diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1200-41ec436fdb8d0e64.js b/litellm/proxy/_experimental/out/_next/static/chunks/1200-64d099608f321062.js similarity index 63% rename from litellm/proxy/_experimental/out/_next/static/chunks/1200-41ec436fdb8d0e64.js rename to litellm/proxy/_experimental/out/_next/static/chunks/1200-64d099608f321062.js index 4adae0f290..52904fccd5 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/1200-41ec436fdb8d0e64.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/1200-64d099608f321062.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1200],{90246:function(e,l,t){t.d(l,{n:function(){return s}});function s(e){let l=[e];return{all:l,lists:()=>[...l,"list"],list:e=>[...l,"list",{params:e}],details:()=>[...l,"detail"],detail:e=>[...l,"detail",e]}}},31200:function(e,l,t){t.d(l,{Z:function(){return lK}});var s=t(57437),a=t(29827),r=t(49804),i=t(67101),n=t(84264),o=t(2265),d=t(9114),c=t(19250),m=t(42673);let u=async(e,l,t)=>{try{var s,a;console.log("handling submit for formValues:",e);let l=e.model_mappings||[];if("model_mappings"in e&&delete e.model_mappings,e.model&&e.model.includes("all-wildcard")){let t=e.custom_llm_provider,a=(null!==(s=m.fK[t])&&void 0!==s?s:t.toLowerCase())+"/*";e.model_name=a,l.push({public_name:a,litellm_model:a}),e.model=a}let t=[];for(let s of l){let l={},r={},i=s.public_name;for(let[t,i]of(l.model=s.litellm_model,e.input_cost_per_token&&(e.input_cost_per_token=Number(e.input_cost_per_token)/1e6),e.output_cost_per_token&&(e.output_cost_per_token=Number(e.output_cost_per_token)/1e6),l.model=s.litellm_model,console.log("formValues add deployment:",e),Object.entries(e)))if(""!==i&&"custom_pricing"!==t&&"pricing_model"!==t&&"cache_control"!==t){if("model_name"==t)l.model=i;else if("custom_llm_provider"==t){console.log("custom_llm_provider:",i);let e=null!==(a=m.fK[i])&&void 0!==a?a:i.toLowerCase();l.custom_llm_provider=e,console.log("custom_llm_provider mappingResult:",e)}else if("model"==t)continue;else if("base_model"===t)r[t]=i;else if("team_id"===t)r.team_id=i;else if("model_access_group"===t)r.access_groups=i;else if("mode"==t)console.log("placing mode in modelInfo"),r.mode=i,delete l.mode;else if("custom_model_name"===t)l.model=i;else if("litellm_extra_params"==t){console.log("litellm_extra_params:",i);let e={};if(i&&void 0!=i){try{e=JSON.parse(i)}catch(e){throw d.Z.fromBackend("Failed to parse LiteLLM Extra Params: "+e),Error("Failed to parse litellm_extra_params: "+e)}for(let[t,s]of Object.entries(e))l[t]=s}}else if("model_info_params"==t){console.log("model_info_params:",i);let e={};if(i&&void 0!=i){try{e=JSON.parse(i)}catch(e){throw d.Z.fromBackend("Failed to parse LiteLLM Extra Params: "+e),Error("Failed to parse litellm_extra_params: "+e)}for(let[l,t]of Object.entries(e))r[l]=t}}else if("input_cost_per_token"===t||"output_cost_per_token"===t||"input_cost_per_second"===t){i&&(l[t]=Number(i));continue}else l[t]=i}t.push({litellmParamsObj:l,modelInfoObj:r,modelName:i})}return t}catch(e){d.Z.fromBackend("Failed to create model: "+e)}},h=async(e,l,t,s)=>{try{let a=await u(e,l,t);if(!a||0===a.length)return;for(let e of a){let{litellmParamsObj:t,modelInfoObj:s,modelName:a}=e,r={model_name:a,litellm_params:t,model_info:s},i=await (0,c.modelCreateCall)(l,r);console.log("response for model create call: ".concat(i.data))}s&&s(),t.resetFields()}catch(e){d.Z.fromBackend("Failed to add model: "+e)}};var x=t(11713),p=t(90246);let g=(0,p.n)("credentials"),f=e=>(0,x.a)({queryKey:g.list({}),queryFn:async()=>await (0,c.credentialListCall)(e),enabled:!!e}),j=(0,p.n)("models");(0,p.n)("modelHub");let v=(e,l,t)=>(0,x.a)({queryKey:j.list({filters:{...l&&{userID:l},...t&&{userRole:t}}}),queryFn:async()=>await (0,c.modelInfoCall)(e,l,t),enabled:!!(e&&l&&t)});var _=t(53410),y=t(74998),b=t(62490),N=t(10032),Z=t(21609),w=t(31283),C=t(57840),S=t(22116),k=t(37592),A=t(99981),E=t(5545);let M=(0,p.n)("providerFields"),I=()=>(0,x.a)({queryKey:M.list({}),queryFn:async()=>await (0,c.getProviderCreateMetadata)(),staleTime:864e5,gcTime:864e5});var F=t(3632),P=t(56522),L=t(47451),T=t(69410),R=t(65319),O=t(4260);let{Link:V}=C.default,D=e=>{var l,t,s,a,r;let i="password"===e.field_type?"password":"select"===e.field_type?"select":"upload"===e.field_type?"upload":"textarea"===e.field_type?"textarea":"text";return{key:e.key,label:e.label,placeholder:null!==(l=e.placeholder)&&void 0!==l?l:void 0,tooltip:null!==(t=e.tooltip)&&void 0!==t?t:void 0,required:null!==(s=e.required)&&void 0!==s&&s,type:i,options:null!==(a=e.options)&&void 0!==a?a:void 0,defaultValue:null!==(r=e.default_value)&&void 0!==r?r:void 0}},z={};var q=e=>{let{selectedProvider:l,uploadProps:t}=e,a=m.Cl[l],r=N.Z.useFormInstance(),{data:i,isLoading:n,error:d}=I(),c=o.useMemo(()=>{if(!i)return null;let e={};return i.forEach(l=>{let t=l.provider_display_name,s=l.credential_fields.map(D);e[t]=s,l.provider&&(e[l.provider]=s),l.litellm_provider&&(e[l.litellm_provider]=s)}),e},[i]);o.useEffect(()=>{c&&Object.assign(z,c)},[c]);let u=o.useMemo(()=>{var e;let t=null!==(e=z[a])&&void 0!==e?e:z[l];if(t)return t;if(!i)return[];let s=i.find(e=>e.provider_display_name===a||e.provider===l||e.litellm_provider===l);if(!s)return[];let r=s.credential_fields.map(D);return z[s.provider_display_name]=r,s.provider&&(z[s.provider]=r),s.litellm_provider&&(z[s.litellm_provider]=r),r},[a,l,i]),h={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;console.log("Setting field value from JSON, length: ".concat(l.length)),r.setFieldsValue({vertex_credentials:l}),console.log("Form values after setting:",r.getFieldsValue())}},l.readAsText(e)}return!1},onChange(e){console.log("Upload onChange triggered in ProviderSpecificFields"),console.log("Current form values:",r.getFieldsValue()),"uploading"!==e.file.status&&console.log(e.file,e.fileList)}};return(0,s.jsxs)(s.Fragment,{children:[n&&0===u.length&&(0,s.jsx)(L.Z,{children:(0,s.jsx)(T.Z,{span:24,children:(0,s.jsx)(P.x,{className:"mb-2",children:"Loading provider fields..."})})}),d&&0===u.length&&(0,s.jsx)(L.Z,{children:(0,s.jsx)(T.Z,{span:24,children:(0,s.jsx)(P.x,{className:"mb-2 text-red-500",children:d instanceof Error?d.message:"Failed to load provider credential fields"})})}),u.map(e=>{var l;return(0,s.jsxs)(o.Fragment,{children:[(0,s.jsx)(N.Z.Item,{label:e.label,name:e.key,rules:e.required?[{required:!0,message:"Required"}]:void 0,tooltip:e.tooltip,className:"vertex_credentials"===e.key?"mb-0":void 0,children:"select"===e.type?(0,s.jsx)(k.default,{placeholder:e.placeholder,defaultValue:e.defaultValue,children:null===(l=e.options)||void 0===l?void 0:l.map(e=>(0,s.jsx)(k.default.Option,{value:e,children:e},e))}):"upload"===e.type?(0,s.jsx)(R.default,{...h,onChange:l=>{(null==t?void 0:t.onChange)&&t.onChange(l),setTimeout(()=>{let l=r.getFieldValue(e.key);console.log("".concat(e.key," value after upload:"),JSON.stringify(l))},500)},children:(0,s.jsx)(E.ZP,{icon:(0,s.jsx)(F.Z,{}),children:"Click to Upload"})}):"textarea"===e.type?(0,s.jsx)(O.default.TextArea,{placeholder:e.placeholder,defaultValue:e.defaultValue,rows:6,style:{fontFamily:"monospace",fontSize:"12px"}}):(0,s.jsx)(P.o,{placeholder:e.placeholder,type:"password"===e.type?"password":"text",defaultValue:e.defaultValue})}),"vertex_credentials"===e.key&&(0,s.jsx)(L.Z,{children:(0,s.jsx)(T.Z,{children:(0,s.jsx)(P.x,{className:"mb-3 mt-1",children:"Give a gcp service account(.json file)"})})}),"base_model"===e.key&&(0,s.jsxs)(L.Z,{children:[(0,s.jsx)(T.Z,{span:10}),(0,s.jsx)(T.Z,{span:10,children:(0,s.jsxs)(P.x,{className:"mb-2",children:["The actual model your azure deployment uses. Used for accurate cost tracking. Select name from"," ",(0,s.jsx)(V,{href:"https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json",target:"_blank",children:"here"})]})})]})]},e.key)})]})};let{Link:B}=C.default;var U=e=>{let{open:l,onCancel:t,onAddCredential:a,uploadProps:r}=e,[i]=N.Z.useForm(),[n,d]=(0,o.useState)(m.Cl.OpenAI);return(0,s.jsx)(S.Z,{title:"Add New Credential",open:l,onCancel:()=>{t(),i.resetFields()},footer:null,width:600,children:(0,s.jsxs)(N.Z,{form:i,onFinish:e=>{a(Object.entries(e).reduce((e,l)=>{let[t,s]=l;return""!==s&&null!=s&&(e[t]=s),e},{})),i.resetFields()},layout:"vertical",children:[(0,s.jsx)(N.Z.Item,{label:"Credential Name:",name:"credential_name",rules:[{required:!0,message:"Credential name is required"}],children:(0,s.jsx)(w.o,{placeholder:"Enter a friendly name for these credentials"})}),(0,s.jsx)(N.Z.Item,{rules:[{required:!0,message:"Required"}],label:"Provider:",name:"custom_llm_provider",tooltip:"Helper to auto-populate provider specific fields",children:(0,s.jsx)(k.default,{showSearch:!0,onChange:e=>{d(e),i.setFieldValue("custom_llm_provider",e)},children:Object.entries(m.Cl).map(e=>{let[l,t]=e;return(0,s.jsx)(k.default.Option,{value:l,children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("img",{src:m.cd[t],alt:"".concat(l," logo"),className:"w-5 h-5",onError:e=>{let l=e.target,s=l.parentElement;if(s){let e=document.createElement("div");e.className="w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=t.charAt(0),s.replaceChild(e,l)}}}),(0,s.jsx)("span",{children:t})]})},l)})})}),(0,s.jsx)(q,{selectedProvider:n,uploadProps:r}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(A.Z,{title:"Get help on our github",children:(0,s.jsx)(B,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)(E.ZP,{onClick:()=>{t(),i.resetFields()},style:{marginRight:10},children:"Cancel"}),(0,s.jsx)(E.ZP,{htmlType:"submit",children:"Add Credential"})]})]})]})})};let{Link:G}=C.default;function H(e){let{open:l,onCancel:t,onUpdateCredential:a,uploadProps:r,existingCredential:i}=e,[n]=N.Z.useForm(),[d,c]=(0,o.useState)(m.Cl.Anthropic);return(0,o.useEffect)(()=>{if(i){let e=Object.entries(i.credential_values||{}).reduce((e,l)=>{let[t,s]=l;return e[t]=null!=s?s:null,e},{});n.setFieldsValue({credential_name:i.credential_name,custom_llm_provider:i.credential_info.custom_llm_provider,...e}),c(i.credential_info.custom_llm_provider)}},[i]),(0,s.jsx)(S.Z,{title:"Edit Credential",open:l,onCancel:()=>{t(),n.resetFields()},footer:null,width:600,destroyOnHidden:!0,children:(0,s.jsxs)(N.Z,{form:n,onFinish:e=>{a(Object.entries(e).reduce((e,l)=>{let[t,s]=l;return""!==s&&null!=s&&(e[t]=s),e},{})),n.resetFields()},layout:"vertical",children:[(0,s.jsx)(N.Z.Item,{label:"Credential Name:",name:"credential_name",rules:[{required:!0,message:"Credential name is required"}],initialValue:null==i?void 0:i.credential_name,children:(0,s.jsx)(w.o,{placeholder:"Enter a friendly name for these credentials",disabled:null!=i&&!!i.credential_name})}),(0,s.jsx)(N.Z.Item,{rules:[{required:!0,message:"Required"}],label:"Provider:",name:"custom_llm_provider",tooltip:"Helper to auto-populate provider specific fields",children:(0,s.jsx)(k.default,{showSearch:!0,onChange:e=>{c(e),n.setFieldValue("custom_llm_provider",e)},children:Object.entries(m.Cl).map(e=>{let[l,t]=e;return(0,s.jsx)(k.default.Option,{value:l,children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("img",{src:m.cd[t],alt:"".concat(l," logo"),className:"w-5 h-5",onError:e=>{let l=e.target,s=l.parentElement;if(s){let e=document.createElement("div");e.className="w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=t.charAt(0),s.replaceChild(e,l)}}}),(0,s.jsx)("span",{children:t})]})},l)})})}),(0,s.jsx)(q,{selectedProvider:d,uploadProps:r}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(A.Z,{title:"Get help on our github",children:(0,s.jsx)(G,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)(E.ZP,{onClick:()=>{t(),n.resetFields()},style:{marginRight:10},children:"Cancel"}),(0,s.jsx)(E.ZP,{htmlType:"submit",children:"Update Credential"})]})]})]})})}var K=t(80443),J=e=>{var l;let{uploadProps:t}=e,{accessToken:a}=(0,K.Z)(),{data:r,refetch:i}=f(a),n=(null==r?void 0:r.credentials)||[],[m,u]=(0,o.useState)(!1),[h,x]=(0,o.useState)(!1),[p,g]=(0,o.useState)(null),[j,v]=(0,o.useState)(null),[w,C]=(0,o.useState)(!1),[S,k]=(0,o.useState)(!1),[A]=N.Z.useForm(),E=["credential_name","custom_llm_provider"],M=async e=>{if(!a)return;let l=Object.entries(e).filter(e=>{let[l]=e;return!E.includes(l)}).reduce((e,l)=>{let[t,s]=l;return{...e,[t]:s}},{}),t={credential_name:e.credential_name,credential_values:l,credential_info:{custom_llm_provider:e.custom_llm_provider}};await (0,c.credentialUpdateCall)(a,e.credential_name,t),d.Z.success("Credential updated successfully"),x(!1),await i()},I=async e=>{if(!a)return;let l=Object.entries(e).filter(e=>{let[l]=e;return!E.includes(l)}).reduce((e,l)=>{let[t,s]=l;return{...e,[t]:s}},{}),t={credential_name:e.credential_name,credential_values:l,credential_info:{custom_llm_provider:e.custom_llm_provider}};await (0,c.credentialCreateCall)(a,t),d.Z.success("Credential added successfully"),u(!1),await i()},F=e=>{let l={openai:"blue",azure:"indigo",anthropic:"purple",default:"gray"},t=l[e.toLowerCase()]||l.default;return(0,s.jsx)(b.Ct,{color:t,size:"xs",children:e})},P=async()=>{if(a&&j){k(!0);try{await (0,c.credentialDeleteCall)(a,j.credential_name),d.Z.success("Credential deleted successfully"),await i()}catch(e){d.Z.error("Failed to delete credential")}finally{v(null),C(!1),k(!1)}}},L=e=>{v(e),C(!0)};return(0,s.jsxs)("div",{className:"w-full mx-auto flex-auto overflow-y-auto p-2",children:[(0,s.jsx)(b.zx,{onClick:()=>u(!0),children:"Add Credential"}),(0,s.jsx)("div",{className:"flex justify-between items-center mt-4 mb-4",children:(0,s.jsx)(b.xv,{children:"Configured credentials for different AI providers. Add and manage your API credentials."})}),(0,s.jsx)(b.Zb,{children:(0,s.jsxs)(b.iA,{children:[(0,s.jsx)(b.ss,{children:(0,s.jsxs)(b.SC,{children:[(0,s.jsx)(b.xs,{children:"Credential Name"}),(0,s.jsx)(b.xs,{children:"Provider"}),(0,s.jsx)(b.xs,{children:"Actions"})]})}),(0,s.jsx)(b.RM,{children:n&&0!==n.length?n.map((e,l)=>{var t;return(0,s.jsxs)(b.SC,{children:[(0,s.jsx)(b.pj,{children:e.credential_name}),(0,s.jsx)(b.pj,{children:F((null===(t=e.credential_info)||void 0===t?void 0:t.custom_llm_provider)||"-")}),(0,s.jsxs)(b.pj,{children:[(0,s.jsx)(b.zx,{icon:_.Z,variant:"light",size:"sm",onClick:()=>{g(e),x(!0)}}),(0,s.jsx)(b.zx,{icon:y.Z,variant:"light",size:"sm",onClick:()=>L(e),className:"ml-2"})]})]},l)}):(0,s.jsx)(b.SC,{children:(0,s.jsx)(b.pj,{colSpan:4,className:"text-center py-4 text-gray-500",children:"No credentials configured"})})})]})}),m&&(0,s.jsx)(U,{onAddCredential:I,open:m,onCancel:()=>u(!1),uploadProps:t}),h&&(0,s.jsx)(H,{open:h,existingCredential:p,onUpdateCredential:M,uploadProps:t,onCancel:()=>x(!1)}),(0,s.jsx)(Z.Z,{isOpen:w,onCancel:()=>{v(null),C(!1)},onOk:P,title:"Delete Credential?",message:"Are you sure you want to delete this credential? This action cannot be undone and may break existing integrations.",resourceInformationTitle:"Credential Information",resourceInformation:[{label:"Credential Name",value:null==j?void 0:j.credential_name},{label:"Provider",value:(null==j?void 0:null===(l=j.credential_info)||void 0===l?void 0:l.custom_llm_provider)||"-"}],confirmLoading:S,requiredConfirmation:null==j?void 0:j.credential_name})]})};let W=e=>{var l;return(null==e?void 0:null===(l=e.model_info)||void 0===l?void 0:l.team_public_model_name)?e.model_info.team_public_model_name:(null==e?void 0:e.model_name)||"-"};var Y=t(23628),$=t(47323),Q=t(12485),X=t(18135),ee=t(35242),el=t(29706),et=t(77991),es=t(20347),ea=t(59341),er=t(5945),ei=t(84376),en=t(29),eo=t.n(en),ed=t(23496),ec=t(35291),em=t(23639),eu=t(15424);let{Text:eh}=C.default;var ex=e=>{let{formValues:l,accessToken:t,testMode:a,modelName:r="this model",onClose:i,onTestComplete:n}=e,[m,h]=o.useState(null),[x,p]=o.useState(null),[g,f]=o.useState(null),[j,v]=o.useState(!0),[_,y]=o.useState(!1),[b,N]=o.useState(!1),Z=async()=>{v(!0),N(!1),h(null),p(null),f(null),y(!1),await new Promise(e=>setTimeout(e,100));try{console.log("Testing connection with form values:",l);let a=await u(l,t,null);if(!a){console.log("No result from prepareModelAddRequest"),h("Failed to prepare model data. Please check your form inputs."),y(!1),v(!1);return}console.log("Result from prepareModelAddRequest:",a);let{litellmParamsObj:r,modelInfoObj:i,modelName:n}=a[0],o=await (0,c.testConnectionRequest)(t,r,i,null==i?void 0:i.mode);if("success"===o.status)d.Z.success("Connection test successful!"),h(null),y(!0);else{var e,s;let l=(null===(e=o.result)||void 0===e?void 0:e.error)||o.message||"Unknown error";h(l),p(r),f(null===(s=o.result)||void 0===s?void 0:s.raw_request_typed_dict),y(!1)}}catch(e){console.error("Test connection error:",e),h(e instanceof Error?e.message:String(e)),y(!1)}finally{v(!1),n&&n()}};o.useEffect(()=>{let e=setTimeout(()=>{Z()},200);return()=>clearTimeout(e)},[]);let w=e=>e?e.split("stack trace:")[0].trim().replace(/^litellm\.(.*?)Error: /,""):"Unknown error",C="string"==typeof m?w(m):(null==m?void 0:m.message)?w(m.message):"Unknown error",S=g?((e,l,t)=>{let s=JSON.stringify(l,null,2).split("\n").map(e=>" ".concat(e)).join("\n"),a=Object.entries(t).map(e=>{let[l,t]=e;return"-H '".concat(l,": ").concat(t,"'")}).join(" \\\n ");return"curl -X POST \\\n ".concat(e," \\\n ").concat(a?"".concat(a," \\\n "):"","-H 'Content-Type: application/json' \\\n -d '{\n").concat(s,"\n }'")})(g.raw_request_api_base,g.raw_request_body,g.raw_request_headers||{}):"";return(0,s.jsxs)("div",{style:{padding:"24px",borderRadius:"8px",backgroundColor:"#fff"},children:[j?(0,s.jsxs)("div",{style:{textAlign:"center",padding:"32px 20px"},className:"jsx-dc9a0e2d897fe63b",children:[(0,s.jsx)("div",{style:{marginBottom:"16px"},className:"jsx-dc9a0e2d897fe63b loading-spinner",children:(0,s.jsx)("div",{style:{border:"3px solid #f3f3f3",borderTop:"3px solid #1890ff",borderRadius:"50%",width:"30px",height:"30px",animation:"spin 1s linear infinite",margin:"0 auto"},className:"jsx-dc9a0e2d897fe63b"})}),(0,s.jsxs)(eh,{style:{fontSize:"16px"},children:["Testing connection to ",r,"..."]}),(0,s.jsx)(eo(),{id:"dc9a0e2d897fe63b",children:"@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-moz-keyframes spin{0%{-moz-transform:rotate(0deg);transform:rotate(0deg)}100%{-moz-transform:rotate(360deg);transform:rotate(360deg)}}@-o-keyframes spin{0%{-o-transform:rotate(0deg);transform:rotate(0deg)}100%{-o-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes spin{0%{-webkit-transform:rotate(0deg);-moz-transform:rotate(0deg);-o-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);-moz-transform:rotate(360deg);-o-transform:rotate(360deg);transform:rotate(360deg)}}"})]}):_?(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"32px 20px"},children:[(0,s.jsx)("div",{style:{color:"#52c41a",fontSize:"24px",display:"flex",alignItems:"center"},children:(0,s.jsx)("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"check-circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:(0,s.jsx)("path",{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 01-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z"})})}),(0,s.jsxs)(eh,{type:"success",style:{fontSize:"18px",fontWeight:500,marginLeft:"10px"},children:["Connection to ",r," successful!"]})]}):(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",marginBottom:"20px"},children:[(0,s.jsx)(ec.Z,{style:{color:"#ff4d4f",fontSize:"24px",marginRight:"12px"}}),(0,s.jsxs)(eh,{type:"danger",style:{fontSize:"18px",fontWeight:500},children:["Connection to ",r," failed"]})]}),(0,s.jsxs)("div",{style:{backgroundColor:"#fff2f0",border:"1px solid #ffccc7",borderRadius:"8px",padding:"16px",marginBottom:"20px",boxShadow:"0 1px 2px rgba(0, 0, 0, 0.03)"},children:[(0,s.jsxs)(eh,{strong:!0,style:{display:"block",marginBottom:"8px"},children:["Error:"," "]}),(0,s.jsx)(eh,{type:"danger",style:{fontSize:"14px",lineHeight:"1.5"},children:C}),m&&(0,s.jsx)("div",{style:{marginTop:"12px"},children:(0,s.jsx)(E.ZP,{type:"link",onClick:()=>N(!b),style:{paddingLeft:0,height:"auto"},children:b?"Hide Details":"Show Details"})})]}),b&&(0,s.jsxs)("div",{style:{marginBottom:"20px"},children:[(0,s.jsx)(eh,{strong:!0,style:{display:"block",marginBottom:"8px",fontSize:"15px"},children:"Troubleshooting Details"}),(0,s.jsx)("pre",{style:{backgroundColor:"#f5f5f5",padding:"16px",borderRadius:"8px",fontSize:"13px",maxHeight:"200px",overflow:"auto",border:"1px solid #e8e8e8",lineHeight:"1.5"},children:"string"==typeof m?m:JSON.stringify(m,null,2)})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(eh,{strong:!0,style:{display:"block",marginBottom:"8px",fontSize:"15px"},children:"API Request"}),(0,s.jsx)("pre",{style:{backgroundColor:"#f5f5f5",padding:"16px",borderRadius:"8px",fontSize:"13px",maxHeight:"250px",overflow:"auto",border:"1px solid #e8e8e8",lineHeight:"1.5"},children:S||"No request data available"}),(0,s.jsx)(E.ZP,{style:{marginTop:"8px"},icon:(0,s.jsx)(em.Z,{}),onClick:()=>{navigator.clipboard.writeText(S||""),d.Z.success("Copied to clipboard")},children:"Copy to Clipboard"})]})]})}),(0,s.jsx)(ed.Z,{style:{margin:"24px 0 16px"}}),(0,s.jsx)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:(0,s.jsx)(E.ZP,{type:"link",href:"https://docs.litellm.ai/docs/providers",target:"_blank",icon:(0,s.jsx)(eu.Z,{}),children:"View Documentation"})})]})};let ep=async(e,l,t,s)=>{try{console.log("=== AUTO ROUTER SUBMIT HANDLER CALLED ==="),console.log("handling auto router submit for formValues:",e),console.log("Access token:",l?"Present":"Missing"),console.log("Form:",t?"Present":"Missing"),console.log("Callback:",s?"Present":"Missing");let a={model_name:e.auto_router_name,litellm_params:{model:"auto_router/".concat(e.auto_router_name),auto_router_config:JSON.stringify(e.auto_router_config),auto_router_default_model:e.auto_router_default_model},model_info:{}};e.auto_router_embedding_model&&"custom"!==e.auto_router_embedding_model?a.litellm_params.auto_router_embedding_model=e.auto_router_embedding_model:e.custom_embedding_model&&(a.litellm_params.auto_router_embedding_model=e.custom_embedding_model),e.team_id&&(a.model_info.team_id=e.team_id),e.model_access_group&&e.model_access_group.length>0&&(a.model_info.access_groups=e.model_access_group),console.log("Auto router configuration to be created:",a),console.log("Auto router config (stringified):",a.litellm_params.auto_router_config),console.log("Calling modelCreateCall with:",{accessToken:l?"Present":"Missing",config:a});let r=await (0,c.modelCreateCall)(l,a);console.log("response for auto router create call:",r),t.resetFields()}catch(e){console.error("Failed to add auto router:",e),d.Z.fromBackend("Failed to add auto router: "+e)}};var eg=t(10703),ef=t(44851),ej=t(19015),ev=t(96473),e_=t(70464),ey=t(26349),eb=t(92280);let{TextArea:eN}=O.default,{Panel:eZ}=ef.default;var ew=e=>{let{modelInfo:l,value:t,onChange:a}=e,[r,i]=(0,o.useState)([]),[n,d]=(0,o.useState)(!1),[c,m]=(0,o.useState)([]);(0,o.useEffect)(()=>{if(null==t?void 0:t.routes){let e=t.routes.map((e,l)=>({id:e.id||"route-".concat(l,"-").concat(Date.now()),model:e.name||e.model||"",utterances:e.utterances||[],description:e.description||"",score_threshold:e.score_threshold||.5}));i(e),m(e.map(e=>e.id))}else i([]),m([])},[t]);let u=e=>{let l=r.filter(l=>l.id!==e);i(l),x(l),m(l=>l.filter(l=>l!==e))},h=(e,l,t)=>{let s=r.map(s=>s.id===e?{...s,[l]:t}:s);i(s),x(s)},x=e=>{let l={routes:e.map(e=>({name:e.model,utterances:e.utterances,description:e.description,score_threshold:e.score_threshold}))};null==a||a(l)},p=l.map(e=>({value:e.model_group,label:e.model_group}));return(0,s.jsxs)("div",{className:"w-full max-w-none",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-6 w-full",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(eb.x,{className:"text-lg font-semibold",children:"Routes Configuration"}),(0,s.jsx)(A.Z,{title:"Configure routing logic to automatically select the best model based on user input patterns",children:(0,s.jsx)(eu.Z,{className:"text-gray-400"})})]}),(0,s.jsx)(E.ZP,{type:"primary",icon:(0,s.jsx)(ev.Z,{}),onClick:()=>{let e="route-".concat(Date.now()),l=[...r,{id:e,model:"",utterances:[],description:"",score_threshold:.5}];i(l),x(l),m(l=>[...l,e])},className:"bg-blue-600 hover:bg-blue-700",children:"Add Route"})]}),0===r.length?(0,s.jsx)("div",{className:"text-center py-12 text-gray-500 bg-gray-50 rounded-lg border-2 border-dashed border-gray-200 mb-6",children:(0,s.jsx)(eb.x,{children:"No routes configured. Click “Add Route” to get started."})}):(0,s.jsx)("div",{className:"space-y-3 mb-6 w-full",children:r.map((e,l)=>(0,s.jsx)(er.Z,{className:"border border-gray-200 shadow-sm w-full",bodyStyle:{padding:0},children:(0,s.jsx)(ef.default,{ghost:!0,expandIcon:e=>{let{isActive:l}=e;return(0,s.jsx)(e_.Z,{rotate:l?180:0})},activeKey:c,onChange:e=>m(Array.isArray(e)?e:[e].filter(Boolean)),items:[{key:e.id,label:(0,s.jsxs)("div",{className:"flex justify-between items-center py-2",children:[(0,s.jsxs)(eb.x,{className:"font-medium text-base",children:["Route ",l+1,": ",e.model||"Unnamed"]}),(0,s.jsx)(E.ZP,{type:"text",danger:!0,icon:(0,s.jsx)(ey.Z,{}),onClick:l=>{l.stopPropagation(),u(e.id)},className:"mr-2"})]}),children:(0,s.jsxs)("div",{className:"px-6 pb-6 w-full",children:[(0,s.jsxs)("div",{className:"mb-4 w-full",children:[(0,s.jsx)(eb.x,{className:"text-sm font-medium mb-2 block",children:"Model"}),(0,s.jsx)(k.default,{value:e.model,onChange:l=>h(e.id,"model",l),placeholder:"Select model",showSearch:!0,style:{width:"100%"},options:p})]}),(0,s.jsxs)("div",{className:"mb-4 w-full",children:[(0,s.jsx)(eb.x,{className:"text-sm font-medium mb-2 block",children:"Description"}),(0,s.jsx)(eN,{value:e.description,onChange:l=>h(e.id,"description",l.target.value),placeholder:"Describe when this route should be used...",rows:2,style:{width:"100%"}})]}),(0,s.jsxs)("div",{className:"mb-4 w-full",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,s.jsx)(eb.x,{className:"text-sm font-medium",children:"Score Threshold"}),(0,s.jsx)(A.Z,{title:"Minimum similarity score to route to this model (0-1)",children:(0,s.jsx)(eu.Z,{className:"text-gray-400"})})]}),(0,s.jsx)(ej.Z,{value:e.score_threshold,onChange:l=>h(e.id,"score_threshold",l||0),min:0,max:1,step:.1,style:{width:"100%"},placeholder:"0.5"})]}),(0,s.jsxs)("div",{className:"w-full",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,s.jsx)(eb.x,{className:"text-sm font-medium",children:"Example Utterances"}),(0,s.jsx)(A.Z,{title:"Training examples for this route. Type an utterance and press Enter to add it.",children:(0,s.jsx)(eu.Z,{className:"text-gray-400"})})]}),(0,s.jsx)(eb.x,{className:"text-xs text-gray-500 mb-2",children:"Type an utterance and press Enter to add it. You can also paste multiple lines."}),(0,s.jsx)(k.default,{mode:"tags",value:e.utterances,onChange:l=>h(e.id,"utterances",l),placeholder:"Type an utterance and press Enter...",style:{width:"100%"},tokenSeparators:["\n"],maxTagCount:"responsive",allowClear:!0})]})]})}]})},e.id))}),(0,s.jsxs)("div",{className:"border-t pt-6 w-full",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4 w-full",children:[(0,s.jsx)(eb.x,{className:"text-lg font-semibold",children:"JSON Preview"}),(0,s.jsx)(E.ZP,{type:"link",onClick:()=>d(!n),className:"text-blue-600 p-0",children:n?"Hide":"Show"})]}),n&&(0,s.jsx)(er.Z,{className:"bg-gray-50 w-full",children:(0,s.jsx)("pre",{className:"text-sm overflow-auto max-h-64 w-full",children:JSON.stringify({routes:r.map(e=>({name:e.model,utterances:e.utterances,description:e.description,score_threshold:e.score_threshold}))},null,2)})})]})]})};let{Title:eC,Link:eS}=C.default;var ek=e=>{let{form:l,handleOk:t,accessToken:a,userRole:r}=e,[i,n]=(0,o.useState)(!1),[m,u]=(0,o.useState)(!1),[h,x]=(0,o.useState)(""),[p,g]=(0,o.useState)([]),[f,j]=(0,o.useState)([]),[v,_]=(0,o.useState)(!1),[y,b]=(0,o.useState)(!1),[Z,w]=(0,o.useState)(null);(0,o.useEffect)(()=>{(async()=>{g((await (0,c.modelAvailableCall)(a,"","",!1,null,!0,!0)).data.map(e=>e.id))})()},[a]),(0,o.useEffect)(()=>{(async()=>{try{let e=await (0,eg.p)(a);console.log("Fetched models for auto router:",e),j(e)}catch(e){console.error("Error fetching model info for auto router:",e)}})()},[a]);let M=es.ZL.includes(r),I=async()=>{u(!0),x("test-".concat(Date.now())),n(!0)},F=()=>{console.log("Auto router submit triggered!"),console.log("Router config:",Z);let e=l.getFieldsValue();if(console.log("Form values:",e),!e.auto_router_name){d.Z.fromBackend("Please enter an Auto Router Name");return}if(!e.auto_router_default_model){d.Z.fromBackend("Please select a Default Model");return}if(l.setFieldsValue({custom_llm_provider:"auto_router",model:e.auto_router_name,api_key:"not_required_for_auto_router"}),!Z||!Z.routes||0===Z.routes.length){d.Z.fromBackend("Please configure at least one route for the auto router");return}if(Z.routes.filter(e=>!e.name||!e.description||0===e.utterances.length).length>0){d.Z.fromBackend("Please ensure all routes have a target model, description, and at least one utterance");return}l.validateFields().then(e=>{console.log("Form validation passed, submitting with values:",e);let s={...e,auto_router_config:Z};console.log("Final submit values:",s),ep(s,a,l,t)}).catch(e=>{console.error("Validation failed:",e);let l=e.errorFields||[];if(l.length>0){let e=l.map(e=>{let l=e.name[0];return({auto_router_name:"Auto Router Name",auto_router_default_model:"Default Model",auto_router_embedding_model:"Embedding Model"})[l]||l});d.Z.fromBackend("Please fill in the following required fields: ".concat(e.join(", ")))}else d.Z.fromBackend("Please fill in all required fields")})};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(eC,{level:2,children:"Add Auto Router"}),(0,s.jsx)(P.x,{className:"text-gray-600 mb-6",children:"Create an auto router with intelligent routing logic that automatically selects the best model based on user input patterns and semantic matching."}),(0,s.jsx)(er.Z,{children:(0,s.jsxs)(N.Z,{form:l,onFinish:F,labelCol:{span:10},wrapperCol:{span:16},labelAlign:"left",children:[(0,s.jsx)(N.Z.Item,{rules:[{required:!0,message:"Auto router name is required"}],label:"Auto Router Name",name:"auto_router_name",tooltip:"Unique name for this auto router configuration",labelCol:{span:10},labelAlign:"left",children:(0,s.jsx)(P.o,{placeholder:"e.g., auto_router_1, smart_routing"})}),(0,s.jsx)("div",{className:"w-full mb-4",children:(0,s.jsx)(ew,{modelInfo:f,value:Z,onChange:e=>{w(e),l.setFieldValue("auto_router_config",e)}})}),(0,s.jsx)(N.Z.Item,{rules:[{required:!0,message:"Default model is required"}],label:"Default Model",name:"auto_router_default_model",tooltip:"Fallback model to use when auto routing logic cannot determine the best model",labelCol:{span:10},labelAlign:"left",children:(0,s.jsx)(k.default,{placeholder:"Select a default model",onChange:e=>{_("custom"===e)},options:[...Array.from(new Set(f.map(e=>e.model_group))).map(e=>({value:e,label:e})),{value:"custom",label:"Enter custom model name"}],style:{width:"100%"},showSearch:!0})}),(0,s.jsx)(N.Z.Item,{label:"Embedding Model",name:"auto_router_embedding_model",tooltip:"Optional: Embedding model to use for semantic routing decisions",labelCol:{span:10},labelAlign:"left",children:(0,s.jsx)(k.default,{value:l.getFieldValue("auto_router_embedding_model"),placeholder:"Select an embedding model (optional)",onChange:e=>{b("custom"===e),l.setFieldValue("auto_router_embedding_model",e)},options:[...Array.from(new Set(f.map(e=>e.model_group))).map(e=>({value:e,label:e})),{value:"custom",label:"Enter custom model name"}],style:{width:"100%"},showSearch:!0,allowClear:!0})}),(0,s.jsxs)("div",{className:"flex items-center my-4",children:[(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"}),(0,s.jsx)("span",{className:"px-4 text-gray-500 text-sm",children:"Additional Settings"}),(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"})]}),M&&(0,s.jsx)(N.Z.Item,{label:"Model Access Group",name:"model_access_group",className:"mb-4",tooltip:"Use model access groups to control who can access this auto router",children:(0,s.jsx)(k.default,{mode:"tags",showSearch:!0,placeholder:"Select existing groups or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],options:p.map(e=>({value:e,label:e})),maxTagCount:"responsive",allowClear:!0})}),(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,s.jsx)(A.Z,{title:"Get help on our github",children:(0,s.jsx)(C.default.Link,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})}),(0,s.jsxs)("div",{className:"space-x-2",children:[(0,s.jsx)(E.ZP,{onClick:I,loading:m,children:"Test Connect"}),(0,s.jsx)(E.ZP,{onClick:()=>{console.log("Add Auto Router button clicked!"),console.log("Current router config:",Z),console.log("Current form values:",l.getFieldsValue()),F()},children:"Add Auto Router"})]})]})]})}),(0,s.jsx)(S.Z,{title:"Connection Test Results",open:i,onCancel:()=>{n(!1),u(!1)},footer:[(0,s.jsx)(E.ZP,{onClick:()=>{n(!1),u(!1)},children:"Close"},"close")],width:700,children:i&&(0,s.jsx)(ex,{formValues:l.getFieldsValue(),accessToken:a,testMode:"chat",modelName:l.getFieldValue("auto_router_name"),onClose:()=>{n(!1),u(!1)},onTestComplete:()=>u(!1)},h)})]})};let eA=[{value:"chat",label:"Chat - /chat/completions"},{value:"completion",label:"Completion - /completions"},{value:"embedding",label:"Embedding - /embeddings"},{value:"audio_speech",label:"Audio Speech - /audio/speech"},{value:"audio_transcription",label:"Audio Transcription - /audio/transcriptions"},{value:"image_generation",label:"Image Generation - /images/generations"},{value:"video_generation",label:"Video Generation - /videos"},{value:"rerank",label:"Rerank - /rerank"},{value:"realtime",label:"Realtime - /realtime"},{value:"batch",label:"Batch - /batch"},{value:"ocr",label:"OCR - /ocr"}];var eE=t(63709),eM=t(26210),eI=t(34766),eF=t(45246),eP=t(24199);let{Text:eL}=C.default;var eT=e=>{let{form:l,showCacheControl:t,onCacheControlChange:a}=e,r=e=>{let t=l.getFieldValue("litellm_extra_params");try{let s=t?JSON.parse(t):{};e.length>0?s.cache_control_injection_points=e:delete s.cache_control_injection_points,Object.keys(s).length>0?l.setFieldValue("litellm_extra_params",JSON.stringify(s,null,2)):l.setFieldValue("litellm_extra_params","")}catch(e){console.error("Error updating cache control points:",e)}};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(N.Z.Item,{label:"Cache Control Injection Points",name:"cache_control",valuePropName:"checked",className:"mb-4",tooltip:"Tell litellm where to inject cache control checkpoints. You can specify either by role (to apply to all messages of that role) or by specific message index.",children:(0,s.jsx)(eE.Z,{onChange:a,className:"bg-gray-600"})}),t&&(0,s.jsxs)("div",{className:"ml-6 pl-4 border-l-2 border-gray-200",children:[(0,s.jsx)(eL,{className:"text-sm text-gray-500 block mb-4",children:"Providers like Anthropic, Bedrock API require users to specify where to inject cache control checkpoints, litellm can automatically add them for you as a cost saving feature."}),(0,s.jsx)(N.Z.List,{name:"cache_control_injection_points",initialValue:[{location:"message"}],children:(e,t)=>{let{add:a,remove:i}=t;return(0,s.jsxs)(s.Fragment,{children:[e.map((t,a)=>(0,s.jsxs)("div",{className:"flex items-center mb-4 gap-4",children:[(0,s.jsx)(N.Z.Item,{...t,label:"Type",name:[t.name,"location"],initialValue:"message",className:"mb-0",style:{width:"180px"},children:(0,s.jsx)(k.default,{disabled:!0,options:[{value:"message",label:"Message"}]})}),(0,s.jsx)(N.Z.Item,{...t,label:"Role",name:[t.name,"role"],className:"mb-0",style:{width:"180px"},tooltip:"LiteLLM will mark all messages of this role as cacheable",children:(0,s.jsx)(k.default,{placeholder:"Select a role",allowClear:!0,options:[{value:"user",label:"User"},{value:"system",label:"System"},{value:"assistant",label:"Assistant"}],onChange:()=>{r(l.getFieldValue("cache_control_points"))}})}),(0,s.jsx)(N.Z.Item,{...t,label:"Index",name:[t.name,"index"],className:"mb-0",style:{width:"180px"},tooltip:"(Optional) If set litellm will mark the message at this index as cacheable",children:(0,s.jsx)(eP.Z,{type:"number",placeholder:"Optional",step:1,onChange:()=>{r(l.getFieldValue("cache_control_points"))}})}),e.length>1&&(0,s.jsx)(eF.Z,{className:"text-red-500 cursor-pointer text-lg ml-12",onClick:()=>{i(t.name),setTimeout(()=>{r(l.getFieldValue("cache_control_points"))},0)}})]},t.key)),(0,s.jsx)(N.Z.Item,{children:(0,s.jsxs)("button",{type:"button",className:"flex items-center justify-center w-full border border-dashed border-gray-300 py-2 px-4 text-gray-600 hover:text-blue-600 hover:border-blue-300 transition-all rounded",onClick:()=>a(),children:[(0,s.jsx)(ev.Z,{className:"mr-2"}),"Add Injection Point"]})})]})}})]})]})},eR=t(9309);let{Link:eO}=C.default;var eV=e=>{let{showAdvancedSettings:l,setShowAdvancedSettings:t,teams:a,guardrailsList:r,tagsList:i}=e,[n]=N.Z.useForm(),[d,c]=o.useState(!1),[m,u]=o.useState("per_token"),[h,x]=o.useState(!1),p=(e,l)=>l&&(isNaN(Number(l))||0>Number(l))?Promise.reject("Please enter a valid positive number"):Promise.resolve();return(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)(eM.UQ,{className:"mt-2 mb-4",children:[(0,s.jsx)(eM._m,{children:(0,s.jsx)("b",{children:"Advanced Settings"})}),(0,s.jsx)(eM.X1,{children:(0,s.jsxs)("div",{className:"bg-white rounded-lg",children:[(0,s.jsx)(N.Z.Item,{label:"Custom Pricing",name:"custom_pricing",valuePropName:"checked",className:"mb-4",children:(0,s.jsx)(eE.Z,{onChange:e=>{c(e),e||n.setFieldsValue({input_cost_per_token:void 0,output_cost_per_token:void 0,input_cost_per_second:void 0})},className:"bg-gray-600"})}),(0,s.jsx)(N.Z.Item,{label:(0,s.jsxs)("span",{children:["Guardrails"," ",(0,s.jsx)(A.Z,{title:"Apply safety guardrails to this key to filter content or enforce policies",children:(0,s.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/quick_start",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,s.jsx)(eu.Z,{style:{marginLeft:"4px"}})})})]}),name:"guardrails",className:"mt-4",help:"Select existing guardrails. Go to 'Guardrails' tab to create new guardrails.",children:(0,s.jsx)(k.default,{mode:"tags",style:{width:"100%"},placeholder:"Select or enter guardrails",options:r.map(e=>({value:e,label:e}))})}),(0,s.jsx)(N.Z.Item,{label:"Tags",name:"tags",className:"mb-4",children:(0,s.jsx)(k.default,{mode:"tags",style:{width:"100%"},placeholder:"Select or enter tags",options:Object.values(i).map(e=>({value:e.name,label:e.name,title:e.description||e.name}))})}),d&&(0,s.jsxs)("div",{className:"ml-6 pl-4 border-l-2 border-gray-200",children:[(0,s.jsx)(N.Z.Item,{label:"Pricing Model",name:"pricing_model",className:"mb-4",children:(0,s.jsx)(k.default,{defaultValue:"per_token",onChange:e=>u(e),options:[{value:"per_token",label:"Per Million Tokens"},{value:"per_second",label:"Per Second"}]})}),"per_token"===m?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(N.Z.Item,{label:"Input Cost (per 1M tokens)",name:"input_cost_per_token",rules:[{validator:p}],className:"mb-4",children:(0,s.jsx)(eM.oi,{})}),(0,s.jsx)(N.Z.Item,{label:"Output Cost (per 1M tokens)",name:"output_cost_per_token",rules:[{validator:p}],className:"mb-4",children:(0,s.jsx)(eM.oi,{})})]}):(0,s.jsx)(N.Z.Item,{label:"Cost Per Second",name:"input_cost_per_second",rules:[{validator:p}],className:"mb-4",children:(0,s.jsx)(eM.oi,{})})]}),(0,s.jsx)(N.Z.Item,{label:"Use in pass through routes",name:"use_in_pass_through",valuePropName:"checked",className:"mb-4 mt-4",tooltip:(0,s.jsxs)("span",{children:["Allow using these credentials in pass through routes."," ",(0,s.jsx)(eO,{href:"https://docs.litellm.ai/docs/pass_through/vertex_ai",target:"_blank",children:"Learn more"})]}),children:(0,s.jsx)(eE.Z,{onChange:e=>{let l=n.getFieldValue("litellm_extra_params");try{let t=l?JSON.parse(l):{};e?t.use_in_pass_through=!0:delete t.use_in_pass_through,Object.keys(t).length>0?n.setFieldValue("litellm_extra_params",JSON.stringify(t,null,2)):n.setFieldValue("litellm_extra_params","")}catch(l){e?n.setFieldValue("litellm_extra_params",JSON.stringify({use_in_pass_through:!0},null,2)):n.setFieldValue("litellm_extra_params","")}},className:"bg-gray-600"})}),(0,s.jsx)(eT,{form:n,showCacheControl:h,onCacheControlChange:e=>{if(x(e),!e){let e=n.getFieldValue("litellm_extra_params");try{let l=e?JSON.parse(e):{};delete l.cache_control_injection_points,Object.keys(l).length>0?n.setFieldValue("litellm_extra_params",JSON.stringify(l,null,2)):n.setFieldValue("litellm_extra_params","")}catch(e){n.setFieldValue("litellm_extra_params","")}}}}),(0,s.jsx)(N.Z.Item,{label:"LiteLLM Params",name:"litellm_extra_params",tooltip:"Optional litellm params used for making a litellm.completion() call.",className:"mb-4 mt-4",rules:[{validator:eR.Ac}],children:(0,s.jsx)(eI.Z,{rows:4,placeholder:'{ "rpm": 100, "timeout": 0, "stream_timeout": 0 }'})}),(0,s.jsxs)(L.Z,{className:"mb-4",children:[(0,s.jsx)(T.Z,{span:10}),(0,s.jsx)(T.Z,{span:10,children:(0,s.jsxs)(eM.xv,{className:"text-gray-600 text-sm",children:["Pass JSON of litellm supported params"," ",(0,s.jsx)(eO,{href:"https://docs.litellm.ai/docs/completion/input",target:"_blank",children:"litellm.completion() call"})]})})]}),(0,s.jsx)(N.Z.Item,{label:"Model Info",name:"model_info_params",tooltip:"Optional model info params. Returned when calling `/model/info` endpoint.",className:"mb-0",rules:[{validator:eR.Ac}],children:(0,s.jsx)(eI.Z,{rows:4,placeholder:'{ "mode": "chat" }'})})]})})]})})},eD=t(56609),ez=t(67187);let eq=e=>{let{content:l,children:t,width:a="auto",className:r=""}=e,[i,n]=(0,o.useState)(!1),[d,c]=(0,o.useState)("top"),m=(0,o.useRef)(null),u=()=>{if(m.current){let e=m.current.getBoundingClientRect(),l=e.top,t=window.innerHeight-e.bottom;l<300&&t>300?c("bottom"):c("top")}};return(0,s.jsxs)("div",{className:"relative inline-block",ref:m,children:[t||(0,s.jsx)(ez.Z,{className:"ml-1 text-gray-500 cursor-help",onMouseEnter:()=>{u(),n(!0)},onMouseLeave:()=>n(!1)}),i&&(0,s.jsxs)("div",{className:"absolute left-1/2 -translate-x-1/2 z-50 bg-black/90 text-white p-2 rounded-md text-sm font-normal shadow-lg ".concat(r),style:{["top"===d?"bottom":"top"]:"100%",width:a,marginBottom:"top"===d?"8px":"0",marginTop:"bottom"===d?"8px":"0"},children:[l,(0,s.jsx)("div",{className:"absolute left-1/2 -translate-x-1/2 w-0 h-0",style:{top:"top"===d?"100%":"auto",bottom:"bottom"===d?"100%":"auto",borderTop:"top"===d?"6px solid rgba(0, 0, 0, 0.9)":"6px solid transparent",borderBottom:"bottom"===d?"6px solid rgba(0, 0, 0, 0.9)":"6px solid transparent",borderLeft:"6px solid transparent",borderRight:"6px solid transparent"}})]})]})};var eB=()=>{let e=N.Z.useFormInstance(),[l,t]=(0,o.useState)(0),a=N.Z.useWatch("model",e)||[],r=Array.isArray(a)?a:[a],i=N.Z.useWatch("custom_model_name",e),n=!r.includes("all-wildcard"),d=N.Z.useWatch("custom_llm_provider",e);if((0,o.useEffect)(()=>{if(i&&r.includes("custom")){let l=(e.getFieldValue("model_mappings")||[]).map(e=>"custom"===e.public_name||"custom"===e.litellm_model?d===m.Cl.Azure?{public_name:i,litellm_model:"azure/".concat(i)}:{public_name:i,litellm_model:i}:e);e.setFieldValue("model_mappings",l),t(e=>e+1)}},[i,r,d,e]),(0,o.useEffect)(()=>{if(r.length>0&&!r.includes("all-wildcard")){let l=e.getFieldValue("model_mappings")||[];if(l.length!==r.length||!r.every(e=>l.some(l=>"custom"===e?"custom"===l.litellm_model||l.litellm_model===i:d===m.Cl.Azure?l.litellm_model==="azure/".concat(e):l.litellm_model===e))){let l=r.map(e=>"custom"===e&&i?d===m.Cl.Azure?{public_name:i,litellm_model:"azure/".concat(i)}:{public_name:i,litellm_model:i}:d===m.Cl.Azure?{public_name:e,litellm_model:"azure/".concat(e)}:{public_name:e,litellm_model:e});e.setFieldValue("model_mappings",l),t(e=>e+1)}}},[r,i,d,e]),!n)return null;let c=(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"mb-2 font-normal",children:"The name you specify in your API calls to LiteLLM Proxy"}),(0,s.jsxs)("div",{className:"mb-2 font-normal",children:[(0,s.jsx)("strong",{children:"Example:"})," If you name your public model"," ",(0,s.jsx)("code",{className:"bg-gray-700 px-1 py-0.5 rounded text-xs",children:"example-name"}),", and choose"," ",(0,s.jsx)("code",{className:"bg-gray-700 px-1 py-0.5 rounded text-xs",children:"openai/qwen-plus-latest"})," as the LiteLLM model"]}),(0,s.jsxs)("div",{className:"mb-2 font-normal",children:[(0,s.jsx)("strong",{children:"Usage:"})," You make an API call to the LiteLLM proxy with"," ",(0,s.jsx)("code",{className:"bg-gray-700 px-1 py-0.5 rounded text-xs",children:'model = "example-name"'})]}),(0,s.jsxs)("div",{className:"font-normal",children:[(0,s.jsx)("strong",{children:"Result:"})," LiteLLM sends"," ",(0,s.jsx)("code",{className:"bg-gray-700 px-1 py-0.5 rounded text-xs",children:"qwen-plus-latest"})," to the provider"]})]}),u=(0,s.jsx)("div",{children:"The model name LiteLLM will send to the LLM API"}),h=[{title:(0,s.jsxs)("span",{className:"flex items-center",children:["Public Model Name",(0,s.jsx)(eq,{content:c,width:"500px"})]}),dataIndex:"public_name",key:"public_name",render:(l,t,a)=>(0,s.jsx)(w.o,{value:l,onChange:l=>{let t=[...e.getFieldValue("model_mappings")];t[a].public_name=l.target.value,e.setFieldValue("model_mappings",t)}})},{title:(0,s.jsxs)("span",{className:"flex items-center",children:["LiteLLM Model Name",(0,s.jsx)(eq,{content:u,width:"360px"})]}),dataIndex:"litellm_model",key:"litellm_model"}];return(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(N.Z.Item,{label:"Model Mappings",name:"model_mappings",tooltip:"Map public model names to LiteLLM model names for load balancing",labelCol:{span:10},wrapperCol:{span:16},labelAlign:"left",rules:[{required:!0,validator:async(e,l)=>{if(!l||0===l.length)throw Error("At least one model mapping is required");if(l.filter(e=>!e.public_name||""===e.public_name.trim()).length>0)throw Error("All model mappings must have valid public names")}}],children:(0,s.jsx)(eD.Z,{dataSource:e.getFieldValue("model_mappings"),columns:h,pagination:!1,size:"small"},l)})})},eU=e=>{let{selectedProvider:l,providerModels:t,getPlaceholder:a}=e,r=N.Z.useFormInstance(),i=e=>{let t=e.target.value,s=(r.getFieldValue("model_mappings")||[]).map(e=>"custom"===e.public_name||"custom"===e.litellm_model?l===m.Cl.Azure?{public_name:t,litellm_model:"azure/".concat(t)}:{public_name:t,litellm_model:t}:e);r.setFieldsValue({model_mappings:s})};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(N.Z.Item,{label:"LiteLLM Model Name(s)",tooltip:"The model name LiteLLM will send to the LLM API",className:"mb-0",children:[(0,s.jsx)(N.Z.Item,{name:"model",rules:[{required:!0,message:"Please enter ".concat(l===m.Cl.Azure?"a deployment name":"at least one model",".")}],noStyle:!0,children:l===m.Cl.Azure||l===m.Cl.OpenAI_Compatible||l===m.Cl.Ollama?(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(P.o,{placeholder:a(l),onChange:l===m.Cl.Azure?e=>{let l=e.target.value,t=l?[{public_name:l,litellm_model:"azure/".concat(l)}]:[];r.setFieldsValue({model:l,model_mappings:t})}:void 0})}):t.length>0?(0,s.jsx)(k.default,{mode:"multiple",allowClear:!0,showSearch:!0,placeholder:"Select models",onChange:e=>{let t=Array.isArray(e)?e:[e];if(t.includes("all-wildcard"))r.setFieldsValue({model_name:void 0,model_mappings:[]});else if(JSON.stringify(r.getFieldValue("model"))!==JSON.stringify(t)){let e=t.map(e=>l===m.Cl.Azure?{public_name:e,litellm_model:"azure/".concat(e)}:{public_name:e,litellm_model:e});r.setFieldsValue({model:t,model_mappings:e})}},optionFilterProp:"children",filterOption:(e,l)=>{var t;return(null!==(t=null==l?void 0:l.label)&&void 0!==t?t:"").toLowerCase().includes(e.toLowerCase())},options:[{label:"Custom Model Name (Enter below)",value:"custom"},{label:"All ".concat(l," Models (Wildcard)"),value:"all-wildcard"},...t.map(e=>({label:e,value:e}))],style:{width:"100%"}}):(0,s.jsx)(P.o,{placeholder:a(l)})}),(0,s.jsx)(N.Z.Item,{noStyle:!0,shouldUpdate:(e,l)=>e.model!==l.model,children:e=>{let{getFieldValue:t}=e,a=t("model")||[];return(Array.isArray(a)?a:[a]).includes("custom")&&(0,s.jsx)(N.Z.Item,{name:"custom_model_name",rules:[{required:!0,message:"Please enter a custom model name."}],className:"mt-2",children:(0,s.jsx)(P.o,{placeholder:l===m.Cl.Azure?"Enter Azure deployment name":"Enter custom model name",onChange:i})})}})]}),(0,s.jsxs)(L.Z,{children:[(0,s.jsx)(T.Z,{span:10}),(0,s.jsx)(T.Z,{span:14,children:(0,s.jsx)(P.x,{className:"mb-3 mt-1",children:l===m.Cl.Azure?"Your deployment name will be saved as the public model name, and LiteLLM will use 'azure/deployment-name' internally":"The model name LiteLLM will send to the LLM API"})})]})]})};let{Title:eG,Link:eH}=C.default;var eK=e=>{let{form:l,handleOk:t,selectedProvider:a,setSelectedProvider:r,providerModels:i,setProviderModelsFn:d,getPlaceholder:u,uploadProps:h,showAdvancedSettings:x,setShowAdvancedSettings:p,teams:g,credentials:f,accessToken:j,userRole:v,premiumUser:_}=e,[y]=N.Z.useForm(),[b,Z]=(0,o.useState)("chat"),[w,M]=(0,o.useState)(!1),[F,P]=(0,o.useState)(!1),[R,O]=(0,o.useState)([]),[V,D]=(0,o.useState)({}),[z,B]=(0,o.useState)(""),{data:U,isLoading:G,error:H}=I();(0,o.useEffect)(()=>{(async()=>{try{let e=(await (0,c.getGuardrailsList)(j)).guardrails.map(e=>e.guardrail_name);O(e)}catch(e){console.error("Failed to fetch guardrails:",e)}})()},[j]),(0,o.useEffect)(()=>{(async()=>{try{let e=await (0,c.tagListCall)(j);D(e)}catch(e){console.error("Failed to fetch tags:",e)}})()},[j]);let K=async()=>{P(!0),B("test-".concat(Date.now())),M(!0)},[J,W]=(0,o.useState)(!1),[Y,$]=(0,o.useState)([]);(0,o.useEffect)(()=>{(async()=>{$((await (0,c.modelAvailableCall)(j,"","",!1,null,!0,!0)).data.map(e=>e.id))})()},[j]);let en=(0,o.useMemo)(()=>U?[...U].sort((e,l)=>e.provider_display_name.localeCompare(l.provider_display_name)):[],[U]),eo=H?H instanceof Error?H.message:"Failed to load providers":null,ed=es.ZL.includes(v);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(X.Z,{className:"w-full",children:[(0,s.jsxs)(ee.Z,{className:"mb-4",children:[(0,s.jsx)(Q.Z,{children:"Add Model"}),(0,s.jsx)(Q.Z,{children:"Add Auto Router"})]}),(0,s.jsxs)(et.Z,{children:[(0,s.jsxs)(el.Z,{children:[(0,s.jsx)(eG,{level:2,children:"Add Model"}),(0,s.jsx)(er.Z,{children:(0,s.jsx)(N.Z,{form:l,onFinish:e=>{console.log("\uD83D\uDD25 Form onFinish triggered with values:",e),t()},onFinishFailed:e=>{console.log("\uD83D\uDCA5 Form onFinishFailed triggered:",e)},labelCol:{span:10},wrapperCol:{span:16},labelAlign:"left",children:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(N.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,s.jsxs)(k.default,{showSearch:!0,loading:G,placeholder:G?"Loading providers...":"Select a provider",optionFilterProp:"data-label",onChange:e=>{r(e),d(e),l.setFieldsValue({custom_llm_provider:e}),l.setFieldsValue({model:[],model_name:void 0})},children:[eo&&0===en.length&&(0,s.jsx)(k.default.Option,{value:"",children:eo},"__error"),en.map(e=>{var l;let t=e.provider_display_name,a=e.provider,r=null!==(l=m.cd[t])&&void 0!==l?l:"";return(0,s.jsx)(k.default.Option,{value:a,"data-label":t,children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[r?(0,s.jsx)("img",{src:r,alt:"".concat(t," logo"),className:"w-5 h-5",onError:e=>{let l=e.currentTarget,s=l.parentElement;if(s&&s.contains(l))try{let e=document.createElement("div");e.className="w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=t.charAt(0),s.replaceChild(e,l)}catch(e){console.error("Failed to replace provider logo fallback:",e)}}}):(0,s.jsx)("div",{className:"w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs",children:t.charAt(0)}),(0,s.jsx)("span",{children:t})]})},a)})]})}),(0,s.jsx)(eU,{selectedProvider:a,providerModels:i,getPlaceholder:u}),(0,s.jsx)(eB,{}),(0,s.jsx)(N.Z.Item,{label:"Mode",name:"mode",className:"mb-1",children:(0,s.jsx)(k.default,{style:{width:"100%"},value:b,onChange:e=>Z(e),options:eA})}),(0,s.jsxs)(L.Z,{children:[(0,s.jsx)(T.Z,{span:10}),(0,s.jsx)(T.Z,{span:10,children:(0,s.jsxs)(n.Z,{className:"mb-5 mt-1",children:[(0,s.jsx)("strong",{children:"Optional"})," - LiteLLM endpoint to use when health checking this model"," ",(0,s.jsx)(eH,{href:"https://docs.litellm.ai/docs/proxy/health#health",target:"_blank",children:"Learn more"})]})})]}),(0,s.jsx)("div",{className:"mb-4",children:(0,s.jsx)(C.default.Text,{className:"text-sm text-gray-500 mb-2",children:"Either select existing credentials OR enter new provider credentials below"})}),(0,s.jsx)(N.Z.Item,{label:"Existing Credentials",name:"litellm_credential_name",initialValue:null,children:(0,s.jsx)(k.default,{showSearch:!0,placeholder:"Select or search for existing credentials",optionFilterProp:"children",filterOption:(e,l)=>{var t;return(null!==(t=null==l?void 0:l.label)&&void 0!==t?t:"").toLowerCase().includes(e.toLowerCase())},options:[{value:null,label:"None"},...f.map(e=>({value:e.credential_name,label:e.credential_name}))],allowClear:!0})}),(0,s.jsx)(N.Z.Item,{noStyle:!0,shouldUpdate:(e,l)=>e.litellm_credential_name!==l.litellm_credential_name||e.provider!==l.provider,children:e=>{let{getFieldValue:l}=e,t=l("litellm_credential_name");return(console.log("\uD83D\uDD11 Credential Name Changed:",t),t)?null:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"flex items-center my-4",children:[(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"}),(0,s.jsx)("span",{className:"px-4 text-gray-500 text-sm",children:"OR"}),(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"})]}),(0,s.jsx)(q,{selectedProvider:a,uploadProps:h})]})}}),(0,s.jsxs)("div",{className:"flex items-center my-4",children:[(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"}),(0,s.jsx)("span",{className:"px-4 text-gray-500 text-sm",children:"Additional Model Info Settings"}),(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"})]}),(0,s.jsx)(N.Z.Item,{label:"Team-BYOK Model",tooltip:"Only use this model + credential combination for this team. Useful when teams want to onboard their own OpenAI keys.",className:"mb-4",children:(0,s.jsx)(A.Z,{title:_?"":"This is an enterprise-only feature. Upgrade to premium to restrict model+credential combinations to a specific team.",placement:"top",children:(0,s.jsx)(ea.Z,{checked:J,onChange:e=>{W(e),e||l.setFieldValue("team_id",void 0)},disabled:!_})})}),J&&(0,s.jsx)(N.Z.Item,{label:"Select Team",name:"team_id",className:"mb-4",tooltip:"Only keys for this team will be able to call this model.",rules:[{required:J&&!ed,message:"Please select a team."}],children:(0,s.jsx)(ei.Z,{teams:g,disabled:!_})}),ed&&(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(N.Z.Item,{label:"Model Access Group",name:"model_access_group",className:"mb-4",tooltip:"Use model access groups to give users access to select models, and add new ones to the group over time.",children:(0,s.jsx)(k.default,{mode:"tags",showSearch:!0,placeholder:"Select existing groups or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],options:Y.map(e=>({value:e,label:e})),maxTagCount:"responsive",allowClear:!0})})}),(0,s.jsx)(eV,{showAdvancedSettings:x,setShowAdvancedSettings:p,teams:g,guardrailsList:R,tagsList:V}),(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,s.jsx)(A.Z,{title:"Get help on our github",children:(0,s.jsx)(C.default.Link,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})}),(0,s.jsxs)("div",{className:"space-x-2",children:[(0,s.jsx)(E.ZP,{onClick:K,loading:F,children:"Test Connect"}),(0,s.jsx)(E.ZP,{htmlType:"submit",children:"Add Model"})]})]})]})})})]}),(0,s.jsx)(el.Z,{children:(0,s.jsx)(ek,{form:y,handleOk:()=>{y.validateFields().then(e=>{ep(e,j,y,t)}).catch(e=>{console.error("Validation failed:",e)})},accessToken:j,userRole:v})})]})]}),(0,s.jsx)(S.Z,{title:"Connection Test Results",open:w,onCancel:()=>{M(!1),P(!1)},footer:[(0,s.jsx)(E.ZP,{onClick:()=>{M(!1),P(!1)},children:"Close"},"close")],width:700,children:w&&(0,s.jsx)(ex,{formValues:l.getFieldsValue(),accessToken:j,testMode:b,modelName:l.getFieldValue("model_name")||l.getFieldValue("model"),onClose:()=>{M(!1),P(!1)},onTestComplete:()=>P(!1)},z)})]})},eJ=t(10900),eW=t(45589),eY=t(78489),e$=t(12514),eQ=t(49566),eX=t(96761),e0=t(30401),e1=t(78867),e2=t(59872),e4=e=>{let{isVisible:l,onCancel:t,onSuccess:a,modelData:r,accessToken:i,userRole:n}=e,[m]=N.Z.useForm(),[u,h]=(0,o.useState)(!1),[x,p]=(0,o.useState)([]),[g,f]=(0,o.useState)([]),[j,v]=(0,o.useState)(!1),[_,y]=(0,o.useState)(!1),[b,Z]=(0,o.useState)(null);(0,o.useEffect)(()=>{l&&r&&w()},[l,r]),(0,o.useEffect)(()=>{let e=async()=>{if(i)try{let e=await (0,c.modelAvailableCall)(i,"","",!1,null,!0,!0);p(e.data.map(e=>e.id))}catch(e){console.error("Error fetching model access groups:",e)}},t=async()=>{if(i)try{let e=await (0,eg.p)(i);f(e)}catch(e){console.error("Error fetching model info:",e)}};l&&(e(),t())},[l,i]);let w=()=>{try{var e,l,t,s,a,i;let n=null;(null===(e=r.litellm_params)||void 0===e?void 0:e.auto_router_config)&&(n="string"==typeof r.litellm_params.auto_router_config?JSON.parse(r.litellm_params.auto_router_config):r.litellm_params.auto_router_config),Z(n),m.setFieldsValue({auto_router_name:r.model_name,auto_router_default_model:(null===(l=r.litellm_params)||void 0===l?void 0:l.auto_router_default_model)||"",auto_router_embedding_model:(null===(t=r.litellm_params)||void 0===t?void 0:t.auto_router_embedding_model)||"",model_access_group:(null===(s=r.model_info)||void 0===s?void 0:s.access_groups)||[]});let o=new Set(g.map(e=>e.model_group));v(!o.has(null===(a=r.litellm_params)||void 0===a?void 0:a.auto_router_default_model)),y(!o.has(null===(i=r.litellm_params)||void 0===i?void 0:i.auto_router_embedding_model))}catch(e){console.error("Error parsing auto router config:",e),d.Z.fromBackend("Error loading auto router configuration")}},C=async()=>{try{h(!0);let e=await m.validateFields(),l={...r.litellm_params,auto_router_config:JSON.stringify(b),auto_router_default_model:e.auto_router_default_model,auto_router_embedding_model:e.auto_router_embedding_model||void 0},s={...r.model_info,access_groups:e.model_access_group||[]},n={model_name:e.auto_router_name,litellm_params:l,model_info:s};await (0,c.modelPatchUpdateCall)(i,n,r.model_info.id);let o={...r,model_name:e.auto_router_name,litellm_params:l,model_info:s};d.Z.success("Auto router configuration updated successfully"),a(o),t()}catch(e){console.error("Error updating auto router:",e),d.Z.fromBackend("Failed to update auto router configuration")}finally{h(!1)}},A=g.map(e=>({value:e.model_group,label:e.model_group}));return(0,s.jsx)(S.Z,{title:"Edit Auto Router Configuration",open:l,onCancel:t,footer:[(0,s.jsx)(E.ZP,{onClick:t,children:"Cancel"},"cancel"),(0,s.jsx)(E.ZP,{loading:u,onClick:C,children:"Save Changes"},"submit")],width:1e3,destroyOnClose:!0,children:(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsx)(P.x,{className:"text-gray-600",children:"Edit the auto router configuration including routing logic, default models, and access settings."}),(0,s.jsxs)(N.Z,{form:m,layout:"vertical",className:"space-y-4",children:[(0,s.jsx)(N.Z.Item,{label:"Auto Router Name",name:"auto_router_name",rules:[{required:!0,message:"Auto router name is required"}],children:(0,s.jsx)(P.o,{placeholder:"e.g., auto_router_1, smart_routing"})}),(0,s.jsx)("div",{className:"w-full",children:(0,s.jsx)(ew,{modelInfo:g,value:b,onChange:e=>{Z(e)}})}),(0,s.jsx)(N.Z.Item,{label:"Default Model",name:"auto_router_default_model",rules:[{required:!0,message:"Default model is required"}],children:(0,s.jsx)(k.default,{placeholder:"Select a default model",onChange:e=>{v("custom"===e)},options:[...A,{value:"custom",label:"Enter custom model name"}],showSearch:!0})}),(0,s.jsx)(N.Z.Item,{label:"Embedding Model",name:"auto_router_embedding_model",children:(0,s.jsx)(k.default,{placeholder:"Select an embedding model (optional)",onChange:e=>{y("custom"===e)},options:[...A,{value:"custom",label:"Enter custom model name"}],showSearch:!0,allowClear:!0})}),"Admin"===n&&(0,s.jsx)(N.Z.Item,{label:"Model Access Groups",name:"model_access_group",tooltip:"Control who can access this auto router",children:(0,s.jsx)(k.default,{mode:"tags",showSearch:!0,placeholder:"Select existing groups or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],options:x.map(e=>({value:e,label:e})),maxTagCount:"responsive",allowClear:!0})})]})]})})};let{Title:e5,Link:e6}=C.default;var e3=e=>{let{isVisible:l,onCancel:t,onAddCredential:a,existingCredential:r,setIsCredentialModalOpen:i}=e,[n]=N.Z.useForm();return console.log("existingCredential in add credentials tab: ".concat(JSON.stringify(r))),(0,s.jsx)(S.Z,{title:"Reuse Credentials",visible:l,onCancel:()=>{t(),n.resetFields()},footer:null,width:600,children:(0,s.jsxs)(N.Z,{form:n,onFinish:e=>{a(e),n.resetFields(),i(!1)},layout:"vertical",children:[(0,s.jsx)(N.Z.Item,{label:"Credential Name:",name:"credential_name",rules:[{required:!0,message:"Credential name is required"}],initialValue:null==r?void 0:r.credential_name,children:(0,s.jsx)(w.o,{placeholder:"Enter a friendly name for these credentials"})}),Object.entries((null==r?void 0:r.credential_values)||{}).map(e=>{let[l,t]=e;return(0,s.jsx)(N.Z.Item,{label:l,name:l,initialValue:t,children:(0,s.jsx)(w.o,{placeholder:"Enter ".concat(l),disabled:!0})},l)}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(A.Z,{title:"Get help on our github",children:(0,s.jsx)(e6,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)(E.ZP,{onClick:()=>{t(),n.resetFields()},style:{marginRight:10},children:"Cancel"}),(0,s.jsx)(E.ZP,{htmlType:"submit",children:"Reuse Credentials"})]})]})]})})};function e8(e){var l,t,a,r,u,h,x,p,g,f,j,v,_,b,Z,w,C,M,I,F,P,L,T,R,V,D,z,q,B,U,G,H;let{modelId:K,onClose:J,modelData:$,accessToken:es,userID:ea,userRole:er,editModel:ei,setEditModalVisible:en,setSelectedModel:eo,onModelUpdate:ed,modelAccessGroups:ec}=e,[em]=N.Z.useForm(),[eh,ex]=(0,o.useState)(null),[ep,eg]=(0,o.useState)(!1),[ef,ej]=(0,o.useState)(!1),[ev,e_]=(0,o.useState)(!1),[ey,eb]=(0,o.useState)(!1),[eN,eZ]=(0,o.useState)(!1),[ew,eC]=(0,o.useState)(null),[eS,ek]=(0,o.useState)(!1),[eA,eE]=(0,o.useState)({}),[eM,eI]=(0,o.useState)(!1),[eF,eL]=(0,o.useState)([]),[eO,eV]=(0,o.useState)({}),eD=("Admin"===er||(null==$?void 0:null===(l=$.model_info)||void 0===l?void 0:l.created_by)===ea)&&(null==$?void 0:null===(t=$.model_info)||void 0===t?void 0:t.db_model),ez="Admin"===er,eq=(null==$?void 0:null===(a=$.litellm_params)||void 0===a?void 0:a.auto_router_config)!=null,eB=(null==$?void 0:null===(r=$.litellm_params)||void 0===r?void 0:r.litellm_credential_name)!=null&&(null==$?void 0:null===(u=$.litellm_params)||void 0===u?void 0:u.litellm_credential_name)!=void 0;console.log("usingExistingCredential, ",eB),console.log("modelData.litellm_params.litellm_credential_name, ",null==$?void 0:null===(h=$.litellm_params)||void 0===h?void 0:h.litellm_credential_name),console.log("tagsList, ",null===(x=$.litellm_params)||void 0===x?void 0:x.tags),(0,o.useEffect)(()=>{let e=async()=>{var e,l,t,s,a,r,i;if(!es)return;let n=await (0,c.modelInfoV1Call)(es,K);console.log("modelInfoResponse, ",n);let o=n.data[0];o&&!o.litellm_model_name&&(o={...o,litellm_model_name:null!==(i=null!==(r=null!==(a=null==o?void 0:null===(l=o.litellm_params)||void 0===l?void 0:l.litellm_model_name)&&void 0!==a?a:null==o?void 0:null===(t=o.litellm_params)||void 0===t?void 0:t.model)&&void 0!==r?r:null==o?void 0:null===(s=o.model_info)||void 0===s?void 0:s.key)&&void 0!==i?i:null}),ex(o),(null==o?void 0:null===(e=o.litellm_params)||void 0===e?void 0:e.cache_control_injection_points)&&ek(!0)},l=async()=>{if(es)try{let e=(await (0,c.getGuardrailsList)(es)).guardrails.map(e=>e.guardrail_name);eL(e)}catch(e){console.error("Failed to fetch guardrails:",e)}},t=async()=>{if(es)try{let e=await (0,c.tagListCall)(es);eV(e)}catch(e){console.error("Failed to fetch tags:",e)}};(async()=>{if(console.log("accessToken, ",es),!es||eB)return;let e=await (0,c.credentialGetCall)(es,null,K);console.log("existingCredentialResponse, ",e),eC({credential_name:e.credential_name,credential_values:e.credential_values,credential_info:e.credential_info})})(),e(),l(),t()},[es,K]);let eU=async e=>{var l;if(console.log("values, ",e),!es)return;let t={credential_name:e.credential_name,model_id:K,credential_info:{custom_llm_provider:null===(l=eh.litellm_params)||void 0===l?void 0:l.custom_llm_provider}};d.Z.info("Storing credential.."),console.log("credentialResponse, ",await (0,c.credentialCreateCall)(es,t)),d.Z.success("Credential stored successfully")},eG=async e=>{try{var l;let t;if(!es)return;eb(!0),console.log("values.model_name, ",e.model_name);let s={};try{s=e.litellm_extra_params?JSON.parse(e.litellm_extra_params):{}}catch(e){d.Z.fromBackend("Invalid JSON in LiteLLM Params"),eb(!1);return}let a={...e.litellm_params,...s,model:e.litellm_model_name,api_base:e.api_base,custom_llm_provider:e.custom_llm_provider,organization:e.organization,tpm:e.tpm,rpm:e.rpm,max_retries:e.max_retries,timeout:e.timeout,stream_timeout:e.stream_timeout,input_cost_per_token:e.input_cost/1e6,output_cost_per_token:e.output_cost/1e6,tags:e.tags};e.guardrails&&(a.guardrails=e.guardrails),e.cache_control&&(null===(l=e.cache_control_injection_points)||void 0===l?void 0:l.length)>0?a.cache_control_injection_points=e.cache_control_injection_points:delete a.cache_control_injection_points;try{t=e.model_info?JSON.parse(e.model_info):$.model_info,e.model_access_group&&(t={...t,access_groups:e.model_access_group})}catch(e){d.Z.fromBackend("Invalid JSON in Model Info");return}let r={model_name:e.model_name,litellm_params:a,model_info:t};await (0,c.modelPatchUpdateCall)(es,r,K);let i={...eh,model_name:e.model_name,litellm_model_name:e.litellm_model_name,litellm_params:a,model_info:t};ex(i),ed&&ed(i),d.Z.success("Model settings updated successfully"),e_(!1),eZ(!1)}catch(e){console.error("Error updating model:",e),d.Z.fromBackend("Failed to update model settings")}finally{eb(!1)}};if(!$)return(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsx)(eY.Z,{icon:eJ.Z,variant:"light",onClick:J,className:"mb-4",children:"Back to Models"}),(0,s.jsx)(n.Z,{children:"Model not found"})]});let eH=async()=>{if(es)try{var e,l,t;d.Z.info("Testing connection...");let s=await (0,c.testConnectionRequest)(es,{custom_llm_provider:eh.litellm_params.custom_llm_provider,litellm_credential_name:eh.litellm_params.litellm_credential_name,model:eh.litellm_model_name},{mode:null===(e=eh.model_info)||void 0===e?void 0:e.mode},null===(l=eh.model_info)||void 0===l?void 0:l.mode);if("success"===s.status)d.Z.success("Connection test successful!");else throw Error((null==s?void 0:null===(t=s.result)||void 0===t?void 0:t.error)||(null==s?void 0:s.message)||"Unknown error")}catch(e){e instanceof Error?d.Z.error("Error testing connection: "+(0,eR.aS)(e.message,100)):d.Z.error("Error testing connection: "+String(e))}},eK=async()=>{try{if(!es)return;await (0,c.modelDeleteCall)(es,K),d.Z.success("Model deleted successfully"),ed&&ed({deleted:!0,model_info:{id:K}}),J()}catch(e){console.error("Error deleting the model:",e),d.Z.fromBackend("Failed to delete model")}},e5=async(e,l)=>{await (0,e2.vQ)(e)&&(eE(e=>({...e,[l]:!0})),setTimeout(()=>{eE(e=>({...e,[l]:!1}))},2e3))};return(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(eY.Z,{icon:eJ.Z,variant:"light",onClick:J,className:"mb-4",children:"Back to Models"}),(0,s.jsxs)(eX.Z,{children:["Public Model Name: ",W($)]}),(0,s.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,s.jsx)(n.Z,{className:"text-gray-500 font-mono",children:$.model_info.id}),(0,s.jsx)(E.ZP,{type:"text",size:"small",icon:eA["model-id"]?(0,s.jsx)(e0.Z,{size:12}):(0,s.jsx)(e1.Z,{size:12}),onClick:()=>e5($.model_info.id,"model-id"),className:"left-2 z-10 transition-all duration-200 ".concat(eA["model-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(eY.Z,{variant:"secondary",icon:Y.Z,onClick:eH,className:"flex items-center gap-2","data-testid":"test-connection-button",children:"Test Connection"}),(0,s.jsx)(eY.Z,{icon:eW.Z,variant:"secondary",onClick:()=>ej(!0),className:"flex items-center",disabled:!ez,"data-testid":"reuse-credentials-button",children:"Re-use Credentials"}),(0,s.jsx)(eY.Z,{icon:y.Z,variant:"secondary",onClick:()=>eg(!0),className:"flex items-center text-red-500 border-red-500 hover:text-red-700",disabled:!eD,"data-testid":"delete-model-button",children:"Delete Model"})]})]}),(0,s.jsxs)(X.Z,{children:[(0,s.jsxs)(ee.Z,{className:"mb-6",children:[(0,s.jsx)(Q.Z,{children:"Overview"}),(0,s.jsx)(Q.Z,{children:"Raw JSON"})]}),(0,s.jsxs)(et.Z,{children:[(0,s.jsxs)(el.Z,{children:[(0,s.jsxs)(i.Z,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6 mb-6",children:[(0,s.jsxs)(e$.Z,{children:[(0,s.jsx)(n.Z,{children:"Provider"}),(0,s.jsxs)("div",{className:"mt-2 flex items-center space-x-2",children:[$.provider&&(0,s.jsx)("img",{src:(0,m.dr)($.provider).logo,alt:"".concat($.provider," logo"),className:"w-4 h-4",onError:e=>{let l=e.currentTarget,t=l.parentElement;if(t&&t.contains(l))try{var s;let e=document.createElement("div");e.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=(null===(s=$.provider)||void 0===s?void 0:s.charAt(0))||"-",t.replaceChild(e,l)}catch(e){console.error("Failed to replace provider logo fallback:",e)}}}),(0,s.jsx)(eX.Z,{children:$.provider||"Not Set"})]})]}),(0,s.jsxs)(e$.Z,{children:[(0,s.jsx)(n.Z,{children:"LiteLLM Model"}),(0,s.jsx)("div",{className:"mt-2 overflow-hidden",children:(0,s.jsx)(A.Z,{title:$.litellm_model_name||"Not Set",children:(0,s.jsx)("div",{className:"break-all text-sm font-medium leading-relaxed cursor-pointer",children:$.litellm_model_name||"Not Set"})})})]}),(0,s.jsxs)(e$.Z,{children:[(0,s.jsx)(n.Z,{children:"Pricing"}),(0,s.jsxs)("div",{className:"mt-2",children:[(0,s.jsxs)(n.Z,{children:["Input: $",$.input_cost,"/1M tokens"]}),(0,s.jsxs)(n.Z,{children:["Output: $",$.output_cost,"/1M tokens"]})]})]})]}),(0,s.jsxs)("div",{className:"mb-6 text-sm text-gray-500 flex items-center gap-x-6",children:[(0,s.jsxs)("div",{className:"flex items-center gap-x-2",children:[(0,s.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Created At"," ",$.model_info.created_at?new Date($.model_info.created_at).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):"Not Set"]}),(0,s.jsxs)("div",{className:"flex items-center gap-x-2",children:[(0,s.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"})}),"Created By ",$.model_info.created_by||"Not Set"]})]}),(0,s.jsxs)(e$.Z,{children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,s.jsx)(eX.Z,{children:"Model Settings"}),(0,s.jsxs)("div",{className:"flex gap-2",children:[eq&&eD&&!eN&&(0,s.jsx)(eY.Z,{onClick:()=>eI(!0),className:"flex items-center",children:"Edit Auto Router"}),eD?!eN&&(0,s.jsx)(eY.Z,{onClick:()=>eZ(!0),className:"flex items-center",children:"Edit Settings"}):(0,s.jsx)(A.Z,{title:"Only DB models can be edited. You must be an admin or the creator of the model to edit it.",children:(0,s.jsx)(eu.Z,{})})]})]}),eh?(0,s.jsx)(N.Z,{form:em,onFinish:eG,initialValues:{model_name:eh.model_name,litellm_model_name:eh.litellm_model_name,api_base:eh.litellm_params.api_base,custom_llm_provider:eh.litellm_params.custom_llm_provider,organization:eh.litellm_params.organization,tpm:eh.litellm_params.tpm,rpm:eh.litellm_params.rpm,max_retries:eh.litellm_params.max_retries,timeout:eh.litellm_params.timeout,stream_timeout:eh.litellm_params.stream_timeout,input_cost:eh.litellm_params.input_cost_per_token?1e6*eh.litellm_params.input_cost_per_token:(null===(p=eh.model_info)||void 0===p?void 0:p.input_cost_per_token)*1e6||null,output_cost:(null===(g=eh.litellm_params)||void 0===g?void 0:g.output_cost_per_token)?1e6*eh.litellm_params.output_cost_per_token:(null===(f=eh.model_info)||void 0===f?void 0:f.output_cost_per_token)*1e6||null,cache_control:null!==(j=eh.litellm_params)&&void 0!==j&&!!j.cache_control_injection_points,cache_control_injection_points:(null===(v=eh.litellm_params)||void 0===v?void 0:v.cache_control_injection_points)||[],model_access_group:Array.isArray(null===(_=eh.model_info)||void 0===_?void 0:_.access_groups)?eh.model_info.access_groups:[],guardrails:Array.isArray(null===(b=eh.litellm_params)||void 0===b?void 0:b.guardrails)?eh.litellm_params.guardrails:[],tags:Array.isArray(null===(Z=eh.litellm_params)||void 0===Z?void 0:Z.tags)?eh.litellm_params.tags:[],litellm_extra_params:JSON.stringify(eh.litellm_params||{},null,2)},layout:"vertical",onValuesChange:()=>e_(!0),children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Model Name"}),eN?(0,s.jsx)(N.Z.Item,{name:"model_name",className:"mb-0",children:(0,s.jsx)(eQ.Z,{placeholder:"Enter model name"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:eh.model_name})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"LiteLLM Model Name"}),eN?(0,s.jsx)(N.Z.Item,{name:"litellm_model_name",className:"mb-0",children:(0,s.jsx)(eQ.Z,{placeholder:"Enter LiteLLM model name"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:eh.litellm_model_name})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Input Cost (per 1M tokens)"}),eN?(0,s.jsx)(N.Z.Item,{name:"input_cost",className:"mb-0",children:(0,s.jsx)(eP.Z,{placeholder:"Enter input cost"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null==eh?void 0:null===(w=eh.litellm_params)||void 0===w?void 0:w.input_cost_per_token)?((null===(C=eh.litellm_params)||void 0===C?void 0:C.input_cost_per_token)*1e6).toFixed(4):(null==eh?void 0:null===(M=eh.model_info)||void 0===M?void 0:M.input_cost_per_token)?(1e6*eh.model_info.input_cost_per_token).toFixed(4):null})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Output Cost (per 1M tokens)"}),eN?(0,s.jsx)(N.Z.Item,{name:"output_cost",className:"mb-0",children:(0,s.jsx)(eP.Z,{placeholder:"Enter output cost"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null==eh?void 0:null===(I=eh.litellm_params)||void 0===I?void 0:I.output_cost_per_token)?(1e6*eh.litellm_params.output_cost_per_token).toFixed(4):(null==eh?void 0:null===(F=eh.model_info)||void 0===F?void 0:F.output_cost_per_token)?(1e6*eh.model_info.output_cost_per_token).toFixed(4):null})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"API Base"}),eN?(0,s.jsx)(N.Z.Item,{name:"api_base",className:"mb-0",children:(0,s.jsx)(eQ.Z,{placeholder:"Enter API base"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(P=eh.litellm_params)||void 0===P?void 0:P.api_base)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Custom LLM Provider"}),eN?(0,s.jsx)(N.Z.Item,{name:"custom_llm_provider",className:"mb-0",children:(0,s.jsx)(eQ.Z,{placeholder:"Enter custom LLM provider"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(L=eh.litellm_params)||void 0===L?void 0:L.custom_llm_provider)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Organization"}),eN?(0,s.jsx)(N.Z.Item,{name:"organization",className:"mb-0",children:(0,s.jsx)(eQ.Z,{placeholder:"Enter organization"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(T=eh.litellm_params)||void 0===T?void 0:T.organization)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"TPM (Tokens per Minute)"}),eN?(0,s.jsx)(N.Z.Item,{name:"tpm",className:"mb-0",children:(0,s.jsx)(eP.Z,{placeholder:"Enter TPM"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(R=eh.litellm_params)||void 0===R?void 0:R.tpm)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"RPM (Requests per Minute)"}),eN?(0,s.jsx)(N.Z.Item,{name:"rpm",className:"mb-0",children:(0,s.jsx)(eP.Z,{placeholder:"Enter RPM"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(V=eh.litellm_params)||void 0===V?void 0:V.rpm)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Max Retries"}),eN?(0,s.jsx)(N.Z.Item,{name:"max_retries",className:"mb-0",children:(0,s.jsx)(eP.Z,{placeholder:"Enter max retries"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(D=eh.litellm_params)||void 0===D?void 0:D.max_retries)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Timeout (seconds)"}),eN?(0,s.jsx)(N.Z.Item,{name:"timeout",className:"mb-0",children:(0,s.jsx)(eP.Z,{placeholder:"Enter timeout"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(z=eh.litellm_params)||void 0===z?void 0:z.timeout)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Stream Timeout (seconds)"}),eN?(0,s.jsx)(N.Z.Item,{name:"stream_timeout",className:"mb-0",children:(0,s.jsx)(eP.Z,{placeholder:"Enter stream timeout"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(q=eh.litellm_params)||void 0===q?void 0:q.stream_timeout)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Model Access Groups"}),eN?(0,s.jsx)(N.Z.Item,{name:"model_access_group",className:"mb-0",children:(0,s.jsx)(k.default,{mode:"tags",showSearch:!0,placeholder:"Select existing groups or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],maxTagCount:"responsive",allowClear:!0,style:{width:"100%"},options:null==ec?void 0:ec.map(e=>({value:e,label:e}))})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(B=eh.model_info)||void 0===B?void 0:B.access_groups)?Array.isArray(eh.model_info.access_groups)?eh.model_info.access_groups.length>0?(0,s.jsx)("div",{className:"flex flex-wrap gap-1",children:eh.model_info.access_groups.map((e,l)=>(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-blue-100 text-blue-800",children:e},l))}):"No groups assigned":eh.model_info.access_groups:"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)(n.Z,{className:"font-medium",children:["Guardrails",(0,s.jsx)(A.Z,{title:"Apply safety guardrails to this model to filter content or enforce policies",children:(0,s.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/quick_start",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,s.jsx)(eu.Z,{style:{marginLeft:"4px"}})})})]}),eN?(0,s.jsx)(N.Z.Item,{name:"guardrails",className:"mb-0",children:(0,s.jsx)(k.default,{mode:"tags",showSearch:!0,placeholder:"Select existing guardrails or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],maxTagCount:"responsive",allowClear:!0,style:{width:"100%"},options:eF.map(e=>({value:e,label:e}))})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(U=eh.litellm_params)||void 0===U?void 0:U.guardrails)?Array.isArray(eh.litellm_params.guardrails)?eh.litellm_params.guardrails.length>0?(0,s.jsx)("div",{className:"flex flex-wrap gap-1",children:eh.litellm_params.guardrails.map((e,l)=>(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-green-100 text-green-800",children:e},l))}):"No guardrails assigned":eh.litellm_params.guardrails:"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Tags"}),eN?(0,s.jsx)(N.Z.Item,{name:"tags",className:"mb-0",children:(0,s.jsx)(k.default,{mode:"tags",showSearch:!0,placeholder:"Select existing tags or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],maxTagCount:"responsive",allowClear:!0,style:{width:"100%"},options:Object.values(eO).map(e=>({value:e.name,label:e.name,title:e.description||e.name}))})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(G=eh.litellm_params)||void 0===G?void 0:G.tags)?Array.isArray(eh.litellm_params.tags)?eh.litellm_params.tags.length>0?(0,s.jsx)("div",{className:"flex flex-wrap gap-1",children:eh.litellm_params.tags.map((e,l)=>(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-purple-100 text-purple-800",children:e},l))}):"No tags assigned":eh.litellm_params.tags:"Not Set"})]}),eN?(0,s.jsx)(eT,{form:em,showCacheControl:eS,onCacheControlChange:e=>ek(e)}):(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Cache Control"}),(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(H=eh.litellm_params)||void 0===H?void 0:H.cache_control_injection_points)?(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{children:"Enabled"}),(0,s.jsx)("div",{className:"mt-2",children:eh.litellm_params.cache_control_injection_points.map((e,l)=>(0,s.jsxs)("div",{className:"text-sm text-gray-600 mb-1",children:["Location: ",e.location,",",e.role&&(0,s.jsxs)("span",{children:[" Role: ",e.role]}),void 0!==e.index&&(0,s.jsxs)("span",{children:[" Index: ",e.index]})]},l))})]}):"Disabled"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Model Info"}),eN?(0,s.jsx)(N.Z.Item,{name:"model_info",className:"mb-0",children:(0,s.jsx)(O.default.TextArea,{rows:4,placeholder:'{"gpt-4": 100, "claude-v1": 200}',defaultValue:JSON.stringify($.model_info,null,2)})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(0,s.jsx)("pre",{className:"bg-gray-100 p-2 rounded text-xs overflow-auto mt-1",children:JSON.stringify(eh.model_info,null,2)})})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)(n.Z,{className:"font-medium",children:["LiteLLM Params",(0,s.jsx)(A.Z,{title:"Optional litellm params used for making a litellm.completion() call. Some params are automatically added by LiteLLM.",children:(0,s.jsx)("a",{href:"https://docs.litellm.ai/docs/completion/input",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,s.jsx)(eu.Z,{style:{marginLeft:"4px"}})})})]}),eN?(0,s.jsx)(N.Z.Item,{name:"litellm_extra_params",rules:[{validator:eR.Ac}],children:(0,s.jsx)(O.default.TextArea,{rows:4,placeholder:'{ "rpm": 100, "timeout": 0, "stream_timeout": 0 }'})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(0,s.jsx)("pre",{className:"bg-gray-100 p-2 rounded text-xs overflow-auto mt-1",children:JSON.stringify(eh.litellm_params,null,2)})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Team ID"}),(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:$.model_info.team_id||"Not Set"})]})]}),eN&&(0,s.jsxs)("div",{className:"mt-6 flex justify-end gap-2",children:[(0,s.jsx)(eY.Z,{variant:"secondary",onClick:()=>{em.resetFields(),e_(!1),eZ(!1)},disabled:ey,children:"Cancel"}),(0,s.jsx)(eY.Z,{variant:"primary",onClick:()=>em.submit(),loading:ey,children:"Save Changes"})]})]})}):(0,s.jsx)(n.Z,{children:"Loading..."})]})]}),(0,s.jsx)(el.Z,{children:(0,s.jsx)(e$.Z,{children:(0,s.jsx)("pre",{className:"bg-gray-100 p-4 rounded text-xs overflow-auto",children:JSON.stringify($,null,2)})})})]})]}),ep&&(0,s.jsx)("div",{className:"fixed z-10 inset-0 overflow-y-auto",children:(0,s.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,s.jsx)("div",{className:"fixed inset-0 transition-opacity","aria-hidden":"true",children:(0,s.jsx)("div",{className:"absolute inset-0 bg-gray-500 opacity-75"})}),(0,s.jsx)("span",{className:"hidden sm:inline-block sm:align-middle sm:h-screen","aria-hidden":"true",children:"​"}),(0,s.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,s.jsx)("div",{className:"bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4",children:(0,s.jsx)("div",{className:"sm:flex sm:items-start",children:(0,s.jsxs)("div",{className:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left",children:[(0,s.jsx)("h3",{className:"text-lg leading-6 font-medium text-gray-900",children:"Delete Model"}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)("p",{className:"text-sm text-gray-500",children:"Are you sure you want to delete this model?"})})]})})}),(0,s.jsxs)("div",{className:"bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse",children:[(0,s.jsx)(E.ZP,{onClick:eK,className:"ml-2",danger:!0,children:"Delete"}),(0,s.jsx)(E.ZP,{onClick:()=>eg(!1),children:"Cancel"})]})]})]})}),ef&&!eB?(0,s.jsx)(e3,{isVisible:ef,onCancel:()=>ej(!1),onAddCredential:eU,existingCredential:ew,setIsCredentialModalOpen:ej}):(0,s.jsx)(S.Z,{open:ef,onCancel:()=>ej(!1),title:"Using Existing Credential",children:(0,s.jsx)(n.Z,{children:$.litellm_params.litellm_credential_name})}),(0,s.jsx)(e4,{isVisible:eM,onCancel:()=>eI(!1),onSuccess:e=>{ex(e),ed&&ed(e)},modelData:eh||$,accessToken:es||"",userRole:er||""})]})}var e9=t(33293),e7=t(11318),le=t(8048),ll=t(41649);let lt=e=>{let{provider:l,className:t="w-4 h-4"}=e,[a,r]=(0,o.useState)(!1),{logo:i}=(0,m.dr)(l);return a||!i?(0,s.jsx)("div",{className:"".concat(t," rounded-full bg-gray-200 flex items-center justify-center text-xs"),children:(null==l?void 0:l.charAt(0))||"-"}):(0,s.jsx)("img",{src:i,alt:"".concat(l," logo"),className:t,onError:()=>r(!0)})},ls=(e,l,t,a,r,i,n,o,d,c,m)=>[{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Model ID"}),accessorKey:"model_info.id",cell:e=>{let{row:l}=e,t=l.original;return(0,s.jsx)(A.Z,{title:t.model_info.id,children:(0,s.jsx)("div",{className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[15ch]",onClick:()=>a(t.model_info.id),children:t.model_info.id})})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Model Information"}),accessorKey:"model_name",size:250,cell:e=>{let{row:l}=e,t=l.original,a=i(l.original)||"-",r=(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("strong",{children:"Provider:"})," ",t.provider||"-"]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("strong",{children:"Public Model Name:"})," ",a]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("strong",{children:"LiteLLM Model Name:"})," ",t.litellm_model_name||"-"]})]});return(0,s.jsx)(A.Z,{title:r,children:(0,s.jsxs)("div",{className:"flex items-start space-x-2 min-w-0 w-full max-w-[250px]",children:[(0,s.jsx)("div",{className:"flex-shrink-0 mt-0.5",children:t.provider?(0,s.jsx)(lt,{provider:t.provider}):(0,s.jsx)("div",{className:"w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",children:"-"})}),(0,s.jsxs)("div",{className:"flex flex-col min-w-0 flex-1",children:[(0,s.jsx)("div",{className:"text-xs font-medium text-gray-900 truncate max-w-[210px]",children:a}),(0,s.jsx)("div",{className:"text-xs text-gray-500 truncate mt-0.5 max-w-[210px]",children:t.litellm_model_name||"-"})]})]})})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Credentials"}),accessorKey:"litellm_credential_name",size:180,cell:e=>{var l;let{row:t}=e,a=null===(l=t.original.litellm_params)||void 0===l?void 0:l.litellm_credential_name;return a?(0,s.jsx)(A.Z,{title:"Credential: ".concat(a),children:(0,s.jsxs)("div",{className:"flex items-center space-x-2 max-w-[180px]",children:[(0,s.jsx)(eW.Z,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}),(0,s.jsx)("span",{className:"text-xs truncate",title:a,children:a})]})}):(0,s.jsxs)("div",{className:"flex items-center space-x-2 max-w-[180px]",children:[(0,s.jsx)(eW.Z,{className:"w-4 h-4 text-gray-300 flex-shrink-0"}),(0,s.jsx)("span",{className:"text-xs text-gray-400",children:"No credentials"})]})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Created By"}),accessorKey:"model_info.created_by",sortingFn:"datetime",size:160,cell:e=>{var l;let{row:t}=e,a=t.original,r=!(null===(l=a.model_info)||void 0===l?void 0:l.db_model),i=a.model_info.created_by,n=a.model_info.created_at?new Date(a.model_info.created_at).toLocaleDateString():null;return(0,s.jsxs)("div",{className:"flex flex-col min-w-0 max-w-[160px]",children:[(0,s.jsx)("div",{className:"text-xs font-medium text-gray-900 truncate",title:r?"Defined in config":i||"Unknown",children:r?"Defined in config":i||"Unknown"}),(0,s.jsx)("div",{className:"text-xs text-gray-500 truncate mt-0.5",title:r?"Config file":n||"Unknown date",children:r?"-":n||"Unknown date"})]})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Updated At"}),accessorKey:"model_info.updated_at",sortingFn:"datetime",cell:e=>{let{row:l}=e,t=l.original;return(0,s.jsx)("span",{className:"text-xs",children:t.model_info.updated_at?new Date(t.model_info.updated_at).toLocaleDateString():"-"})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Costs"}),accessorKey:"input_cost",size:120,cell:e=>{let{row:l}=e,t=l.original,a=t.input_cost,r=t.output_cost;return a||r?(0,s.jsx)(A.Z,{title:"Cost per 1M tokens",children:(0,s.jsxs)("div",{className:"flex flex-col min-w-0 max-w-[120px]",children:[a&&(0,s.jsxs)("div",{className:"text-xs font-medium text-gray-900 truncate",children:["In: $",a]}),r&&(0,s.jsxs)("div",{className:"text-xs text-gray-500 truncate mt-0.5",children:["Out: $",r]})]})}):(0,s.jsx)("div",{className:"max-w-[120px]",children:(0,s.jsx)("span",{className:"text-xs text-gray-400",children:"-"})})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Team ID"}),accessorKey:"model_info.team_id",cell:e=>{let{row:l}=e,t=l.original;return t.model_info.team_id?(0,s.jsx)("div",{className:"overflow-hidden",children:(0,s.jsx)(A.Z,{title:t.model_info.team_id,children:(0,s.jsxs)(eY.Z,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left overflow-hidden truncate max-w-[200px]",onClick:()=>r(t.model_info.team_id),children:[t.model_info.team_id.slice(0,7),"..."]})})}):"-"}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Model Access Group"}),accessorKey:"model_info.model_access_group",enableSorting:!1,cell:e=>{let{row:l}=e,t=l.original,a=t.model_info.access_groups;if(!a||0===a.length)return"-";let r=t.model_info.id,i=c.has(r),n=a.length>1,o=()=>{let e=new Set(c);i?e.delete(r):e.add(r),m(e)};return(0,s.jsxs)("div",{className:"flex items-center gap-1 overflow-hidden",children:[(0,s.jsx)(ll.Z,{size:"xs",color:"blue",className:"text-xs px-1.5 py-0.5 h-5 leading-tight flex-shrink-0",children:a[0]}),(i||!n&&2===a.length)&&a.slice(1).map((e,l)=>(0,s.jsx)(ll.Z,{size:"xs",color:"blue",className:"text-xs px-1.5 py-0.5 h-5 leading-tight flex-shrink-0",children:e},l+1)),n&&(0,s.jsx)("button",{onClick:e=>{e.stopPropagation(),o()},className:"text-xs text-blue-600 hover:text-blue-800 px-1 py-0.5 rounded hover:bg-blue-50 h-5 leading-tight flex-shrink-0 whitespace-nowrap",children:i?"−":"+".concat(a.length-1)})]})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Status"}),accessorKey:"model_info.db_model",cell:e=>{let{row:l}=e,t=l.original;return(0,s.jsx)("div",{className:"\n inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium\n ".concat(t.model_info.db_model?"bg-blue-50 text-blue-600":"bg-gray-100 text-gray-600","\n "),children:t.model_info.db_model?"DB Model":"Config Model"})}},{id:"actions",header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Actions"}),cell:t=>{var r,i;let{row:n}=t,o=n.original,c="Admin"===e||(null===(r=o.model_info)||void 0===r?void 0:r.created_by)===l,m=!(null===(i=o.model_info)||void 0===i?void 0:i.db_model);return(0,s.jsx)("div",{className:"flex items-center justify-end gap-2 pr-4",children:m?(0,s.jsx)(A.Z,{title:"Config model cannot be deleted on the dashboard. Please delete it from the config file.",children:(0,s.jsx)($.Z,{icon:y.Z,size:"sm",className:"opacity-50 cursor-not-allowed"})}):(0,s.jsx)(A.Z,{title:"Delete model",children:(0,s.jsx)($.Z,{icon:y.Z,size:"sm",onClick:()=>{c&&(a(o.model_info.id),d(!1))},className:c?"cursor-pointer hover:text-red-600":"opacity-50 cursor-not-allowed"})})})}}];var la=t(27281),lr=t(57365),li=e=>{let{selectedModelGroup:l,setSelectedModelGroup:t,availableModelGroups:a,availableModelAccessGroups:r,setSelectedModelId:d,setSelectedTeamId:c,setEditModel:m,modelData:u}=e,{userId:h,userRole:x,premiumUser:p}=(0,K.Z)(),{teams:g}=(0,e7.Z)(),[f,j]=(0,o.useState)(""),[v,_]=(0,o.useState)("current_team"),[y,b]=(0,o.useState)("personal"),[N,Z]=(0,o.useState)(!1),[w,C]=(0,o.useState)(null),[S,k]=(0,o.useState)(new Set),[A,E]=(0,o.useState)({pageIndex:0,pageSize:50}),M=(0,o.useRef)(null),I=(0,o.useMemo)(()=>u&&u.data&&0!==u.data.length?u.data.filter(e=>{var t,s,a,r,i,n;let o=""===f||e.model_name.toLowerCase().includes(f.toLowerCase()),d="all"===l||e.model_name===l||!l||"wildcard"===l&&(null===(t=e.model_name)||void 0===t?void 0:t.includes("*")),c="all"===w||(null===(s=e.model_info.access_groups)||void 0===s?void 0:s.includes(w))||!w,m=!0;if("current_team"===v){if("personal"===y)m=(null===(a=e.model_info)||void 0===a?void 0:a.direct_access)===!0;else{let l=(null===(i=e.model_info)||void 0===i?void 0:null===(r=i.access_via_team_ids)||void 0===r?void 0:r.includes(y.team_id))===!0,t=(null===(n=y.models)||void 0===n?void 0:n.some(l=>{var t,s;return null===(s=e.model_info)||void 0===s?void 0:null===(t=s.access_groups)||void 0===t?void 0:t.includes(l)}))===!0;m=l||t}}return o&&d&&c&&m}):[],[u,f,l,w,y,v]),F=(0,o.useMemo)(()=>{let e=A.pageIndex*A.pageSize,l=e+A.pageSize;return I.slice(e,l)},[I,A.pageIndex,A.pageSize]);return(0,o.useEffect)(()=>{E(e=>({...e,pageIndex:0}))},[f,l,w,y,v]),(0,s.jsx)(el.Z,{children:(0,s.jsx)(i.Z,{children:(0,s.jsx)("div",{className:"flex flex-col space-y-4",children:(0,s.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,s.jsxs)("div",{className:"border-b px-6 py-4 bg-gray-50",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsx)(n.Z,{className:"text-lg font-semibold text-gray-900",children:"Current Team:"}),(0,s.jsxs)(la.Z,{className:"w-80",defaultValue:"personal",value:"personal"===y?"personal":y.team_id,onValueChange:e=>{if("personal"===e)b("personal");else{let l=null==g?void 0:g.find(l=>l.team_id===e);l&&b(l)}},children:[(0,s.jsx)(lr.Z,{value:"personal",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,s.jsx)("span",{className:"font-medium",children:"Personal"})]})}),null==g?void 0:g.filter(e=>e.team_id).map(e=>(0,s.jsx)(lr.Z,{value:e.team_id,children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,s.jsx)("span",{className:"font-medium",children:e.team_alias?"".concat(e.team_alias.slice(0,30),"..."):"Team ".concat(e.team_id.slice(0,30),"...")})]})},e.team_id))]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsx)(n.Z,{className:"text-lg font-semibold text-gray-900",children:"View:"}),(0,s.jsxs)(la.Z,{className:"w-64",defaultValue:"current_team",value:v,onValueChange:e=>_(e),children:[(0,s.jsx)(lr.Z,{value:"current_team",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-purple-500 rounded-full"}),(0,s.jsx)("span",{className:"font-medium",children:"Current Team Models"})]})}),(0,s.jsx)(lr.Z,{value:"all",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-gray-500 rounded-full"}),(0,s.jsx)("span",{className:"font-medium",children:"All Available Models"})]})})]})]})]}),"current_team"===v&&(0,s.jsxs)("div",{className:"flex items-start gap-2 mt-3",children:[(0,s.jsx)(eu.Z,{className:"text-gray-400 mt-0.5 flex-shrink-0 text-xs"}),(0,s.jsx)("div",{className:"text-xs text-gray-500",children:"personal"===y?(0,s.jsxs)("span",{children:["To access these models: Create a Virtual Key without selecting a team on the"," ",(0,s.jsx)("a",{href:"/public?login=success&page=api-keys",className:"text-gray-600 hover:text-gray-800 underline",children:"Virtual Keys page"})]}):(0,s.jsxs)("span",{children:['To access these models: Create a Virtual Key and select Team as "',"string"!=typeof y?y.team_alias||y.team_id:"",'" on the'," ",(0,s.jsx)("a",{href:"/public?login=success&page=api-keys",className:"text-gray-600 hover:text-gray-800 underline",children:"Virtual Keys page"})]})})]})]}),(0,s.jsx)("div",{className:"border-b px-6 py-4",children:(0,s.jsxs)("div",{className:"flex flex-col space-y-4",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,s.jsxs)("div",{className:"relative w-64",children:[(0,s.jsx)("input",{type:"text",placeholder:"Search model names...",className:"w-full px-3 py-2 pl-8 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",value:f,onChange:e=>j(e.target.value)}),(0,s.jsx)("svg",{className:"absolute left-2.5 top-2.5 h-4 w-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})]}),(0,s.jsxs)("button",{className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2 ".concat(N?"bg-gray-100":""),onClick:()=>Z(!N),children:[(0,s.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z"})}),"Filters"]}),(0,s.jsxs)("button",{className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2",onClick:()=>{j(""),t("all"),C(null),b("personal"),_("current_team"),E({pageIndex:0,pageSize:50})},children:[(0,s.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Reset Filters"]})]}),N&&(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-3 mt-3",children:[(0,s.jsx)("div",{className:"w-64",children:(0,s.jsxs)(la.Z,{value:null!=l?l:"all",onValueChange:e=>t("all"===e?"all":e),placeholder:"Filter by Public Model Name",children:[(0,s.jsx)(lr.Z,{value:"all",children:"All Models"}),(0,s.jsx)(lr.Z,{value:"wildcard",children:"Wildcard Models (*)"}),a.map((e,l)=>(0,s.jsx)(lr.Z,{value:e,children:e},l))]})}),(0,s.jsx)("div",{className:"w-64",children:(0,s.jsxs)(la.Z,{value:null!=w?w:"all",onValueChange:e=>C("all"===e?null:e),placeholder:"Filter by Model Access Group",children:[(0,s.jsx)(lr.Z,{value:"all",children:"All Model Access Groups"}),r.map((e,l)=>(0,s.jsx)(lr.Z,{value:e,children:e},l))]})})]}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)("span",{className:"text-sm text-gray-700",children:I.length>0?"Showing ".concat(A.pageIndex*A.pageSize+1," - ").concat(Math.min((A.pageIndex+1)*A.pageSize,I.length)," of ").concat(I.length," results"):"Showing 0 results"}),I.length>A.pageSize&&(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("button",{onClick:()=>E(e=>({...e,pageIndex:e.pageIndex-1})),disabled:0===A.pageIndex,className:"px-3 py-1 text-sm border rounded-md ".concat(0===A.pageIndex?"bg-gray-100 text-gray-400 cursor-not-allowed":"hover:bg-gray-50"),children:"Previous"}),(0,s.jsx)("button",{onClick:()=>E(e=>({...e,pageIndex:e.pageIndex+1})),disabled:A.pageIndex>=Math.ceil(I.length/A.pageSize)-1,className:"px-3 py-1 text-sm border rounded-md ".concat(A.pageIndex>=Math.ceil(I.length/A.pageSize)-1?"bg-gray-100 text-gray-400 cursor-not-allowed":"hover:bg-gray-50"),children:"Next"})]})]})]})}),(0,s.jsx)(le.C,{columns:ls(x,h,p,d,c,W,()=>{},()=>{},m,S,k),data:F,isLoading:!1,table:M})]})})})})},ln=t(75105),lo=t(40278),ld=t(97765),lc=t(21626),lm=t(97214),lu=t(28241),lh=t(58834),lx=t(69552),lp=t(71876),lg=t(39789),lf=t(79326),lj=t(2356),lv=t(59664),l_=e=>{let{modelMetrics:l,modelMetricsCategories:t,customTooltip:a,premiumUser:r}=e;return(0,s.jsx)(lv.Z,{title:"Time to First token (s)",className:"h-72",data:l,index:"date",showLegend:!1,categories:t,colors:["indigo","rose"],connectNulls:!0,customTooltip:a})},ly=e=>{let{setSelectedAPIKey:l,keys:t,teams:a,setSelectedCustomer:r,allEndUsers:i}=e,{premiumUser:d}=(0,K.Z)(),[c,m]=(0,o.useState)(null);return(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"mb-1",children:"Select API Key Name"}),d?(0,s.jsxs)("div",{children:[(0,s.jsxs)(la.Z,{defaultValue:"all-keys",children:[(0,s.jsx)(lr.Z,{value:"all-keys",onClick:()=>{l(null)},children:"All Keys"},"all-keys"),null==t?void 0:t.map((e,t)=>e&&null!==e.key_alias&&e.key_alias.length>0?(0,s.jsx)(lr.Z,{value:String(t),onClick:()=>{l(e)},children:e.key_alias},t):null)]}),(0,s.jsx)(n.Z,{className:"mt-1",children:"Select Customer Name"}),(0,s.jsxs)(la.Z,{defaultValue:"all-customers",children:[(0,s.jsx)(lr.Z,{value:"all-customers",onClick:()=>{r(null)},children:"All Customers"},"all-customers"),null==i?void 0:i.map((e,l)=>(0,s.jsx)(lr.Z,{value:e,onClick:()=>{r(e)},children:e},l))]}),(0,s.jsx)(n.Z,{className:"mt-1",children:"Select Team"}),(0,s.jsxs)(la.Z,{className:"w-64 relative z-50",defaultValue:"all",value:null!=c?c:"all",onValueChange:e=>m("all"===e?null:e),children:[(0,s.jsx)(lr.Z,{value:"all",children:"All Teams"}),null==a?void 0:a.filter(e=>e.team_id).map(e=>(0,s.jsx)(lr.Z,{value:e.team_id,children:e.team_alias?"".concat(e.team_alias," (").concat(e.team_id.slice(0,8),"...)"):"Team ".concat(e.team_id.slice(0,8),"...")},e.team_id))]})]}):(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"mt-1",children:"Select Team"}),(0,s.jsxs)(la.Z,{className:"w-64 relative z-50",defaultValue:"all",value:null!=c?c:"all",onValueChange:e=>m("all"===e?null:e),children:[(0,s.jsx)(lr.Z,{value:"all",children:"All Teams"}),null==a?void 0:a.filter(e=>e.team_id).map(e=>(0,s.jsx)(lr.Z,{value:e.team_id,children:e.team_alias?"".concat(e.team_alias," (").concat(e.team_id.slice(0,8),"...)"):"Team ".concat(e.team_id.slice(0,8),"...")},e.team_id))]})]})]})},lb=e=>{let{dateValue:l,setDateValue:t,selectedModelGroup:a,availableModelGroups:d,setShowAdvancedFilters:m,modelMetrics:u,modelMetricsCategories:h,streamingModelMetrics:x,streamingModelMetricsCategories:p,customTooltip:g,slowResponsesData:f,modelExceptions:j,globalExceptionData:v,allExceptions:_,globalExceptionPerDeployment:y,setSelectedAPIKey:b,keys:N,setSelectedCustomer:Z,teams:w,allEndUsers:C,selectedAPIKey:S,selectedCustomer:k,selectedTeam:A,setSelectedModelGroup:E,setModelMetrics:M,setModelMetricsCategories:I,setStreamingModelMetrics:F,setStreamingModelMetricsCategories:P,setSlowResponsesData:L,setModelExceptions:T,setAllExceptions:R,setGlobalExceptionData:O,setGlobalExceptionPerDeployment:V}=e,{accessToken:D,userId:z,userRole:q,premiumUser:B}=(0,K.Z)();(0,o.useEffect)(()=>{U(a,l.from,l.to)},[S,k,A]);let U=async(e,l,t)=>{if(console.log("Updating model metrics for group:",e),!D||!z||!q||!l||!t)return;console.log("inside updateModelMetrics - startTime:",l,"endTime:",t),E(e);let s=null==S?void 0:S.token;void 0===s&&(s=null);let a=k;void 0===a&&(a=null);try{let r=await (0,c.modelMetricsCall)(D,z,q,e,l.toISOString(),t.toISOString(),s,a);console.log("Model metrics response:",r),M(r.data),I(r.all_api_bases);let i=await (0,c.streamingModelMetricsCall)(D,e,l.toISOString(),t.toISOString());F(i.data),P(i.all_api_bases);let n=await (0,c.modelExceptionsCall)(D,z,q,e,l.toISOString(),t.toISOString(),s,a);console.log("Model exceptions response:",n),T(n.data),R(n.exception_types);let o=await (0,c.modelMetricsSlowResponsesCall)(D,z,q,e,l.toISOString(),t.toISOString(),s,a);if(console.log("slowResponses:",o),L(o),e){let s=await (0,c.adminGlobalActivityExceptions)(D,null==l?void 0:l.toISOString().split("T")[0],null==t?void 0:t.toISOString().split("T")[0],e);O(s);let a=await (0,c.adminGlobalActivityExceptionsPerDeployment)(D,null==l?void 0:l.toISOString().split("T")[0],null==t?void 0:t.toISOString().split("T")[0],e);V(a)}}catch(e){console.error("Failed to fetch model metrics",e)}};return(0,s.jsxs)(el.Z,{children:[(0,s.jsx)("div",{className:"mb-4 rounded-md border border-red-500 bg-red-50 p-4",children:(0,s.jsx)(n.Z,{className:"font-semibold text-red-700",children:"This page is deprecated and will be removed in the future. Some functionality may not work as expected."})}),(0,s.jsxs)(i.Z,{numItems:4,className:"mt-2 mb-2",children:[(0,s.jsx)(r.Z,{children:(0,s.jsx)(lg.Z,{value:l,className:"mr-2",onValueChange:e=>{t(e),U(a,e.from,e.to)}})}),(0,s.jsxs)(r.Z,{className:"ml-2",children:[(0,s.jsx)(n.Z,{children:"Select Model Group"}),(0,s.jsx)(la.Z,{defaultValue:a||d[0],value:a||d[0],children:d.map((e,t)=>(0,s.jsx)(lr.Z,{value:e,onClick:()=>U(e,l.from,l.to),children:e},t))})]}),(0,s.jsx)(r.Z,{children:(0,s.jsx)(lf.Z,{trigger:"click",content:(0,s.jsx)(ly,{allEndUsers:C,keys:N,setSelectedAPIKey:b,setSelectedCustomer:Z,teams:w}),overlayStyle:{width:"20vw"},children:(0,s.jsx)(eY.Z,{icon:lj.Z,size:"md",variant:"secondary",className:"mt-4 ml-2",style:{border:"none"},onClick:()=>m(!0)})})})]}),(0,s.jsxs)(i.Z,{numItems:2,children:[(0,s.jsx)(r.Z,{children:(0,s.jsx)(e$.Z,{className:"mr-2 max-h-[400px] min-h-[400px]",children:(0,s.jsxs)(X.Z,{children:[(0,s.jsxs)(ee.Z,{variant:"line",defaultValue:"1",children:[(0,s.jsx)(Q.Z,{value:"1",children:"Avg. Latency per Token"}),(0,s.jsx)(Q.Z,{value:"2",children:"Time to first token"})]}),(0,s.jsxs)(et.Z,{children:[(0,s.jsxs)(el.Z,{children:[(0,s.jsx)("p",{className:"text-gray-500 italic",children:" (seconds/token)"}),(0,s.jsx)(n.Z,{className:"text-gray-500 italic mt-1 mb-1",children:"average Latency for successfull requests divided by the total tokens"}),u&&h&&(0,s.jsx)(ln.Z,{title:"Model Latency",className:"h-72",data:u,showLegend:!1,index:"date",categories:h,connectNulls:!0,customTooltip:g})]}),(0,s.jsx)(el.Z,{children:(0,s.jsx)(l_,{modelMetrics:x,modelMetricsCategories:p,customTooltip:g,premiumUser:B})})]})]})})}),(0,s.jsx)(r.Z,{children:(0,s.jsx)(e$.Z,{className:"ml-2 max-h-[400px] min-h-[400px] overflow-y-auto",children:(0,s.jsxs)(lc.Z,{children:[(0,s.jsx)(lh.Z,{children:(0,s.jsxs)(lp.Z,{children:[(0,s.jsx)(lx.Z,{children:"Deployment"}),(0,s.jsx)(lx.Z,{children:"Success Responses"}),(0,s.jsxs)(lx.Z,{children:["Slow Responses ",(0,s.jsx)("p",{children:"Success Responses taking 600+s"})]})]})}),(0,s.jsx)(lm.Z,{children:f.map((e,l)=>(0,s.jsxs)(lp.Z,{children:[(0,s.jsx)(lu.Z,{children:e.api_base}),(0,s.jsx)(lu.Z,{children:e.total_count}),(0,s.jsx)(lu.Z,{children:e.slow_count})]},l))})]})})})]}),(0,s.jsx)(i.Z,{numItems:1,className:"gap-2 w-full mt-2",children:(0,s.jsxs)(e$.Z,{children:[(0,s.jsxs)(eX.Z,{children:["All Exceptions for ",a]}),(0,s.jsx)(lo.Z,{className:"h-60",data:j,index:"model",categories:_,stack:!0,yAxisWidth:30})]})}),(0,s.jsxs)(i.Z,{numItems:1,className:"gap-2 w-full mt-2",children:[(0,s.jsxs)(e$.Z,{children:[(0,s.jsxs)(eX.Z,{children:["All Up Rate Limit Errors (429) for ",a]}),(0,s.jsxs)(i.Z,{numItems:1,children:[(0,s.jsxs)(r.Z,{children:[(0,s.jsxs)(ld.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Num Rate Limit Errors ",v.sum_num_rate_limit_exceptions]}),(0,s.jsx)(lo.Z,{className:"h-40",data:v.daily_data,index:"date",colors:["rose"],categories:["num_rate_limit_exceptions"],onValueChange:e=>console.log(e)})]}),(0,s.jsx)(r.Z,{})]})]}),B?(0,s.jsx)(s.Fragment,{children:y.map((e,l)=>(0,s.jsxs)(e$.Z,{children:[(0,s.jsx)(eX.Z,{children:e.api_base?e.api_base:"Unknown API Base"}),(0,s.jsx)(i.Z,{numItems:1,children:(0,s.jsxs)(r.Z,{children:[(0,s.jsxs)(ld.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Num Rate Limit Errors (429) ",e.sum_num_rate_limit_exceptions]}),(0,s.jsx)(lo.Z,{className:"h-40",data:e.daily_data,index:"date",colors:["rose"],categories:["num_rate_limit_exceptions"],onValueChange:e=>console.log(e)})]})})]},l))}):(0,s.jsx)(s.Fragment,{children:y&&y.length>0&&y.slice(0,1).map((e,l)=>(0,s.jsxs)(e$.Z,{children:[(0,s.jsx)(eX.Z,{children:"✨ Rate Limit Errors by Deployment"}),(0,s.jsx)("p",{className:"mb-2 text-gray-500 italic text-[12px]",children:"Upgrade to see exceptions for all deployments"}),(0,s.jsx)(eY.Z,{variant:"primary",className:"mb-2",children:(0,s.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"Get Free Trial"})}),(0,s.jsxs)(e$.Z,{children:[(0,s.jsx)(eX.Z,{children:e.api_base}),(0,s.jsx)(i.Z,{numItems:1,children:(0,s.jsxs)(r.Z,{children:[(0,s.jsxs)(ld.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Num Rate Limit Errors ",e.sum_num_rate_limit_exceptions]}),(0,s.jsx)(lo.Z,{className:"h-40",data:e.daily_data,index:"date",colors:["rose"],categories:["num_rate_limit_exceptions"],onValueChange:e=>console.log(e)})]})})]})]},l))})]})]})};let lN={"BadRequestError (400)":"BadRequestErrorRetries","AuthenticationError (401)":"AuthenticationErrorRetries","TimeoutError (408)":"TimeoutErrorRetries","RateLimitError (429)":"RateLimitErrorRetries","ContentPolicyViolationError (400)":"ContentPolicyViolationErrorRetries","InternalServerError (500)":"InternalServerErrorRetries"};var lZ=e=>{let{selectedModelGroup:l,setSelectedModelGroup:t,availableModelGroups:a,globalRetryPolicy:r,setGlobalRetryPolicy:i,defaultRetry:o,modelGroupRetryPolicy:d,setModelGroupRetryPolicy:c,handleSaveRetrySettings:m}=e;return(0,s.jsxs)(el.Z,{children:[(0,s.jsx)("div",{className:"flex items-center gap-4 mb-6",children:(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)(n.Z,{children:"Retry Policy Scope:"}),(0,s.jsxs)(la.Z,{className:"ml-2 w-48",defaultValue:"global",value:"global"===l?"global":l||a[0],onValueChange:e=>t(e),children:[(0,s.jsx)(lr.Z,{value:"global",children:"Global Default"}),a.map((e,l)=>(0,s.jsx)(lr.Z,{value:e,onClick:()=>t(e),children:e},l))]})]})}),"global"===l?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(eX.Z,{children:"Global Retry Policy"}),(0,s.jsx)(n.Z,{className:"mb-6",children:"Default retry settings applied to all model groups unless overridden"})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(eX.Z,{children:["Retry Policy for ",l]}),(0,s.jsx)(n.Z,{className:"mb-6",children:"Model-specific retry settings. Falls back to global defaults if not set."})]}),lN&&(0,s.jsx)("table",{children:(0,s.jsx)("tbody",{children:Object.entries(lN).map((e,t)=>{var a,m,u,h;let x,[p,g]=e;if("global"===l)x=null!==(a=null==r?void 0:r[g])&&void 0!==a?a:o;else{let e=null==d?void 0:null===(m=d[l])||void 0===m?void 0:m[g];x=null!=e?e:null!==(u=null==r?void 0:r[g])&&void 0!==u?u:o}return(0,s.jsxs)("tr",{className:"flex justify-between items-center mt-2",children:[(0,s.jsxs)("td",{children:[(0,s.jsx)(n.Z,{children:p}),"global"!==l&&(0,s.jsxs)(n.Z,{className:"text-xs text-gray-500 ml-2",children:["(Global: ",null!==(h=null==r?void 0:r[g])&&void 0!==h?h:o,")"]})]}),(0,s.jsx)("td",{children:(0,s.jsx)(ej.Z,{className:"ml-5",value:x,min:0,step:1,onChange:e=>{"global"===l?i(l=>null==e?l:{...null!=l?l:{},[g]:e}):c(t=>{var s;let a=null!==(s=null==t?void 0:t[l])&&void 0!==s?s:{};return{...null!=t?t:{},[l]:{...a,[g]:e}}})}})})]},t)})})}),(0,s.jsx)(eY.Z,{className:"mt-6 mr-8",onClick:m,children:"Save"})]})},lw=t(58760),lC=t(867),lS=t(3810),lk=t(89245),lA=t(5540),lE=t(8881);let{Text:lM}=C.default;var lI=e=>{let{accessToken:l,onReloadSuccess:t,buttonText:a="Reload Price Data",showIcon:r=!0,size:i="middle",type:n="primary",className:m=""}=e,[u,h]=(0,o.useState)(!1),[x,p]=(0,o.useState)(!1),[g,f]=(0,o.useState)(!1),[j,v]=(0,o.useState)(!1),[_,y]=(0,o.useState)(6),[b,N]=(0,o.useState)(null),[Z,w]=(0,o.useState)(!1);(0,o.useEffect)(()=>{C();let e=setInterval(()=>{C()},3e4);return()=>clearInterval(e)},[l]);let C=async()=>{if(l){w(!0);try{console.log("Fetching reload status...");let e=await (0,c.getModelCostMapReloadStatus)(l);console.log("Received status:",e),N(e)}catch(e){console.error("Failed to fetch reload status:",e),N({scheduled:!1,interval_hours:null,last_run:null,next_run:null})}finally{w(!1)}}},k=async()=>{if(!l){d.Z.fromBackend("No access token available");return}h(!0);try{let e=await (0,c.reloadModelCostMap)(l);"success"===e.status?(d.Z.success("Price data reloaded successfully! ".concat(e.models_count||0," models updated.")),null==t||t(),await C()):d.Z.fromBackend("Failed to reload price data")}catch(e){console.error("Error reloading price data:",e),d.Z.fromBackend("Failed to reload price data. Please try again.")}finally{h(!1)}},A=async()=>{if(!l){d.Z.fromBackend("No access token available");return}if(_<=0){d.Z.fromBackend("Hours must be greater than 0");return}p(!0);try{let e=await (0,c.scheduleModelCostMapReload)(l,_);"success"===e.status?(d.Z.success("Periodic reload scheduled for every ".concat(_," hours")),v(!1),await C()):d.Z.fromBackend("Failed to schedule periodic reload")}catch(e){console.error("Error scheduling reload:",e),d.Z.fromBackend("Failed to schedule periodic reload. Please try again.")}finally{p(!1)}},M=async()=>{if(!l){d.Z.fromBackend("No access token available");return}f(!0);try{let e=await (0,c.cancelModelCostMapReload)(l);"success"===e.status?(d.Z.success("Periodic reload cancelled successfully"),await C()):d.Z.fromBackend("Failed to cancel periodic reload")}catch(e){console.error("Error cancelling reload:",e),d.Z.fromBackend("Failed to cancel periodic reload. Please try again.")}finally{f(!1)}},I=e=>{if(!e)return"Never";try{return new Date(e).toLocaleString()}catch(l){return e}};return(0,s.jsxs)("div",{className:m,children:[(0,s.jsxs)(lw.Z,{direction:"horizontal",size:"middle",style:{marginBottom:16},children:[(0,s.jsx)(lC.Z,{title:"Hard Refresh Price Data",description:"This will immediately fetch the latest pricing information from the remote source. Continue?",onConfirm:k,okText:"Yes",cancelText:"No",okButtonProps:{style:{backgroundColor:"#6366f1",borderColor:"#6366f1",color:"white",fontWeight:"500",borderRadius:"0.375rem",padding:"0.375rem 0.75rem",height:"auto",fontSize:"0.875rem",lineHeight:"1.25rem",transition:"all 0.2s ease-in-out"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#4f46e5"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#6366f1"}},children:(0,s.jsx)(E.ZP,{type:n,size:i,loading:u,icon:r?(0,s.jsx)(lk.Z,{}):void 0,style:{backgroundColor:"#6366f1",borderColor:"#6366f1",color:"white",fontWeight:"500",borderRadius:"0.375rem",padding:"0.375rem 0.75rem",height:"auto",fontSize:"0.875rem",lineHeight:"1.25rem",transition:"all 0.2s ease-in-out"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#4f46e5"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#6366f1"},children:a})}),(null==b?void 0:b.scheduled)?(0,s.jsx)(E.ZP,{type:"default",size:i,danger:!0,icon:(0,s.jsx)(lE.Z,{}),loading:g,onClick:M,style:{borderColor:"#ff4d4f",color:"#ff4d4f",fontWeight:"500",borderRadius:"0.375rem",padding:"0.375rem 0.75rem",height:"auto",fontSize:"0.875rem",lineHeight:"1.25rem"},children:"Cancel Periodic Reload"}):(0,s.jsx)(E.ZP,{type:"default",size:i,icon:(0,s.jsx)(lA.Z,{}),onClick:()=>v(!0),style:{borderColor:"#d9d9d9",color:"#6366f1",fontWeight:"500",borderRadius:"0.375rem",padding:"0.375rem 0.75rem",height:"auto",fontSize:"0.875rem",lineHeight:"1.25rem"},children:"Set Up Periodic Reload"})]}),b&&(0,s.jsx)(er.Z,{size:"small",style:{backgroundColor:"#f8f9fa",border:"1px solid #e9ecef",borderRadius:8},children:(0,s.jsxs)(lw.Z,{direction:"vertical",size:"small",style:{width:"100%"},children:[b.scheduled?(0,s.jsx)("div",{children:(0,s.jsxs)(lS.Z,{color:"green",icon:(0,s.jsx)(lA.Z,{}),children:["Scheduled every ",b.interval_hours," hours"]})}):(0,s.jsx)(lM,{type:"secondary",children:"No periodic reload scheduled"}),(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,s.jsx)(lM,{type:"secondary",style:{fontSize:"12px"},children:"Last run:"}),(0,s.jsx)(lM,{style:{fontSize:"12px"},children:I(b.last_run)})]}),b.scheduled&&(0,s.jsxs)(s.Fragment,{children:[b.next_run&&(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,s.jsx)(lM,{type:"secondary",style:{fontSize:"12px"},children:"Next run:"}),(0,s.jsx)(lM,{style:{fontSize:"12px"},children:I(b.next_run)})]}),(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,s.jsx)(lM,{type:"secondary",style:{fontSize:"12px"},children:"Status:"}),(0,s.jsx)(lS.Z,{color:(null==b?void 0:b.scheduled)?b.last_run?"success":"processing":"default",children:(null==b?void 0:b.scheduled)?b.last_run?"Active":"Ready":"Not scheduled"})]})]})]})}),(0,s.jsxs)(S.Z,{title:"Set Up Periodic Reload",open:j,onOk:A,onCancel:()=>v(!1),confirmLoading:x,okText:"Schedule",cancelText:"Cancel",okButtonProps:{style:{backgroundColor:"#6366f1",borderColor:"#6366f1",color:"white"}},children:[(0,s.jsx)("div",{style:{marginBottom:16},children:(0,s.jsx)(lM,{children:"Set up automatic reload of price data every:"})}),(0,s.jsx)("div",{style:{marginBottom:16},children:(0,s.jsx)(ej.Z,{min:1,max:168,value:_,onChange:e=>y(e||6),addonAfter:"hours",style:{width:"100%"}})}),(0,s.jsx)("div",{children:(0,s.jsxs)(lM,{type:"secondary",children:["This will automatically fetch the latest pricing data from the remote source every ",_," hours."]})})]})]})},lF=e=>{let{setModelMap:l}=e,{accessToken:t}=(0,K.Z)();return(0,s.jsx)(el.Z,{children:(0,s.jsxs)("div",{className:"p-6",children:[(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsx)(eX.Z,{children:"Price Data Management"}),(0,s.jsx)(n.Z,{className:"text-tremor-content",children:"Manage model pricing data and configure automatic reload schedules"})]}),(0,s.jsx)(lI,{accessToken:t,onReloadSuccess:()=>{(async()=>{l(await (0,c.modelCostMap)(t))})()},buttonText:"Reload Price Data",size:"middle",type:"primary",className:"w-full"})]})})},lP=t(4156),lL=t(15731),lT=t(91126);let lR=(e,l,t,a,r,i,n,o,d,c,m)=>[{header:()=>(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(lP.Z,{checked:t,indeterminate:l.length>0&&!t,onChange:e=>r(e.target.checked),onClick:e=>e.stopPropagation()}),(0,s.jsx)("span",{children:"Model ID"})]}),accessorKey:"model_info.id",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:t}=e,r=t.original,i=r.model_name,n=l.includes(i);return(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(lP.Z,{checked:n,onChange:e=>a(i,e.target.checked),onClick:e=>e.stopPropagation()}),(0,s.jsx)(A.Z,{title:r.model_info.id,children:(0,s.jsx)("div",{className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[15ch]",onClick:()=>m&&m(r.model_info.id),children:r.model_info.id})})]})}},{header:"Model Name",accessorKey:"model_name",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:l}=e,t=l.original,a=o(t)||t.model_name;return(0,s.jsx)("div",{className:"font-medium text-sm",children:(0,s.jsx)(A.Z,{title:a,children:(0,s.jsx)("div",{className:"truncate max-w-[200px]",children:a})})})}},{header:"Health Status",accessorKey:"health_status",enableSorting:!0,sortingFn:(e,l,t)=>{var s,a;let r=e.getValue("health_status")||"unknown",i=l.getValue("health_status")||"unknown",n={healthy:0,checking:1,unknown:2,unhealthy:3};return(null!==(s=n[r])&&void 0!==s?s:4)-(null!==(a=n[i])&&void 0!==a?a:4)},cell:l=>{var t;let{row:a}=l,r=a.original,i={status:r.health_status,loading:r.health_loading,error:r.health_error};if(i.loading)return(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsxs)("div",{className:"flex space-x-1",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-indigo-500 rounded-full animate-pulse"}),(0,s.jsx)("div",{className:"w-2 h-2 bg-indigo-500 rounded-full animate-pulse",style:{animationDelay:"0.2s"}}),(0,s.jsx)("div",{className:"w-2 h-2 bg-indigo-500 rounded-full animate-pulse",style:{animationDelay:"0.4s"}})]}),(0,s.jsx)(eb.x,{className:"text-gray-600 text-sm",children:"Checking..."})]});let o=r.model_name,d="healthy"===i.status&&(null===(t=e[o])||void 0===t?void 0:t.successResponse);return(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[n(i.status),d&&c&&(0,s.jsx)(A.Z,{title:"View response details",placement:"top",children:(0,s.jsx)("button",{onClick:()=>{var l;return c(o,null===(l=e[o])||void 0===l?void 0:l.successResponse)},className:"p-1 text-green-600 hover:text-green-800 hover:bg-green-50 rounded cursor-pointer transition-colors",children:(0,s.jsx)(lL.Z,{className:"h-4 w-4"})})})]})}},{header:"Error Details",accessorKey:"health_error",enableSorting:!1,cell:l=>{let{row:t}=l,a=t.original.model_name,r=e[a];if(!(null==r?void 0:r.error))return(0,s.jsx)(eb.x,{className:"text-gray-400 text-sm",children:"No errors"});let i=r.error,n=r.fullError||r.error;return(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"max-w-[200px]",children:(0,s.jsx)(A.Z,{title:i,placement:"top",children:(0,s.jsx)(eb.x,{className:"text-red-600 text-sm truncate",children:i})})}),d&&n!==i&&(0,s.jsx)(A.Z,{title:"View full error details",placement:"top",children:(0,s.jsx)("button",{onClick:()=>d(a,i,n),className:"p-1 text-red-600 hover:text-red-800 hover:bg-red-50 rounded cursor-pointer transition-colors",children:(0,s.jsx)(lL.Z,{className:"h-4 w-4"})})})]})}},{header:"Last Check",accessorKey:"last_check",enableSorting:!0,sortingFn:(e,l,t)=>{let s=e.getValue("last_check")||"Never checked",a=l.getValue("last_check")||"Never checked";if("Never checked"===s&&"Never checked"===a)return 0;if("Never checked"===s)return 1;if("Never checked"===a)return -1;if("Check in progress..."===s&&"Check in progress..."===a)return 0;if("Check in progress..."===s)return -1;if("Check in progress..."===a)return 1;let r=new Date(s),i=new Date(a);return isNaN(r.getTime())&&isNaN(i.getTime())?0:isNaN(r.getTime())?1:isNaN(i.getTime())?-1:i.getTime()-r.getTime()},cell:e=>{let{row:l}=e,t=l.original;return(0,s.jsx)(eb.x,{className:"text-gray-600 text-sm",children:t.health_loading?"Check in progress...":t.last_check})}},{header:"Last Success",accessorKey:"last_success",enableSorting:!0,sortingFn:(e,l,t)=>{let s=e.getValue("last_success")||"Never succeeded",a=l.getValue("last_success")||"Never succeeded";if("Never succeeded"===s&&"Never succeeded"===a)return 0;if("Never succeeded"===s)return 1;if("Never succeeded"===a)return -1;if("None"===s&&"None"===a)return 0;if("None"===s)return 1;if("None"===a)return -1;let r=new Date(s),i=new Date(a);return isNaN(r.getTime())&&isNaN(i.getTime())?0:isNaN(r.getTime())?1:isNaN(i.getTime())?-1:i.getTime()-r.getTime()},cell:l=>{let{row:t}=l,a=e[t.original.model_name],r=(null==a?void 0:a.lastSuccess)||"None";return(0,s.jsx)(eb.x,{className:"text-gray-600 text-sm",children:r})}},{header:"Actions",id:"actions",cell:e=>{let{row:l}=e,t=l.original,a=t.model_name,r=t.health_status&&"none"!==t.health_status,n=t.health_loading?"Checking...":r?"Re-run Health Check":"Run Health Check";return(0,s.jsx)(A.Z,{title:n,placement:"top",children:(0,s.jsx)("button",{className:"p-2 rounded-md transition-colors ".concat(t.health_loading?"text-gray-400 cursor-not-allowed bg-gray-100":"text-indigo-600 hover:text-indigo-700 hover:bg-indigo-50"),onClick:()=>{t.health_loading||i(a)},disabled:t.health_loading,children:t.health_loading?(0,s.jsxs)("div",{className:"flex space-x-1",children:[(0,s.jsx)("div",{className:"w-1 h-1 bg-gray-400 rounded-full animate-pulse"}),(0,s.jsx)("div",{className:"w-1 h-1 bg-gray-400 rounded-full animate-pulse",style:{animationDelay:"0.2s"}}),(0,s.jsx)("div",{className:"w-1 h-1 bg-gray-400 rounded-full animate-pulse",style:{animationDelay:"0.4s"}})]}):r?(0,s.jsx)(Y.Z,{className:"h-4 w-4"}):(0,s.jsx)(lT.Z,{className:"h-4 w-4"})})})},enableSorting:!1}],lO=[{pattern:/Missing .* API Key/i,replacement:"Missing API Key"},{pattern:/Connection timeout/i,replacement:"Connection timeout"},{pattern:/Network.*not.*ok/i,replacement:"Network connection failed"},{pattern:/403.*Forbidden/i,replacement:"Access forbidden - check API key permissions"},{pattern:/401.*Unauthorized/i,replacement:"Unauthorized - invalid API key"},{pattern:/429.*rate limit/i,replacement:"Rate limit exceeded"},{pattern:/500.*Internal Server Error/i,replacement:"Provider internal server error"},{pattern:/litellm\.AuthenticationError/i,replacement:"Authentication failed"},{pattern:/litellm\.RateLimitError/i,replacement:"Rate limit exceeded"},{pattern:/litellm\.APIError/i,replacement:"API error"}];var lV=e=>{let{accessToken:l,modelData:t,all_models_on_proxy:a,getDisplayModelName:r,setSelectedModelId:i}=e,[d,m]=(0,o.useState)({}),[u,h]=(0,o.useState)([]),[x,p]=(0,o.useState)(!1),[g,f]=(0,o.useState)(!1),[j,v]=(0,o.useState)(null),[_,y]=(0,o.useState)(!1),[b,N]=(0,o.useState)(null),Z=(0,o.useRef)(null);(0,o.useEffect)(()=>{l&&(null==t?void 0:t.data)&&(async()=>{let e={};t.data.forEach(l=>{e[l.model_name]={status:"none",lastCheck:"None",lastSuccess:"None",loading:!1,error:void 0,fullError:void 0,successResponse:void 0}});try{let s=await (0,c.latestHealthChecksCall)(l);s&&s.latest_health_checks&&"object"==typeof s.latest_health_checks&&Object.entries(s.latest_health_checks).forEach(l=>{let[s,a]=l;if(!a)return;let r=null,i=t.data.find(e=>e.model_name===s);if(i)r=i.model_name;else{let e=t.data.find(e=>e.model_info&&e.model_info.id===s);if(e)r=e.model_name;else if(a.model_name){let e=t.data.find(e=>e.model_name===a.model_name);e&&(r=e.model_name)}}if(r){let l=a.error_message||void 0;e[r]={status:a.status||"unknown",lastCheck:a.checked_at?new Date(a.checked_at).toLocaleString():"None",lastSuccess:"healthy"===a.status&&a.checked_at?new Date(a.checked_at).toLocaleString():"None",loading:!1,error:l?w(l):void 0,fullError:l,successResponse:"healthy"===a.status?a:void 0}}})}catch(e){console.warn("Failed to load health check history (using default states):",e)}m(e)})()},[l,t]);let w=e=>{var l;if(!e)return"Health check failed";let t="string"==typeof e?e:JSON.stringify(e),s=t.match(/(\w+Error):\s*(\d{3})/i);if(s)return"".concat(s[1],": ").concat(s[2]);let a=t.match(/(AuthenticationError|RateLimitError|BadRequestError|InternalServerError|TimeoutError|NotFoundError|ForbiddenError|ServiceUnavailableError|BadGatewayError|ContentPolicyViolationError|\w+Error)/i),r=t.match(/\b(400|401|403|404|408|429|500|502|503|504)\b/);if(a&&r)return"".concat(a[1],": ").concat(r[1]);if(r){let e=r[1];return"".concat({400:"BadRequestError",401:"AuthenticationError",403:"ForbiddenError",404:"NotFoundError",408:"TimeoutError",429:"RateLimitError",500:"InternalServerError",502:"BadGatewayError",503:"ServiceUnavailableError",504:"GatewayTimeoutError"}[e],": ").concat(e)}if(a){let e=a[1],l={AuthenticationError:"401",RateLimitError:"429",BadRequestError:"400",InternalServerError:"500",TimeoutError:"408",NotFoundError:"404",ForbiddenError:"403",ServiceUnavailableError:"503",BadGatewayError:"502",GatewayTimeoutError:"504",ContentPolicyViolationError:"400"}[e];return l?"".concat(e,": ").concat(l):e}for(let{pattern:e,replacement:l}of lO)if(e.test(t))return l;if(/missing.*api.*key|invalid.*key|unauthorized/i.test(t))return"AuthenticationError: 401";if(/rate.*limit|too.*many.*requests/i.test(t))return"RateLimitError: 429";if(/timeout|timed.*out/i.test(t))return"TimeoutError: 408";if(/not.*found/i.test(t))return"NotFoundError: 404";if(/forbidden|access.*denied/i.test(t))return"ForbiddenError: 403";if(/internal.*server.*error/i.test(t))return"InternalServerError: 500";let i=t.replace(/[\n\r]+/g," ").replace(/\s+/g," ").trim(),n=null===(l=i.split(/[.!?]/)[0])||void 0===l?void 0:l.trim();return n&&n.length>0?n.length>100?n.substring(0,97)+"...":n:i.length>100?i.substring(0,97)+"...":i},C=async e=>{if(l){m(l=>({...l,[e]:{...l[e],loading:!0,status:"checking"}}));try{var s,a;let r=await (0,c.individualModelHealthCheckCall)(l,e),i=new Date().toLocaleString();if(r.unhealthy_count>0&&r.unhealthy_endpoints&&r.unhealthy_endpoints.length>0){let l=(null===(s=r.unhealthy_endpoints[0])||void 0===s?void 0:s.error)||"Health check failed",t=w(l);m(s=>{var a;return{...s,[e]:{status:"unhealthy",lastCheck:i,lastSuccess:(null===(a=s[e])||void 0===a?void 0:a.lastSuccess)||"None",loading:!1,error:t,fullError:l}}})}else m(l=>({...l,[e]:{status:"healthy",lastCheck:i,lastSuccess:i,loading:!1,successResponse:r}}));try{let s=await (0,c.latestHealthChecksCall)(l),r=t.data.find(l=>l.model_name===e);if(r){let l=r.model_info.id,t=null===(a=s.latest_health_checks)||void 0===a?void 0:a[l];if(t){let l=t.error_message||void 0;m(s=>{var a,r,i,n,o,d,c;return{...s,[e]:{status:t.status||(null===(a=s[e])||void 0===a?void 0:a.status)||"unknown",lastCheck:t.checked_at?new Date(t.checked_at).toLocaleString():(null===(r=s[e])||void 0===r?void 0:r.lastCheck)||"None",lastSuccess:"healthy"===t.status?t.checked_at?new Date(t.checked_at).toLocaleString():(null===(i=s[e])||void 0===i?void 0:i.lastSuccess)||"None":(null===(n=s[e])||void 0===n?void 0:n.lastSuccess)||"None",loading:!1,error:l?w(l):null===(o=s[e])||void 0===o?void 0:o.error,fullError:l||(null===(d=s[e])||void 0===d?void 0:d.fullError),successResponse:"healthy"===t.status?t:null===(c=s[e])||void 0===c?void 0:c.successResponse}}})}}}catch(e){console.debug("Could not fetch updated status from database (non-critical):",e)}}catch(a){let l=new Date().toLocaleString(),t=a instanceof Error?a.message:String(a),s=w(t);m(a=>{var r;return{...a,[e]:{status:"unhealthy",lastCheck:l,lastSuccess:(null===(r=a[e])||void 0===r?void 0:r.lastSuccess)||"None",loading:!1,error:s,fullError:t}}})}}},k=async()=>{let e=u.length>0?u:a,s=e.reduce((e,l)=>(e[l]={...d[l],loading:!0,status:"checking"},e),{});m(e=>({...e,...s}));let r={},i=e.map(async e=>{if(l)try{let s=await (0,c.individualModelHealthCheckCall)(l,e);r[e]=s;let a=new Date().toLocaleString();if(s.unhealthy_count>0&&s.unhealthy_endpoints&&s.unhealthy_endpoints.length>0){var t;let l=(null===(t=s.unhealthy_endpoints[0])||void 0===t?void 0:t.error)||"Health check failed",r=w(l);m(t=>{var s;return{...t,[e]:{status:"unhealthy",lastCheck:a,lastSuccess:(null===(s=t[e])||void 0===s?void 0:s.lastSuccess)||"None",loading:!1,error:r,fullError:l}}})}else m(l=>({...l,[e]:{status:"healthy",lastCheck:a,lastSuccess:a,loading:!1,successResponse:s}}))}catch(a){console.error("Health check failed for ".concat(e,":"),a);let l=new Date().toLocaleString(),t=a instanceof Error?a.message:String(a),s=w(t);m(a=>{var r;return{...a,[e]:{status:"unhealthy",lastCheck:l,lastSuccess:(null===(r=a[e])||void 0===r?void 0:r.lastSuccess)||"None",loading:!1,error:s,fullError:t}}})}});await Promise.allSettled(i);try{if(!l)return;let s=await (0,c.latestHealthChecksCall)(l);s.latest_health_checks&&Object.entries(s.latest_health_checks).forEach(l=>{let[s,a]=l,r=t.data.find(e=>e.model_info.id===s);if(r&&e.includes(r.model_name)&&a){let e=r.model_name,l=a.error_message||void 0;m(t=>{let s=t[e];return{...t,[e]:{status:a.status||(null==s?void 0:s.status)||"unknown",lastCheck:a.checked_at?new Date(a.checked_at).toLocaleString():(null==s?void 0:s.lastCheck)||"None",lastSuccess:"healthy"===a.status&&a.checked_at?new Date(a.checked_at).toLocaleString():(null==s?void 0:s.lastSuccess)||"None",loading:!1,error:l?w(l):null==s?void 0:s.error,fullError:l||(null==s?void 0:s.fullError),successResponse:"healthy"===a.status?a:null==s?void 0:s.successResponse}}})}})}catch(e){console.warn("Failed to fetch updated health statuses from database (non-critical):",e)}},A=e=>{p(e),e?h(a):h([])},M=()=>{f(!1),v(null)},I=()=>{y(!1),N(null)};return(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"mb-6",children:(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(eX.Z,{children:"Model Health Status"}),(0,s.jsx)(n.Z,{className:"text-gray-600 mt-1",children:"Run health checks on individual models to verify they are working correctly"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[u.length>0&&(0,s.jsx)(eY.Z,{size:"sm",variant:"light",onClick:()=>A(!1),className:"px-3 py-1 text-sm",children:"Clear Selection"}),(0,s.jsx)(eY.Z,{size:"sm",variant:"secondary",onClick:k,disabled:Object.values(d).some(e=>e.loading),className:"px-3 py-1 text-sm",children:u.length>0&&u.length{l?h(l=>[...l,e]):(h(l=>l.filter(l=>l!==e)),p(!1))},A,C,e=>{switch(e){case"healthy":return(0,s.jsx)(ll.Z,{color:"emerald",children:"healthy"});case"unhealthy":return(0,s.jsx)(ll.Z,{color:"red",children:"unhealthy"});case"checking":return(0,s.jsx)(ll.Z,{color:"blue",children:"checking"});case"none":return(0,s.jsx)(ll.Z,{color:"gray",children:"none"});default:return(0,s.jsx)(ll.Z,{color:"gray",children:"unknown"})}},r,(e,l,t)=>{v({modelName:e,cleanedError:l,fullError:t}),f(!0)},(e,l)=>{N({modelName:e,response:l}),y(!0)},i),data:t.data.map(e=>{let l=d[e.model_name]||{status:"none",lastCheck:"None",loading:!1};return{model_name:e.model_name,model_info:e.model_info,provider:e.provider,litellm_model_name:e.litellm_model_name,health_status:l.status,last_check:l.lastCheck,last_success:l.lastSuccess||"None",health_loading:l.loading,health_error:l.error,health_full_error:l.fullError}}),isLoading:!1,table:Z})}),(0,s.jsx)(S.Z,{title:j?"Health Check Error - ".concat(j.modelName):"Error Details",open:g,onCancel:M,footer:[(0,s.jsx)(E.ZP,{onClick:M,children:"Close"},"close")],width:800,children:j&&(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Error:"}),(0,s.jsx)("div",{className:"mt-2 p-3 bg-red-50 border border-red-200 rounded-md",children:(0,s.jsx)(n.Z,{className:"text-red-800",children:j.cleanedError})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Full Error Details:"}),(0,s.jsx)("div",{className:"mt-2 p-3 bg-gray-50 border border-gray-200 rounded-md max-h-96 overflow-y-auto",children:(0,s.jsx)("pre",{className:"text-sm text-gray-800 whitespace-pre-wrap",children:j.fullError})})]})]})}),(0,s.jsx)(S.Z,{title:b?"Health Check Response - ".concat(b.modelName):"Response Details",open:_,onCancel:I,footer:[(0,s.jsx)(E.ZP,{onClick:I,children:"Close"},"close")],width:800,children:b&&(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Status:"}),(0,s.jsx)("div",{className:"mt-2 p-3 bg-green-50 border border-green-200 rounded-md",children:(0,s.jsx)(n.Z,{className:"text-green-800",children:"Health check passed successfully"})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Response Details:"}),(0,s.jsx)("div",{className:"mt-2 p-3 bg-gray-50 border border-gray-200 rounded-md max-h-96 overflow-y-auto",children:(0,s.jsx)("pre",{className:"text-sm text-gray-800 whitespace-pre-wrap",children:JSON.stringify(b.response,null,2)})})]})]})})]})},lD=t(86462),lz=t(47686),lq=t(77355),lB=t(93416),lU=t(95704),lG=e=>{let{accessToken:l,initialModelGroupAlias:t={},onAliasUpdate:a}=e,[r,i]=(0,o.useState)([]),[n,m]=(0,o.useState)({aliasName:"",targetModelGroup:""}),[u,h]=(0,o.useState)(null),[x,p]=(0,o.useState)(!0);(0,o.useEffect)(()=>{i(Object.entries(t).map((e,l)=>{var t;let[s,a]=e;return{id:"".concat(l,"-").concat(s),aliasName:s,targetModelGroup:"string"==typeof a?a:null!==(t=null==a?void 0:a.model)&&void 0!==t?t:""}}))},[t]);let g=async e=>{if(!l)return console.error("Access token is missing"),!1;try{let t={};return e.forEach(e=>{t[e.aliasName]=e.targetModelGroup}),console.log("Saving model group alias:",t),await (0,c.setCallbacksCall)(l,{router_settings:{model_group_alias:t}}),a&&a(t),!0}catch(e){return console.error("Failed to save model group alias settings:",e),d.Z.fromBackend("Failed to save model group alias settings"),!1}},f=async()=>{if(!n.aliasName||!n.targetModelGroup){d.Z.fromBackend("Please provide both alias name and target model group");return}if(r.some(e=>e.aliasName===n.aliasName)){d.Z.fromBackend("An alias with this name already exists");return}let e=[...r,{id:"".concat(Date.now(),"-").concat(n.aliasName),aliasName:n.aliasName,targetModelGroup:n.targetModelGroup}];await g(e)&&(i(e),m({aliasName:"",targetModelGroup:""}),d.Z.success("Alias added successfully"))},j=e=>{h({...e})},v=async()=>{if(!u)return;if(!u.aliasName||!u.targetModelGroup){d.Z.fromBackend("Please provide both alias name and target model group");return}if(r.some(e=>e.id!==u.id&&e.aliasName===u.aliasName)){d.Z.fromBackend("An alias with this name already exists");return}let e=r.map(e=>e.id===u.id?u:e);await g(e)&&(i(e),h(null),d.Z.success("Alias updated successfully"))},_=()=>{h(null)},b=async e=>{let l=r.filter(l=>l.id!==e);await g(l)&&(i(l),d.Z.success("Alias deleted successfully"))},N=r.reduce((e,l)=>(e[l.aliasName]=l.targetModelGroup,e),{});return(0,s.jsxs)(lU.Zb,{className:"mb-6",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between cursor-pointer",onClick:()=>p(!x),children:[(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsx)(lU.Dx,{className:"mb-0",children:"Model Group Alias Settings"}),(0,s.jsx)("p",{className:"text-sm text-gray-500",children:"Create aliases for your model groups to simplify API calls. For example, you can create an alias 'gpt-4o' that points to 'gpt-4o-mini-openai' model group."})]}),(0,s.jsx)("div",{className:"flex items-center",children:x?(0,s.jsx)(lD.Z,{className:"w-5 h-5 text-gray-500"}):(0,s.jsx)(lz.Z,{className:"w-5 h-5 text-gray-500"})})]}),x&&(0,s.jsxs)("div",{className:"mt-4",children:[(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsx)(lU.xv,{className:"text-sm font-medium text-gray-700 mb-2",children:"Add New Alias"}),(0,s.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Alias Name"}),(0,s.jsx)("input",{type:"text",value:n.aliasName,onChange:e=>m({...n,aliasName:e.target.value}),placeholder:"e.g., gpt-4o",className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Target Model Group"}),(0,s.jsx)("input",{type:"text",value:n.targetModelGroup,onChange:e=>m({...n,targetModelGroup:e.target.value}),placeholder:"e.g., gpt-4o-mini-openai",className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm"})]}),(0,s.jsx)("div",{className:"flex items-end",children:(0,s.jsxs)("button",{onClick:f,disabled:!n.aliasName||!n.targetModelGroup,className:"flex items-center px-4 py-2 rounded-md text-sm ".concat(n.aliasName&&n.targetModelGroup?"bg-green-600 text-white hover:bg-green-700":"bg-gray-300 text-gray-500 cursor-not-allowed"),children:[(0,s.jsx)(lq.Z,{className:"w-4 h-4 mr-1"}),"Add Alias"]})})]})]}),(0,s.jsx)(lU.xv,{className:"text-sm font-medium text-gray-700 mb-2",children:"Manage Existing Aliases"}),(0,s.jsx)("div",{className:"rounded-lg custom-border relative mb-6",children:(0,s.jsx)("div",{className:"overflow-x-auto",children:(0,s.jsxs)(lU.iA,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,s.jsx)(lU.ss,{children:(0,s.jsxs)(lU.SC,{children:[(0,s.jsx)(lU.xs,{className:"py-1 h-8",children:"Alias Name"}),(0,s.jsx)(lU.xs,{className:"py-1 h-8",children:"Target Model Group"}),(0,s.jsx)(lU.xs,{className:"py-1 h-8",children:"Actions"})]})}),(0,s.jsxs)(lU.RM,{children:[r.map(e=>(0,s.jsx)(lU.SC,{className:"h-8",children:u&&u.id===e.id?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(lU.pj,{className:"py-0.5",children:(0,s.jsx)("input",{type:"text",value:u.aliasName,onChange:e=>h({...u,aliasName:e.target.value}),className:"w-full px-2 py-1 border border-gray-300 rounded-md text-sm"})}),(0,s.jsx)(lU.pj,{className:"py-0.5",children:(0,s.jsx)("input",{type:"text",value:u.targetModelGroup,onChange:e=>h({...u,targetModelGroup:e.target.value}),className:"w-full px-2 py-1 border border-gray-300 rounded-md text-sm"})}),(0,s.jsx)(lU.pj,{className:"py-0.5 whitespace-nowrap",children:(0,s.jsxs)("div",{className:"flex space-x-2",children:[(0,s.jsx)("button",{onClick:v,className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:"Save"}),(0,s.jsx)("button",{onClick:_,className:"text-xs bg-gray-50 text-gray-600 px-2 py-1 rounded hover:bg-gray-100",children:"Cancel"})]})})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(lU.pj,{className:"py-0.5 text-sm text-gray-900",children:e.aliasName}),(0,s.jsx)(lU.pj,{className:"py-0.5 text-sm text-gray-500",children:e.targetModelGroup}),(0,s.jsx)(lU.pj,{className:"py-0.5 whitespace-nowrap",children:(0,s.jsxs)("div",{className:"flex space-x-2",children:[(0,s.jsx)("button",{onClick:()=>j(e),className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:(0,s.jsx)(lB.Z,{className:"w-3 h-3"})}),(0,s.jsx)("button",{onClick:()=>b(e.id),className:"text-xs bg-red-50 text-red-600 px-2 py-1 rounded hover:bg-red-100",children:(0,s.jsx)(y.Z,{className:"w-3 h-3"})})]})})]})},e.id)),0===r.length&&(0,s.jsx)(lU.SC,{children:(0,s.jsx)(lU.pj,{colSpan:3,className:"py-0.5 text-sm text-gray-500 text-center",children:"No aliases added yet. Add a new alias above."})})]})]})})}),(0,s.jsxs)(lU.Zb,{children:[(0,s.jsx)(lU.Dx,{className:"mb-4",children:"Configuration Example"}),(0,s.jsx)(lU.xv,{className:"text-gray-600 mb-4",children:"Here's how your current aliases would look in the config.yaml:"}),(0,s.jsx)("div",{className:"bg-gray-100 rounded-lg p-4 font-mono text-sm",children:(0,s.jsxs)("div",{className:"text-gray-700",children:["router_settings:",(0,s.jsx)("br",{}),"\xa0\xa0model_group_alias:",0===Object.keys(N).length?(0,s.jsxs)("span",{className:"text-gray-500",children:[(0,s.jsx)("br",{}),"\xa0\xa0\xa0\xa0# No aliases configured yet"]}):Object.entries(N).map(e=>{let[l,t]=e;return(0,s.jsxs)("span",{children:[(0,s.jsx)("br",{}),'\xa0\xa0\xa0\xa0"',l,'": "',t,'"']},l)})]})})]})]})]})},lH=t(27593),lK=e=>{let{accessToken:l,token:t,userRole:u,userID:x,modelData:p={data:[]},keys:g,setModelData:j,premiumUser:_,teams:y}=e,[b]=N.Z.useForm(),[Z,w]=(0,o.useState)(null),[S,k]=(0,o.useState)(""),[A,E]=(0,o.useState)([]),[M,I]=(0,o.useState)([]),[F,P]=(0,o.useState)(m.Cl.Anthropic),[L,T]=(0,o.useState)(!1),[R,O]=(0,o.useState)(null),[V,D]=(0,o.useState)([]),[z,q]=(0,o.useState)([]),[B,U]=(0,o.useState)(null),[G,H]=(0,o.useState)([]),[K,ea]=(0,o.useState)([]),[er,ei]=(0,o.useState)([]),[en,eo]=(0,o.useState)([]),[ed,ec]=(0,o.useState)([]),[em,eu]=(0,o.useState)([]),[eh,ex]=(0,o.useState)([]),[ep,eg]=(0,o.useState)({from:new Date(Date.now()-6048e5),to:new Date}),[ef,ej]=(0,o.useState)(null),[ev,e_]=(0,o.useState)(null),[ey,eb]=(0,o.useState)(0),[eN,eZ]=(0,o.useState)({}),[ew,eC]=(0,o.useState)([]),[eS,ek]=(0,o.useState)(!1),[eA,eE]=(0,o.useState)(null),[eM,eI]=(0,o.useState)(null),[eF,eP]=(0,o.useState)([]),[eL,eT]=(0,o.useState)({}),[eR,eO]=(0,o.useState)(!1),[eV,eD]=(0,o.useState)(null),[ez,eq]=(0,o.useState)(!1),[eB,eU]=(0,o.useState)(null),[eG,eH]=(0,o.useState)(null),[eJ,eW]=(0,o.useState)(!1),eY=(0,o.useRef)(null),[e$,eQ]=(0,o.useState)(0),eX=(0,a.NL)(),{data:e0,isLoading:e1,refetch:e2}=v(l,x,u),{data:e4}=f(l),e5=(null==e4?void 0:e4.credentials)||[];(0,o.useEffect)(()=>{let e=e=>{eY.current&&!eY.current.contains(e.target)&&eW(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let e6={name:"file",accept:".json",pastable:!1,beforeUpload:e=>{if("application/json"===e.type){let l=new FileReader;l.onload=e=>{if(e.target){let l=e.target.result;b.setFieldsValue({vertex_credentials:l})}},l.readAsText(e)}return!1},onChange(e){"done"===e.file.status?d.Z.success("".concat(e.file.name," file uploaded successfully")):"error"===e.file.status&&d.Z.fromBackend("".concat(e.file.name," file upload failed."))}},e3=()=>{k(new Date().toLocaleString()),eX.invalidateQueries({queryKey:["models","list"]}),e2()},e7=async()=>{if(l)try{let e={router_settings:{}};"global"===B?(ev&&(e.router_settings.retry_policy=ev),d.Z.success("Global retry settings saved successfully")):(ef&&(e.router_settings.model_group_retry_policy=ef),d.Z.success("Retry settings saved successfully for ".concat(B))),await (0,c.setCallbacksCall)(l,e)}catch(e){d.Z.fromBackend("Failed to save retry settings")}};if((0,o.useEffect)(()=>{if(!l||!t||!u||!x||!e0)return;let e=async()=>{try{var e,t,s,a,r,i,n,o,d,m,h,p;j(e0);let g=await (0,c.modelSettingsCall)(l);g&&I(g);let f=new Set;for(let e=0;e0&&(y=v[v.length-1]);let b=await (0,c.modelMetricsCall)(l,x,u,y,null===(e=ep.from)||void 0===e?void 0:e.toISOString(),null===(t=ep.to)||void 0===t?void 0:t.toISOString(),null==eA?void 0:eA.token,eM);H(b.data),ea(b.all_api_bases);let N=await (0,c.streamingModelMetricsCall)(l,y,null===(s=ep.from)||void 0===s?void 0:s.toISOString(),null===(a=ep.to)||void 0===a?void 0:a.toISOString());ei(N.data),eo(N.all_api_bases);let Z=await (0,c.modelExceptionsCall)(l,x,u,y,null===(r=ep.from)||void 0===r?void 0:r.toISOString(),null===(i=ep.to)||void 0===i?void 0:i.toISOString(),null==eA?void 0:eA.token,eM);ec(Z.data),eu(Z.exception_types);let w=await (0,c.modelMetricsSlowResponsesCall)(l,x,u,y,null===(n=ep.from)||void 0===n?void 0:n.toISOString(),null===(o=ep.to)||void 0===o?void 0:o.toISOString(),null==eA?void 0:eA.token,eM),C=await (0,c.adminGlobalActivityExceptions)(l,null===(d=ep.from)||void 0===d?void 0:d.toISOString().split("T")[0],null===(m=ep.to)||void 0===m?void 0:m.toISOString().split("T")[0],y);eZ(C);let S=await (0,c.adminGlobalActivityExceptionsPerDeployment)(l,null===(h=ep.from)||void 0===h?void 0:h.toISOString().split("T")[0],null===(p=ep.to)||void 0===p?void 0:p.toISOString().split("T")[0],y);eC(S),ex(w);let k=await (0,c.allEndUsersCall)(l);eP(null==k?void 0:k.map(e=>e.user_id));let A=(await (0,c.getCallbacksCall)(l,x,u)).router_settings,E=A.model_group_retry_policy,M=A.num_retries;ej(E),e_(A.retry_policy),eb(M);let F=A.model_group_alias||{};eT(F)}catch(e){console.error("Error fetching model data:",e)}};l&&t&&u&&x&&e0&&e();let s=async()=>{w(await (0,c.modelCostMap)(l))};null==Z&&s()},[l,t,u,x,e0]),!p||e1||!l||!t||!u||!x)return(0,s.jsx)("div",{children:"Loading..."});let le=[],ll=[];for(let e=0;enull!=Z&&"object"==typeof Z&&e in Z?Z[e].litellm_provider:"openai";if(t){let e=t.split("/"),l=e[0];(r=s)||(r=1===e.length?m(t):l)}else r="-";a&&(i=null==a?void 0:a.input_cost_per_token,n=null==a?void 0:a.output_cost_per_token,o=null==a?void 0:a.max_tokens,d=null==a?void 0:a.max_input_tokens),(null==l?void 0:l.litellm_params)&&(c=Object.fromEntries(Object.entries(null==l?void 0:l.litellm_params).filter(e=>{let[l]=e;return"model"!==l&&"api_base"!==l}))),p.data[e].provider=r,p.data[e].input_cost=i,p.data[e].output_cost=n,p.data[e].litellm_model_name=t,ll.push(r),p.data[e].input_cost&&(p.data[e].input_cost=(1e6*Number(p.data[e].input_cost)).toFixed(2)),p.data[e].output_cost&&(p.data[e].output_cost=(1e6*Number(p.data[e].output_cost)).toFixed(2)),p.data[e].max_tokens=o,p.data[e].max_input_tokens=d,p.data[e].api_base=null==l?void 0:null===(la=l.litellm_params)||void 0===la?void 0:la.api_base,p.data[e].cleanedLitellmParams=c,le.push(l.model_name)}if(u&&"Admin Viewer"==u){let{Title:e,Paragraph:l}=C.default;return(0,s.jsxs)("div",{children:[(0,s.jsx)(e,{level:1,children:"Access Denied"}),(0,s.jsx)(l,{children:"Ask your proxy admin for access to view all models"})]})}return(Object.keys(m.Cl).find(e=>m.Cl[e]===F),eB)?(0,s.jsx)("div",{className:"w-full h-full",children:(0,s.jsx)(e9.Z,{teamId:eB,onClose:()=>eU(null),accessToken:l,is_team_admin:"Admin"===u,is_proxy_admin:"Proxy Admin"===u,userModels:le,editTeam:!1,onUpdate:e3})}):(0,s.jsx)("div",{className:"w-full mx-4 h-[75vh]",children:(0,s.jsx)(i.Z,{numItems:1,className:"gap-2 p-8 w-full mt-2",children:(0,s.jsxs)(r.Z,{numColSpan:1,className:"flex flex-col gap-2",children:[(0,s.jsx)("div",{className:"flex justify-between items-center mb-4",children:(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",children:"Model Management"}),es.ZL.includes(u)?(0,s.jsx)("p",{className:"text-sm text-gray-600",children:"Add and manage models for the proxy"}):(0,s.jsx)("p",{className:"text-sm text-gray-600",children:"Add models for teams you are an admin for."})]})}),eV?(0,s.jsx)(e8,{modelId:eV,editModel:!0,onClose:()=>{eD(null),eq(!1)},modelData:p.data.find(e=>e.model_info.id===eV),accessToken:l,userID:x,userRole:u,setEditModalVisible:T,setSelectedModel:O,onModelUpdate:e=>{e.deleted?j({...p,data:p.data.filter(l=>l.model_info.id!==e.model_info.id)}):j({...p,data:p.data.map(l=>l.model_info.id===e.model_info.id?e:l)}),eX.invalidateQueries({queryKey:["models","list"]}),e3()},modelAccessGroups:z}):(0,s.jsxs)(X.Z,{index:e$,onIndexChange:eQ,className:"gap-2 h-[75vh] w-full ",children:[(0,s.jsxs)(ee.Z,{className:"flex justify-between mt-2 w-full items-center",children:[(0,s.jsxs)("div",{className:"flex",children:[es.ZL.includes(u)?(0,s.jsx)(Q.Z,{children:"All Models"}):(0,s.jsx)(Q.Z,{children:"Your Models"}),(0,s.jsx)(Q.Z,{children:"Add Model"}),es.ZL.includes(u)&&(0,s.jsx)(Q.Z,{children:"LLM Credentials"}),es.ZL.includes(u)&&(0,s.jsx)(Q.Z,{children:"Pass-Through Endpoints"}),es.ZL.includes(u)&&(0,s.jsx)(Q.Z,{children:"Health Status"}),es.ZL.includes(u)&&(0,s.jsx)(Q.Z,{children:"Model Analytics"}),es.ZL.includes(u)&&(0,s.jsx)(Q.Z,{children:"Model Retry Settings"}),es.ZL.includes(u)&&(0,s.jsx)(Q.Z,{children:"Model Group Alias"}),es.ZL.includes(u)&&(0,s.jsx)(Q.Z,{children:"Price Data Reload"})]}),(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[S&&(0,s.jsxs)(n.Z,{children:["Last Refreshed: ",S]}),(0,s.jsx)($.Z,{icon:Y.Z,variant:"shadow",size:"xs",className:"self-center",onClick:e3})]})]}),(0,s.jsxs)(et.Z,{children:[(0,s.jsx)(li,{selectedModelGroup:B,setSelectedModelGroup:U,availableModelGroups:V,availableModelAccessGroups:z,setSelectedModelId:eD,setSelectedTeamId:eU,setEditModel:eq,modelData:p}),(0,s.jsx)(el.Z,{className:"h-full",children:(0,s.jsx)(eK,{form:b,handleOk:()=>{b.validateFields().then(e=>{h(e,l,b,e3)}).catch(e=>{var l;let t=(null===(l=e.errorFields)||void 0===l?void 0:l.map(e=>"".concat(e.name.join("."),": ").concat(e.errors.join(", "))).join(" | "))||"Unknown validation error";d.Z.fromBackend("Please fill in the following required fields: ".concat(t))})},selectedProvider:F,setSelectedProvider:P,providerModels:A,setProviderModelsFn:e=>{E((0,m.bK)(e,Z))},getPlaceholder:m.ph,uploadProps:e6,showAdvancedSettings:eR,setShowAdvancedSettings:eO,teams:y,credentials:e5,accessToken:l,userRole:u,premiumUser:_})}),(0,s.jsx)(el.Z,{children:(0,s.jsx)(J,{uploadProps:e6})}),(0,s.jsx)(el.Z,{children:(0,s.jsx)(lH.Z,{accessToken:l,userRole:u,userID:x,modelData:p,premiumUser:_})}),(0,s.jsx)(el.Z,{children:(0,s.jsx)(lV,{accessToken:l,modelData:p,all_models_on_proxy:le,getDisplayModelName:W,setSelectedModelId:eD})}),(0,s.jsx)(lb,{dateValue:ep,setDateValue:eg,selectedModelGroup:B,availableModelGroups:V,setShowAdvancedFilters:ek,modelMetrics:G,modelMetricsCategories:K,streamingModelMetrics:er,streamingModelMetricsCategories:en,customTooltip:e=>{var l,t;let{payload:a,active:r}=e;if(!r||!a)return null;let i=null===(t=a[0])||void 0===t?void 0:null===(l=t.payload)||void 0===l?void 0:l.date,n=a.sort((e,l)=>l.value-e.value);if(n.length>5){let e=n.length-5;(n=n.slice(0,5)).push({dataKey:"".concat(e," other deployments"),value:a.slice(5).reduce((e,l)=>e+l.value,0),color:"gray"})}return(0,s.jsxs)("div",{className:"w-150 rounded-tremor-default border border-tremor-border bg-tremor-background p-2 text-tremor-default shadow-tremor-dropdown",children:[i&&(0,s.jsxs)("p",{className:"text-tremor-content-emphasis mb-2",children:["Date: ",i]}),n.map((e,l)=>{let t=parseFloat(e.value.toFixed(5)),a=0===t&&e.value>0?"<0.00001":t.toFixed(5);return(0,s.jsxs)("div",{className:"flex justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 mt-1 rounded-full bg-".concat(e.color,"-500")}),(0,s.jsx)("p",{className:"text-tremor-content",children:e.dataKey})]}),(0,s.jsx)("p",{className:"font-medium text-tremor-content-emphasis text-righ ml-2",children:a})]},l)})]})},slowResponsesData:eh,modelExceptions:ed,globalExceptionData:eN,allExceptions:em,globalExceptionPerDeployment:ew,allEndUsers:eF,keys:g,setSelectedAPIKey:eE,setSelectedCustomer:eI,teams:y,selectedAPIKey:eA,selectedCustomer:eM,selectedTeam:eG,setAllExceptions:eu,setGlobalExceptionData:eZ,setGlobalExceptionPerDeployment:eC,setModelExceptions:ec,setModelMetrics:H,setModelMetricsCategories:ea,setSelectedModelGroup:U,setSlowResponsesData:ex,setStreamingModelMetrics:ei,setStreamingModelMetricsCategories:eo}),(0,s.jsx)(lZ,{selectedModelGroup:B,setSelectedModelGroup:U,availableModelGroups:V,globalRetryPolicy:ev,setGlobalRetryPolicy:e_,defaultRetry:ey,modelGroupRetryPolicy:ef,setModelGroupRetryPolicy:ej,handleSaveRetrySettings:e7}),(0,s.jsx)(el.Z,{children:(0,s.jsx)(lG,{accessToken:l,initialModelGroupAlias:eL,onAliasUpdate:eT})}),(0,s.jsx)(lF,{setModelMap:w})]})]})]})})})}},27593:function(e,l,t){t.d(l,{Z:function(){return Y}});var s=t(57437),a=t(2265),r=t(78489),i=t(47323),n=t(84264),o=t(96761),d=t(19250),c=t(99981),m=t(33866),u=t(15731),h=t(53410),x=t(74998),p=t(59341),g=t(49566),f=t(12514),j=t(97765),v=t(37592),_=t(10032),y=t(22116),b=t(51653),N=t(24199),Z=t(12660),w=t(15424),C=t(58760),S=t(5545),k=t(45246),A=t(96473),E=t(31283),M=e=>{let{value:l={},onChange:t}=e,[r,i]=(0,a.useState)(Object.entries(l)),n=e=>{let l=r.filter((l,t)=>t!==e);i(l),null==t||t(Object.fromEntries(l))},o=(e,l,s)=>{let a=[...r];a[e]=[l,s],i(a),null==t||t(Object.fromEntries(a))};return(0,s.jsxs)("div",{children:[r.map((e,l)=>{let[t,a]=e;return(0,s.jsxs)(C.Z,{style:{display:"flex",marginBottom:8},align:"center",children:[(0,s.jsx)(E.o,{placeholder:"Header Name",value:t,onChange:e=>o(l,e.target.value,a)}),(0,s.jsx)(E.o,{placeholder:"Header Value",value:a,onChange:e=>o(l,t,e.target.value)}),(0,s.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:(0,s.jsx)(k.Z,{onClick:()=>n(l),style:{cursor:"pointer"}})})]},l)}),(0,s.jsx)(S.ZP,{type:"dashed",onClick:()=>{i([...r,["",""]])},icon:(0,s.jsx)(A.Z,{}),children:"Add Header"})]})},I=t(77565),F=e=>{let{pathValue:l,targetValue:t,includeSubpath:a}=e,r=(0,d.getProxyBaseUrl)();return l&&t?(0,s.jsxs)(f.Z,{className:"p-5",children:[(0,s.jsx)(o.Z,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Route Preview"}),(0,s.jsx)(j.Z,{className:"text-gray-600 mb-5",children:"How your requests will be routed"}),(0,s.jsxs)("div",{className:"space-y-5",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-base font-semibold text-gray-900 mb-3",children:"Basic routing:"}),(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsxs)("div",{className:"flex-1 bg-gray-50 border border-gray-200 rounded-lg p-3",children:[(0,s.jsx)("div",{className:"text-sm text-gray-600 mb-2",children:"Your endpoint"}),(0,s.jsx)("code",{className:"font-mono text-sm text-gray-900",children:l?"".concat(r).concat(l):""})]}),(0,s.jsx)("div",{className:"text-gray-400",children:(0,s.jsx)(I.Z,{className:"text-lg"})}),(0,s.jsxs)("div",{className:"flex-1 bg-gray-50 border border-gray-200 rounded-lg p-3",children:[(0,s.jsx)("div",{className:"text-sm text-gray-600 mb-2",children:"Forwards to"}),(0,s.jsx)("code",{className:"font-mono text-sm text-gray-900",children:t})]})]})]}),a&&(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-base font-semibold text-gray-900 mb-3",children:"With subpaths:"}),(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsxs)("div",{className:"flex-1 bg-gray-50 border border-gray-200 rounded-lg p-3",children:[(0,s.jsx)("div",{className:"text-sm text-gray-600 mb-2",children:"Your endpoint + subpath"}),(0,s.jsxs)("code",{className:"font-mono text-sm text-gray-900",children:[l&&"".concat(r).concat(l),(0,s.jsx)("span",{className:"text-blue-600",children:"/v1/text-to-image/base/model"})]})]}),(0,s.jsx)("div",{className:"text-gray-400",children:(0,s.jsx)(I.Z,{className:"text-lg"})}),(0,s.jsxs)("div",{className:"flex-1 bg-gray-50 border border-gray-200 rounded-lg p-3",children:[(0,s.jsx)("div",{className:"text-sm text-gray-600 mb-2",children:"Forwards to"}),(0,s.jsxs)("code",{className:"font-mono text-sm text-gray-900",children:[t,(0,s.jsx)("span",{className:"text-blue-600",children:"/v1/text-to-image/base/model"})]})]})]}),(0,s.jsxs)("div",{className:"mt-3 text-sm text-gray-600",children:["Any path after ",l," will be appended to the target URL"]})]})}),!a&&(0,s.jsx)("div",{className:"mt-4 p-3 bg-blue-50 rounded-md border border-blue-200",children:(0,s.jsxs)("div",{className:"flex items-start",children:[(0,s.jsx)(w.Z,{className:"text-blue-500 mt-0.5 mr-2 flex-shrink-0"}),(0,s.jsxs)("div",{className:"text-sm text-blue-700",children:[(0,s.jsx)("span",{className:"font-medium",children:"Not seeing the routing you wanted?"})," Try enabling - Include Subpaths - above - this allows subroutes like"," ",(0,s.jsx)("code",{className:"bg-blue-100 px-1 py-0.5 rounded font-mono text-xs",children:"/api/v1/models"})," to be forwarded automatically."]})]})})]})]}):null},P=t(9114),L=t(63709),T=e=>{let{premiumUser:l,authEnabled:t,onAuthChange:a}=e;return(0,s.jsxs)(f.Z,{className:"p-6",children:[(0,s.jsx)(o.Z,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Security"}),(0,s.jsx)(j.Z,{className:"text-gray-600 mb-4",children:"When enabled, requests to this endpoint will require a valid LiteLLM Virtual Key"}),l?(0,s.jsx)(_.Z.Item,{name:"auth",valuePropName:"checked",className:"mb-0",children:(0,s.jsx)(L.Z,{checked:t,onChange:e=>{a(e)}})}):(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center mb-3",children:[(0,s.jsx)(L.Z,{disabled:!0,checked:!1,style:{outline:"2px solid #d1d5db",outlineOffset:"2px"}}),(0,s.jsx)("span",{className:"ml-2 text-sm text-gray-400",children:"Authentication (Premium)"})]}),(0,s.jsx)("div",{className:"p-3 bg-yellow-50 border border-yellow-200 rounded-lg",children:(0,s.jsxs)(n.Z,{className:"text-sm text-yellow-800",children:["Setting authentication for pass-through endpoints is a LiteLLM Enterprise feature. Get a trial key"," ",(0,s.jsx)("a",{href:"https://www.litellm.ai/#pricing",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"here"}),"."]})})]})]})},R=t(67479),O=e=>{let{accessToken:l,value:t={},onChange:r,disabled:i=!1}=e,[n,d]=(0,a.useState)(Object.keys(t)),[m,u]=(0,a.useState)(t);(0,a.useEffect)(()=>{u(t),d(Object.keys(t))},[t]);let h=(e,l,t)=>{var s,a;let i=m[e]||{},n={...m,[e]:{...i,[l]:t.length>0?t:void 0}};(null===(s=n[e])||void 0===s?void 0:s.request_fields)||(null===(a=n[e])||void 0===a?void 0:a.response_fields)||(n[e]=null),u(n),r&&r(n)};return(0,s.jsxs)(f.Z,{className:"p-6",children:[(0,s.jsx)(o.Z,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Guardrails"}),(0,s.jsx)(j.Z,{className:"text-gray-600 mb-6",children:"Configure guardrails to enforce policies on requests and responses. Guardrails are opt-in for passthrough endpoints."}),(0,s.jsx)(b.Z,{message:(0,s.jsxs)("span",{children:["Field-Level Targeting"," ",(0,s.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/pass_through_guardrails#field-level-targeting",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline",children:"(Learn More)"})]}),description:(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("div",{children:"Optionally specify which fields to check. If left empty, the entire request/response is sent to the guardrail."}),(0,s.jsxs)("div",{className:"text-xs space-y-1 mt-2",children:[(0,s.jsx)("div",{className:"font-medium",children:"Common Examples:"}),(0,s.jsxs)("div",{children:["• ",(0,s.jsx)("code",{className:"bg-gray-100 px-1 rounded",children:"query"})," - Single field"]}),(0,s.jsxs)("div",{children:["• ",(0,s.jsx)("code",{className:"bg-gray-100 px-1 rounded",children:"documents[*].text"})," - All text in documents array"]}),(0,s.jsxs)("div",{children:["• ",(0,s.jsx)("code",{className:"bg-gray-100 px-1 rounded",children:"messages[*].content"})," - All message contents"]})]})]}),type:"info",showIcon:!0,className:"mb-4"}),(0,s.jsx)(_.Z.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Select Guardrails",(0,s.jsx)(c.Z,{title:"Choose which guardrails should run on this endpoint. Org/team/key level guardrails will also be included.",children:(0,s.jsx)(w.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),children:(0,s.jsx)(R.Z,{accessToken:l,value:n,onChange:e=>{d(e);let l={};e.forEach(e=>{l[e]=m[e]||null}),u(l),r&&r(l)},disabled:i})}),n.length>0&&(0,s.jsxs)("div",{className:"mt-6 space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,s.jsx)("div",{className:"text-sm font-medium text-gray-700",children:"Field Targeting (Optional)"}),(0,s.jsx)("div",{className:"text-xs text-gray-500",children:"\uD83D\uDCA1 Tip: Leave empty to check entire payload"})]}),n.map(e=>{var l,t;return(0,s.jsxs)(f.Z,{className:"p-4 bg-gray-50",children:[(0,s.jsx)("div",{className:"text-sm font-medium text-gray-900 mb-3",children:e}),(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,s.jsxs)("label",{className:"text-xs text-gray-600 flex items-center",children:["Request Fields (pre_call)",(0,s.jsx)(c.Z,{title:(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"font-medium mb-1",children:"Specify which request fields to check"}),(0,s.jsxs)("div",{className:"text-xs space-y-1",children:[(0,s.jsx)("div",{children:"Examples:"}),(0,s.jsx)("div",{children:"• query"}),(0,s.jsx)("div",{children:"• documents[*].text"}),(0,s.jsx)("div",{children:"• messages[*].content"})]})]}),children:(0,s.jsx)(w.Z,{className:"ml-1 text-gray-400"})})]}),(0,s.jsxs)("div",{className:"flex gap-1",children:[(0,s.jsx)("button",{type:"button",onClick:()=>{var l;let t=(null===(l=m[e])||void 0===l?void 0:l.request_fields)||[];h(e,"request_fields",[...t,"query"])},className:"text-xs px-2 py-1 bg-white border border-gray-300 rounded hover:bg-gray-50",disabled:i,children:"+ query"}),(0,s.jsx)("button",{type:"button",onClick:()=>{var l;let t=(null===(l=m[e])||void 0===l?void 0:l.request_fields)||[];h(e,"request_fields",[...t,"documents[*]"])},className:"text-xs px-2 py-1 bg-white border border-gray-300 rounded hover:bg-gray-50",disabled:i,children:"+ documents[*]"})]})]}),(0,s.jsx)(v.default,{mode:"tags",style:{width:"100%"},placeholder:"Type field name or use + buttons above (e.g., query, documents[*].text)",value:(null===(l=m[e])||void 0===l?void 0:l.request_fields)||[],onChange:l=>h(e,"request_fields",l),disabled:i,tokenSeparators:[","]})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,s.jsxs)("label",{className:"text-xs text-gray-600 flex items-center",children:["Response Fields (post_call)",(0,s.jsx)(c.Z,{title:(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"font-medium mb-1",children:"Specify which response fields to check"}),(0,s.jsxs)("div",{className:"text-xs space-y-1",children:[(0,s.jsx)("div",{children:"Examples:"}),(0,s.jsx)("div",{children:"• results[*].text"}),(0,s.jsx)("div",{children:"• choices[*].message.content"})]})]}),children:(0,s.jsx)(w.Z,{className:"ml-1 text-gray-400"})})]}),(0,s.jsx)("div",{className:"flex gap-1",children:(0,s.jsx)("button",{type:"button",onClick:()=>{var l;let t=(null===(l=m[e])||void 0===l?void 0:l.response_fields)||[];h(e,"response_fields",[...t,"results[*]"])},className:"text-xs px-2 py-1 bg-white border border-gray-300 rounded hover:bg-gray-50",disabled:i,children:"+ results[*]"})})]}),(0,s.jsx)(v.default,{mode:"tags",style:{width:"100%"},placeholder:"Type field name or use + buttons above (e.g., results[*].text)",value:(null===(t=m[e])||void 0===t?void 0:t.response_fields)||[],onChange:l=>h(e,"response_fields",l),disabled:i,tokenSeparators:[","]})]})]})]},e)})]})]})};let{Option:V}=v.default;var D=e=>{let{accessToken:l,setPassThroughItems:t,passThroughItems:i,premiumUser:n=!1}=e,[m]=_.Z.useForm(),[u,h]=(0,a.useState)(!1),[x,v]=(0,a.useState)(!1),[C,S]=(0,a.useState)(""),[k,A]=(0,a.useState)(""),[E,I]=(0,a.useState)(""),[L,R]=(0,a.useState)(!0),[V,D]=(0,a.useState)(!1),[z,q]=(0,a.useState)({}),B=()=>{m.resetFields(),A(""),I(""),R(!0),q({}),h(!1)},U=e=>{let l=e;e&&!e.startsWith("/")&&(l="/"+e),A(l),m.setFieldsValue({path:l})},G=async e=>{console.log("addPassThrough called with:",e),v(!0);try{!n&&"auth"in e&&delete e.auth,z&&Object.keys(z).length>0&&(e.guardrails=z),console.log("formValues: ".concat(JSON.stringify(e)));let s=(await (0,d.createPassThroughEndpoint)(l,e)).endpoints[0],a=[...i,s];t(a),P.Z.success("Pass-through endpoint created successfully"),m.resetFields(),A(""),I(""),R(!0),q({}),h(!1)}catch(e){P.Z.fromBackend("Error creating pass-through endpoint: "+e)}finally{v(!1)}};return(0,s.jsxs)("div",{children:[(0,s.jsx)(r.Z,{className:"mx-auto mb-4 mt-4",onClick:()=>h(!0),children:"+ Add Pass-Through Endpoint"}),(0,s.jsx)(y.Z,{title:(0,s.jsxs)("div",{className:"flex items-center space-x-3 pb-4 border-b border-gray-100",children:[(0,s.jsx)(Z.Z,{className:"text-xl text-blue-500"}),(0,s.jsx)("h2",{className:"text-xl font-semibold text-gray-900",children:"Add Pass-Through Endpoint"})]}),open:u,width:1e3,onCancel:B,footer:null,className:"top-8",styles:{body:{padding:"24px"},header:{padding:"24px 24px 0 24px",border:"none"}},children:(0,s.jsxs)("div",{className:"mt-6",children:[(0,s.jsx)(b.Z,{message:"What is a Pass-Through Endpoint?",description:"Route requests from your LiteLLM proxy to any external API. Perfect for custom models, image generation APIs, or any service you want to proxy through LiteLLM.",type:"info",showIcon:!0,className:"mb-6"}),(0,s.jsxs)(_.Z,{form:m,onFinish:G,layout:"vertical",className:"space-y-6",initialValues:{include_subpath:!0,path:k,target:E},children:[(0,s.jsxs)(f.Z,{className:"p-5",children:[(0,s.jsx)(o.Z,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Route Configuration"}),(0,s.jsx)(j.Z,{className:"text-gray-600 mb-5",children:"Configure how requests to your domain will be forwarded to the target API"}),(0,s.jsxs)("div",{className:"space-y-5",children:[(0,s.jsx)(_.Z.Item,{label:(0,s.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Path Prefix"}),name:"path",rules:[{required:!0,message:"Path is required",pattern:/^\//}],extra:(0,s.jsx)("div",{className:"text-xs text-gray-500 mt-1",children:"Example: /bria, /adobe-photoshop, /elasticsearch"}),className:"mb-4",children:(0,s.jsx)("div",{className:"flex items-center",children:(0,s.jsx)(g.Z,{placeholder:"bria",value:k,onChange:e=>U(e.target.value),className:"flex-1"})})}),(0,s.jsx)(_.Z.Item,{label:(0,s.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Target URL"}),name:"target",rules:[{required:!0,message:"Target URL is required"},{type:"url",message:"Please enter a valid URL"}],extra:(0,s.jsx)("div",{className:"text-xs text-gray-500 mt-1",children:"Example:https://engine.prod.bria-api.com"}),className:"mb-4",children:(0,s.jsx)(g.Z,{placeholder:"https://engine.prod.bria-api.com",value:E,onChange:e=>{I(e.target.value),m.setFieldsValue({target:e.target.value})}})}),(0,s.jsxs)("div",{className:"flex items-center justify-between py-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-sm font-medium text-gray-700",children:"Include Subpaths"}),(0,s.jsx)("div",{className:"text-xs text-gray-500 mt-0.5",children:"Forward all subpaths to the target API (recommended for REST APIs)"})]}),(0,s.jsx)(_.Z.Item,{name:"include_subpath",valuePropName:"checked",className:"mb-0",children:(0,s.jsx)(p.Z,{checked:L,onChange:R})})]})]})]}),(0,s.jsx)(F,{pathValue:k,targetValue:E,includeSubpath:L}),(0,s.jsxs)(f.Z,{className:"p-6",children:[(0,s.jsx)(o.Z,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Headers"}),(0,s.jsx)(j.Z,{className:"text-gray-600 mb-6",children:"Add headers that will be sent with every request to the target API"}),(0,s.jsx)(_.Z.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Authentication Headers",(0,s.jsx)(c.Z,{title:"Authentication and other headers to forward with requests",children:(0,s.jsx)(w.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"headers",rules:[{required:!0,message:"Please configure the headers"}],extra:(0,s.jsxs)("div",{className:"text-xs text-gray-500 mt-2",children:[(0,s.jsx)("div",{className:"font-medium mb-1",children:"Add authentication tokens and other required headers"}),(0,s.jsx)("div",{children:"Common examples: auth_token, Authorization, x-api-key"})]}),children:(0,s.jsx)(M,{})})]}),(0,s.jsx)(T,{premiumUser:n,authEnabled:V,onAuthChange:e=>{D(e),m.setFieldsValue({auth:e})}}),(0,s.jsx)(O,{accessToken:l,value:z,onChange:q}),(0,s.jsxs)(f.Z,{className:"p-6",children:[(0,s.jsx)(o.Z,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Billing"}),(0,s.jsx)(j.Z,{className:"text-gray-600 mb-6",children:"Optional cost tracking for this endpoint"}),(0,s.jsx)(_.Z.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Cost Per Request (USD)",(0,s.jsx)(c.Z,{title:"Optional: Track costs for requests to this endpoint",children:(0,s.jsx)(w.Z,{className:"ml-2 text-gray-400 hover:text-gray-600"})})]}),name:"cost_per_request",extra:(0,s.jsx)("div",{className:"text-xs text-gray-500 mt-2",children:"The cost charged for each request through this endpoint"}),children:(0,s.jsx)(N.Z,{min:0,step:.001,precision:4,placeholder:"2.0000",size:"large"})})]}),(0,s.jsxs)("div",{className:"flex items-center justify-end space-x-3 pt-6 border-t border-gray-100",children:[(0,s.jsx)(r.Z,{variant:"secondary",onClick:B,children:"Cancel"}),(0,s.jsx)(r.Z,{variant:"primary",loading:x,onClick:()=>{console.log("Submit button clicked"),m.submit()},children:x?"Creating...":"Add Pass-Through Endpoint"})]})]})]})})]})},z=t(30078),q=t(4260),B=t(19015),U=t(87769),G=t(42208);let H=e=>{let{value:l}=e,[t,r]=(0,a.useState)(!1),i=JSON.stringify(l,null,2);return(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("pre",{className:"font-mono text-xs bg-gray-50 p-2 rounded max-w-md overflow-auto",children:t?i:"••••••••"}),(0,s.jsx)("button",{onClick:()=>r(!t),className:"p-1 hover:bg-gray-100 rounded",type:"button",children:t?(0,s.jsx)(U.Z,{className:"w-4 h-4 text-gray-500"}):(0,s.jsx)(G.Z,{className:"w-4 h-4 text-gray-500"})})]})};var K=e=>{let{endpointData:l,onClose:t,accessToken:r,isAdmin:i,premiumUser:n=!1,onEndpointUpdated:o}=e,[c,m]=(0,a.useState)(l),[u,h]=(0,a.useState)(!1),[x,p]=(0,a.useState)(!1),[g,f]=(0,a.useState)((null==l?void 0:l.auth)||!1),[j,v]=(0,a.useState)((null==l?void 0:l.guardrails)||{}),[y]=_.Z.useForm(),b=async e=>{try{if(!r||!(null==c?void 0:c.id))return;let l={};if(e.headers)try{l="string"==typeof e.headers?JSON.parse(e.headers):e.headers}catch(e){P.Z.fromBackend("Invalid JSON format for headers");return}let t={path:c.path,target:e.target,headers:l,include_subpath:e.include_subpath,cost_per_request:e.cost_per_request,auth:n?e.auth:void 0,guardrails:j&&Object.keys(j).length>0?j:void 0};await (0,d.updatePassThroughEndpoint)(r,c.id,t),m({...c,...t}),p(!1),o&&o()}catch(e){console.error("Error updating endpoint:",e),P.Z.fromBackend("Failed to update pass through endpoint")}},N=async()=>{try{if(!r||!(null==c?void 0:c.id))return;await (0,d.deletePassThroughEndpointsCall)(r,c.id),P.Z.success("Pass through endpoint deleted successfully"),t(),o&&o()}catch(e){console.error("Error deleting endpoint:",e),P.Z.fromBackend("Failed to delete pass through endpoint")}};return u?(0,s.jsx)("div",{className:"p-4",children:"Loading..."}):c?(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsx)("div",{className:"flex justify-between items-center mb-6",children:(0,s.jsxs)("div",{children:[(0,s.jsx)(S.ZP,{onClick:t,className:"mb-4",children:"← Back"}),(0,s.jsxs)(z.Dx,{children:["Pass Through Endpoint: ",c.path]}),(0,s.jsx)(z.xv,{className:"text-gray-500 font-mono",children:c.id})]})}),(0,s.jsxs)(z.v0,{children:[(0,s.jsxs)(z.td,{className:"mb-4",children:[(0,s.jsx)(z.OK,{children:"Overview"},"overview"),i?(0,s.jsx)(z.OK,{children:"Settings"},"settings"):(0,s.jsx)(s.Fragment,{})]}),(0,s.jsxs)(z.nP,{children:[(0,s.jsxs)(z.x4,{children:[(0,s.jsxs)(z.rj,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,s.jsxs)(z.Zb,{children:[(0,s.jsx)(z.xv,{children:"Path"}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(z.Dx,{className:"font-mono",children:c.path})})]}),(0,s.jsxs)(z.Zb,{children:[(0,s.jsx)(z.xv,{children:"Target"}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(z.Dx,{children:c.target})})]}),(0,s.jsxs)(z.Zb,{children:[(0,s.jsx)(z.xv,{children:"Configuration"}),(0,s.jsxs)("div",{className:"mt-2 space-y-2",children:[(0,s.jsx)("div",{children:(0,s.jsx)(z.Ct,{color:c.include_subpath?"green":"gray",children:c.include_subpath?"Include Subpath":"Exact Path"})}),(0,s.jsx)("div",{children:(0,s.jsx)(z.Ct,{color:c.auth?"blue":"gray",children:c.auth?"Auth Required":"No Auth"})}),void 0!==c.cost_per_request&&(0,s.jsx)("div",{children:(0,s.jsxs)(z.xv,{children:["Cost per request: $",c.cost_per_request]})})]})]})]}),(0,s.jsx)("div",{className:"mt-6",children:(0,s.jsx)(F,{pathValue:c.path,targetValue:c.target,includeSubpath:c.include_subpath||!1})}),c.headers&&Object.keys(c.headers).length>0&&(0,s.jsxs)(z.Zb,{className:"mt-6",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(z.xv,{className:"font-medium",children:"Headers"}),(0,s.jsxs)(z.Ct,{color:"blue",children:[Object.keys(c.headers).length," headers configured"]})]}),(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(H,{value:c.headers})})]}),c.guardrails&&Object.keys(c.guardrails).length>0&&(0,s.jsxs)(z.Zb,{className:"mt-6",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(z.xv,{className:"font-medium",children:"Guardrails"}),(0,s.jsxs)(z.Ct,{color:"purple",children:[Object.keys(c.guardrails).length," guardrails configured"]})]}),(0,s.jsx)("div",{className:"mt-4 space-y-2",children:Object.entries(c.guardrails).map(e=>{let[l,t]=e;return(0,s.jsxs)("div",{className:"p-3 bg-gray-50 rounded",children:[(0,s.jsx)("div",{className:"font-medium text-sm",children:l}),t&&(t.request_fields||t.response_fields)&&(0,s.jsxs)("div",{className:"mt-2 text-xs text-gray-600 space-y-1",children:[t.request_fields&&(0,s.jsxs)("div",{children:["Request fields: ",t.request_fields.join(", ")]}),t.response_fields&&(0,s.jsxs)("div",{children:["Response fields: ",t.response_fields.join(", ")]})]}),!t&&(0,s.jsx)("div",{className:"text-xs text-gray-600 mt-1",children:"Uses entire payload"})]},l)})})]})]}),i&&(0,s.jsx)(z.x4,{children:(0,s.jsxs)(z.Zb,{children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,s.jsx)(z.Dx,{children:"Pass Through Endpoint Settings"}),(0,s.jsx)("div",{className:"space-x-2",children:!x&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(z.zx,{onClick:()=>p(!0),children:"Edit Settings"}),(0,s.jsx)(z.zx,{onClick:N,variant:"secondary",color:"red",children:"Delete Endpoint"})]})})]}),x?(0,s.jsxs)(_.Z,{form:y,onFinish:b,initialValues:{target:c.target,headers:c.headers?JSON.stringify(c.headers,null,2):"",include_subpath:c.include_subpath||!1,cost_per_request:c.cost_per_request,auth:c.auth||!1},layout:"vertical",children:[(0,s.jsx)(_.Z.Item,{label:"Target URL",name:"target",rules:[{required:!0,message:"Please input a target URL"}],children:(0,s.jsx)(z.oi,{placeholder:"https://api.example.com"})}),(0,s.jsx)(_.Z.Item,{label:"Headers (JSON)",name:"headers",children:(0,s.jsx)(q.default.TextArea,{rows:5,placeholder:'{"Authorization": "Bearer your-token", "Content-Type": "application/json"}'})}),(0,s.jsx)(_.Z.Item,{label:"Include Subpath",name:"include_subpath",valuePropName:"checked",children:(0,s.jsx)(L.Z,{})}),(0,s.jsx)(_.Z.Item,{label:"Cost per Request",name:"cost_per_request",children:(0,s.jsx)(B.Z,{min:0,step:.01,precision:2,placeholder:"0.00",addonBefore:"$"})}),(0,s.jsx)(T,{premiumUser:n,authEnabled:g,onAuthChange:e=>{f(e),y.setFieldsValue({auth:e})}}),(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(O,{accessToken:r||"",value:j,onChange:v})}),(0,s.jsxs)("div",{className:"flex justify-end gap-2 mt-6",children:[(0,s.jsx)(S.ZP,{onClick:()=>p(!1),children:"Cancel"}),(0,s.jsx)(z.zx,{children:"Save Changes"})]})]}):(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(z.xv,{className:"font-medium",children:"Path"}),(0,s.jsx)("div",{className:"font-mono",children:c.path})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(z.xv,{className:"font-medium",children:"Target URL"}),(0,s.jsx)("div",{children:c.target})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(z.xv,{className:"font-medium",children:"Include Subpath"}),(0,s.jsx)(z.Ct,{color:c.include_subpath?"green":"gray",children:c.include_subpath?"Yes":"No"})]}),void 0!==c.cost_per_request&&(0,s.jsxs)("div",{children:[(0,s.jsx)(z.xv,{className:"font-medium",children:"Cost per Request"}),(0,s.jsxs)("div",{children:["$",c.cost_per_request]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(z.xv,{className:"font-medium",children:"Authentication Required"}),(0,s.jsx)(z.Ct,{color:c.auth?"green":"gray",children:c.auth?"Yes":"No"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(z.xv,{className:"font-medium",children:"Headers"}),c.headers&&Object.keys(c.headers).length>0?(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(H,{value:c.headers})}):(0,s.jsx)("div",{className:"text-gray-500",children:"No headers configured"})]})]})]})})]})]})]}):(0,s.jsx)("div",{className:"p-4",children:"Pass through endpoint not found"})},J=t(12322);let W=e=>{let{value:l}=e,[t,r]=(0,a.useState)(!1),i=JSON.stringify(l);return(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("span",{className:"font-mono text-xs",children:t?i:"••••••••"}),(0,s.jsx)("button",{onClick:()=>r(!t),className:"p-1 hover:bg-gray-100 rounded",type:"button",children:t?(0,s.jsx)(U.Z,{className:"w-4 h-4 text-gray-500"}):(0,s.jsx)(G.Z,{className:"w-4 h-4 text-gray-500"})})]})};var Y=e=>{let{accessToken:l,userRole:t,userID:p,modelData:g,premiumUser:f}=e,[j,v]=(0,a.useState)([]),[_,y]=(0,a.useState)(null),[b,N]=(0,a.useState)(!1),[Z,w]=(0,a.useState)(null);(0,a.useEffect)(()=>{l&&t&&p&&(0,d.getPassThroughEndpointsCall)(l).then(e=>{v(e.endpoints)})},[l,t,p]);let C=async e=>{w(e),N(!0)},S=async()=>{if(null!=Z&&l){try{await (0,d.deletePassThroughEndpointsCall)(l,Z);let e=j.filter(e=>e.id!==Z);v(e),P.Z.success("Endpoint deleted successfully.")}catch(e){console.error("Error deleting the endpoint:",e),P.Z.fromBackend("Error deleting the endpoint: "+e)}N(!1),w(null)}},k=(e,l)=>{C(e)},A=[{header:"ID",accessorKey:"id",cell:e=>(0,s.jsx)(c.Z,{title:e.row.original.id,children:(0,s.jsx)("div",{className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[15ch]",onClick:()=>e.row.original.id&&y(e.row.original.id),children:e.row.original.id})})},{header:"Path",accessorKey:"path"},{header:"Target",accessorKey:"target",cell:e=>(0,s.jsx)(n.Z,{children:e.getValue()})},{header:()=>(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)("span",{children:"Authentication"}),(0,s.jsx)(c.Z,{title:"LiteLLM Virtual Key required to call endpoint",children:(0,s.jsx)(u.Z,{className:"w-4 h-4 text-gray-400 cursor-help"})})]}),accessorKey:"auth",cell:e=>(0,s.jsx)(m.Z,{color:e.getValue()?"green":"gray",children:e.getValue()?"Yes":"No"})},{header:"Headers",accessorKey:"headers",cell:e=>(0,s.jsx)(W,{value:e.getValue()||{}})},{header:"Actions",id:"actions",cell:e=>{let{row:l}=e;return(0,s.jsxs)("div",{className:"flex space-x-1",children:[(0,s.jsx)(i.Z,{icon:h.Z,size:"sm",onClick:()=>l.original.id&&y(l.original.id),title:"Edit"}),(0,s.jsx)(i.Z,{icon:x.Z,size:"sm",onClick:()=>k(l.original.id,l.index),title:"Delete"})]})}}];if(!l)return null;if(_){console.log("selectedEndpointId",_),console.log("generalSettings",j);let e=j.find(e=>e.id===_);return e?(0,s.jsx)(K,{endpointData:e,onClose:()=>y(null),accessToken:l,isAdmin:"Admin"===t||"admin"===t,premiumUser:f,onEndpointUpdated:()=>{l&&(0,d.getPassThroughEndpointsCall)(l).then(e=>{v(e.endpoints)})}}):(0,s.jsx)("div",{children:"Endpoint not found"})}return(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(o.Z,{children:"Pass Through Endpoints"}),(0,s.jsx)(n.Z,{className:"text-tremor-content",children:"Configure and manage your pass-through endpoints"})]}),(0,s.jsx)(D,{accessToken:l,setPassThroughItems:v,passThroughItems:j,premiumUser:f}),(0,s.jsx)(J.w,{data:j,columns:A,renderSubComponent:()=>(0,s.jsx)("div",{}),getRowCanExpand:()=>!1,isLoading:!1,noDataMessage:"No pass-through endpoints configured"}),b&&(0,s.jsx)("div",{className:"fixed z-10 inset-0 overflow-y-auto",children:(0,s.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,s.jsx)("div",{className:"fixed inset-0 transition-opacity","aria-hidden":"true",children:(0,s.jsx)("div",{className:"absolute inset-0 bg-gray-500 opacity-75"})}),(0,s.jsx)("span",{className:"hidden sm:inline-block sm:align-middle sm:h-screen","aria-hidden":"true",children:"​"}),(0,s.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,s.jsx)("div",{className:"bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4",children:(0,s.jsx)("div",{className:"sm:flex sm:items-start",children:(0,s.jsxs)("div",{className:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left",children:[(0,s.jsx)("h3",{className:"text-lg leading-6 font-medium text-gray-900",children:"Delete Pass-Through Endpoint"}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)("p",{className:"text-sm text-gray-500",children:"Are you sure you want to delete this pass-through endpoint? This action cannot be undone."})})]})})}),(0,s.jsxs)("div",{className:"bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse",children:[(0,s.jsx)(r.Z,{onClick:S,color:"red",className:"ml-2",children:"Delete"}),(0,s.jsx)(r.Z,{onClick:()=>{N(!1),w(null)},children:"Cancel"})]})]})]})})]})}},39789:function(e,l,t){t.d(l,{Z:function(){return n}});var s=t(57437),a=t(2265),r=t(88237),i=t(84264),n=e=>{let{value:l,onValueChange:t,label:n="Select Time Range",className:o="",showTimeRange:d=!0}=e,[c,m]=(0,a.useState)(!1),u=(0,a.useRef)(null),h=(0,a.useCallback)(e=>{m(!0),setTimeout(()=>m(!1),1500),t(e),requestIdleCallback(()=>{if(e.from){let l;let s={...e},a=new Date(e.from);l=new Date(e.to?e.to:e.from),a.toDateString(),l.toDateString(),a.setHours(0,0,0,0),l.setHours(23,59,59,999),s.from=a,s.to=l,t(s)}},{timeout:100})},[t]),x=(0,a.useCallback)((e,l)=>{if(!e||!l)return"";let t=e=>e.toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0,timeZoneName:"short"});if(e.toDateString()!==l.toDateString())return"".concat(t(e)," - ").concat(t(l));{let t=e.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),s=e.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!0}),a=l.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!0,timeZoneName:"short"});return"".concat(t,": ").concat(s," - ").concat(a)}},[]);return(0,s.jsxs)("div",{className:o,children:[n&&(0,s.jsx)(i.Z,{className:"mb-2",children:n}),(0,s.jsxs)("div",{className:"relative w-fit",children:[(0,s.jsx)("div",{ref:u,children:(0,s.jsx)(r.Z,{enableSelect:!0,value:l,onValueChange:h,placeholder:"Select date range",enableClear:!1,style:{zIndex:100}})}),c&&(0,s.jsx)("div",{className:"absolute top-1/2 animate-pulse",style:{left:"calc(100% + 8px)",transform:"translateY(-50%)",zIndex:110},children:(0,s.jsxs)("div",{className:"flex items-center gap-1 text-green-600 text-sm font-medium bg-white px-2 py-1 rounded-full border border-green-200 shadow-sm whitespace-nowrap",children:[(0,s.jsx)("div",{className:"w-3 h-3 bg-green-500 text-white rounded-full flex items-center justify-center text-xs",children:"✓"}),(0,s.jsx)("span",{className:"text-xs",children:"Selected"})]})})]}),d&&l.from&&l.to&&(0,s.jsx)(i.Z,{className:"mt-2 text-xs text-gray-500",children:x(l.from,l.to)})]})}},12322:function(e,l,t){t.d(l,{w:function(){return o}});var s=t(57437),a=t(2265),r=t(71594),i=t(24525),n=t(19130);function o(e){let{data:l=[],columns:t,getRowCanExpand:o,renderSubComponent:d,isLoading:c=!1,loadingMessage:m="\uD83D\uDE85 Loading logs...",noDataMessage:u="No logs found"}=e,h=(0,r.b7)({data:l,columns:t,getRowCanExpand:o,getRowId:(e,l)=>{var t;return null!==(t=null==e?void 0:e.request_id)&&void 0!==t?t:String(l)},getCoreRowModel:(0,i.sC)(),getExpandedRowModel:(0,i.rV)()});return(0,s.jsx)("div",{className:"rounded-lg custom-border overflow-x-auto w-full max-w-full box-border",children:(0,s.jsxs)(n.iA,{className:"[&_td]:py-0.5 [&_th]:py-1 table-fixed w-full box-border",style:{minWidth:"400px"},children:[(0,s.jsx)(n.ss,{children:h.getHeaderGroups().map(e=>(0,s.jsx)(n.SC,{children:e.headers.map(e=>(0,s.jsx)(n.xs,{className:"py-1 h-8",children:e.isPlaceholder?null:(0,r.ie)(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,s.jsx)(n.RM,{children:c?(0,s.jsx)(n.SC,{children:(0,s.jsx)(n.pj,{colSpan:t.length,className:"h-8 text-center",children:(0,s.jsx)("div",{className:"text-center text-gray-500",children:(0,s.jsx)("p",{children:m})})})}):h.getRowModel().rows.length>0?h.getRowModel().rows.map(e=>(0,s.jsxs)(a.Fragment,{children:[(0,s.jsx)(n.SC,{className:"h-8",children:e.getVisibleCells().map(e=>(0,s.jsx)(n.pj,{className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap",children:(0,r.ie)(e.column.columnDef.cell,e.getContext())},e.id))}),e.getIsExpanded()&&(0,s.jsx)(n.SC,{children:(0,s.jsx)(n.pj,{colSpan:e.getVisibleCells().length,className:"p-0",children:(0,s.jsx)("div",{className:"w-full max-w-full overflow-hidden box-border",children:d({row:e})})})})]},e.id)):(0,s.jsx)(n.SC,{children:(0,s.jsx)(n.pj,{colSpan:t.length,className:"h-8 text-center",children:(0,s.jsx)("div",{className:"text-center text-gray-500",children:(0,s.jsx)("p",{children:u})})})})})]})})}}}]); \ No newline at end of file +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1200],{90246:function(e,l,t){t.d(l,{n:function(){return s}});function s(e){let l=[e];return{all:l,lists:()=>[...l,"list"],list:e=>[...l,"list",{params:e}],details:()=>[...l,"detail"],detail:e=>[...l,"detail",e]}}},31200:function(e,l,t){t.d(l,{Z:function(){return lK}});var s=t(57437),a=t(29827),r=t(49804),i=t(67101),n=t(84264),o=t(2265),d=t(9114),c=t(19250),m=t(42673);let u=async(e,l,t)=>{try{var s,a;console.log("handling submit for formValues:",e);let l=e.model_mappings||[];if("model_mappings"in e&&delete e.model_mappings,e.model&&e.model.includes("all-wildcard")){let t=e.custom_llm_provider,a=(null!==(s=m.fK[t])&&void 0!==s?s:t.toLowerCase())+"/*";e.model_name=a,l.push({public_name:a,litellm_model:a}),e.model=a}let t=[];for(let s of l){let l={},r={},i=s.public_name;for(let[t,i]of(l.model=s.litellm_model,e.input_cost_per_token&&(e.input_cost_per_token=Number(e.input_cost_per_token)/1e6),e.output_cost_per_token&&(e.output_cost_per_token=Number(e.output_cost_per_token)/1e6),l.model=s.litellm_model,console.log("formValues add deployment:",e),Object.entries(e)))if(""!==i&&"custom_pricing"!==t&&"pricing_model"!==t&&"cache_control"!==t){if("model_name"==t)l.model=i;else if("custom_llm_provider"==t){console.log("custom_llm_provider:",i);let e=null!==(a=m.fK[i])&&void 0!==a?a:i.toLowerCase();l.custom_llm_provider=e,console.log("custom_llm_provider mappingResult:",e)}else if("model"==t)continue;else if("base_model"===t)r[t]=i;else if("team_id"===t)r.team_id=i;else if("model_access_group"===t)r.access_groups=i;else if("mode"==t)console.log("placing mode in modelInfo"),r.mode=i,delete l.mode;else if("custom_model_name"===t)l.model=i;else if("litellm_extra_params"==t){console.log("litellm_extra_params:",i);let e={};if(i&&void 0!=i){try{e=JSON.parse(i)}catch(e){throw d.Z.fromBackend("Failed to parse LiteLLM Extra Params: "+e),Error("Failed to parse litellm_extra_params: "+e)}for(let[t,s]of Object.entries(e))l[t]=s}}else if("model_info_params"==t){console.log("model_info_params:",i);let e={};if(i&&void 0!=i){try{e=JSON.parse(i)}catch(e){throw d.Z.fromBackend("Failed to parse LiteLLM Extra Params: "+e),Error("Failed to parse litellm_extra_params: "+e)}for(let[l,t]of Object.entries(e))r[l]=t}}else if("input_cost_per_token"===t||"output_cost_per_token"===t||"input_cost_per_second"===t){i&&(l[t]=Number(i));continue}else l[t]=i}t.push({litellmParamsObj:l,modelInfoObj:r,modelName:i})}return t}catch(e){d.Z.fromBackend("Failed to create model: "+e)}},h=async(e,l,t,s)=>{try{let a=await u(e,l,t);if(!a||0===a.length)return;for(let e of a){let{litellmParamsObj:t,modelInfoObj:s,modelName:a}=e,r={model_name:a,litellm_params:t,model_info:s},i=await (0,c.modelCreateCall)(l,r);console.log("response for model create call: ".concat(i.data))}s&&s(),t.resetFields()}catch(e){d.Z.fromBackend("Failed to add model: "+e)}};var x=t(11713),p=t(90246);let g=(0,p.n)("credentials"),f=e=>(0,x.a)({queryKey:g.list({}),queryFn:async()=>await (0,c.credentialListCall)(e),enabled:!!e}),j=(0,p.n)("models");(0,p.n)("modelHub");let v=(e,l,t)=>(0,x.a)({queryKey:j.list({filters:{...l&&{userID:l},...t&&{userRole:t}}}),queryFn:async()=>await (0,c.modelInfoCall)(e,l,t),enabled:!!(e&&l&&t)});var _=t(53410),y=t(74998),b=t(62490),N=t(10032),Z=t(21609),w=t(31283),C=t(57840),S=t(22116),k=t(37592),A=t(99981),E=t(5545);let M=(0,p.n)("providerFields"),I=()=>(0,x.a)({queryKey:M.list({}),queryFn:async()=>await (0,c.getProviderCreateMetadata)(),staleTime:864e5,gcTime:864e5});var F=t(3632),P=t(56522),L=t(47451),T=t(69410),R=t(65319),O=t(4260);let{Link:V}=C.default,D=e=>{var l,t,s,a,r;let i="password"===e.field_type?"password":"select"===e.field_type?"select":"upload"===e.field_type?"upload":"textarea"===e.field_type?"textarea":"text";return{key:e.key,label:e.label,placeholder:null!==(l=e.placeholder)&&void 0!==l?l:void 0,tooltip:null!==(t=e.tooltip)&&void 0!==t?t:void 0,required:null!==(s=e.required)&&void 0!==s&&s,type:i,options:null!==(a=e.options)&&void 0!==a?a:void 0,defaultValue:null!==(r=e.default_value)&&void 0!==r?r:void 0}},z={};var q=e=>{let{selectedProvider:l,uploadProps:t}=e,a=m.Cl[l],r=N.Z.useFormInstance(),{data:i,isLoading:n,error:d}=I(),c=o.useMemo(()=>{if(!i)return null;let e={};return i.forEach(l=>{let t=l.provider_display_name,s=l.credential_fields.map(D);e[t]=s,l.provider&&(e[l.provider]=s),l.litellm_provider&&(e[l.litellm_provider]=s)}),e},[i]);o.useEffect(()=>{c&&Object.assign(z,c)},[c]);let u=o.useMemo(()=>{var e;let t=null!==(e=z[a])&&void 0!==e?e:z[l];if(t)return t;if(!i)return[];let s=i.find(e=>e.provider_display_name===a||e.provider===l||e.litellm_provider===l);if(!s)return[];let r=s.credential_fields.map(D);return z[s.provider_display_name]=r,s.provider&&(z[s.provider]=r),s.litellm_provider&&(z[s.litellm_provider]=r),r},[a,l,i]),h={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;console.log("Setting field value from JSON, length: ".concat(l.length)),r.setFieldsValue({vertex_credentials:l}),console.log("Form values after setting:",r.getFieldsValue())}},l.readAsText(e)}return!1},onChange(e){console.log("Upload onChange triggered in ProviderSpecificFields"),console.log("Current form values:",r.getFieldsValue()),"uploading"!==e.file.status&&console.log(e.file,e.fileList)}};return(0,s.jsxs)(s.Fragment,{children:[n&&0===u.length&&(0,s.jsx)(L.Z,{children:(0,s.jsx)(T.Z,{span:24,children:(0,s.jsx)(P.x,{className:"mb-2",children:"Loading provider fields..."})})}),d&&0===u.length&&(0,s.jsx)(L.Z,{children:(0,s.jsx)(T.Z,{span:24,children:(0,s.jsx)(P.x,{className:"mb-2 text-red-500",children:d instanceof Error?d.message:"Failed to load provider credential fields"})})}),u.map(e=>{var l;return(0,s.jsxs)(o.Fragment,{children:[(0,s.jsx)(N.Z.Item,{label:e.label,name:e.key,rules:e.required?[{required:!0,message:"Required"}]:void 0,tooltip:e.tooltip,className:"vertex_credentials"===e.key?"mb-0":void 0,children:"select"===e.type?(0,s.jsx)(k.default,{placeholder:e.placeholder,defaultValue:e.defaultValue,children:null===(l=e.options)||void 0===l?void 0:l.map(e=>(0,s.jsx)(k.default.Option,{value:e,children:e},e))}):"upload"===e.type?(0,s.jsx)(R.default,{...h,onChange:l=>{(null==t?void 0:t.onChange)&&t.onChange(l),setTimeout(()=>{let l=r.getFieldValue(e.key);console.log("".concat(e.key," value after upload:"),JSON.stringify(l))},500)},children:(0,s.jsx)(E.ZP,{icon:(0,s.jsx)(F.Z,{}),children:"Click to Upload"})}):"textarea"===e.type?(0,s.jsx)(O.default.TextArea,{placeholder:e.placeholder,defaultValue:e.defaultValue,rows:6,style:{fontFamily:"monospace",fontSize:"12px"}}):(0,s.jsx)(P.o,{placeholder:e.placeholder,type:"password"===e.type?"password":"text",defaultValue:e.defaultValue})}),"vertex_credentials"===e.key&&(0,s.jsx)(L.Z,{children:(0,s.jsx)(T.Z,{children:(0,s.jsx)(P.x,{className:"mb-3 mt-1",children:"Give a gcp service account(.json file)"})})}),"base_model"===e.key&&(0,s.jsxs)(L.Z,{children:[(0,s.jsx)(T.Z,{span:10}),(0,s.jsx)(T.Z,{span:10,children:(0,s.jsxs)(P.x,{className:"mb-2",children:["The actual model your azure deployment uses. Used for accurate cost tracking. Select name from"," ",(0,s.jsx)(V,{href:"https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json",target:"_blank",children:"here"})]})})]})]},e.key)})]})};let{Link:B}=C.default;var U=e=>{let{open:l,onCancel:t,onAddCredential:a,uploadProps:r}=e,[i]=N.Z.useForm(),[n,d]=(0,o.useState)(m.Cl.OpenAI);return(0,s.jsx)(S.Z,{title:"Add New Credential",open:l,onCancel:()=>{t(),i.resetFields()},footer:null,width:600,children:(0,s.jsxs)(N.Z,{form:i,onFinish:e=>{a(Object.entries(e).reduce((e,l)=>{let[t,s]=l;return""!==s&&null!=s&&(e[t]=s),e},{})),i.resetFields()},layout:"vertical",children:[(0,s.jsx)(N.Z.Item,{label:"Credential Name:",name:"credential_name",rules:[{required:!0,message:"Credential name is required"}],children:(0,s.jsx)(w.o,{placeholder:"Enter a friendly name for these credentials"})}),(0,s.jsx)(N.Z.Item,{rules:[{required:!0,message:"Required"}],label:"Provider:",name:"custom_llm_provider",tooltip:"Helper to auto-populate provider specific fields",children:(0,s.jsx)(k.default,{showSearch:!0,onChange:e=>{d(e),i.setFieldValue("custom_llm_provider",e)},children:Object.entries(m.Cl).map(e=>{let[l,t]=e;return(0,s.jsx)(k.default.Option,{value:l,children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("img",{src:m.cd[t],alt:"".concat(l," logo"),className:"w-5 h-5",onError:e=>{let l=e.target,s=l.parentElement;if(s){let e=document.createElement("div");e.className="w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=t.charAt(0),s.replaceChild(e,l)}}}),(0,s.jsx)("span",{children:t})]})},l)})})}),(0,s.jsx)(q,{selectedProvider:n,uploadProps:r}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(A.Z,{title:"Get help on our github",children:(0,s.jsx)(B,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)(E.ZP,{onClick:()=>{t(),i.resetFields()},style:{marginRight:10},children:"Cancel"}),(0,s.jsx)(E.ZP,{htmlType:"submit",children:"Add Credential"})]})]})]})})};let{Link:G}=C.default;function H(e){let{open:l,onCancel:t,onUpdateCredential:a,uploadProps:r,existingCredential:i}=e,[n]=N.Z.useForm(),[d,c]=(0,o.useState)(m.Cl.Anthropic);return(0,o.useEffect)(()=>{if(i){let e=Object.entries(i.credential_values||{}).reduce((e,l)=>{let[t,s]=l;return e[t]=null!=s?s:null,e},{});n.setFieldsValue({credential_name:i.credential_name,custom_llm_provider:i.credential_info.custom_llm_provider,...e}),c(i.credential_info.custom_llm_provider)}},[i]),(0,s.jsx)(S.Z,{title:"Edit Credential",open:l,onCancel:()=>{t(),n.resetFields()},footer:null,width:600,destroyOnHidden:!0,children:(0,s.jsxs)(N.Z,{form:n,onFinish:e=>{a(Object.entries(e).reduce((e,l)=>{let[t,s]=l;return""!==s&&null!=s&&(e[t]=s),e},{})),n.resetFields()},layout:"vertical",children:[(0,s.jsx)(N.Z.Item,{label:"Credential Name:",name:"credential_name",rules:[{required:!0,message:"Credential name is required"}],initialValue:null==i?void 0:i.credential_name,children:(0,s.jsx)(w.o,{placeholder:"Enter a friendly name for these credentials",disabled:null!=i&&!!i.credential_name})}),(0,s.jsx)(N.Z.Item,{rules:[{required:!0,message:"Required"}],label:"Provider:",name:"custom_llm_provider",tooltip:"Helper to auto-populate provider specific fields",children:(0,s.jsx)(k.default,{showSearch:!0,onChange:e=>{c(e),n.setFieldValue("custom_llm_provider",e)},children:Object.entries(m.Cl).map(e=>{let[l,t]=e;return(0,s.jsx)(k.default.Option,{value:l,children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("img",{src:m.cd[t],alt:"".concat(l," logo"),className:"w-5 h-5",onError:e=>{let l=e.target,s=l.parentElement;if(s){let e=document.createElement("div");e.className="w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=t.charAt(0),s.replaceChild(e,l)}}}),(0,s.jsx)("span",{children:t})]})},l)})})}),(0,s.jsx)(q,{selectedProvider:d,uploadProps:r}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(A.Z,{title:"Get help on our github",children:(0,s.jsx)(G,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)(E.ZP,{onClick:()=>{t(),n.resetFields()},style:{marginRight:10},children:"Cancel"}),(0,s.jsx)(E.ZP,{htmlType:"submit",children:"Update Credential"})]})]})]})})}var K=t(80443),J=e=>{var l;let{uploadProps:t}=e,{accessToken:a}=(0,K.Z)(),{data:r,refetch:i}=f(a),n=(null==r?void 0:r.credentials)||[],[m,u]=(0,o.useState)(!1),[h,x]=(0,o.useState)(!1),[p,g]=(0,o.useState)(null),[j,v]=(0,o.useState)(null),[w,C]=(0,o.useState)(!1),[S,k]=(0,o.useState)(!1),[A]=N.Z.useForm(),E=["credential_name","custom_llm_provider"],M=async e=>{if(!a)return;let l=Object.entries(e).filter(e=>{let[l]=e;return!E.includes(l)}).reduce((e,l)=>{let[t,s]=l;return{...e,[t]:s}},{}),t={credential_name:e.credential_name,credential_values:l,credential_info:{custom_llm_provider:e.custom_llm_provider}};await (0,c.credentialUpdateCall)(a,e.credential_name,t),d.Z.success("Credential updated successfully"),x(!1),await i()},I=async e=>{if(!a)return;let l=Object.entries(e).filter(e=>{let[l]=e;return!E.includes(l)}).reduce((e,l)=>{let[t,s]=l;return{...e,[t]:s}},{}),t={credential_name:e.credential_name,credential_values:l,credential_info:{custom_llm_provider:e.custom_llm_provider}};await (0,c.credentialCreateCall)(a,t),d.Z.success("Credential added successfully"),u(!1),await i()},F=e=>{let l={openai:"blue",azure:"indigo",anthropic:"purple",default:"gray"},t=l[e.toLowerCase()]||l.default;return(0,s.jsx)(b.Ct,{color:t,size:"xs",children:e})},P=async()=>{if(a&&j){k(!0);try{await (0,c.credentialDeleteCall)(a,j.credential_name),d.Z.success("Credential deleted successfully"),await i()}catch(e){d.Z.error("Failed to delete credential")}finally{v(null),C(!1),k(!1)}}},L=e=>{v(e),C(!0)};return(0,s.jsxs)("div",{className:"w-full mx-auto flex-auto overflow-y-auto p-2",children:[(0,s.jsx)(b.zx,{onClick:()=>u(!0),children:"Add Credential"}),(0,s.jsx)("div",{className:"flex justify-between items-center mt-4 mb-4",children:(0,s.jsx)(b.xv,{children:"Configured credentials for different AI providers. Add and manage your API credentials."})}),(0,s.jsx)(b.Zb,{children:(0,s.jsxs)(b.iA,{children:[(0,s.jsx)(b.ss,{children:(0,s.jsxs)(b.SC,{children:[(0,s.jsx)(b.xs,{children:"Credential Name"}),(0,s.jsx)(b.xs,{children:"Provider"}),(0,s.jsx)(b.xs,{children:"Actions"})]})}),(0,s.jsx)(b.RM,{children:n&&0!==n.length?n.map((e,l)=>{var t;return(0,s.jsxs)(b.SC,{children:[(0,s.jsx)(b.pj,{children:e.credential_name}),(0,s.jsx)(b.pj,{children:F((null===(t=e.credential_info)||void 0===t?void 0:t.custom_llm_provider)||"-")}),(0,s.jsxs)(b.pj,{children:[(0,s.jsx)(b.zx,{icon:_.Z,variant:"light",size:"sm",onClick:()=>{g(e),x(!0)}}),(0,s.jsx)(b.zx,{icon:y.Z,variant:"light",size:"sm",onClick:()=>L(e),className:"ml-2"})]})]},l)}):(0,s.jsx)(b.SC,{children:(0,s.jsx)(b.pj,{colSpan:4,className:"text-center py-4 text-gray-500",children:"No credentials configured"})})})]})}),m&&(0,s.jsx)(U,{onAddCredential:I,open:m,onCancel:()=>u(!1),uploadProps:t}),h&&(0,s.jsx)(H,{open:h,existingCredential:p,onUpdateCredential:M,uploadProps:t,onCancel:()=>x(!1)}),(0,s.jsx)(Z.Z,{isOpen:w,onCancel:()=>{v(null),C(!1)},onOk:P,title:"Delete Credential?",message:"Are you sure you want to delete this credential? This action cannot be undone and may break existing integrations.",resourceInformationTitle:"Credential Information",resourceInformation:[{label:"Credential Name",value:null==j?void 0:j.credential_name},{label:"Provider",value:(null==j?void 0:null===(l=j.credential_info)||void 0===l?void 0:l.custom_llm_provider)||"-"}],confirmLoading:S,requiredConfirmation:null==j?void 0:j.credential_name})]})};let W=e=>{var l;return(null==e?void 0:null===(l=e.model_info)||void 0===l?void 0:l.team_public_model_name)?e.model_info.team_public_model_name:(null==e?void 0:e.model_name)||"-"};var Y=t(23628),$=t(47323),Q=t(12485),X=t(18135),ee=t(35242),el=t(29706),et=t(77991),es=t(20347),ea=t(59341),er=t(5945),ei=t(84376),en=t(29),eo=t.n(en),ed=t(23496),ec=t(35291),em=t(23639),eu=t(15424);let{Text:eh}=C.default;var ex=e=>{let{formValues:l,accessToken:t,testMode:a,modelName:r="this model",onClose:i,onTestComplete:n}=e,[m,h]=o.useState(null),[x,p]=o.useState(null),[g,f]=o.useState(null),[j,v]=o.useState(!0),[_,y]=o.useState(!1),[b,N]=o.useState(!1),Z=async()=>{v(!0),N(!1),h(null),p(null),f(null),y(!1),await new Promise(e=>setTimeout(e,100));try{console.log("Testing connection with form values:",l);let a=await u(l,t,null);if(!a){console.log("No result from prepareModelAddRequest"),h("Failed to prepare model data. Please check your form inputs."),y(!1),v(!1);return}console.log("Result from prepareModelAddRequest:",a);let{litellmParamsObj:r,modelInfoObj:i,modelName:n}=a[0],o=await (0,c.testConnectionRequest)(t,r,i,null==i?void 0:i.mode);if("success"===o.status)d.Z.success("Connection test successful!"),h(null),y(!0);else{var e,s;let l=(null===(e=o.result)||void 0===e?void 0:e.error)||o.message||"Unknown error";h(l),p(r),f(null===(s=o.result)||void 0===s?void 0:s.raw_request_typed_dict),y(!1)}}catch(e){console.error("Test connection error:",e),h(e instanceof Error?e.message:String(e)),y(!1)}finally{v(!1),n&&n()}};o.useEffect(()=>{let e=setTimeout(()=>{Z()},200);return()=>clearTimeout(e)},[]);let w=e=>e?e.split("stack trace:")[0].trim().replace(/^litellm\.(.*?)Error: /,""):"Unknown error",C="string"==typeof m?w(m):(null==m?void 0:m.message)?w(m.message):"Unknown error",S=g?((e,l,t)=>{let s=JSON.stringify(l,null,2).split("\n").map(e=>" ".concat(e)).join("\n"),a=Object.entries(t).map(e=>{let[l,t]=e;return"-H '".concat(l,": ").concat(t,"'")}).join(" \\\n ");return"curl -X POST \\\n ".concat(e," \\\n ").concat(a?"".concat(a," \\\n "):"","-H 'Content-Type: application/json' \\\n -d '{\n").concat(s,"\n }'")})(g.raw_request_api_base,g.raw_request_body,g.raw_request_headers||{}):"";return(0,s.jsxs)("div",{style:{padding:"24px",borderRadius:"8px",backgroundColor:"#fff"},children:[j?(0,s.jsxs)("div",{style:{textAlign:"center",padding:"32px 20px"},className:"jsx-dc9a0e2d897fe63b",children:[(0,s.jsx)("div",{style:{marginBottom:"16px"},className:"jsx-dc9a0e2d897fe63b loading-spinner",children:(0,s.jsx)("div",{style:{border:"3px solid #f3f3f3",borderTop:"3px solid #1890ff",borderRadius:"50%",width:"30px",height:"30px",animation:"spin 1s linear infinite",margin:"0 auto"},className:"jsx-dc9a0e2d897fe63b"})}),(0,s.jsxs)(eh,{style:{fontSize:"16px"},children:["Testing connection to ",r,"..."]}),(0,s.jsx)(eo(),{id:"dc9a0e2d897fe63b",children:"@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-moz-keyframes spin{0%{-moz-transform:rotate(0deg);transform:rotate(0deg)}100%{-moz-transform:rotate(360deg);transform:rotate(360deg)}}@-o-keyframes spin{0%{-o-transform:rotate(0deg);transform:rotate(0deg)}100%{-o-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes spin{0%{-webkit-transform:rotate(0deg);-moz-transform:rotate(0deg);-o-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);-moz-transform:rotate(360deg);-o-transform:rotate(360deg);transform:rotate(360deg)}}"})]}):_?(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"32px 20px"},children:[(0,s.jsx)("div",{style:{color:"#52c41a",fontSize:"24px",display:"flex",alignItems:"center"},children:(0,s.jsx)("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"check-circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:(0,s.jsx)("path",{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 01-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z"})})}),(0,s.jsxs)(eh,{type:"success",style:{fontSize:"18px",fontWeight:500,marginLeft:"10px"},children:["Connection to ",r," successful!"]})]}):(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",marginBottom:"20px"},children:[(0,s.jsx)(ec.Z,{style:{color:"#ff4d4f",fontSize:"24px",marginRight:"12px"}}),(0,s.jsxs)(eh,{type:"danger",style:{fontSize:"18px",fontWeight:500},children:["Connection to ",r," failed"]})]}),(0,s.jsxs)("div",{style:{backgroundColor:"#fff2f0",border:"1px solid #ffccc7",borderRadius:"8px",padding:"16px",marginBottom:"20px",boxShadow:"0 1px 2px rgba(0, 0, 0, 0.03)"},children:[(0,s.jsxs)(eh,{strong:!0,style:{display:"block",marginBottom:"8px"},children:["Error:"," "]}),(0,s.jsx)(eh,{type:"danger",style:{fontSize:"14px",lineHeight:"1.5"},children:C}),m&&(0,s.jsx)("div",{style:{marginTop:"12px"},children:(0,s.jsx)(E.ZP,{type:"link",onClick:()=>N(!b),style:{paddingLeft:0,height:"auto"},children:b?"Hide Details":"Show Details"})})]}),b&&(0,s.jsxs)("div",{style:{marginBottom:"20px"},children:[(0,s.jsx)(eh,{strong:!0,style:{display:"block",marginBottom:"8px",fontSize:"15px"},children:"Troubleshooting Details"}),(0,s.jsx)("pre",{style:{backgroundColor:"#f5f5f5",padding:"16px",borderRadius:"8px",fontSize:"13px",maxHeight:"200px",overflow:"auto",border:"1px solid #e8e8e8",lineHeight:"1.5"},children:"string"==typeof m?m:JSON.stringify(m,null,2)})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(eh,{strong:!0,style:{display:"block",marginBottom:"8px",fontSize:"15px"},children:"API Request"}),(0,s.jsx)("pre",{style:{backgroundColor:"#f5f5f5",padding:"16px",borderRadius:"8px",fontSize:"13px",maxHeight:"250px",overflow:"auto",border:"1px solid #e8e8e8",lineHeight:"1.5"},children:S||"No request data available"}),(0,s.jsx)(E.ZP,{style:{marginTop:"8px"},icon:(0,s.jsx)(em.Z,{}),onClick:()=>{navigator.clipboard.writeText(S||""),d.Z.success("Copied to clipboard")},children:"Copy to Clipboard"})]})]})}),(0,s.jsx)(ed.Z,{style:{margin:"24px 0 16px"}}),(0,s.jsx)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:(0,s.jsx)(E.ZP,{type:"link",href:"https://docs.litellm.ai/docs/providers",target:"_blank",icon:(0,s.jsx)(eu.Z,{}),children:"View Documentation"})})]})};let ep=async(e,l,t,s)=>{try{console.log("=== AUTO ROUTER SUBMIT HANDLER CALLED ==="),console.log("handling auto router submit for formValues:",e),console.log("Access token:",l?"Present":"Missing"),console.log("Form:",t?"Present":"Missing"),console.log("Callback:",s?"Present":"Missing");let a={model_name:e.auto_router_name,litellm_params:{model:"auto_router/".concat(e.auto_router_name),auto_router_config:JSON.stringify(e.auto_router_config),auto_router_default_model:e.auto_router_default_model},model_info:{}};e.auto_router_embedding_model&&"custom"!==e.auto_router_embedding_model?a.litellm_params.auto_router_embedding_model=e.auto_router_embedding_model:e.custom_embedding_model&&(a.litellm_params.auto_router_embedding_model=e.custom_embedding_model),e.team_id&&(a.model_info.team_id=e.team_id),e.model_access_group&&e.model_access_group.length>0&&(a.model_info.access_groups=e.model_access_group),console.log("Auto router configuration to be created:",a),console.log("Auto router config (stringified):",a.litellm_params.auto_router_config),console.log("Calling modelCreateCall with:",{accessToken:l?"Present":"Missing",config:a});let r=await (0,c.modelCreateCall)(l,a);console.log("response for auto router create call:",r),t.resetFields()}catch(e){console.error("Failed to add auto router:",e),d.Z.fromBackend("Failed to add auto router: "+e)}};var eg=t(10703),ef=t(44851),ej=t(19015),ev=t(96473),e_=t(70464),ey=t(26349),eb=t(92280);let{TextArea:eN}=O.default,{Panel:eZ}=ef.default;var ew=e=>{let{modelInfo:l,value:t,onChange:a}=e,[r,i]=(0,o.useState)([]),[n,d]=(0,o.useState)(!1),[c,m]=(0,o.useState)([]);(0,o.useEffect)(()=>{if(null==t?void 0:t.routes){let e=t.routes.map((e,l)=>({id:e.id||"route-".concat(l,"-").concat(Date.now()),model:e.name||e.model||"",utterances:e.utterances||[],description:e.description||"",score_threshold:e.score_threshold||.5}));i(e),m(e.map(e=>e.id))}else i([]),m([])},[t]);let u=e=>{let l=r.filter(l=>l.id!==e);i(l),x(l),m(l=>l.filter(l=>l!==e))},h=(e,l,t)=>{let s=r.map(s=>s.id===e?{...s,[l]:t}:s);i(s),x(s)},x=e=>{let l={routes:e.map(e=>({name:e.model,utterances:e.utterances,description:e.description,score_threshold:e.score_threshold}))};null==a||a(l)},p=l.map(e=>({value:e.model_group,label:e.model_group}));return(0,s.jsxs)("div",{className:"w-full max-w-none",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-6 w-full",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(eb.x,{className:"text-lg font-semibold",children:"Routes Configuration"}),(0,s.jsx)(A.Z,{title:"Configure routing logic to automatically select the best model based on user input patterns",children:(0,s.jsx)(eu.Z,{className:"text-gray-400"})})]}),(0,s.jsx)(E.ZP,{type:"primary",icon:(0,s.jsx)(ev.Z,{}),onClick:()=>{let e="route-".concat(Date.now()),l=[...r,{id:e,model:"",utterances:[],description:"",score_threshold:.5}];i(l),x(l),m(l=>[...l,e])},className:"bg-blue-600 hover:bg-blue-700",children:"Add Route"})]}),0===r.length?(0,s.jsx)("div",{className:"text-center py-12 text-gray-500 bg-gray-50 rounded-lg border-2 border-dashed border-gray-200 mb-6",children:(0,s.jsx)(eb.x,{children:"No routes configured. Click “Add Route” to get started."})}):(0,s.jsx)("div",{className:"space-y-3 mb-6 w-full",children:r.map((e,l)=>(0,s.jsx)(er.Z,{className:"border border-gray-200 shadow-sm w-full",bodyStyle:{padding:0},children:(0,s.jsx)(ef.default,{ghost:!0,expandIcon:e=>{let{isActive:l}=e;return(0,s.jsx)(e_.Z,{rotate:l?180:0})},activeKey:c,onChange:e=>m(Array.isArray(e)?e:[e].filter(Boolean)),items:[{key:e.id,label:(0,s.jsxs)("div",{className:"flex justify-between items-center py-2",children:[(0,s.jsxs)(eb.x,{className:"font-medium text-base",children:["Route ",l+1,": ",e.model||"Unnamed"]}),(0,s.jsx)(E.ZP,{type:"text",danger:!0,icon:(0,s.jsx)(ey.Z,{}),onClick:l=>{l.stopPropagation(),u(e.id)},className:"mr-2"})]}),children:(0,s.jsxs)("div",{className:"px-6 pb-6 w-full",children:[(0,s.jsxs)("div",{className:"mb-4 w-full",children:[(0,s.jsx)(eb.x,{className:"text-sm font-medium mb-2 block",children:"Model"}),(0,s.jsx)(k.default,{value:e.model,onChange:l=>h(e.id,"model",l),placeholder:"Select model",showSearch:!0,style:{width:"100%"},options:p})]}),(0,s.jsxs)("div",{className:"mb-4 w-full",children:[(0,s.jsx)(eb.x,{className:"text-sm font-medium mb-2 block",children:"Description"}),(0,s.jsx)(eN,{value:e.description,onChange:l=>h(e.id,"description",l.target.value),placeholder:"Describe when this route should be used...",rows:2,style:{width:"100%"}})]}),(0,s.jsxs)("div",{className:"mb-4 w-full",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,s.jsx)(eb.x,{className:"text-sm font-medium",children:"Score Threshold"}),(0,s.jsx)(A.Z,{title:"Minimum similarity score to route to this model (0-1)",children:(0,s.jsx)(eu.Z,{className:"text-gray-400"})})]}),(0,s.jsx)(ej.Z,{value:e.score_threshold,onChange:l=>h(e.id,"score_threshold",l||0),min:0,max:1,step:.1,style:{width:"100%"},placeholder:"0.5"})]}),(0,s.jsxs)("div",{className:"w-full",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,s.jsx)(eb.x,{className:"text-sm font-medium",children:"Example Utterances"}),(0,s.jsx)(A.Z,{title:"Training examples for this route. Type an utterance and press Enter to add it.",children:(0,s.jsx)(eu.Z,{className:"text-gray-400"})})]}),(0,s.jsx)(eb.x,{className:"text-xs text-gray-500 mb-2",children:"Type an utterance and press Enter to add it. You can also paste multiple lines."}),(0,s.jsx)(k.default,{mode:"tags",value:e.utterances,onChange:l=>h(e.id,"utterances",l),placeholder:"Type an utterance and press Enter...",style:{width:"100%"},tokenSeparators:["\n"],maxTagCount:"responsive",allowClear:!0})]})]})}]})},e.id))}),(0,s.jsxs)("div",{className:"border-t pt-6 w-full",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4 w-full",children:[(0,s.jsx)(eb.x,{className:"text-lg font-semibold",children:"JSON Preview"}),(0,s.jsx)(E.ZP,{type:"link",onClick:()=>d(!n),className:"text-blue-600 p-0",children:n?"Hide":"Show"})]}),n&&(0,s.jsx)(er.Z,{className:"bg-gray-50 w-full",children:(0,s.jsx)("pre",{className:"text-sm overflow-auto max-h-64 w-full",children:JSON.stringify({routes:r.map(e=>({name:e.model,utterances:e.utterances,description:e.description,score_threshold:e.score_threshold}))},null,2)})})]})]})};let{Title:eC,Link:eS}=C.default;var ek=e=>{let{form:l,handleOk:t,accessToken:a,userRole:r}=e,[i,n]=(0,o.useState)(!1),[m,u]=(0,o.useState)(!1),[h,x]=(0,o.useState)(""),[p,g]=(0,o.useState)([]),[f,j]=(0,o.useState)([]),[v,_]=(0,o.useState)(!1),[y,b]=(0,o.useState)(!1),[Z,w]=(0,o.useState)(null);(0,o.useEffect)(()=>{(async()=>{g((await (0,c.modelAvailableCall)(a,"","",!1,null,!0,!0)).data.map(e=>e.id))})()},[a]),(0,o.useEffect)(()=>{(async()=>{try{let e=await (0,eg.p)(a);console.log("Fetched models for auto router:",e),j(e)}catch(e){console.error("Error fetching model info for auto router:",e)}})()},[a]);let M=es.ZL.includes(r),I=async()=>{u(!0),x("test-".concat(Date.now())),n(!0)},F=()=>{console.log("Auto router submit triggered!"),console.log("Router config:",Z);let e=l.getFieldsValue();if(console.log("Form values:",e),!e.auto_router_name){d.Z.fromBackend("Please enter an Auto Router Name");return}if(!e.auto_router_default_model){d.Z.fromBackend("Please select a Default Model");return}if(l.setFieldsValue({custom_llm_provider:"auto_router",model:e.auto_router_name,api_key:"not_required_for_auto_router"}),!Z||!Z.routes||0===Z.routes.length){d.Z.fromBackend("Please configure at least one route for the auto router");return}if(Z.routes.filter(e=>!e.name||!e.description||0===e.utterances.length).length>0){d.Z.fromBackend("Please ensure all routes have a target model, description, and at least one utterance");return}l.validateFields().then(e=>{console.log("Form validation passed, submitting with values:",e);let s={...e,auto_router_config:Z};console.log("Final submit values:",s),ep(s,a,l,t)}).catch(e=>{console.error("Validation failed:",e);let l=e.errorFields||[];if(l.length>0){let e=l.map(e=>{let l=e.name[0];return({auto_router_name:"Auto Router Name",auto_router_default_model:"Default Model",auto_router_embedding_model:"Embedding Model"})[l]||l});d.Z.fromBackend("Please fill in the following required fields: ".concat(e.join(", ")))}else d.Z.fromBackend("Please fill in all required fields")})};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(eC,{level:2,children:"Add Auto Router"}),(0,s.jsx)(P.x,{className:"text-gray-600 mb-6",children:"Create an auto router with intelligent routing logic that automatically selects the best model based on user input patterns and semantic matching."}),(0,s.jsx)(er.Z,{children:(0,s.jsxs)(N.Z,{form:l,onFinish:F,labelCol:{span:10},wrapperCol:{span:16},labelAlign:"left",children:[(0,s.jsx)(N.Z.Item,{rules:[{required:!0,message:"Auto router name is required"}],label:"Auto Router Name",name:"auto_router_name",tooltip:"Unique name for this auto router configuration",labelCol:{span:10},labelAlign:"left",children:(0,s.jsx)(P.o,{placeholder:"e.g., auto_router_1, smart_routing"})}),(0,s.jsx)("div",{className:"w-full mb-4",children:(0,s.jsx)(ew,{modelInfo:f,value:Z,onChange:e=>{w(e),l.setFieldValue("auto_router_config",e)}})}),(0,s.jsx)(N.Z.Item,{rules:[{required:!0,message:"Default model is required"}],label:"Default Model",name:"auto_router_default_model",tooltip:"Fallback model to use when auto routing logic cannot determine the best model",labelCol:{span:10},labelAlign:"left",children:(0,s.jsx)(k.default,{placeholder:"Select a default model",onChange:e=>{_("custom"===e)},options:[...Array.from(new Set(f.map(e=>e.model_group))).map(e=>({value:e,label:e})),{value:"custom",label:"Enter custom model name"}],style:{width:"100%"},showSearch:!0})}),(0,s.jsx)(N.Z.Item,{label:"Embedding Model",name:"auto_router_embedding_model",tooltip:"Optional: Embedding model to use for semantic routing decisions",labelCol:{span:10},labelAlign:"left",children:(0,s.jsx)(k.default,{value:l.getFieldValue("auto_router_embedding_model"),placeholder:"Select an embedding model (optional)",onChange:e=>{b("custom"===e),l.setFieldValue("auto_router_embedding_model",e)},options:[...Array.from(new Set(f.map(e=>e.model_group))).map(e=>({value:e,label:e})),{value:"custom",label:"Enter custom model name"}],style:{width:"100%"},showSearch:!0,allowClear:!0})}),(0,s.jsxs)("div",{className:"flex items-center my-4",children:[(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"}),(0,s.jsx)("span",{className:"px-4 text-gray-500 text-sm",children:"Additional Settings"}),(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"})]}),M&&(0,s.jsx)(N.Z.Item,{label:"Model Access Group",name:"model_access_group",className:"mb-4",tooltip:"Use model access groups to control who can access this auto router",children:(0,s.jsx)(k.default,{mode:"tags",showSearch:!0,placeholder:"Select existing groups or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],options:p.map(e=>({value:e,label:e})),maxTagCount:"responsive",allowClear:!0})}),(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,s.jsx)(A.Z,{title:"Get help on our github",children:(0,s.jsx)(C.default.Link,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})}),(0,s.jsxs)("div",{className:"space-x-2",children:[(0,s.jsx)(E.ZP,{onClick:I,loading:m,children:"Test Connect"}),(0,s.jsx)(E.ZP,{onClick:()=>{console.log("Add Auto Router button clicked!"),console.log("Current router config:",Z),console.log("Current form values:",l.getFieldsValue()),F()},children:"Add Auto Router"})]})]})]})}),(0,s.jsx)(S.Z,{title:"Connection Test Results",open:i,onCancel:()=>{n(!1),u(!1)},footer:[(0,s.jsx)(E.ZP,{onClick:()=>{n(!1),u(!1)},children:"Close"},"close")],width:700,children:i&&(0,s.jsx)(ex,{formValues:l.getFieldsValue(),accessToken:a,testMode:"chat",modelName:l.getFieldValue("auto_router_name"),onClose:()=>{n(!1),u(!1)},onTestComplete:()=>u(!1)},h)})]})};let eA=[{value:"chat",label:"Chat - /chat/completions"},{value:"completion",label:"Completion - /completions"},{value:"embedding",label:"Embedding - /embeddings"},{value:"audio_speech",label:"Audio Speech - /audio/speech"},{value:"audio_transcription",label:"Audio Transcription - /audio/transcriptions"},{value:"image_generation",label:"Image Generation - /images/generations"},{value:"video_generation",label:"Video Generation - /videos"},{value:"rerank",label:"Rerank - /rerank"},{value:"realtime",label:"Realtime - /realtime"},{value:"batch",label:"Batch - /batch"},{value:"ocr",label:"OCR - /ocr"}];var eE=t(63709),eM=t(26210),eI=t(34766),eF=t(45246),eP=t(24199);let{Text:eL}=C.default;var eT=e=>{let{form:l,showCacheControl:t,onCacheControlChange:a}=e,r=e=>{let t=l.getFieldValue("litellm_extra_params");try{let s=t?JSON.parse(t):{};e.length>0?s.cache_control_injection_points=e:delete s.cache_control_injection_points,Object.keys(s).length>0?l.setFieldValue("litellm_extra_params",JSON.stringify(s,null,2)):l.setFieldValue("litellm_extra_params","")}catch(e){console.error("Error updating cache control points:",e)}};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(N.Z.Item,{label:"Cache Control Injection Points",name:"cache_control",valuePropName:"checked",className:"mb-4",tooltip:"Tell litellm where to inject cache control checkpoints. You can specify either by role (to apply to all messages of that role) or by specific message index.",children:(0,s.jsx)(eE.Z,{onChange:a,className:"bg-gray-600"})}),t&&(0,s.jsxs)("div",{className:"ml-6 pl-4 border-l-2 border-gray-200",children:[(0,s.jsx)(eL,{className:"text-sm text-gray-500 block mb-4",children:"Providers like Anthropic, Bedrock API require users to specify where to inject cache control checkpoints, litellm can automatically add them for you as a cost saving feature."}),(0,s.jsx)(N.Z.List,{name:"cache_control_injection_points",initialValue:[{location:"message"}],children:(e,t)=>{let{add:a,remove:i}=t;return(0,s.jsxs)(s.Fragment,{children:[e.map((t,a)=>(0,s.jsxs)("div",{className:"flex items-center mb-4 gap-4",children:[(0,s.jsx)(N.Z.Item,{...t,label:"Type",name:[t.name,"location"],initialValue:"message",className:"mb-0",style:{width:"180px"},children:(0,s.jsx)(k.default,{disabled:!0,options:[{value:"message",label:"Message"}]})}),(0,s.jsx)(N.Z.Item,{...t,label:"Role",name:[t.name,"role"],className:"mb-0",style:{width:"180px"},tooltip:"LiteLLM will mark all messages of this role as cacheable",children:(0,s.jsx)(k.default,{placeholder:"Select a role",allowClear:!0,options:[{value:"user",label:"User"},{value:"system",label:"System"},{value:"assistant",label:"Assistant"}],onChange:()=>{r(l.getFieldValue("cache_control_points"))}})}),(0,s.jsx)(N.Z.Item,{...t,label:"Index",name:[t.name,"index"],className:"mb-0",style:{width:"180px"},tooltip:"(Optional) If set litellm will mark the message at this index as cacheable",children:(0,s.jsx)(eP.Z,{type:"number",placeholder:"Optional",step:1,onChange:()=>{r(l.getFieldValue("cache_control_points"))}})}),e.length>1&&(0,s.jsx)(eF.Z,{className:"text-red-500 cursor-pointer text-lg ml-12",onClick:()=>{i(t.name),setTimeout(()=>{r(l.getFieldValue("cache_control_points"))},0)}})]},t.key)),(0,s.jsx)(N.Z.Item,{children:(0,s.jsxs)("button",{type:"button",className:"flex items-center justify-center w-full border border-dashed border-gray-300 py-2 px-4 text-gray-600 hover:text-blue-600 hover:border-blue-300 transition-all rounded",onClick:()=>a(),children:[(0,s.jsx)(ev.Z,{className:"mr-2"}),"Add Injection Point"]})})]})}})]})]})},eR=t(9309);let{Link:eO}=C.default;var eV=e=>{let{showAdvancedSettings:l,setShowAdvancedSettings:t,teams:a,guardrailsList:r,tagsList:i}=e,[n]=N.Z.useForm(),[d,c]=o.useState(!1),[m,u]=o.useState("per_token"),[h,x]=o.useState(!1),p=(e,l)=>l&&(isNaN(Number(l))||0>Number(l))?Promise.reject("Please enter a valid positive number"):Promise.resolve();return(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)(eM.UQ,{className:"mt-2 mb-4",children:[(0,s.jsx)(eM._m,{children:(0,s.jsx)("b",{children:"Advanced Settings"})}),(0,s.jsx)(eM.X1,{children:(0,s.jsxs)("div",{className:"bg-white rounded-lg",children:[(0,s.jsx)(N.Z.Item,{label:"Custom Pricing",name:"custom_pricing",valuePropName:"checked",className:"mb-4",children:(0,s.jsx)(eE.Z,{onChange:e=>{c(e),e||n.setFieldsValue({input_cost_per_token:void 0,output_cost_per_token:void 0,input_cost_per_second:void 0})},className:"bg-gray-600"})}),(0,s.jsx)(N.Z.Item,{label:(0,s.jsxs)("span",{children:["Guardrails"," ",(0,s.jsx)(A.Z,{title:"Apply safety guardrails to this key to filter content or enforce policies",children:(0,s.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/quick_start",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,s.jsx)(eu.Z,{style:{marginLeft:"4px"}})})})]}),name:"guardrails",className:"mt-4",help:"Select existing guardrails. Go to 'Guardrails' tab to create new guardrails.",children:(0,s.jsx)(k.default,{mode:"tags",style:{width:"100%"},placeholder:"Select or enter guardrails",options:r.map(e=>({value:e,label:e}))})}),(0,s.jsx)(N.Z.Item,{label:"Tags",name:"tags",className:"mb-4",children:(0,s.jsx)(k.default,{mode:"tags",style:{width:"100%"},placeholder:"Select or enter tags",options:Object.values(i).map(e=>({value:e.name,label:e.name,title:e.description||e.name}))})}),d&&(0,s.jsxs)("div",{className:"ml-6 pl-4 border-l-2 border-gray-200",children:[(0,s.jsx)(N.Z.Item,{label:"Pricing Model",name:"pricing_model",className:"mb-4",children:(0,s.jsx)(k.default,{defaultValue:"per_token",onChange:e=>u(e),options:[{value:"per_token",label:"Per Million Tokens"},{value:"per_second",label:"Per Second"}]})}),"per_token"===m?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(N.Z.Item,{label:"Input Cost (per 1M tokens)",name:"input_cost_per_token",rules:[{validator:p}],className:"mb-4",children:(0,s.jsx)(eM.oi,{})}),(0,s.jsx)(N.Z.Item,{label:"Output Cost (per 1M tokens)",name:"output_cost_per_token",rules:[{validator:p}],className:"mb-4",children:(0,s.jsx)(eM.oi,{})})]}):(0,s.jsx)(N.Z.Item,{label:"Cost Per Second",name:"input_cost_per_second",rules:[{validator:p}],className:"mb-4",children:(0,s.jsx)(eM.oi,{})})]}),(0,s.jsx)(N.Z.Item,{label:"Use in pass through routes",name:"use_in_pass_through",valuePropName:"checked",className:"mb-4 mt-4",tooltip:(0,s.jsxs)("span",{children:["Allow using these credentials in pass through routes."," ",(0,s.jsx)(eO,{href:"https://docs.litellm.ai/docs/pass_through/vertex_ai",target:"_blank",children:"Learn more"})]}),children:(0,s.jsx)(eE.Z,{onChange:e=>{let l=n.getFieldValue("litellm_extra_params");try{let t=l?JSON.parse(l):{};e?t.use_in_pass_through=!0:delete t.use_in_pass_through,Object.keys(t).length>0?n.setFieldValue("litellm_extra_params",JSON.stringify(t,null,2)):n.setFieldValue("litellm_extra_params","")}catch(l){e?n.setFieldValue("litellm_extra_params",JSON.stringify({use_in_pass_through:!0},null,2)):n.setFieldValue("litellm_extra_params","")}},className:"bg-gray-600"})}),(0,s.jsx)(eT,{form:n,showCacheControl:h,onCacheControlChange:e=>{if(x(e),!e){let e=n.getFieldValue("litellm_extra_params");try{let l=e?JSON.parse(e):{};delete l.cache_control_injection_points,Object.keys(l).length>0?n.setFieldValue("litellm_extra_params",JSON.stringify(l,null,2)):n.setFieldValue("litellm_extra_params","")}catch(e){n.setFieldValue("litellm_extra_params","")}}}}),(0,s.jsx)(N.Z.Item,{label:"LiteLLM Params",name:"litellm_extra_params",tooltip:"Optional litellm params used for making a litellm.completion() call.",className:"mb-4 mt-4",rules:[{validator:eR.Ac}],children:(0,s.jsx)(eI.Z,{rows:4,placeholder:'{ "rpm": 100, "timeout": 0, "stream_timeout": 0 }'})}),(0,s.jsxs)(L.Z,{className:"mb-4",children:[(0,s.jsx)(T.Z,{span:10}),(0,s.jsx)(T.Z,{span:10,children:(0,s.jsxs)(eM.xv,{className:"text-gray-600 text-sm",children:["Pass JSON of litellm supported params"," ",(0,s.jsx)(eO,{href:"https://docs.litellm.ai/docs/completion/input",target:"_blank",children:"litellm.completion() call"})]})})]}),(0,s.jsx)(N.Z.Item,{label:"Model Info",name:"model_info_params",tooltip:"Optional model info params. Returned when calling `/model/info` endpoint.",className:"mb-0",rules:[{validator:eR.Ac}],children:(0,s.jsx)(eI.Z,{rows:4,placeholder:'{ "mode": "chat" }'})})]})})]})})},eD=t(56609),ez=t(67187);let eq=e=>{let{content:l,children:t,width:a="auto",className:r=""}=e,[i,n]=(0,o.useState)(!1),[d,c]=(0,o.useState)("top"),m=(0,o.useRef)(null),u=()=>{if(m.current){let e=m.current.getBoundingClientRect(),l=e.top,t=window.innerHeight-e.bottom;l<300&&t>300?c("bottom"):c("top")}};return(0,s.jsxs)("div",{className:"relative inline-block",ref:m,children:[t||(0,s.jsx)(ez.Z,{className:"ml-1 text-gray-500 cursor-help",onMouseEnter:()=>{u(),n(!0)},onMouseLeave:()=>n(!1)}),i&&(0,s.jsxs)("div",{className:"absolute left-1/2 -translate-x-1/2 z-50 bg-black/90 text-white p-2 rounded-md text-sm font-normal shadow-lg ".concat(r),style:{["top"===d?"bottom":"top"]:"100%",width:a,marginBottom:"top"===d?"8px":"0",marginTop:"bottom"===d?"8px":"0"},children:[l,(0,s.jsx)("div",{className:"absolute left-1/2 -translate-x-1/2 w-0 h-0",style:{top:"top"===d?"100%":"auto",bottom:"bottom"===d?"100%":"auto",borderTop:"top"===d?"6px solid rgba(0, 0, 0, 0.9)":"6px solid transparent",borderBottom:"bottom"===d?"6px solid rgba(0, 0, 0, 0.9)":"6px solid transparent",borderLeft:"6px solid transparent",borderRight:"6px solid transparent"}})]})]})};var eB=()=>{let e=N.Z.useFormInstance(),[l,t]=(0,o.useState)(0),a=N.Z.useWatch("model",e)||[],r=Array.isArray(a)?a:[a],i=N.Z.useWatch("custom_model_name",e),n=!r.includes("all-wildcard"),d=N.Z.useWatch("custom_llm_provider",e);if((0,o.useEffect)(()=>{if(i&&r.includes("custom")){let l=(e.getFieldValue("model_mappings")||[]).map(e=>"custom"===e.public_name||"custom"===e.litellm_model?d===m.Cl.Azure?{public_name:i,litellm_model:"azure/".concat(i)}:{public_name:i,litellm_model:i}:e);e.setFieldValue("model_mappings",l),t(e=>e+1)}},[i,r,d,e]),(0,o.useEffect)(()=>{if(r.length>0&&!r.includes("all-wildcard")){let l=e.getFieldValue("model_mappings")||[];if(l.length!==r.length||!r.every(e=>l.some(l=>"custom"===e?"custom"===l.litellm_model||l.litellm_model===i:d===m.Cl.Azure?l.litellm_model==="azure/".concat(e):l.litellm_model===e))){let l=r.map(e=>"custom"===e&&i?d===m.Cl.Azure?{public_name:i,litellm_model:"azure/".concat(i)}:{public_name:i,litellm_model:i}:d===m.Cl.Azure?{public_name:e,litellm_model:"azure/".concat(e)}:{public_name:e,litellm_model:e});e.setFieldValue("model_mappings",l),t(e=>e+1)}}},[r,i,d,e]),!n)return null;let c=(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"mb-2 font-normal",children:"The name you specify in your API calls to LiteLLM Proxy"}),(0,s.jsxs)("div",{className:"mb-2 font-normal",children:[(0,s.jsx)("strong",{children:"Example:"})," If you name your public model"," ",(0,s.jsx)("code",{className:"bg-gray-700 px-1 py-0.5 rounded text-xs",children:"example-name"}),", and choose"," ",(0,s.jsx)("code",{className:"bg-gray-700 px-1 py-0.5 rounded text-xs",children:"openai/qwen-plus-latest"})," as the LiteLLM model"]}),(0,s.jsxs)("div",{className:"mb-2 font-normal",children:[(0,s.jsx)("strong",{children:"Usage:"})," You make an API call to the LiteLLM proxy with"," ",(0,s.jsx)("code",{className:"bg-gray-700 px-1 py-0.5 rounded text-xs",children:'model = "example-name"'})]}),(0,s.jsxs)("div",{className:"font-normal",children:[(0,s.jsx)("strong",{children:"Result:"})," LiteLLM sends"," ",(0,s.jsx)("code",{className:"bg-gray-700 px-1 py-0.5 rounded text-xs",children:"qwen-plus-latest"})," to the provider"]})]}),u=(0,s.jsx)("div",{children:"The model name LiteLLM will send to the LLM API"}),h=[{title:(0,s.jsxs)("span",{className:"flex items-center",children:["Public Model Name",(0,s.jsx)(eq,{content:c,width:"500px"})]}),dataIndex:"public_name",key:"public_name",render:(l,t,a)=>(0,s.jsx)(w.o,{value:l,onChange:l=>{let t=[...e.getFieldValue("model_mappings")];t[a].public_name=l.target.value,e.setFieldValue("model_mappings",t)}})},{title:(0,s.jsxs)("span",{className:"flex items-center",children:["LiteLLM Model Name",(0,s.jsx)(eq,{content:u,width:"360px"})]}),dataIndex:"litellm_model",key:"litellm_model"}];return(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(N.Z.Item,{label:"Model Mappings",name:"model_mappings",tooltip:"Map public model names to LiteLLM model names for load balancing",labelCol:{span:10},wrapperCol:{span:16},labelAlign:"left",rules:[{required:!0,validator:async(e,l)=>{if(!l||0===l.length)throw Error("At least one model mapping is required");if(l.filter(e=>!e.public_name||""===e.public_name.trim()).length>0)throw Error("All model mappings must have valid public names")}}],children:(0,s.jsx)(eD.Z,{dataSource:e.getFieldValue("model_mappings"),columns:h,pagination:!1,size:"small"},l)})})},eU=e=>{let{selectedProvider:l,providerModels:t,getPlaceholder:a}=e,r=N.Z.useFormInstance(),i=e=>{let t=e.target.value,s=(r.getFieldValue("model_mappings")||[]).map(e=>"custom"===e.public_name||"custom"===e.litellm_model?l===m.Cl.Azure?{public_name:t,litellm_model:"azure/".concat(t)}:{public_name:t,litellm_model:t}:e);r.setFieldsValue({model_mappings:s})};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(N.Z.Item,{label:"LiteLLM Model Name(s)",tooltip:"The model name LiteLLM will send to the LLM API",className:"mb-0",children:[(0,s.jsx)(N.Z.Item,{name:"model",rules:[{required:!0,message:"Please enter ".concat(l===m.Cl.Azure?"a deployment name":"at least one model",".")}],noStyle:!0,children:l===m.Cl.Azure||l===m.Cl.OpenAI_Compatible||l===m.Cl.Ollama?(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(P.o,{placeholder:a(l),onChange:l===m.Cl.Azure?e=>{let l=e.target.value,t=l?[{public_name:l,litellm_model:"azure/".concat(l)}]:[];r.setFieldsValue({model:l,model_mappings:t})}:void 0})}):t.length>0?(0,s.jsx)(k.default,{mode:"multiple",allowClear:!0,showSearch:!0,placeholder:"Select models",onChange:e=>{let t=Array.isArray(e)?e:[e];if(t.includes("all-wildcard"))r.setFieldsValue({model_name:void 0,model_mappings:[]});else if(JSON.stringify(r.getFieldValue("model"))!==JSON.stringify(t)){let e=t.map(e=>l===m.Cl.Azure?{public_name:e,litellm_model:"azure/".concat(e)}:{public_name:e,litellm_model:e});r.setFieldsValue({model:t,model_mappings:e})}},optionFilterProp:"children",filterOption:(e,l)=>{var t;return(null!==(t=null==l?void 0:l.label)&&void 0!==t?t:"").toLowerCase().includes(e.toLowerCase())},options:[{label:"Custom Model Name (Enter below)",value:"custom"},{label:"All ".concat(l," Models (Wildcard)"),value:"all-wildcard"},...t.map(e=>({label:e,value:e}))],style:{width:"100%"}}):(0,s.jsx)(P.o,{placeholder:a(l)})}),(0,s.jsx)(N.Z.Item,{noStyle:!0,shouldUpdate:(e,l)=>e.model!==l.model,children:e=>{let{getFieldValue:t}=e,a=t("model")||[];return(Array.isArray(a)?a:[a]).includes("custom")&&(0,s.jsx)(N.Z.Item,{name:"custom_model_name",rules:[{required:!0,message:"Please enter a custom model name."}],className:"mt-2",children:(0,s.jsx)(P.o,{placeholder:l===m.Cl.Azure?"Enter Azure deployment name":"Enter custom model name",onChange:i})})}})]}),(0,s.jsxs)(L.Z,{children:[(0,s.jsx)(T.Z,{span:10}),(0,s.jsx)(T.Z,{span:14,children:(0,s.jsx)(P.x,{className:"mb-3 mt-1",children:l===m.Cl.Azure?"Your deployment name will be saved as the public model name, and LiteLLM will use 'azure/deployment-name' internally":"The model name LiteLLM will send to the LLM API"})})]})]})};let{Title:eG,Link:eH}=C.default;var eK=e=>{let{form:l,handleOk:t,selectedProvider:a,setSelectedProvider:r,providerModels:i,setProviderModelsFn:d,getPlaceholder:u,uploadProps:h,showAdvancedSettings:x,setShowAdvancedSettings:p,teams:g,credentials:f,accessToken:j,userRole:v,premiumUser:_}=e,[y]=N.Z.useForm(),[b,Z]=(0,o.useState)("chat"),[w,M]=(0,o.useState)(!1),[F,P]=(0,o.useState)(!1),[R,O]=(0,o.useState)([]),[V,D]=(0,o.useState)({}),[z,B]=(0,o.useState)(""),{data:U,isLoading:G,error:H}=I();(0,o.useEffect)(()=>{(async()=>{try{let e=(await (0,c.getGuardrailsList)(j)).guardrails.map(e=>e.guardrail_name);O(e)}catch(e){console.error("Failed to fetch guardrails:",e)}})()},[j]),(0,o.useEffect)(()=>{(async()=>{try{let e=await (0,c.tagListCall)(j);D(e)}catch(e){console.error("Failed to fetch tags:",e)}})()},[j]);let K=async()=>{P(!0),B("test-".concat(Date.now())),M(!0)},[J,W]=(0,o.useState)(!1),[Y,$]=(0,o.useState)([]);(0,o.useEffect)(()=>{(async()=>{$((await (0,c.modelAvailableCall)(j,"","",!1,null,!0,!0)).data.map(e=>e.id))})()},[j]);let en=(0,o.useMemo)(()=>U?[...U].sort((e,l)=>e.provider_display_name.localeCompare(l.provider_display_name)):[],[U]),eo=H?H instanceof Error?H.message:"Failed to load providers":null,ed=es.ZL.includes(v);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(X.Z,{className:"w-full",children:[(0,s.jsxs)(ee.Z,{className:"mb-4",children:[(0,s.jsx)(Q.Z,{children:"Add Model"}),(0,s.jsx)(Q.Z,{children:"Add Auto Router"})]}),(0,s.jsxs)(et.Z,{children:[(0,s.jsxs)(el.Z,{children:[(0,s.jsx)(eG,{level:2,children:"Add Model"}),(0,s.jsx)(er.Z,{children:(0,s.jsx)(N.Z,{form:l,onFinish:e=>{console.log("\uD83D\uDD25 Form onFinish triggered with values:",e),t()},onFinishFailed:e=>{console.log("\uD83D\uDCA5 Form onFinishFailed triggered:",e)},labelCol:{span:10},wrapperCol:{span:16},labelAlign:"left",children:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(N.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,s.jsxs)(k.default,{showSearch:!0,loading:G,placeholder:G?"Loading providers...":"Select a provider",optionFilterProp:"data-label",onChange:e=>{r(e),d(e),l.setFieldsValue({custom_llm_provider:e}),l.setFieldsValue({model:[],model_name:void 0})},children:[eo&&0===en.length&&(0,s.jsx)(k.default.Option,{value:"",children:eo},"__error"),en.map(e=>{var l;let t=e.provider_display_name,a=e.provider,r=null!==(l=m.cd[t])&&void 0!==l?l:"";return(0,s.jsx)(k.default.Option,{value:a,"data-label":t,children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[r?(0,s.jsx)("img",{src:r,alt:"".concat(t," logo"),className:"w-5 h-5",onError:e=>{let l=e.currentTarget,s=l.parentElement;if(s&&s.contains(l))try{let e=document.createElement("div");e.className="w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=t.charAt(0),s.replaceChild(e,l)}catch(e){console.error("Failed to replace provider logo fallback:",e)}}}):(0,s.jsx)("div",{className:"w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs",children:t.charAt(0)}),(0,s.jsx)("span",{children:t})]})},a)})]})}),(0,s.jsx)(eU,{selectedProvider:a,providerModels:i,getPlaceholder:u}),(0,s.jsx)(eB,{}),(0,s.jsx)(N.Z.Item,{label:"Mode",name:"mode",className:"mb-1",children:(0,s.jsx)(k.default,{style:{width:"100%"},value:b,onChange:e=>Z(e),options:eA})}),(0,s.jsxs)(L.Z,{children:[(0,s.jsx)(T.Z,{span:10}),(0,s.jsx)(T.Z,{span:10,children:(0,s.jsxs)(n.Z,{className:"mb-5 mt-1",children:[(0,s.jsx)("strong",{children:"Optional"})," - LiteLLM endpoint to use when health checking this model"," ",(0,s.jsx)(eH,{href:"https://docs.litellm.ai/docs/proxy/health#health",target:"_blank",children:"Learn more"})]})})]}),(0,s.jsx)("div",{className:"mb-4",children:(0,s.jsx)(C.default.Text,{className:"text-sm text-gray-500 mb-2",children:"Either select existing credentials OR enter new provider credentials below"})}),(0,s.jsx)(N.Z.Item,{label:"Existing Credentials",name:"litellm_credential_name",initialValue:null,children:(0,s.jsx)(k.default,{showSearch:!0,placeholder:"Select or search for existing credentials",optionFilterProp:"children",filterOption:(e,l)=>{var t;return(null!==(t=null==l?void 0:l.label)&&void 0!==t?t:"").toLowerCase().includes(e.toLowerCase())},options:[{value:null,label:"None"},...f.map(e=>({value:e.credential_name,label:e.credential_name}))],allowClear:!0})}),(0,s.jsx)(N.Z.Item,{noStyle:!0,shouldUpdate:(e,l)=>e.litellm_credential_name!==l.litellm_credential_name||e.provider!==l.provider,children:e=>{let{getFieldValue:l}=e,t=l("litellm_credential_name");return(console.log("\uD83D\uDD11 Credential Name Changed:",t),t)?null:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"flex items-center my-4",children:[(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"}),(0,s.jsx)("span",{className:"px-4 text-gray-500 text-sm",children:"OR"}),(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"})]}),(0,s.jsx)(q,{selectedProvider:a,uploadProps:h})]})}}),(0,s.jsxs)("div",{className:"flex items-center my-4",children:[(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"}),(0,s.jsx)("span",{className:"px-4 text-gray-500 text-sm",children:"Additional Model Info Settings"}),(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"})]}),(0,s.jsx)(N.Z.Item,{label:"Team-BYOK Model",tooltip:"Only use this model + credential combination for this team. Useful when teams want to onboard their own OpenAI keys.",className:"mb-4",children:(0,s.jsx)(A.Z,{title:_?"":"This is an enterprise-only feature. Upgrade to premium to restrict model+credential combinations to a specific team.",placement:"top",children:(0,s.jsx)(ea.Z,{checked:J,onChange:e=>{W(e),e||l.setFieldValue("team_id",void 0)},disabled:!_})})}),J&&(0,s.jsx)(N.Z.Item,{label:"Select Team",name:"team_id",className:"mb-4",tooltip:"Only keys for this team will be able to call this model.",rules:[{required:J&&!ed,message:"Please select a team."}],children:(0,s.jsx)(ei.Z,{teams:g,disabled:!_})}),ed&&(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(N.Z.Item,{label:"Model Access Group",name:"model_access_group",className:"mb-4",tooltip:"Use model access groups to give users access to select models, and add new ones to the group over time.",children:(0,s.jsx)(k.default,{mode:"tags",showSearch:!0,placeholder:"Select existing groups or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],options:Y.map(e=>({value:e,label:e})),maxTagCount:"responsive",allowClear:!0})})}),(0,s.jsx)(eV,{showAdvancedSettings:x,setShowAdvancedSettings:p,teams:g,guardrailsList:R,tagsList:V}),(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,s.jsx)(A.Z,{title:"Get help on our github",children:(0,s.jsx)(C.default.Link,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})}),(0,s.jsxs)("div",{className:"space-x-2",children:[(0,s.jsx)(E.ZP,{onClick:K,loading:F,children:"Test Connect"}),(0,s.jsx)(E.ZP,{htmlType:"submit",children:"Add Model"})]})]})]})})})]}),(0,s.jsx)(el.Z,{children:(0,s.jsx)(ek,{form:y,handleOk:()=>{y.validateFields().then(e=>{ep(e,j,y,t)}).catch(e=>{console.error("Validation failed:",e)})},accessToken:j,userRole:v})})]})]}),(0,s.jsx)(S.Z,{title:"Connection Test Results",open:w,onCancel:()=>{M(!1),P(!1)},footer:[(0,s.jsx)(E.ZP,{onClick:()=>{M(!1),P(!1)},children:"Close"},"close")],width:700,children:w&&(0,s.jsx)(ex,{formValues:l.getFieldsValue(),accessToken:j,testMode:b,modelName:l.getFieldValue("model_name")||l.getFieldValue("model"),onClose:()=>{M(!1),P(!1)},onTestComplete:()=>P(!1)},z)})]})},eJ=t(10900),eW=t(45589),eY=t(78489),e$=t(12514),eQ=t(49566),eX=t(96761),e0=t(30401),e1=t(78867),e2=t(59872),e4=e=>{let{isVisible:l,onCancel:t,onSuccess:a,modelData:r,accessToken:i,userRole:n}=e,[m]=N.Z.useForm(),[u,h]=(0,o.useState)(!1),[x,p]=(0,o.useState)([]),[g,f]=(0,o.useState)([]),[j,v]=(0,o.useState)(!1),[_,y]=(0,o.useState)(!1),[b,Z]=(0,o.useState)(null);(0,o.useEffect)(()=>{l&&r&&w()},[l,r]),(0,o.useEffect)(()=>{let e=async()=>{if(i)try{let e=await (0,c.modelAvailableCall)(i,"","",!1,null,!0,!0);p(e.data.map(e=>e.id))}catch(e){console.error("Error fetching model access groups:",e)}},t=async()=>{if(i)try{let e=await (0,eg.p)(i);f(e)}catch(e){console.error("Error fetching model info:",e)}};l&&(e(),t())},[l,i]);let w=()=>{try{var e,l,t,s,a,i;let n=null;(null===(e=r.litellm_params)||void 0===e?void 0:e.auto_router_config)&&(n="string"==typeof r.litellm_params.auto_router_config?JSON.parse(r.litellm_params.auto_router_config):r.litellm_params.auto_router_config),Z(n),m.setFieldsValue({auto_router_name:r.model_name,auto_router_default_model:(null===(l=r.litellm_params)||void 0===l?void 0:l.auto_router_default_model)||"",auto_router_embedding_model:(null===(t=r.litellm_params)||void 0===t?void 0:t.auto_router_embedding_model)||"",model_access_group:(null===(s=r.model_info)||void 0===s?void 0:s.access_groups)||[]});let o=new Set(g.map(e=>e.model_group));v(!o.has(null===(a=r.litellm_params)||void 0===a?void 0:a.auto_router_default_model)),y(!o.has(null===(i=r.litellm_params)||void 0===i?void 0:i.auto_router_embedding_model))}catch(e){console.error("Error parsing auto router config:",e),d.Z.fromBackend("Error loading auto router configuration")}},C=async()=>{try{h(!0);let e=await m.validateFields(),l={...r.litellm_params,auto_router_config:JSON.stringify(b),auto_router_default_model:e.auto_router_default_model,auto_router_embedding_model:e.auto_router_embedding_model||void 0},s={...r.model_info,access_groups:e.model_access_group||[]},n={model_name:e.auto_router_name,litellm_params:l,model_info:s};await (0,c.modelPatchUpdateCall)(i,n,r.model_info.id);let o={...r,model_name:e.auto_router_name,litellm_params:l,model_info:s};d.Z.success("Auto router configuration updated successfully"),a(o),t()}catch(e){console.error("Error updating auto router:",e),d.Z.fromBackend("Failed to update auto router configuration")}finally{h(!1)}},A=g.map(e=>({value:e.model_group,label:e.model_group}));return(0,s.jsx)(S.Z,{title:"Edit Auto Router Configuration",open:l,onCancel:t,footer:[(0,s.jsx)(E.ZP,{onClick:t,children:"Cancel"},"cancel"),(0,s.jsx)(E.ZP,{loading:u,onClick:C,children:"Save Changes"},"submit")],width:1e3,destroyOnClose:!0,children:(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsx)(P.x,{className:"text-gray-600",children:"Edit the auto router configuration including routing logic, default models, and access settings."}),(0,s.jsxs)(N.Z,{form:m,layout:"vertical",className:"space-y-4",children:[(0,s.jsx)(N.Z.Item,{label:"Auto Router Name",name:"auto_router_name",rules:[{required:!0,message:"Auto router name is required"}],children:(0,s.jsx)(P.o,{placeholder:"e.g., auto_router_1, smart_routing"})}),(0,s.jsx)("div",{className:"w-full",children:(0,s.jsx)(ew,{modelInfo:g,value:b,onChange:e=>{Z(e)}})}),(0,s.jsx)(N.Z.Item,{label:"Default Model",name:"auto_router_default_model",rules:[{required:!0,message:"Default model is required"}],children:(0,s.jsx)(k.default,{placeholder:"Select a default model",onChange:e=>{v("custom"===e)},options:[...A,{value:"custom",label:"Enter custom model name"}],showSearch:!0})}),(0,s.jsx)(N.Z.Item,{label:"Embedding Model",name:"auto_router_embedding_model",children:(0,s.jsx)(k.default,{placeholder:"Select an embedding model (optional)",onChange:e=>{y("custom"===e)},options:[...A,{value:"custom",label:"Enter custom model name"}],showSearch:!0,allowClear:!0})}),"Admin"===n&&(0,s.jsx)(N.Z.Item,{label:"Model Access Groups",name:"model_access_group",tooltip:"Control who can access this auto router",children:(0,s.jsx)(k.default,{mode:"tags",showSearch:!0,placeholder:"Select existing groups or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],options:x.map(e=>({value:e,label:e})),maxTagCount:"responsive",allowClear:!0})})]})]})})};let{Title:e5,Link:e6}=C.default;var e3=e=>{let{isVisible:l,onCancel:t,onAddCredential:a,existingCredential:r,setIsCredentialModalOpen:i}=e,[n]=N.Z.useForm();return console.log("existingCredential in add credentials tab: ".concat(JSON.stringify(r))),(0,s.jsx)(S.Z,{title:"Reuse Credentials",visible:l,onCancel:()=>{t(),n.resetFields()},footer:null,width:600,children:(0,s.jsxs)(N.Z,{form:n,onFinish:e=>{a(e),n.resetFields(),i(!1)},layout:"vertical",children:[(0,s.jsx)(N.Z.Item,{label:"Credential Name:",name:"credential_name",rules:[{required:!0,message:"Credential name is required"}],initialValue:null==r?void 0:r.credential_name,children:(0,s.jsx)(w.o,{placeholder:"Enter a friendly name for these credentials"})}),Object.entries((null==r?void 0:r.credential_values)||{}).map(e=>{let[l,t]=e;return(0,s.jsx)(N.Z.Item,{label:l,name:l,initialValue:t,children:(0,s.jsx)(w.o,{placeholder:"Enter ".concat(l),disabled:!0})},l)}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(A.Z,{title:"Get help on our github",children:(0,s.jsx)(e6,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)(E.ZP,{onClick:()=>{t(),n.resetFields()},style:{marginRight:10},children:"Cancel"}),(0,s.jsx)(E.ZP,{htmlType:"submit",children:"Reuse Credentials"})]})]})]})})};function e8(e){var l,t,a,r,u,h,x,p,g,f,j,v,_,b,Z,w,C,M,I,F,P,L,T,R,V,D,z,q,B,U,G,H;let{modelId:K,onClose:J,modelData:$,accessToken:es,userID:ea,userRole:er,editModel:ei,setEditModalVisible:en,setSelectedModel:eo,onModelUpdate:ed,modelAccessGroups:ec}=e,[em]=N.Z.useForm(),[eh,ex]=(0,o.useState)(null),[ep,eg]=(0,o.useState)(!1),[ef,ej]=(0,o.useState)(!1),[ev,e_]=(0,o.useState)(!1),[ey,eb]=(0,o.useState)(!1),[eN,eZ]=(0,o.useState)(!1),[ew,eC]=(0,o.useState)(null),[eS,ek]=(0,o.useState)(!1),[eA,eE]=(0,o.useState)({}),[eM,eI]=(0,o.useState)(!1),[eF,eL]=(0,o.useState)([]),[eO,eV]=(0,o.useState)({}),eD=("Admin"===er||(null==$?void 0:null===(l=$.model_info)||void 0===l?void 0:l.created_by)===ea)&&(null==$?void 0:null===(t=$.model_info)||void 0===t?void 0:t.db_model),ez="Admin"===er,eq=(null==$?void 0:null===(a=$.litellm_params)||void 0===a?void 0:a.auto_router_config)!=null,eB=(null==$?void 0:null===(r=$.litellm_params)||void 0===r?void 0:r.litellm_credential_name)!=null&&(null==$?void 0:null===(u=$.litellm_params)||void 0===u?void 0:u.litellm_credential_name)!=void 0;console.log("usingExistingCredential, ",eB),console.log("modelData.litellm_params.litellm_credential_name, ",null==$?void 0:null===(h=$.litellm_params)||void 0===h?void 0:h.litellm_credential_name),console.log("tagsList, ",null===(x=$.litellm_params)||void 0===x?void 0:x.tags),(0,o.useEffect)(()=>{let e=async()=>{var e,l,t,s,a,r,i;if(!es)return;let n=await (0,c.modelInfoV1Call)(es,K);console.log("modelInfoResponse, ",n);let o=n.data[0];o&&!o.litellm_model_name&&(o={...o,litellm_model_name:null!==(i=null!==(r=null!==(a=null==o?void 0:null===(l=o.litellm_params)||void 0===l?void 0:l.litellm_model_name)&&void 0!==a?a:null==o?void 0:null===(t=o.litellm_params)||void 0===t?void 0:t.model)&&void 0!==r?r:null==o?void 0:null===(s=o.model_info)||void 0===s?void 0:s.key)&&void 0!==i?i:null}),ex(o),(null==o?void 0:null===(e=o.litellm_params)||void 0===e?void 0:e.cache_control_injection_points)&&ek(!0)},l=async()=>{if(es)try{let e=(await (0,c.getGuardrailsList)(es)).guardrails.map(e=>e.guardrail_name);eL(e)}catch(e){console.error("Failed to fetch guardrails:",e)}},t=async()=>{if(es)try{let e=await (0,c.tagListCall)(es);eV(e)}catch(e){console.error("Failed to fetch tags:",e)}};(async()=>{if(console.log("accessToken, ",es),!es||eB)return;let e=await (0,c.credentialGetCall)(es,null,K);console.log("existingCredentialResponse, ",e),eC({credential_name:e.credential_name,credential_values:e.credential_values,credential_info:e.credential_info})})(),e(),l(),t()},[es,K]);let eU=async e=>{var l;if(console.log("values, ",e),!es)return;let t={credential_name:e.credential_name,model_id:K,credential_info:{custom_llm_provider:null===(l=eh.litellm_params)||void 0===l?void 0:l.custom_llm_provider}};d.Z.info("Storing credential.."),console.log("credentialResponse, ",await (0,c.credentialCreateCall)(es,t)),d.Z.success("Credential stored successfully")},eG=async e=>{try{var l;let t;if(!es)return;eb(!0),console.log("values.model_name, ",e.model_name);let s={};try{s=e.litellm_extra_params?JSON.parse(e.litellm_extra_params):{}}catch(e){d.Z.fromBackend("Invalid JSON in LiteLLM Params"),eb(!1);return}let a={...e.litellm_params,...s,model:e.litellm_model_name,api_base:e.api_base,custom_llm_provider:e.custom_llm_provider,organization:e.organization,tpm:e.tpm,rpm:e.rpm,max_retries:e.max_retries,timeout:e.timeout,stream_timeout:e.stream_timeout,input_cost_per_token:e.input_cost/1e6,output_cost_per_token:e.output_cost/1e6,tags:e.tags};e.guardrails&&(a.guardrails=e.guardrails),e.cache_control&&(null===(l=e.cache_control_injection_points)||void 0===l?void 0:l.length)>0?a.cache_control_injection_points=e.cache_control_injection_points:delete a.cache_control_injection_points;try{t=e.model_info?JSON.parse(e.model_info):$.model_info,e.model_access_group&&(t={...t,access_groups:e.model_access_group})}catch(e){d.Z.fromBackend("Invalid JSON in Model Info");return}let r={model_name:e.model_name,litellm_params:a,model_info:t};await (0,c.modelPatchUpdateCall)(es,r,K);let i={...eh,model_name:e.model_name,litellm_model_name:e.litellm_model_name,litellm_params:a,model_info:t};ex(i),ed&&ed(i),d.Z.success("Model settings updated successfully"),e_(!1),eZ(!1)}catch(e){console.error("Error updating model:",e),d.Z.fromBackend("Failed to update model settings")}finally{eb(!1)}};if(!$)return(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsx)(eY.Z,{icon:eJ.Z,variant:"light",onClick:J,className:"mb-4",children:"Back to Models"}),(0,s.jsx)(n.Z,{children:"Model not found"})]});let eH=async()=>{if(es)try{var e,l,t;d.Z.info("Testing connection...");let s=await (0,c.testConnectionRequest)(es,{custom_llm_provider:eh.litellm_params.custom_llm_provider,litellm_credential_name:eh.litellm_params.litellm_credential_name,model:eh.litellm_model_name},{mode:null===(e=eh.model_info)||void 0===e?void 0:e.mode},null===(l=eh.model_info)||void 0===l?void 0:l.mode);if("success"===s.status)d.Z.success("Connection test successful!");else throw Error((null==s?void 0:null===(t=s.result)||void 0===t?void 0:t.error)||(null==s?void 0:s.message)||"Unknown error")}catch(e){e instanceof Error?d.Z.error("Error testing connection: "+(0,eR.aS)(e.message,100)):d.Z.error("Error testing connection: "+String(e))}},eK=async()=>{try{if(!es)return;await (0,c.modelDeleteCall)(es,K),d.Z.success("Model deleted successfully"),ed&&ed({deleted:!0,model_info:{id:K}}),J()}catch(e){console.error("Error deleting the model:",e),d.Z.fromBackend("Failed to delete model")}},e5=async(e,l)=>{await (0,e2.vQ)(e)&&(eE(e=>({...e,[l]:!0})),setTimeout(()=>{eE(e=>({...e,[l]:!1}))},2e3))};return(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(eY.Z,{icon:eJ.Z,variant:"light",onClick:J,className:"mb-4",children:"Back to Models"}),(0,s.jsxs)(eX.Z,{children:["Public Model Name: ",W($)]}),(0,s.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,s.jsx)(n.Z,{className:"text-gray-500 font-mono",children:$.model_info.id}),(0,s.jsx)(E.ZP,{type:"text",size:"small",icon:eA["model-id"]?(0,s.jsx)(e0.Z,{size:12}):(0,s.jsx)(e1.Z,{size:12}),onClick:()=>e5($.model_info.id,"model-id"),className:"left-2 z-10 transition-all duration-200 ".concat(eA["model-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(eY.Z,{variant:"secondary",icon:Y.Z,onClick:eH,className:"flex items-center gap-2","data-testid":"test-connection-button",children:"Test Connection"}),(0,s.jsx)(eY.Z,{icon:eW.Z,variant:"secondary",onClick:()=>ej(!0),className:"flex items-center",disabled:!ez,"data-testid":"reuse-credentials-button",children:"Re-use Credentials"}),(0,s.jsx)(eY.Z,{icon:y.Z,variant:"secondary",onClick:()=>eg(!0),className:"flex items-center text-red-500 border-red-500 hover:text-red-700",disabled:!eD,"data-testid":"delete-model-button",children:"Delete Model"})]})]}),(0,s.jsxs)(X.Z,{children:[(0,s.jsxs)(ee.Z,{className:"mb-6",children:[(0,s.jsx)(Q.Z,{children:"Overview"}),(0,s.jsx)(Q.Z,{children:"Raw JSON"})]}),(0,s.jsxs)(et.Z,{children:[(0,s.jsxs)(el.Z,{children:[(0,s.jsxs)(i.Z,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6 mb-6",children:[(0,s.jsxs)(e$.Z,{children:[(0,s.jsx)(n.Z,{children:"Provider"}),(0,s.jsxs)("div",{className:"mt-2 flex items-center space-x-2",children:[$.provider&&(0,s.jsx)("img",{src:(0,m.dr)($.provider).logo,alt:"".concat($.provider," logo"),className:"w-4 h-4",onError:e=>{let l=e.currentTarget,t=l.parentElement;if(t&&t.contains(l))try{var s;let e=document.createElement("div");e.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=(null===(s=$.provider)||void 0===s?void 0:s.charAt(0))||"-",t.replaceChild(e,l)}catch(e){console.error("Failed to replace provider logo fallback:",e)}}}),(0,s.jsx)(eX.Z,{children:$.provider||"Not Set"})]})]}),(0,s.jsxs)(e$.Z,{children:[(0,s.jsx)(n.Z,{children:"LiteLLM Model"}),(0,s.jsx)("div",{className:"mt-2 overflow-hidden",children:(0,s.jsx)(A.Z,{title:$.litellm_model_name||"Not Set",children:(0,s.jsx)("div",{className:"break-all text-sm font-medium leading-relaxed cursor-pointer",children:$.litellm_model_name||"Not Set"})})})]}),(0,s.jsxs)(e$.Z,{children:[(0,s.jsx)(n.Z,{children:"Pricing"}),(0,s.jsxs)("div",{className:"mt-2",children:[(0,s.jsxs)(n.Z,{children:["Input: $",$.input_cost,"/1M tokens"]}),(0,s.jsxs)(n.Z,{children:["Output: $",$.output_cost,"/1M tokens"]})]})]})]}),(0,s.jsxs)("div",{className:"mb-6 text-sm text-gray-500 flex items-center gap-x-6",children:[(0,s.jsxs)("div",{className:"flex items-center gap-x-2",children:[(0,s.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Created At"," ",$.model_info.created_at?new Date($.model_info.created_at).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):"Not Set"]}),(0,s.jsxs)("div",{className:"flex items-center gap-x-2",children:[(0,s.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"})}),"Created By ",$.model_info.created_by||"Not Set"]})]}),(0,s.jsxs)(e$.Z,{children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,s.jsx)(eX.Z,{children:"Model Settings"}),(0,s.jsxs)("div",{className:"flex gap-2",children:[eq&&eD&&!eN&&(0,s.jsx)(eY.Z,{onClick:()=>eI(!0),className:"flex items-center",children:"Edit Auto Router"}),eD?!eN&&(0,s.jsx)(eY.Z,{onClick:()=>eZ(!0),className:"flex items-center",children:"Edit Settings"}):(0,s.jsx)(A.Z,{title:"Only DB models can be edited. You must be an admin or the creator of the model to edit it.",children:(0,s.jsx)(eu.Z,{})})]})]}),eh?(0,s.jsx)(N.Z,{form:em,onFinish:eG,initialValues:{model_name:eh.model_name,litellm_model_name:eh.litellm_model_name,api_base:eh.litellm_params.api_base,custom_llm_provider:eh.litellm_params.custom_llm_provider,organization:eh.litellm_params.organization,tpm:eh.litellm_params.tpm,rpm:eh.litellm_params.rpm,max_retries:eh.litellm_params.max_retries,timeout:eh.litellm_params.timeout,stream_timeout:eh.litellm_params.stream_timeout,input_cost:eh.litellm_params.input_cost_per_token?1e6*eh.litellm_params.input_cost_per_token:(null===(p=eh.model_info)||void 0===p?void 0:p.input_cost_per_token)*1e6||null,output_cost:(null===(g=eh.litellm_params)||void 0===g?void 0:g.output_cost_per_token)?1e6*eh.litellm_params.output_cost_per_token:(null===(f=eh.model_info)||void 0===f?void 0:f.output_cost_per_token)*1e6||null,cache_control:null!==(j=eh.litellm_params)&&void 0!==j&&!!j.cache_control_injection_points,cache_control_injection_points:(null===(v=eh.litellm_params)||void 0===v?void 0:v.cache_control_injection_points)||[],model_access_group:Array.isArray(null===(_=eh.model_info)||void 0===_?void 0:_.access_groups)?eh.model_info.access_groups:[],guardrails:Array.isArray(null===(b=eh.litellm_params)||void 0===b?void 0:b.guardrails)?eh.litellm_params.guardrails:[],tags:Array.isArray(null===(Z=eh.litellm_params)||void 0===Z?void 0:Z.tags)?eh.litellm_params.tags:[],litellm_extra_params:JSON.stringify(eh.litellm_params||{},null,2)},layout:"vertical",onValuesChange:()=>e_(!0),children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Model Name"}),eN?(0,s.jsx)(N.Z.Item,{name:"model_name",className:"mb-0",children:(0,s.jsx)(eQ.Z,{placeholder:"Enter model name"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:eh.model_name})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"LiteLLM Model Name"}),eN?(0,s.jsx)(N.Z.Item,{name:"litellm_model_name",className:"mb-0",children:(0,s.jsx)(eQ.Z,{placeholder:"Enter LiteLLM model name"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:eh.litellm_model_name})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Input Cost (per 1M tokens)"}),eN?(0,s.jsx)(N.Z.Item,{name:"input_cost",className:"mb-0",children:(0,s.jsx)(eP.Z,{placeholder:"Enter input cost"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null==eh?void 0:null===(w=eh.litellm_params)||void 0===w?void 0:w.input_cost_per_token)?((null===(C=eh.litellm_params)||void 0===C?void 0:C.input_cost_per_token)*1e6).toFixed(4):(null==eh?void 0:null===(M=eh.model_info)||void 0===M?void 0:M.input_cost_per_token)?(1e6*eh.model_info.input_cost_per_token).toFixed(4):null})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Output Cost (per 1M tokens)"}),eN?(0,s.jsx)(N.Z.Item,{name:"output_cost",className:"mb-0",children:(0,s.jsx)(eP.Z,{placeholder:"Enter output cost"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null==eh?void 0:null===(I=eh.litellm_params)||void 0===I?void 0:I.output_cost_per_token)?(1e6*eh.litellm_params.output_cost_per_token).toFixed(4):(null==eh?void 0:null===(F=eh.model_info)||void 0===F?void 0:F.output_cost_per_token)?(1e6*eh.model_info.output_cost_per_token).toFixed(4):null})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"API Base"}),eN?(0,s.jsx)(N.Z.Item,{name:"api_base",className:"mb-0",children:(0,s.jsx)(eQ.Z,{placeholder:"Enter API base"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(P=eh.litellm_params)||void 0===P?void 0:P.api_base)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Custom LLM Provider"}),eN?(0,s.jsx)(N.Z.Item,{name:"custom_llm_provider",className:"mb-0",children:(0,s.jsx)(eQ.Z,{placeholder:"Enter custom LLM provider"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(L=eh.litellm_params)||void 0===L?void 0:L.custom_llm_provider)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Organization"}),eN?(0,s.jsx)(N.Z.Item,{name:"organization",className:"mb-0",children:(0,s.jsx)(eQ.Z,{placeholder:"Enter organization"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(T=eh.litellm_params)||void 0===T?void 0:T.organization)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"TPM (Tokens per Minute)"}),eN?(0,s.jsx)(N.Z.Item,{name:"tpm",className:"mb-0",children:(0,s.jsx)(eP.Z,{placeholder:"Enter TPM"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(R=eh.litellm_params)||void 0===R?void 0:R.tpm)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"RPM (Requests per Minute)"}),eN?(0,s.jsx)(N.Z.Item,{name:"rpm",className:"mb-0",children:(0,s.jsx)(eP.Z,{placeholder:"Enter RPM"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(V=eh.litellm_params)||void 0===V?void 0:V.rpm)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Max Retries"}),eN?(0,s.jsx)(N.Z.Item,{name:"max_retries",className:"mb-0",children:(0,s.jsx)(eP.Z,{placeholder:"Enter max retries"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(D=eh.litellm_params)||void 0===D?void 0:D.max_retries)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Timeout (seconds)"}),eN?(0,s.jsx)(N.Z.Item,{name:"timeout",className:"mb-0",children:(0,s.jsx)(eP.Z,{placeholder:"Enter timeout"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(z=eh.litellm_params)||void 0===z?void 0:z.timeout)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Stream Timeout (seconds)"}),eN?(0,s.jsx)(N.Z.Item,{name:"stream_timeout",className:"mb-0",children:(0,s.jsx)(eP.Z,{placeholder:"Enter stream timeout"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(q=eh.litellm_params)||void 0===q?void 0:q.stream_timeout)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Model Access Groups"}),eN?(0,s.jsx)(N.Z.Item,{name:"model_access_group",className:"mb-0",children:(0,s.jsx)(k.default,{mode:"tags",showSearch:!0,placeholder:"Select existing groups or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],maxTagCount:"responsive",allowClear:!0,style:{width:"100%"},options:null==ec?void 0:ec.map(e=>({value:e,label:e}))})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(B=eh.model_info)||void 0===B?void 0:B.access_groups)?Array.isArray(eh.model_info.access_groups)?eh.model_info.access_groups.length>0?(0,s.jsx)("div",{className:"flex flex-wrap gap-1",children:eh.model_info.access_groups.map((e,l)=>(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-blue-100 text-blue-800",children:e},l))}):"No groups assigned":eh.model_info.access_groups:"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)(n.Z,{className:"font-medium",children:["Guardrails",(0,s.jsx)(A.Z,{title:"Apply safety guardrails to this model to filter content or enforce policies",children:(0,s.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/quick_start",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,s.jsx)(eu.Z,{style:{marginLeft:"4px"}})})})]}),eN?(0,s.jsx)(N.Z.Item,{name:"guardrails",className:"mb-0",children:(0,s.jsx)(k.default,{mode:"tags",showSearch:!0,placeholder:"Select existing guardrails or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],maxTagCount:"responsive",allowClear:!0,style:{width:"100%"},options:eF.map(e=>({value:e,label:e}))})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(U=eh.litellm_params)||void 0===U?void 0:U.guardrails)?Array.isArray(eh.litellm_params.guardrails)?eh.litellm_params.guardrails.length>0?(0,s.jsx)("div",{className:"flex flex-wrap gap-1",children:eh.litellm_params.guardrails.map((e,l)=>(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-green-100 text-green-800",children:e},l))}):"No guardrails assigned":eh.litellm_params.guardrails:"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Tags"}),eN?(0,s.jsx)(N.Z.Item,{name:"tags",className:"mb-0",children:(0,s.jsx)(k.default,{mode:"tags",showSearch:!0,placeholder:"Select existing tags or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],maxTagCount:"responsive",allowClear:!0,style:{width:"100%"},options:Object.values(eO).map(e=>({value:e.name,label:e.name,title:e.description||e.name}))})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(G=eh.litellm_params)||void 0===G?void 0:G.tags)?Array.isArray(eh.litellm_params.tags)?eh.litellm_params.tags.length>0?(0,s.jsx)("div",{className:"flex flex-wrap gap-1",children:eh.litellm_params.tags.map((e,l)=>(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-purple-100 text-purple-800",children:e},l))}):"No tags assigned":eh.litellm_params.tags:"Not Set"})]}),eN?(0,s.jsx)(eT,{form:em,showCacheControl:eS,onCacheControlChange:e=>ek(e)}):(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Cache Control"}),(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(H=eh.litellm_params)||void 0===H?void 0:H.cache_control_injection_points)?(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{children:"Enabled"}),(0,s.jsx)("div",{className:"mt-2",children:eh.litellm_params.cache_control_injection_points.map((e,l)=>(0,s.jsxs)("div",{className:"text-sm text-gray-600 mb-1",children:["Location: ",e.location,",",e.role&&(0,s.jsxs)("span",{children:[" Role: ",e.role]}),void 0!==e.index&&(0,s.jsxs)("span",{children:[" Index: ",e.index]})]},l))})]}):"Disabled"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Model Info"}),eN?(0,s.jsx)(N.Z.Item,{name:"model_info",className:"mb-0",children:(0,s.jsx)(O.default.TextArea,{rows:4,placeholder:'{"gpt-4": 100, "claude-v1": 200}',defaultValue:JSON.stringify($.model_info,null,2)})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(0,s.jsx)("pre",{className:"bg-gray-100 p-2 rounded text-xs overflow-auto mt-1",children:JSON.stringify(eh.model_info,null,2)})})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)(n.Z,{className:"font-medium",children:["LiteLLM Params",(0,s.jsx)(A.Z,{title:"Optional litellm params used for making a litellm.completion() call. Some params are automatically added by LiteLLM.",children:(0,s.jsx)("a",{href:"https://docs.litellm.ai/docs/completion/input",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,s.jsx)(eu.Z,{style:{marginLeft:"4px"}})})})]}),eN?(0,s.jsx)(N.Z.Item,{name:"litellm_extra_params",rules:[{validator:eR.Ac}],children:(0,s.jsx)(O.default.TextArea,{rows:4,placeholder:'{ "rpm": 100, "timeout": 0, "stream_timeout": 0 }'})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(0,s.jsx)("pre",{className:"bg-gray-100 p-2 rounded text-xs overflow-auto mt-1",children:JSON.stringify(eh.litellm_params,null,2)})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Team ID"}),(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:$.model_info.team_id||"Not Set"})]})]}),eN&&(0,s.jsxs)("div",{className:"mt-6 flex justify-end gap-2",children:[(0,s.jsx)(eY.Z,{variant:"secondary",onClick:()=>{em.resetFields(),e_(!1),eZ(!1)},disabled:ey,children:"Cancel"}),(0,s.jsx)(eY.Z,{variant:"primary",onClick:()=>em.submit(),loading:ey,children:"Save Changes"})]})]})}):(0,s.jsx)(n.Z,{children:"Loading..."})]})]}),(0,s.jsx)(el.Z,{children:(0,s.jsx)(e$.Z,{children:(0,s.jsx)("pre",{className:"bg-gray-100 p-4 rounded text-xs overflow-auto",children:JSON.stringify($,null,2)})})})]})]}),ep&&(0,s.jsx)("div",{className:"fixed z-10 inset-0 overflow-y-auto",children:(0,s.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,s.jsx)("div",{className:"fixed inset-0 transition-opacity","aria-hidden":"true",children:(0,s.jsx)("div",{className:"absolute inset-0 bg-gray-500 opacity-75"})}),(0,s.jsx)("span",{className:"hidden sm:inline-block sm:align-middle sm:h-screen","aria-hidden":"true",children:"​"}),(0,s.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,s.jsx)("div",{className:"bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4",children:(0,s.jsx)("div",{className:"sm:flex sm:items-start",children:(0,s.jsxs)("div",{className:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left",children:[(0,s.jsx)("h3",{className:"text-lg leading-6 font-medium text-gray-900",children:"Delete Model"}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)("p",{className:"text-sm text-gray-500",children:"Are you sure you want to delete this model?"})})]})})}),(0,s.jsxs)("div",{className:"bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse",children:[(0,s.jsx)(E.ZP,{onClick:eK,className:"ml-2",danger:!0,children:"Delete"}),(0,s.jsx)(E.ZP,{onClick:()=>eg(!1),children:"Cancel"})]})]})]})}),ef&&!eB?(0,s.jsx)(e3,{isVisible:ef,onCancel:()=>ej(!1),onAddCredential:eU,existingCredential:ew,setIsCredentialModalOpen:ej}):(0,s.jsx)(S.Z,{open:ef,onCancel:()=>ej(!1),title:"Using Existing Credential",children:(0,s.jsx)(n.Z,{children:$.litellm_params.litellm_credential_name})}),(0,s.jsx)(e4,{isVisible:eM,onCancel:()=>eI(!1),onSuccess:e=>{ex(e),ed&&ed(e)},modelData:eh||$,accessToken:es||"",userRole:er||""})]})}var e9=t(33293),e7=t(11318),le=t(8048),ll=t(41649);let lt=e=>{let{provider:l,className:t="w-4 h-4"}=e,[a,r]=(0,o.useState)(!1),{logo:i}=(0,m.dr)(l);return a||!i?(0,s.jsx)("div",{className:"".concat(t," rounded-full bg-gray-200 flex items-center justify-center text-xs"),children:(null==l?void 0:l.charAt(0))||"-"}):(0,s.jsx)("img",{src:i,alt:"".concat(l," logo"),className:t,onError:()=>r(!0)})},ls=(e,l,t,a,r,i,n,o,d,c,m)=>[{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Model ID"}),accessorKey:"model_info.id",cell:e=>{let{row:l}=e,t=l.original;return(0,s.jsx)(A.Z,{title:t.model_info.id,children:(0,s.jsx)("div",{className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[15ch]",onClick:()=>a(t.model_info.id),children:t.model_info.id})})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Model Information"}),accessorKey:"model_name",size:250,cell:e=>{let{row:l}=e,t=l.original,a=i(l.original)||"-",r=(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("strong",{children:"Provider:"})," ",t.provider||"-"]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("strong",{children:"Public Model Name:"})," ",a]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("strong",{children:"LiteLLM Model Name:"})," ",t.litellm_model_name||"-"]})]});return(0,s.jsx)(A.Z,{title:r,children:(0,s.jsxs)("div",{className:"flex items-start space-x-2 min-w-0 w-full max-w-[250px]",children:[(0,s.jsx)("div",{className:"flex-shrink-0 mt-0.5",children:t.provider?(0,s.jsx)(lt,{provider:t.provider}):(0,s.jsx)("div",{className:"w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",children:"-"})}),(0,s.jsxs)("div",{className:"flex flex-col min-w-0 flex-1",children:[(0,s.jsx)("div",{className:"text-xs font-medium text-gray-900 truncate max-w-[210px]",children:a}),(0,s.jsx)("div",{className:"text-xs text-gray-500 truncate mt-0.5 max-w-[210px]",children:t.litellm_model_name||"-"})]})]})})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Credentials"}),accessorKey:"litellm_credential_name",size:180,cell:e=>{var l;let{row:t}=e,a=null===(l=t.original.litellm_params)||void 0===l?void 0:l.litellm_credential_name;return a?(0,s.jsx)(A.Z,{title:"Credential: ".concat(a),children:(0,s.jsxs)("div",{className:"flex items-center space-x-2 max-w-[180px]",children:[(0,s.jsx)(eW.Z,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}),(0,s.jsx)("span",{className:"text-xs truncate",title:a,children:a})]})}):(0,s.jsxs)("div",{className:"flex items-center space-x-2 max-w-[180px]",children:[(0,s.jsx)(eW.Z,{className:"w-4 h-4 text-gray-300 flex-shrink-0"}),(0,s.jsx)("span",{className:"text-xs text-gray-400",children:"No credentials"})]})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Created By"}),accessorKey:"model_info.created_by",sortingFn:"datetime",size:160,cell:e=>{var l;let{row:t}=e,a=t.original,r=!(null===(l=a.model_info)||void 0===l?void 0:l.db_model),i=a.model_info.created_by,n=a.model_info.created_at?new Date(a.model_info.created_at).toLocaleDateString():null;return(0,s.jsxs)("div",{className:"flex flex-col min-w-0 max-w-[160px]",children:[(0,s.jsx)("div",{className:"text-xs font-medium text-gray-900 truncate",title:r?"Defined in config":i||"Unknown",children:r?"Defined in config":i||"Unknown"}),(0,s.jsx)("div",{className:"text-xs text-gray-500 truncate mt-0.5",title:r?"Config file":n||"Unknown date",children:r?"-":n||"Unknown date"})]})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Updated At"}),accessorKey:"model_info.updated_at",sortingFn:"datetime",cell:e=>{let{row:l}=e,t=l.original;return(0,s.jsx)("span",{className:"text-xs",children:t.model_info.updated_at?new Date(t.model_info.updated_at).toLocaleDateString():"-"})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Costs"}),accessorKey:"input_cost",size:120,cell:e=>{let{row:l}=e,t=l.original,a=t.input_cost,r=t.output_cost;return a||r?(0,s.jsx)(A.Z,{title:"Cost per 1M tokens",children:(0,s.jsxs)("div",{className:"flex flex-col min-w-0 max-w-[120px]",children:[a&&(0,s.jsxs)("div",{className:"text-xs font-medium text-gray-900 truncate",children:["In: $",a]}),r&&(0,s.jsxs)("div",{className:"text-xs text-gray-500 truncate mt-0.5",children:["Out: $",r]})]})}):(0,s.jsx)("div",{className:"max-w-[120px]",children:(0,s.jsx)("span",{className:"text-xs text-gray-400",children:"-"})})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Team ID"}),accessorKey:"model_info.team_id",cell:e=>{let{row:l}=e,t=l.original;return t.model_info.team_id?(0,s.jsx)("div",{className:"overflow-hidden",children:(0,s.jsx)(A.Z,{title:t.model_info.team_id,children:(0,s.jsxs)(eY.Z,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left overflow-hidden truncate max-w-[200px]",onClick:()=>r(t.model_info.team_id),children:[t.model_info.team_id.slice(0,7),"..."]})})}):"-"}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Model Access Group"}),accessorKey:"model_info.model_access_group",enableSorting:!1,cell:e=>{let{row:l}=e,t=l.original,a=t.model_info.access_groups;if(!a||0===a.length)return"-";let r=t.model_info.id,i=c.has(r),n=a.length>1,o=()=>{let e=new Set(c);i?e.delete(r):e.add(r),m(e)};return(0,s.jsxs)("div",{className:"flex items-center gap-1 overflow-hidden",children:[(0,s.jsx)(ll.Z,{size:"xs",color:"blue",className:"text-xs px-1.5 py-0.5 h-5 leading-tight flex-shrink-0",children:a[0]}),(i||!n&&2===a.length)&&a.slice(1).map((e,l)=>(0,s.jsx)(ll.Z,{size:"xs",color:"blue",className:"text-xs px-1.5 py-0.5 h-5 leading-tight flex-shrink-0",children:e},l+1)),n&&(0,s.jsx)("button",{onClick:e=>{e.stopPropagation(),o()},className:"text-xs text-blue-600 hover:text-blue-800 px-1 py-0.5 rounded hover:bg-blue-50 h-5 leading-tight flex-shrink-0 whitespace-nowrap",children:i?"−":"+".concat(a.length-1)})]})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Status"}),accessorKey:"model_info.db_model",cell:e=>{let{row:l}=e,t=l.original;return(0,s.jsx)("div",{className:"\n inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium\n ".concat(t.model_info.db_model?"bg-blue-50 text-blue-600":"bg-gray-100 text-gray-600","\n "),children:t.model_info.db_model?"DB Model":"Config Model"})}},{id:"actions",header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Actions"}),cell:t=>{var r,i;let{row:n}=t,o=n.original,c="Admin"===e||(null===(r=o.model_info)||void 0===r?void 0:r.created_by)===l,m=!(null===(i=o.model_info)||void 0===i?void 0:i.db_model);return(0,s.jsx)("div",{className:"flex items-center justify-end gap-2 pr-4",children:m?(0,s.jsx)(A.Z,{title:"Config model cannot be deleted on the dashboard. Please delete it from the config file.",children:(0,s.jsx)($.Z,{icon:y.Z,size:"sm",className:"opacity-50 cursor-not-allowed"})}):(0,s.jsx)(A.Z,{title:"Delete model",children:(0,s.jsx)($.Z,{icon:y.Z,size:"sm",onClick:()=>{c&&(a(o.model_info.id),d(!1))},className:c?"cursor-pointer hover:text-red-600":"opacity-50 cursor-not-allowed"})})})}}];var la=t(27281),lr=t(57365),li=e=>{let{selectedModelGroup:l,setSelectedModelGroup:t,availableModelGroups:a,availableModelAccessGroups:r,setSelectedModelId:d,setSelectedTeamId:c,setEditModel:m,modelData:u}=e,{userId:h,userRole:x,premiumUser:p}=(0,K.Z)(),{teams:g}=(0,e7.Z)(),[f,j]=(0,o.useState)(""),[v,_]=(0,o.useState)("current_team"),[y,b]=(0,o.useState)("personal"),[N,Z]=(0,o.useState)(!1),[w,C]=(0,o.useState)(null),[S,k]=(0,o.useState)(new Set),[A,E]=(0,o.useState)({pageIndex:0,pageSize:50}),M=(0,o.useRef)(null),I=(0,o.useMemo)(()=>u&&u.data&&0!==u.data.length?u.data.filter(e=>{var t,s,a,r,i,n;let o=""===f||e.model_name.toLowerCase().includes(f.toLowerCase()),d="all"===l||e.model_name===l||!l||"wildcard"===l&&(null===(t=e.model_name)||void 0===t?void 0:t.includes("*")),c="all"===w||(null===(s=e.model_info.access_groups)||void 0===s?void 0:s.includes(w))||!w,m=!0;if("current_team"===v){if("personal"===y)m=(null===(a=e.model_info)||void 0===a?void 0:a.direct_access)===!0;else{let l=(null===(i=e.model_info)||void 0===i?void 0:null===(r=i.access_via_team_ids)||void 0===r?void 0:r.includes(y.team_id))===!0,t=(null===(n=y.models)||void 0===n?void 0:n.some(l=>{var t,s;return null===(s=e.model_info)||void 0===s?void 0:null===(t=s.access_groups)||void 0===t?void 0:t.includes(l)}))===!0;m=l||t}}return o&&d&&c&&m}):[],[u,f,l,w,y,v]),F=(0,o.useMemo)(()=>{let e=A.pageIndex*A.pageSize,l=e+A.pageSize;return I.slice(e,l)},[I,A.pageIndex,A.pageSize]);return(0,o.useEffect)(()=>{E(e=>({...e,pageIndex:0}))},[f,l,w,y,v]),(0,s.jsx)(el.Z,{children:(0,s.jsx)(i.Z,{children:(0,s.jsx)("div",{className:"flex flex-col space-y-4",children:(0,s.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,s.jsxs)("div",{className:"border-b px-6 py-4 bg-gray-50",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsx)(n.Z,{className:"text-lg font-semibold text-gray-900",children:"Current Team:"}),(0,s.jsxs)(la.Z,{className:"w-80",defaultValue:"personal",value:"personal"===y?"personal":y.team_id,onValueChange:e=>{if("personal"===e)b("personal");else{let l=null==g?void 0:g.find(l=>l.team_id===e);l&&b(l)}},children:[(0,s.jsx)(lr.Z,{value:"personal",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,s.jsx)("span",{className:"font-medium",children:"Personal"})]})}),null==g?void 0:g.filter(e=>e.team_id).map(e=>(0,s.jsx)(lr.Z,{value:e.team_id,children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,s.jsx)("span",{className:"font-medium",children:e.team_alias?"".concat(e.team_alias.slice(0,30),"..."):"Team ".concat(e.team_id.slice(0,30),"...")})]})},e.team_id))]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsx)(n.Z,{className:"text-lg font-semibold text-gray-900",children:"View:"}),(0,s.jsxs)(la.Z,{className:"w-64",defaultValue:"current_team",value:v,onValueChange:e=>_(e),children:[(0,s.jsx)(lr.Z,{value:"current_team",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-purple-500 rounded-full"}),(0,s.jsx)("span",{className:"font-medium",children:"Current Team Models"})]})}),(0,s.jsx)(lr.Z,{value:"all",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-gray-500 rounded-full"}),(0,s.jsx)("span",{className:"font-medium",children:"All Available Models"})]})})]})]})]}),"current_team"===v&&(0,s.jsxs)("div",{className:"flex items-start gap-2 mt-3",children:[(0,s.jsx)(eu.Z,{className:"text-gray-400 mt-0.5 flex-shrink-0 text-xs"}),(0,s.jsx)("div",{className:"text-xs text-gray-500",children:"personal"===y?(0,s.jsxs)("span",{children:["To access these models: Create a Virtual Key without selecting a team on the"," ",(0,s.jsx)("a",{href:"/public?login=success&page=api-keys",className:"text-gray-600 hover:text-gray-800 underline",children:"Virtual Keys page"})]}):(0,s.jsxs)("span",{children:['To access these models: Create a Virtual Key and select Team as "',"string"!=typeof y?y.team_alias||y.team_id:"",'" on the'," ",(0,s.jsx)("a",{href:"/public?login=success&page=api-keys",className:"text-gray-600 hover:text-gray-800 underline",children:"Virtual Keys page"})]})})]})]}),(0,s.jsx)("div",{className:"border-b px-6 py-4",children:(0,s.jsxs)("div",{className:"flex flex-col space-y-4",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,s.jsxs)("div",{className:"relative w-64",children:[(0,s.jsx)("input",{type:"text",placeholder:"Search model names...",className:"w-full px-3 py-2 pl-8 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",value:f,onChange:e=>j(e.target.value)}),(0,s.jsx)("svg",{className:"absolute left-2.5 top-2.5 h-4 w-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})]}),(0,s.jsxs)("button",{className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2 ".concat(N?"bg-gray-100":""),onClick:()=>Z(!N),children:[(0,s.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z"})}),"Filters"]}),(0,s.jsxs)("button",{className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2",onClick:()=>{j(""),t("all"),C(null),b("personal"),_("current_team"),E({pageIndex:0,pageSize:50})},children:[(0,s.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Reset Filters"]})]}),N&&(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-3 mt-3",children:[(0,s.jsx)("div",{className:"w-64",children:(0,s.jsxs)(la.Z,{value:null!=l?l:"all",onValueChange:e=>t("all"===e?"all":e),placeholder:"Filter by Public Model Name",children:[(0,s.jsx)(lr.Z,{value:"all",children:"All Models"}),(0,s.jsx)(lr.Z,{value:"wildcard",children:"Wildcard Models (*)"}),a.map((e,l)=>(0,s.jsx)(lr.Z,{value:e,children:e},l))]})}),(0,s.jsx)("div",{className:"w-64",children:(0,s.jsxs)(la.Z,{value:null!=w?w:"all",onValueChange:e=>C("all"===e?null:e),placeholder:"Filter by Model Access Group",children:[(0,s.jsx)(lr.Z,{value:"all",children:"All Model Access Groups"}),r.map((e,l)=>(0,s.jsx)(lr.Z,{value:e,children:e},l))]})})]}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)("span",{className:"text-sm text-gray-700",children:I.length>0?"Showing ".concat(A.pageIndex*A.pageSize+1," - ").concat(Math.min((A.pageIndex+1)*A.pageSize,I.length)," of ").concat(I.length," results"):"Showing 0 results"}),I.length>A.pageSize&&(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("button",{onClick:()=>E(e=>({...e,pageIndex:e.pageIndex-1})),disabled:0===A.pageIndex,className:"px-3 py-1 text-sm border rounded-md ".concat(0===A.pageIndex?"bg-gray-100 text-gray-400 cursor-not-allowed":"hover:bg-gray-50"),children:"Previous"}),(0,s.jsx)("button",{onClick:()=>E(e=>({...e,pageIndex:e.pageIndex+1})),disabled:A.pageIndex>=Math.ceil(I.length/A.pageSize)-1,className:"px-3 py-1 text-sm border rounded-md ".concat(A.pageIndex>=Math.ceil(I.length/A.pageSize)-1?"bg-gray-100 text-gray-400 cursor-not-allowed":"hover:bg-gray-50"),children:"Next"})]})]})]})}),(0,s.jsx)(le.C,{columns:ls(x,h,p,d,c,W,()=>{},()=>{},m,S,k),data:F,isLoading:!1,table:M})]})})})})},ln=t(75105),lo=t(40278),ld=t(97765),lc=t(21626),lm=t(97214),lu=t(28241),lh=t(58834),lx=t(69552),lp=t(71876),lg=t(39789),lf=t(79326),lj=t(2356),lv=t(59664),l_=e=>{let{modelMetrics:l,modelMetricsCategories:t,customTooltip:a,premiumUser:r}=e;return(0,s.jsx)(lv.Z,{title:"Time to First token (s)",className:"h-72",data:l,index:"date",showLegend:!1,categories:t,colors:["indigo","rose"],connectNulls:!0,customTooltip:a})},ly=e=>{let{setSelectedAPIKey:l,keys:t,teams:a,setSelectedCustomer:r,allEndUsers:i}=e,{premiumUser:d}=(0,K.Z)(),[c,m]=(0,o.useState)(null);return(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"mb-1",children:"Select API Key Name"}),d?(0,s.jsxs)("div",{children:[(0,s.jsxs)(la.Z,{defaultValue:"all-keys",children:[(0,s.jsx)(lr.Z,{value:"all-keys",onClick:()=>{l(null)},children:"All Keys"},"all-keys"),null==t?void 0:t.map((e,t)=>e&&null!==e.key_alias&&e.key_alias.length>0?(0,s.jsx)(lr.Z,{value:String(t),onClick:()=>{l(e)},children:e.key_alias},t):null)]}),(0,s.jsx)(n.Z,{className:"mt-1",children:"Select Customer Name"}),(0,s.jsxs)(la.Z,{defaultValue:"all-customers",children:[(0,s.jsx)(lr.Z,{value:"all-customers",onClick:()=>{r(null)},children:"All Customers"},"all-customers"),null==i?void 0:i.map((e,l)=>(0,s.jsx)(lr.Z,{value:e,onClick:()=>{r(e)},children:e},l))]}),(0,s.jsx)(n.Z,{className:"mt-1",children:"Select Team"}),(0,s.jsxs)(la.Z,{className:"w-64 relative z-50",defaultValue:"all",value:null!=c?c:"all",onValueChange:e=>m("all"===e?null:e),children:[(0,s.jsx)(lr.Z,{value:"all",children:"All Teams"}),null==a?void 0:a.filter(e=>e.team_id).map(e=>(0,s.jsx)(lr.Z,{value:e.team_id,children:e.team_alias?"".concat(e.team_alias," (").concat(e.team_id.slice(0,8),"...)"):"Team ".concat(e.team_id.slice(0,8),"...")},e.team_id))]})]}):(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"mt-1",children:"Select Team"}),(0,s.jsxs)(la.Z,{className:"w-64 relative z-50",defaultValue:"all",value:null!=c?c:"all",onValueChange:e=>m("all"===e?null:e),children:[(0,s.jsx)(lr.Z,{value:"all",children:"All Teams"}),null==a?void 0:a.filter(e=>e.team_id).map(e=>(0,s.jsx)(lr.Z,{value:e.team_id,children:e.team_alias?"".concat(e.team_alias," (").concat(e.team_id.slice(0,8),"...)"):"Team ".concat(e.team_id.slice(0,8),"...")},e.team_id))]})]})]})},lb=e=>{let{dateValue:l,setDateValue:t,selectedModelGroup:a,availableModelGroups:d,setShowAdvancedFilters:m,modelMetrics:u,modelMetricsCategories:h,streamingModelMetrics:x,streamingModelMetricsCategories:p,customTooltip:g,slowResponsesData:f,modelExceptions:j,globalExceptionData:v,allExceptions:_,globalExceptionPerDeployment:y,setSelectedAPIKey:b,keys:N,setSelectedCustomer:Z,teams:w,allEndUsers:C,selectedAPIKey:S,selectedCustomer:k,selectedTeam:A,setSelectedModelGroup:E,setModelMetrics:M,setModelMetricsCategories:I,setStreamingModelMetrics:F,setStreamingModelMetricsCategories:P,setSlowResponsesData:L,setModelExceptions:T,setAllExceptions:R,setGlobalExceptionData:O,setGlobalExceptionPerDeployment:V}=e,{accessToken:D,userId:z,userRole:q,premiumUser:B}=(0,K.Z)();(0,o.useEffect)(()=>{U(a,l.from,l.to)},[S,k,A]);let U=async(e,l,t)=>{if(console.log("Updating model metrics for group:",e),!D||!z||!q||!l||!t)return;console.log("inside updateModelMetrics - startTime:",l,"endTime:",t),E(e);let s=null==S?void 0:S.token;void 0===s&&(s=null);let a=k;void 0===a&&(a=null);try{let r=await (0,c.modelMetricsCall)(D,z,q,e,l.toISOString(),t.toISOString(),s,a);console.log("Model metrics response:",r),M(r.data),I(r.all_api_bases);let i=await (0,c.streamingModelMetricsCall)(D,e,l.toISOString(),t.toISOString());F(i.data),P(i.all_api_bases);let n=await (0,c.modelExceptionsCall)(D,z,q,e,l.toISOString(),t.toISOString(),s,a);console.log("Model exceptions response:",n),T(n.data),R(n.exception_types);let o=await (0,c.modelMetricsSlowResponsesCall)(D,z,q,e,l.toISOString(),t.toISOString(),s,a);if(console.log("slowResponses:",o),L(o),e){let s=await (0,c.adminGlobalActivityExceptions)(D,null==l?void 0:l.toISOString().split("T")[0],null==t?void 0:t.toISOString().split("T")[0],e);O(s);let a=await (0,c.adminGlobalActivityExceptionsPerDeployment)(D,null==l?void 0:l.toISOString().split("T")[0],null==t?void 0:t.toISOString().split("T")[0],e);V(a)}}catch(e){console.error("Failed to fetch model metrics",e)}};return(0,s.jsxs)(el.Z,{children:[(0,s.jsx)("div",{className:"mb-4 rounded-md border border-red-500 bg-red-50 p-4",children:(0,s.jsx)(n.Z,{className:"font-semibold text-red-700",children:"This page is deprecated and will be removed in the future. Some functionality may not work as expected."})}),(0,s.jsxs)(i.Z,{numItems:4,className:"mt-2 mb-2",children:[(0,s.jsx)(r.Z,{children:(0,s.jsx)(lg.Z,{value:l,className:"mr-2",onValueChange:e=>{t(e),U(a,e.from,e.to)}})}),(0,s.jsxs)(r.Z,{className:"ml-2",children:[(0,s.jsx)(n.Z,{children:"Select Model Group"}),(0,s.jsx)(la.Z,{defaultValue:a||d[0],value:a||d[0],children:d.map((e,t)=>(0,s.jsx)(lr.Z,{value:e,onClick:()=>U(e,l.from,l.to),children:e},t))})]}),(0,s.jsx)(r.Z,{children:(0,s.jsx)(lf.Z,{trigger:"click",content:(0,s.jsx)(ly,{allEndUsers:C,keys:N,setSelectedAPIKey:b,setSelectedCustomer:Z,teams:w}),overlayStyle:{width:"20vw"},children:(0,s.jsx)(eY.Z,{icon:lj.Z,size:"md",variant:"secondary",className:"mt-4 ml-2",style:{border:"none"},onClick:()=>m(!0)})})})]}),(0,s.jsxs)(i.Z,{numItems:2,children:[(0,s.jsx)(r.Z,{children:(0,s.jsx)(e$.Z,{className:"mr-2 max-h-[400px] min-h-[400px]",children:(0,s.jsxs)(X.Z,{children:[(0,s.jsxs)(ee.Z,{variant:"line",defaultValue:"1",children:[(0,s.jsx)(Q.Z,{value:"1",children:"Avg. Latency per Token"}),(0,s.jsx)(Q.Z,{value:"2",children:"Time to first token"})]}),(0,s.jsxs)(et.Z,{children:[(0,s.jsxs)(el.Z,{children:[(0,s.jsx)("p",{className:"text-gray-500 italic",children:" (seconds/token)"}),(0,s.jsx)(n.Z,{className:"text-gray-500 italic mt-1 mb-1",children:"average Latency for successfull requests divided by the total tokens"}),u&&h&&(0,s.jsx)(ln.Z,{title:"Model Latency",className:"h-72",data:u,showLegend:!1,index:"date",categories:h,connectNulls:!0,customTooltip:g})]}),(0,s.jsx)(el.Z,{children:(0,s.jsx)(l_,{modelMetrics:x,modelMetricsCategories:p,customTooltip:g,premiumUser:B})})]})]})})}),(0,s.jsx)(r.Z,{children:(0,s.jsx)(e$.Z,{className:"ml-2 max-h-[400px] min-h-[400px] overflow-y-auto",children:(0,s.jsxs)(lc.Z,{children:[(0,s.jsx)(lh.Z,{children:(0,s.jsxs)(lp.Z,{children:[(0,s.jsx)(lx.Z,{children:"Deployment"}),(0,s.jsx)(lx.Z,{children:"Success Responses"}),(0,s.jsxs)(lx.Z,{children:["Slow Responses ",(0,s.jsx)("p",{children:"Success Responses taking 600+s"})]})]})}),(0,s.jsx)(lm.Z,{children:f.map((e,l)=>(0,s.jsxs)(lp.Z,{children:[(0,s.jsx)(lu.Z,{children:e.api_base}),(0,s.jsx)(lu.Z,{children:e.total_count}),(0,s.jsx)(lu.Z,{children:e.slow_count})]},l))})]})})})]}),(0,s.jsx)(i.Z,{numItems:1,className:"gap-2 w-full mt-2",children:(0,s.jsxs)(e$.Z,{children:[(0,s.jsxs)(eX.Z,{children:["All Exceptions for ",a]}),(0,s.jsx)(lo.Z,{className:"h-60",data:j,index:"model",categories:_,stack:!0,yAxisWidth:30})]})}),(0,s.jsxs)(i.Z,{numItems:1,className:"gap-2 w-full mt-2",children:[(0,s.jsxs)(e$.Z,{children:[(0,s.jsxs)(eX.Z,{children:["All Up Rate Limit Errors (429) for ",a]}),(0,s.jsxs)(i.Z,{numItems:1,children:[(0,s.jsxs)(r.Z,{children:[(0,s.jsxs)(ld.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Num Rate Limit Errors ",v.sum_num_rate_limit_exceptions]}),(0,s.jsx)(lo.Z,{className:"h-40",data:v.daily_data,index:"date",colors:["rose"],categories:["num_rate_limit_exceptions"],onValueChange:e=>console.log(e)})]}),(0,s.jsx)(r.Z,{})]})]}),B?(0,s.jsx)(s.Fragment,{children:y.map((e,l)=>(0,s.jsxs)(e$.Z,{children:[(0,s.jsx)(eX.Z,{children:e.api_base?e.api_base:"Unknown API Base"}),(0,s.jsx)(i.Z,{numItems:1,children:(0,s.jsxs)(r.Z,{children:[(0,s.jsxs)(ld.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Num Rate Limit Errors (429) ",e.sum_num_rate_limit_exceptions]}),(0,s.jsx)(lo.Z,{className:"h-40",data:e.daily_data,index:"date",colors:["rose"],categories:["num_rate_limit_exceptions"],onValueChange:e=>console.log(e)})]})})]},l))}):(0,s.jsx)(s.Fragment,{children:y&&y.length>0&&y.slice(0,1).map((e,l)=>(0,s.jsxs)(e$.Z,{children:[(0,s.jsx)(eX.Z,{children:"✨ Rate Limit Errors by Deployment"}),(0,s.jsx)("p",{className:"mb-2 text-gray-500 italic text-[12px]",children:"Upgrade to see exceptions for all deployments"}),(0,s.jsx)(eY.Z,{variant:"primary",className:"mb-2",children:(0,s.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"Get Free Trial"})}),(0,s.jsxs)(e$.Z,{children:[(0,s.jsx)(eX.Z,{children:e.api_base}),(0,s.jsx)(i.Z,{numItems:1,children:(0,s.jsxs)(r.Z,{children:[(0,s.jsxs)(ld.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Num Rate Limit Errors ",e.sum_num_rate_limit_exceptions]}),(0,s.jsx)(lo.Z,{className:"h-40",data:e.daily_data,index:"date",colors:["rose"],categories:["num_rate_limit_exceptions"],onValueChange:e=>console.log(e)})]})})]})]},l))})]})]})};let lN={"BadRequestError (400)":"BadRequestErrorRetries","AuthenticationError (401)":"AuthenticationErrorRetries","TimeoutError (408)":"TimeoutErrorRetries","RateLimitError (429)":"RateLimitErrorRetries","ContentPolicyViolationError (400)":"ContentPolicyViolationErrorRetries","InternalServerError (500)":"InternalServerErrorRetries"};var lZ=e=>{let{selectedModelGroup:l,setSelectedModelGroup:t,availableModelGroups:a,globalRetryPolicy:r,setGlobalRetryPolicy:i,defaultRetry:o,modelGroupRetryPolicy:d,setModelGroupRetryPolicy:c,handleSaveRetrySettings:m}=e;return(0,s.jsxs)(el.Z,{children:[(0,s.jsx)("div",{className:"flex items-center gap-4 mb-6",children:(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)(n.Z,{children:"Retry Policy Scope:"}),(0,s.jsxs)(la.Z,{className:"ml-2 w-48",defaultValue:"global",value:"global"===l?"global":l||a[0],onValueChange:e=>t(e),children:[(0,s.jsx)(lr.Z,{value:"global",children:"Global Default"}),a.map((e,l)=>(0,s.jsx)(lr.Z,{value:e,onClick:()=>t(e),children:e},l))]})]})}),"global"===l?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(eX.Z,{children:"Global Retry Policy"}),(0,s.jsx)(n.Z,{className:"mb-6",children:"Default retry settings applied to all model groups unless overridden"})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(eX.Z,{children:["Retry Policy for ",l]}),(0,s.jsx)(n.Z,{className:"mb-6",children:"Model-specific retry settings. Falls back to global defaults if not set."})]}),lN&&(0,s.jsx)("table",{children:(0,s.jsx)("tbody",{children:Object.entries(lN).map((e,t)=>{var a,m,u,h;let x,[p,g]=e;if("global"===l)x=null!==(a=null==r?void 0:r[g])&&void 0!==a?a:o;else{let e=null==d?void 0:null===(m=d[l])||void 0===m?void 0:m[g];x=null!=e?e:null!==(u=null==r?void 0:r[g])&&void 0!==u?u:o}return(0,s.jsxs)("tr",{className:"flex justify-between items-center mt-2",children:[(0,s.jsxs)("td",{children:[(0,s.jsx)(n.Z,{children:p}),"global"!==l&&(0,s.jsxs)(n.Z,{className:"text-xs text-gray-500 ml-2",children:["(Global: ",null!==(h=null==r?void 0:r[g])&&void 0!==h?h:o,")"]})]}),(0,s.jsx)("td",{children:(0,s.jsx)(ej.Z,{className:"ml-5",value:x,min:0,step:1,onChange:e=>{"global"===l?i(l=>null==e?l:{...null!=l?l:{},[g]:e}):c(t=>{var s;let a=null!==(s=null==t?void 0:t[l])&&void 0!==s?s:{};return{...null!=t?t:{},[l]:{...a,[g]:e}}})}})})]},t)})})}),(0,s.jsx)(eY.Z,{className:"mt-6 mr-8",onClick:m,children:"Save"})]})},lw=t(58760),lC=t(867),lS=t(3810),lk=t(89245),lA=t(5540),lE=t(8881);let{Text:lM}=C.default;var lI=e=>{let{accessToken:l,onReloadSuccess:t,buttonText:a="Reload Price Data",showIcon:r=!0,size:i="middle",type:n="primary",className:m=""}=e,[u,h]=(0,o.useState)(!1),[x,p]=(0,o.useState)(!1),[g,f]=(0,o.useState)(!1),[j,v]=(0,o.useState)(!1),[_,y]=(0,o.useState)(6),[b,N]=(0,o.useState)(null),[Z,w]=(0,o.useState)(!1);(0,o.useEffect)(()=>{C();let e=setInterval(()=>{C()},3e4);return()=>clearInterval(e)},[l]);let C=async()=>{if(l){w(!0);try{console.log("Fetching reload status...");let e=await (0,c.getModelCostMapReloadStatus)(l);console.log("Received status:",e),N(e)}catch(e){console.error("Failed to fetch reload status:",e),N({scheduled:!1,interval_hours:null,last_run:null,next_run:null})}finally{w(!1)}}},k=async()=>{if(!l){d.Z.fromBackend("No access token available");return}h(!0);try{let e=await (0,c.reloadModelCostMap)(l);"success"===e.status?(d.Z.success("Price data reloaded successfully! ".concat(e.models_count||0," models updated.")),null==t||t(),await C()):d.Z.fromBackend("Failed to reload price data")}catch(e){console.error("Error reloading price data:",e),d.Z.fromBackend("Failed to reload price data. Please try again.")}finally{h(!1)}},A=async()=>{if(!l){d.Z.fromBackend("No access token available");return}if(_<=0){d.Z.fromBackend("Hours must be greater than 0");return}p(!0);try{let e=await (0,c.scheduleModelCostMapReload)(l,_);"success"===e.status?(d.Z.success("Periodic reload scheduled for every ".concat(_," hours")),v(!1),await C()):d.Z.fromBackend("Failed to schedule periodic reload")}catch(e){console.error("Error scheduling reload:",e),d.Z.fromBackend("Failed to schedule periodic reload. Please try again.")}finally{p(!1)}},M=async()=>{if(!l){d.Z.fromBackend("No access token available");return}f(!0);try{let e=await (0,c.cancelModelCostMapReload)(l);"success"===e.status?(d.Z.success("Periodic reload cancelled successfully"),await C()):d.Z.fromBackend("Failed to cancel periodic reload")}catch(e){console.error("Error cancelling reload:",e),d.Z.fromBackend("Failed to cancel periodic reload. Please try again.")}finally{f(!1)}},I=e=>{if(!e)return"Never";try{return new Date(e).toLocaleString()}catch(l){return e}};return(0,s.jsxs)("div",{className:m,children:[(0,s.jsxs)(lw.Z,{direction:"horizontal",size:"middle",style:{marginBottom:16},children:[(0,s.jsx)(lC.Z,{title:"Hard Refresh Price Data",description:"This will immediately fetch the latest pricing information from the remote source. Continue?",onConfirm:k,okText:"Yes",cancelText:"No",okButtonProps:{style:{backgroundColor:"#6366f1",borderColor:"#6366f1",color:"white",fontWeight:"500",borderRadius:"0.375rem",padding:"0.375rem 0.75rem",height:"auto",fontSize:"0.875rem",lineHeight:"1.25rem",transition:"all 0.2s ease-in-out"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#4f46e5"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#6366f1"}},children:(0,s.jsx)(E.ZP,{type:n,size:i,loading:u,icon:r?(0,s.jsx)(lk.Z,{}):void 0,style:{backgroundColor:"#6366f1",borderColor:"#6366f1",color:"white",fontWeight:"500",borderRadius:"0.375rem",padding:"0.375rem 0.75rem",height:"auto",fontSize:"0.875rem",lineHeight:"1.25rem",transition:"all 0.2s ease-in-out"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#4f46e5"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#6366f1"},children:a})}),(null==b?void 0:b.scheduled)?(0,s.jsx)(E.ZP,{type:"default",size:i,danger:!0,icon:(0,s.jsx)(lE.Z,{}),loading:g,onClick:M,style:{borderColor:"#ff4d4f",color:"#ff4d4f",fontWeight:"500",borderRadius:"0.375rem",padding:"0.375rem 0.75rem",height:"auto",fontSize:"0.875rem",lineHeight:"1.25rem"},children:"Cancel Periodic Reload"}):(0,s.jsx)(E.ZP,{type:"default",size:i,icon:(0,s.jsx)(lA.Z,{}),onClick:()=>v(!0),style:{borderColor:"#d9d9d9",color:"#6366f1",fontWeight:"500",borderRadius:"0.375rem",padding:"0.375rem 0.75rem",height:"auto",fontSize:"0.875rem",lineHeight:"1.25rem"},children:"Set Up Periodic Reload"})]}),b&&(0,s.jsx)(er.Z,{size:"small",style:{backgroundColor:"#f8f9fa",border:"1px solid #e9ecef",borderRadius:8},children:(0,s.jsxs)(lw.Z,{direction:"vertical",size:"small",style:{width:"100%"},children:[b.scheduled?(0,s.jsx)("div",{children:(0,s.jsxs)(lS.Z,{color:"green",icon:(0,s.jsx)(lA.Z,{}),children:["Scheduled every ",b.interval_hours," hours"]})}):(0,s.jsx)(lM,{type:"secondary",children:"No periodic reload scheduled"}),(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,s.jsx)(lM,{type:"secondary",style:{fontSize:"12px"},children:"Last run:"}),(0,s.jsx)(lM,{style:{fontSize:"12px"},children:I(b.last_run)})]}),b.scheduled&&(0,s.jsxs)(s.Fragment,{children:[b.next_run&&(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,s.jsx)(lM,{type:"secondary",style:{fontSize:"12px"},children:"Next run:"}),(0,s.jsx)(lM,{style:{fontSize:"12px"},children:I(b.next_run)})]}),(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,s.jsx)(lM,{type:"secondary",style:{fontSize:"12px"},children:"Status:"}),(0,s.jsx)(lS.Z,{color:(null==b?void 0:b.scheduled)?b.last_run?"success":"processing":"default",children:(null==b?void 0:b.scheduled)?b.last_run?"Active":"Ready":"Not scheduled"})]})]})]})}),(0,s.jsxs)(S.Z,{title:"Set Up Periodic Reload",open:j,onOk:A,onCancel:()=>v(!1),confirmLoading:x,okText:"Schedule",cancelText:"Cancel",okButtonProps:{style:{backgroundColor:"#6366f1",borderColor:"#6366f1",color:"white"}},children:[(0,s.jsx)("div",{style:{marginBottom:16},children:(0,s.jsx)(lM,{children:"Set up automatic reload of price data every:"})}),(0,s.jsx)("div",{style:{marginBottom:16},children:(0,s.jsx)(ej.Z,{min:1,max:168,value:_,onChange:e=>y(e||6),addonAfter:"hours",style:{width:"100%"}})}),(0,s.jsx)("div",{children:(0,s.jsxs)(lM,{type:"secondary",children:["This will automatically fetch the latest pricing data from the remote source every ",_," hours."]})})]})]})},lF=e=>{let{setModelMap:l}=e,{accessToken:t}=(0,K.Z)();return(0,s.jsx)(el.Z,{children:(0,s.jsxs)("div",{className:"p-6",children:[(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsx)(eX.Z,{children:"Price Data Management"}),(0,s.jsx)(n.Z,{className:"text-tremor-content",children:"Manage model pricing data and configure automatic reload schedules"})]}),(0,s.jsx)(lI,{accessToken:t,onReloadSuccess:()=>{(async()=>{l(await (0,c.modelCostMap)(t))})()},buttonText:"Reload Price Data",size:"middle",type:"primary",className:"w-full"})]})})},lP=t(61994),lL=t(15731),lT=t(91126);let lR=(e,l,t,a,r,i,n,o,d,c,m)=>[{header:()=>(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(lP.Z,{checked:t,indeterminate:l.length>0&&!t,onChange:e=>r(e.target.checked),onClick:e=>e.stopPropagation()}),(0,s.jsx)("span",{children:"Model ID"})]}),accessorKey:"model_info.id",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:t}=e,r=t.original,i=r.model_name,n=l.includes(i);return(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(lP.Z,{checked:n,onChange:e=>a(i,e.target.checked),onClick:e=>e.stopPropagation()}),(0,s.jsx)(A.Z,{title:r.model_info.id,children:(0,s.jsx)("div",{className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[15ch]",onClick:()=>m&&m(r.model_info.id),children:r.model_info.id})})]})}},{header:"Model Name",accessorKey:"model_name",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:l}=e,t=l.original,a=o(t)||t.model_name;return(0,s.jsx)("div",{className:"font-medium text-sm",children:(0,s.jsx)(A.Z,{title:a,children:(0,s.jsx)("div",{className:"truncate max-w-[200px]",children:a})})})}},{header:"Health Status",accessorKey:"health_status",enableSorting:!0,sortingFn:(e,l,t)=>{var s,a;let r=e.getValue("health_status")||"unknown",i=l.getValue("health_status")||"unknown",n={healthy:0,checking:1,unknown:2,unhealthy:3};return(null!==(s=n[r])&&void 0!==s?s:4)-(null!==(a=n[i])&&void 0!==a?a:4)},cell:l=>{var t;let{row:a}=l,r=a.original,i={status:r.health_status,loading:r.health_loading,error:r.health_error};if(i.loading)return(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsxs)("div",{className:"flex space-x-1",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-indigo-500 rounded-full animate-pulse"}),(0,s.jsx)("div",{className:"w-2 h-2 bg-indigo-500 rounded-full animate-pulse",style:{animationDelay:"0.2s"}}),(0,s.jsx)("div",{className:"w-2 h-2 bg-indigo-500 rounded-full animate-pulse",style:{animationDelay:"0.4s"}})]}),(0,s.jsx)(eb.x,{className:"text-gray-600 text-sm",children:"Checking..."})]});let o=r.model_name,d="healthy"===i.status&&(null===(t=e[o])||void 0===t?void 0:t.successResponse);return(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[n(i.status),d&&c&&(0,s.jsx)(A.Z,{title:"View response details",placement:"top",children:(0,s.jsx)("button",{onClick:()=>{var l;return c(o,null===(l=e[o])||void 0===l?void 0:l.successResponse)},className:"p-1 text-green-600 hover:text-green-800 hover:bg-green-50 rounded cursor-pointer transition-colors",children:(0,s.jsx)(lL.Z,{className:"h-4 w-4"})})})]})}},{header:"Error Details",accessorKey:"health_error",enableSorting:!1,cell:l=>{let{row:t}=l,a=t.original.model_name,r=e[a];if(!(null==r?void 0:r.error))return(0,s.jsx)(eb.x,{className:"text-gray-400 text-sm",children:"No errors"});let i=r.error,n=r.fullError||r.error;return(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"max-w-[200px]",children:(0,s.jsx)(A.Z,{title:i,placement:"top",children:(0,s.jsx)(eb.x,{className:"text-red-600 text-sm truncate",children:i})})}),d&&n!==i&&(0,s.jsx)(A.Z,{title:"View full error details",placement:"top",children:(0,s.jsx)("button",{onClick:()=>d(a,i,n),className:"p-1 text-red-600 hover:text-red-800 hover:bg-red-50 rounded cursor-pointer transition-colors",children:(0,s.jsx)(lL.Z,{className:"h-4 w-4"})})})]})}},{header:"Last Check",accessorKey:"last_check",enableSorting:!0,sortingFn:(e,l,t)=>{let s=e.getValue("last_check")||"Never checked",a=l.getValue("last_check")||"Never checked";if("Never checked"===s&&"Never checked"===a)return 0;if("Never checked"===s)return 1;if("Never checked"===a)return -1;if("Check in progress..."===s&&"Check in progress..."===a)return 0;if("Check in progress..."===s)return -1;if("Check in progress..."===a)return 1;let r=new Date(s),i=new Date(a);return isNaN(r.getTime())&&isNaN(i.getTime())?0:isNaN(r.getTime())?1:isNaN(i.getTime())?-1:i.getTime()-r.getTime()},cell:e=>{let{row:l}=e,t=l.original;return(0,s.jsx)(eb.x,{className:"text-gray-600 text-sm",children:t.health_loading?"Check in progress...":t.last_check})}},{header:"Last Success",accessorKey:"last_success",enableSorting:!0,sortingFn:(e,l,t)=>{let s=e.getValue("last_success")||"Never succeeded",a=l.getValue("last_success")||"Never succeeded";if("Never succeeded"===s&&"Never succeeded"===a)return 0;if("Never succeeded"===s)return 1;if("Never succeeded"===a)return -1;if("None"===s&&"None"===a)return 0;if("None"===s)return 1;if("None"===a)return -1;let r=new Date(s),i=new Date(a);return isNaN(r.getTime())&&isNaN(i.getTime())?0:isNaN(r.getTime())?1:isNaN(i.getTime())?-1:i.getTime()-r.getTime()},cell:l=>{let{row:t}=l,a=e[t.original.model_name],r=(null==a?void 0:a.lastSuccess)||"None";return(0,s.jsx)(eb.x,{className:"text-gray-600 text-sm",children:r})}},{header:"Actions",id:"actions",cell:e=>{let{row:l}=e,t=l.original,a=t.model_name,r=t.health_status&&"none"!==t.health_status,n=t.health_loading?"Checking...":r?"Re-run Health Check":"Run Health Check";return(0,s.jsx)(A.Z,{title:n,placement:"top",children:(0,s.jsx)("button",{className:"p-2 rounded-md transition-colors ".concat(t.health_loading?"text-gray-400 cursor-not-allowed bg-gray-100":"text-indigo-600 hover:text-indigo-700 hover:bg-indigo-50"),onClick:()=>{t.health_loading||i(a)},disabled:t.health_loading,children:t.health_loading?(0,s.jsxs)("div",{className:"flex space-x-1",children:[(0,s.jsx)("div",{className:"w-1 h-1 bg-gray-400 rounded-full animate-pulse"}),(0,s.jsx)("div",{className:"w-1 h-1 bg-gray-400 rounded-full animate-pulse",style:{animationDelay:"0.2s"}}),(0,s.jsx)("div",{className:"w-1 h-1 bg-gray-400 rounded-full animate-pulse",style:{animationDelay:"0.4s"}})]}):r?(0,s.jsx)(Y.Z,{className:"h-4 w-4"}):(0,s.jsx)(lT.Z,{className:"h-4 w-4"})})})},enableSorting:!1}],lO=[{pattern:/Missing .* API Key/i,replacement:"Missing API Key"},{pattern:/Connection timeout/i,replacement:"Connection timeout"},{pattern:/Network.*not.*ok/i,replacement:"Network connection failed"},{pattern:/403.*Forbidden/i,replacement:"Access forbidden - check API key permissions"},{pattern:/401.*Unauthorized/i,replacement:"Unauthorized - invalid API key"},{pattern:/429.*rate limit/i,replacement:"Rate limit exceeded"},{pattern:/500.*Internal Server Error/i,replacement:"Provider internal server error"},{pattern:/litellm\.AuthenticationError/i,replacement:"Authentication failed"},{pattern:/litellm\.RateLimitError/i,replacement:"Rate limit exceeded"},{pattern:/litellm\.APIError/i,replacement:"API error"}];var lV=e=>{let{accessToken:l,modelData:t,all_models_on_proxy:a,getDisplayModelName:r,setSelectedModelId:i}=e,[d,m]=(0,o.useState)({}),[u,h]=(0,o.useState)([]),[x,p]=(0,o.useState)(!1),[g,f]=(0,o.useState)(!1),[j,v]=(0,o.useState)(null),[_,y]=(0,o.useState)(!1),[b,N]=(0,o.useState)(null),Z=(0,o.useRef)(null);(0,o.useEffect)(()=>{l&&(null==t?void 0:t.data)&&(async()=>{let e={};t.data.forEach(l=>{e[l.model_name]={status:"none",lastCheck:"None",lastSuccess:"None",loading:!1,error:void 0,fullError:void 0,successResponse:void 0}});try{let s=await (0,c.latestHealthChecksCall)(l);s&&s.latest_health_checks&&"object"==typeof s.latest_health_checks&&Object.entries(s.latest_health_checks).forEach(l=>{let[s,a]=l;if(!a)return;let r=null,i=t.data.find(e=>e.model_name===s);if(i)r=i.model_name;else{let e=t.data.find(e=>e.model_info&&e.model_info.id===s);if(e)r=e.model_name;else if(a.model_name){let e=t.data.find(e=>e.model_name===a.model_name);e&&(r=e.model_name)}}if(r){let l=a.error_message||void 0;e[r]={status:a.status||"unknown",lastCheck:a.checked_at?new Date(a.checked_at).toLocaleString():"None",lastSuccess:"healthy"===a.status&&a.checked_at?new Date(a.checked_at).toLocaleString():"None",loading:!1,error:l?w(l):void 0,fullError:l,successResponse:"healthy"===a.status?a:void 0}}})}catch(e){console.warn("Failed to load health check history (using default states):",e)}m(e)})()},[l,t]);let w=e=>{var l;if(!e)return"Health check failed";let t="string"==typeof e?e:JSON.stringify(e),s=t.match(/(\w+Error):\s*(\d{3})/i);if(s)return"".concat(s[1],": ").concat(s[2]);let a=t.match(/(AuthenticationError|RateLimitError|BadRequestError|InternalServerError|TimeoutError|NotFoundError|ForbiddenError|ServiceUnavailableError|BadGatewayError|ContentPolicyViolationError|\w+Error)/i),r=t.match(/\b(400|401|403|404|408|429|500|502|503|504)\b/);if(a&&r)return"".concat(a[1],": ").concat(r[1]);if(r){let e=r[1];return"".concat({400:"BadRequestError",401:"AuthenticationError",403:"ForbiddenError",404:"NotFoundError",408:"TimeoutError",429:"RateLimitError",500:"InternalServerError",502:"BadGatewayError",503:"ServiceUnavailableError",504:"GatewayTimeoutError"}[e],": ").concat(e)}if(a){let e=a[1],l={AuthenticationError:"401",RateLimitError:"429",BadRequestError:"400",InternalServerError:"500",TimeoutError:"408",NotFoundError:"404",ForbiddenError:"403",ServiceUnavailableError:"503",BadGatewayError:"502",GatewayTimeoutError:"504",ContentPolicyViolationError:"400"}[e];return l?"".concat(e,": ").concat(l):e}for(let{pattern:e,replacement:l}of lO)if(e.test(t))return l;if(/missing.*api.*key|invalid.*key|unauthorized/i.test(t))return"AuthenticationError: 401";if(/rate.*limit|too.*many.*requests/i.test(t))return"RateLimitError: 429";if(/timeout|timed.*out/i.test(t))return"TimeoutError: 408";if(/not.*found/i.test(t))return"NotFoundError: 404";if(/forbidden|access.*denied/i.test(t))return"ForbiddenError: 403";if(/internal.*server.*error/i.test(t))return"InternalServerError: 500";let i=t.replace(/[\n\r]+/g," ").replace(/\s+/g," ").trim(),n=null===(l=i.split(/[.!?]/)[0])||void 0===l?void 0:l.trim();return n&&n.length>0?n.length>100?n.substring(0,97)+"...":n:i.length>100?i.substring(0,97)+"...":i},C=async e=>{if(l){m(l=>({...l,[e]:{...l[e],loading:!0,status:"checking"}}));try{var s,a;let r=await (0,c.individualModelHealthCheckCall)(l,e),i=new Date().toLocaleString();if(r.unhealthy_count>0&&r.unhealthy_endpoints&&r.unhealthy_endpoints.length>0){let l=(null===(s=r.unhealthy_endpoints[0])||void 0===s?void 0:s.error)||"Health check failed",t=w(l);m(s=>{var a;return{...s,[e]:{status:"unhealthy",lastCheck:i,lastSuccess:(null===(a=s[e])||void 0===a?void 0:a.lastSuccess)||"None",loading:!1,error:t,fullError:l}}})}else m(l=>({...l,[e]:{status:"healthy",lastCheck:i,lastSuccess:i,loading:!1,successResponse:r}}));try{let s=await (0,c.latestHealthChecksCall)(l),r=t.data.find(l=>l.model_name===e);if(r){let l=r.model_info.id,t=null===(a=s.latest_health_checks)||void 0===a?void 0:a[l];if(t){let l=t.error_message||void 0;m(s=>{var a,r,i,n,o,d,c;return{...s,[e]:{status:t.status||(null===(a=s[e])||void 0===a?void 0:a.status)||"unknown",lastCheck:t.checked_at?new Date(t.checked_at).toLocaleString():(null===(r=s[e])||void 0===r?void 0:r.lastCheck)||"None",lastSuccess:"healthy"===t.status?t.checked_at?new Date(t.checked_at).toLocaleString():(null===(i=s[e])||void 0===i?void 0:i.lastSuccess)||"None":(null===(n=s[e])||void 0===n?void 0:n.lastSuccess)||"None",loading:!1,error:l?w(l):null===(o=s[e])||void 0===o?void 0:o.error,fullError:l||(null===(d=s[e])||void 0===d?void 0:d.fullError),successResponse:"healthy"===t.status?t:null===(c=s[e])||void 0===c?void 0:c.successResponse}}})}}}catch(e){console.debug("Could not fetch updated status from database (non-critical):",e)}}catch(a){let l=new Date().toLocaleString(),t=a instanceof Error?a.message:String(a),s=w(t);m(a=>{var r;return{...a,[e]:{status:"unhealthy",lastCheck:l,lastSuccess:(null===(r=a[e])||void 0===r?void 0:r.lastSuccess)||"None",loading:!1,error:s,fullError:t}}})}}},k=async()=>{let e=u.length>0?u:a,s=e.reduce((e,l)=>(e[l]={...d[l],loading:!0,status:"checking"},e),{});m(e=>({...e,...s}));let r={},i=e.map(async e=>{if(l)try{let s=await (0,c.individualModelHealthCheckCall)(l,e);r[e]=s;let a=new Date().toLocaleString();if(s.unhealthy_count>0&&s.unhealthy_endpoints&&s.unhealthy_endpoints.length>0){var t;let l=(null===(t=s.unhealthy_endpoints[0])||void 0===t?void 0:t.error)||"Health check failed",r=w(l);m(t=>{var s;return{...t,[e]:{status:"unhealthy",lastCheck:a,lastSuccess:(null===(s=t[e])||void 0===s?void 0:s.lastSuccess)||"None",loading:!1,error:r,fullError:l}}})}else m(l=>({...l,[e]:{status:"healthy",lastCheck:a,lastSuccess:a,loading:!1,successResponse:s}}))}catch(a){console.error("Health check failed for ".concat(e,":"),a);let l=new Date().toLocaleString(),t=a instanceof Error?a.message:String(a),s=w(t);m(a=>{var r;return{...a,[e]:{status:"unhealthy",lastCheck:l,lastSuccess:(null===(r=a[e])||void 0===r?void 0:r.lastSuccess)||"None",loading:!1,error:s,fullError:t}}})}});await Promise.allSettled(i);try{if(!l)return;let s=await (0,c.latestHealthChecksCall)(l);s.latest_health_checks&&Object.entries(s.latest_health_checks).forEach(l=>{let[s,a]=l,r=t.data.find(e=>e.model_info.id===s);if(r&&e.includes(r.model_name)&&a){let e=r.model_name,l=a.error_message||void 0;m(t=>{let s=t[e];return{...t,[e]:{status:a.status||(null==s?void 0:s.status)||"unknown",lastCheck:a.checked_at?new Date(a.checked_at).toLocaleString():(null==s?void 0:s.lastCheck)||"None",lastSuccess:"healthy"===a.status&&a.checked_at?new Date(a.checked_at).toLocaleString():(null==s?void 0:s.lastSuccess)||"None",loading:!1,error:l?w(l):null==s?void 0:s.error,fullError:l||(null==s?void 0:s.fullError),successResponse:"healthy"===a.status?a:null==s?void 0:s.successResponse}}})}})}catch(e){console.warn("Failed to fetch updated health statuses from database (non-critical):",e)}},A=e=>{p(e),e?h(a):h([])},M=()=>{f(!1),v(null)},I=()=>{y(!1),N(null)};return(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"mb-6",children:(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(eX.Z,{children:"Model Health Status"}),(0,s.jsx)(n.Z,{className:"text-gray-600 mt-1",children:"Run health checks on individual models to verify they are working correctly"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[u.length>0&&(0,s.jsx)(eY.Z,{size:"sm",variant:"light",onClick:()=>A(!1),className:"px-3 py-1 text-sm",children:"Clear Selection"}),(0,s.jsx)(eY.Z,{size:"sm",variant:"secondary",onClick:k,disabled:Object.values(d).some(e=>e.loading),className:"px-3 py-1 text-sm",children:u.length>0&&u.length{l?h(l=>[...l,e]):(h(l=>l.filter(l=>l!==e)),p(!1))},A,C,e=>{switch(e){case"healthy":return(0,s.jsx)(ll.Z,{color:"emerald",children:"healthy"});case"unhealthy":return(0,s.jsx)(ll.Z,{color:"red",children:"unhealthy"});case"checking":return(0,s.jsx)(ll.Z,{color:"blue",children:"checking"});case"none":return(0,s.jsx)(ll.Z,{color:"gray",children:"none"});default:return(0,s.jsx)(ll.Z,{color:"gray",children:"unknown"})}},r,(e,l,t)=>{v({modelName:e,cleanedError:l,fullError:t}),f(!0)},(e,l)=>{N({modelName:e,response:l}),y(!0)},i),data:t.data.map(e=>{let l=d[e.model_name]||{status:"none",lastCheck:"None",loading:!1};return{model_name:e.model_name,model_info:e.model_info,provider:e.provider,litellm_model_name:e.litellm_model_name,health_status:l.status,last_check:l.lastCheck,last_success:l.lastSuccess||"None",health_loading:l.loading,health_error:l.error,health_full_error:l.fullError}}),isLoading:!1,table:Z})}),(0,s.jsx)(S.Z,{title:j?"Health Check Error - ".concat(j.modelName):"Error Details",open:g,onCancel:M,footer:[(0,s.jsx)(E.ZP,{onClick:M,children:"Close"},"close")],width:800,children:j&&(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Error:"}),(0,s.jsx)("div",{className:"mt-2 p-3 bg-red-50 border border-red-200 rounded-md",children:(0,s.jsx)(n.Z,{className:"text-red-800",children:j.cleanedError})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Full Error Details:"}),(0,s.jsx)("div",{className:"mt-2 p-3 bg-gray-50 border border-gray-200 rounded-md max-h-96 overflow-y-auto",children:(0,s.jsx)("pre",{className:"text-sm text-gray-800 whitespace-pre-wrap",children:j.fullError})})]})]})}),(0,s.jsx)(S.Z,{title:b?"Health Check Response - ".concat(b.modelName):"Response Details",open:_,onCancel:I,footer:[(0,s.jsx)(E.ZP,{onClick:I,children:"Close"},"close")],width:800,children:b&&(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Status:"}),(0,s.jsx)("div",{className:"mt-2 p-3 bg-green-50 border border-green-200 rounded-md",children:(0,s.jsx)(n.Z,{className:"text-green-800",children:"Health check passed successfully"})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Response Details:"}),(0,s.jsx)("div",{className:"mt-2 p-3 bg-gray-50 border border-gray-200 rounded-md max-h-96 overflow-y-auto",children:(0,s.jsx)("pre",{className:"text-sm text-gray-800 whitespace-pre-wrap",children:JSON.stringify(b.response,null,2)})})]})]})})]})},lD=t(86462),lz=t(47686),lq=t(77355),lB=t(93416),lU=t(95704),lG=e=>{let{accessToken:l,initialModelGroupAlias:t={},onAliasUpdate:a}=e,[r,i]=(0,o.useState)([]),[n,m]=(0,o.useState)({aliasName:"",targetModelGroup:""}),[u,h]=(0,o.useState)(null),[x,p]=(0,o.useState)(!0);(0,o.useEffect)(()=>{i(Object.entries(t).map((e,l)=>{var t;let[s,a]=e;return{id:"".concat(l,"-").concat(s),aliasName:s,targetModelGroup:"string"==typeof a?a:null!==(t=null==a?void 0:a.model)&&void 0!==t?t:""}}))},[t]);let g=async e=>{if(!l)return console.error("Access token is missing"),!1;try{let t={};return e.forEach(e=>{t[e.aliasName]=e.targetModelGroup}),console.log("Saving model group alias:",t),await (0,c.setCallbacksCall)(l,{router_settings:{model_group_alias:t}}),a&&a(t),!0}catch(e){return console.error("Failed to save model group alias settings:",e),d.Z.fromBackend("Failed to save model group alias settings"),!1}},f=async()=>{if(!n.aliasName||!n.targetModelGroup){d.Z.fromBackend("Please provide both alias name and target model group");return}if(r.some(e=>e.aliasName===n.aliasName)){d.Z.fromBackend("An alias with this name already exists");return}let e=[...r,{id:"".concat(Date.now(),"-").concat(n.aliasName),aliasName:n.aliasName,targetModelGroup:n.targetModelGroup}];await g(e)&&(i(e),m({aliasName:"",targetModelGroup:""}),d.Z.success("Alias added successfully"))},j=e=>{h({...e})},v=async()=>{if(!u)return;if(!u.aliasName||!u.targetModelGroup){d.Z.fromBackend("Please provide both alias name and target model group");return}if(r.some(e=>e.id!==u.id&&e.aliasName===u.aliasName)){d.Z.fromBackend("An alias with this name already exists");return}let e=r.map(e=>e.id===u.id?u:e);await g(e)&&(i(e),h(null),d.Z.success("Alias updated successfully"))},_=()=>{h(null)},b=async e=>{let l=r.filter(l=>l.id!==e);await g(l)&&(i(l),d.Z.success("Alias deleted successfully"))},N=r.reduce((e,l)=>(e[l.aliasName]=l.targetModelGroup,e),{});return(0,s.jsxs)(lU.Zb,{className:"mb-6",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between cursor-pointer",onClick:()=>p(!x),children:[(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsx)(lU.Dx,{className:"mb-0",children:"Model Group Alias Settings"}),(0,s.jsx)("p",{className:"text-sm text-gray-500",children:"Create aliases for your model groups to simplify API calls. For example, you can create an alias 'gpt-4o' that points to 'gpt-4o-mini-openai' model group."})]}),(0,s.jsx)("div",{className:"flex items-center",children:x?(0,s.jsx)(lD.Z,{className:"w-5 h-5 text-gray-500"}):(0,s.jsx)(lz.Z,{className:"w-5 h-5 text-gray-500"})})]}),x&&(0,s.jsxs)("div",{className:"mt-4",children:[(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsx)(lU.xv,{className:"text-sm font-medium text-gray-700 mb-2",children:"Add New Alias"}),(0,s.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Alias Name"}),(0,s.jsx)("input",{type:"text",value:n.aliasName,onChange:e=>m({...n,aliasName:e.target.value}),placeholder:"e.g., gpt-4o",className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Target Model Group"}),(0,s.jsx)("input",{type:"text",value:n.targetModelGroup,onChange:e=>m({...n,targetModelGroup:e.target.value}),placeholder:"e.g., gpt-4o-mini-openai",className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm"})]}),(0,s.jsx)("div",{className:"flex items-end",children:(0,s.jsxs)("button",{onClick:f,disabled:!n.aliasName||!n.targetModelGroup,className:"flex items-center px-4 py-2 rounded-md text-sm ".concat(n.aliasName&&n.targetModelGroup?"bg-green-600 text-white hover:bg-green-700":"bg-gray-300 text-gray-500 cursor-not-allowed"),children:[(0,s.jsx)(lq.Z,{className:"w-4 h-4 mr-1"}),"Add Alias"]})})]})]}),(0,s.jsx)(lU.xv,{className:"text-sm font-medium text-gray-700 mb-2",children:"Manage Existing Aliases"}),(0,s.jsx)("div",{className:"rounded-lg custom-border relative mb-6",children:(0,s.jsx)("div",{className:"overflow-x-auto",children:(0,s.jsxs)(lU.iA,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,s.jsx)(lU.ss,{children:(0,s.jsxs)(lU.SC,{children:[(0,s.jsx)(lU.xs,{className:"py-1 h-8",children:"Alias Name"}),(0,s.jsx)(lU.xs,{className:"py-1 h-8",children:"Target Model Group"}),(0,s.jsx)(lU.xs,{className:"py-1 h-8",children:"Actions"})]})}),(0,s.jsxs)(lU.RM,{children:[r.map(e=>(0,s.jsx)(lU.SC,{className:"h-8",children:u&&u.id===e.id?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(lU.pj,{className:"py-0.5",children:(0,s.jsx)("input",{type:"text",value:u.aliasName,onChange:e=>h({...u,aliasName:e.target.value}),className:"w-full px-2 py-1 border border-gray-300 rounded-md text-sm"})}),(0,s.jsx)(lU.pj,{className:"py-0.5",children:(0,s.jsx)("input",{type:"text",value:u.targetModelGroup,onChange:e=>h({...u,targetModelGroup:e.target.value}),className:"w-full px-2 py-1 border border-gray-300 rounded-md text-sm"})}),(0,s.jsx)(lU.pj,{className:"py-0.5 whitespace-nowrap",children:(0,s.jsxs)("div",{className:"flex space-x-2",children:[(0,s.jsx)("button",{onClick:v,className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:"Save"}),(0,s.jsx)("button",{onClick:_,className:"text-xs bg-gray-50 text-gray-600 px-2 py-1 rounded hover:bg-gray-100",children:"Cancel"})]})})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(lU.pj,{className:"py-0.5 text-sm text-gray-900",children:e.aliasName}),(0,s.jsx)(lU.pj,{className:"py-0.5 text-sm text-gray-500",children:e.targetModelGroup}),(0,s.jsx)(lU.pj,{className:"py-0.5 whitespace-nowrap",children:(0,s.jsxs)("div",{className:"flex space-x-2",children:[(0,s.jsx)("button",{onClick:()=>j(e),className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:(0,s.jsx)(lB.Z,{className:"w-3 h-3"})}),(0,s.jsx)("button",{onClick:()=>b(e.id),className:"text-xs bg-red-50 text-red-600 px-2 py-1 rounded hover:bg-red-100",children:(0,s.jsx)(y.Z,{className:"w-3 h-3"})})]})})]})},e.id)),0===r.length&&(0,s.jsx)(lU.SC,{children:(0,s.jsx)(lU.pj,{colSpan:3,className:"py-0.5 text-sm text-gray-500 text-center",children:"No aliases added yet. Add a new alias above."})})]})]})})}),(0,s.jsxs)(lU.Zb,{children:[(0,s.jsx)(lU.Dx,{className:"mb-4",children:"Configuration Example"}),(0,s.jsx)(lU.xv,{className:"text-gray-600 mb-4",children:"Here's how your current aliases would look in the config.yaml:"}),(0,s.jsx)("div",{className:"bg-gray-100 rounded-lg p-4 font-mono text-sm",children:(0,s.jsxs)("div",{className:"text-gray-700",children:["router_settings:",(0,s.jsx)("br",{}),"\xa0\xa0model_group_alias:",0===Object.keys(N).length?(0,s.jsxs)("span",{className:"text-gray-500",children:[(0,s.jsx)("br",{}),"\xa0\xa0\xa0\xa0# No aliases configured yet"]}):Object.entries(N).map(e=>{let[l,t]=e;return(0,s.jsxs)("span",{children:[(0,s.jsx)("br",{}),'\xa0\xa0\xa0\xa0"',l,'": "',t,'"']},l)})]})})]})]})]})},lH=t(27593),lK=e=>{let{accessToken:l,token:t,userRole:u,userID:x,modelData:p={data:[]},keys:g,setModelData:j,premiumUser:_,teams:y}=e,[b]=N.Z.useForm(),[Z,w]=(0,o.useState)(null),[S,k]=(0,o.useState)(""),[A,E]=(0,o.useState)([]),[M,I]=(0,o.useState)([]),[F,P]=(0,o.useState)(m.Cl.Anthropic),[L,T]=(0,o.useState)(!1),[R,O]=(0,o.useState)(null),[V,D]=(0,o.useState)([]),[z,q]=(0,o.useState)([]),[B,U]=(0,o.useState)(null),[G,H]=(0,o.useState)([]),[K,ea]=(0,o.useState)([]),[er,ei]=(0,o.useState)([]),[en,eo]=(0,o.useState)([]),[ed,ec]=(0,o.useState)([]),[em,eu]=(0,o.useState)([]),[eh,ex]=(0,o.useState)([]),[ep,eg]=(0,o.useState)({from:new Date(Date.now()-6048e5),to:new Date}),[ef,ej]=(0,o.useState)(null),[ev,e_]=(0,o.useState)(null),[ey,eb]=(0,o.useState)(0),[eN,eZ]=(0,o.useState)({}),[ew,eC]=(0,o.useState)([]),[eS,ek]=(0,o.useState)(!1),[eA,eE]=(0,o.useState)(null),[eM,eI]=(0,o.useState)(null),[eF,eP]=(0,o.useState)([]),[eL,eT]=(0,o.useState)({}),[eR,eO]=(0,o.useState)(!1),[eV,eD]=(0,o.useState)(null),[ez,eq]=(0,o.useState)(!1),[eB,eU]=(0,o.useState)(null),[eG,eH]=(0,o.useState)(null),[eJ,eW]=(0,o.useState)(!1),eY=(0,o.useRef)(null),[e$,eQ]=(0,o.useState)(0),eX=(0,a.NL)(),{data:e0,isLoading:e1,refetch:e2}=v(l,x,u),{data:e4}=f(l),e5=(null==e4?void 0:e4.credentials)||[];(0,o.useEffect)(()=>{let e=e=>{eY.current&&!eY.current.contains(e.target)&&eW(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let e6={name:"file",accept:".json",pastable:!1,beforeUpload:e=>{if("application/json"===e.type){let l=new FileReader;l.onload=e=>{if(e.target){let l=e.target.result;b.setFieldsValue({vertex_credentials:l})}},l.readAsText(e)}return!1},onChange(e){"done"===e.file.status?d.Z.success("".concat(e.file.name," file uploaded successfully")):"error"===e.file.status&&d.Z.fromBackend("".concat(e.file.name," file upload failed."))}},e3=()=>{k(new Date().toLocaleString()),eX.invalidateQueries({queryKey:["models","list"]}),e2()},e7=async()=>{if(l)try{let e={router_settings:{}};"global"===B?(ev&&(e.router_settings.retry_policy=ev),d.Z.success("Global retry settings saved successfully")):(ef&&(e.router_settings.model_group_retry_policy=ef),d.Z.success("Retry settings saved successfully for ".concat(B))),await (0,c.setCallbacksCall)(l,e)}catch(e){d.Z.fromBackend("Failed to save retry settings")}};if((0,o.useEffect)(()=>{if(!l||!t||!u||!x||!e0)return;let e=async()=>{try{var e,t,s,a,r,i,n,o,d,m,h,p;j(e0);let g=await (0,c.modelSettingsCall)(l);g&&I(g);let f=new Set;for(let e=0;e0&&(y=v[v.length-1]);let b=await (0,c.modelMetricsCall)(l,x,u,y,null===(e=ep.from)||void 0===e?void 0:e.toISOString(),null===(t=ep.to)||void 0===t?void 0:t.toISOString(),null==eA?void 0:eA.token,eM);H(b.data),ea(b.all_api_bases);let N=await (0,c.streamingModelMetricsCall)(l,y,null===(s=ep.from)||void 0===s?void 0:s.toISOString(),null===(a=ep.to)||void 0===a?void 0:a.toISOString());ei(N.data),eo(N.all_api_bases);let Z=await (0,c.modelExceptionsCall)(l,x,u,y,null===(r=ep.from)||void 0===r?void 0:r.toISOString(),null===(i=ep.to)||void 0===i?void 0:i.toISOString(),null==eA?void 0:eA.token,eM);ec(Z.data),eu(Z.exception_types);let w=await (0,c.modelMetricsSlowResponsesCall)(l,x,u,y,null===(n=ep.from)||void 0===n?void 0:n.toISOString(),null===(o=ep.to)||void 0===o?void 0:o.toISOString(),null==eA?void 0:eA.token,eM),C=await (0,c.adminGlobalActivityExceptions)(l,null===(d=ep.from)||void 0===d?void 0:d.toISOString().split("T")[0],null===(m=ep.to)||void 0===m?void 0:m.toISOString().split("T")[0],y);eZ(C);let S=await (0,c.adminGlobalActivityExceptionsPerDeployment)(l,null===(h=ep.from)||void 0===h?void 0:h.toISOString().split("T")[0],null===(p=ep.to)||void 0===p?void 0:p.toISOString().split("T")[0],y);eC(S),ex(w);let k=await (0,c.allEndUsersCall)(l);eP(null==k?void 0:k.map(e=>e.user_id));let A=(await (0,c.getCallbacksCall)(l,x,u)).router_settings,E=A.model_group_retry_policy,M=A.num_retries;ej(E),e_(A.retry_policy),eb(M);let F=A.model_group_alias||{};eT(F)}catch(e){console.error("Error fetching model data:",e)}};l&&t&&u&&x&&e0&&e();let s=async()=>{w(await (0,c.modelCostMap)(l))};null==Z&&s()},[l,t,u,x,e0]),!p||e1||!l||!t||!u||!x)return(0,s.jsx)("div",{children:"Loading..."});let le=[],ll=[];for(let e=0;enull!=Z&&"object"==typeof Z&&e in Z?Z[e].litellm_provider:"openai";if(t){let e=t.split("/"),l=e[0];(r=s)||(r=1===e.length?m(t):l)}else r="-";a&&(i=null==a?void 0:a.input_cost_per_token,n=null==a?void 0:a.output_cost_per_token,o=null==a?void 0:a.max_tokens,d=null==a?void 0:a.max_input_tokens),(null==l?void 0:l.litellm_params)&&(c=Object.fromEntries(Object.entries(null==l?void 0:l.litellm_params).filter(e=>{let[l]=e;return"model"!==l&&"api_base"!==l}))),p.data[e].provider=r,p.data[e].input_cost=i,p.data[e].output_cost=n,p.data[e].litellm_model_name=t,ll.push(r),p.data[e].input_cost&&(p.data[e].input_cost=(1e6*Number(p.data[e].input_cost)).toFixed(2)),p.data[e].output_cost&&(p.data[e].output_cost=(1e6*Number(p.data[e].output_cost)).toFixed(2)),p.data[e].max_tokens=o,p.data[e].max_input_tokens=d,p.data[e].api_base=null==l?void 0:null===(la=l.litellm_params)||void 0===la?void 0:la.api_base,p.data[e].cleanedLitellmParams=c,le.push(l.model_name)}if(u&&"Admin Viewer"==u){let{Title:e,Paragraph:l}=C.default;return(0,s.jsxs)("div",{children:[(0,s.jsx)(e,{level:1,children:"Access Denied"}),(0,s.jsx)(l,{children:"Ask your proxy admin for access to view all models"})]})}return(Object.keys(m.Cl).find(e=>m.Cl[e]===F),eB)?(0,s.jsx)("div",{className:"w-full h-full",children:(0,s.jsx)(e9.Z,{teamId:eB,onClose:()=>eU(null),accessToken:l,is_team_admin:"Admin"===u,is_proxy_admin:"Proxy Admin"===u,userModels:le,editTeam:!1,onUpdate:e3})}):(0,s.jsx)("div",{className:"w-full mx-4 h-[75vh]",children:(0,s.jsx)(i.Z,{numItems:1,className:"gap-2 p-8 w-full mt-2",children:(0,s.jsxs)(r.Z,{numColSpan:1,className:"flex flex-col gap-2",children:[(0,s.jsx)("div",{className:"flex justify-between items-center mb-4",children:(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",children:"Model Management"}),es.ZL.includes(u)?(0,s.jsx)("p",{className:"text-sm text-gray-600",children:"Add and manage models for the proxy"}):(0,s.jsx)("p",{className:"text-sm text-gray-600",children:"Add models for teams you are an admin for."})]})}),eV?(0,s.jsx)(e8,{modelId:eV,editModel:!0,onClose:()=>{eD(null),eq(!1)},modelData:p.data.find(e=>e.model_info.id===eV),accessToken:l,userID:x,userRole:u,setEditModalVisible:T,setSelectedModel:O,onModelUpdate:e=>{e.deleted?j({...p,data:p.data.filter(l=>l.model_info.id!==e.model_info.id)}):j({...p,data:p.data.map(l=>l.model_info.id===e.model_info.id?e:l)}),eX.invalidateQueries({queryKey:["models","list"]}),e3()},modelAccessGroups:z}):(0,s.jsxs)(X.Z,{index:e$,onIndexChange:eQ,className:"gap-2 h-[75vh] w-full ",children:[(0,s.jsxs)(ee.Z,{className:"flex justify-between mt-2 w-full items-center",children:[(0,s.jsxs)("div",{className:"flex",children:[es.ZL.includes(u)?(0,s.jsx)(Q.Z,{children:"All Models"}):(0,s.jsx)(Q.Z,{children:"Your Models"}),(0,s.jsx)(Q.Z,{children:"Add Model"}),es.ZL.includes(u)&&(0,s.jsx)(Q.Z,{children:"LLM Credentials"}),es.ZL.includes(u)&&(0,s.jsx)(Q.Z,{children:"Pass-Through Endpoints"}),es.ZL.includes(u)&&(0,s.jsx)(Q.Z,{children:"Health Status"}),es.ZL.includes(u)&&(0,s.jsx)(Q.Z,{children:"Model Analytics"}),es.ZL.includes(u)&&(0,s.jsx)(Q.Z,{children:"Model Retry Settings"}),es.ZL.includes(u)&&(0,s.jsx)(Q.Z,{children:"Model Group Alias"}),es.ZL.includes(u)&&(0,s.jsx)(Q.Z,{children:"Price Data Reload"})]}),(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[S&&(0,s.jsxs)(n.Z,{children:["Last Refreshed: ",S]}),(0,s.jsx)($.Z,{icon:Y.Z,variant:"shadow",size:"xs",className:"self-center",onClick:e3})]})]}),(0,s.jsxs)(et.Z,{children:[(0,s.jsx)(li,{selectedModelGroup:B,setSelectedModelGroup:U,availableModelGroups:V,availableModelAccessGroups:z,setSelectedModelId:eD,setSelectedTeamId:eU,setEditModel:eq,modelData:p}),(0,s.jsx)(el.Z,{className:"h-full",children:(0,s.jsx)(eK,{form:b,handleOk:()=>{b.validateFields().then(e=>{h(e,l,b,e3)}).catch(e=>{var l;let t=(null===(l=e.errorFields)||void 0===l?void 0:l.map(e=>"".concat(e.name.join("."),": ").concat(e.errors.join(", "))).join(" | "))||"Unknown validation error";d.Z.fromBackend("Please fill in the following required fields: ".concat(t))})},selectedProvider:F,setSelectedProvider:P,providerModels:A,setProviderModelsFn:e=>{E((0,m.bK)(e,Z))},getPlaceholder:m.ph,uploadProps:e6,showAdvancedSettings:eR,setShowAdvancedSettings:eO,teams:y,credentials:e5,accessToken:l,userRole:u,premiumUser:_})}),(0,s.jsx)(el.Z,{children:(0,s.jsx)(J,{uploadProps:e6})}),(0,s.jsx)(el.Z,{children:(0,s.jsx)(lH.Z,{accessToken:l,userRole:u,userID:x,modelData:p,premiumUser:_})}),(0,s.jsx)(el.Z,{children:(0,s.jsx)(lV,{accessToken:l,modelData:p,all_models_on_proxy:le,getDisplayModelName:W,setSelectedModelId:eD})}),(0,s.jsx)(lb,{dateValue:ep,setDateValue:eg,selectedModelGroup:B,availableModelGroups:V,setShowAdvancedFilters:ek,modelMetrics:G,modelMetricsCategories:K,streamingModelMetrics:er,streamingModelMetricsCategories:en,customTooltip:e=>{var l,t;let{payload:a,active:r}=e;if(!r||!a)return null;let i=null===(t=a[0])||void 0===t?void 0:null===(l=t.payload)||void 0===l?void 0:l.date,n=a.sort((e,l)=>l.value-e.value);if(n.length>5){let e=n.length-5;(n=n.slice(0,5)).push({dataKey:"".concat(e," other deployments"),value:a.slice(5).reduce((e,l)=>e+l.value,0),color:"gray"})}return(0,s.jsxs)("div",{className:"w-150 rounded-tremor-default border border-tremor-border bg-tremor-background p-2 text-tremor-default shadow-tremor-dropdown",children:[i&&(0,s.jsxs)("p",{className:"text-tremor-content-emphasis mb-2",children:["Date: ",i]}),n.map((e,l)=>{let t=parseFloat(e.value.toFixed(5)),a=0===t&&e.value>0?"<0.00001":t.toFixed(5);return(0,s.jsxs)("div",{className:"flex justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 mt-1 rounded-full bg-".concat(e.color,"-500")}),(0,s.jsx)("p",{className:"text-tremor-content",children:e.dataKey})]}),(0,s.jsx)("p",{className:"font-medium text-tremor-content-emphasis text-righ ml-2",children:a})]},l)})]})},slowResponsesData:eh,modelExceptions:ed,globalExceptionData:eN,allExceptions:em,globalExceptionPerDeployment:ew,allEndUsers:eF,keys:g,setSelectedAPIKey:eE,setSelectedCustomer:eI,teams:y,selectedAPIKey:eA,selectedCustomer:eM,selectedTeam:eG,setAllExceptions:eu,setGlobalExceptionData:eZ,setGlobalExceptionPerDeployment:eC,setModelExceptions:ec,setModelMetrics:H,setModelMetricsCategories:ea,setSelectedModelGroup:U,setSlowResponsesData:ex,setStreamingModelMetrics:ei,setStreamingModelMetricsCategories:eo}),(0,s.jsx)(lZ,{selectedModelGroup:B,setSelectedModelGroup:U,availableModelGroups:V,globalRetryPolicy:ev,setGlobalRetryPolicy:e_,defaultRetry:ey,modelGroupRetryPolicy:ef,setModelGroupRetryPolicy:ej,handleSaveRetrySettings:e7}),(0,s.jsx)(el.Z,{children:(0,s.jsx)(lG,{accessToken:l,initialModelGroupAlias:eL,onAliasUpdate:eT})}),(0,s.jsx)(lF,{setModelMap:w})]})]})]})})})}},27593:function(e,l,t){t.d(l,{Z:function(){return Y}});var s=t(57437),a=t(2265),r=t(78489),i=t(47323),n=t(84264),o=t(96761),d=t(19250),c=t(99981),m=t(33866),u=t(15731),h=t(53410),x=t(74998),p=t(59341),g=t(49566),f=t(12514),j=t(97765),v=t(37592),_=t(10032),y=t(22116),b=t(51653),N=t(24199),Z=t(12660),w=t(15424),C=t(58760),S=t(5545),k=t(45246),A=t(96473),E=t(31283),M=e=>{let{value:l={},onChange:t}=e,[r,i]=(0,a.useState)(Object.entries(l)),n=e=>{let l=r.filter((l,t)=>t!==e);i(l),null==t||t(Object.fromEntries(l))},o=(e,l,s)=>{let a=[...r];a[e]=[l,s],i(a),null==t||t(Object.fromEntries(a))};return(0,s.jsxs)("div",{children:[r.map((e,l)=>{let[t,a]=e;return(0,s.jsxs)(C.Z,{style:{display:"flex",marginBottom:8},align:"center",children:[(0,s.jsx)(E.o,{placeholder:"Header Name",value:t,onChange:e=>o(l,e.target.value,a)}),(0,s.jsx)(E.o,{placeholder:"Header Value",value:a,onChange:e=>o(l,t,e.target.value)}),(0,s.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:(0,s.jsx)(k.Z,{onClick:()=>n(l),style:{cursor:"pointer"}})})]},l)}),(0,s.jsx)(S.ZP,{type:"dashed",onClick:()=>{i([...r,["",""]])},icon:(0,s.jsx)(A.Z,{}),children:"Add Header"})]})},I=t(77565),F=e=>{let{pathValue:l,targetValue:t,includeSubpath:a}=e,r=(0,d.getProxyBaseUrl)();return l&&t?(0,s.jsxs)(f.Z,{className:"p-5",children:[(0,s.jsx)(o.Z,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Route Preview"}),(0,s.jsx)(j.Z,{className:"text-gray-600 mb-5",children:"How your requests will be routed"}),(0,s.jsxs)("div",{className:"space-y-5",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-base font-semibold text-gray-900 mb-3",children:"Basic routing:"}),(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsxs)("div",{className:"flex-1 bg-gray-50 border border-gray-200 rounded-lg p-3",children:[(0,s.jsx)("div",{className:"text-sm text-gray-600 mb-2",children:"Your endpoint"}),(0,s.jsx)("code",{className:"font-mono text-sm text-gray-900",children:l?"".concat(r).concat(l):""})]}),(0,s.jsx)("div",{className:"text-gray-400",children:(0,s.jsx)(I.Z,{className:"text-lg"})}),(0,s.jsxs)("div",{className:"flex-1 bg-gray-50 border border-gray-200 rounded-lg p-3",children:[(0,s.jsx)("div",{className:"text-sm text-gray-600 mb-2",children:"Forwards to"}),(0,s.jsx)("code",{className:"font-mono text-sm text-gray-900",children:t})]})]})]}),a&&(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-base font-semibold text-gray-900 mb-3",children:"With subpaths:"}),(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsxs)("div",{className:"flex-1 bg-gray-50 border border-gray-200 rounded-lg p-3",children:[(0,s.jsx)("div",{className:"text-sm text-gray-600 mb-2",children:"Your endpoint + subpath"}),(0,s.jsxs)("code",{className:"font-mono text-sm text-gray-900",children:[l&&"".concat(r).concat(l),(0,s.jsx)("span",{className:"text-blue-600",children:"/v1/text-to-image/base/model"})]})]}),(0,s.jsx)("div",{className:"text-gray-400",children:(0,s.jsx)(I.Z,{className:"text-lg"})}),(0,s.jsxs)("div",{className:"flex-1 bg-gray-50 border border-gray-200 rounded-lg p-3",children:[(0,s.jsx)("div",{className:"text-sm text-gray-600 mb-2",children:"Forwards to"}),(0,s.jsxs)("code",{className:"font-mono text-sm text-gray-900",children:[t,(0,s.jsx)("span",{className:"text-blue-600",children:"/v1/text-to-image/base/model"})]})]})]}),(0,s.jsxs)("div",{className:"mt-3 text-sm text-gray-600",children:["Any path after ",l," will be appended to the target URL"]})]})}),!a&&(0,s.jsx)("div",{className:"mt-4 p-3 bg-blue-50 rounded-md border border-blue-200",children:(0,s.jsxs)("div",{className:"flex items-start",children:[(0,s.jsx)(w.Z,{className:"text-blue-500 mt-0.5 mr-2 flex-shrink-0"}),(0,s.jsxs)("div",{className:"text-sm text-blue-700",children:[(0,s.jsx)("span",{className:"font-medium",children:"Not seeing the routing you wanted?"})," Try enabling - Include Subpaths - above - this allows subroutes like"," ",(0,s.jsx)("code",{className:"bg-blue-100 px-1 py-0.5 rounded font-mono text-xs",children:"/api/v1/models"})," to be forwarded automatically."]})]})})]})]}):null},P=t(9114),L=t(63709),T=e=>{let{premiumUser:l,authEnabled:t,onAuthChange:a}=e;return(0,s.jsxs)(f.Z,{className:"p-6",children:[(0,s.jsx)(o.Z,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Security"}),(0,s.jsx)(j.Z,{className:"text-gray-600 mb-4",children:"When enabled, requests to this endpoint will require a valid LiteLLM Virtual Key"}),l?(0,s.jsx)(_.Z.Item,{name:"auth",valuePropName:"checked",className:"mb-0",children:(0,s.jsx)(L.Z,{checked:t,onChange:e=>{a(e)}})}):(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center mb-3",children:[(0,s.jsx)(L.Z,{disabled:!0,checked:!1,style:{outline:"2px solid #d1d5db",outlineOffset:"2px"}}),(0,s.jsx)("span",{className:"ml-2 text-sm text-gray-400",children:"Authentication (Premium)"})]}),(0,s.jsx)("div",{className:"p-3 bg-yellow-50 border border-yellow-200 rounded-lg",children:(0,s.jsxs)(n.Z,{className:"text-sm text-yellow-800",children:["Setting authentication for pass-through endpoints is a LiteLLM Enterprise feature. Get a trial key"," ",(0,s.jsx)("a",{href:"https://www.litellm.ai/#pricing",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"here"}),"."]})})]})]})},R=t(67479),O=e=>{let{accessToken:l,value:t={},onChange:r,disabled:i=!1}=e,[n,d]=(0,a.useState)(Object.keys(t)),[m,u]=(0,a.useState)(t);(0,a.useEffect)(()=>{u(t),d(Object.keys(t))},[t]);let h=(e,l,t)=>{var s,a;let i=m[e]||{},n={...m,[e]:{...i,[l]:t.length>0?t:void 0}};(null===(s=n[e])||void 0===s?void 0:s.request_fields)||(null===(a=n[e])||void 0===a?void 0:a.response_fields)||(n[e]=null),u(n),r&&r(n)};return(0,s.jsxs)(f.Z,{className:"p-6",children:[(0,s.jsx)(o.Z,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Guardrails"}),(0,s.jsx)(j.Z,{className:"text-gray-600 mb-6",children:"Configure guardrails to enforce policies on requests and responses. Guardrails are opt-in for passthrough endpoints."}),(0,s.jsx)(b.Z,{message:(0,s.jsxs)("span",{children:["Field-Level Targeting"," ",(0,s.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/pass_through_guardrails#field-level-targeting",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline",children:"(Learn More)"})]}),description:(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("div",{children:"Optionally specify which fields to check. If left empty, the entire request/response is sent to the guardrail."}),(0,s.jsxs)("div",{className:"text-xs space-y-1 mt-2",children:[(0,s.jsx)("div",{className:"font-medium",children:"Common Examples:"}),(0,s.jsxs)("div",{children:["• ",(0,s.jsx)("code",{className:"bg-gray-100 px-1 rounded",children:"query"})," - Single field"]}),(0,s.jsxs)("div",{children:["• ",(0,s.jsx)("code",{className:"bg-gray-100 px-1 rounded",children:"documents[*].text"})," - All text in documents array"]}),(0,s.jsxs)("div",{children:["• ",(0,s.jsx)("code",{className:"bg-gray-100 px-1 rounded",children:"messages[*].content"})," - All message contents"]})]})]}),type:"info",showIcon:!0,className:"mb-4"}),(0,s.jsx)(_.Z.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Select Guardrails",(0,s.jsx)(c.Z,{title:"Choose which guardrails should run on this endpoint. Org/team/key level guardrails will also be included.",children:(0,s.jsx)(w.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),children:(0,s.jsx)(R.Z,{accessToken:l,value:n,onChange:e=>{d(e);let l={};e.forEach(e=>{l[e]=m[e]||null}),u(l),r&&r(l)},disabled:i})}),n.length>0&&(0,s.jsxs)("div",{className:"mt-6 space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,s.jsx)("div",{className:"text-sm font-medium text-gray-700",children:"Field Targeting (Optional)"}),(0,s.jsx)("div",{className:"text-xs text-gray-500",children:"\uD83D\uDCA1 Tip: Leave empty to check entire payload"})]}),n.map(e=>{var l,t;return(0,s.jsxs)(f.Z,{className:"p-4 bg-gray-50",children:[(0,s.jsx)("div",{className:"text-sm font-medium text-gray-900 mb-3",children:e}),(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,s.jsxs)("label",{className:"text-xs text-gray-600 flex items-center",children:["Request Fields (pre_call)",(0,s.jsx)(c.Z,{title:(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"font-medium mb-1",children:"Specify which request fields to check"}),(0,s.jsxs)("div",{className:"text-xs space-y-1",children:[(0,s.jsx)("div",{children:"Examples:"}),(0,s.jsx)("div",{children:"• query"}),(0,s.jsx)("div",{children:"• documents[*].text"}),(0,s.jsx)("div",{children:"• messages[*].content"})]})]}),children:(0,s.jsx)(w.Z,{className:"ml-1 text-gray-400"})})]}),(0,s.jsxs)("div",{className:"flex gap-1",children:[(0,s.jsx)("button",{type:"button",onClick:()=>{var l;let t=(null===(l=m[e])||void 0===l?void 0:l.request_fields)||[];h(e,"request_fields",[...t,"query"])},className:"text-xs px-2 py-1 bg-white border border-gray-300 rounded hover:bg-gray-50",disabled:i,children:"+ query"}),(0,s.jsx)("button",{type:"button",onClick:()=>{var l;let t=(null===(l=m[e])||void 0===l?void 0:l.request_fields)||[];h(e,"request_fields",[...t,"documents[*]"])},className:"text-xs px-2 py-1 bg-white border border-gray-300 rounded hover:bg-gray-50",disabled:i,children:"+ documents[*]"})]})]}),(0,s.jsx)(v.default,{mode:"tags",style:{width:"100%"},placeholder:"Type field name or use + buttons above (e.g., query, documents[*].text)",value:(null===(l=m[e])||void 0===l?void 0:l.request_fields)||[],onChange:l=>h(e,"request_fields",l),disabled:i,tokenSeparators:[","]})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,s.jsxs)("label",{className:"text-xs text-gray-600 flex items-center",children:["Response Fields (post_call)",(0,s.jsx)(c.Z,{title:(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"font-medium mb-1",children:"Specify which response fields to check"}),(0,s.jsxs)("div",{className:"text-xs space-y-1",children:[(0,s.jsx)("div",{children:"Examples:"}),(0,s.jsx)("div",{children:"• results[*].text"}),(0,s.jsx)("div",{children:"• choices[*].message.content"})]})]}),children:(0,s.jsx)(w.Z,{className:"ml-1 text-gray-400"})})]}),(0,s.jsx)("div",{className:"flex gap-1",children:(0,s.jsx)("button",{type:"button",onClick:()=>{var l;let t=(null===(l=m[e])||void 0===l?void 0:l.response_fields)||[];h(e,"response_fields",[...t,"results[*]"])},className:"text-xs px-2 py-1 bg-white border border-gray-300 rounded hover:bg-gray-50",disabled:i,children:"+ results[*]"})})]}),(0,s.jsx)(v.default,{mode:"tags",style:{width:"100%"},placeholder:"Type field name or use + buttons above (e.g., results[*].text)",value:(null===(t=m[e])||void 0===t?void 0:t.response_fields)||[],onChange:l=>h(e,"response_fields",l),disabled:i,tokenSeparators:[","]})]})]})]},e)})]})]})};let{Option:V}=v.default;var D=e=>{let{accessToken:l,setPassThroughItems:t,passThroughItems:i,premiumUser:n=!1}=e,[m]=_.Z.useForm(),[u,h]=(0,a.useState)(!1),[x,v]=(0,a.useState)(!1),[C,S]=(0,a.useState)(""),[k,A]=(0,a.useState)(""),[E,I]=(0,a.useState)(""),[L,R]=(0,a.useState)(!0),[V,D]=(0,a.useState)(!1),[z,q]=(0,a.useState)({}),B=()=>{m.resetFields(),A(""),I(""),R(!0),q({}),h(!1)},U=e=>{let l=e;e&&!e.startsWith("/")&&(l="/"+e),A(l),m.setFieldsValue({path:l})},G=async e=>{console.log("addPassThrough called with:",e),v(!0);try{!n&&"auth"in e&&delete e.auth,z&&Object.keys(z).length>0&&(e.guardrails=z),console.log("formValues: ".concat(JSON.stringify(e)));let s=(await (0,d.createPassThroughEndpoint)(l,e)).endpoints[0],a=[...i,s];t(a),P.Z.success("Pass-through endpoint created successfully"),m.resetFields(),A(""),I(""),R(!0),q({}),h(!1)}catch(e){P.Z.fromBackend("Error creating pass-through endpoint: "+e)}finally{v(!1)}};return(0,s.jsxs)("div",{children:[(0,s.jsx)(r.Z,{className:"mx-auto mb-4 mt-4",onClick:()=>h(!0),children:"+ Add Pass-Through Endpoint"}),(0,s.jsx)(y.Z,{title:(0,s.jsxs)("div",{className:"flex items-center space-x-3 pb-4 border-b border-gray-100",children:[(0,s.jsx)(Z.Z,{className:"text-xl text-blue-500"}),(0,s.jsx)("h2",{className:"text-xl font-semibold text-gray-900",children:"Add Pass-Through Endpoint"})]}),open:u,width:1e3,onCancel:B,footer:null,className:"top-8",styles:{body:{padding:"24px"},header:{padding:"24px 24px 0 24px",border:"none"}},children:(0,s.jsxs)("div",{className:"mt-6",children:[(0,s.jsx)(b.Z,{message:"What is a Pass-Through Endpoint?",description:"Route requests from your LiteLLM proxy to any external API. Perfect for custom models, image generation APIs, or any service you want to proxy through LiteLLM.",type:"info",showIcon:!0,className:"mb-6"}),(0,s.jsxs)(_.Z,{form:m,onFinish:G,layout:"vertical",className:"space-y-6",initialValues:{include_subpath:!0,path:k,target:E},children:[(0,s.jsxs)(f.Z,{className:"p-5",children:[(0,s.jsx)(o.Z,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Route Configuration"}),(0,s.jsx)(j.Z,{className:"text-gray-600 mb-5",children:"Configure how requests to your domain will be forwarded to the target API"}),(0,s.jsxs)("div",{className:"space-y-5",children:[(0,s.jsx)(_.Z.Item,{label:(0,s.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Path Prefix"}),name:"path",rules:[{required:!0,message:"Path is required",pattern:/^\//}],extra:(0,s.jsx)("div",{className:"text-xs text-gray-500 mt-1",children:"Example: /bria, /adobe-photoshop, /elasticsearch"}),className:"mb-4",children:(0,s.jsx)("div",{className:"flex items-center",children:(0,s.jsx)(g.Z,{placeholder:"bria",value:k,onChange:e=>U(e.target.value),className:"flex-1"})})}),(0,s.jsx)(_.Z.Item,{label:(0,s.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Target URL"}),name:"target",rules:[{required:!0,message:"Target URL is required"},{type:"url",message:"Please enter a valid URL"}],extra:(0,s.jsx)("div",{className:"text-xs text-gray-500 mt-1",children:"Example:https://engine.prod.bria-api.com"}),className:"mb-4",children:(0,s.jsx)(g.Z,{placeholder:"https://engine.prod.bria-api.com",value:E,onChange:e=>{I(e.target.value),m.setFieldsValue({target:e.target.value})}})}),(0,s.jsxs)("div",{className:"flex items-center justify-between py-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-sm font-medium text-gray-700",children:"Include Subpaths"}),(0,s.jsx)("div",{className:"text-xs text-gray-500 mt-0.5",children:"Forward all subpaths to the target API (recommended for REST APIs)"})]}),(0,s.jsx)(_.Z.Item,{name:"include_subpath",valuePropName:"checked",className:"mb-0",children:(0,s.jsx)(p.Z,{checked:L,onChange:R})})]})]})]}),(0,s.jsx)(F,{pathValue:k,targetValue:E,includeSubpath:L}),(0,s.jsxs)(f.Z,{className:"p-6",children:[(0,s.jsx)(o.Z,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Headers"}),(0,s.jsx)(j.Z,{className:"text-gray-600 mb-6",children:"Add headers that will be sent with every request to the target API"}),(0,s.jsx)(_.Z.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Authentication Headers",(0,s.jsx)(c.Z,{title:"Authentication and other headers to forward with requests",children:(0,s.jsx)(w.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"headers",rules:[{required:!0,message:"Please configure the headers"}],extra:(0,s.jsxs)("div",{className:"text-xs text-gray-500 mt-2",children:[(0,s.jsx)("div",{className:"font-medium mb-1",children:"Add authentication tokens and other required headers"}),(0,s.jsx)("div",{children:"Common examples: auth_token, Authorization, x-api-key"})]}),children:(0,s.jsx)(M,{})})]}),(0,s.jsx)(T,{premiumUser:n,authEnabled:V,onAuthChange:e=>{D(e),m.setFieldsValue({auth:e})}}),(0,s.jsx)(O,{accessToken:l,value:z,onChange:q}),(0,s.jsxs)(f.Z,{className:"p-6",children:[(0,s.jsx)(o.Z,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Billing"}),(0,s.jsx)(j.Z,{className:"text-gray-600 mb-6",children:"Optional cost tracking for this endpoint"}),(0,s.jsx)(_.Z.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Cost Per Request (USD)",(0,s.jsx)(c.Z,{title:"Optional: Track costs for requests to this endpoint",children:(0,s.jsx)(w.Z,{className:"ml-2 text-gray-400 hover:text-gray-600"})})]}),name:"cost_per_request",extra:(0,s.jsx)("div",{className:"text-xs text-gray-500 mt-2",children:"The cost charged for each request through this endpoint"}),children:(0,s.jsx)(N.Z,{min:0,step:.001,precision:4,placeholder:"2.0000",size:"large"})})]}),(0,s.jsxs)("div",{className:"flex items-center justify-end space-x-3 pt-6 border-t border-gray-100",children:[(0,s.jsx)(r.Z,{variant:"secondary",onClick:B,children:"Cancel"}),(0,s.jsx)(r.Z,{variant:"primary",loading:x,onClick:()=>{console.log("Submit button clicked"),m.submit()},children:x?"Creating...":"Add Pass-Through Endpoint"})]})]})]})})]})},z=t(30078),q=t(4260),B=t(19015),U=t(87769),G=t(42208);let H=e=>{let{value:l}=e,[t,r]=(0,a.useState)(!1),i=JSON.stringify(l,null,2);return(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("pre",{className:"font-mono text-xs bg-gray-50 p-2 rounded max-w-md overflow-auto",children:t?i:"••••••••"}),(0,s.jsx)("button",{onClick:()=>r(!t),className:"p-1 hover:bg-gray-100 rounded",type:"button",children:t?(0,s.jsx)(U.Z,{className:"w-4 h-4 text-gray-500"}):(0,s.jsx)(G.Z,{className:"w-4 h-4 text-gray-500"})})]})};var K=e=>{let{endpointData:l,onClose:t,accessToken:r,isAdmin:i,premiumUser:n=!1,onEndpointUpdated:o}=e,[c,m]=(0,a.useState)(l),[u,h]=(0,a.useState)(!1),[x,p]=(0,a.useState)(!1),[g,f]=(0,a.useState)((null==l?void 0:l.auth)||!1),[j,v]=(0,a.useState)((null==l?void 0:l.guardrails)||{}),[y]=_.Z.useForm(),b=async e=>{try{if(!r||!(null==c?void 0:c.id))return;let l={};if(e.headers)try{l="string"==typeof e.headers?JSON.parse(e.headers):e.headers}catch(e){P.Z.fromBackend("Invalid JSON format for headers");return}let t={path:c.path,target:e.target,headers:l,include_subpath:e.include_subpath,cost_per_request:e.cost_per_request,auth:n?e.auth:void 0,guardrails:j&&Object.keys(j).length>0?j:void 0};await (0,d.updatePassThroughEndpoint)(r,c.id,t),m({...c,...t}),p(!1),o&&o()}catch(e){console.error("Error updating endpoint:",e),P.Z.fromBackend("Failed to update pass through endpoint")}},N=async()=>{try{if(!r||!(null==c?void 0:c.id))return;await (0,d.deletePassThroughEndpointsCall)(r,c.id),P.Z.success("Pass through endpoint deleted successfully"),t(),o&&o()}catch(e){console.error("Error deleting endpoint:",e),P.Z.fromBackend("Failed to delete pass through endpoint")}};return u?(0,s.jsx)("div",{className:"p-4",children:"Loading..."}):c?(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsx)("div",{className:"flex justify-between items-center mb-6",children:(0,s.jsxs)("div",{children:[(0,s.jsx)(S.ZP,{onClick:t,className:"mb-4",children:"← Back"}),(0,s.jsxs)(z.Dx,{children:["Pass Through Endpoint: ",c.path]}),(0,s.jsx)(z.xv,{className:"text-gray-500 font-mono",children:c.id})]})}),(0,s.jsxs)(z.v0,{children:[(0,s.jsxs)(z.td,{className:"mb-4",children:[(0,s.jsx)(z.OK,{children:"Overview"},"overview"),i?(0,s.jsx)(z.OK,{children:"Settings"},"settings"):(0,s.jsx)(s.Fragment,{})]}),(0,s.jsxs)(z.nP,{children:[(0,s.jsxs)(z.x4,{children:[(0,s.jsxs)(z.rj,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,s.jsxs)(z.Zb,{children:[(0,s.jsx)(z.xv,{children:"Path"}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(z.Dx,{className:"font-mono",children:c.path})})]}),(0,s.jsxs)(z.Zb,{children:[(0,s.jsx)(z.xv,{children:"Target"}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(z.Dx,{children:c.target})})]}),(0,s.jsxs)(z.Zb,{children:[(0,s.jsx)(z.xv,{children:"Configuration"}),(0,s.jsxs)("div",{className:"mt-2 space-y-2",children:[(0,s.jsx)("div",{children:(0,s.jsx)(z.Ct,{color:c.include_subpath?"green":"gray",children:c.include_subpath?"Include Subpath":"Exact Path"})}),(0,s.jsx)("div",{children:(0,s.jsx)(z.Ct,{color:c.auth?"blue":"gray",children:c.auth?"Auth Required":"No Auth"})}),void 0!==c.cost_per_request&&(0,s.jsx)("div",{children:(0,s.jsxs)(z.xv,{children:["Cost per request: $",c.cost_per_request]})})]})]})]}),(0,s.jsx)("div",{className:"mt-6",children:(0,s.jsx)(F,{pathValue:c.path,targetValue:c.target,includeSubpath:c.include_subpath||!1})}),c.headers&&Object.keys(c.headers).length>0&&(0,s.jsxs)(z.Zb,{className:"mt-6",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(z.xv,{className:"font-medium",children:"Headers"}),(0,s.jsxs)(z.Ct,{color:"blue",children:[Object.keys(c.headers).length," headers configured"]})]}),(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(H,{value:c.headers})})]}),c.guardrails&&Object.keys(c.guardrails).length>0&&(0,s.jsxs)(z.Zb,{className:"mt-6",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(z.xv,{className:"font-medium",children:"Guardrails"}),(0,s.jsxs)(z.Ct,{color:"purple",children:[Object.keys(c.guardrails).length," guardrails configured"]})]}),(0,s.jsx)("div",{className:"mt-4 space-y-2",children:Object.entries(c.guardrails).map(e=>{let[l,t]=e;return(0,s.jsxs)("div",{className:"p-3 bg-gray-50 rounded",children:[(0,s.jsx)("div",{className:"font-medium text-sm",children:l}),t&&(t.request_fields||t.response_fields)&&(0,s.jsxs)("div",{className:"mt-2 text-xs text-gray-600 space-y-1",children:[t.request_fields&&(0,s.jsxs)("div",{children:["Request fields: ",t.request_fields.join(", ")]}),t.response_fields&&(0,s.jsxs)("div",{children:["Response fields: ",t.response_fields.join(", ")]})]}),!t&&(0,s.jsx)("div",{className:"text-xs text-gray-600 mt-1",children:"Uses entire payload"})]},l)})})]})]}),i&&(0,s.jsx)(z.x4,{children:(0,s.jsxs)(z.Zb,{children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,s.jsx)(z.Dx,{children:"Pass Through Endpoint Settings"}),(0,s.jsx)("div",{className:"space-x-2",children:!x&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(z.zx,{onClick:()=>p(!0),children:"Edit Settings"}),(0,s.jsx)(z.zx,{onClick:N,variant:"secondary",color:"red",children:"Delete Endpoint"})]})})]}),x?(0,s.jsxs)(_.Z,{form:y,onFinish:b,initialValues:{target:c.target,headers:c.headers?JSON.stringify(c.headers,null,2):"",include_subpath:c.include_subpath||!1,cost_per_request:c.cost_per_request,auth:c.auth||!1},layout:"vertical",children:[(0,s.jsx)(_.Z.Item,{label:"Target URL",name:"target",rules:[{required:!0,message:"Please input a target URL"}],children:(0,s.jsx)(z.oi,{placeholder:"https://api.example.com"})}),(0,s.jsx)(_.Z.Item,{label:"Headers (JSON)",name:"headers",children:(0,s.jsx)(q.default.TextArea,{rows:5,placeholder:'{"Authorization": "Bearer your-token", "Content-Type": "application/json"}'})}),(0,s.jsx)(_.Z.Item,{label:"Include Subpath",name:"include_subpath",valuePropName:"checked",children:(0,s.jsx)(L.Z,{})}),(0,s.jsx)(_.Z.Item,{label:"Cost per Request",name:"cost_per_request",children:(0,s.jsx)(B.Z,{min:0,step:.01,precision:2,placeholder:"0.00",addonBefore:"$"})}),(0,s.jsx)(T,{premiumUser:n,authEnabled:g,onAuthChange:e=>{f(e),y.setFieldsValue({auth:e})}}),(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(O,{accessToken:r||"",value:j,onChange:v})}),(0,s.jsxs)("div",{className:"flex justify-end gap-2 mt-6",children:[(0,s.jsx)(S.ZP,{onClick:()=>p(!1),children:"Cancel"}),(0,s.jsx)(z.zx,{children:"Save Changes"})]})]}):(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(z.xv,{className:"font-medium",children:"Path"}),(0,s.jsx)("div",{className:"font-mono",children:c.path})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(z.xv,{className:"font-medium",children:"Target URL"}),(0,s.jsx)("div",{children:c.target})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(z.xv,{className:"font-medium",children:"Include Subpath"}),(0,s.jsx)(z.Ct,{color:c.include_subpath?"green":"gray",children:c.include_subpath?"Yes":"No"})]}),void 0!==c.cost_per_request&&(0,s.jsxs)("div",{children:[(0,s.jsx)(z.xv,{className:"font-medium",children:"Cost per Request"}),(0,s.jsxs)("div",{children:["$",c.cost_per_request]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(z.xv,{className:"font-medium",children:"Authentication Required"}),(0,s.jsx)(z.Ct,{color:c.auth?"green":"gray",children:c.auth?"Yes":"No"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(z.xv,{className:"font-medium",children:"Headers"}),c.headers&&Object.keys(c.headers).length>0?(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(H,{value:c.headers})}):(0,s.jsx)("div",{className:"text-gray-500",children:"No headers configured"})]})]})]})})]})]})]}):(0,s.jsx)("div",{className:"p-4",children:"Pass through endpoint not found"})},J=t(12322);let W=e=>{let{value:l}=e,[t,r]=(0,a.useState)(!1),i=JSON.stringify(l);return(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("span",{className:"font-mono text-xs",children:t?i:"••••••••"}),(0,s.jsx)("button",{onClick:()=>r(!t),className:"p-1 hover:bg-gray-100 rounded",type:"button",children:t?(0,s.jsx)(U.Z,{className:"w-4 h-4 text-gray-500"}):(0,s.jsx)(G.Z,{className:"w-4 h-4 text-gray-500"})})]})};var Y=e=>{let{accessToken:l,userRole:t,userID:p,modelData:g,premiumUser:f}=e,[j,v]=(0,a.useState)([]),[_,y]=(0,a.useState)(null),[b,N]=(0,a.useState)(!1),[Z,w]=(0,a.useState)(null);(0,a.useEffect)(()=>{l&&t&&p&&(0,d.getPassThroughEndpointsCall)(l).then(e=>{v(e.endpoints)})},[l,t,p]);let C=async e=>{w(e),N(!0)},S=async()=>{if(null!=Z&&l){try{await (0,d.deletePassThroughEndpointsCall)(l,Z);let e=j.filter(e=>e.id!==Z);v(e),P.Z.success("Endpoint deleted successfully.")}catch(e){console.error("Error deleting the endpoint:",e),P.Z.fromBackend("Error deleting the endpoint: "+e)}N(!1),w(null)}},k=(e,l)=>{C(e)},A=[{header:"ID",accessorKey:"id",cell:e=>(0,s.jsx)(c.Z,{title:e.row.original.id,children:(0,s.jsx)("div",{className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[15ch]",onClick:()=>e.row.original.id&&y(e.row.original.id),children:e.row.original.id})})},{header:"Path",accessorKey:"path"},{header:"Target",accessorKey:"target",cell:e=>(0,s.jsx)(n.Z,{children:e.getValue()})},{header:()=>(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)("span",{children:"Authentication"}),(0,s.jsx)(c.Z,{title:"LiteLLM Virtual Key required to call endpoint",children:(0,s.jsx)(u.Z,{className:"w-4 h-4 text-gray-400 cursor-help"})})]}),accessorKey:"auth",cell:e=>(0,s.jsx)(m.Z,{color:e.getValue()?"green":"gray",children:e.getValue()?"Yes":"No"})},{header:"Headers",accessorKey:"headers",cell:e=>(0,s.jsx)(W,{value:e.getValue()||{}})},{header:"Actions",id:"actions",cell:e=>{let{row:l}=e;return(0,s.jsxs)("div",{className:"flex space-x-1",children:[(0,s.jsx)(i.Z,{icon:h.Z,size:"sm",onClick:()=>l.original.id&&y(l.original.id),title:"Edit"}),(0,s.jsx)(i.Z,{icon:x.Z,size:"sm",onClick:()=>k(l.original.id,l.index),title:"Delete"})]})}}];if(!l)return null;if(_){console.log("selectedEndpointId",_),console.log("generalSettings",j);let e=j.find(e=>e.id===_);return e?(0,s.jsx)(K,{endpointData:e,onClose:()=>y(null),accessToken:l,isAdmin:"Admin"===t||"admin"===t,premiumUser:f,onEndpointUpdated:()=>{l&&(0,d.getPassThroughEndpointsCall)(l).then(e=>{v(e.endpoints)})}}):(0,s.jsx)("div",{children:"Endpoint not found"})}return(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(o.Z,{children:"Pass Through Endpoints"}),(0,s.jsx)(n.Z,{className:"text-tremor-content",children:"Configure and manage your pass-through endpoints"})]}),(0,s.jsx)(D,{accessToken:l,setPassThroughItems:v,passThroughItems:j,premiumUser:f}),(0,s.jsx)(J.w,{data:j,columns:A,renderSubComponent:()=>(0,s.jsx)("div",{}),getRowCanExpand:()=>!1,isLoading:!1,noDataMessage:"No pass-through endpoints configured"}),b&&(0,s.jsx)("div",{className:"fixed z-10 inset-0 overflow-y-auto",children:(0,s.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,s.jsx)("div",{className:"fixed inset-0 transition-opacity","aria-hidden":"true",children:(0,s.jsx)("div",{className:"absolute inset-0 bg-gray-500 opacity-75"})}),(0,s.jsx)("span",{className:"hidden sm:inline-block sm:align-middle sm:h-screen","aria-hidden":"true",children:"​"}),(0,s.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,s.jsx)("div",{className:"bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4",children:(0,s.jsx)("div",{className:"sm:flex sm:items-start",children:(0,s.jsxs)("div",{className:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left",children:[(0,s.jsx)("h3",{className:"text-lg leading-6 font-medium text-gray-900",children:"Delete Pass-Through Endpoint"}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)("p",{className:"text-sm text-gray-500",children:"Are you sure you want to delete this pass-through endpoint? This action cannot be undone."})})]})})}),(0,s.jsxs)("div",{className:"bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse",children:[(0,s.jsx)(r.Z,{onClick:S,color:"red",className:"ml-2",children:"Delete"}),(0,s.jsx)(r.Z,{onClick:()=>{N(!1),w(null)},children:"Cancel"})]})]})]})})]})}},39789:function(e,l,t){t.d(l,{Z:function(){return n}});var s=t(57437),a=t(2265),r=t(88237),i=t(84264),n=e=>{let{value:l,onValueChange:t,label:n="Select Time Range",className:o="",showTimeRange:d=!0}=e,[c,m]=(0,a.useState)(!1),u=(0,a.useRef)(null),h=(0,a.useCallback)(e=>{m(!0),setTimeout(()=>m(!1),1500),t(e),requestIdleCallback(()=>{if(e.from){let l;let s={...e},a=new Date(e.from);l=new Date(e.to?e.to:e.from),a.toDateString(),l.toDateString(),a.setHours(0,0,0,0),l.setHours(23,59,59,999),s.from=a,s.to=l,t(s)}},{timeout:100})},[t]),x=(0,a.useCallback)((e,l)=>{if(!e||!l)return"";let t=e=>e.toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0,timeZoneName:"short"});if(e.toDateString()!==l.toDateString())return"".concat(t(e)," - ").concat(t(l));{let t=e.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),s=e.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!0}),a=l.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!0,timeZoneName:"short"});return"".concat(t,": ").concat(s," - ").concat(a)}},[]);return(0,s.jsxs)("div",{className:o,children:[n&&(0,s.jsx)(i.Z,{className:"mb-2",children:n}),(0,s.jsxs)("div",{className:"relative w-fit",children:[(0,s.jsx)("div",{ref:u,children:(0,s.jsx)(r.Z,{enableSelect:!0,value:l,onValueChange:h,placeholder:"Select date range",enableClear:!1,style:{zIndex:100}})}),c&&(0,s.jsx)("div",{className:"absolute top-1/2 animate-pulse",style:{left:"calc(100% + 8px)",transform:"translateY(-50%)",zIndex:110},children:(0,s.jsxs)("div",{className:"flex items-center gap-1 text-green-600 text-sm font-medium bg-white px-2 py-1 rounded-full border border-green-200 shadow-sm whitespace-nowrap",children:[(0,s.jsx)("div",{className:"w-3 h-3 bg-green-500 text-white rounded-full flex items-center justify-center text-xs",children:"✓"}),(0,s.jsx)("span",{className:"text-xs",children:"Selected"})]})})]}),d&&l.from&&l.to&&(0,s.jsx)(i.Z,{className:"mt-2 text-xs text-gray-500",children:x(l.from,l.to)})]})}},12322:function(e,l,t){t.d(l,{w:function(){return o}});var s=t(57437),a=t(2265),r=t(71594),i=t(24525),n=t(19130);function o(e){let{data:l=[],columns:t,getRowCanExpand:o,renderSubComponent:d,isLoading:c=!1,loadingMessage:m="\uD83D\uDE85 Loading logs...",noDataMessage:u="No logs found"}=e,h=(0,r.b7)({data:l,columns:t,getRowCanExpand:o,getRowId:(e,l)=>{var t;return null!==(t=null==e?void 0:e.request_id)&&void 0!==t?t:String(l)},getCoreRowModel:(0,i.sC)(),getExpandedRowModel:(0,i.rV)()});return(0,s.jsx)("div",{className:"rounded-lg custom-border overflow-x-auto w-full max-w-full box-border",children:(0,s.jsxs)(n.iA,{className:"[&_td]:py-0.5 [&_th]:py-1 table-fixed w-full box-border",style:{minWidth:"400px"},children:[(0,s.jsx)(n.ss,{children:h.getHeaderGroups().map(e=>(0,s.jsx)(n.SC,{children:e.headers.map(e=>(0,s.jsx)(n.xs,{className:"py-1 h-8",children:e.isPlaceholder?null:(0,r.ie)(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,s.jsx)(n.RM,{children:c?(0,s.jsx)(n.SC,{children:(0,s.jsx)(n.pj,{colSpan:t.length,className:"h-8 text-center",children:(0,s.jsx)("div",{className:"text-center text-gray-500",children:(0,s.jsx)("p",{children:m})})})}):h.getRowModel().rows.length>0?h.getRowModel().rows.map(e=>(0,s.jsxs)(a.Fragment,{children:[(0,s.jsx)(n.SC,{className:"h-8",children:e.getVisibleCells().map(e=>(0,s.jsx)(n.pj,{className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap",children:(0,r.ie)(e.column.columnDef.cell,e.getContext())},e.id))}),e.getIsExpanded()&&(0,s.jsx)(n.SC,{children:(0,s.jsx)(n.pj,{colSpan:e.getVisibleCells().length,className:"p-0",children:(0,s.jsx)("div",{className:"w-full max-w-full overflow-hidden box-border",children:d({row:e})})})})]},e.id)):(0,s.jsx)(n.SC,{children:(0,s.jsx)(n.pj,{colSpan:t.length,className:"h-8 text-center",children:(0,s.jsx)("div",{className:"text-center text-gray-500",children:(0,s.jsx)("p",{children:u})})})})})]})})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1518-3d9170796eddc9f1.js b/litellm/proxy/_experimental/out/_next/static/chunks/1518-3d9170796eddc9f1.js deleted file mode 100644 index 6c15e1df5a..0000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/1518-3d9170796eddc9f1.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1518],{81518:function(e,s,a){a.r(s),a.d(s,{default:function(){return Q}});var t=a(57437),r=a(2265),n=a(75301),l=a(9114),i=a(26430),o=a(96473),d=a(50010),c=a(26349),m=a(37592),u=a(4260),x=a(99981),h=a(5545),g=a(93837),p=a(27930),v=a(66830),f=a(95459),j=a(10703),y=a(32489),b=a(98728),N=a(79862),w=a(82222),k=a(51817),A=a(62831),S=a(17906),C=a(94263),T=a(88712),L=a(94331),Z=a(38398),P=a(33152);function _(e){let{messages:s,isLoading:a}=e;if(0===s.length)return(0,t.jsx)("div",{className:"h-full"});let r=[],n=0;for(;n(0,t.jsxs)("div",{className:"whitespace-pre-wrap break-words",style:{wordWrap:"break-word",overflowWrap:"break-word",wordBreak:"break-word",hyphens:"auto"},children:[(0,t.jsx)(T.Z,{message:e}),(0,t.jsx)(A.UG,{components:{code(e){let{node:s,inline:a,className:r,children:n,...l}=e,i=/language-(\w+)/.exec(r||"");return!a&&i?(0,t.jsx)(S.Z,{style:C.Z,language:i[1],PreTag:"div",className:"rounded-md my-2",wrapLines:!0,wrapLongLines:!0,...l,children:String(n).replace(/\n$/,"")}):(0,t.jsx)("code",{className:"".concat(r," px-1.5 py-0.5 rounded bg-gray-100 text-sm font-mono"),...l,children:n})},pre:e=>{let{node:s,...a}=e;return(0,t.jsx)("pre",{style:{overflowX:"auto",maxWidth:"100%"},...a})}},children:"string"==typeof e.content?e.content:""})]});return(0,t.jsxs)("div",{className:"flex flex-col gap-6 min-w-0 w-full p-4",children:[r.map((e,s)=>{let n=e.assistant,i=(null==n?void 0:n.model)||"Assistant";return(0,t.jsxs)("div",{className:"space-y-4",children:[e.user&&(0,t.jsxs)("div",{className:"space-y-2 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-blue-100 text-blue-600",children:(0,t.jsx)(N.Z,{size:16})}),(0,t.jsx)("div",{className:"text-sm font-semibold text-gray-700",children:"You"})]}),l(e.user)]}),(0,t.jsx)("div",{className:"border-t border-gray-200"}),n?(0,t.jsxs)("div",{className:"space-y-3 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-gray-100 text-gray-600",children:(0,t.jsx)(w.Z,{size:16})}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-sm font-semibold text-gray-700",children:i}),n.toolName&&(0,t.jsx)("span",{className:"rounded bg-gray-100 px-2 py-0.5 text-xs text-gray-600",children:n.toolName})]})]}),n.reasoningContent&&(0,t.jsx)(L.Z,{reasoningContent:n.reasoningContent}),n.searchResults&&(0,t.jsx)(P.J,{searchResults:n.searchResults}),l(n),(n.timeToFirstToken||n.totalLatency||n.usage)&&(0,t.jsx)(Z.Z,{timeToFirstToken:n.timeToFirstToken,totalLatency:n.totalLatency,usage:n.usage,toolName:n.toolName})]}):a&&s===r.length-1?(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[(0,t.jsx)(k.Z,{size:18,className:"animate-spin"}),(0,t.jsx)("span",{children:"Generating response..."})]}):(0,t.jsx)("div",{className:"text-sm text-gray-500",children:"Waiting for a response..."})]},s)}),a&&0===r.length&&(0,t.jsxs)("div",{className:"flex items-center gap-2 text-gray-500",children:[(0,t.jsx)(k.Z,{size:18,className:"animate-spin"}),(0,t.jsx)("span",{children:"Generating response..."})]})]})}var M=a(31283);function E(e){let{value:s,onChange:a,models:n,loading:l,disabled:i}=e,[o,d]=(0,r.useState)(!1),[c,u]=(0,r.useState)(""),x=(0,r.useMemo)(()=>Array.from(new Set(n)).sort(),[n]),h=(0,r.useMemo)(()=>s&&!x.includes(s)?[s,...x]:x,[x,s]),g=o?"__custom__":s||void 0,p=()=>{let e=c.trim();if(!e){d(!1),u("");return}a(e),d(!1),u("")};return(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)(m.default,{value:g,onChange:e=>{if("__custom__"===e){d(!0),s&&!x.includes(s)?u(s):u("");return}d(!1),u(""),a(e)},disabled:i,loading:l,placeholder:l?"Loading models...":"Select a model",className:"w-full rounded-md",showSearch:!0,optionFilterProp:"children",children:[h.map(e=>(0,t.jsx)(m.default.Option,{value:e,children:e},e)),(0,t.jsx)(m.default.Option,{value:"__custom__",children:"+ Add custom model"})]}),o&&(0,t.jsx)(M.o,{className:"mt-2",placeholder:"Custom Model Name (Enter to add)",value:c,onValueChange:u,onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),p())},onBlur:p,autoFocus:!0})]})}var U=a(99020),R=a(97415),I=a(67479),O=a(4156),z=a(23496),K=a(85847),D=a(79326);function B(e){let{comparison:s,onUpdate:a,onRemove:n,canRemove:l,modelOptions:i,isLoadingModels:o,apiKey:d}=e,[c,m]=(0,r.useState)(!1),u=e=>{e?a({applyAcrossModels:!0,temperature:s.temperature,maxTokens:s.maxTokens,tags:[...s.tags],vectorStores:[...s.vectorStores],guardrails:[...s.guardrails],useAdvancedParams:s.useAdvancedParams},{applyToAll:!0,keysToApply:["temperature","maxTokens","tags","vectorStores","guardrails","useAdvancedParams"]}):a({applyAcrossModels:!1})},x=e=>{a({useAdvancedParams:e},s.applyAcrossModels?{applyToAll:!0,keysToApply:["useAdvancedParams"]}:void 0)},h=(e,t)=>{a({[e]:t},s.applyAcrossModels?{applyToAll:!0,keysToApply:[e]}:void 0)},g=s.useAdvancedParams?1:.4,p=s.useAdvancedParams?"text-gray-700":"text-gray-400",v=()=>{m(e=>!e)},f=(0,t.jsxs)("div",{className:"w-[300px] max-h-[65vh] overflow-y-auto relative",children:[(0,t.jsx)("button",{onClick:()=>{m(!1)},className:"absolute top-0 right-0 p-1 hover:bg-gray-100 rounded transition-colors text-gray-500 hover:text-gray-700 z-10",children:(0,t.jsx)(y.Z,{size:14})}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsx)(O.Z,{checked:s.applyAcrossModels,onChange:e=>u(e.target.checked),children:(0,t.jsx)("span",{className:"text-xs font-medium",children:"Sync Settings Across Models"})})}),(0,t.jsx)(z.Z,{className:"border-gray-200"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"text-xs font-semibold text-gray-700 mb-1.5 uppercase tracking-wide",children:"General Settings"}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-600 block mb-0.5",children:"Tags"}),(0,t.jsx)(U.Z,{value:s.tags,onChange:e=>h("tags",e),accessToken:d})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-600 block mb-0.5",children:"Vector Stores"}),(0,t.jsx)(R.Z,{value:s.vectorStores,onChange:e=>h("vectorStores",e),accessToken:d})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-600 block mb-0.5",children:"Guardrails"}),(0,t.jsx)(I.Z,{value:s.guardrails,onChange:e=>h("guardrails",e),accessToken:d})]})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"text-xs font-semibold text-gray-700 mb-1.5 uppercase tracking-wide",children:"Advanced Settings"}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("div",{className:"flex items-center gap-2 pb-1",children:(0,t.jsx)(O.Z,{checked:s.useAdvancedParams,onChange:e=>x(e.target.checked),children:(0,t.jsx)("span",{className:"text-sm font-medium",children:"Use Advanced Parameters"})})}),(0,t.jsxs)("div",{className:"space-y-2 transition-opacity duration-200",style:{opacity:g},children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,t.jsx)("label",{className:"text-xs font-medium ".concat(p),children:"Temperature"}),(0,t.jsx)("span",{className:"text-xs ".concat(p),children:s.temperature.toFixed(2)})]}),(0,t.jsx)(K.Z,{min:0,max:2,step:.01,value:s.temperature,onChange:e=>{h("temperature",Math.min(2,Math.max(0,Number((Array.isArray(e)?e[0]:e).toFixed(2)))))},disabled:!s.useAdvancedParams})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,t.jsx)("label",{className:"text-xs font-medium ".concat(p),children:"Max Tokens"}),(0,t.jsx)("span",{className:"text-xs ".concat(p),children:s.maxTokens})]}),(0,t.jsx)(K.Z,{min:1,max:32768,step:1,value:s.maxTokens,onChange:e=>{h("maxTokens",Math.min(32768,Math.max(1,Math.round(Array.isArray(e)?e[0]:e))))},disabled:!s.useAdvancedParams})]})]})]})]})]})]});return(0,t.jsxs)("div",{className:"bg-white first:border-l-0 border-l border-gray-200 flex flex-col min-h-0",children:[(0,t.jsxs)("div",{className:"border-b flex items-center justify-between gap-3 px-4 py-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 flex-1",children:[(0,t.jsx)(E,{value:s.model,models:i,loading:o,onChange:e=>a({model:e})}),(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsx)(D.Z,{content:f,trigger:[],open:c,onOpenChange:()=>{},placement:"bottomRight",destroyTooltipOnHide:!1,children:(0,t.jsx)("button",{onClick:e=>{e.stopPropagation(),v()},className:"p-2 rounded-lg transition-colors ".concat(c?"bg-gray-200 text-gray-700":"hover:bg-gray-100 text-gray-600"),children:(0,t.jsx)(b.Z,{size:18})})})})]}),l&&(0,t.jsx)("button",{onClick:e=>{e.stopPropagation(),n()},className:"p-2 hover:bg-red-50 text-red-600 rounded-lg transition-colors",children:(0,t.jsx)(y.Z,{size:18})})]}),(0,t.jsx)("div",{className:"relative flex-1 flex flex-col min-h-0",children:(0,t.jsx)("div",{className:"flex-1 max-h-[calc(100vh-385px)] overflow-auto rounded-b-2xl",children:(0,t.jsx)(_,{messages:s.messages,isLoading:s.isLoading})})})]})}var F=a(79276);let{TextArea:W}=u.default;function G(e){let{value:s,onChange:a,onSend:r,disabled:n,hasAttachment:l,uploadComponent:i}=e,o=!n&&(s.trim().length>0||!!l);return(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsxs)("div",{className:"flex items-center flex-1 bg-white border border-gray-300 rounded-xl px-3 py-1 min-h-[44px]",children:[i&&(0,t.jsx)("div",{className:"flex-shrink-0 mr-2",children:i}),(0,t.jsx)(W,{value:s,onChange:e=>a(e.target.value),onKeyDown:e=>{"Enter"===e.key&&!e.shiftKey&&(e.preventDefault(),o&&r())},placeholder:"Type your message... (Shift+Enter for new line)",disabled:n,className:"flex-1",autoSize:{minRows:1,maxRows:4},style:{resize:"none",border:"none",boxShadow:"none",background:"transparent",padding:"4px 0",fontSize:"14px",lineHeight:"20px"}}),(0,t.jsx)(h.ZP,{onClick:r,disabled:!o,icon:(0,t.jsx)(F.Z,{}),shape:"circle"})]})})}let V=["Can you summarize the key points?","What assumptions did you make?","What are the next steps?"],H=["Write me a poem","Explain quantum computing","Draft a polite email requesting a meeting"],X="/v1/chat/completions";function Y(e){let{accessToken:s,disabledPersonalKeyCreation:a}=e,[n,y]=(0,r.useState)([{id:"1",model:"",messages:[],isLoading:!1,tags:[],mcpTools:[],vectorStores:[],guardrails:[],temperature:1,maxTokens:2048,applyAcrossModels:!1,useAdvancedParams:!1},{id:"2",model:"",messages:[],isLoading:!1,tags:[],mcpTools:[],vectorStores:[],guardrails:[],temperature:1,maxTokens:2048,applyAcrossModels:!1,useAdvancedParams:!1}]),[b,N]=(0,r.useState)([]),[w,k]=(0,r.useState)(!1),[A,S]=(0,r.useState)(""),[C,T]=(0,r.useState)(null),[L,Z]=(0,r.useState)(null),[P,_]=(0,r.useState)(a?"custom":"session"),[M,E]=(0,r.useState)(""),[U,R]=(0,r.useState)("");(0,r.useEffect)(()=>{let e=setTimeout(()=>{R(M)},300);return()=>clearTimeout(e)},[M]),(0,r.useEffect)(()=>()=>{L&&URL.revokeObjectURL(L)},[L]);let I=(0,r.useMemo)(()=>"session"===P?s||"":U.trim(),[P,s,U]),O=(0,r.useMemo)(()=>n.length>0&&n.every(e=>!e.isLoading&&e.messages.some(e=>"assistant"===e.role)),[n]);(0,r.useEffect)(()=>{let e=!0;return(async()=>{if(!I){N([]);return}k(!0);try{let s=await (0,j.p)(I);if(!e)return;let a=Array.from(new Set(s.map(e=>e.model_group)));N(a)}catch(s){console.error("CompareUI: failed to fetch models",s),e&&N([])}finally{e&&k(!1)}})(),()=>{e=!1}},[I]),(0,r.useEffect)(()=>{0!==b.length&&y(e=>e.map((e,s)=>{var a,t,r,n,l;return{...e,temperature:null!==(a=e.temperature)&&void 0!==a?a:1,maxTokens:null!==(t=e.maxTokens)&&void 0!==t?t:2048,applyAcrossModels:null!==(r=e.applyAcrossModels)&&void 0!==r&&r,useAdvancedParams:null!==(n=e.useAdvancedParams)&&void 0!==n&&n,...e.model?{}:{model:null!==(l=b[s%b.length])&&void 0!==l?l:""}}}))},[b]);let z=e=>{n.length>1&&y(s=>s.filter(s=>s.id!==e))},K=(e,s,a)=>{y(t=>{var r;if((null==a?void 0:a.applyToAll)&&(null===(r=a.keysToApply)||void 0===r?void 0:r.length)){let r={};a.keysToApply.forEach(e=>{let a=s[e];void 0!==a&&(r[e]=Array.isArray(a)?[...a]:a)});let n=Object.keys(r).length>0;return t.map(a=>a.id===e?{...a,...s}:n?{...a,...r}:a)}return t.map(a=>a.id===e?{...a,...s}:a)})},D=()=>{L&&URL.revokeObjectURL(L),T(null),Z(null)},F=(e,s,a)=>{s&&y(t=>t.map(t=>{if(t.id!==e)return t;let r=[...t.messages],n=r[r.length-1];if(n&&"assistant"===n.role){var l;let e="string"==typeof n.content?n.content:"";r[r.length-1]={...n,content:e+s,model:null!==(l=n.model)&&void 0!==l?l:a}}else r.push({role:"assistant",content:s,model:a});return{...t,messages:r}}))},W=(e,s)=>{s&&y(a=>a.map(a=>{if(a.id!==e)return a;let t=[...a.messages],r=t[t.length-1];return r&&"assistant"===r.role?t[t.length-1]={...r,reasoningContent:(r.reasoningContent||"")+s}:r&&"user"===r.role&&t.push({role:"assistant",content:"",reasoningContent:s}),{...a,messages:t}}))},Y=(e,s)=>{y(a=>a.map(a=>{if(a.id!==e)return a;let t=[...a.messages],r=t[t.length-1];return r&&"assistant"===r.role?t[t.length-1]={...r,timeToFirstToken:s}:r&&"user"===r.role&&t.push({role:"assistant",content:"",timeToFirstToken:s}),{...a,messages:t}}))},q=(e,s)=>{y(a=>a.map(a=>{if(a.id!==e)return a;let t=[...a.messages],r=t[t.length-1];return r&&"assistant"===r.role?t[t.length-1]={...r,totalLatency:s}:r&&"user"===r.role&&t.push({role:"assistant",content:"",totalLatency:s}),{...a,messages:t}}))},J=(e,s,a)=>{y(t=>t.map(t=>{if(t.id!==e)return t;let r=[...t.messages],n=r[r.length-1];return n&&"assistant"===n.role&&(r[r.length-1]={...n,usage:s,toolName:a}),{...t,messages:r}}))},$=(e,s)=>{s&&y(a=>a.map(a=>{if(a.id!==e)return a;let t=[...a.messages],r=t[t.length-1];return r&&"assistant"===r.role&&(t[t.length-1]={...r,searchResults:s}),{...a,messages:t}}))},Q=!!s,ee=async e=>{let s=e.trim(),a=!!C;if(!s&&!a)return;if(!I){l.Z.fromBackend("Please provide a Virtual Key or select Current UI Session");return}if(0===n.length)return;if(n.some(e=>!e.model)){l.Z.fromBackend("Select a model before sending a message.");return}let t=a?await (0,v.Sn)(s,C):{role:"user",content:s},r=(0,v.Hk)(s,a,L||void 0,null==C?void 0:C.name),i=new Map;n.forEach(e=>{var s;let a=null!==(s=e.traceId)&&void 0!==s?s:(0,g.Z)(),n=[...e.messages.map(e=>{let{role:s,content:a}=e;return{role:s,content:Array.isArray(a)?a:"string"==typeof a?a:""}}),t];i.set(e.id,{id:e.id,model:e.model,traceId:a,tags:e.tags,vectorStores:e.vectorStores,guardrails:e.guardrails,temperature:e.temperature,maxTokens:e.maxTokens,displayMessages:[...e.messages,r],apiChatHistory:n})}),0!==i.size&&(y(e=>e.map(e=>{let s=i.get(e.id);return s?{...e,traceId:s.traceId,messages:s.displayMessages,isLoading:!0}:e})),S(""),D(),i.forEach(e=>{var s;let a=e.tags.length>0?e.tags:void 0,t=e.vectorStores.length>0?e.vectorStores:void 0,r=e.guardrails.length>0?e.guardrails:void 0,i=n.find(s=>s.id===e.id),o=null!==(s=null==i?void 0:i.useAdvancedParams)&&void 0!==s&&s;(0,f.n)(e.apiChatHistory,(s,a)=>F(e.id,s,a),e.model,I,a,void 0,s=>W(e.id,s),s=>Y(e.id,s),s=>J(e.id,s),e.traceId,t,r,void 0,void 0,s=>$(e.id,s),o?e.temperature:void 0,o?e.maxTokens:void 0,s=>q(e.id,s)).catch(s=>{let a=s instanceof Error?s.message:String(s);console.error("CompareUI: failed to fetch response",s),l.Z.fromBackend(a),y(s=>s.map(s=>{if(s.id!==e.id)return s;let t=[...s.messages],r=t[t.length-1],n=r&&"assistant"===r.role&&"string"==typeof r.content?r.content:"";return r&&"assistant"===r.role?t[t.length-1]={...r,content:n?"".concat(n,"\nError fetching response: ").concat(a):"Error fetching response: ".concat(a)}:t.push({role:"assistant",content:"Error fetching response: ".concat(a)}),{...s,messages:t}}))}).finally(()=>{y(s=>s.map(s=>s.id===e.id?{...s,isLoading:!1}:s))})}))},es=e=>{S(e)},ea=n.some(e=>e.messages.length>0),et=n.some(e=>e.isLoading),er=!!C,en=!!(null==C?void 0:C.name.toLowerCase().endsWith(".pdf")),el=!ea&&!et&&!er;return(0,t.jsx)("div",{className:"w-full h-full p-4 bg-white",children:(0,t.jsxs)("div",{className:"rounded-2xl border border-gray-200 bg-white shadow-sm min-h-[calc(100vh-160px)] flex flex-col",children:[(0,t.jsx)("div",{className:"border-b px-4 py-2",children:(0,t.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-gray-600",children:"Virtual Key Source"}),(0,t.jsxs)(m.default,{value:P,onChange:e=>_(e),disabled:a,className:"w-48",children:[(0,t.jsx)(m.default.Option,{value:"session",disabled:!Q,children:"Current UI Session"}),(0,t.jsx)(m.default.Option,{value:"custom",children:"Virtual Key"})]}),"custom"===P&&(0,t.jsx)(u.default.Password,{value:M,onChange:e=>E(e.target.value),placeholder:"Enter Virtual Key",className:"w-56"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-gray-600",children:"Endpoint"}),(0,t.jsx)(x.Z,{title:"Other endpoints will be available soon",children:(0,t.jsx)(m.default,{value:X,disabled:!0,className:"w-56",children:(0,t.jsx)(m.default.Option,{value:X,children:X})})})]}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)(h.ZP,{onClick:()=>{y(e=>e.map(e=>({...e,messages:[],traceId:void 0,isLoading:!1}))),S(""),D()},disabled:!ea,icon:(0,t.jsx)(i.Z,{}),children:"Clear All Chats"}),(0,t.jsx)(x.Z,{title:n.length>=3?"Compare up to 3 models at a time":"Add another comparison",children:(0,t.jsx)(h.ZP,{onClick:()=>{var e;if(n.length>=3)return;let s=null!==(e=b[n.length%(b.length||1)])&&void 0!==e?e:"",a={id:Date.now().toString(),model:s,messages:[],isLoading:!1,tags:[],mcpTools:[],vectorStores:[],guardrails:[],temperature:1,maxTokens:2048,applyAcrossModels:!1,useAdvancedParams:!1};y(e=>[...e,a])},disabled:n.length>=3,icon:(0,t.jsx)(o.Z,{}),children:"Add Comparison"})})]})]})}),(0,t.jsx)("div",{className:"grid flex-1 min-h-0 auto-rows-[minmax(0,1fr)]",style:{gridTemplateColumns:"repeat(".concat(n.length,", minmax(0, 1fr))")},children:n.map(e=>(0,t.jsx)(B,{comparison:e,onUpdate:(s,a)=>K(e.id,s,a),onRemove:()=>z(e.id),canRemove:n.length>1,modelOptions:b,isLoadingModels:w,apiKey:I},e.id))}),(0,t.jsx)("div",{className:"flex justify-center pb-4",children:(0,t.jsx)("div",{className:"w-full max-w-3xl px-4",children:(0,t.jsxs)("div",{className:"border border-gray-200 shadow-lg rounded-xl bg-white p-4",children:[(0,t.jsx)("div",{className:"flex items-center justify-between gap-4 mb-3 min-h-8",children:er?(0,t.jsx)("span",{className:"text-sm text-gray-500",children:"Attachment ready to send"}):el?(0,t.jsx)("div",{className:"flex items-center gap-2 overflow-x-auto",children:H.map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>es(e),className:"shrink-0 rounded-full border border-gray-200 px-3 py-1 text-xs font-medium text-gray-600 transition-colors hover:bg-gray-100 cursor-pointer",children:e},e))}):O&&!er?(0,t.jsx)("div",{className:"flex items-center gap-2 overflow-x-auto",children:V.map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>es(e),className:"shrink-0 rounded-full border border-gray-200 px-3 py-1 text-xs font-medium text-gray-600 transition-colors hover:bg-gray-100 cursor-pointer",children:e},e))}):et?(0,t.jsxs)("span",{className:"flex items-center gap-2 text-sm text-gray-500",children:[(0,t.jsx)("span",{className:"h-2 w-2 rounded-full bg-blue-500 animate-pulse","aria-hidden":!0}),"Gathering responses from all models..."]}):(0,t.jsx)("span",{className:"text-sm text-gray-500",children:"Send a prompt to compare models"})}),C&&(0,t.jsx)("div",{className:"mb-3",children:(0,t.jsxs)("div",{className:"flex items-center gap-3 p-3 bg-gray-50 rounded-lg border border-gray-200",children:[(0,t.jsx)("div",{className:"relative inline-block",children:en?(0,t.jsx)("div",{className:"w-10 h-10 rounded-md bg-red-500 flex items-center justify-center",children:(0,t.jsx)(d.Z,{style:{fontSize:"16px",color:"white"}})}):(0,t.jsx)("img",{src:L||"",alt:"Upload preview",className:"w-10 h-10 rounded-md border border-gray-200 object-cover"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("div",{className:"text-sm font-medium text-gray-900 truncate",children:C.name}),(0,t.jsx)("div",{className:"text-xs text-gray-500",children:en?"PDF":"Image"})]}),(0,t.jsx)("button",{className:"flex items-center justify-center w-6 h-6 text-gray-400 hover:text-gray-600 hover:bg-gray-200 rounded-full transition-colors",onClick:D,children:(0,t.jsx)(c.Z,{style:{fontSize:"12px"}})})]})}),(0,t.jsx)(G,{value:A,onChange:e=>{S(e)},onSend:()=>{ee(A)},disabled:0===n.length||n.every(e=>e.isLoading),hasAttachment:er,uploadComponent:(0,t.jsx)(p.Z,{chatUploadedImage:C,chatImagePreviewUrl:L,onImageUpload:e=>(L&&URL.revokeObjectURL(L),T(e),Z(URL.createObjectURL(e)),!1),onRemoveImage:D})})]})})})]})})}var q=a(58643),J=a(80443),$=a(91624);function Q(){let{accessToken:e,userRole:s,userId:a,disabledPersonalKeyCreation:l,token:i}=(0,J.Z)(),[o,d]=(0,r.useState)(void 0);return(0,r.useEffect)(()=>{(async()=>{if(e){let s=await (0,$.C)(e);s&&d({PROXY_BASE_URL:s.PROXY_BASE_URL,LITELLM_UI_API_DOC_BASE_URL:s.LITELLM_UI_API_DOC_BASE_URL})}})()},[e]),(0,t.jsxs)(q.v0,{className:"h-full w-full",children:[(0,t.jsxs)(q.td,{className:"mb-0",children:[(0,t.jsx)(q.OK,{children:"Chat"}),(0,t.jsx)(q.OK,{children:"Compare"})]}),(0,t.jsxs)(q.nP,{className:"h-full",children:[(0,t.jsx)(q.x4,{className:"h-full",children:(0,t.jsx)(n.Z,{accessToken:e,token:i,userRole:s,userID:a,disabledPersonalKeyCreation:l,proxySettings:o})}),(0,t.jsx)(q.x4,{className:"h-full",children:(0,t.jsx)(Y,{accessToken:e,disabledPersonalKeyCreation:l})})]})]})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1518-499d06fabfcafb58.js b/litellm/proxy/_experimental/out/_next/static/chunks/1518-499d06fabfcafb58.js new file mode 100644 index 0000000000..f510aabc7d --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/1518-499d06fabfcafb58.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1518],{81518:function(e,s,a){a.r(s),a.d(s,{default:function(){return Q}});var t=a(57437),r=a(2265),n=a(75301),l=a(9114),i=a(26430),o=a(96473),d=a(50010),c=a(26349),m=a(37592),u=a(4260),x=a(99981),h=a(5545),g=a(93837),p=a(27930),v=a(66830),f=a(95459),j=a(10703),y=a(32489),b=a(98728),N=a(79862),w=a(82222),k=a(51817),A=a(62831),S=a(17906),C=a(94263),T=a(88712),L=a(94331),Z=a(38398),P=a(33152);function _(e){let{messages:s,isLoading:a}=e;if(0===s.length)return(0,t.jsx)("div",{className:"h-full"});let r=[],n=0;for(;n(0,t.jsxs)("div",{className:"whitespace-pre-wrap break-words",style:{wordWrap:"break-word",overflowWrap:"break-word",wordBreak:"break-word",hyphens:"auto"},children:[(0,t.jsx)(T.Z,{message:e}),(0,t.jsx)(A.UG,{components:{code(e){let{node:s,inline:a,className:r,children:n,...l}=e,i=/language-(\w+)/.exec(r||"");return!a&&i?(0,t.jsx)(S.Z,{style:C.Z,language:i[1],PreTag:"div",className:"rounded-md my-2",wrapLines:!0,wrapLongLines:!0,...l,children:String(n).replace(/\n$/,"")}):(0,t.jsx)("code",{className:"".concat(r," px-1.5 py-0.5 rounded bg-gray-100 text-sm font-mono"),...l,children:n})},pre:e=>{let{node:s,...a}=e;return(0,t.jsx)("pre",{style:{overflowX:"auto",maxWidth:"100%"},...a})}},children:"string"==typeof e.content?e.content:""})]});return(0,t.jsxs)("div",{className:"flex flex-col gap-6 min-w-0 w-full p-4",children:[r.map((e,s)=>{let n=e.assistant,i=(null==n?void 0:n.model)||"Assistant";return(0,t.jsxs)("div",{className:"space-y-4",children:[e.user&&(0,t.jsxs)("div",{className:"space-y-2 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-blue-100 text-blue-600",children:(0,t.jsx)(N.Z,{size:16})}),(0,t.jsx)("div",{className:"text-sm font-semibold text-gray-700",children:"You"})]}),l(e.user)]}),(0,t.jsx)("div",{className:"border-t border-gray-200"}),n?(0,t.jsxs)("div",{className:"space-y-3 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-gray-100 text-gray-600",children:(0,t.jsx)(w.Z,{size:16})}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-sm font-semibold text-gray-700",children:i}),n.toolName&&(0,t.jsx)("span",{className:"rounded bg-gray-100 px-2 py-0.5 text-xs text-gray-600",children:n.toolName})]})]}),n.reasoningContent&&(0,t.jsx)(L.Z,{reasoningContent:n.reasoningContent}),n.searchResults&&(0,t.jsx)(P.J,{searchResults:n.searchResults}),l(n),(n.timeToFirstToken||n.totalLatency||n.usage)&&(0,t.jsx)(Z.Z,{timeToFirstToken:n.timeToFirstToken,totalLatency:n.totalLatency,usage:n.usage,toolName:n.toolName})]}):a&&s===r.length-1?(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[(0,t.jsx)(k.Z,{size:18,className:"animate-spin"}),(0,t.jsx)("span",{children:"Generating response..."})]}):(0,t.jsx)("div",{className:"text-sm text-gray-500",children:"Waiting for a response..."})]},s)}),a&&0===r.length&&(0,t.jsxs)("div",{className:"flex items-center gap-2 text-gray-500",children:[(0,t.jsx)(k.Z,{size:18,className:"animate-spin"}),(0,t.jsx)("span",{children:"Generating response..."})]})]})}var M=a(31283);function E(e){let{value:s,onChange:a,models:n,loading:l,disabled:i}=e,[o,d]=(0,r.useState)(!1),[c,u]=(0,r.useState)(""),x=(0,r.useMemo)(()=>Array.from(new Set(n)).sort(),[n]),h=(0,r.useMemo)(()=>s&&!x.includes(s)?[s,...x]:x,[x,s]),g=o?"__custom__":s||void 0,p=()=>{let e=c.trim();if(!e){d(!1),u("");return}a(e),d(!1),u("")};return(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)(m.default,{value:g,onChange:e=>{if("__custom__"===e){d(!0),s&&!x.includes(s)?u(s):u("");return}d(!1),u(""),a(e)},disabled:i,loading:l,placeholder:l?"Loading models...":"Select a model",className:"w-full rounded-md",showSearch:!0,optionFilterProp:"children",children:[h.map(e=>(0,t.jsx)(m.default.Option,{value:e,children:e},e)),(0,t.jsx)(m.default.Option,{value:"__custom__",children:"+ Add custom model"})]}),o&&(0,t.jsx)(M.o,{className:"mt-2",placeholder:"Custom Model Name (Enter to add)",value:c,onValueChange:u,onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),p())},onBlur:p,autoFocus:!0})]})}var U=a(99020),R=a(97415),I=a(67479),O=a(61994),z=a(23496),K=a(85847),D=a(79326);function B(e){let{comparison:s,onUpdate:a,onRemove:n,canRemove:l,modelOptions:i,isLoadingModels:o,apiKey:d}=e,[c,m]=(0,r.useState)(!1),u=e=>{e?a({applyAcrossModels:!0,temperature:s.temperature,maxTokens:s.maxTokens,tags:[...s.tags],vectorStores:[...s.vectorStores],guardrails:[...s.guardrails],useAdvancedParams:s.useAdvancedParams},{applyToAll:!0,keysToApply:["temperature","maxTokens","tags","vectorStores","guardrails","useAdvancedParams"]}):a({applyAcrossModels:!1})},x=e=>{a({useAdvancedParams:e},s.applyAcrossModels?{applyToAll:!0,keysToApply:["useAdvancedParams"]}:void 0)},h=(e,t)=>{a({[e]:t},s.applyAcrossModels?{applyToAll:!0,keysToApply:[e]}:void 0)},g=s.useAdvancedParams?1:.4,p=s.useAdvancedParams?"text-gray-700":"text-gray-400",v=()=>{m(e=>!e)},f=(0,t.jsxs)("div",{className:"w-[300px] max-h-[65vh] overflow-y-auto relative",children:[(0,t.jsx)("button",{onClick:()=>{m(!1)},className:"absolute top-0 right-0 p-1 hover:bg-gray-100 rounded transition-colors text-gray-500 hover:text-gray-700 z-10",children:(0,t.jsx)(y.Z,{size:14})}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsx)(O.Z,{checked:s.applyAcrossModels,onChange:e=>u(e.target.checked),children:(0,t.jsx)("span",{className:"text-xs font-medium",children:"Sync Settings Across Models"})})}),(0,t.jsx)(z.Z,{className:"border-gray-200"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"text-xs font-semibold text-gray-700 mb-1.5 uppercase tracking-wide",children:"General Settings"}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-600 block mb-0.5",children:"Tags"}),(0,t.jsx)(U.Z,{value:s.tags,onChange:e=>h("tags",e),accessToken:d})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-600 block mb-0.5",children:"Vector Stores"}),(0,t.jsx)(R.Z,{value:s.vectorStores,onChange:e=>h("vectorStores",e),accessToken:d})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-600 block mb-0.5",children:"Guardrails"}),(0,t.jsx)(I.Z,{value:s.guardrails,onChange:e=>h("guardrails",e),accessToken:d})]})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"text-xs font-semibold text-gray-700 mb-1.5 uppercase tracking-wide",children:"Advanced Settings"}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("div",{className:"flex items-center gap-2 pb-1",children:(0,t.jsx)(O.Z,{checked:s.useAdvancedParams,onChange:e=>x(e.target.checked),children:(0,t.jsx)("span",{className:"text-sm font-medium",children:"Use Advanced Parameters"})})}),(0,t.jsxs)("div",{className:"space-y-2 transition-opacity duration-200",style:{opacity:g},children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,t.jsx)("label",{className:"text-xs font-medium ".concat(p),children:"Temperature"}),(0,t.jsx)("span",{className:"text-xs ".concat(p),children:s.temperature.toFixed(2)})]}),(0,t.jsx)(K.Z,{min:0,max:2,step:.01,value:s.temperature,onChange:e=>{h("temperature",Math.min(2,Math.max(0,Number((Array.isArray(e)?e[0]:e).toFixed(2)))))},disabled:!s.useAdvancedParams})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,t.jsx)("label",{className:"text-xs font-medium ".concat(p),children:"Max Tokens"}),(0,t.jsx)("span",{className:"text-xs ".concat(p),children:s.maxTokens})]}),(0,t.jsx)(K.Z,{min:1,max:32768,step:1,value:s.maxTokens,onChange:e=>{h("maxTokens",Math.min(32768,Math.max(1,Math.round(Array.isArray(e)?e[0]:e))))},disabled:!s.useAdvancedParams})]})]})]})]})]})]});return(0,t.jsxs)("div",{className:"bg-white first:border-l-0 border-l border-gray-200 flex flex-col min-h-0",children:[(0,t.jsxs)("div",{className:"border-b flex items-center justify-between gap-3 px-4 py-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 flex-1",children:[(0,t.jsx)(E,{value:s.model,models:i,loading:o,onChange:e=>a({model:e})}),(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsx)(D.Z,{content:f,trigger:[],open:c,onOpenChange:()=>{},placement:"bottomRight",destroyTooltipOnHide:!1,children:(0,t.jsx)("button",{onClick:e=>{e.stopPropagation(),v()},className:"p-2 rounded-lg transition-colors ".concat(c?"bg-gray-200 text-gray-700":"hover:bg-gray-100 text-gray-600"),children:(0,t.jsx)(b.Z,{size:18})})})})]}),l&&(0,t.jsx)("button",{onClick:e=>{e.stopPropagation(),n()},className:"p-2 hover:bg-red-50 text-red-600 rounded-lg transition-colors",children:(0,t.jsx)(y.Z,{size:18})})]}),(0,t.jsx)("div",{className:"relative flex-1 flex flex-col min-h-0",children:(0,t.jsx)("div",{className:"flex-1 max-h-[calc(100vh-385px)] overflow-auto rounded-b-2xl",children:(0,t.jsx)(_,{messages:s.messages,isLoading:s.isLoading})})})]})}var F=a(79276);let{TextArea:W}=u.default;function G(e){let{value:s,onChange:a,onSend:r,disabled:n,hasAttachment:l,uploadComponent:i}=e,o=!n&&(s.trim().length>0||!!l);return(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsxs)("div",{className:"flex items-center flex-1 bg-white border border-gray-300 rounded-xl px-3 py-1 min-h-[44px]",children:[i&&(0,t.jsx)("div",{className:"flex-shrink-0 mr-2",children:i}),(0,t.jsx)(W,{value:s,onChange:e=>a(e.target.value),onKeyDown:e=>{"Enter"===e.key&&!e.shiftKey&&(e.preventDefault(),o&&r())},placeholder:"Type your message... (Shift+Enter for new line)",disabled:n,className:"flex-1",autoSize:{minRows:1,maxRows:4},style:{resize:"none",border:"none",boxShadow:"none",background:"transparent",padding:"4px 0",fontSize:"14px",lineHeight:"20px"}}),(0,t.jsx)(h.ZP,{onClick:r,disabled:!o,icon:(0,t.jsx)(F.Z,{}),shape:"circle"})]})})}let V=["Can you summarize the key points?","What assumptions did you make?","What are the next steps?"],H=["Write me a poem","Explain quantum computing","Draft a polite email requesting a meeting"],X="/v1/chat/completions";function Y(e){let{accessToken:s,disabledPersonalKeyCreation:a}=e,[n,y]=(0,r.useState)([{id:"1",model:"",messages:[],isLoading:!1,tags:[],mcpTools:[],vectorStores:[],guardrails:[],temperature:1,maxTokens:2048,applyAcrossModels:!1,useAdvancedParams:!1},{id:"2",model:"",messages:[],isLoading:!1,tags:[],mcpTools:[],vectorStores:[],guardrails:[],temperature:1,maxTokens:2048,applyAcrossModels:!1,useAdvancedParams:!1}]),[b,N]=(0,r.useState)([]),[w,k]=(0,r.useState)(!1),[A,S]=(0,r.useState)(""),[C,T]=(0,r.useState)(null),[L,Z]=(0,r.useState)(null),[P,_]=(0,r.useState)(a?"custom":"session"),[M,E]=(0,r.useState)(""),[U,R]=(0,r.useState)("");(0,r.useEffect)(()=>{let e=setTimeout(()=>{R(M)},300);return()=>clearTimeout(e)},[M]),(0,r.useEffect)(()=>()=>{L&&URL.revokeObjectURL(L)},[L]);let I=(0,r.useMemo)(()=>"session"===P?s||"":U.trim(),[P,s,U]),O=(0,r.useMemo)(()=>n.length>0&&n.every(e=>!e.isLoading&&e.messages.some(e=>"assistant"===e.role)),[n]);(0,r.useEffect)(()=>{let e=!0;return(async()=>{if(!I){N([]);return}k(!0);try{let s=await (0,j.p)(I);if(!e)return;let a=Array.from(new Set(s.map(e=>e.model_group)));N(a)}catch(s){console.error("CompareUI: failed to fetch models",s),e&&N([])}finally{e&&k(!1)}})(),()=>{e=!1}},[I]),(0,r.useEffect)(()=>{0!==b.length&&y(e=>e.map((e,s)=>{var a,t,r,n,l;return{...e,temperature:null!==(a=e.temperature)&&void 0!==a?a:1,maxTokens:null!==(t=e.maxTokens)&&void 0!==t?t:2048,applyAcrossModels:null!==(r=e.applyAcrossModels)&&void 0!==r&&r,useAdvancedParams:null!==(n=e.useAdvancedParams)&&void 0!==n&&n,...e.model?{}:{model:null!==(l=b[s%b.length])&&void 0!==l?l:""}}}))},[b]);let z=e=>{n.length>1&&y(s=>s.filter(s=>s.id!==e))},K=(e,s,a)=>{y(t=>{var r;if((null==a?void 0:a.applyToAll)&&(null===(r=a.keysToApply)||void 0===r?void 0:r.length)){let r={};a.keysToApply.forEach(e=>{let a=s[e];void 0!==a&&(r[e]=Array.isArray(a)?[...a]:a)});let n=Object.keys(r).length>0;return t.map(a=>a.id===e?{...a,...s}:n?{...a,...r}:a)}return t.map(a=>a.id===e?{...a,...s}:a)})},D=()=>{L&&URL.revokeObjectURL(L),T(null),Z(null)},F=(e,s,a)=>{s&&y(t=>t.map(t=>{if(t.id!==e)return t;let r=[...t.messages],n=r[r.length-1];if(n&&"assistant"===n.role){var l;let e="string"==typeof n.content?n.content:"";r[r.length-1]={...n,content:e+s,model:null!==(l=n.model)&&void 0!==l?l:a}}else r.push({role:"assistant",content:s,model:a});return{...t,messages:r}}))},W=(e,s)=>{s&&y(a=>a.map(a=>{if(a.id!==e)return a;let t=[...a.messages],r=t[t.length-1];return r&&"assistant"===r.role?t[t.length-1]={...r,reasoningContent:(r.reasoningContent||"")+s}:r&&"user"===r.role&&t.push({role:"assistant",content:"",reasoningContent:s}),{...a,messages:t}}))},Y=(e,s)=>{y(a=>a.map(a=>{if(a.id!==e)return a;let t=[...a.messages],r=t[t.length-1];return r&&"assistant"===r.role?t[t.length-1]={...r,timeToFirstToken:s}:r&&"user"===r.role&&t.push({role:"assistant",content:"",timeToFirstToken:s}),{...a,messages:t}}))},q=(e,s)=>{y(a=>a.map(a=>{if(a.id!==e)return a;let t=[...a.messages],r=t[t.length-1];return r&&"assistant"===r.role?t[t.length-1]={...r,totalLatency:s}:r&&"user"===r.role&&t.push({role:"assistant",content:"",totalLatency:s}),{...a,messages:t}}))},J=(e,s,a)=>{y(t=>t.map(t=>{if(t.id!==e)return t;let r=[...t.messages],n=r[r.length-1];return n&&"assistant"===n.role&&(r[r.length-1]={...n,usage:s,toolName:a}),{...t,messages:r}}))},$=(e,s)=>{s&&y(a=>a.map(a=>{if(a.id!==e)return a;let t=[...a.messages],r=t[t.length-1];return r&&"assistant"===r.role&&(t[t.length-1]={...r,searchResults:s}),{...a,messages:t}}))},Q=!!s,ee=async e=>{let s=e.trim(),a=!!C;if(!s&&!a)return;if(!I){l.Z.fromBackend("Please provide a Virtual Key or select Current UI Session");return}if(0===n.length)return;if(n.some(e=>!e.model)){l.Z.fromBackend("Select a model before sending a message.");return}let t=a?await (0,v.Sn)(s,C):{role:"user",content:s},r=(0,v.Hk)(s,a,L||void 0,null==C?void 0:C.name),i=new Map;n.forEach(e=>{var s;let a=null!==(s=e.traceId)&&void 0!==s?s:(0,g.Z)(),n=[...e.messages.map(e=>{let{role:s,content:a}=e;return{role:s,content:Array.isArray(a)?a:"string"==typeof a?a:""}}),t];i.set(e.id,{id:e.id,model:e.model,traceId:a,tags:e.tags,vectorStores:e.vectorStores,guardrails:e.guardrails,temperature:e.temperature,maxTokens:e.maxTokens,displayMessages:[...e.messages,r],apiChatHistory:n})}),0!==i.size&&(y(e=>e.map(e=>{let s=i.get(e.id);return s?{...e,traceId:s.traceId,messages:s.displayMessages,isLoading:!0}:e})),S(""),D(),i.forEach(e=>{var s;let a=e.tags.length>0?e.tags:void 0,t=e.vectorStores.length>0?e.vectorStores:void 0,r=e.guardrails.length>0?e.guardrails:void 0,i=n.find(s=>s.id===e.id),o=null!==(s=null==i?void 0:i.useAdvancedParams)&&void 0!==s&&s;(0,f.n)(e.apiChatHistory,(s,a)=>F(e.id,s,a),e.model,I,a,void 0,s=>W(e.id,s),s=>Y(e.id,s),s=>J(e.id,s),e.traceId,t,r,void 0,void 0,s=>$(e.id,s),o?e.temperature:void 0,o?e.maxTokens:void 0,s=>q(e.id,s)).catch(s=>{let a=s instanceof Error?s.message:String(s);console.error("CompareUI: failed to fetch response",s),l.Z.fromBackend(a),y(s=>s.map(s=>{if(s.id!==e.id)return s;let t=[...s.messages],r=t[t.length-1],n=r&&"assistant"===r.role&&"string"==typeof r.content?r.content:"";return r&&"assistant"===r.role?t[t.length-1]={...r,content:n?"".concat(n,"\nError fetching response: ").concat(a):"Error fetching response: ".concat(a)}:t.push({role:"assistant",content:"Error fetching response: ".concat(a)}),{...s,messages:t}}))}).finally(()=>{y(s=>s.map(s=>s.id===e.id?{...s,isLoading:!1}:s))})}))},es=e=>{S(e)},ea=n.some(e=>e.messages.length>0),et=n.some(e=>e.isLoading),er=!!C,en=!!(null==C?void 0:C.name.toLowerCase().endsWith(".pdf")),el=!ea&&!et&&!er;return(0,t.jsx)("div",{className:"w-full h-full p-4 bg-white",children:(0,t.jsxs)("div",{className:"rounded-2xl border border-gray-200 bg-white shadow-sm min-h-[calc(100vh-160px)] flex flex-col",children:[(0,t.jsx)("div",{className:"border-b px-4 py-2",children:(0,t.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-gray-600",children:"Virtual Key Source"}),(0,t.jsxs)(m.default,{value:P,onChange:e=>_(e),disabled:a,className:"w-48",children:[(0,t.jsx)(m.default.Option,{value:"session",disabled:!Q,children:"Current UI Session"}),(0,t.jsx)(m.default.Option,{value:"custom",children:"Virtual Key"})]}),"custom"===P&&(0,t.jsx)(u.default.Password,{value:M,onChange:e=>E(e.target.value),placeholder:"Enter Virtual Key",className:"w-56"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-gray-600",children:"Endpoint"}),(0,t.jsx)(x.Z,{title:"Other endpoints will be available soon",children:(0,t.jsx)(m.default,{value:X,disabled:!0,className:"w-56",children:(0,t.jsx)(m.default.Option,{value:X,children:X})})})]}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)(h.ZP,{onClick:()=>{y(e=>e.map(e=>({...e,messages:[],traceId:void 0,isLoading:!1}))),S(""),D()},disabled:!ea,icon:(0,t.jsx)(i.Z,{}),children:"Clear All Chats"}),(0,t.jsx)(x.Z,{title:n.length>=3?"Compare up to 3 models at a time":"Add another comparison",children:(0,t.jsx)(h.ZP,{onClick:()=>{var e;if(n.length>=3)return;let s=null!==(e=b[n.length%(b.length||1)])&&void 0!==e?e:"",a={id:Date.now().toString(),model:s,messages:[],isLoading:!1,tags:[],mcpTools:[],vectorStores:[],guardrails:[],temperature:1,maxTokens:2048,applyAcrossModels:!1,useAdvancedParams:!1};y(e=>[...e,a])},disabled:n.length>=3,icon:(0,t.jsx)(o.Z,{}),children:"Add Comparison"})})]})]})}),(0,t.jsx)("div",{className:"grid flex-1 min-h-0 auto-rows-[minmax(0,1fr)]",style:{gridTemplateColumns:"repeat(".concat(n.length,", minmax(0, 1fr))")},children:n.map(e=>(0,t.jsx)(B,{comparison:e,onUpdate:(s,a)=>K(e.id,s,a),onRemove:()=>z(e.id),canRemove:n.length>1,modelOptions:b,isLoadingModels:w,apiKey:I},e.id))}),(0,t.jsx)("div",{className:"flex justify-center pb-4",children:(0,t.jsx)("div",{className:"w-full max-w-3xl px-4",children:(0,t.jsxs)("div",{className:"border border-gray-200 shadow-lg rounded-xl bg-white p-4",children:[(0,t.jsx)("div",{className:"flex items-center justify-between gap-4 mb-3 min-h-8",children:er?(0,t.jsx)("span",{className:"text-sm text-gray-500",children:"Attachment ready to send"}):el?(0,t.jsx)("div",{className:"flex items-center gap-2 overflow-x-auto",children:H.map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>es(e),className:"shrink-0 rounded-full border border-gray-200 px-3 py-1 text-xs font-medium text-gray-600 transition-colors hover:bg-gray-100 cursor-pointer",children:e},e))}):O&&!er?(0,t.jsx)("div",{className:"flex items-center gap-2 overflow-x-auto",children:V.map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>es(e),className:"shrink-0 rounded-full border border-gray-200 px-3 py-1 text-xs font-medium text-gray-600 transition-colors hover:bg-gray-100 cursor-pointer",children:e},e))}):et?(0,t.jsxs)("span",{className:"flex items-center gap-2 text-sm text-gray-500",children:[(0,t.jsx)("span",{className:"h-2 w-2 rounded-full bg-blue-500 animate-pulse","aria-hidden":!0}),"Gathering responses from all models..."]}):(0,t.jsx)("span",{className:"text-sm text-gray-500",children:"Send a prompt to compare models"})}),C&&(0,t.jsx)("div",{className:"mb-3",children:(0,t.jsxs)("div",{className:"flex items-center gap-3 p-3 bg-gray-50 rounded-lg border border-gray-200",children:[(0,t.jsx)("div",{className:"relative inline-block",children:en?(0,t.jsx)("div",{className:"w-10 h-10 rounded-md bg-red-500 flex items-center justify-center",children:(0,t.jsx)(d.Z,{style:{fontSize:"16px",color:"white"}})}):(0,t.jsx)("img",{src:L||"",alt:"Upload preview",className:"w-10 h-10 rounded-md border border-gray-200 object-cover"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("div",{className:"text-sm font-medium text-gray-900 truncate",children:C.name}),(0,t.jsx)("div",{className:"text-xs text-gray-500",children:en?"PDF":"Image"})]}),(0,t.jsx)("button",{className:"flex items-center justify-center w-6 h-6 text-gray-400 hover:text-gray-600 hover:bg-gray-200 rounded-full transition-colors",onClick:D,children:(0,t.jsx)(c.Z,{style:{fontSize:"12px"}})})]})}),(0,t.jsx)(G,{value:A,onChange:e=>{S(e)},onSend:()=>{ee(A)},disabled:0===n.length||n.every(e=>e.isLoading),hasAttachment:er,uploadComponent:(0,t.jsx)(p.Z,{chatUploadedImage:C,chatImagePreviewUrl:L,onImageUpload:e=>(L&&URL.revokeObjectURL(L),T(e),Z(URL.createObjectURL(e)),!1),onRemoveImage:D})})]})})})]})})}var q=a(58643),J=a(80443),$=a(91624);function Q(){let{accessToken:e,userRole:s,userId:a,disabledPersonalKeyCreation:l,token:i}=(0,J.Z)(),[o,d]=(0,r.useState)(void 0);return(0,r.useEffect)(()=>{(async()=>{if(e){let s=await (0,$.C)(e);s&&d({PROXY_BASE_URL:s.PROXY_BASE_URL,LITELLM_UI_API_DOC_BASE_URL:s.LITELLM_UI_API_DOC_BASE_URL})}})()},[e]),(0,t.jsxs)(q.v0,{className:"h-full w-full",children:[(0,t.jsxs)(q.td,{className:"mb-0",children:[(0,t.jsx)(q.OK,{children:"Chat"}),(0,t.jsx)(q.OK,{children:"Compare"})]}),(0,t.jsxs)(q.nP,{className:"h-full",children:[(0,t.jsx)(q.x4,{className:"h-full",children:(0,t.jsx)(n.Z,{accessToken:e,token:i,userRole:s,userID:a,disabledPersonalKeyCreation:l,proxySettings:o})}),(0,t.jsx)(q.x4,{className:"h-full",children:(0,t.jsx)(Y,{accessToken:e,disabledPersonalKeyCreation:l})})]})]})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1994-6637a121c9ee1602.js b/litellm/proxy/_experimental/out/_next/static/chunks/1994-6637a121c9ee1602.js deleted file mode 100644 index 90f29480d6..0000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/1994-6637a121c9ee1602.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1994],{4156:function(e,n,t){t.d(n,{Z:function(){return O}});var o=t(2265),a=t(36760),r=t.n(a),c=t(20873),l=t(28791),i=t(6694),s=t(34709),u=t(71744),d=t(86586),b=t(64024),p=t(39109);let f=o.createContext(null);var v=t(23159),m=t(66531),h=function(e,n){var t={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>n.indexOf(o)&&(t[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(e);an.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(t[o[a]]=e[o[a]]);return t};let g=o.forwardRef((e,n)=>{var t;let{prefixCls:a,className:g,rootClassName:C,children:y,indeterminate:k=!1,style:x,onMouseEnter:O,onMouseLeave:E,skipGroup:S=!1,disabled:w}=e,Z=h(e,["prefixCls","className","rootClassName","children","indeterminate","style","onMouseEnter","onMouseLeave","skipGroup","disabled"]),{getPrefixCls:P,direction:N,checkbox:j}=o.useContext(u.E_),I=o.useContext(f),{isFormItemInput:R}=o.useContext(p.aM),z=o.useContext(d.Z),B=null!==(t=(null==I?void 0:I.disabled)||w)&&void 0!==t?t:z,D=o.useRef(Z.value),M=o.useRef(null),_=(0,l.sQ)(n,M);o.useEffect(()=>{null==I||I.registerValue(Z.value)},[]),o.useEffect(()=>{if(!S)return Z.value!==D.current&&(null==I||I.cancelValue(D.current),null==I||I.registerValue(Z.value),D.current=Z.value),()=>null==I?void 0:I.cancelValue(Z.value)},[Z.value]),o.useEffect(()=>{var e;(null===(e=M.current)||void 0===e?void 0:e.input)&&(M.current.input.indeterminate=k)},[k]);let W=P("checkbox",a),q=(0,b.Z)(W),[H,T,G]=(0,v.ZP)(W,q),V=Object.assign({},Z);I&&!S&&(V.onChange=function(){for(var e=arguments.length,n=Array(e),t=0;tn.indexOf(o)&&(t[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(e);an.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(t[o[a]]=e[o[a]]);return t};let x=o.forwardRef((e,n)=>{let{defaultValue:t,children:a,options:c=[],prefixCls:l,className:i,rootClassName:s,style:d,onChange:p}=e,m=k(e,["defaultValue","children","options","prefixCls","className","rootClassName","style","onChange"]),{getPrefixCls:h,direction:x}=o.useContext(u.E_),[O,E]=o.useState(m.value||t||[]),[S,w]=o.useState([]);o.useEffect(()=>{"value"in m&&E(m.value||[])},[m.value]);let Z=o.useMemo(()=>c.map(e=>"string"==typeof e||"number"==typeof e?{label:e,value:e}:e),[c]),P=e=>{w(n=>n.filter(n=>n!==e))},N=e=>{w(n=>[].concat((0,C.Z)(n),[e]))},j=e=>{let n=O.indexOf(e.value),t=(0,C.Z)(O);-1===n?t.push(e.value):t.splice(n,1),"value"in m||E(t),null==p||p(t.filter(e=>S.includes(e)).sort((e,n)=>Z.findIndex(n=>n.value===e)-Z.findIndex(e=>e.value===n)))},I=h("checkbox",l),R="".concat(I,"-group"),z=(0,b.Z)(I),[B,D,M]=(0,v.ZP)(I,z),_=(0,y.Z)(m,["value","disabled"]),W=c.length?Z.map(e=>o.createElement(g,{prefixCls:I,key:e.value.toString(),disabled:"disabled"in e?e.disabled:m.disabled,value:e.value,checked:O.includes(e.value),onChange:e.onChange,className:r()("".concat(R,"-item"),e.className),style:e.style,title:e.title,id:e.id,required:e.required},e.label)):a,q=o.useMemo(()=>({toggleOption:j,value:O,disabled:m.disabled,name:m.name,registerValue:N,cancelValue:P}),[j,O,m.disabled,m.name,N,P]),H=r()(R,{["".concat(R,"-rtl")]:"rtl"===x},i,s,M,z,D);return B(o.createElement("div",Object.assign({className:H,style:d},_,{ref:n}),o.createElement(f.Provider,{value:q},W)))});g.Group=x,g.__ANT_CHECKBOX=!0;var O=g},23159:function(e,n,t){t.d(n,{C2:function(){return i}});var o=t(93463),a=t(12918),r=t(71140),c=t(99320);let l=e=>{let{checkboxCls:n}=e,t="".concat(n,"-wrapper");return[{["".concat(n,"-group")]:Object.assign(Object.assign({},(0,a.Wf)(e)),{display:"inline-flex",flexWrap:"wrap",columnGap:e.marginXS,["> ".concat(e.antCls,"-row")]:{flex:1}}),[t]:Object.assign(Object.assign({},(0,a.Wf)(e)),{display:"inline-flex",alignItems:"baseline",cursor:"pointer","&:after":{display:"inline-block",width:0,overflow:"hidden",content:"'\\a0'"},["& + ".concat(t)]:{marginInlineStart:0},["&".concat(t,"-in-form-item")]:{'input[type="checkbox"]':{width:14,height:14}}}),[n]:Object.assign(Object.assign({},(0,a.Wf)(e)),{position:"relative",whiteSpace:"nowrap",lineHeight:1,cursor:"pointer",borderRadius:e.borderRadiusSM,alignSelf:"center",["".concat(n,"-input")]:{position:"absolute",inset:0,zIndex:1,cursor:"pointer",opacity:0,margin:0,["&:focus-visible + ".concat(n,"-inner")]:(0,a.oN)(e)},["".concat(n,"-inner")]:{boxSizing:"border-box",display:"block",width:e.checkboxSize,height:e.checkboxSize,direction:"ltr",backgroundColor:e.colorBgContainer,border:"".concat((0,o.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorder),borderRadius:e.borderRadiusSM,borderCollapse:"separate",transition:"all ".concat(e.motionDurationSlow),"&:after":{boxSizing:"border-box",position:"absolute",top:"50%",insetInlineStart:"25%",display:"table",width:e.calc(e.checkboxSize).div(14).mul(5).equal(),height:e.calc(e.checkboxSize).div(14).mul(8).equal(),border:"".concat((0,o.bf)(e.lineWidthBold)," solid ").concat(e.colorWhite),borderTop:0,borderInlineStart:0,transform:"rotate(45deg) scale(0) translate(-50%,-50%)",opacity:0,content:'""',transition:"all ".concat(e.motionDurationFast," ").concat(e.motionEaseInBack,", opacity ").concat(e.motionDurationFast)}},"& + span":{paddingInlineStart:e.paddingXS,paddingInlineEnd:e.paddingXS}})},{["\n ".concat(t,":not(").concat(t,"-disabled),\n ").concat(n,":not(").concat(n,"-disabled)\n ")]:{["&:hover ".concat(n,"-inner")]:{borderColor:e.colorPrimary}},["".concat(t,":not(").concat(t,"-disabled)")]:{["&:hover ".concat(n,"-checked:not(").concat(n,"-disabled) ").concat(n,"-inner")]:{backgroundColor:e.colorPrimaryHover,borderColor:"transparent"},["&:hover ".concat(n,"-checked:not(").concat(n,"-disabled):after")]:{borderColor:e.colorPrimaryHover}}},{["".concat(n,"-checked")]:{["".concat(n,"-inner")]:{backgroundColor:e.colorPrimary,borderColor:e.colorPrimary,"&:after":{opacity:1,transform:"rotate(45deg) scale(1) translate(-50%,-50%)",transition:"all ".concat(e.motionDurationMid," ").concat(e.motionEaseOutBack," ").concat(e.motionDurationFast)}}},["\n ".concat(t,"-checked:not(").concat(t,"-disabled),\n ").concat(n,"-checked:not(").concat(n,"-disabled)\n ")]:{["&:hover ".concat(n,"-inner")]:{backgroundColor:e.colorPrimaryHover,borderColor:"transparent"}}},{[n]:{"&-indeterminate":{"&":{["".concat(n,"-inner")]:{backgroundColor:"".concat(e.colorBgContainer),borderColor:"".concat(e.colorBorder),"&:after":{top:"50%",insetInlineStart:"50%",width:e.calc(e.fontSizeLG).div(2).equal(),height:e.calc(e.fontSizeLG).div(2).equal(),backgroundColor:e.colorPrimary,border:0,transform:"translate(-50%, -50%) scale(1)",opacity:1,content:'""'}},["&:hover ".concat(n,"-inner")]:{backgroundColor:"".concat(e.colorBgContainer),borderColor:"".concat(e.colorPrimary)}}}}},{["".concat(t,"-disabled")]:{cursor:"not-allowed"},["".concat(n,"-disabled")]:{["&, ".concat(n,"-input")]:{cursor:"not-allowed",pointerEvents:"none"},["".concat(n,"-inner")]:{background:e.colorBgContainerDisabled,borderColor:e.colorBorder,"&:after":{borderColor:e.colorTextDisabled}},"&:after":{display:"none"},"& + span":{color:e.colorTextDisabled},["&".concat(n,"-indeterminate ").concat(n,"-inner::after")]:{background:e.colorTextDisabled}}}]};function i(e,n){return l((0,r.IX)(n,{checkboxCls:".".concat(e),checkboxSize:n.controlInteractiveSize}))}n.ZP=(0,c.I$)("Checkbox",(e,n)=>{let{prefixCls:t}=n;return[i(t,e)]})},66531:function(e,n,t){t.d(n,{Z:function(){return r}});var o=t(2265),a=t(53346);function r(e){let n=o.useRef(null),t=()=>{a.Z.cancel(n.current),n.current=null};return[()=>{t(),n.current=(0,a.Z)(()=>{n.current=null})},o=>{n.current&&(o.stopPropagation(),t()),null==e||e(o)}]}},20873:function(e,n,t){var o=t(1119),a=t(31686),r=t(11993),c=t(26365),l=t(6989),i=t(36760),s=t.n(i),u=t(50506),d=t(2265),b=["prefixCls","className","style","checked","disabled","defaultChecked","type","title","onChange"],p=(0,d.forwardRef)(function(e,n){var t=e.prefixCls,i=void 0===t?"rc-checkbox":t,p=e.className,f=e.style,v=e.checked,m=e.disabled,h=e.defaultChecked,g=e.type,C=void 0===g?"checkbox":g,y=e.title,k=e.onChange,x=(0,l.Z)(e,b),O=(0,d.useRef)(null),E=(0,d.useRef)(null),S=(0,u.Z)(void 0!==h&&h,{value:v}),w=(0,c.Z)(S,2),Z=w[0],P=w[1];(0,d.useImperativeHandle)(n,function(){return{focus:function(e){var n;null===(n=O.current)||void 0===n||n.focus(e)},blur:function(){var e;null===(e=O.current)||void 0===e||e.blur()},input:O.current,nativeElement:E.current}});var N=s()(i,p,(0,r.Z)((0,r.Z)({},"".concat(i,"-checked"),Z),"".concat(i,"-disabled"),m));return d.createElement("span",{className:N,title:y,style:f,ref:E},d.createElement("input",(0,o.Z)({},x,{className:"".concat(i,"-input"),ref:O,onChange:function(n){m||("checked"in e||P(n.target.checked),null==k||k({target:(0,a.Z)((0,a.Z)({},e),{},{type:C,checked:n.target.checked}),stopPropagation:function(){n.stopPropagation()},preventDefault:function(){n.preventDefault()},nativeEvent:n.nativeEvent}))},disabled:m,checked:!!Z,type:C})),d.createElement("span",{className:"".concat(i,"-inner")}))});n.Z=p}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1994-a4d0b99849c16b62.js b/litellm/proxy/_experimental/out/_next/static/chunks/1994-a4d0b99849c16b62.js new file mode 100644 index 0000000000..3211472683 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/1994-a4d0b99849c16b62.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1994],{61994:function(e,n,t){t.d(n,{Z:function(){return O}});var o=t(2265),a=t(36760),r=t.n(a),c=t(20873),l=t(28791),i=t(6694),s=t(34709),u=t(71744),d=t(86586),b=t(64024),p=t(39109);let f=o.createContext(null);var v=t(23159),m=t(66531),h=function(e,n){var t={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>n.indexOf(o)&&(t[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(e);an.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(t[o[a]]=e[o[a]]);return t};let g=o.forwardRef((e,n)=>{var t;let{prefixCls:a,className:g,rootClassName:C,children:y,indeterminate:k=!1,style:x,onMouseEnter:O,onMouseLeave:E,skipGroup:S=!1,disabled:w}=e,Z=h(e,["prefixCls","className","rootClassName","children","indeterminate","style","onMouseEnter","onMouseLeave","skipGroup","disabled"]),{getPrefixCls:P,direction:N,checkbox:j}=o.useContext(u.E_),I=o.useContext(f),{isFormItemInput:R}=o.useContext(p.aM),z=o.useContext(d.Z),B=null!==(t=(null==I?void 0:I.disabled)||w)&&void 0!==t?t:z,D=o.useRef(Z.value),M=o.useRef(null),_=(0,l.sQ)(n,M);o.useEffect(()=>{null==I||I.registerValue(Z.value)},[]),o.useEffect(()=>{if(!S)return Z.value!==D.current&&(null==I||I.cancelValue(D.current),null==I||I.registerValue(Z.value),D.current=Z.value),()=>null==I?void 0:I.cancelValue(Z.value)},[Z.value]),o.useEffect(()=>{var e;(null===(e=M.current)||void 0===e?void 0:e.input)&&(M.current.input.indeterminate=k)},[k]);let W=P("checkbox",a),q=(0,b.Z)(W),[H,T,G]=(0,v.ZP)(W,q),V=Object.assign({},Z);I&&!S&&(V.onChange=function(){for(var e=arguments.length,n=Array(e),t=0;tn.indexOf(o)&&(t[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(e);an.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(t[o[a]]=e[o[a]]);return t};let x=o.forwardRef((e,n)=>{let{defaultValue:t,children:a,options:c=[],prefixCls:l,className:i,rootClassName:s,style:d,onChange:p}=e,m=k(e,["defaultValue","children","options","prefixCls","className","rootClassName","style","onChange"]),{getPrefixCls:h,direction:x}=o.useContext(u.E_),[O,E]=o.useState(m.value||t||[]),[S,w]=o.useState([]);o.useEffect(()=>{"value"in m&&E(m.value||[])},[m.value]);let Z=o.useMemo(()=>c.map(e=>"string"==typeof e||"number"==typeof e?{label:e,value:e}:e),[c]),P=e=>{w(n=>n.filter(n=>n!==e))},N=e=>{w(n=>[].concat((0,C.Z)(n),[e]))},j=e=>{let n=O.indexOf(e.value),t=(0,C.Z)(O);-1===n?t.push(e.value):t.splice(n,1),"value"in m||E(t),null==p||p(t.filter(e=>S.includes(e)).sort((e,n)=>Z.findIndex(n=>n.value===e)-Z.findIndex(e=>e.value===n)))},I=h("checkbox",l),R="".concat(I,"-group"),z=(0,b.Z)(I),[B,D,M]=(0,v.ZP)(I,z),_=(0,y.Z)(m,["value","disabled"]),W=c.length?Z.map(e=>o.createElement(g,{prefixCls:I,key:e.value.toString(),disabled:"disabled"in e?e.disabled:m.disabled,value:e.value,checked:O.includes(e.value),onChange:e.onChange,className:r()("".concat(R,"-item"),e.className),style:e.style,title:e.title,id:e.id,required:e.required},e.label)):a,q=o.useMemo(()=>({toggleOption:j,value:O,disabled:m.disabled,name:m.name,registerValue:N,cancelValue:P}),[j,O,m.disabled,m.name,N,P]),H=r()(R,{["".concat(R,"-rtl")]:"rtl"===x},i,s,M,z,D);return B(o.createElement("div",Object.assign({className:H,style:d},_,{ref:n}),o.createElement(f.Provider,{value:q},W)))});g.Group=x,g.__ANT_CHECKBOX=!0;var O=g},23159:function(e,n,t){t.d(n,{C2:function(){return i}});var o=t(93463),a=t(12918),r=t(71140),c=t(99320);let l=e=>{let{checkboxCls:n}=e,t="".concat(n,"-wrapper");return[{["".concat(n,"-group")]:Object.assign(Object.assign({},(0,a.Wf)(e)),{display:"inline-flex",flexWrap:"wrap",columnGap:e.marginXS,["> ".concat(e.antCls,"-row")]:{flex:1}}),[t]:Object.assign(Object.assign({},(0,a.Wf)(e)),{display:"inline-flex",alignItems:"baseline",cursor:"pointer","&:after":{display:"inline-block",width:0,overflow:"hidden",content:"'\\a0'"},["& + ".concat(t)]:{marginInlineStart:0},["&".concat(t,"-in-form-item")]:{'input[type="checkbox"]':{width:14,height:14}}}),[n]:Object.assign(Object.assign({},(0,a.Wf)(e)),{position:"relative",whiteSpace:"nowrap",lineHeight:1,cursor:"pointer",borderRadius:e.borderRadiusSM,alignSelf:"center",["".concat(n,"-input")]:{position:"absolute",inset:0,zIndex:1,cursor:"pointer",opacity:0,margin:0,["&:focus-visible + ".concat(n,"-inner")]:(0,a.oN)(e)},["".concat(n,"-inner")]:{boxSizing:"border-box",display:"block",width:e.checkboxSize,height:e.checkboxSize,direction:"ltr",backgroundColor:e.colorBgContainer,border:"".concat((0,o.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorder),borderRadius:e.borderRadiusSM,borderCollapse:"separate",transition:"all ".concat(e.motionDurationSlow),"&:after":{boxSizing:"border-box",position:"absolute",top:"50%",insetInlineStart:"25%",display:"table",width:e.calc(e.checkboxSize).div(14).mul(5).equal(),height:e.calc(e.checkboxSize).div(14).mul(8).equal(),border:"".concat((0,o.bf)(e.lineWidthBold)," solid ").concat(e.colorWhite),borderTop:0,borderInlineStart:0,transform:"rotate(45deg) scale(0) translate(-50%,-50%)",opacity:0,content:'""',transition:"all ".concat(e.motionDurationFast," ").concat(e.motionEaseInBack,", opacity ").concat(e.motionDurationFast)}},"& + span":{paddingInlineStart:e.paddingXS,paddingInlineEnd:e.paddingXS}})},{["\n ".concat(t,":not(").concat(t,"-disabled),\n ").concat(n,":not(").concat(n,"-disabled)\n ")]:{["&:hover ".concat(n,"-inner")]:{borderColor:e.colorPrimary}},["".concat(t,":not(").concat(t,"-disabled)")]:{["&:hover ".concat(n,"-checked:not(").concat(n,"-disabled) ").concat(n,"-inner")]:{backgroundColor:e.colorPrimaryHover,borderColor:"transparent"},["&:hover ".concat(n,"-checked:not(").concat(n,"-disabled):after")]:{borderColor:e.colorPrimaryHover}}},{["".concat(n,"-checked")]:{["".concat(n,"-inner")]:{backgroundColor:e.colorPrimary,borderColor:e.colorPrimary,"&:after":{opacity:1,transform:"rotate(45deg) scale(1) translate(-50%,-50%)",transition:"all ".concat(e.motionDurationMid," ").concat(e.motionEaseOutBack," ").concat(e.motionDurationFast)}}},["\n ".concat(t,"-checked:not(").concat(t,"-disabled),\n ").concat(n,"-checked:not(").concat(n,"-disabled)\n ")]:{["&:hover ".concat(n,"-inner")]:{backgroundColor:e.colorPrimaryHover,borderColor:"transparent"}}},{[n]:{"&-indeterminate":{"&":{["".concat(n,"-inner")]:{backgroundColor:"".concat(e.colorBgContainer),borderColor:"".concat(e.colorBorder),"&:after":{top:"50%",insetInlineStart:"50%",width:e.calc(e.fontSizeLG).div(2).equal(),height:e.calc(e.fontSizeLG).div(2).equal(),backgroundColor:e.colorPrimary,border:0,transform:"translate(-50%, -50%) scale(1)",opacity:1,content:'""'}},["&:hover ".concat(n,"-inner")]:{backgroundColor:"".concat(e.colorBgContainer),borderColor:"".concat(e.colorPrimary)}}}}},{["".concat(t,"-disabled")]:{cursor:"not-allowed"},["".concat(n,"-disabled")]:{["&, ".concat(n,"-input")]:{cursor:"not-allowed",pointerEvents:"none"},["".concat(n,"-inner")]:{background:e.colorBgContainerDisabled,borderColor:e.colorBorder,"&:after":{borderColor:e.colorTextDisabled}},"&:after":{display:"none"},"& + span":{color:e.colorTextDisabled},["&".concat(n,"-indeterminate ").concat(n,"-inner::after")]:{background:e.colorTextDisabled}}}]};function i(e,n){return l((0,r.IX)(n,{checkboxCls:".".concat(e),checkboxSize:n.controlInteractiveSize}))}n.ZP=(0,c.I$)("Checkbox",(e,n)=>{let{prefixCls:t}=n;return[i(t,e)]})},66531:function(e,n,t){t.d(n,{Z:function(){return r}});var o=t(2265),a=t(53346);function r(e){let n=o.useRef(null),t=()=>{a.Z.cancel(n.current),n.current=null};return[()=>{t(),n.current=(0,a.Z)(()=>{n.current=null})},o=>{n.current&&(o.stopPropagation(),t()),null==e||e(o)}]}},20873:function(e,n,t){var o=t(1119),a=t(31686),r=t(11993),c=t(26365),l=t(6989),i=t(36760),s=t.n(i),u=t(50506),d=t(2265),b=["prefixCls","className","style","checked","disabled","defaultChecked","type","title","onChange"],p=(0,d.forwardRef)(function(e,n){var t=e.prefixCls,i=void 0===t?"rc-checkbox":t,p=e.className,f=e.style,v=e.checked,m=e.disabled,h=e.defaultChecked,g=e.type,C=void 0===g?"checkbox":g,y=e.title,k=e.onChange,x=(0,l.Z)(e,b),O=(0,d.useRef)(null),E=(0,d.useRef)(null),S=(0,u.Z)(void 0!==h&&h,{value:v}),w=(0,c.Z)(S,2),Z=w[0],P=w[1];(0,d.useImperativeHandle)(n,function(){return{focus:function(e){var n;null===(n=O.current)||void 0===n||n.focus(e)},blur:function(){var e;null===(e=O.current)||void 0===e||e.blur()},input:O.current,nativeElement:E.current}});var N=s()(i,p,(0,r.Z)((0,r.Z)({},"".concat(i,"-checked"),Z),"".concat(i,"-disabled"),m));return d.createElement("span",{className:N,title:y,style:f,ref:E},d.createElement("input",(0,o.Z)({},x,{className:"".concat(i,"-input"),ref:O,onChange:function(n){m||("checked"in e||P(n.target.checked),null==k||k({target:(0,a.Z)((0,a.Z)({},e),{},{type:C,checked:n.target.checked}),stopPropagation:function(){n.stopPropagation()},preventDefault:function(){n.preventDefault()},nativeEvent:n.nativeEvent}))},disabled:m,checked:!!Z,type:C})),d.createElement("span",{className:"".concat(i,"-inner")}))});n.Z=p}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/2012-390546d3cdd37c82.js b/litellm/proxy/_experimental/out/_next/static/chunks/2012-390546d3cdd37c82.js deleted file mode 100644 index d3f4b1af8d..0000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/2012-390546d3cdd37c82.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2012],{26210:function(e,l,s){s.d(l,{UQ:function(){return t.Z},X1:function(){return i.Z},_m:function(){return a.Z},oi:function(){return n.Z},xv:function(){return r.Z}});var t=s(87452),i=s(88829),a=s(72208),r=s(84264),n=s(49566)},30078:function(e,l,s){s.d(l,{Ct:function(){return t.Z},Dx:function(){return x.Z},OK:function(){return n.Z},Zb:function(){return a.Z},nP:function(){return c.Z},oi:function(){return h.Z},rj:function(){return r.Z},td:function(){return o.Z},v0:function(){return m.Z},x4:function(){return d.Z},xv:function(){return u.Z},zx:function(){return i.Z}});var t=s(41649),i=s(78489),a=s(12514),r=s(67101),n=s(12485),m=s(18135),o=s(35242),d=s(29706),c=s(77991),u=s(84264),h=s(49566),x=s(96761)},62490:function(e,l,s){s.d(l,{Ct:function(){return t.Z},RM:function(){return n.Z},SC:function(){return c.Z},Zb:function(){return a.Z},iA:function(){return r.Z},pj:function(){return m.Z},ss:function(){return o.Z},xs:function(){return d.Z},xv:function(){return u.Z},zx:function(){return i.Z}});var t=s(41649),i=s(78489),a=s(12514),r=s(21626),n=s(97214),m=s(28241),o=s(58834),d=s(69552),c=s(71876),u=s(84264)},11318:function(e,l,s){s.d(l,{Z:function(){return n}});var t=s(2265),i=s(80443),a=s(19250);let r=async(e,l,s,t)=>"Admin"!=s&&"Admin Viewer"!=s?await (0,a.teamListCall)(e,(null==t?void 0:t.organization_id)||null,l):await (0,a.teamListCall)(e,(null==t?void 0:t.organization_id)||null);var n=()=>{let[e,l]=(0,t.useState)([]),{accessToken:s,userId:a,userRole:n}=(0,i.Z)();return(0,t.useEffect)(()=>{(async()=>{l(await r(s,a,n,null))})()},[s,a,n]),{teams:e,setTeams:l}}},21609:function(e,l,s){s.d(l,{Z:function(){return d}});var t=s(57437),i=s(57840),a=s(22116),r=s(51653),n=s(76188),m=s(4260),o=s(2265);function d(e){let{isOpen:l,title:s,alertMessage:d,message:c,resourceInformationTitle:u,resourceInformation:h,onCancel:x,onOk:p,confirmLoading:g,requiredConfirmation:b}=e,{Title:_,Text:v}=i.default,[j,f]=(0,o.useState)("");return(0,o.useEffect)(()=>{l&&f("")},[l]),(0,t.jsx)(a.Z,{title:s,open:l,onOk:p,onCancel:x,confirmLoading:g,okText:g?"Deleting...":"Delete",cancelText:"Cancel",okButtonProps:{danger:!0,disabled:!!b&&j!==b||g},cancelButtonProps:{disabled:g},children:(0,t.jsxs)("div",{className:"space-y-4",children:[d&&(0,t.jsx)(r.Z,{message:d,type:"warning"}),(0,t.jsxs)("div",{className:"mt-4 p-4 bg-red-50 rounded-lg border border-red-200",children:[(0,t.jsx)(_,{level:5,className:"mb-3 text-gray-900",children:u}),(0,t.jsx)(n.Z,{column:1,size:"small",children:h&&h.map(e=>{let{label:l,value:s,...i}=e;return(0,t.jsx)(n.Z.Item,{label:(0,t.jsx)("span",{className:"font-semibold text-gray-700",children:l}),children:(0,t.jsx)(v,{...i,children:null!=s?s:"-"})},l)})})]}),(0,t.jsx)("div",{children:(0,t.jsx)(v,{children:c})}),b&&(0,t.jsxs)("div",{className:"mb-6 mt-4 pt-4 border-t border-gray-200",children:[(0,t.jsxs)(v,{className:"block text-base font-medium text-gray-700 mb-2",children:[(0,t.jsx)(v,{children:"Type "}),(0,t.jsx)(v,{strong:!0,type:"danger",children:b}),(0,t.jsx)(v,{children:" to confirm deletion:"})]}),(0,t.jsx)(m.default,{value:j,onChange:e=>f(e.target.value),placeholder:b,className:"rounded-md text-base border-gray-200",autoFocus:!0})]})]})})}},33860:function(e,l,s){var t=s(57437),i=s(2265),a=s(10032),r=s(22116),n=s(37592),m=s(99981),o=s(5545),d=s(7310),c=s.n(d),u=s(19250);l.Z=e=>{let{isVisible:l,onCancel:s,onSubmit:d,accessToken:h,title:x="Add Team Member",roles:p=[{label:"admin",value:"admin",description:"Admin role. Can create team keys, add members, and manage settings."},{label:"user",value:"user",description:"User role. Can view team info, but not manage it."}],defaultRole:g="user"}=e,[b]=a.Z.useForm(),[_,v]=(0,i.useState)([]),[j,f]=(0,i.useState)(!1),[Z,y]=(0,i.useState)("user_email"),N=async(e,l)=>{if(!e){v([]);return}f(!0);try{let s=new URLSearchParams;if(s.append(l,e),null==h)return;let t=(await (0,u.userFilterUICall)(h,s)).map(e=>({label:"user_email"===l?"".concat(e.user_email):"".concat(e.user_id),value:"user_email"===l?e.user_email:e.user_id,user:e}));v(t)}catch(e){console.error("Error fetching users:",e)}finally{f(!1)}},w=(0,i.useCallback)(c()((e,l)=>N(e,l),300),[]),k=(e,l)=>{y(l),w(e,l)},M=(e,l)=>{let s=l.user;b.setFieldsValue({user_email:s.user_email,user_id:s.user_id,role:b.getFieldValue("role")})};return(0,t.jsx)(r.Z,{title:x,open:l,onCancel:()=>{b.resetFields(),v([]),s()},footer:null,width:800,children:(0,t.jsxs)(a.Z,{form:b,onFinish:d,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",initialValues:{role:g},children:[(0,t.jsx)(a.Z.Item,{label:"Email",name:"user_email",className:"mb-4",children:(0,t.jsx)(n.default,{showSearch:!0,className:"w-full",placeholder:"Search by email",filterOption:!1,onSearch:e=>k(e,"user_email"),onSelect:(e,l)=>M(e,l),options:"user_email"===Z?_:[],loading:j,allowClear:!0})}),(0,t.jsx)("div",{className:"text-center mb-4",children:"OR"}),(0,t.jsx)(a.Z.Item,{label:"User ID",name:"user_id",className:"mb-4",children:(0,t.jsx)(n.default,{showSearch:!0,className:"w-full",placeholder:"Search by user ID",filterOption:!1,onSearch:e=>k(e,"user_id"),onSelect:(e,l)=>M(e,l),options:"user_id"===Z?_:[],loading:j,allowClear:!0})}),(0,t.jsx)(a.Z.Item,{label:"Member Role",name:"role",className:"mb-4",children:(0,t.jsx)(n.default,{defaultValue:g,children:p.map(e=>(0,t.jsx)(n.default.Option,{value:e.value,children:(0,t.jsxs)(m.Z,{title:e.description,children:[(0,t.jsx)("span",{className:"font-medium",children:e.label}),(0,t.jsxs)("span",{className:"ml-2 text-gray-500 text-sm",children:["- ",e.description]})]})},e.value))})}),(0,t.jsx)("div",{className:"text-right mt-4",children:(0,t.jsx)(o.ZP,{type:"default",htmlType:"submit",children:"Add Member"})})]})})}},36894:function(e,l,s){var t=s(57437),i=s(56522),a=s(10032),r=s(37592),n=s(22116),m=s(5545),o=s(2265),d=s(24199);l.Z=e=>{var l,s,c;let{visible:u,onCancel:h,onSubmit:x,initialData:p,mode:g,config:b}=e,[_]=a.Z.useForm();console.log("Initial Data:",p),(0,o.useEffect)(()=>{if(u){if("edit"===g&&p){let e={...p,role:p.role||b.defaultRole,max_budget_in_team:p.max_budget_in_team||null,tpm_limit:p.tpm_limit||null,rpm_limit:p.rpm_limit||null};console.log("Setting form values:",e),_.setFieldsValue(e)}else{var e;_.resetFields(),_.setFieldsValue({role:b.defaultRole||(null===(e=b.roleOptions[0])||void 0===e?void 0:e.value)})}}},[u,p,g,_,b.defaultRole,b.roleOptions]);let v=async e=>{try{let l=Object.entries(e).reduce((e,l)=>{let[s,t]=l;if("string"==typeof t){let l=t.trim();return""===l&&("max_budget_in_team"===s||"tpm_limit"===s||"rpm_limit"===s)?{...e,[s]:null}:{...e,[s]:l}}return{...e,[s]:t}},{});console.log("Submitting form data:",l),x(l),_.resetFields()}catch(e){console.error("Form submission error:",e)}},j=e=>{switch(e.type){case"input":return(0,t.jsx)(i.o,{placeholder:e.placeholder});case"numerical":return(0,t.jsx)(d.Z,{step:e.step||1,min:e.min||0,style:{width:"100%"},placeholder:e.placeholder||"Enter a numerical value"});case"select":var l;return(0,t.jsx)(r.default,{children:null===(l=e.options)||void 0===l?void 0:l.map(e=>(0,t.jsx)(r.default.Option,{value:e.value,children:e.label},e.value))});default:return null}};return(0,t.jsx)(n.Z,{title:b.title||("add"===g?"Add Member":"Edit Member"),open:u,width:1e3,footer:null,onCancel:h,children:(0,t.jsxs)(a.Z,{form:_,onFinish:v,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[b.showEmail&&(0,t.jsx)(a.Z.Item,{label:"Email",name:"user_email",className:"mb-4",rules:[{type:"email",message:"Please enter a valid email!"}],children:(0,t.jsx)(i.o,{placeholder:"user@example.com"})}),b.showEmail&&b.showUserId&&(0,t.jsx)("div",{className:"text-center mb-4",children:(0,t.jsx)(i.x,{children:"OR"})}),b.showUserId&&(0,t.jsx)(a.Z.Item,{label:"User ID",name:"user_id",className:"mb-4",children:(0,t.jsx)(i.o,{placeholder:"user_123"})}),(0,t.jsx)(a.Z.Item,{label:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{children:"Role"}),"edit"===g&&p&&(0,t.jsxs)("span",{className:"text-gray-500 text-sm",children:["(Current: ",(s=p.role,(null===(c=b.roleOptions.find(e=>e.value===s))||void 0===c?void 0:c.label)||s),")"]})]}),name:"role",className:"mb-4",rules:[{required:!0,message:"Please select a role!"}],children:(0,t.jsx)(r.default,{children:"edit"===g&&p?[...b.roleOptions.filter(e=>e.value===p.role),...b.roleOptions.filter(e=>e.value!==p.role)].map(e=>(0,t.jsx)(r.default.Option,{value:e.value,children:e.label},e.value)):b.roleOptions.map(e=>(0,t.jsx)(r.default.Option,{value:e.value,children:e.label},e.value))})}),null===(l=b.additionalFields)||void 0===l?void 0:l.map(e=>(0,t.jsx)(a.Z.Item,{label:e.label,name:e.name,className:"mb-4",rules:e.rules,children:j(e)},e.name)),(0,t.jsxs)("div",{className:"text-right mt-6",children:[(0,t.jsx)(m.ZP,{onClick:h,className:"mr-2",children:"Cancel"}),(0,t.jsx)(m.ZP,{type:"default",htmlType:"submit",children:"add"===g?"Add Member":"Save Changes"})]})]})})}},33293:function(e,l,s){s.d(l,{Z:function(){return et}});var t=s(57437),i=s(33860),a=s(19250),r=s(59872),n=s(33304),m=s(15424),o=s(10900),d=s(30078),c=s(10032),u=s(42264),h=s(5545),x=s(4260),p=s(37592),g=s(99981),b=s(63709),_=s(30401),v=s(78867),j=s(2265),f=s(82586),Z=s(21609),y=s(95096),N=s(46468),w=s(27799),k=s(95920),M=s(68473),C=s(9114),S=s(60131),T=s(24199),I=s(97415),P=s(21425),L=s(36894),O=s(78489),F=s(12514),E=s(21626),D=s(97214),A=s(28241),R=s(58834),z=s(69552),U=s(71876),V=s(84264),B=s(96761),G=s(4156),q=s(85180),K=s(89245),$=s(78355);let J={"/key/generate":"Member can generate a virtual key for this team","/key/service-account/generate":"Member can generate a service account key (not belonging to any user) for this team","/key/update":"Member can update a virtual key belonging to this team","/key/delete":"Member can delete a virtual key belonging to this team","/key/info":"Member can get info about a virtual key belonging to this team","/key/regenerate":"Member can regenerate a virtual key belonging to this team","/key/{key_id}/regenerate":"Member can regenerate a virtual key belonging to this team","/key/list":"Member can list virtual keys belonging to this team","/key/block":"Member can block a virtual key belonging to this team","/key/unblock":"Member can unblock a virtual key belonging to this team"},Q=e=>e.includes("/info")||e.includes("/list")?"GET":"POST",W=e=>{let l=Q(e),s=J[e];if(!s){for(let[l,t]of Object.entries(J))if(e.includes(l)){s=t;break}}return s||(s="Access ".concat(e)),{method:l,endpoint:e,description:s,route:e}};var X=e=>{let{teamId:l,accessToken:s,canEditTeam:i}=e,[r,n]=(0,j.useState)([]),[m,o]=(0,j.useState)([]),[d,c]=(0,j.useState)(!0),[u,x]=(0,j.useState)(!1),[p,g]=(0,j.useState)(!1),b=async()=>{try{if(c(!0),!s)return;let e=await (0,a.getTeamPermissionsCall)(s,l),t=e.all_available_permissions||[];n(t);let i=e.team_member_permissions||[];o(i),g(!1)}catch(e){C.Z.fromBackend("Failed to load permissions"),console.error("Error fetching permissions:",e)}finally{c(!1)}};(0,j.useEffect)(()=>{b()},[l,s]);let _=(e,l)=>{o(l?[...m,e]:m.filter(l=>l!==e)),g(!0)},v=async()=>{try{if(!s)return;x(!0),await (0,a.teamPermissionsUpdateCall)(s,l,m),C.Z.success("Permissions updated successfully"),g(!1)}catch(e){C.Z.fromBackend("Failed to update permissions"),console.error("Error updating permissions:",e)}finally{x(!1)}};if(d)return(0,t.jsx)("div",{className:"p-6 text-center",children:"Loading permissions..."});let f=r.length>0;return(0,t.jsxs)(F.Z,{className:"bg-white shadow-md rounded-md p-6",children:[(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center border-b pb-4 mb-6",children:[(0,t.jsx)(B.Z,{className:"mb-2 sm:mb-0",children:"Member Permissions"}),i&&p&&(0,t.jsxs)("div",{className:"flex gap-3",children:[(0,t.jsx)(h.ZP,{icon:(0,t.jsx)(K.Z,{}),onClick:()=>{b()},children:"Reset"}),(0,t.jsxs)(O.Z,{onClick:v,loading:u,className:"flex items-center gap-2",children:[(0,t.jsx)($.Z,{})," Save Changes"]})]})]}),(0,t.jsx)(V.Z,{className:"mb-6 text-gray-600",children:"Control what team members can do when they are not team admins."}),f?(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(E.Z,{className:" min-w-full",children:[(0,t.jsx)(R.Z,{children:(0,t.jsxs)(U.Z,{children:[(0,t.jsx)(z.Z,{children:"Method"}),(0,t.jsx)(z.Z,{children:"Endpoint"}),(0,t.jsx)(z.Z,{children:"Description"}),(0,t.jsx)(z.Z,{className:"sticky right-0 bg-white shadow-[-4px_0_4px_-4px_rgba(0,0,0,0.1)] text-center",children:"Allow Access"})]})}),(0,t.jsx)(D.Z,{children:r.map(e=>{let l=W(e);return(0,t.jsxs)(U.Z,{className:"hover:bg-gray-50 transition-colors",children:[(0,t.jsx)(A.Z,{children:(0,t.jsx)("span",{className:"px-2 py-1 rounded text-xs font-medium ".concat("GET"===l.method?"bg-blue-100 text-blue-800":"bg-green-100 text-green-800"),children:l.method})}),(0,t.jsx)(A.Z,{children:(0,t.jsx)("span",{className:"font-mono text-sm text-gray-800",children:l.endpoint})}),(0,t.jsx)(A.Z,{className:"text-gray-700",children:l.description}),(0,t.jsx)(A.Z,{className:"sticky right-0 bg-white shadow-[-4px_0_4px_-4px_rgba(0,0,0,0.1)] text-center",children:(0,t.jsx)(G.Z,{checked:m.includes(e),onChange:l=>_(e,l.target.checked),disabled:!i})})]},e)})})]})}):(0,t.jsx)("div",{className:"py-12",children:(0,t.jsx)(q.Z,{description:"No permissions available"})})]})},Y=s(47323),H=s(53410),ee=s(74998),el=e=>{let{teamData:l,canEditTeam:s,handleMemberDelete:i,setSelectedEditMember:a,setIsEditMemberModalVisible:n,setIsAddMemberModalVisible:o}=e,d=e=>{if(null==e)return"0";if("number"==typeof e){let l=Number(e);return l===Math.floor(l)?l.toString():(0,r.pw)(l,8).replace(/\.?0+$/,"")}return"0"},c=e=>{if(!e)return 0;let s=l.team_memberships.find(l=>l.user_id===e);return(null==s?void 0:s.spend)||0},u=e=>{var s;if(!e)return null;let t=l.team_memberships.find(l=>l.user_id===e);console.log("membership=".concat(t));let i=null==t?void 0:null===(s=t.litellm_budget_table)||void 0===s?void 0:s.max_budget;return null==i?null:d(i)},h=e=>{var s,t;if(!e)return"No Limits";let i=l.team_memberships.find(l=>l.user_id===e),a=null==i?void 0:null===(s=i.litellm_budget_table)||void 0===s?void 0:s.rpm_limit,r=null==i?void 0:null===(t=i.litellm_budget_table)||void 0===t?void 0:t.tpm_limit,n=[a?"".concat(d(a)," RPM"):null,r?"".concat(d(r)," TPM"):null].filter(Boolean);return n.length>0?n.join(" / "):"No Limits"};return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(F.Z,{className:"w-full mx-auto flex-auto overflow-auto max-h-[50vh]",children:(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(E.Z,{className:"min-w-full",children:[(0,t.jsx)(R.Z,{children:(0,t.jsxs)(U.Z,{children:[(0,t.jsx)(z.Z,{children:"User ID"}),(0,t.jsx)(z.Z,{children:"User Email"}),(0,t.jsx)(z.Z,{children:"Role"}),(0,t.jsxs)(z.Z,{children:["Team Member Spend (USD)"," ",(0,t.jsx)(g.Z,{title:"This is the amount spent by a user in the team.",children:(0,t.jsx)(m.Z,{})})]}),(0,t.jsx)(z.Z,{children:"Team Member Budget (USD)"}),(0,t.jsxs)(z.Z,{children:["Team Member Rate Limits"," ",(0,t.jsx)(g.Z,{title:"Rate limits for this member's usage within this team.",children:(0,t.jsx)(m.Z,{})})]}),(0,t.jsx)(z.Z,{className:"sticky right-0 bg-white z-10 border-l border-gray-200",children:"Actions"})]})}),(0,t.jsx)(D.Z,{children:l.team_info.members_with_roles.map((e,m)=>(0,t.jsxs)(U.Z,{children:[(0,t.jsx)(A.Z,{children:(0,t.jsx)(V.Z,{className:"font-mono",children:e.user_id})}),(0,t.jsx)(A.Z,{children:(0,t.jsx)(V.Z,{className:"font-mono",children:e.user_email?e.user_email:"No Email"})}),(0,t.jsx)(A.Z,{children:(0,t.jsx)(V.Z,{className:"font-mono",children:e.role})}),(0,t.jsx)(A.Z,{children:(0,t.jsxs)(V.Z,{className:"font-mono",children:["$",(0,r.pw)(c(e.user_id),4)]})}),(0,t.jsx)(A.Z,{children:(0,t.jsx)(V.Z,{className:"font-mono",children:u(e.user_id)?"$".concat((0,r.pw)(Number(u(e.user_id)),4)):"No Limit"})}),(0,t.jsx)(A.Z,{children:(0,t.jsx)(V.Z,{className:"font-mono",children:h(e.user_id)})}),(0,t.jsx)(A.Z,{className:"sticky right-0 bg-white z-10 border-l border-gray-200",children:s&&(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(Y.Z,{icon:H.Z,size:"sm",onClick:()=>{var s,t,i;let r=l.team_memberships.find(l=>l.user_id===e.user_id);a({...e,max_budget_in_team:(null==r?void 0:null===(s=r.litellm_budget_table)||void 0===s?void 0:s.max_budget)||null,tpm_limit:(null==r?void 0:null===(t=r.litellm_budget_table)||void 0===t?void 0:t.tpm_limit)||null,rpm_limit:(null==r?void 0:null===(i=r.litellm_budget_table)||void 0===i?void 0:i.rpm_limit)||null}),n(!0)},className:"cursor-pointer hover:text-blue-600"}),(0,t.jsx)(Y.Z,{icon:ee.Z,size:"sm",onClick:()=>i(e),className:"cursor-pointer hover:text-red-600"})]})})]},m))})]})})}),(0,t.jsx)(O.Z,{onClick:()=>o(!0),children:"Add Member"})]})};let es=(e,l)=>{let s=[];return s=e?e.models.includes("all-proxy-models")?l:e.models.length>0?e.models:l:l,(0,N.Ob)(s,l)};var et=e=>{var l,s,O,F,E,D,A,R,z,U,V,B,G,q,K,$,J,Q,W,Y,H;let ee;let{teamId:et,onClose:ei,accessToken:ea,is_team_admin:er,is_proxy_admin:en,userModels:em,editTeam:eo,premiumUser:ed=!1,onUpdate:ec}=e,[eu,eh]=(0,j.useState)(null),[ex,ep]=(0,j.useState)(!0),[eg,eb]=(0,j.useState)(!1),[e_]=c.Z.useForm(),[ev,ej]=(0,j.useState)(!1),[ef,eZ]=(0,j.useState)(null),[ey,eN]=(0,j.useState)(!1),[ew,ek]=(0,j.useState)([]),[eM,eC]=(0,j.useState)(!1),[eS,eT]=(0,j.useState)({}),[eI,eP]=(0,j.useState)([]),[eL,eO]=(0,j.useState)(null),[eF,eE]=(0,j.useState)(!1),[eD,eA]=(0,j.useState)(!1),[eR,ez]=(0,j.useState)(!1),[eU,eV]=(0,j.useState)(null);console.log("userModels in team info",em);let eB=er||en,eG=async()=>{try{if(ep(!0),!ea)return;let e=await (0,a.teamInfoCall)(ea,et);eh(e)}catch(e){C.Z.fromBackend("Failed to load team information"),console.error("Error fetching team info:",e)}finally{ep(!1)}};(0,j.useEffect)(()=>{eG()},[et,ea]),(0,j.useEffect)(()=>{(async()=>{var e;if(!ea||!(null==eu?void 0:null===(e=eu.team_info)||void 0===e?void 0:e.organization_id)){eV(null);return}try{let e=await (0,a.organizationInfoCall)(ea,eu.team_info.organization_id);eV(e)}catch(e){console.error("Error fetching organization info:",e),eV(null)}})()},[ea,null==eu?void 0:null===(l=eu.team_info)||void 0===l?void 0:l.organization_id]);let eq=(0,j.useMemo)(()=>es(eU,em),[eU,em]);(0,j.useEffect)(()=>{(async()=>{try{if(!ea)return;let e=(await (0,a.getGuardrailsList)(ea)).guardrails.map(e=>e.guardrail_name);eP(e)}catch(e){console.error("Failed to fetch guardrails:",e)}})()},[ea]);let eK=async e=>{try{if(null==ea)return;let l={user_email:e.user_email,user_id:e.user_id,role:e.role};await (0,a.teamMemberAddCall)(ea,et,l),C.Z.success("Team member added successfully"),eb(!1),e_.resetFields();let s=await (0,a.teamInfoCall)(ea,et);eh(s),ec(s)}catch(i){var l,s,t;let e="Failed to add team member";(null==i?void 0:null===(t=i.raw)||void 0===t?void 0:null===(s=t.detail)||void 0===s?void 0:null===(l=s.error)||void 0===l?void 0:l.includes("Assigning team admins is a premium feature"))?e="Assigning admins is an enterprise-only feature. Please upgrade your LiteLLM plan to enable this.":(null==i?void 0:i.message)&&(e=i.message),C.Z.fromBackend(e),console.error("Error adding team member:",i)}},e$=async e=>{try{if(null==ea)return;let l={user_email:e.user_email,user_id:e.user_id,role:e.role,max_budget_in_team:e.max_budget_in_team,tpm_limit:e.tpm_limit,rpm_limit:e.rpm_limit};console.log("Updating member with values:",l),u.ZP.destroy(),await (0,a.teamMemberUpdateCall)(ea,et,l),C.Z.success("Team member updated successfully"),ej(!1);let s=await (0,a.teamInfoCall)(ea,et);eh(s),ec(s)}catch(t){var l,s;let e="Failed to update team member";(null==t?void 0:null===(s=t.raw)||void 0===s?void 0:null===(l=s.detail)||void 0===l?void 0:l.includes("Assigning team admins is a premium feature"))?e="Assigning admins is an enterprise-only feature. Please upgrade your LiteLLM plan to enable this.":(null==t?void 0:t.message)&&(e=t.message),ej(!1),u.ZP.destroy(),C.Z.fromBackend(e),console.error("Error updating team member:",t)}},eJ=async()=>{if(eL&&ea){eA(!0);try{await (0,a.teamMemberDeleteCall)(ea,et,eL),C.Z.success("Team member removed successfully");let e=await (0,a.teamInfoCall)(ea,et);eh(e),ec(e)}catch(e){C.Z.fromBackend("Failed to remove team member"),console.error("Error removing team member:",e)}finally{eA(!1),eE(!1),eO(null)}}},eQ=async e=>{try{if(!ea)return;ez(!0);let l={};try{l=e.metadata?JSON.parse(e.metadata):{}}catch(e){C.Z.fromBackend("Invalid JSON in metadata field");return}let s=e=>null==e||"string"==typeof e&&""===e.trim()||"number"==typeof e&&Number.isNaN(e)?null:e,t={team_id:et,team_alias:e.team_alias,models:e.models,tpm_limit:s(e.tpm_limit),rpm_limit:s(e.rpm_limit),max_budget:e.max_budget,budget_duration:e.budget_duration,metadata:{...l,guardrails:e.guardrails||[],logging:e.logging_settings||[]},organization_id:e.organization_id};t.max_budget=(0,n.C)(t.max_budget),void 0!==e.team_member_budget&&(t.team_member_budget=Number(e.team_member_budget)),void 0!==e.team_member_key_duration&&(t.team_member_key_duration=e.team_member_key_duration),(void 0!==e.team_member_tpm_limit||void 0!==e.team_member_rpm_limit)&&(t.team_member_tpm_limit=s(e.team_member_tpm_limit),t.team_member_rpm_limit=s(e.team_member_rpm_limit));let{servers:i,accessGroups:r}=e.mcp_servers_and_groups||{servers:[],accessGroups:[]},m=new Set(i||[]),o=Object.fromEntries(Object.entries(e.mcp_tool_permissions||{}).filter(e=>{let[l]=e;return m.has(l)}));t.object_permission={},i&&(t.object_permission.mcp_servers=i),r&&(t.object_permission.mcp_access_groups=r),o&&(t.object_permission.mcp_tool_permissions=o),delete e.mcp_servers_and_groups,delete e.mcp_tool_permissions;let{agents:d,accessGroups:c}=e.agents_and_groups||{agents:[],accessGroups:[]};d&&d.length>0&&(t.object_permission.agents=d),c&&c.length>0&&(t.object_permission.agent_access_groups=c),delete e.agents_and_groups,await (0,a.teamUpdateCall)(ea,t),C.Z.success("Team settings updated successfully"),eN(!1),eG()}catch(e){console.error("Error updating team:",e)}finally{ez(!1)}};if(ex)return(0,t.jsx)("div",{className:"p-4",children:"Loading..."});if(!(null==eu?void 0:eu.team_info))return(0,t.jsx)("div",{className:"p-4",children:"Team not found"});let{team_info:eW}=eu,eX=async(e,l)=>{await (0,r.vQ)(e)&&(eT(e=>({...e,[l]:!0})),setTimeout(()=>{eT(e=>({...e,[l]:!1}))},2e3))};return(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsx)("div",{className:"flex justify-between items-center mb-6",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(d.zx,{icon:o.Z,variant:"light",onClick:ei,className:"mb-4",children:"Back to Teams"}),(0,t.jsx)(d.Dx,{children:eW.team_alias}),(0,t.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)(d.xv,{className:"text-gray-500 font-mono",children:eW.team_id}),(0,t.jsx)(h.ZP,{type:"text",size:"small",icon:eS["team-id"]?(0,t.jsx)(_.Z,{size:12}):(0,t.jsx)(v.Z,{size:12}),onClick:()=>eX(eW.team_id,"team-id"),className:"left-2 z-10 transition-all duration-200 ".concat(eS["team-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]})}),(0,t.jsxs)(d.v0,{defaultIndex:eo?3:0,children:[(0,t.jsx)(d.td,{className:"mb-4",children:[(0,t.jsx)(d.OK,{children:"Overview"},"overview"),...eB?[(0,t.jsx)(d.OK,{children:"Members"},"members"),(0,t.jsx)(d.OK,{children:"Member Permissions"},"member-permissions"),(0,t.jsx)(d.OK,{children:"Settings"},"settings")]:[]]}),(0,t.jsxs)(d.nP,{children:[(0,t.jsx)(d.x4,{children:(0,t.jsxs)(d.rj,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,t.jsxs)(d.Zb,{children:[(0,t.jsx)(d.xv,{children:"Budget Status"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(d.Dx,{children:["$",(0,r.pw)(eW.spend,4)]}),(0,t.jsxs)(d.xv,{children:["of ",null===eW.max_budget?"Unlimited":"$".concat((0,r.pw)(eW.max_budget,4))]}),eW.budget_duration&&(0,t.jsxs)(d.xv,{className:"text-gray-500",children:["Reset: ",eW.budget_duration]}),(0,t.jsx)("br",{}),eW.team_member_budget_table&&(0,t.jsxs)(d.xv,{className:"text-gray-500",children:["Team Member Budget: $",(0,r.pw)(eW.team_member_budget_table.max_budget,4)]})]})]}),(0,t.jsxs)(d.Zb,{children:[(0,t.jsx)(d.xv,{children:"Rate Limits"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(d.xv,{children:["TPM: ",eW.tpm_limit||"Unlimited"]}),(0,t.jsxs)(d.xv,{children:["RPM: ",eW.rpm_limit||"Unlimited"]}),eW.max_parallel_requests&&(0,t.jsxs)(d.xv,{children:["Max Parallel Requests: ",eW.max_parallel_requests]})]})]}),(0,t.jsxs)(d.Zb,{children:[(0,t.jsx)(d.xv,{children:"Models"}),(0,t.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:0===eW.models.length?(0,t.jsx)(d.Ct,{color:"red",children:"All proxy models"}):eW.models.map((e,l)=>(0,t.jsx)(d.Ct,{color:"red",children:e},l))})]}),(0,t.jsxs)(d.Zb,{children:[(0,t.jsx)(d.xv,{className:"font-semibold text-gray-900",children:"Virtual Keys"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(d.xv,{children:["User Keys: ",eu.keys.filter(e=>e.user_id).length]}),(0,t.jsxs)(d.xv,{children:["Service Account Keys: ",eu.keys.filter(e=>!e.user_id).length]}),(0,t.jsxs)(d.xv,{className:"text-gray-500",children:["Total: ",eu.keys.length]})]})]}),(0,t.jsx)(S.Z,{objectPermission:eW.object_permission,variant:"card",accessToken:ea}),(0,t.jsx)(w.Z,{loggingConfigs:(null===(s=eW.metadata)||void 0===s?void 0:s.logging)||[],disabledCallbacks:[],variant:"card"})]})}),(0,t.jsx)(d.x4,{children:(0,t.jsx)(el,{teamData:eu,canEditTeam:eB,handleMemberDelete:e=>{eO(e),eE(!0)},setSelectedEditMember:eZ,setIsEditMemberModalVisible:ej,setIsAddMemberModalVisible:eb})}),eB&&(0,t.jsx)(d.x4,{children:(0,t.jsx)(X,{teamId:et,accessToken:ea,canEditTeam:eB})}),(0,t.jsx)(d.x4,{children:(0,t.jsxs)(d.Zb,{className:"overflow-y-auto max-h-[65vh]",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsx)(d.Dx,{children:"Team Settings"}),eB&&!ey&&(0,t.jsx)(d.zx,{onClick:()=>eN(!0),children:"Edit Settings"})]}),ey?(0,t.jsxs)(c.Z,{form:e_,onFinish:eQ,initialValues:{...eW,team_alias:eW.team_alias,models:eW.models,tpm_limit:eW.tpm_limit,rpm_limit:eW.rpm_limit,max_budget:eW.max_budget,budget_duration:eW.budget_duration,team_member_tpm_limit:null===(O=eW.team_member_budget_table)||void 0===O?void 0:O.tpm_limit,team_member_rpm_limit:null===(F=eW.team_member_budget_table)||void 0===F?void 0:F.rpm_limit,guardrails:(null===(E=eW.metadata)||void 0===E?void 0:E.guardrails)||[],disable_global_guardrails:(null===(D=eW.metadata)||void 0===D?void 0:D.disable_global_guardrails)||!1,metadata:eW.metadata?JSON.stringify((e=>{let{logging:l,...s}=e;return s})(eW.metadata),null,2):"",logging_settings:(null===(A=eW.metadata)||void 0===A?void 0:A.logging)||[],organization_id:eW.organization_id,vector_stores:(null===(R=eW.object_permission)||void 0===R?void 0:R.vector_stores)||[],mcp_servers:(null===(z=eW.object_permission)||void 0===z?void 0:z.mcp_servers)||[],mcp_access_groups:(null===(U=eW.object_permission)||void 0===U?void 0:U.mcp_access_groups)||[],mcp_servers_and_groups:{servers:(null===(V=eW.object_permission)||void 0===V?void 0:V.mcp_servers)||[],accessGroups:(null===(B=eW.object_permission)||void 0===B?void 0:B.mcp_access_groups)||[]},mcp_tool_permissions:(null===(G=eW.object_permission)||void 0===G?void 0:G.mcp_tool_permissions)||{},agents_and_groups:{agents:(null===(q=eW.object_permission)||void 0===q?void 0:q.agents)||[],accessGroups:(null===(K=eW.object_permission)||void 0===K?void 0:K.agent_access_groups)||[]}},layout:"vertical",children:[(0,t.jsx)(c.Z.Item,{label:"Team Name",name:"team_alias",rules:[{required:!0,message:"Please input a team name"}],children:(0,t.jsx)(x.default,{type:""})}),(0,t.jsx)(c.Z.Item,{label:"Models",name:"models",rules:[{required:!0,message:"Please select at least one model"}],children:(0,t.jsxs)(p.default,{mode:"multiple",placeholder:"Select models",children:[(ee=!1,eU?(0===eU.models.length||eU.models.includes("all-proxy-models"))&&(ee=!0):ee=en||em.includes("all-proxy-models"),ee?(0,t.jsx)(p.default.Option,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"):null),!eU||eU.models.includes("no-default-models")?(0,t.jsx)(p.default.Option,{value:"no-default-models",children:"No Default Models"},"no-default-models"):null,Array.from(new Set(eq)).map((e,l)=>(0,t.jsx)(p.default.Option,{value:e,children:(0,N.W0)(e)},l))]})}),(0,t.jsx)(c.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,t.jsx)(T.Z,{step:.01,precision:2,style:{width:"100%"}})}),(0,t.jsx)(c.Z.Item,{label:"Team Member Budget (USD)",name:"team_member_budget",tooltip:"This is the individual budget for a user in the team.",children:(0,t.jsx)(T.Z,{step:.01,precision:2,style:{width:"100%"}})}),(0,t.jsx)(c.Z.Item,{label:"Team Member Key Duration (eg: 1d, 1mo)",name:"team_member_key_duration",tooltip:"Set a limit to the duration of a team member's key. Format: 30s (seconds), 30m (minutes), 30h (hours), 30d (days), 1mo (month)",children:(0,t.jsx)(d.oi,{placeholder:"e.g., 30d"})}),(0,t.jsx)(c.Z.Item,{label:"Team Member TPM Limit",name:"team_member_tpm_limit",tooltip:"Default tokens per minute limit for an individual team member. This limit applies to all requests the user makes within this team. Can be overridden per member.",children:(0,t.jsx)(T.Z,{step:1,style:{width:"100%"},placeholder:"e.g., 1000"})}),(0,t.jsx)(c.Z.Item,{label:"Team Member RPM Limit",name:"team_member_rpm_limit",tooltip:"Default requests per minute limit for an individual team member. This limit applies to all requests the user makes within this team. Can be overridden per member.",children:(0,t.jsx)(T.Z,{step:1,style:{width:"100%"},placeholder:"e.g., 100"})}),(0,t.jsx)(c.Z.Item,{label:"Reset Budget",name:"budget_duration",children:(0,t.jsxs)(p.default,{placeholder:"n/a",children:[(0,t.jsx)(p.default.Option,{value:"24h",children:"daily"}),(0,t.jsx)(p.default.Option,{value:"7d",children:"weekly"}),(0,t.jsx)(p.default.Option,{value:"30d",children:"monthly"})]})}),(0,t.jsx)(c.Z.Item,{label:"Tokens per minute Limit (TPM)",name:"tpm_limit",children:(0,t.jsx)(T.Z,{step:1,style:{width:"100%"}})}),(0,t.jsx)(c.Z.Item,{label:"Requests per minute Limit (RPM)",name:"rpm_limit",children:(0,t.jsx)(T.Z,{step:1,style:{width:"100%"}})}),(0,t.jsx)(c.Z.Item,{label:(0,t.jsxs)("span",{children:["Guardrails"," ",(0,t.jsx)(g.Z,{title:"Setup your first guardrail",children:(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/quick_start",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(m.Z,{style:{marginLeft:"4px"}})})})]}),name:"guardrails",help:"Select existing guardrails or enter new ones",children:(0,t.jsx)(p.default,{mode:"tags",placeholder:"Select or enter guardrails",options:eI.map(e=>({value:e,label:e}))})}),(0,t.jsx)(c.Z.Item,{label:(0,t.jsxs)("span",{children:["Disable Global Guardrails"," ",(0,t.jsx)(g.Z,{title:"When enabled, this team will bypass any guardrails configured to run on every request (global guardrails)",children:(0,t.jsx)(m.Z,{style:{marginLeft:"4px"}})})]}),name:"disable_global_guardrails",valuePropName:"checked",help:"Bypass global guardrails for this team",children:(0,t.jsx)(b.Z,{checkedChildren:"Yes",unCheckedChildren:"No"})}),(0,t.jsx)(c.Z.Item,{label:"Vector Stores",name:"vector_stores",children:(0,t.jsx)(I.Z,{onChange:e=>e_.setFieldValue("vector_stores",e),value:e_.getFieldValue("vector_stores"),accessToken:ea||"",placeholder:"Select vector stores"})}),(0,t.jsx)(c.Z.Item,{label:"Allowed Pass Through Routes",name:"allowed_passthrough_routes",children:(0,t.jsx)(y.Z,{onChange:e=>e_.setFieldValue("allowed_passthrough_routes",e),value:e_.getFieldValue("allowed_passthrough_routes"),accessToken:ea||"",placeholder:"Select pass through routes"})}),(0,t.jsx)(c.Z.Item,{label:"MCP Servers / Access Groups",name:"mcp_servers_and_groups",children:(0,t.jsx)(k.Z,{onChange:e=>e_.setFieldValue("mcp_servers_and_groups",e),value:e_.getFieldValue("mcp_servers_and_groups"),accessToken:ea||"",placeholder:"Select MCP servers or access groups (optional)"})}),(0,t.jsx)(c.Z.Item,{name:"mcp_tool_permissions",initialValue:{},hidden:!0,children:(0,t.jsx)(x.default,{type:"hidden"})}),(0,t.jsx)(c.Z.Item,{noStyle:!0,shouldUpdate:(e,l)=>e.mcp_servers_and_groups!==l.mcp_servers_and_groups||e.mcp_tool_permissions!==l.mcp_tool_permissions,children:()=>{var e;return(0,t.jsx)("div",{className:"mb-6",children:(0,t.jsx)(M.Z,{accessToken:ea||"",selectedServers:(null===(e=e_.getFieldValue("mcp_servers_and_groups"))||void 0===e?void 0:e.servers)||[],toolPermissions:e_.getFieldValue("mcp_tool_permissions")||{},onChange:e=>e_.setFieldsValue({mcp_tool_permissions:e})})})}}),(0,t.jsx)(c.Z.Item,{label:"Agents / Access Groups",name:"agents_and_groups",children:(0,t.jsx)(f.Z,{onChange:e=>e_.setFieldValue("agents_and_groups",e),value:e_.getFieldValue("agents_and_groups"),accessToken:ea||"",placeholder:"Select agents or access groups (optional)"})}),(0,t.jsx)(c.Z.Item,{label:"Organization ID",name:"organization_id",children:(0,t.jsx)(x.default,{type:"",disabled:!0})}),(0,t.jsx)(c.Z.Item,{label:"Logging Settings",name:"logging_settings",children:(0,t.jsx)(P.Z,{value:e_.getFieldValue("logging_settings"),onChange:e=>e_.setFieldValue("logging_settings",e)})}),(0,t.jsx)(c.Z.Item,{label:"Metadata",name:"metadata",children:(0,t.jsx)(x.default.TextArea,{rows:10})}),(0,t.jsx)("div",{className:"sticky z-10 bg-white p-4 border-t border-gray-200 bottom-[-1.5rem] inset-x-[-1.5rem]",children:(0,t.jsxs)("div",{className:"flex justify-end items-center gap-2",children:[(0,t.jsx)(d.zx,{variant:"secondary",onClick:()=>eN(!1),disabled:eR,children:"Cancel"}),(0,t.jsx)(d.zx,{type:"submit",loading:eR,children:"Save Changes"})]})})]}):(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(d.xv,{className:"font-medium",children:"Team Name"}),(0,t.jsx)("div",{children:eW.team_alias})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(d.xv,{className:"font-medium",children:"Team ID"}),(0,t.jsx)("div",{className:"font-mono",children:eW.team_id})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(d.xv,{className:"font-medium",children:"Created At"}),(0,t.jsx)("div",{children:new Date(eW.created_at).toLocaleString()})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(d.xv,{className:"font-medium",children:"Models"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:eW.models.map((e,l)=>(0,t.jsx)(d.Ct,{color:"red",children:e},l))})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(d.xv,{className:"font-medium",children:"Rate Limits"}),(0,t.jsxs)("div",{children:["TPM: ",eW.tpm_limit||"Unlimited"]}),(0,t.jsxs)("div",{children:["RPM: ",eW.rpm_limit||"Unlimited"]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(d.xv,{className:"font-medium",children:"Team Budget"}),(0,t.jsxs)("div",{children:["Max Budget:"," ",null!==eW.max_budget?"$".concat((0,r.pw)(eW.max_budget,4)):"No Limit"]}),(0,t.jsxs)("div",{children:["Budget Reset: ",eW.budget_duration||"Never"]})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)(d.xv,{className:"font-medium",children:["Team Member Settings"," ",(0,t.jsx)(g.Z,{title:"These are limits on individual team members",children:(0,t.jsx)(m.Z,{style:{marginLeft:"4px"}})})]}),(0,t.jsxs)("div",{children:["Max Budget: ",(null===($=eW.team_member_budget_table)||void 0===$?void 0:$.max_budget)||"No Limit"]}),(0,t.jsxs)("div",{children:["Key Duration: ",(null===(J=eW.metadata)||void 0===J?void 0:J.team_member_key_duration)||"No Limit"]}),(0,t.jsxs)("div",{children:["TPM Limit: ",(null===(Q=eW.team_member_budget_table)||void 0===Q?void 0:Q.tpm_limit)||"No Limit"]}),(0,t.jsxs)("div",{children:["RPM Limit: ",(null===(W=eW.team_member_budget_table)||void 0===W?void 0:W.rpm_limit)||"No Limit"]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(d.xv,{className:"font-medium",children:"Organization ID"}),(0,t.jsx)("div",{children:eW.organization_id})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(d.xv,{className:"font-medium",children:"Status"}),(0,t.jsx)(d.Ct,{color:eW.blocked?"red":"green",children:eW.blocked?"Blocked":"Active"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(d.xv,{className:"font-medium",children:"Disable Global Guardrails"}),(0,t.jsx)("div",{children:(null===(Y=eW.metadata)||void 0===Y?void 0:Y.disable_global_guardrails)===!0?(0,t.jsx)(d.Ct,{color:"yellow",children:"Enabled - Global guardrails bypassed"}):(0,t.jsx)(d.Ct,{color:"green",children:"Disabled - Global guardrails active"})})]}),(0,t.jsx)(S.Z,{objectPermission:eW.object_permission,variant:"inline",className:"pt-4 border-t border-gray-200",accessToken:ea}),(0,t.jsx)(w.Z,{loggingConfigs:(null===(H=eW.metadata)||void 0===H?void 0:H.logging)||[],disabledCallbacks:[],variant:"inline",className:"pt-4 border-t border-gray-200"})]})]})})]})]}),(0,t.jsx)(L.Z,{visible:ev,onCancel:()=>ej(!1),onSubmit:e$,initialData:ef,mode:"edit",config:{title:"Edit Member",showEmail:!0,showUserId:!0,roleOptions:[{label:"Admin",value:"admin"},{label:"User",value:"user"}],additionalFields:[{name:"max_budget_in_team",label:(0,t.jsxs)("span",{children:["Team Member Budget (USD)"," ",(0,t.jsx)(g.Z,{title:"Maximum amount in USD this member can spend within this team. This is separate from any global user budget limits",children:(0,t.jsx)(m.Z,{style:{marginLeft:"4px"}})})]}),type:"numerical",step:.01,min:0,placeholder:"Budget limit for this member within this team"},{name:"tpm_limit",label:(0,t.jsxs)("span",{children:["Team Member TPM Limit"," ",(0,t.jsx)(g.Z,{title:"Maximum tokens per minute this member can use within this team. This is separate from any global user TPM limit",children:(0,t.jsx)(m.Z,{style:{marginLeft:"4px"}})})]}),type:"numerical",step:1,min:0,placeholder:"Tokens per minute limit for this member in this team"},{name:"rpm_limit",label:(0,t.jsxs)("span",{children:["Team Member RPM Limit"," ",(0,t.jsx)(g.Z,{title:"Maximum requests per minute this member can make within this team. This is separate from any global user RPM limit",children:(0,t.jsx)(m.Z,{style:{marginLeft:"4px"}})})]}),type:"numerical",step:1,min:0,placeholder:"Requests per minute limit for this member in this team"}]}}),(0,t.jsx)(i.Z,{isVisible:eg,onCancel:()=>eb(!1),onSubmit:eK,accessToken:ea}),(0,t.jsx)(Z.Z,{isOpen:eF,title:"Delete Team Member",alertMessage:"Removing team members will also delete any keys created by or created for this member.",message:"Are you sure you want to remove this member from the team? This action cannot be undone.",resourceInformationTitle:"Team Member Information",resourceInformation:[{label:"User ID",value:null==eL?void 0:eL.user_id,code:!0},{label:"Email",value:null==eL?void 0:eL.user_email},{label:"Role",value:null==eL?void 0:eL.role}],onCancel:()=>{eE(!1),eO(null)},onOk:eJ,confirmLoading:eD})]})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/2012-4854cbc146d8a7eb.js b/litellm/proxy/_experimental/out/_next/static/chunks/2012-4854cbc146d8a7eb.js new file mode 100644 index 0000000000..65f6b48bc3 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/2012-4854cbc146d8a7eb.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2012],{26210:function(e,l,s){s.d(l,{UQ:function(){return t.Z},X1:function(){return i.Z},_m:function(){return a.Z},oi:function(){return n.Z},xv:function(){return r.Z}});var t=s(87452),i=s(88829),a=s(72208),r=s(84264),n=s(49566)},30078:function(e,l,s){s.d(l,{Ct:function(){return t.Z},Dx:function(){return x.Z},OK:function(){return n.Z},Zb:function(){return a.Z},nP:function(){return c.Z},oi:function(){return h.Z},rj:function(){return r.Z},td:function(){return o.Z},v0:function(){return m.Z},x4:function(){return d.Z},xv:function(){return u.Z},zx:function(){return i.Z}});var t=s(41649),i=s(78489),a=s(12514),r=s(67101),n=s(12485),m=s(18135),o=s(35242),d=s(29706),c=s(77991),u=s(84264),h=s(49566),x=s(96761)},62490:function(e,l,s){s.d(l,{Ct:function(){return t.Z},RM:function(){return n.Z},SC:function(){return c.Z},Zb:function(){return a.Z},iA:function(){return r.Z},pj:function(){return m.Z},ss:function(){return o.Z},xs:function(){return d.Z},xv:function(){return u.Z},zx:function(){return i.Z}});var t=s(41649),i=s(78489),a=s(12514),r=s(21626),n=s(97214),m=s(28241),o=s(58834),d=s(69552),c=s(71876),u=s(84264)},11318:function(e,l,s){s.d(l,{Z:function(){return n}});var t=s(2265),i=s(80443),a=s(19250);let r=async(e,l,s,t)=>"Admin"!=s&&"Admin Viewer"!=s?await (0,a.teamListCall)(e,(null==t?void 0:t.organization_id)||null,l):await (0,a.teamListCall)(e,(null==t?void 0:t.organization_id)||null);var n=()=>{let[e,l]=(0,t.useState)([]),{accessToken:s,userId:a,userRole:n}=(0,i.Z)();return(0,t.useEffect)(()=>{(async()=>{l(await r(s,a,n,null))})()},[s,a,n]),{teams:e,setTeams:l}}},21609:function(e,l,s){s.d(l,{Z:function(){return d}});var t=s(57437),i=s(57840),a=s(22116),r=s(51653),n=s(76188),m=s(4260),o=s(2265);function d(e){let{isOpen:l,title:s,alertMessage:d,message:c,resourceInformationTitle:u,resourceInformation:h,onCancel:x,onOk:p,confirmLoading:g,requiredConfirmation:b}=e,{Title:_,Text:v}=i.default,[j,f]=(0,o.useState)("");return(0,o.useEffect)(()=>{l&&f("")},[l]),(0,t.jsx)(a.Z,{title:s,open:l,onOk:p,onCancel:x,confirmLoading:g,okText:g?"Deleting...":"Delete",cancelText:"Cancel",okButtonProps:{danger:!0,disabled:!!b&&j!==b||g},cancelButtonProps:{disabled:g},children:(0,t.jsxs)("div",{className:"space-y-4",children:[d&&(0,t.jsx)(r.Z,{message:d,type:"warning"}),(0,t.jsxs)("div",{className:"mt-4 p-4 bg-red-50 rounded-lg border border-red-200",children:[(0,t.jsx)(_,{level:5,className:"mb-3 text-gray-900",children:u}),(0,t.jsx)(n.Z,{column:1,size:"small",children:h&&h.map(e=>{let{label:l,value:s,...i}=e;return(0,t.jsx)(n.Z.Item,{label:(0,t.jsx)("span",{className:"font-semibold text-gray-700",children:l}),children:(0,t.jsx)(v,{...i,children:null!=s?s:"-"})},l)})})]}),(0,t.jsx)("div",{children:(0,t.jsx)(v,{children:c})}),b&&(0,t.jsxs)("div",{className:"mb-6 mt-4 pt-4 border-t border-gray-200",children:[(0,t.jsxs)(v,{className:"block text-base font-medium text-gray-700 mb-2",children:[(0,t.jsx)(v,{children:"Type "}),(0,t.jsx)(v,{strong:!0,type:"danger",children:b}),(0,t.jsx)(v,{children:" to confirm deletion:"})]}),(0,t.jsx)(m.default,{value:j,onChange:e=>f(e.target.value),placeholder:b,className:"rounded-md text-base border-gray-200",autoFocus:!0})]})]})})}},33860:function(e,l,s){var t=s(57437),i=s(2265),a=s(10032),r=s(22116),n=s(37592),m=s(99981),o=s(5545),d=s(7310),c=s.n(d),u=s(19250);l.Z=e=>{let{isVisible:l,onCancel:s,onSubmit:d,accessToken:h,title:x="Add Team Member",roles:p=[{label:"admin",value:"admin",description:"Admin role. Can create team keys, add members, and manage settings."},{label:"user",value:"user",description:"User role. Can view team info, but not manage it."}],defaultRole:g="user"}=e,[b]=a.Z.useForm(),[_,v]=(0,i.useState)([]),[j,f]=(0,i.useState)(!1),[Z,y]=(0,i.useState)("user_email"),N=async(e,l)=>{if(!e){v([]);return}f(!0);try{let s=new URLSearchParams;if(s.append(l,e),null==h)return;let t=(await (0,u.userFilterUICall)(h,s)).map(e=>({label:"user_email"===l?"".concat(e.user_email):"".concat(e.user_id),value:"user_email"===l?e.user_email:e.user_id,user:e}));v(t)}catch(e){console.error("Error fetching users:",e)}finally{f(!1)}},w=(0,i.useCallback)(c()((e,l)=>N(e,l),300),[]),k=(e,l)=>{y(l),w(e,l)},M=(e,l)=>{let s=l.user;b.setFieldsValue({user_email:s.user_email,user_id:s.user_id,role:b.getFieldValue("role")})};return(0,t.jsx)(r.Z,{title:x,open:l,onCancel:()=>{b.resetFields(),v([]),s()},footer:null,width:800,children:(0,t.jsxs)(a.Z,{form:b,onFinish:d,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",initialValues:{role:g},children:[(0,t.jsx)(a.Z.Item,{label:"Email",name:"user_email",className:"mb-4",children:(0,t.jsx)(n.default,{showSearch:!0,className:"w-full",placeholder:"Search by email",filterOption:!1,onSearch:e=>k(e,"user_email"),onSelect:(e,l)=>M(e,l),options:"user_email"===Z?_:[],loading:j,allowClear:!0})}),(0,t.jsx)("div",{className:"text-center mb-4",children:"OR"}),(0,t.jsx)(a.Z.Item,{label:"User ID",name:"user_id",className:"mb-4",children:(0,t.jsx)(n.default,{showSearch:!0,className:"w-full",placeholder:"Search by user ID",filterOption:!1,onSearch:e=>k(e,"user_id"),onSelect:(e,l)=>M(e,l),options:"user_id"===Z?_:[],loading:j,allowClear:!0})}),(0,t.jsx)(a.Z.Item,{label:"Member Role",name:"role",className:"mb-4",children:(0,t.jsx)(n.default,{defaultValue:g,children:p.map(e=>(0,t.jsx)(n.default.Option,{value:e.value,children:(0,t.jsxs)(m.Z,{title:e.description,children:[(0,t.jsx)("span",{className:"font-medium",children:e.label}),(0,t.jsxs)("span",{className:"ml-2 text-gray-500 text-sm",children:["- ",e.description]})]})},e.value))})}),(0,t.jsx)("div",{className:"text-right mt-4",children:(0,t.jsx)(o.ZP,{type:"default",htmlType:"submit",children:"Add Member"})})]})})}},36894:function(e,l,s){var t=s(57437),i=s(56522),a=s(10032),r=s(37592),n=s(22116),m=s(5545),o=s(2265),d=s(24199);l.Z=e=>{var l,s,c;let{visible:u,onCancel:h,onSubmit:x,initialData:p,mode:g,config:b}=e,[_]=a.Z.useForm();console.log("Initial Data:",p),(0,o.useEffect)(()=>{if(u){if("edit"===g&&p){let e={...p,role:p.role||b.defaultRole,max_budget_in_team:p.max_budget_in_team||null,tpm_limit:p.tpm_limit||null,rpm_limit:p.rpm_limit||null};console.log("Setting form values:",e),_.setFieldsValue(e)}else{var e;_.resetFields(),_.setFieldsValue({role:b.defaultRole||(null===(e=b.roleOptions[0])||void 0===e?void 0:e.value)})}}},[u,p,g,_,b.defaultRole,b.roleOptions]);let v=async e=>{try{let l=Object.entries(e).reduce((e,l)=>{let[s,t]=l;if("string"==typeof t){let l=t.trim();return""===l&&("max_budget_in_team"===s||"tpm_limit"===s||"rpm_limit"===s)?{...e,[s]:null}:{...e,[s]:l}}return{...e,[s]:t}},{});console.log("Submitting form data:",l),x(l),_.resetFields()}catch(e){console.error("Form submission error:",e)}},j=e=>{switch(e.type){case"input":return(0,t.jsx)(i.o,{placeholder:e.placeholder});case"numerical":return(0,t.jsx)(d.Z,{step:e.step||1,min:e.min||0,style:{width:"100%"},placeholder:e.placeholder||"Enter a numerical value"});case"select":var l;return(0,t.jsx)(r.default,{children:null===(l=e.options)||void 0===l?void 0:l.map(e=>(0,t.jsx)(r.default.Option,{value:e.value,children:e.label},e.value))});default:return null}};return(0,t.jsx)(n.Z,{title:b.title||("add"===g?"Add Member":"Edit Member"),open:u,width:1e3,footer:null,onCancel:h,children:(0,t.jsxs)(a.Z,{form:_,onFinish:v,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[b.showEmail&&(0,t.jsx)(a.Z.Item,{label:"Email",name:"user_email",className:"mb-4",rules:[{type:"email",message:"Please enter a valid email!"}],children:(0,t.jsx)(i.o,{placeholder:"user@example.com"})}),b.showEmail&&b.showUserId&&(0,t.jsx)("div",{className:"text-center mb-4",children:(0,t.jsx)(i.x,{children:"OR"})}),b.showUserId&&(0,t.jsx)(a.Z.Item,{label:"User ID",name:"user_id",className:"mb-4",children:(0,t.jsx)(i.o,{placeholder:"user_123"})}),(0,t.jsx)(a.Z.Item,{label:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{children:"Role"}),"edit"===g&&p&&(0,t.jsxs)("span",{className:"text-gray-500 text-sm",children:["(Current: ",(s=p.role,(null===(c=b.roleOptions.find(e=>e.value===s))||void 0===c?void 0:c.label)||s),")"]})]}),name:"role",className:"mb-4",rules:[{required:!0,message:"Please select a role!"}],children:(0,t.jsx)(r.default,{children:"edit"===g&&p?[...b.roleOptions.filter(e=>e.value===p.role),...b.roleOptions.filter(e=>e.value!==p.role)].map(e=>(0,t.jsx)(r.default.Option,{value:e.value,children:e.label},e.value)):b.roleOptions.map(e=>(0,t.jsx)(r.default.Option,{value:e.value,children:e.label},e.value))})}),null===(l=b.additionalFields)||void 0===l?void 0:l.map(e=>(0,t.jsx)(a.Z.Item,{label:e.label,name:e.name,className:"mb-4",rules:e.rules,children:j(e)},e.name)),(0,t.jsxs)("div",{className:"text-right mt-6",children:[(0,t.jsx)(m.ZP,{onClick:h,className:"mr-2",children:"Cancel"}),(0,t.jsx)(m.ZP,{type:"default",htmlType:"submit",children:"add"===g?"Add Member":"Save Changes"})]})]})})}},33293:function(e,l,s){s.d(l,{Z:function(){return et}});var t=s(57437),i=s(33860),a=s(19250),r=s(59872),n=s(33304),m=s(15424),o=s(10900),d=s(30078),c=s(10032),u=s(42264),h=s(5545),x=s(4260),p=s(37592),g=s(99981),b=s(63709),_=s(30401),v=s(78867),j=s(2265),f=s(82586),Z=s(21609),y=s(95096),N=s(46468),w=s(27799),k=s(95920),M=s(68473),C=s(9114),S=s(60131),T=s(24199),I=s(97415),P=s(21425),L=s(36894),O=s(78489),F=s(12514),E=s(21626),D=s(97214),A=s(28241),R=s(58834),z=s(69552),U=s(71876),V=s(84264),B=s(96761),G=s(61994),q=s(85180),K=s(89245),$=s(78355);let J={"/key/generate":"Member can generate a virtual key for this team","/key/service-account/generate":"Member can generate a service account key (not belonging to any user) for this team","/key/update":"Member can update a virtual key belonging to this team","/key/delete":"Member can delete a virtual key belonging to this team","/key/info":"Member can get info about a virtual key belonging to this team","/key/regenerate":"Member can regenerate a virtual key belonging to this team","/key/{key_id}/regenerate":"Member can regenerate a virtual key belonging to this team","/key/list":"Member can list virtual keys belonging to this team","/key/block":"Member can block a virtual key belonging to this team","/key/unblock":"Member can unblock a virtual key belonging to this team"},Q=e=>e.includes("/info")||e.includes("/list")?"GET":"POST",W=e=>{let l=Q(e),s=J[e];if(!s){for(let[l,t]of Object.entries(J))if(e.includes(l)){s=t;break}}return s||(s="Access ".concat(e)),{method:l,endpoint:e,description:s,route:e}};var X=e=>{let{teamId:l,accessToken:s,canEditTeam:i}=e,[r,n]=(0,j.useState)([]),[m,o]=(0,j.useState)([]),[d,c]=(0,j.useState)(!0),[u,x]=(0,j.useState)(!1),[p,g]=(0,j.useState)(!1),b=async()=>{try{if(c(!0),!s)return;let e=await (0,a.getTeamPermissionsCall)(s,l),t=e.all_available_permissions||[];n(t);let i=e.team_member_permissions||[];o(i),g(!1)}catch(e){C.Z.fromBackend("Failed to load permissions"),console.error("Error fetching permissions:",e)}finally{c(!1)}};(0,j.useEffect)(()=>{b()},[l,s]);let _=(e,l)=>{o(l?[...m,e]:m.filter(l=>l!==e)),g(!0)},v=async()=>{try{if(!s)return;x(!0),await (0,a.teamPermissionsUpdateCall)(s,l,m),C.Z.success("Permissions updated successfully"),g(!1)}catch(e){C.Z.fromBackend("Failed to update permissions"),console.error("Error updating permissions:",e)}finally{x(!1)}};if(d)return(0,t.jsx)("div",{className:"p-6 text-center",children:"Loading permissions..."});let f=r.length>0;return(0,t.jsxs)(F.Z,{className:"bg-white shadow-md rounded-md p-6",children:[(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center border-b pb-4 mb-6",children:[(0,t.jsx)(B.Z,{className:"mb-2 sm:mb-0",children:"Member Permissions"}),i&&p&&(0,t.jsxs)("div",{className:"flex gap-3",children:[(0,t.jsx)(h.ZP,{icon:(0,t.jsx)(K.Z,{}),onClick:()=>{b()},children:"Reset"}),(0,t.jsxs)(O.Z,{onClick:v,loading:u,className:"flex items-center gap-2",children:[(0,t.jsx)($.Z,{})," Save Changes"]})]})]}),(0,t.jsx)(V.Z,{className:"mb-6 text-gray-600",children:"Control what team members can do when they are not team admins."}),f?(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(E.Z,{className:" min-w-full",children:[(0,t.jsx)(R.Z,{children:(0,t.jsxs)(U.Z,{children:[(0,t.jsx)(z.Z,{children:"Method"}),(0,t.jsx)(z.Z,{children:"Endpoint"}),(0,t.jsx)(z.Z,{children:"Description"}),(0,t.jsx)(z.Z,{className:"sticky right-0 bg-white shadow-[-4px_0_4px_-4px_rgba(0,0,0,0.1)] text-center",children:"Allow Access"})]})}),(0,t.jsx)(D.Z,{children:r.map(e=>{let l=W(e);return(0,t.jsxs)(U.Z,{className:"hover:bg-gray-50 transition-colors",children:[(0,t.jsx)(A.Z,{children:(0,t.jsx)("span",{className:"px-2 py-1 rounded text-xs font-medium ".concat("GET"===l.method?"bg-blue-100 text-blue-800":"bg-green-100 text-green-800"),children:l.method})}),(0,t.jsx)(A.Z,{children:(0,t.jsx)("span",{className:"font-mono text-sm text-gray-800",children:l.endpoint})}),(0,t.jsx)(A.Z,{className:"text-gray-700",children:l.description}),(0,t.jsx)(A.Z,{className:"sticky right-0 bg-white shadow-[-4px_0_4px_-4px_rgba(0,0,0,0.1)] text-center",children:(0,t.jsx)(G.Z,{checked:m.includes(e),onChange:l=>_(e,l.target.checked),disabled:!i})})]},e)})})]})}):(0,t.jsx)("div",{className:"py-12",children:(0,t.jsx)(q.Z,{description:"No permissions available"})})]})},Y=s(47323),H=s(53410),ee=s(74998),el=e=>{let{teamData:l,canEditTeam:s,handleMemberDelete:i,setSelectedEditMember:a,setIsEditMemberModalVisible:n,setIsAddMemberModalVisible:o}=e,d=e=>{if(null==e)return"0";if("number"==typeof e){let l=Number(e);return l===Math.floor(l)?l.toString():(0,r.pw)(l,8).replace(/\.?0+$/,"")}return"0"},c=e=>{if(!e)return 0;let s=l.team_memberships.find(l=>l.user_id===e);return(null==s?void 0:s.spend)||0},u=e=>{var s;if(!e)return null;let t=l.team_memberships.find(l=>l.user_id===e);console.log("membership=".concat(t));let i=null==t?void 0:null===(s=t.litellm_budget_table)||void 0===s?void 0:s.max_budget;return null==i?null:d(i)},h=e=>{var s,t;if(!e)return"No Limits";let i=l.team_memberships.find(l=>l.user_id===e),a=null==i?void 0:null===(s=i.litellm_budget_table)||void 0===s?void 0:s.rpm_limit,r=null==i?void 0:null===(t=i.litellm_budget_table)||void 0===t?void 0:t.tpm_limit,n=[a?"".concat(d(a)," RPM"):null,r?"".concat(d(r)," TPM"):null].filter(Boolean);return n.length>0?n.join(" / "):"No Limits"};return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(F.Z,{className:"w-full mx-auto flex-auto overflow-auto max-h-[50vh]",children:(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(E.Z,{className:"min-w-full",children:[(0,t.jsx)(R.Z,{children:(0,t.jsxs)(U.Z,{children:[(0,t.jsx)(z.Z,{children:"User ID"}),(0,t.jsx)(z.Z,{children:"User Email"}),(0,t.jsx)(z.Z,{children:"Role"}),(0,t.jsxs)(z.Z,{children:["Team Member Spend (USD)"," ",(0,t.jsx)(g.Z,{title:"This is the amount spent by a user in the team.",children:(0,t.jsx)(m.Z,{})})]}),(0,t.jsx)(z.Z,{children:"Team Member Budget (USD)"}),(0,t.jsxs)(z.Z,{children:["Team Member Rate Limits"," ",(0,t.jsx)(g.Z,{title:"Rate limits for this member's usage within this team.",children:(0,t.jsx)(m.Z,{})})]}),(0,t.jsx)(z.Z,{className:"sticky right-0 bg-white z-10 border-l border-gray-200",children:"Actions"})]})}),(0,t.jsx)(D.Z,{children:l.team_info.members_with_roles.map((e,m)=>(0,t.jsxs)(U.Z,{children:[(0,t.jsx)(A.Z,{children:(0,t.jsx)(V.Z,{className:"font-mono",children:e.user_id})}),(0,t.jsx)(A.Z,{children:(0,t.jsx)(V.Z,{className:"font-mono",children:e.user_email?e.user_email:"No Email"})}),(0,t.jsx)(A.Z,{children:(0,t.jsx)(V.Z,{className:"font-mono",children:e.role})}),(0,t.jsx)(A.Z,{children:(0,t.jsxs)(V.Z,{className:"font-mono",children:["$",(0,r.pw)(c(e.user_id),4)]})}),(0,t.jsx)(A.Z,{children:(0,t.jsx)(V.Z,{className:"font-mono",children:u(e.user_id)?"$".concat((0,r.pw)(Number(u(e.user_id)),4)):"No Limit"})}),(0,t.jsx)(A.Z,{children:(0,t.jsx)(V.Z,{className:"font-mono",children:h(e.user_id)})}),(0,t.jsx)(A.Z,{className:"sticky right-0 bg-white z-10 border-l border-gray-200",children:s&&(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(Y.Z,{icon:H.Z,size:"sm",onClick:()=>{var s,t,i;let r=l.team_memberships.find(l=>l.user_id===e.user_id);a({...e,max_budget_in_team:(null==r?void 0:null===(s=r.litellm_budget_table)||void 0===s?void 0:s.max_budget)||null,tpm_limit:(null==r?void 0:null===(t=r.litellm_budget_table)||void 0===t?void 0:t.tpm_limit)||null,rpm_limit:(null==r?void 0:null===(i=r.litellm_budget_table)||void 0===i?void 0:i.rpm_limit)||null}),n(!0)},className:"cursor-pointer hover:text-blue-600"}),(0,t.jsx)(Y.Z,{icon:ee.Z,size:"sm",onClick:()=>i(e),className:"cursor-pointer hover:text-red-600"})]})})]},m))})]})})}),(0,t.jsx)(O.Z,{onClick:()=>o(!0),children:"Add Member"})]})};let es=(e,l)=>{let s=[];return s=e?e.models.includes("all-proxy-models")?l:e.models.length>0?e.models:l:l,(0,N.Ob)(s,l)};var et=e=>{var l,s,O,F,E,D,A,R,z,U,V,B,G,q,K,$,J,Q,W,Y,H;let ee;let{teamId:et,onClose:ei,accessToken:ea,is_team_admin:er,is_proxy_admin:en,userModels:em,editTeam:eo,premiumUser:ed=!1,onUpdate:ec}=e,[eu,eh]=(0,j.useState)(null),[ex,ep]=(0,j.useState)(!0),[eg,eb]=(0,j.useState)(!1),[e_]=c.Z.useForm(),[ev,ej]=(0,j.useState)(!1),[ef,eZ]=(0,j.useState)(null),[ey,eN]=(0,j.useState)(!1),[ew,ek]=(0,j.useState)([]),[eM,eC]=(0,j.useState)(!1),[eS,eT]=(0,j.useState)({}),[eI,eP]=(0,j.useState)([]),[eL,eO]=(0,j.useState)(null),[eF,eE]=(0,j.useState)(!1),[eD,eA]=(0,j.useState)(!1),[eR,ez]=(0,j.useState)(!1),[eU,eV]=(0,j.useState)(null);console.log("userModels in team info",em);let eB=er||en,eG=async()=>{try{if(ep(!0),!ea)return;let e=await (0,a.teamInfoCall)(ea,et);eh(e)}catch(e){C.Z.fromBackend("Failed to load team information"),console.error("Error fetching team info:",e)}finally{ep(!1)}};(0,j.useEffect)(()=>{eG()},[et,ea]),(0,j.useEffect)(()=>{(async()=>{var e;if(!ea||!(null==eu?void 0:null===(e=eu.team_info)||void 0===e?void 0:e.organization_id)){eV(null);return}try{let e=await (0,a.organizationInfoCall)(ea,eu.team_info.organization_id);eV(e)}catch(e){console.error("Error fetching organization info:",e),eV(null)}})()},[ea,null==eu?void 0:null===(l=eu.team_info)||void 0===l?void 0:l.organization_id]);let eq=(0,j.useMemo)(()=>es(eU,em),[eU,em]);(0,j.useEffect)(()=>{(async()=>{try{if(!ea)return;let e=(await (0,a.getGuardrailsList)(ea)).guardrails.map(e=>e.guardrail_name);eP(e)}catch(e){console.error("Failed to fetch guardrails:",e)}})()},[ea]);let eK=async e=>{try{if(null==ea)return;let l={user_email:e.user_email,user_id:e.user_id,role:e.role};await (0,a.teamMemberAddCall)(ea,et,l),C.Z.success("Team member added successfully"),eb(!1),e_.resetFields();let s=await (0,a.teamInfoCall)(ea,et);eh(s),ec(s)}catch(i){var l,s,t;let e="Failed to add team member";(null==i?void 0:null===(t=i.raw)||void 0===t?void 0:null===(s=t.detail)||void 0===s?void 0:null===(l=s.error)||void 0===l?void 0:l.includes("Assigning team admins is a premium feature"))?e="Assigning admins is an enterprise-only feature. Please upgrade your LiteLLM plan to enable this.":(null==i?void 0:i.message)&&(e=i.message),C.Z.fromBackend(e),console.error("Error adding team member:",i)}},e$=async e=>{try{if(null==ea)return;let l={user_email:e.user_email,user_id:e.user_id,role:e.role,max_budget_in_team:e.max_budget_in_team,tpm_limit:e.tpm_limit,rpm_limit:e.rpm_limit};console.log("Updating member with values:",l),u.ZP.destroy(),await (0,a.teamMemberUpdateCall)(ea,et,l),C.Z.success("Team member updated successfully"),ej(!1);let s=await (0,a.teamInfoCall)(ea,et);eh(s),ec(s)}catch(t){var l,s;let e="Failed to update team member";(null==t?void 0:null===(s=t.raw)||void 0===s?void 0:null===(l=s.detail)||void 0===l?void 0:l.includes("Assigning team admins is a premium feature"))?e="Assigning admins is an enterprise-only feature. Please upgrade your LiteLLM plan to enable this.":(null==t?void 0:t.message)&&(e=t.message),ej(!1),u.ZP.destroy(),C.Z.fromBackend(e),console.error("Error updating team member:",t)}},eJ=async()=>{if(eL&&ea){eA(!0);try{await (0,a.teamMemberDeleteCall)(ea,et,eL),C.Z.success("Team member removed successfully");let e=await (0,a.teamInfoCall)(ea,et);eh(e),ec(e)}catch(e){C.Z.fromBackend("Failed to remove team member"),console.error("Error removing team member:",e)}finally{eA(!1),eE(!1),eO(null)}}},eQ=async e=>{try{if(!ea)return;ez(!0);let l={};try{l=e.metadata?JSON.parse(e.metadata):{}}catch(e){C.Z.fromBackend("Invalid JSON in metadata field");return}let s=e=>null==e||"string"==typeof e&&""===e.trim()||"number"==typeof e&&Number.isNaN(e)?null:e,t={team_id:et,team_alias:e.team_alias,models:e.models,tpm_limit:s(e.tpm_limit),rpm_limit:s(e.rpm_limit),max_budget:e.max_budget,budget_duration:e.budget_duration,metadata:{...l,guardrails:e.guardrails||[],logging:e.logging_settings||[]},organization_id:e.organization_id};t.max_budget=(0,n.C)(t.max_budget),void 0!==e.team_member_budget&&(t.team_member_budget=Number(e.team_member_budget)),void 0!==e.team_member_key_duration&&(t.team_member_key_duration=e.team_member_key_duration),(void 0!==e.team_member_tpm_limit||void 0!==e.team_member_rpm_limit)&&(t.team_member_tpm_limit=s(e.team_member_tpm_limit),t.team_member_rpm_limit=s(e.team_member_rpm_limit));let{servers:i,accessGroups:r}=e.mcp_servers_and_groups||{servers:[],accessGroups:[]},m=new Set(i||[]),o=Object.fromEntries(Object.entries(e.mcp_tool_permissions||{}).filter(e=>{let[l]=e;return m.has(l)}));t.object_permission={},i&&(t.object_permission.mcp_servers=i),r&&(t.object_permission.mcp_access_groups=r),o&&(t.object_permission.mcp_tool_permissions=o),delete e.mcp_servers_and_groups,delete e.mcp_tool_permissions;let{agents:d,accessGroups:c}=e.agents_and_groups||{agents:[],accessGroups:[]};d&&d.length>0&&(t.object_permission.agents=d),c&&c.length>0&&(t.object_permission.agent_access_groups=c),delete e.agents_and_groups,await (0,a.teamUpdateCall)(ea,t),C.Z.success("Team settings updated successfully"),eN(!1),eG()}catch(e){console.error("Error updating team:",e)}finally{ez(!1)}};if(ex)return(0,t.jsx)("div",{className:"p-4",children:"Loading..."});if(!(null==eu?void 0:eu.team_info))return(0,t.jsx)("div",{className:"p-4",children:"Team not found"});let{team_info:eW}=eu,eX=async(e,l)=>{await (0,r.vQ)(e)&&(eT(e=>({...e,[l]:!0})),setTimeout(()=>{eT(e=>({...e,[l]:!1}))},2e3))};return(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsx)("div",{className:"flex justify-between items-center mb-6",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(d.zx,{icon:o.Z,variant:"light",onClick:ei,className:"mb-4",children:"Back to Teams"}),(0,t.jsx)(d.Dx,{children:eW.team_alias}),(0,t.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)(d.xv,{className:"text-gray-500 font-mono",children:eW.team_id}),(0,t.jsx)(h.ZP,{type:"text",size:"small",icon:eS["team-id"]?(0,t.jsx)(_.Z,{size:12}):(0,t.jsx)(v.Z,{size:12}),onClick:()=>eX(eW.team_id,"team-id"),className:"left-2 z-10 transition-all duration-200 ".concat(eS["team-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]})}),(0,t.jsxs)(d.v0,{defaultIndex:eo?3:0,children:[(0,t.jsx)(d.td,{className:"mb-4",children:[(0,t.jsx)(d.OK,{children:"Overview"},"overview"),...eB?[(0,t.jsx)(d.OK,{children:"Members"},"members"),(0,t.jsx)(d.OK,{children:"Member Permissions"},"member-permissions"),(0,t.jsx)(d.OK,{children:"Settings"},"settings")]:[]]}),(0,t.jsxs)(d.nP,{children:[(0,t.jsx)(d.x4,{children:(0,t.jsxs)(d.rj,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,t.jsxs)(d.Zb,{children:[(0,t.jsx)(d.xv,{children:"Budget Status"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(d.Dx,{children:["$",(0,r.pw)(eW.spend,4)]}),(0,t.jsxs)(d.xv,{children:["of ",null===eW.max_budget?"Unlimited":"$".concat((0,r.pw)(eW.max_budget,4))]}),eW.budget_duration&&(0,t.jsxs)(d.xv,{className:"text-gray-500",children:["Reset: ",eW.budget_duration]}),(0,t.jsx)("br",{}),eW.team_member_budget_table&&(0,t.jsxs)(d.xv,{className:"text-gray-500",children:["Team Member Budget: $",(0,r.pw)(eW.team_member_budget_table.max_budget,4)]})]})]}),(0,t.jsxs)(d.Zb,{children:[(0,t.jsx)(d.xv,{children:"Rate Limits"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(d.xv,{children:["TPM: ",eW.tpm_limit||"Unlimited"]}),(0,t.jsxs)(d.xv,{children:["RPM: ",eW.rpm_limit||"Unlimited"]}),eW.max_parallel_requests&&(0,t.jsxs)(d.xv,{children:["Max Parallel Requests: ",eW.max_parallel_requests]})]})]}),(0,t.jsxs)(d.Zb,{children:[(0,t.jsx)(d.xv,{children:"Models"}),(0,t.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:0===eW.models.length?(0,t.jsx)(d.Ct,{color:"red",children:"All proxy models"}):eW.models.map((e,l)=>(0,t.jsx)(d.Ct,{color:"red",children:e},l))})]}),(0,t.jsxs)(d.Zb,{children:[(0,t.jsx)(d.xv,{className:"font-semibold text-gray-900",children:"Virtual Keys"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(d.xv,{children:["User Keys: ",eu.keys.filter(e=>e.user_id).length]}),(0,t.jsxs)(d.xv,{children:["Service Account Keys: ",eu.keys.filter(e=>!e.user_id).length]}),(0,t.jsxs)(d.xv,{className:"text-gray-500",children:["Total: ",eu.keys.length]})]})]}),(0,t.jsx)(S.Z,{objectPermission:eW.object_permission,variant:"card",accessToken:ea}),(0,t.jsx)(w.Z,{loggingConfigs:(null===(s=eW.metadata)||void 0===s?void 0:s.logging)||[],disabledCallbacks:[],variant:"card"})]})}),(0,t.jsx)(d.x4,{children:(0,t.jsx)(el,{teamData:eu,canEditTeam:eB,handleMemberDelete:e=>{eO(e),eE(!0)},setSelectedEditMember:eZ,setIsEditMemberModalVisible:ej,setIsAddMemberModalVisible:eb})}),eB&&(0,t.jsx)(d.x4,{children:(0,t.jsx)(X,{teamId:et,accessToken:ea,canEditTeam:eB})}),(0,t.jsx)(d.x4,{children:(0,t.jsxs)(d.Zb,{className:"overflow-y-auto max-h-[65vh]",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsx)(d.Dx,{children:"Team Settings"}),eB&&!ey&&(0,t.jsx)(d.zx,{onClick:()=>eN(!0),children:"Edit Settings"})]}),ey?(0,t.jsxs)(c.Z,{form:e_,onFinish:eQ,initialValues:{...eW,team_alias:eW.team_alias,models:eW.models,tpm_limit:eW.tpm_limit,rpm_limit:eW.rpm_limit,max_budget:eW.max_budget,budget_duration:eW.budget_duration,team_member_tpm_limit:null===(O=eW.team_member_budget_table)||void 0===O?void 0:O.tpm_limit,team_member_rpm_limit:null===(F=eW.team_member_budget_table)||void 0===F?void 0:F.rpm_limit,guardrails:(null===(E=eW.metadata)||void 0===E?void 0:E.guardrails)||[],disable_global_guardrails:(null===(D=eW.metadata)||void 0===D?void 0:D.disable_global_guardrails)||!1,metadata:eW.metadata?JSON.stringify((e=>{let{logging:l,...s}=e;return s})(eW.metadata),null,2):"",logging_settings:(null===(A=eW.metadata)||void 0===A?void 0:A.logging)||[],organization_id:eW.organization_id,vector_stores:(null===(R=eW.object_permission)||void 0===R?void 0:R.vector_stores)||[],mcp_servers:(null===(z=eW.object_permission)||void 0===z?void 0:z.mcp_servers)||[],mcp_access_groups:(null===(U=eW.object_permission)||void 0===U?void 0:U.mcp_access_groups)||[],mcp_servers_and_groups:{servers:(null===(V=eW.object_permission)||void 0===V?void 0:V.mcp_servers)||[],accessGroups:(null===(B=eW.object_permission)||void 0===B?void 0:B.mcp_access_groups)||[]},mcp_tool_permissions:(null===(G=eW.object_permission)||void 0===G?void 0:G.mcp_tool_permissions)||{},agents_and_groups:{agents:(null===(q=eW.object_permission)||void 0===q?void 0:q.agents)||[],accessGroups:(null===(K=eW.object_permission)||void 0===K?void 0:K.agent_access_groups)||[]}},layout:"vertical",children:[(0,t.jsx)(c.Z.Item,{label:"Team Name",name:"team_alias",rules:[{required:!0,message:"Please input a team name"}],children:(0,t.jsx)(x.default,{type:""})}),(0,t.jsx)(c.Z.Item,{label:"Models",name:"models",rules:[{required:!0,message:"Please select at least one model"}],children:(0,t.jsxs)(p.default,{mode:"multiple",placeholder:"Select models",children:[(ee=!1,eU?(0===eU.models.length||eU.models.includes("all-proxy-models"))&&(ee=!0):ee=en||em.includes("all-proxy-models"),ee?(0,t.jsx)(p.default.Option,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"):null),!eU||eU.models.includes("no-default-models")?(0,t.jsx)(p.default.Option,{value:"no-default-models",children:"No Default Models"},"no-default-models"):null,Array.from(new Set(eq)).map((e,l)=>(0,t.jsx)(p.default.Option,{value:e,children:(0,N.W0)(e)},l))]})}),(0,t.jsx)(c.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,t.jsx)(T.Z,{step:.01,precision:2,style:{width:"100%"}})}),(0,t.jsx)(c.Z.Item,{label:"Team Member Budget (USD)",name:"team_member_budget",tooltip:"This is the individual budget for a user in the team.",children:(0,t.jsx)(T.Z,{step:.01,precision:2,style:{width:"100%"}})}),(0,t.jsx)(c.Z.Item,{label:"Team Member Key Duration (eg: 1d, 1mo)",name:"team_member_key_duration",tooltip:"Set a limit to the duration of a team member's key. Format: 30s (seconds), 30m (minutes), 30h (hours), 30d (days), 1mo (month)",children:(0,t.jsx)(d.oi,{placeholder:"e.g., 30d"})}),(0,t.jsx)(c.Z.Item,{label:"Team Member TPM Limit",name:"team_member_tpm_limit",tooltip:"Default tokens per minute limit for an individual team member. This limit applies to all requests the user makes within this team. Can be overridden per member.",children:(0,t.jsx)(T.Z,{step:1,style:{width:"100%"},placeholder:"e.g., 1000"})}),(0,t.jsx)(c.Z.Item,{label:"Team Member RPM Limit",name:"team_member_rpm_limit",tooltip:"Default requests per minute limit for an individual team member. This limit applies to all requests the user makes within this team. Can be overridden per member.",children:(0,t.jsx)(T.Z,{step:1,style:{width:"100%"},placeholder:"e.g., 100"})}),(0,t.jsx)(c.Z.Item,{label:"Reset Budget",name:"budget_duration",children:(0,t.jsxs)(p.default,{placeholder:"n/a",children:[(0,t.jsx)(p.default.Option,{value:"24h",children:"daily"}),(0,t.jsx)(p.default.Option,{value:"7d",children:"weekly"}),(0,t.jsx)(p.default.Option,{value:"30d",children:"monthly"})]})}),(0,t.jsx)(c.Z.Item,{label:"Tokens per minute Limit (TPM)",name:"tpm_limit",children:(0,t.jsx)(T.Z,{step:1,style:{width:"100%"}})}),(0,t.jsx)(c.Z.Item,{label:"Requests per minute Limit (RPM)",name:"rpm_limit",children:(0,t.jsx)(T.Z,{step:1,style:{width:"100%"}})}),(0,t.jsx)(c.Z.Item,{label:(0,t.jsxs)("span",{children:["Guardrails"," ",(0,t.jsx)(g.Z,{title:"Setup your first guardrail",children:(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/quick_start",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(m.Z,{style:{marginLeft:"4px"}})})})]}),name:"guardrails",help:"Select existing guardrails or enter new ones",children:(0,t.jsx)(p.default,{mode:"tags",placeholder:"Select or enter guardrails",options:eI.map(e=>({value:e,label:e}))})}),(0,t.jsx)(c.Z.Item,{label:(0,t.jsxs)("span",{children:["Disable Global Guardrails"," ",(0,t.jsx)(g.Z,{title:"When enabled, this team will bypass any guardrails configured to run on every request (global guardrails)",children:(0,t.jsx)(m.Z,{style:{marginLeft:"4px"}})})]}),name:"disable_global_guardrails",valuePropName:"checked",help:"Bypass global guardrails for this team",children:(0,t.jsx)(b.Z,{checkedChildren:"Yes",unCheckedChildren:"No"})}),(0,t.jsx)(c.Z.Item,{label:"Vector Stores",name:"vector_stores",children:(0,t.jsx)(I.Z,{onChange:e=>e_.setFieldValue("vector_stores",e),value:e_.getFieldValue("vector_stores"),accessToken:ea||"",placeholder:"Select vector stores"})}),(0,t.jsx)(c.Z.Item,{label:"Allowed Pass Through Routes",name:"allowed_passthrough_routes",children:(0,t.jsx)(y.Z,{onChange:e=>e_.setFieldValue("allowed_passthrough_routes",e),value:e_.getFieldValue("allowed_passthrough_routes"),accessToken:ea||"",placeholder:"Select pass through routes"})}),(0,t.jsx)(c.Z.Item,{label:"MCP Servers / Access Groups",name:"mcp_servers_and_groups",children:(0,t.jsx)(k.Z,{onChange:e=>e_.setFieldValue("mcp_servers_and_groups",e),value:e_.getFieldValue("mcp_servers_and_groups"),accessToken:ea||"",placeholder:"Select MCP servers or access groups (optional)"})}),(0,t.jsx)(c.Z.Item,{name:"mcp_tool_permissions",initialValue:{},hidden:!0,children:(0,t.jsx)(x.default,{type:"hidden"})}),(0,t.jsx)(c.Z.Item,{noStyle:!0,shouldUpdate:(e,l)=>e.mcp_servers_and_groups!==l.mcp_servers_and_groups||e.mcp_tool_permissions!==l.mcp_tool_permissions,children:()=>{var e;return(0,t.jsx)("div",{className:"mb-6",children:(0,t.jsx)(M.Z,{accessToken:ea||"",selectedServers:(null===(e=e_.getFieldValue("mcp_servers_and_groups"))||void 0===e?void 0:e.servers)||[],toolPermissions:e_.getFieldValue("mcp_tool_permissions")||{},onChange:e=>e_.setFieldsValue({mcp_tool_permissions:e})})})}}),(0,t.jsx)(c.Z.Item,{label:"Agents / Access Groups",name:"agents_and_groups",children:(0,t.jsx)(f.Z,{onChange:e=>e_.setFieldValue("agents_and_groups",e),value:e_.getFieldValue("agents_and_groups"),accessToken:ea||"",placeholder:"Select agents or access groups (optional)"})}),(0,t.jsx)(c.Z.Item,{label:"Organization ID",name:"organization_id",children:(0,t.jsx)(x.default,{type:"",disabled:!0})}),(0,t.jsx)(c.Z.Item,{label:"Logging Settings",name:"logging_settings",children:(0,t.jsx)(P.Z,{value:e_.getFieldValue("logging_settings"),onChange:e=>e_.setFieldValue("logging_settings",e)})}),(0,t.jsx)(c.Z.Item,{label:"Metadata",name:"metadata",children:(0,t.jsx)(x.default.TextArea,{rows:10})}),(0,t.jsx)("div",{className:"sticky z-10 bg-white p-4 border-t border-gray-200 bottom-[-1.5rem] inset-x-[-1.5rem]",children:(0,t.jsxs)("div",{className:"flex justify-end items-center gap-2",children:[(0,t.jsx)(d.zx,{variant:"secondary",onClick:()=>eN(!1),disabled:eR,children:"Cancel"}),(0,t.jsx)(d.zx,{type:"submit",loading:eR,children:"Save Changes"})]})})]}):(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(d.xv,{className:"font-medium",children:"Team Name"}),(0,t.jsx)("div",{children:eW.team_alias})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(d.xv,{className:"font-medium",children:"Team ID"}),(0,t.jsx)("div",{className:"font-mono",children:eW.team_id})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(d.xv,{className:"font-medium",children:"Created At"}),(0,t.jsx)("div",{children:new Date(eW.created_at).toLocaleString()})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(d.xv,{className:"font-medium",children:"Models"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:eW.models.map((e,l)=>(0,t.jsx)(d.Ct,{color:"red",children:e},l))})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(d.xv,{className:"font-medium",children:"Rate Limits"}),(0,t.jsxs)("div",{children:["TPM: ",eW.tpm_limit||"Unlimited"]}),(0,t.jsxs)("div",{children:["RPM: ",eW.rpm_limit||"Unlimited"]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(d.xv,{className:"font-medium",children:"Team Budget"}),(0,t.jsxs)("div",{children:["Max Budget:"," ",null!==eW.max_budget?"$".concat((0,r.pw)(eW.max_budget,4)):"No Limit"]}),(0,t.jsxs)("div",{children:["Budget Reset: ",eW.budget_duration||"Never"]})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)(d.xv,{className:"font-medium",children:["Team Member Settings"," ",(0,t.jsx)(g.Z,{title:"These are limits on individual team members",children:(0,t.jsx)(m.Z,{style:{marginLeft:"4px"}})})]}),(0,t.jsxs)("div",{children:["Max Budget: ",(null===($=eW.team_member_budget_table)||void 0===$?void 0:$.max_budget)||"No Limit"]}),(0,t.jsxs)("div",{children:["Key Duration: ",(null===(J=eW.metadata)||void 0===J?void 0:J.team_member_key_duration)||"No Limit"]}),(0,t.jsxs)("div",{children:["TPM Limit: ",(null===(Q=eW.team_member_budget_table)||void 0===Q?void 0:Q.tpm_limit)||"No Limit"]}),(0,t.jsxs)("div",{children:["RPM Limit: ",(null===(W=eW.team_member_budget_table)||void 0===W?void 0:W.rpm_limit)||"No Limit"]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(d.xv,{className:"font-medium",children:"Organization ID"}),(0,t.jsx)("div",{children:eW.organization_id})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(d.xv,{className:"font-medium",children:"Status"}),(0,t.jsx)(d.Ct,{color:eW.blocked?"red":"green",children:eW.blocked?"Blocked":"Active"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(d.xv,{className:"font-medium",children:"Disable Global Guardrails"}),(0,t.jsx)("div",{children:(null===(Y=eW.metadata)||void 0===Y?void 0:Y.disable_global_guardrails)===!0?(0,t.jsx)(d.Ct,{color:"yellow",children:"Enabled - Global guardrails bypassed"}):(0,t.jsx)(d.Ct,{color:"green",children:"Disabled - Global guardrails active"})})]}),(0,t.jsx)(S.Z,{objectPermission:eW.object_permission,variant:"inline",className:"pt-4 border-t border-gray-200",accessToken:ea}),(0,t.jsx)(w.Z,{loggingConfigs:(null===(H=eW.metadata)||void 0===H?void 0:H.logging)||[],disabledCallbacks:[],variant:"inline",className:"pt-4 border-t border-gray-200"})]})]})})]})]}),(0,t.jsx)(L.Z,{visible:ev,onCancel:()=>ej(!1),onSubmit:e$,initialData:ef,mode:"edit",config:{title:"Edit Member",showEmail:!0,showUserId:!0,roleOptions:[{label:"Admin",value:"admin"},{label:"User",value:"user"}],additionalFields:[{name:"max_budget_in_team",label:(0,t.jsxs)("span",{children:["Team Member Budget (USD)"," ",(0,t.jsx)(g.Z,{title:"Maximum amount in USD this member can spend within this team. This is separate from any global user budget limits",children:(0,t.jsx)(m.Z,{style:{marginLeft:"4px"}})})]}),type:"numerical",step:.01,min:0,placeholder:"Budget limit for this member within this team"},{name:"tpm_limit",label:(0,t.jsxs)("span",{children:["Team Member TPM Limit"," ",(0,t.jsx)(g.Z,{title:"Maximum tokens per minute this member can use within this team. This is separate from any global user TPM limit",children:(0,t.jsx)(m.Z,{style:{marginLeft:"4px"}})})]}),type:"numerical",step:1,min:0,placeholder:"Tokens per minute limit for this member in this team"},{name:"rpm_limit",label:(0,t.jsxs)("span",{children:["Team Member RPM Limit"," ",(0,t.jsx)(g.Z,{title:"Maximum requests per minute this member can make within this team. This is separate from any global user RPM limit",children:(0,t.jsx)(m.Z,{style:{marginLeft:"4px"}})})]}),type:"numerical",step:1,min:0,placeholder:"Requests per minute limit for this member in this team"}]}}),(0,t.jsx)(i.Z,{isVisible:eg,onCancel:()=>eb(!1),onSubmit:eK,accessToken:ea}),(0,t.jsx)(Z.Z,{isOpen:eF,title:"Delete Team Member",alertMessage:"Removing team members will also delete any keys created by or created for this member.",message:"Are you sure you want to remove this member from the team? This action cannot be undone.",resourceInformationTitle:"Team Member Information",resourceInformation:[{label:"User ID",value:null==eL?void 0:eL.user_id,code:!0},{label:"Email",value:null==eL?void 0:eL.user_email},{label:"Role",value:null==eL?void 0:eL.role}],onCancel:()=>{eE(!1),eO(null)},onOk:eJ,confirmLoading:eD})]})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/2249-43e410d60ba8aea4.js b/litellm/proxy/_experimental/out/_next/static/chunks/2249-43e410d60ba8aea4.js deleted file mode 100644 index 724461874e..0000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/2249-43e410d60ba8aea4.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2249],{64748:function(e,s,l){l.d(s,{Ct:function(){return a.Z},Dx:function(){return m.Z},OK:function(){return n.Z},Zb:function(){return r.Z},nP:function(){return o.Z},td:function(){return c.Z},v0:function(){return i.Z},x4:function(){return d.Z},xv:function(){return x.Z},zx:function(){return t.Z}});var a=l(41649),t=l(78489),r=l(12514),n=l(12485),i=l(18135),c=l(35242),d=l(29706),o=l(77991),x=l(84264),m=l(96761)},78801:function(e,s,l){l.d(s,{Z:function(){return a.Z},x:function(){return t.Z}});var a=l(12514),t=l(84264)},92249:function(e,s,l){l.d(s,{Z:function(){return W}});var a=l(57437),t=l(23639),r=l(64748),n=l(22116),i=l(78867),c=l(99376),d=l(2265),o=l(17906),x=l(20347),m=l(41649),h=l(78489),u=l(84264),p=l(99981),g=l(3810),j=l(15424),v=l(15690),b=l(10032),N=l(4156),f=l(5545),y=l(96761),_=l(19250),k=l(9114);let{Step:w}=v.default;var Z=e=>{let{visible:s,onClose:l,accessToken:t,agentHubData:r,onSuccess:i}=e,[c,o]=(0,d.useState)(0),[x,h]=(0,d.useState)(new Set),[p,g]=(0,d.useState)(!1),[j]=b.Z.useForm(),Z=()=>{o(0),h(new Set),j.resetFields(),l()},C=(e,s)=>{let l=new Set(x);s?l.add(e):l.delete(e),h(l)},S=e=>{e?h(new Set(r.map(e=>e.agent_id||e.name))):h(new Set)};(0,d.useEffect)(()=>{s&&r.length>0&&h(new Set(r.filter(e=>!0===e.is_public).map(e=>e.agent_id||e.name)))},[s,r]);let P=async()=>{if(0===x.size){k.Z.fromBackend("Please select at least one agent to make public");return}g(!0);try{let e=Array.from(x);await (0,_.makeAgentsPublicCall)(t,e),k.Z.success("Successfully made ".concat(e.length," agent(s) public!")),Z(),i()}catch(e){console.error("Error making agents public:",e),k.Z.fromBackend("Failed to make agents public. Please try again.")}finally{g(!1)}},M=()=>{let e=r.length>0&&r.every(e=>x.has(e.agent_id||e.name)),s=x.size>0&&!e;return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)(y.Z,{children:"Select Agents to Make Public"}),(0,a.jsx)("div",{className:"flex items-center space-x-2",children:(0,a.jsxs)(N.Z,{checked:e,indeterminate:s,onChange:e=>S(e.target.checked),disabled:0===r.length,children:["Select All ",r.length>0&&"(".concat(r.length,")")]})})]}),(0,a.jsx)(u.Z,{className:"text-sm text-gray-600",children:"Select the agents you want to be visible on the public model hub. Users will still require a valid Virtual Key to use these agents."}),(0,a.jsx)("div",{className:"max-h-96 overflow-y-auto border rounded-lg p-4",children:(0,a.jsx)("div",{className:"space-y-3",children:0===r.length?(0,a.jsx)("div",{className:"text-center py-8 text-gray-500",children:(0,a.jsx)(u.Z,{children:"No agents available."})}):r.map(e=>{let s=e.agent_id||e.name;return(0,a.jsxs)("div",{className:"flex items-center space-x-3 p-3 border rounded-lg hover:bg-gray-50",children:[(0,a.jsx)(N.Z,{checked:x.has(s),onChange:e=>C(s,e.target.checked)}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:e.name}),(0,a.jsxs)(m.Z,{color:"blue",size:"sm",children:["v",e.version]})]}),(0,a.jsx)(u.Z,{className:"text-xs text-gray-600 mt-1",children:e.description}),e.skills&&e.skills.length>0&&(0,a.jsxs)("div",{className:"flex flex-wrap gap-1 mt-1",children:[e.skills.slice(0,3).map(e=>(0,a.jsx)(m.Z,{color:"purple",size:"xs",children:e.name},e.id)),e.skills.length>3&&(0,a.jsxs)(u.Z,{className:"text-xs text-gray-500",children:["+",e.skills.length-3," more"]})]})]})]},s)})})}),x.size>0&&(0,a.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,a.jsxs)(u.Z,{className:"text-sm text-blue-800",children:[(0,a.jsx)("strong",{children:x.size})," agent",1!==x.size?"s":""," selected"]})})]})},z=()=>(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(y.Z,{children:"Confirm Making Agents Public"}),(0,a.jsx)("div",{className:"bg-yellow-50 border border-yellow-200 rounded-lg p-4",children:(0,a.jsxs)(u.Z,{className:"text-sm text-yellow-800",children:[(0,a.jsx)("strong",{children:"Warning:"})," Once you make these agents public, anyone who can go to the"," ",(0,a.jsx)("code",{children:"/ui/model_hub_table"})," will be able to know they exist on the proxy."]})}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:"Agents to be made public:"}),(0,a.jsx)("div",{className:"max-h-48 overflow-y-auto border rounded-lg p-3",children:(0,a.jsx)("div",{className:"space-y-2",children:Array.from(x).map(e=>{let s=r.find(s=>(s.agent_id||s.name)===e);return(0,a.jsx)("div",{className:"flex items-center justify-between p-2 bg-gray-50 rounded",children:(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:(null==s?void 0:s.name)||e}),s&&(0,a.jsxs)(m.Z,{color:"blue",size:"xs",children:["v",s.version]})]}),(null==s?void 0:s.description)&&(0,a.jsx)(u.Z,{className:"text-xs text-gray-600 mt-1",children:s.description})]})},e)})})})]}),(0,a.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,a.jsxs)(u.Z,{className:"text-sm text-blue-800",children:["Total: ",(0,a.jsx)("strong",{children:x.size})," agent",1!==x.size?"s":""," will be made public"]})})]});return(0,a.jsx)(n.Z,{title:"Make Agents Public",open:s,onCancel:Z,footer:null,width:1200,maskClosable:!1,children:(0,a.jsxs)(b.Z,{form:j,layout:"vertical",children:[(0,a.jsxs)(v.default,{current:c,className:"mb-6",children:[(0,a.jsx)(w,{title:"Select Agents"}),(0,a.jsx)(w,{title:"Confirm"})]}),(()=>{switch(c){case 0:return M();case 1:return z();default:return null}})(),(0,a.jsxs)("div",{className:"flex justify-between mt-6",children:[(0,a.jsx)(f.ZP,{onClick:0===c?Z:()=>{1===c&&o(0)},children:0===c?"Cancel":"Previous"}),(0,a.jsxs)("div",{className:"flex space-x-2",children:[0===c&&(0,a.jsx)(f.ZP,{onClick:()=>{if(0===c){if(0===x.size){k.Z.fromBackend("Please select at least one agent to make public");return}o(1)}},disabled:0===x.size,children:"Next"}),1===c&&(0,a.jsx)(f.ZP,{onClick:P,loading:p,children:"Make Public"})]})]})]})})};let{Step:C}=v.default;var S=e=>{let{visible:s,onClose:l,accessToken:t,mcpHubData:r,onSuccess:i}=e,[c,o]=(0,d.useState)(0),[x,h]=(0,d.useState)(new Set),[p,g]=(0,d.useState)(!1),[j]=b.Z.useForm(),w=()=>{o(0),h(new Set),j.resetFields(),l()},Z=(e,s)=>{let l=new Set(x);s?l.add(e):l.delete(e),h(l)},S=e=>{e?h(new Set(r.map(e=>e.server_id))):h(new Set)};(0,d.useEffect)(()=>{s&&r.length>0&&h(new Set(r.filter(e=>{var s;return(null===(s=e.mcp_info)||void 0===s?void 0:s.is_public)===!0}).map(e=>e.server_id)))},[s]);let P=async()=>{if(0===x.size){k.Z.fromBackend("Please select at least one MCP server to make public");return}g(!0);try{let e=Array.from(x);await (0,_.makeMCPPublicCall)(t,e),k.Z.success("Successfully made ".concat(e.length," MCP server(s) public!")),w(),i()}catch(e){console.error("Error making MCP servers public:",e),k.Z.fromBackend("Failed to make MCP servers public. Please try again.")}finally{g(!1)}},M=()=>{let e=r.length>0&&r.every(e=>x.has(e.server_id)),s=x.size>0&&!e;return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)(y.Z,{children:"Select MCP Servers to Make Public"}),(0,a.jsx)("div",{className:"flex items-center space-x-2",children:(0,a.jsxs)(N.Z,{checked:e,indeterminate:s,onChange:e=>S(e.target.checked),disabled:0===r.length,children:["Select All ",r.length>0&&"(".concat(r.length,")")]})})]}),(0,a.jsx)(u.Z,{className:"text-sm text-gray-600",children:"Select the MCP servers you want to be visible on the public model hub. Users will still require a valid Virtual Key to use these servers."}),(0,a.jsx)("div",{className:"max-h-96 overflow-y-auto border rounded-lg p-4",children:(0,a.jsx)("div",{className:"space-y-3",children:0===r.length?(0,a.jsx)("div",{className:"text-center py-8 text-gray-500",children:(0,a.jsx)(u.Z,{children:"No MCP servers available."})}):r.map(e=>{var s;let l=(null===(s=e.mcp_info)||void 0===s?void 0:s.is_public)===!0;return(0,a.jsxs)("div",{className:"flex items-center space-x-3 p-3 border rounded-lg hover:bg-gray-50",children:[(0,a.jsx)(N.Z,{checked:x.has(e.server_id),onChange:s=>Z(e.server_id,s.target.checked)}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:e.server_name}),l&&(0,a.jsx)(m.Z,{color:"emerald",size:"sm",children:"Public"}),(0,a.jsx)(m.Z,{color:"blue",size:"sm",children:e.transport}),(0,a.jsx)(m.Z,{color:"active"===e.status||"healthy"===e.status?"green":"inactive"===e.status||"unhealthy"===e.status?"red":"gray",size:"sm",children:e.status||"unknown"})]}),(0,a.jsx)(u.Z,{className:"text-xs text-gray-600 mt-1",children:e.description||e.url}),e.allowed_tools&&e.allowed_tools.length>0&&(0,a.jsxs)("div",{className:"flex flex-wrap gap-1 mt-1",children:[e.allowed_tools.slice(0,3).map((e,s)=>(0,a.jsx)(m.Z,{color:"purple",size:"xs",children:e},s)),e.allowed_tools.length>3&&(0,a.jsxs)(u.Z,{className:"text-xs text-gray-500",children:["+",e.allowed_tools.length-3," more"]})]})]})]},e.server_id)})})}),x.size>0&&(0,a.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,a.jsxs)(u.Z,{className:"text-sm text-blue-800",children:[(0,a.jsx)("strong",{children:x.size})," MCP server",1!==x.size?"s":""," selected"]})})]})},z=()=>(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(y.Z,{children:"Confirm Making MCP Servers Public"}),(0,a.jsx)("div",{className:"bg-yellow-50 border border-yellow-200 rounded-lg p-4",children:(0,a.jsxs)(u.Z,{className:"text-sm text-yellow-800",children:[(0,a.jsx)("strong",{children:"Warning:"})," Once you make these MCP servers public, anyone who can go to the"," ",(0,a.jsx)("code",{children:"/ui/model_hub_table"})," will be able to know they exist on the proxy."]})}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:"MCP Servers to be made public:"}),(0,a.jsx)("div",{className:"max-h-48 overflow-y-auto border rounded-lg p-3",children:(0,a.jsx)("div",{className:"space-y-2",children:Array.from(x).map(e=>{let s=r.find(s=>s.server_id===e);return(0,a.jsx)("div",{className:"flex items-center justify-between p-2 bg-gray-50 rounded",children:(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:(null==s?void 0:s.server_name)||e}),s&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(m.Z,{color:"blue",size:"xs",children:s.transport}),(0,a.jsx)(m.Z,{color:"active"===s.status||"healthy"===s.status?"green":"inactive"===s.status||"unhealthy"===s.status?"red":"gray",size:"xs",children:s.status||"unknown"})]})]}),(null==s?void 0:s.description)&&(0,a.jsx)(u.Z,{className:"text-xs text-gray-600 mt-1",children:s.description}),(null==s?void 0:s.url)&&(0,a.jsx)(u.Z,{className:"text-xs text-gray-500 mt-1",children:s.url})]})},e)})})})]}),(0,a.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,a.jsxs)(u.Z,{className:"text-sm text-blue-800",children:["Total: ",(0,a.jsx)("strong",{children:x.size})," MCP server",1!==x.size?"s":""," will be made public"]})})]});return(0,a.jsx)(n.Z,{title:"Make MCP Servers Public",open:s,onCancel:w,footer:null,width:1200,maskClosable:!1,children:(0,a.jsxs)(b.Z,{form:j,layout:"vertical",children:[(0,a.jsxs)(v.default,{current:c,className:"mb-6",children:[(0,a.jsx)(C,{title:"Select Servers"}),(0,a.jsx)(C,{title:"Confirm"})]}),(()=>{switch(c){case 0:return M();case 1:return z();default:return null}})(),(0,a.jsxs)("div",{className:"flex justify-between mt-6",children:[(0,a.jsx)(f.ZP,{onClick:0===c?w:()=>{1===c&&o(0)},children:0===c?"Cancel":"Previous"}),(0,a.jsxs)("div",{className:"flex space-x-2",children:[0===c&&(0,a.jsx)(f.ZP,{onClick:()=>{if(0===c){if(0===x.size){k.Z.fromBackend("Please select at least one MCP server to make public");return}o(1)}},disabled:0===x.size,children:"Next"}),1===c&&(0,a.jsx)(f.ZP,{onClick:P,loading:p,children:"Make Public"})]})]})]})})},P=l(78801),M=e=>{let{modelHubData:s,onFilteredDataChange:l,showFiltersCard:t=!0,className:r=""}=e,[n,i]=(0,d.useState)(""),[c,o]=(0,d.useState)(""),[x,m]=(0,d.useState)(""),[h,u]=(0,d.useState)(""),p=(0,d.useRef)([]),g=(0,d.useMemo)(()=>(null==s?void 0:s.filter(e=>{let s=e.model_group.toLowerCase().includes(n.toLowerCase()),l=""===c||e.providers.includes(c),a=""===x||e.mode===x,t=""===h||Object.entries(e).filter(e=>{let[s,l]=e;return s.startsWith("supports_")&&!0===l}).some(e=>{let[s]=e;return s.replace(/^supports_/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")===h});return s&&l&&a&&t}))||[],[s,n,c,x,h]);(0,d.useEffect)(()=>{(g.length!==p.current.length||g.some((e,s)=>{var l;return e.model_group!==(null===(l=p.current[s])||void 0===l?void 0:l.model_group)}))&&(p.current=g,l(g))},[g,l]);let j=(0,a.jsxs)("div",{className:"flex flex-wrap gap-4 items-center",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(P.x,{className:"text-sm font-medium mb-2",children:"Search Models:"}),(0,a.jsx)("input",{type:"text",placeholder:"Search model names...",value:n,onChange:e=>i(e.target.value),className:"border rounded px-3 py-2 w-64 h-10 text-sm"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(P.x,{className:"text-sm font-medium mb-2",children:"Provider:"}),(0,a.jsxs)("select",{value:c,onChange:e=>o(e.target.value),className:"border rounded px-3 py-2 text-sm text-gray-600 w-40 h-10",children:[(0,a.jsx)("option",{value:"",className:"text-sm text-gray-600",children:"All Providers"}),s&&(e=>{let s=new Set;return e.forEach(e=>{e.providers.forEach(e=>s.add(e))}),Array.from(s)})(s).map(e=>(0,a.jsx)("option",{value:e,className:"text-sm text-gray-800",children:e},e))]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(P.x,{className:"text-sm font-medium mb-2",children:"Mode:"}),(0,a.jsxs)("select",{value:x,onChange:e=>m(e.target.value),className:"border rounded px-3 py-2 text-sm text-gray-600 w-32 h-10",children:[(0,a.jsx)("option",{value:"",className:"text-sm text-gray-600",children:"All Modes"}),s&&(e=>{let s=new Set;return e.forEach(e=>{e.mode&&s.add(e.mode)}),Array.from(s)})(s).map(e=>(0,a.jsx)("option",{value:e,className:"text-sm text-gray-800",children:e},e))]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(P.x,{className:"text-sm font-medium mb-2",children:"Features:"}),(0,a.jsxs)("select",{value:h,onChange:e=>u(e.target.value),className:"border rounded px-3 py-2 text-sm text-gray-600 w-48 h-10",children:[(0,a.jsx)("option",{value:"",className:"text-sm text-gray-600",children:"All Features"}),s&&(e=>{let s=new Set;return e.forEach(e=>{Object.entries(e).filter(e=>{let[s,l]=e;return s.startsWith("supports_")&&!0===l}).forEach(e=>{let[l]=e,a=l.replace(/^supports_/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ");s.add(a)})}),Array.from(s).sort()})(s).map(e=>(0,a.jsx)("option",{value:e,className:"text-sm text-gray-800",children:e},e))]})]}),(n||c||x||h)&&(0,a.jsx)("div",{className:"flex items-end",children:(0,a.jsx)("button",{onClick:()=>{i(""),o(""),m(""),u("")},className:"text-blue-600 hover:text-blue-800 text-sm underline h-10 flex items-center",children:"Clear Filters"})})]});return t?(0,a.jsx)(P.Z,{className:"mb-6 ".concat(r),children:j}):(0,a.jsx)("div",{className:r,children:j})};let{Step:z}=v.default;var A=e=>{let{visible:s,onClose:l,accessToken:t,modelHubData:r,onSuccess:i}=e,[c,o]=(0,d.useState)(0),[x,h]=(0,d.useState)(new Set),[p,g]=(0,d.useState)([]),[j,w]=(0,d.useState)(!1),[Z]=b.Z.useForm(),C=()=>{o(0),h(new Set),g([]),Z.resetFields(),l()},S=(e,s)=>{let l=new Set(x);s?l.add(e):l.delete(e),h(l)},P=e=>{e?h(new Set(p.map(e=>e.model_group))):h(new Set)},A=(0,d.useCallback)(e=>{g(e)},[]);(0,d.useEffect)(()=>{s&&r.length>0&&(g(r),h(new Set(r.filter(e=>!0===e.is_public_model_group).map(e=>e.model_group))))},[s,r]);let F=async()=>{if(0===x.size){k.Z.fromBackend("Please select at least one model to make public");return}w(!0);try{let e=Array.from(x);await (0,_.makeModelGroupPublic)(t,e),k.Z.success("Successfully made ".concat(e.length," model group(s) public!")),C(),i()}catch(e){console.error("Error making model groups public:",e),k.Z.fromBackend("Failed to make model groups public. Please try again.")}finally{w(!1)}},L=()=>{let e=p.length>0&&p.every(e=>x.has(e.model_group)),s=x.size>0&&!e;return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)(y.Z,{children:"Select Models to Make Public"}),(0,a.jsx)("div",{className:"flex items-center space-x-2",children:(0,a.jsxs)(N.Z,{checked:e,indeterminate:s,onChange:e=>P(e.target.checked),disabled:0===p.length,children:["Select All ",p.length>0&&"(".concat(p.length,")")]})})]}),(0,a.jsx)(u.Z,{className:"text-sm text-gray-600",children:"Select the models you want to be visible on the public model hub. Users will still require a valid Virtual Key to use these models."}),(0,a.jsx)(M,{modelHubData:r,onFilteredDataChange:A,showFiltersCard:!1,className:"border rounded-lg p-4 bg-gray-50"}),(0,a.jsx)("div",{className:"max-h-96 overflow-y-auto border rounded-lg p-4",children:(0,a.jsx)("div",{className:"space-y-3",children:0===p.length?(0,a.jsx)("div",{className:"text-center py-8 text-gray-500",children:(0,a.jsx)(u.Z,{children:"No models match the current filters."})}):p.map(e=>(0,a.jsxs)("div",{className:"flex items-center space-x-3 p-3 border rounded-lg hover:bg-gray-50",children:[(0,a.jsx)(N.Z,{checked:x.has(e.model_group),onChange:s=>S(e.model_group,s.target.checked)}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:e.model_group}),e.mode&&(0,a.jsx)(m.Z,{color:"green",size:"sm",children:e.mode})]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:e.providers.map(e=>(0,a.jsx)(m.Z,{color:"blue",size:"xs",children:e},e))})]})]},e.model_group))})}),x.size>0&&(0,a.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,a.jsxs)(u.Z,{className:"text-sm text-blue-800",children:[(0,a.jsx)("strong",{children:x.size})," model",1!==x.size?"s":""," selected"]})})]})},D=()=>(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(y.Z,{children:"Confirm Making Models Public"}),(0,a.jsx)("div",{className:"bg-yellow-50 border border-yellow-200 rounded-lg p-4",children:(0,a.jsxs)(u.Z,{className:"text-sm text-yellow-800",children:[(0,a.jsx)("strong",{children:"Warning:"})," Once you make these models public, anyone who can go to the"," ",(0,a.jsx)("code",{children:"/ui/model_hub_table"})," will be able to know they exist on the proxy."]})}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:"Models to be made public:"}),(0,a.jsx)("div",{className:"max-h-48 overflow-y-auto border rounded-lg p-3",children:(0,a.jsx)("div",{className:"space-y-2",children:Array.from(x).map(e=>{let s=r.find(s=>s.model_group===e);return(0,a.jsx)("div",{className:"flex items-center justify-between p-2 bg-gray-50 rounded",children:(0,a.jsxs)("div",{children:[(0,a.jsx)(u.Z,{className:"font-medium",children:e}),s&&(0,a.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:s.providers.map(e=>(0,a.jsx)(m.Z,{color:"blue",size:"xs",children:e},e))})]})},e)})})})]}),(0,a.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,a.jsxs)(u.Z,{className:"text-sm text-blue-800",children:["Total: ",(0,a.jsx)("strong",{children:x.size})," model",1!==x.size?"s":""," will be made public"]})})]});return(0,a.jsx)(n.Z,{title:"Make Models Public",open:s,onCancel:C,footer:null,width:1200,maskClosable:!1,children:(0,a.jsxs)(b.Z,{form:Z,layout:"vertical",children:[(0,a.jsxs)(v.default,{current:c,className:"mb-6",children:[(0,a.jsx)(z,{title:"Select Models"}),(0,a.jsx)(z,{title:"Confirm"})]}),(()=>{switch(c){case 0:return L();case 1:return D();default:return null}})(),(0,a.jsxs)("div",{className:"flex justify-between mt-6",children:[(0,a.jsx)(f.ZP,{onClick:0===c?C:()=>{1===c&&o(0)},children:0===c?"Cancel":"Previous"}),(0,a.jsxs)("div",{className:"flex space-x-2",children:[0===c&&(0,a.jsx)(f.ZP,{onClick:()=>{if(0===c){if(0===x.size){k.Z.fromBackend("Please select at least one model to make public");return}o(1)}},disabled:0===x.size,children:"Next"}),1===c&&(0,a.jsx)(f.ZP,{onClick:F,loading:j,children:"Make Public"})]})]})]})})},F=l(8048);let L=e=>e.replace(/^supports_/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "),D=e=>Object.entries(e).filter(e=>{let[s,l]=e;return s.startsWith("supports_")&&!0===l}).map(e=>{let[s]=e;return s}),O=e=>"$".concat((1e6*e).toFixed(2)),K=e=>e>=1e6?"".concat((e/1e6).toFixed(1),"M"):e>=1e3?"".concat((e/1e3).toFixed(1),"K"):e.toString(),U=function(e,s){let l=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=[{header:"Public Model Name",accessorKey:"model_group",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:l}=e,r=l.original;return(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium text-sm",children:r.model_group}),(0,a.jsx)(p.Z,{title:"Copy model name",children:(0,a.jsx)(t.Z,{onClick:()=>s(r.model_group),className:"cursor-pointer text-gray-500 hover:text-blue-500 text-xs"})})]}),(0,a.jsx)("div",{className:"md:hidden",children:(0,a.jsx)(u.Z,{className:"text-xs text-gray-600",children:r.providers.join(", ")})})]})}},{header:"Provider",accessorKey:"providers",enableSorting:!0,sortingFn:(e,s)=>{let l=e.original.providers.join(", "),a=s.original.providers.join(", ");return l.localeCompare(a)},cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsxs)("div",{className:"flex flex-wrap gap-1",children:[l.providers.slice(0,2).map(e=>(0,a.jsx)(g.Z,{color:"blue",className:"text-xs",children:e},e)),l.providers.length>2&&(0,a.jsxs)(u.Z,{className:"text-xs text-gray-500",children:["+",l.providers.length-2]})]})},meta:{className:"hidden md:table-cell"}},{header:"Mode",accessorKey:"mode",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return l.mode?(0,a.jsx)(m.Z,{color:"green",size:"sm",children:l.mode}):(0,a.jsx)(u.Z,{className:"text-gray-500",children:"-"})},meta:{className:"hidden lg:table-cell"}},{header:"Tokens",accessorKey:"max_input_tokens",enableSorting:!0,sortingFn:(e,s)=>(e.original.max_input_tokens||0)+(e.original.max_output_tokens||0)-((s.original.max_input_tokens||0)+(s.original.max_output_tokens||0)),cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsx)("div",{className:"space-y-1",children:(0,a.jsxs)(u.Z,{className:"text-xs",children:[l.max_input_tokens?K(l.max_input_tokens):"-"," /"," ",l.max_output_tokens?K(l.max_output_tokens):"-"]})})},meta:{className:"hidden lg:table-cell"}},{header:"Cost/1M",accessorKey:"input_cost_per_token",enableSorting:!0,sortingFn:(e,s)=>(e.original.input_cost_per_token||0)+(e.original.output_cost_per_token||0)-((s.original.input_cost_per_token||0)+(s.original.output_cost_per_token||0)),cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)(u.Z,{className:"text-xs",children:l.input_cost_per_token?O(l.input_cost_per_token):"-"}),(0,a.jsx)(u.Z,{className:"text-xs text-gray-500",children:l.output_cost_per_token?O(l.output_cost_per_token):"-"})]})}},{header:"Features",accessorKey:"capabilities",enableSorting:!1,cell:e=>{let{row:s}=e,l=D(s.original),t=["green","blue","purple","orange","red","yellow"];return(0,a.jsx)("div",{className:"flex flex-wrap gap-1",children:0===l.length?(0,a.jsx)(u.Z,{className:"text-gray-500 text-xs",children:"-"}):l.map((e,s)=>(0,a.jsx)(m.Z,{color:t[s%t.length],size:"xs",children:L(e)},e))})}},{header:"Public",accessorKey:"is_public_model_group",enableSorting:!0,sortingFn:(e,s)=>(!0===e.original.is_public_model_group?1:0)-(!0===s.original.is_public_model_group?1:0),cell:e=>{let{row:s}=e;return!0===s.original.is_public_model_group?(0,a.jsx)(m.Z,{color:"green",size:"xs",children:"Yes"}):(0,a.jsx)(m.Z,{color:"gray",size:"xs",children:"No"})},meta:{className:"hidden md:table-cell"}},{header:"Details",id:"details",enableSorting:!1,cell:s=>{let{row:l}=s,t=l.original;return(0,a.jsxs)(h.Z,{size:"xs",variant:"secondary",onClick:()=>e(t),icon:j.Z,children:[(0,a.jsx)("span",{className:"hidden lg:inline",children:"Details"}),(0,a.jsx)("span",{className:"lg:hidden",children:"Info"})]})}}];return l?r.filter(e=>!("accessorKey"in e)||"is_public_model_group"!==e.accessorKey):r};var E=l(87526),T=l(86462),H=l(47686),R=l(77355),B=l(93416),I=l(74998),Y=l(95704),V=e=>{let{accessToken:s,userRole:l}=e,[t,r]=(0,d.useState)([]),[i,c]=(0,d.useState)({url:"",displayName:""}),[o,m]=(0,d.useState)(null),[h,u]=(0,d.useState)(!1),[p,g]=(0,d.useState)(!0),j=async()=>{if(s)try{u(!0);let e=await (0,_.getPublicModelHubInfo)();if(e&&e.useful_links){let s=e.useful_links||{},l=Object.entries(s).map((e,s)=>{let[l,a]=e;return{id:"".concat(s,"-").concat(l),displayName:l,url:a}});r(l)}else r([])}catch(e){console.error("Error fetching useful links:",e),r([])}finally{u(!1)}};if((0,d.useEffect)(()=>{j()},[s]),!(0,x.tY)(l||""))return null;let v=async e=>{if(!s)return!1;try{let l={};return e.forEach(e=>{l[e.displayName]=e.url}),await (0,_.updateUsefulLinksCall)(s,l),n.Z.success({title:"Links Saved Successfully",content:(0,a.jsxs)("div",{className:"py-4",children:[(0,a.jsx)("p",{className:"text-gray-600 mb-4",children:"Your useful links have been saved and are now visible on the public model hub."}),(0,a.jsxs)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:[(0,a.jsx)("p",{className:"text-sm text-blue-800 mb-2 font-medium",children:"View your updated model hub:"}),(0,a.jsx)("a",{href:"".concat((0,_.getProxyBaseUrl)(),"/ui/model_hub_table"),target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center text-blue-600 hover:text-blue-800 underline text-sm font-medium",children:"Open Public Model Hub →"})]})]}),width:500,okText:"Close",maskClosable:!0,keyboard:!0}),!0}catch(e){return console.error("Error saving links:",e),k.Z.fromBackend("Failed to save links - ".concat(e)),!1}},b=async()=>{if(!i.url||!i.displayName)return;try{new URL(i.url)}catch(e){k.Z.fromBackend("Please enter a valid URL");return}if(t.some(e=>e.displayName===i.displayName)){k.Z.fromBackend("A link with this display name already exists");return}let e=[...t,{id:"".concat(Date.now(),"-").concat(i.displayName),displayName:i.displayName,url:i.url}];await v(e)&&(r(e),c({url:"",displayName:""}),k.Z.success("Link added successfully"))},N=e=>{m({...e})},f=async()=>{if(!o)return;try{new URL(o.url)}catch(e){k.Z.fromBackend("Please enter a valid URL");return}if(t.some(e=>e.id!==o.id&&e.displayName===o.displayName)){k.Z.fromBackend("A link with this display name already exists");return}let e=t.map(e=>e.id===o.id?o:e);await v(e)&&(r(e),m(null),k.Z.success("Link updated successfully"))},y=()=>{m(null)},w=async e=>{let s=t.filter(s=>s.id!==e);await v(s)&&(r(s),k.Z.success("Link deleted successfully"))},Z=e=>{window.open(e,"_blank")};return(0,a.jsxs)(Y.Zb,{className:"mb-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between cursor-pointer",onClick:()=>g(!p),children:[(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)(Y.Dx,{className:"mb-0",children:"Link Management"}),(0,a.jsx)("p",{className:"text-sm text-gray-500",children:"Manage the links that are displayed under 'Useful Links' on the public model hub."})]}),(0,a.jsx)("div",{className:"flex items-center",children:p?(0,a.jsx)(T.Z,{className:"w-5 h-5 text-gray-500"}):(0,a.jsx)(H.Z,{className:"w-5 h-5 text-gray-500"})})]}),p&&(0,a.jsxs)("div",{className:"mt-4",children:[(0,a.jsxs)("div",{className:"mb-6",children:[(0,a.jsx)(Y.xv,{className:"text-sm font-medium text-gray-700 mb-2",children:"Add New Link"}),(0,a.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"URL"}),(0,a.jsx)("input",{type:"text",value:i.url,onChange:e=>c({...i,url:e.target.value}),placeholder:"https://example.com",className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Display Name"}),(0,a.jsx)("input",{type:"text",value:i.displayName,onChange:e=>c({...i,displayName:e.target.value}),placeholder:"Friendly name",className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm"})]}),(0,a.jsx)("div",{className:"flex items-end",children:(0,a.jsxs)("button",{onClick:b,disabled:!i.url||!i.displayName,className:"flex items-center px-4 py-2 rounded-md text-sm ".concat(i.url&&i.displayName?"bg-green-600 text-white hover:bg-green-700":"bg-gray-300 text-gray-500 cursor-not-allowed"),children:[(0,a.jsx)(R.Z,{className:"w-4 h-4 mr-1"}),"Add Link"]})})]})]}),(0,a.jsx)(Y.xv,{className:"text-sm font-medium text-gray-700 mb-2",children:"Manage Existing Links"}),(0,a.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)(Y.iA,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,a.jsx)(Y.ss,{children:(0,a.jsxs)(Y.SC,{children:[(0,a.jsx)(Y.xs,{className:"py-1 h-8",children:"Display Name"}),(0,a.jsx)(Y.xs,{className:"py-1 h-8",children:"URL"}),(0,a.jsx)(Y.xs,{className:"py-1 h-8",children:"Actions"})]})}),(0,a.jsxs)(Y.RM,{children:[t.map(e=>(0,a.jsx)(Y.SC,{className:"h-8",children:o&&o.id===e.id?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(Y.pj,{className:"py-0.5",children:(0,a.jsx)("input",{type:"text",value:o.displayName,onChange:e=>m({...o,displayName:e.target.value}),className:"w-full px-2 py-1 border border-gray-300 rounded-md text-sm"})}),(0,a.jsx)(Y.pj,{className:"py-0.5",children:(0,a.jsx)("input",{type:"text",value:o.url,onChange:e=>m({...o,url:e.target.value}),className:"w-full px-2 py-1 border border-gray-300 rounded-md text-sm"})}),(0,a.jsx)(Y.pj,{className:"py-0.5 whitespace-nowrap",children:(0,a.jsxs)("div",{className:"flex space-x-2",children:[(0,a.jsx)("button",{onClick:f,className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:"Save"}),(0,a.jsx)("button",{onClick:y,className:"text-xs bg-gray-50 text-gray-600 px-2 py-1 rounded hover:bg-gray-100",children:"Cancel"})]})})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(Y.pj,{className:"py-0.5 text-sm text-gray-900",children:e.displayName}),(0,a.jsx)(Y.pj,{className:"py-0.5 text-sm text-gray-500",children:e.url}),(0,a.jsx)(Y.pj,{className:"py-0.5 whitespace-nowrap",children:(0,a.jsxs)("div",{className:"flex space-x-2",children:[(0,a.jsx)("button",{onClick:()=>Z(e.url),className:"text-xs bg-green-50 text-green-600 px-2 py-1 rounded hover:bg-green-100",children:"Use"}),(0,a.jsx)("button",{onClick:()=>N(e),className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:(0,a.jsx)(B.Z,{className:"w-3 h-3"})}),(0,a.jsx)("button",{onClick:()=>w(e.id),className:"text-xs bg-red-50 text-red-600 px-2 py-1 rounded hover:bg-red-100",children:(0,a.jsx)(I.Z,{className:"w-3 h-3"})})]})})]})},e.id)),0===t.length&&(0,a.jsx)(Y.SC,{children:(0,a.jsx)(Y.pj,{colSpan:3,className:"py-0.5 text-sm text-gray-500 text-center",children:"No links added yet. Add a new link above."})})]})]})})})]})]})},W=e=>{var s,l,v,b;let{accessToken:N,publicPage:f,premiumUser:y,userRole:w}=e,[C,P]=(0,d.useState)(!1),[z,L]=(0,d.useState)(null),[D,O]=(0,d.useState)(!0),[K,T]=(0,d.useState)(!1),[H,R]=(0,d.useState)(!1),[B,I]=(0,d.useState)(null),[Y,W]=(0,d.useState)([]),[q,G]=(0,d.useState)(!1),[J,$]=(0,d.useState)(null),[Q,X]=(0,d.useState)(!1),[ee,es]=(0,d.useState)(!0),[el,ea]=(0,d.useState)(null),[et,er]=(0,d.useState)(!1),[en,ei]=(0,d.useState)(null),[ec,ed]=(0,d.useState)(!0),[eo,ex]=(0,d.useState)(null),[em,eh]=(0,d.useState)(!1),[eu,ep]=(0,d.useState)(!1),eg=(0,c.useRouter)(),ej=(0,d.useRef)(null),ev=(0,d.useRef)(null),eb=(0,d.useRef)(null);(0,d.useEffect)(()=>{let e=async e=>{try{O(!0);let s=await (0,_.modelHubCall)(e);console.log("ModelHubData:",s),L(s.data),(0,_.getConfigFieldSetting)(e,"enable_public_model_hub").then(e=>{console.log("data: ".concat(JSON.stringify(e))),!0==e.field_value&&P(!0)}).catch(e=>{})}catch(e){console.error("There was an error fetching the model data",e)}finally{O(!1)}},s=async()=>{try{var e,s;O(!0),await (0,_.getUiConfig)();let l=await (0,_.modelHubPublicModelsCall)();console.log("ModelHubData:",l),console.log("First model structure:",l[0]),console.log("Model has model_group?",null===(e=l[0])||void 0===e?void 0:e.model_group),console.log("Model has providers?",null===(s=l[0])||void 0===s?void 0:s.providers),L(l),P(!0)}catch(e){console.error("There was an error fetching the public model data",e)}finally{O(!1)}};N?e(N):f&&s()},[N,f]),(0,d.useEffect)(()=>{let e=async()=>{if(N)try{es(!0);let e=await (0,_.getAgentsList)(N);console.log("AgentHubData:",e);let s=e.agents.map(e=>({agent_id:e.agent_id,...e.agent_card_params,is_public:e.litellm_params.is_public}));$(s)}catch(e){console.error("There was an error fetching the agent data",e)}finally{es(!1)}};f||e()},[f,N]),(0,d.useEffect)(()=>{let e=async()=>{if(N)try{ed(!0);let e=await (0,_.fetchMCPServers)(N);console.log("MCPHubData:",e),ei(e)}catch(e){console.error("There was an error fetching the MCP server data",e)}finally{ed(!1)}};f||e()},[f,N]);let eN=()=>{N&&G(!0)},ef=()=>{N&&X(!0)},ey=()=>{N&&ep(!0)},e_=()=>{T(!1),R(!1),I(null),er(!1),ea(null),eh(!1),ex(null)},ek=()=>{T(!1),R(!1),I(null),er(!1),ea(null),eh(!1),ex(null)},ew=e=>{navigator.clipboard.writeText(e),k.Z.success("Copied to clipboard!")},eZ=e=>e.replace(/^supports_/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "),eC=e=>Object.entries(e).filter(e=>{let[s,l]=e;return s.startsWith("supports_")&&!0===l}).map(e=>{let[s]=e;return s}),eS=e=>"$".concat((1e6*e).toFixed(2)),eP=(0,d.useCallback)(e=>{W(e)},[]);return(console.log("publicPage: ",f),console.log("publicPageAllowed: ",C),f&&C)?(0,a.jsx)(E.Z,{accessToken:N}):(0,a.jsxs)("div",{className:"w-full mx-4 h-[75vh]",children:[!1==f?(0,a.jsxs)("div",{className:"w-full m-2 mt-2 p-8",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,a.jsxs)("div",{className:"flex flex-col items-start",children:[(0,a.jsx)(r.Dx,{className:"text-center",children:"AI Hub"}),(0,x.tY)(w||"")?(0,a.jsx)("p",{className:"text-sm text-gray-600",children:"Make models, agents, and MCP servers public for developers to know what's available."}):(0,a.jsx)("p",{className:"text-sm text-gray-600",children:"A list of all public model names personally available to you."})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,a.jsx)(r.xv,{children:"Model Hub URL:"}),(0,a.jsxs)("div",{className:"flex items-center bg-gray-200 px-2 py-1 rounded",children:[(0,a.jsx)(r.xv,{className:"mr-2",children:"".concat((0,_.getProxyBaseUrl)(),"/ui/model_hub_table")}),(0,a.jsx)("button",{onClick:()=>ew("".concat((0,_.getProxyBaseUrl)(),"/ui/model_hub_table")),className:"p-1 hover:bg-gray-300 rounded transition-colors",title:"Copy URL",children:(0,a.jsx)(i.Z,{size:16,className:"text-gray-600"})})]})]})]}),(0,x.tY)(w||"")&&(0,a.jsx)("div",{className:"mt-8 mb-2",children:(0,a.jsx)(V,{accessToken:N,userRole:w})}),(0,a.jsxs)(r.v0,{children:[(0,a.jsxs)(r.td,{className:"mb-4",children:[(0,a.jsx)(r.OK,{children:"Model Hub"}),(0,a.jsx)(r.OK,{children:"Agent Hub"}),(0,a.jsx)(r.OK,{children:"MCP Hub"})]}),(0,a.jsxs)(r.nP,{children:[(0,a.jsxs)(r.x4,{children:[(0,a.jsxs)(r.Zb,{children:[!1==f&&(0,x.tY)(w||"")&&(0,a.jsx)("div",{className:"flex justify-end mb-4",children:(0,a.jsx)(r.zx,{onClick:()=>eN(),children:"Select Models to Make Public"})}),(0,a.jsx)(M,{modelHubData:z||[],onFilteredDataChange:eP}),(0,a.jsx)(F.C,{columns:U(e=>{I(e),T(!0)},ew,f),data:Y,isLoading:D,table:ej,defaultSorting:[{id:"model_group",desc:!1}]})]}),(0,a.jsx)("div",{className:"mt-4 text-center space-y-2",children:(0,a.jsxs)(r.xv,{className:"text-sm text-gray-600",children:["Showing ",Y.length," of ",(null==z?void 0:z.length)||0," models"]})})]}),(0,a.jsxs)(r.x4,{children:[(0,a.jsxs)(r.Zb,{children:[!1==f&&(0,x.tY)(w||"")&&(0,a.jsx)("div",{className:"flex justify-end mb-4",children:(0,a.jsx)(r.zx,{onClick:()=>ef(),children:"Select Agents to Make Public"})}),(0,a.jsx)(F.C,{columns:function(e,s){return arguments.length>2&&void 0!==arguments[2]&&arguments[2],[{header:"Agent Name",accessorKey:"name",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:l}=e,r=l.original;return(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium text-sm",children:r.name}),(0,a.jsx)(p.Z,{title:"Copy agent name",children:(0,a.jsx)(t.Z,{onClick:()=>s(r.name),className:"cursor-pointer text-gray-500 hover:text-blue-500 text-xs"})})]}),(0,a.jsx)("div",{className:"md:hidden",children:(0,a.jsx)(u.Z,{className:"text-xs text-gray-600",children:r.description})})]})}},{header:"Description",accessorKey:"description",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsx)(u.Z,{className:"text-xs line-clamp-2",children:l.description||"-"})},meta:{className:"hidden md:table-cell"}},{header:"Version",accessorKey:"version",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsxs)(m.Z,{color:"blue",size:"sm",children:["v",l.version]})},meta:{className:"hidden lg:table-cell"}},{header:"Protocol",accessorKey:"protocolVersion",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsx)(u.Z,{className:"text-xs",children:l.protocolVersion||"-"})},meta:{className:"hidden lg:table-cell"}},{header:"Skills",accessorKey:"skills",enableSorting:!1,cell:e=>{let{row:s}=e,l=s.original.skills||[];return(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)(u.Z,{className:"text-xs font-medium",children:[l.length," skill",1!==l.length?"s":""]}),l.length>0&&(0,a.jsxs)("div",{className:"flex flex-wrap gap-1",children:[l.slice(0,2).map(e=>(0,a.jsx)(g.Z,{color:"purple",className:"text-xs",children:e.name},e.id)),l.length>2&&(0,a.jsxs)(u.Z,{className:"text-xs text-gray-500",children:["+",l.length-2]})]})]})}},{header:"Capabilities",accessorKey:"capabilities",enableSorting:!1,cell:e=>{let{row:s}=e,l=Object.entries(s.original.capabilities||{}).filter(e=>{let[s,l]=e;return!0===l}).map(e=>{let[s]=e;return s});return(0,a.jsx)("div",{className:"flex flex-wrap gap-1",children:0===l.length?(0,a.jsx)(u.Z,{className:"text-gray-500 text-xs",children:"-"}):l.map(e=>(0,a.jsx)(m.Z,{color:"green",size:"xs",children:e},e))})}},{header:"I/O Modes",accessorKey:"defaultInputModes",enableSorting:!1,cell:e=>{let{row:s}=e,l=s.original,t=l.defaultInputModes||[],r=l.defaultOutputModes||[];return(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)(u.Z,{className:"text-xs",children:[(0,a.jsx)("span",{className:"font-medium",children:"In:"})," ",t.join(", ")||"-"]}),(0,a.jsxs)(u.Z,{className:"text-xs",children:[(0,a.jsx)("span",{className:"font-medium",children:"Out:"})," ",r.join(", ")||"-"]})]})},meta:{className:"hidden xl:table-cell"}},{header:"Public",accessorKey:"is_public",enableSorting:!0,sortingFn:(e,s)=>(!0===e.original.is_public?1:0)-(!0===s.original.is_public?1:0),cell:e=>{let{row:s}=e;return console.log("CHECKPOINT 1: ".concat(JSON.stringify(s.original))),!0===s.original.is_public?(0,a.jsx)(m.Z,{color:"green",size:"xs",children:"Yes"}):(0,a.jsx)(m.Z,{color:"gray",size:"xs",children:"No"})},meta:{className:"hidden md:table-cell"}},{header:"Details",id:"details",enableSorting:!1,cell:s=>{let{row:l}=s,t=l.original;return(0,a.jsxs)(h.Z,{size:"xs",variant:"secondary",onClick:()=>e(t),icon:j.Z,children:[(0,a.jsx)("span",{className:"hidden lg:inline",children:"Details"}),(0,a.jsx)("span",{className:"lg:hidden",children:"Info"})]})}}]}(e=>{ea(e),er(!0)},ew,f),data:J||[],isLoading:ee,table:ev,defaultSorting:[{id:"name",desc:!1}]})]}),(0,a.jsx)("div",{className:"mt-4 text-center space-y-2",children:(0,a.jsxs)(r.xv,{className:"text-sm text-gray-600",children:["Showing ",(null==J?void 0:J.length)||0," agent",(null==J?void 0:J.length)!==1?"s":""]})})]}),(0,a.jsxs)(r.x4,{children:[(0,a.jsxs)(r.Zb,{children:[!1==f&&(0,x.tY)(w||"")&&(0,a.jsx)("div",{className:"flex justify-end mb-4",children:(0,a.jsx)(r.zx,{onClick:()=>ey(),children:"Select MCP Servers to Make Public"})}),(0,a.jsx)(F.C,{columns:function(e,s){return arguments.length>2&&void 0!==arguments[2]&&arguments[2],[{header:"Server Name",accessorKey:"server_name",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:l}=e,r=l.original;return(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium text-sm",children:r.server_name}),(0,a.jsx)(p.Z,{title:"Copy server name",children:(0,a.jsx)(t.Z,{onClick:()=>s(r.server_name),className:"cursor-pointer text-gray-500 hover:text-blue-500 text-xs"})})]}),(0,a.jsx)("div",{className:"md:hidden",children:(0,a.jsx)(u.Z,{className:"text-xs text-gray-600",children:r.description||"-"})})]})}},{header:"Description",accessorKey:"description",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsx)(u.Z,{className:"text-xs line-clamp-2",children:l.description||"-"})},meta:{className:"hidden md:table-cell"}},{header:"URL",accessorKey:"url",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:l}=e,r=l.original;return(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"text-xs truncate max-w-xs",children:r.url}),(0,a.jsx)(p.Z,{title:"Copy URL",children:(0,a.jsx)(t.Z,{onClick:()=>s(r.url),className:"cursor-pointer text-gray-500 hover:text-blue-500 text-xs flex-shrink-0"})})]})},meta:{className:"hidden lg:table-cell"}},{header:"Transport",accessorKey:"transport",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsx)(m.Z,{color:"blue",size:"sm",children:l.transport})},meta:{className:"hidden md:table-cell"}},{header:"Auth Type",accessorKey:"auth_type",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original,t="none"===l.auth_type?"gray":"green";return(0,a.jsx)(m.Z,{color:t,size:"sm",children:l.auth_type})},meta:{className:"hidden md:table-cell"}},{header:"Status",accessorKey:"status",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original,t={active:"green",inactive:"red",unknown:"gray",healthy:"green",unhealthy:"red"}[l.status]||"gray";return(0,a.jsx)(m.Z,{color:t,size:"sm",children:l.status||"unknown"})}},{header:"Tools",accessorKey:"allowed_tools",enableSorting:!1,cell:e=>{let{row:s}=e,l=s.original.allowed_tools||[];return(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)(u.Z,{className:"text-xs font-medium",children:l.length>0?"".concat(l.length," tool").concat(1!==l.length?"s":""):"All tools"}),l.length>0&&(0,a.jsxs)("div",{className:"flex flex-wrap gap-1",children:[l.slice(0,2).map((e,s)=>(0,a.jsx)(g.Z,{color:"purple",className:"text-xs",children:e},s)),l.length>2&&(0,a.jsxs)(u.Z,{className:"text-xs text-gray-500",children:["+",l.length-2]})]})]})},meta:{className:"hidden lg:table-cell"}},{header:"Created By",accessorKey:"created_by",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsx)(u.Z,{className:"text-xs",children:l.created_by||"-"})},meta:{className:"hidden xl:table-cell"}},{header:"Public",accessorKey:"mcp_info.is_public",enableSorting:!0,sortingFn:(e,s)=>{var l,a;return((null===(l=e.original.mcp_info)||void 0===l?void 0:l.is_public)===!0?1:0)-((null===(a=s.original.mcp_info)||void 0===a?void 0:a.is_public)===!0?1:0)},cell:e=>{var s;let{row:l}=e;return(null===(s=l.original.mcp_info)||void 0===s?void 0:s.is_public)===!0?(0,a.jsx)(m.Z,{color:"green",size:"xs",children:"Yes"}):(0,a.jsx)(m.Z,{color:"gray",size:"xs",children:"No"})},meta:{className:"hidden md:table-cell"}},{header:"Details",id:"details",enableSorting:!1,cell:s=>{let{row:l}=s,t=l.original;return(0,a.jsxs)(h.Z,{size:"xs",variant:"secondary",onClick:()=>e(t),icon:j.Z,children:[(0,a.jsx)("span",{className:"hidden lg:inline",children:"Details"}),(0,a.jsx)("span",{className:"lg:hidden",children:"Info"})]})}}]}(e=>{ex(e),eh(!0)},ew,f),data:en||[],isLoading:ec,table:eb,defaultSorting:[{id:"server_name",desc:!1}]})]}),(0,a.jsx)("div",{className:"mt-4 text-center space-y-2",children:(0,a.jsxs)(r.xv,{className:"text-sm text-gray-600",children:["Showing ",(null==en?void 0:en.length)||0," MCP server",(null==en?void 0:en.length)!==1?"s":""]})})]})]})]})]}):(0,a.jsxs)(r.Zb,{className:"mx-auto max-w-xl mt-10",children:[(0,a.jsx)(r.xv,{className:"text-xl text-center mb-2 text-black",children:"Public Model Hub not enabled."}),(0,a.jsx)("p",{className:"text-base text-center text-slate-800",children:"Ask your proxy admin to enable this on their Admin UI."})]}),(0,a.jsx)(n.Z,{title:"Public Model Hub",width:600,visible:H,footer:null,onOk:e_,onCancel:ek,children:(0,a.jsxs)("div",{className:"pt-5 pb-5",children:[(0,a.jsxs)("div",{className:"flex justify-between mb-4",children:[(0,a.jsx)(r.xv,{className:"text-base mr-2",children:"Shareable Link:"}),(0,a.jsx)(r.xv,{className:"max-w-sm ml-2 bg-gray-200 pr-2 pl-2 pt-1 pb-1 text-center rounded",children:"".concat((0,_.getProxyBaseUrl)(),"/ui/model_hub_table")})]}),(0,a.jsx)("div",{className:"flex justify-end",children:(0,a.jsx)(r.zx,{onClick:()=>{eg.replace("/model_hub_table?key=".concat(N))},children:"See Page"})})]})}),(0,a.jsx)(n.Z,{title:(null==B?void 0:B.model_group)||"Model Details",width:1e3,visible:K,footer:null,onOk:e_,onCancel:ek,children:B&&(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Model Overview"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Model Group:"}),(0,a.jsx)(r.xv,{children:B.model_group})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Mode:"}),(0,a.jsx)(r.xv,{children:B.mode||"Not specified"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Providers:"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:B.providers.map(e=>(0,a.jsx)(r.Ct,{color:"blue",children:e},e))})]})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Token & Cost Information"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Max Input Tokens:"}),(0,a.jsx)(r.xv,{children:(null===(s=B.max_input_tokens)||void 0===s?void 0:s.toLocaleString())||"Not specified"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Max Output Tokens:"}),(0,a.jsx)(r.xv,{children:(null===(l=B.max_output_tokens)||void 0===l?void 0:l.toLocaleString())||"Not specified"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Input Cost per 1M Tokens:"}),(0,a.jsx)(r.xv,{children:B.input_cost_per_token?eS(B.input_cost_per_token):"Not specified"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Output Cost per 1M Tokens:"}),(0,a.jsx)(r.xv,{children:B.output_cost_per_token?eS(B.output_cost_per_token):"Not specified"})]})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Capabilities"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:(()=>{let e=eC(B),s=["green","blue","purple","orange","red","yellow"];return 0===e.length?(0,a.jsx)(r.xv,{className:"text-gray-500",children:"No special capabilities listed"}):e.map((e,l)=>(0,a.jsx)(r.Ct,{color:s[l%s.length],children:eZ(e)},e))})()})]}),(B.tpm||B.rpm)&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Rate Limits"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[B.tpm&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Tokens per Minute:"}),(0,a.jsx)(r.xv,{children:B.tpm.toLocaleString()})]}),B.rpm&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Requests per Minute:"}),(0,a.jsx)(r.xv,{children:B.rpm.toLocaleString()})]})]})]}),B.supported_openai_params&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Supported OpenAI Parameters"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:B.supported_openai_params.map(e=>(0,a.jsx)(r.Ct,{color:"green",children:e},e))})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Usage Example"}),(0,a.jsx)(o.Z,{language:"python",className:"text-sm",children:'import openai\n\nclient = openai.OpenAI(\n api_key="your_api_key",\n base_url="http://0.0.0.0:4000" # Your LiteLLM Proxy URL\n)\n\nresponse = client.chat.completions.create(\n model="'.concat(B.model_group,'",\n messages=[\n {\n "role": "user",\n "content": "Hello, how are you?"\n }\n ]\n)\n\nprint(response.choices[0].message.content)')})]})]})}),(0,a.jsx)(n.Z,{title:(null==el?void 0:el.name)||"Agent Details",width:1e3,visible:et,footer:null,onOk:e_,onCancel:ek,children:el&&(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Agent Overview"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Name:"}),(0,a.jsx)(r.xv,{children:el.name})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Version:"}),(0,a.jsxs)(r.Ct,{color:"blue",children:["v",el.version]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Protocol Version:"}),(0,a.jsx)(r.xv,{children:el.protocolVersion})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"URL:"}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(r.xv,{className:"truncate",children:el.url}),(0,a.jsx)(t.Z,{onClick:()=>ew(el.url),className:"cursor-pointer text-gray-500 hover:text-blue-500"})]})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Description:"}),(0,a.jsx)(r.xv,{className:"mt-1",children:el.description})]})]}),el.capabilities&&Object.keys(el.capabilities).length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Capabilities"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:Object.entries(el.capabilities).filter(e=>{let[s,l]=e;return!0===l}).map(e=>{let[s]=e;return(0,a.jsx)(r.Ct,{color:"green",children:s},s)})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Input/Output Modes"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Input Modes:"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:(null===(v=el.defaultInputModes)||void 0===v?void 0:v.map(e=>(0,a.jsx)(r.Ct,{color:"blue",children:e},e)))||(0,a.jsx)(r.xv,{children:"Not specified"})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Output Modes:"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:(null===(b=el.defaultOutputModes)||void 0===b?void 0:b.map(e=>(0,a.jsx)(r.Ct,{color:"purple",children:e},e)))||(0,a.jsx)(r.xv,{children:"Not specified"})})]})]})]}),el.skills&&el.skills.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Skills"}),(0,a.jsx)("div",{className:"space-y-4",children:el.skills.map(e=>(0,a.jsxs)("div",{className:"border border-gray-200 rounded p-4",children:[(0,a.jsxs)("div",{className:"flex justify-between items-start mb-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium text-base",children:e.name}),(0,a.jsxs)(r.xv,{className:"text-xs text-gray-500",children:["ID: ",e.id]})]}),e.tags&&e.tags.length>0&&(0,a.jsx)("div",{className:"flex flex-wrap gap-1",children:e.tags.map(e=>(0,a.jsx)(r.Ct,{color:"purple",size:"xs",children:e},e))})]}),(0,a.jsx)(r.xv,{className:"text-sm mb-2",children:e.description}),e.examples&&e.examples.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-xs font-medium text-gray-700",children:"Examples:"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:e.examples.map((e,s)=>(0,a.jsx)(r.Ct,{color:"gray",size:"xs",children:e},s))})]})]},e.id))})]}),el.supportsAuthenticatedExtendedCard&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Additional Features"}),(0,a.jsx)(r.Ct,{color:"green",children:"Supports Authenticated Extended Card"})]})]})}),(0,a.jsx)(n.Z,{title:(null==eo?void 0:eo.server_name)||"MCP Server Details",width:1e3,visible:em,footer:null,onOk:e_,onCancel:ek,children:eo&&(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Server Overview"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Server Name:"}),(0,a.jsx)(r.xv,{children:eo.server_name})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Server ID:"}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(r.xv,{className:"text-xs truncate",children:eo.server_id}),(0,a.jsx)(t.Z,{onClick:()=>ew(eo.server_id),className:"cursor-pointer text-gray-500 hover:text-blue-500"})]})]}),eo.alias&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Alias:"}),(0,a.jsx)(r.xv,{children:eo.alias})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Transport:"}),(0,a.jsx)(r.Ct,{color:"blue",children:eo.transport})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Auth Type:"}),(0,a.jsx)(r.Ct,{color:"none"===eo.auth_type?"gray":"green",children:eo.auth_type})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Status:"}),(0,a.jsx)(r.Ct,{color:"active"===eo.status||"healthy"===eo.status?"green":"inactive"===eo.status||"unhealthy"===eo.status?"red":"gray",children:eo.status||"unknown"})]})]}),eo.description&&(0,a.jsxs)("div",{className:"mt-2",children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Description:"}),(0,a.jsx)(r.xv,{className:"mt-1",children:eo.description})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Connection Details"}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"URL:"}),(0,a.jsxs)("div",{className:"flex items-center space-x-2 mt-1",children:[(0,a.jsx)(r.xv,{className:"text-sm break-all bg-gray-100 p-2 rounded flex-1",children:eo.url}),(0,a.jsx)(t.Z,{onClick:()=>ew(eo.url),className:"cursor-pointer text-gray-500 hover:text-blue-500 flex-shrink-0"})]})]}),eo.command&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Command:"}),(0,a.jsx)(r.xv,{className:"text-sm bg-gray-100 p-2 rounded mt-1 font-mono",children:eo.command})]})]})]}),eo.allowed_tools&&eo.allowed_tools.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Allowed Tools"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:eo.allowed_tools.map((e,s)=>(0,a.jsx)(r.Ct,{color:"purple",children:e},s))})]}),eo.teams&&eo.teams.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Teams"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:eo.teams.map((e,s)=>(0,a.jsx)(r.Ct,{color:"blue",children:e},s))})]}),eo.mcp_access_groups&&eo.mcp_access_groups.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Access Groups"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:eo.mcp_access_groups.map((e,s)=>(0,a.jsx)(r.Ct,{color:"green",children:e},s))})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Metadata"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Created By:"}),(0,a.jsx)(r.xv,{children:eo.created_by})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Updated By:"}),(0,a.jsx)(r.xv,{children:eo.updated_by})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Created At:"}),(0,a.jsx)(r.xv,{className:"text-sm",children:new Date(eo.created_at).toLocaleString()})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Updated At:"}),(0,a.jsx)(r.xv,{className:"text-sm",children:new Date(eo.updated_at).toLocaleString()})]}),eo.last_health_check&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Last Health Check:"}),(0,a.jsx)(r.xv,{className:"text-sm",children:new Date(eo.last_health_check).toLocaleString()})]})]}),eo.health_check_error&&(0,a.jsxs)("div",{className:"mt-2 p-2 bg-red-50 rounded",children:[(0,a.jsx)(r.xv,{className:"font-medium text-red-700",children:"Health Check Error:"}),(0,a.jsx)(r.xv,{className:"text-sm text-red-600 mt-1",children:eo.health_check_error})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Usage Example"}),(0,a.jsx)(o.Z,{language:"python",className:"text-sm",children:'from fastmcp import Client\nimport asyncio\n\n# Standard MCP configuration\nconfig = {\n "mcpServers": {\n "'.concat(eo.server_name,'": {\n "url": "http://localhost:4000/').concat(eo.server_name,'/mcp",\n "headers": {\n "x-litellm-api-key": "Bearer sk-1234"\n }\n }\n }\n}\n\n# Create a client that connects to the server\nclient = Client(config)\n\nasync def main():\n async with client:\n # List available tools\n tools = await client.list_tools()\n print(f"Available tools: {[tool.name for tool in tools]}")\n\n # Call a tool\n response = await client.call_tool(\n name="tool_name", \n arguments={"arg": "value"}\n )\n print(f"Response: {response}")\n\nif __name__ == "__main__":\n asyncio.run(main())')})]})]})}),(0,a.jsx)(A,{visible:q,onClose:()=>G(!1),accessToken:N||"",modelHubData:z||[],onSuccess:()=>{N&&(async()=>{try{let e=await (0,_.modelHubCall)(N);L(e.data)}catch(e){console.error("Error refreshing model data:",e)}})()}}),(0,a.jsx)(Z,{visible:Q,onClose:()=>X(!1),accessToken:N||"",agentHubData:J||[],onSuccess:()=>{N&&(async()=>{try{let e=(await (0,_.getAgentsList)(N)).agents.map(e=>({agent_id:e.agent_id,...e.agent_card_params,is_public:e.is_public}));$(e)}catch(e){console.error("Error refreshing agent data:",e)}})()}}),(0,a.jsx)(S,{visible:eu,onClose:()=>ep(!1),accessToken:N||"",mcpHubData:en||[],onSuccess:()=>{N&&(async()=>{try{let e=await (0,_.fetchMCPServers)(N);ei(e)}catch(e){console.error("Error refreshing MCP server data:",e)}})()}})]})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/2249-985208cb7064c804.js b/litellm/proxy/_experimental/out/_next/static/chunks/2249-985208cb7064c804.js new file mode 100644 index 0000000000..e255730d8c --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/2249-985208cb7064c804.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2249],{64748:function(e,s,l){l.d(s,{Ct:function(){return a.Z},Dx:function(){return m.Z},OK:function(){return n.Z},Zb:function(){return r.Z},nP:function(){return o.Z},td:function(){return c.Z},v0:function(){return i.Z},x4:function(){return d.Z},xv:function(){return x.Z},zx:function(){return t.Z}});var a=l(41649),t=l(78489),r=l(12514),n=l(12485),i=l(18135),c=l(35242),d=l(29706),o=l(77991),x=l(84264),m=l(96761)},78801:function(e,s,l){l.d(s,{Z:function(){return a.Z},x:function(){return t.Z}});var a=l(12514),t=l(84264)},92249:function(e,s,l){l.d(s,{Z:function(){return W}});var a=l(57437),t=l(23639),r=l(64748),n=l(22116),i=l(78867),c=l(99376),d=l(2265),o=l(17906),x=l(20347),m=l(41649),h=l(78489),u=l(84264),p=l(99981),g=l(3810),j=l(15424),v=l(15690),b=l(10032),N=l(61994),f=l(5545),y=l(96761),_=l(19250),k=l(9114);let{Step:w}=v.default;var Z=e=>{let{visible:s,onClose:l,accessToken:t,agentHubData:r,onSuccess:i}=e,[c,o]=(0,d.useState)(0),[x,h]=(0,d.useState)(new Set),[p,g]=(0,d.useState)(!1),[j]=b.Z.useForm(),Z=()=>{o(0),h(new Set),j.resetFields(),l()},C=(e,s)=>{let l=new Set(x);s?l.add(e):l.delete(e),h(l)},S=e=>{e?h(new Set(r.map(e=>e.agent_id||e.name))):h(new Set)};(0,d.useEffect)(()=>{s&&r.length>0&&h(new Set(r.filter(e=>!0===e.is_public).map(e=>e.agent_id||e.name)))},[s,r]);let P=async()=>{if(0===x.size){k.Z.fromBackend("Please select at least one agent to make public");return}g(!0);try{let e=Array.from(x);await (0,_.makeAgentsPublicCall)(t,e),k.Z.success("Successfully made ".concat(e.length," agent(s) public!")),Z(),i()}catch(e){console.error("Error making agents public:",e),k.Z.fromBackend("Failed to make agents public. Please try again.")}finally{g(!1)}},M=()=>{let e=r.length>0&&r.every(e=>x.has(e.agent_id||e.name)),s=x.size>0&&!e;return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)(y.Z,{children:"Select Agents to Make Public"}),(0,a.jsx)("div",{className:"flex items-center space-x-2",children:(0,a.jsxs)(N.Z,{checked:e,indeterminate:s,onChange:e=>S(e.target.checked),disabled:0===r.length,children:["Select All ",r.length>0&&"(".concat(r.length,")")]})})]}),(0,a.jsx)(u.Z,{className:"text-sm text-gray-600",children:"Select the agents you want to be visible on the public model hub. Users will still require a valid Virtual Key to use these agents."}),(0,a.jsx)("div",{className:"max-h-96 overflow-y-auto border rounded-lg p-4",children:(0,a.jsx)("div",{className:"space-y-3",children:0===r.length?(0,a.jsx)("div",{className:"text-center py-8 text-gray-500",children:(0,a.jsx)(u.Z,{children:"No agents available."})}):r.map(e=>{let s=e.agent_id||e.name;return(0,a.jsxs)("div",{className:"flex items-center space-x-3 p-3 border rounded-lg hover:bg-gray-50",children:[(0,a.jsx)(N.Z,{checked:x.has(s),onChange:e=>C(s,e.target.checked)}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:e.name}),(0,a.jsxs)(m.Z,{color:"blue",size:"sm",children:["v",e.version]})]}),(0,a.jsx)(u.Z,{className:"text-xs text-gray-600 mt-1",children:e.description}),e.skills&&e.skills.length>0&&(0,a.jsxs)("div",{className:"flex flex-wrap gap-1 mt-1",children:[e.skills.slice(0,3).map(e=>(0,a.jsx)(m.Z,{color:"purple",size:"xs",children:e.name},e.id)),e.skills.length>3&&(0,a.jsxs)(u.Z,{className:"text-xs text-gray-500",children:["+",e.skills.length-3," more"]})]})]})]},s)})})}),x.size>0&&(0,a.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,a.jsxs)(u.Z,{className:"text-sm text-blue-800",children:[(0,a.jsx)("strong",{children:x.size})," agent",1!==x.size?"s":""," selected"]})})]})},z=()=>(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(y.Z,{children:"Confirm Making Agents Public"}),(0,a.jsx)("div",{className:"bg-yellow-50 border border-yellow-200 rounded-lg p-4",children:(0,a.jsxs)(u.Z,{className:"text-sm text-yellow-800",children:[(0,a.jsx)("strong",{children:"Warning:"})," Once you make these agents public, anyone who can go to the"," ",(0,a.jsx)("code",{children:"/ui/model_hub_table"})," will be able to know they exist on the proxy."]})}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:"Agents to be made public:"}),(0,a.jsx)("div",{className:"max-h-48 overflow-y-auto border rounded-lg p-3",children:(0,a.jsx)("div",{className:"space-y-2",children:Array.from(x).map(e=>{let s=r.find(s=>(s.agent_id||s.name)===e);return(0,a.jsx)("div",{className:"flex items-center justify-between p-2 bg-gray-50 rounded",children:(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:(null==s?void 0:s.name)||e}),s&&(0,a.jsxs)(m.Z,{color:"blue",size:"xs",children:["v",s.version]})]}),(null==s?void 0:s.description)&&(0,a.jsx)(u.Z,{className:"text-xs text-gray-600 mt-1",children:s.description})]})},e)})})})]}),(0,a.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,a.jsxs)(u.Z,{className:"text-sm text-blue-800",children:["Total: ",(0,a.jsx)("strong",{children:x.size})," agent",1!==x.size?"s":""," will be made public"]})})]});return(0,a.jsx)(n.Z,{title:"Make Agents Public",open:s,onCancel:Z,footer:null,width:1200,maskClosable:!1,children:(0,a.jsxs)(b.Z,{form:j,layout:"vertical",children:[(0,a.jsxs)(v.default,{current:c,className:"mb-6",children:[(0,a.jsx)(w,{title:"Select Agents"}),(0,a.jsx)(w,{title:"Confirm"})]}),(()=>{switch(c){case 0:return M();case 1:return z();default:return null}})(),(0,a.jsxs)("div",{className:"flex justify-between mt-6",children:[(0,a.jsx)(f.ZP,{onClick:0===c?Z:()=>{1===c&&o(0)},children:0===c?"Cancel":"Previous"}),(0,a.jsxs)("div",{className:"flex space-x-2",children:[0===c&&(0,a.jsx)(f.ZP,{onClick:()=>{if(0===c){if(0===x.size){k.Z.fromBackend("Please select at least one agent to make public");return}o(1)}},disabled:0===x.size,children:"Next"}),1===c&&(0,a.jsx)(f.ZP,{onClick:P,loading:p,children:"Make Public"})]})]})]})})};let{Step:C}=v.default;var S=e=>{let{visible:s,onClose:l,accessToken:t,mcpHubData:r,onSuccess:i}=e,[c,o]=(0,d.useState)(0),[x,h]=(0,d.useState)(new Set),[p,g]=(0,d.useState)(!1),[j]=b.Z.useForm(),w=()=>{o(0),h(new Set),j.resetFields(),l()},Z=(e,s)=>{let l=new Set(x);s?l.add(e):l.delete(e),h(l)},S=e=>{e?h(new Set(r.map(e=>e.server_id))):h(new Set)};(0,d.useEffect)(()=>{s&&r.length>0&&h(new Set(r.filter(e=>{var s;return(null===(s=e.mcp_info)||void 0===s?void 0:s.is_public)===!0}).map(e=>e.server_id)))},[s]);let P=async()=>{if(0===x.size){k.Z.fromBackend("Please select at least one MCP server to make public");return}g(!0);try{let e=Array.from(x);await (0,_.makeMCPPublicCall)(t,e),k.Z.success("Successfully made ".concat(e.length," MCP server(s) public!")),w(),i()}catch(e){console.error("Error making MCP servers public:",e),k.Z.fromBackend("Failed to make MCP servers public. Please try again.")}finally{g(!1)}},M=()=>{let e=r.length>0&&r.every(e=>x.has(e.server_id)),s=x.size>0&&!e;return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)(y.Z,{children:"Select MCP Servers to Make Public"}),(0,a.jsx)("div",{className:"flex items-center space-x-2",children:(0,a.jsxs)(N.Z,{checked:e,indeterminate:s,onChange:e=>S(e.target.checked),disabled:0===r.length,children:["Select All ",r.length>0&&"(".concat(r.length,")")]})})]}),(0,a.jsx)(u.Z,{className:"text-sm text-gray-600",children:"Select the MCP servers you want to be visible on the public model hub. Users will still require a valid Virtual Key to use these servers."}),(0,a.jsx)("div",{className:"max-h-96 overflow-y-auto border rounded-lg p-4",children:(0,a.jsx)("div",{className:"space-y-3",children:0===r.length?(0,a.jsx)("div",{className:"text-center py-8 text-gray-500",children:(0,a.jsx)(u.Z,{children:"No MCP servers available."})}):r.map(e=>{var s;let l=(null===(s=e.mcp_info)||void 0===s?void 0:s.is_public)===!0;return(0,a.jsxs)("div",{className:"flex items-center space-x-3 p-3 border rounded-lg hover:bg-gray-50",children:[(0,a.jsx)(N.Z,{checked:x.has(e.server_id),onChange:s=>Z(e.server_id,s.target.checked)}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:e.server_name}),l&&(0,a.jsx)(m.Z,{color:"emerald",size:"sm",children:"Public"}),(0,a.jsx)(m.Z,{color:"blue",size:"sm",children:e.transport}),(0,a.jsx)(m.Z,{color:"active"===e.status||"healthy"===e.status?"green":"inactive"===e.status||"unhealthy"===e.status?"red":"gray",size:"sm",children:e.status||"unknown"})]}),(0,a.jsx)(u.Z,{className:"text-xs text-gray-600 mt-1",children:e.description||e.url}),e.allowed_tools&&e.allowed_tools.length>0&&(0,a.jsxs)("div",{className:"flex flex-wrap gap-1 mt-1",children:[e.allowed_tools.slice(0,3).map((e,s)=>(0,a.jsx)(m.Z,{color:"purple",size:"xs",children:e},s)),e.allowed_tools.length>3&&(0,a.jsxs)(u.Z,{className:"text-xs text-gray-500",children:["+",e.allowed_tools.length-3," more"]})]})]})]},e.server_id)})})}),x.size>0&&(0,a.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,a.jsxs)(u.Z,{className:"text-sm text-blue-800",children:[(0,a.jsx)("strong",{children:x.size})," MCP server",1!==x.size?"s":""," selected"]})})]})},z=()=>(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(y.Z,{children:"Confirm Making MCP Servers Public"}),(0,a.jsx)("div",{className:"bg-yellow-50 border border-yellow-200 rounded-lg p-4",children:(0,a.jsxs)(u.Z,{className:"text-sm text-yellow-800",children:[(0,a.jsx)("strong",{children:"Warning:"})," Once you make these MCP servers public, anyone who can go to the"," ",(0,a.jsx)("code",{children:"/ui/model_hub_table"})," will be able to know they exist on the proxy."]})}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:"MCP Servers to be made public:"}),(0,a.jsx)("div",{className:"max-h-48 overflow-y-auto border rounded-lg p-3",children:(0,a.jsx)("div",{className:"space-y-2",children:Array.from(x).map(e=>{let s=r.find(s=>s.server_id===e);return(0,a.jsx)("div",{className:"flex items-center justify-between p-2 bg-gray-50 rounded",children:(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:(null==s?void 0:s.server_name)||e}),s&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(m.Z,{color:"blue",size:"xs",children:s.transport}),(0,a.jsx)(m.Z,{color:"active"===s.status||"healthy"===s.status?"green":"inactive"===s.status||"unhealthy"===s.status?"red":"gray",size:"xs",children:s.status||"unknown"})]})]}),(null==s?void 0:s.description)&&(0,a.jsx)(u.Z,{className:"text-xs text-gray-600 mt-1",children:s.description}),(null==s?void 0:s.url)&&(0,a.jsx)(u.Z,{className:"text-xs text-gray-500 mt-1",children:s.url})]})},e)})})})]}),(0,a.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,a.jsxs)(u.Z,{className:"text-sm text-blue-800",children:["Total: ",(0,a.jsx)("strong",{children:x.size})," MCP server",1!==x.size?"s":""," will be made public"]})})]});return(0,a.jsx)(n.Z,{title:"Make MCP Servers Public",open:s,onCancel:w,footer:null,width:1200,maskClosable:!1,children:(0,a.jsxs)(b.Z,{form:j,layout:"vertical",children:[(0,a.jsxs)(v.default,{current:c,className:"mb-6",children:[(0,a.jsx)(C,{title:"Select Servers"}),(0,a.jsx)(C,{title:"Confirm"})]}),(()=>{switch(c){case 0:return M();case 1:return z();default:return null}})(),(0,a.jsxs)("div",{className:"flex justify-between mt-6",children:[(0,a.jsx)(f.ZP,{onClick:0===c?w:()=>{1===c&&o(0)},children:0===c?"Cancel":"Previous"}),(0,a.jsxs)("div",{className:"flex space-x-2",children:[0===c&&(0,a.jsx)(f.ZP,{onClick:()=>{if(0===c){if(0===x.size){k.Z.fromBackend("Please select at least one MCP server to make public");return}o(1)}},disabled:0===x.size,children:"Next"}),1===c&&(0,a.jsx)(f.ZP,{onClick:P,loading:p,children:"Make Public"})]})]})]})})},P=l(78801),M=e=>{let{modelHubData:s,onFilteredDataChange:l,showFiltersCard:t=!0,className:r=""}=e,[n,i]=(0,d.useState)(""),[c,o]=(0,d.useState)(""),[x,m]=(0,d.useState)(""),[h,u]=(0,d.useState)(""),p=(0,d.useRef)([]),g=(0,d.useMemo)(()=>(null==s?void 0:s.filter(e=>{let s=e.model_group.toLowerCase().includes(n.toLowerCase()),l=""===c||e.providers.includes(c),a=""===x||e.mode===x,t=""===h||Object.entries(e).filter(e=>{let[s,l]=e;return s.startsWith("supports_")&&!0===l}).some(e=>{let[s]=e;return s.replace(/^supports_/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")===h});return s&&l&&a&&t}))||[],[s,n,c,x,h]);(0,d.useEffect)(()=>{(g.length!==p.current.length||g.some((e,s)=>{var l;return e.model_group!==(null===(l=p.current[s])||void 0===l?void 0:l.model_group)}))&&(p.current=g,l(g))},[g,l]);let j=(0,a.jsxs)("div",{className:"flex flex-wrap gap-4 items-center",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(P.x,{className:"text-sm font-medium mb-2",children:"Search Models:"}),(0,a.jsx)("input",{type:"text",placeholder:"Search model names...",value:n,onChange:e=>i(e.target.value),className:"border rounded px-3 py-2 w-64 h-10 text-sm"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(P.x,{className:"text-sm font-medium mb-2",children:"Provider:"}),(0,a.jsxs)("select",{value:c,onChange:e=>o(e.target.value),className:"border rounded px-3 py-2 text-sm text-gray-600 w-40 h-10",children:[(0,a.jsx)("option",{value:"",className:"text-sm text-gray-600",children:"All Providers"}),s&&(e=>{let s=new Set;return e.forEach(e=>{e.providers.forEach(e=>s.add(e))}),Array.from(s)})(s).map(e=>(0,a.jsx)("option",{value:e,className:"text-sm text-gray-800",children:e},e))]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(P.x,{className:"text-sm font-medium mb-2",children:"Mode:"}),(0,a.jsxs)("select",{value:x,onChange:e=>m(e.target.value),className:"border rounded px-3 py-2 text-sm text-gray-600 w-32 h-10",children:[(0,a.jsx)("option",{value:"",className:"text-sm text-gray-600",children:"All Modes"}),s&&(e=>{let s=new Set;return e.forEach(e=>{e.mode&&s.add(e.mode)}),Array.from(s)})(s).map(e=>(0,a.jsx)("option",{value:e,className:"text-sm text-gray-800",children:e},e))]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(P.x,{className:"text-sm font-medium mb-2",children:"Features:"}),(0,a.jsxs)("select",{value:h,onChange:e=>u(e.target.value),className:"border rounded px-3 py-2 text-sm text-gray-600 w-48 h-10",children:[(0,a.jsx)("option",{value:"",className:"text-sm text-gray-600",children:"All Features"}),s&&(e=>{let s=new Set;return e.forEach(e=>{Object.entries(e).filter(e=>{let[s,l]=e;return s.startsWith("supports_")&&!0===l}).forEach(e=>{let[l]=e,a=l.replace(/^supports_/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ");s.add(a)})}),Array.from(s).sort()})(s).map(e=>(0,a.jsx)("option",{value:e,className:"text-sm text-gray-800",children:e},e))]})]}),(n||c||x||h)&&(0,a.jsx)("div",{className:"flex items-end",children:(0,a.jsx)("button",{onClick:()=>{i(""),o(""),m(""),u("")},className:"text-blue-600 hover:text-blue-800 text-sm underline h-10 flex items-center",children:"Clear Filters"})})]});return t?(0,a.jsx)(P.Z,{className:"mb-6 ".concat(r),children:j}):(0,a.jsx)("div",{className:r,children:j})};let{Step:z}=v.default;var A=e=>{let{visible:s,onClose:l,accessToken:t,modelHubData:r,onSuccess:i}=e,[c,o]=(0,d.useState)(0),[x,h]=(0,d.useState)(new Set),[p,g]=(0,d.useState)([]),[j,w]=(0,d.useState)(!1),[Z]=b.Z.useForm(),C=()=>{o(0),h(new Set),g([]),Z.resetFields(),l()},S=(e,s)=>{let l=new Set(x);s?l.add(e):l.delete(e),h(l)},P=e=>{e?h(new Set(p.map(e=>e.model_group))):h(new Set)},A=(0,d.useCallback)(e=>{g(e)},[]);(0,d.useEffect)(()=>{s&&r.length>0&&(g(r),h(new Set(r.filter(e=>!0===e.is_public_model_group).map(e=>e.model_group))))},[s,r]);let F=async()=>{if(0===x.size){k.Z.fromBackend("Please select at least one model to make public");return}w(!0);try{let e=Array.from(x);await (0,_.makeModelGroupPublic)(t,e),k.Z.success("Successfully made ".concat(e.length," model group(s) public!")),C(),i()}catch(e){console.error("Error making model groups public:",e),k.Z.fromBackend("Failed to make model groups public. Please try again.")}finally{w(!1)}},L=()=>{let e=p.length>0&&p.every(e=>x.has(e.model_group)),s=x.size>0&&!e;return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)(y.Z,{children:"Select Models to Make Public"}),(0,a.jsx)("div",{className:"flex items-center space-x-2",children:(0,a.jsxs)(N.Z,{checked:e,indeterminate:s,onChange:e=>P(e.target.checked),disabled:0===p.length,children:["Select All ",p.length>0&&"(".concat(p.length,")")]})})]}),(0,a.jsx)(u.Z,{className:"text-sm text-gray-600",children:"Select the models you want to be visible on the public model hub. Users will still require a valid Virtual Key to use these models."}),(0,a.jsx)(M,{modelHubData:r,onFilteredDataChange:A,showFiltersCard:!1,className:"border rounded-lg p-4 bg-gray-50"}),(0,a.jsx)("div",{className:"max-h-96 overflow-y-auto border rounded-lg p-4",children:(0,a.jsx)("div",{className:"space-y-3",children:0===p.length?(0,a.jsx)("div",{className:"text-center py-8 text-gray-500",children:(0,a.jsx)(u.Z,{children:"No models match the current filters."})}):p.map(e=>(0,a.jsxs)("div",{className:"flex items-center space-x-3 p-3 border rounded-lg hover:bg-gray-50",children:[(0,a.jsx)(N.Z,{checked:x.has(e.model_group),onChange:s=>S(e.model_group,s.target.checked)}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:e.model_group}),e.mode&&(0,a.jsx)(m.Z,{color:"green",size:"sm",children:e.mode})]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:e.providers.map(e=>(0,a.jsx)(m.Z,{color:"blue",size:"xs",children:e},e))})]})]},e.model_group))})}),x.size>0&&(0,a.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,a.jsxs)(u.Z,{className:"text-sm text-blue-800",children:[(0,a.jsx)("strong",{children:x.size})," model",1!==x.size?"s":""," selected"]})})]})},D=()=>(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(y.Z,{children:"Confirm Making Models Public"}),(0,a.jsx)("div",{className:"bg-yellow-50 border border-yellow-200 rounded-lg p-4",children:(0,a.jsxs)(u.Z,{className:"text-sm text-yellow-800",children:[(0,a.jsx)("strong",{children:"Warning:"})," Once you make these models public, anyone who can go to the"," ",(0,a.jsx)("code",{children:"/ui/model_hub_table"})," will be able to know they exist on the proxy."]})}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:"Models to be made public:"}),(0,a.jsx)("div",{className:"max-h-48 overflow-y-auto border rounded-lg p-3",children:(0,a.jsx)("div",{className:"space-y-2",children:Array.from(x).map(e=>{let s=r.find(s=>s.model_group===e);return(0,a.jsx)("div",{className:"flex items-center justify-between p-2 bg-gray-50 rounded",children:(0,a.jsxs)("div",{children:[(0,a.jsx)(u.Z,{className:"font-medium",children:e}),s&&(0,a.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:s.providers.map(e=>(0,a.jsx)(m.Z,{color:"blue",size:"xs",children:e},e))})]})},e)})})})]}),(0,a.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,a.jsxs)(u.Z,{className:"text-sm text-blue-800",children:["Total: ",(0,a.jsx)("strong",{children:x.size})," model",1!==x.size?"s":""," will be made public"]})})]});return(0,a.jsx)(n.Z,{title:"Make Models Public",open:s,onCancel:C,footer:null,width:1200,maskClosable:!1,children:(0,a.jsxs)(b.Z,{form:Z,layout:"vertical",children:[(0,a.jsxs)(v.default,{current:c,className:"mb-6",children:[(0,a.jsx)(z,{title:"Select Models"}),(0,a.jsx)(z,{title:"Confirm"})]}),(()=>{switch(c){case 0:return L();case 1:return D();default:return null}})(),(0,a.jsxs)("div",{className:"flex justify-between mt-6",children:[(0,a.jsx)(f.ZP,{onClick:0===c?C:()=>{1===c&&o(0)},children:0===c?"Cancel":"Previous"}),(0,a.jsxs)("div",{className:"flex space-x-2",children:[0===c&&(0,a.jsx)(f.ZP,{onClick:()=>{if(0===c){if(0===x.size){k.Z.fromBackend("Please select at least one model to make public");return}o(1)}},disabled:0===x.size,children:"Next"}),1===c&&(0,a.jsx)(f.ZP,{onClick:F,loading:j,children:"Make Public"})]})]})]})})},F=l(8048);let L=e=>e.replace(/^supports_/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "),D=e=>Object.entries(e).filter(e=>{let[s,l]=e;return s.startsWith("supports_")&&!0===l}).map(e=>{let[s]=e;return s}),O=e=>"$".concat((1e6*e).toFixed(2)),K=e=>e>=1e6?"".concat((e/1e6).toFixed(1),"M"):e>=1e3?"".concat((e/1e3).toFixed(1),"K"):e.toString(),U=function(e,s){let l=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=[{header:"Public Model Name",accessorKey:"model_group",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:l}=e,r=l.original;return(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium text-sm",children:r.model_group}),(0,a.jsx)(p.Z,{title:"Copy model name",children:(0,a.jsx)(t.Z,{onClick:()=>s(r.model_group),className:"cursor-pointer text-gray-500 hover:text-blue-500 text-xs"})})]}),(0,a.jsx)("div",{className:"md:hidden",children:(0,a.jsx)(u.Z,{className:"text-xs text-gray-600",children:r.providers.join(", ")})})]})}},{header:"Provider",accessorKey:"providers",enableSorting:!0,sortingFn:(e,s)=>{let l=e.original.providers.join(", "),a=s.original.providers.join(", ");return l.localeCompare(a)},cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsxs)("div",{className:"flex flex-wrap gap-1",children:[l.providers.slice(0,2).map(e=>(0,a.jsx)(g.Z,{color:"blue",className:"text-xs",children:e},e)),l.providers.length>2&&(0,a.jsxs)(u.Z,{className:"text-xs text-gray-500",children:["+",l.providers.length-2]})]})},meta:{className:"hidden md:table-cell"}},{header:"Mode",accessorKey:"mode",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return l.mode?(0,a.jsx)(m.Z,{color:"green",size:"sm",children:l.mode}):(0,a.jsx)(u.Z,{className:"text-gray-500",children:"-"})},meta:{className:"hidden lg:table-cell"}},{header:"Tokens",accessorKey:"max_input_tokens",enableSorting:!0,sortingFn:(e,s)=>(e.original.max_input_tokens||0)+(e.original.max_output_tokens||0)-((s.original.max_input_tokens||0)+(s.original.max_output_tokens||0)),cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsx)("div",{className:"space-y-1",children:(0,a.jsxs)(u.Z,{className:"text-xs",children:[l.max_input_tokens?K(l.max_input_tokens):"-"," /"," ",l.max_output_tokens?K(l.max_output_tokens):"-"]})})},meta:{className:"hidden lg:table-cell"}},{header:"Cost/1M",accessorKey:"input_cost_per_token",enableSorting:!0,sortingFn:(e,s)=>(e.original.input_cost_per_token||0)+(e.original.output_cost_per_token||0)-((s.original.input_cost_per_token||0)+(s.original.output_cost_per_token||0)),cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)(u.Z,{className:"text-xs",children:l.input_cost_per_token?O(l.input_cost_per_token):"-"}),(0,a.jsx)(u.Z,{className:"text-xs text-gray-500",children:l.output_cost_per_token?O(l.output_cost_per_token):"-"})]})}},{header:"Features",accessorKey:"capabilities",enableSorting:!1,cell:e=>{let{row:s}=e,l=D(s.original),t=["green","blue","purple","orange","red","yellow"];return(0,a.jsx)("div",{className:"flex flex-wrap gap-1",children:0===l.length?(0,a.jsx)(u.Z,{className:"text-gray-500 text-xs",children:"-"}):l.map((e,s)=>(0,a.jsx)(m.Z,{color:t[s%t.length],size:"xs",children:L(e)},e))})}},{header:"Public",accessorKey:"is_public_model_group",enableSorting:!0,sortingFn:(e,s)=>(!0===e.original.is_public_model_group?1:0)-(!0===s.original.is_public_model_group?1:0),cell:e=>{let{row:s}=e;return!0===s.original.is_public_model_group?(0,a.jsx)(m.Z,{color:"green",size:"xs",children:"Yes"}):(0,a.jsx)(m.Z,{color:"gray",size:"xs",children:"No"})},meta:{className:"hidden md:table-cell"}},{header:"Details",id:"details",enableSorting:!1,cell:s=>{let{row:l}=s,t=l.original;return(0,a.jsxs)(h.Z,{size:"xs",variant:"secondary",onClick:()=>e(t),icon:j.Z,children:[(0,a.jsx)("span",{className:"hidden lg:inline",children:"Details"}),(0,a.jsx)("span",{className:"lg:hidden",children:"Info"})]})}}];return l?r.filter(e=>!("accessorKey"in e)||"is_public_model_group"!==e.accessorKey):r};var E=l(87526),T=l(86462),H=l(47686),R=l(77355),B=l(93416),I=l(74998),Y=l(95704),V=e=>{let{accessToken:s,userRole:l}=e,[t,r]=(0,d.useState)([]),[i,c]=(0,d.useState)({url:"",displayName:""}),[o,m]=(0,d.useState)(null),[h,u]=(0,d.useState)(!1),[p,g]=(0,d.useState)(!0),j=async()=>{if(s)try{u(!0);let e=await (0,_.getPublicModelHubInfo)();if(e&&e.useful_links){let s=e.useful_links||{},l=Object.entries(s).map((e,s)=>{let[l,a]=e;return{id:"".concat(s,"-").concat(l),displayName:l,url:a}});r(l)}else r([])}catch(e){console.error("Error fetching useful links:",e),r([])}finally{u(!1)}};if((0,d.useEffect)(()=>{j()},[s]),!(0,x.tY)(l||""))return null;let v=async e=>{if(!s)return!1;try{let l={};return e.forEach(e=>{l[e.displayName]=e.url}),await (0,_.updateUsefulLinksCall)(s,l),n.Z.success({title:"Links Saved Successfully",content:(0,a.jsxs)("div",{className:"py-4",children:[(0,a.jsx)("p",{className:"text-gray-600 mb-4",children:"Your useful links have been saved and are now visible on the public model hub."}),(0,a.jsxs)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:[(0,a.jsx)("p",{className:"text-sm text-blue-800 mb-2 font-medium",children:"View your updated model hub:"}),(0,a.jsx)("a",{href:"".concat((0,_.getProxyBaseUrl)(),"/ui/model_hub_table"),target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center text-blue-600 hover:text-blue-800 underline text-sm font-medium",children:"Open Public Model Hub →"})]})]}),width:500,okText:"Close",maskClosable:!0,keyboard:!0}),!0}catch(e){return console.error("Error saving links:",e),k.Z.fromBackend("Failed to save links - ".concat(e)),!1}},b=async()=>{if(!i.url||!i.displayName)return;try{new URL(i.url)}catch(e){k.Z.fromBackend("Please enter a valid URL");return}if(t.some(e=>e.displayName===i.displayName)){k.Z.fromBackend("A link with this display name already exists");return}let e=[...t,{id:"".concat(Date.now(),"-").concat(i.displayName),displayName:i.displayName,url:i.url}];await v(e)&&(r(e),c({url:"",displayName:""}),k.Z.success("Link added successfully"))},N=e=>{m({...e})},f=async()=>{if(!o)return;try{new URL(o.url)}catch(e){k.Z.fromBackend("Please enter a valid URL");return}if(t.some(e=>e.id!==o.id&&e.displayName===o.displayName)){k.Z.fromBackend("A link with this display name already exists");return}let e=t.map(e=>e.id===o.id?o:e);await v(e)&&(r(e),m(null),k.Z.success("Link updated successfully"))},y=()=>{m(null)},w=async e=>{let s=t.filter(s=>s.id!==e);await v(s)&&(r(s),k.Z.success("Link deleted successfully"))},Z=e=>{window.open(e,"_blank")};return(0,a.jsxs)(Y.Zb,{className:"mb-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between cursor-pointer",onClick:()=>g(!p),children:[(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)(Y.Dx,{className:"mb-0",children:"Link Management"}),(0,a.jsx)("p",{className:"text-sm text-gray-500",children:"Manage the links that are displayed under 'Useful Links' on the public model hub."})]}),(0,a.jsx)("div",{className:"flex items-center",children:p?(0,a.jsx)(T.Z,{className:"w-5 h-5 text-gray-500"}):(0,a.jsx)(H.Z,{className:"w-5 h-5 text-gray-500"})})]}),p&&(0,a.jsxs)("div",{className:"mt-4",children:[(0,a.jsxs)("div",{className:"mb-6",children:[(0,a.jsx)(Y.xv,{className:"text-sm font-medium text-gray-700 mb-2",children:"Add New Link"}),(0,a.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"URL"}),(0,a.jsx)("input",{type:"text",value:i.url,onChange:e=>c({...i,url:e.target.value}),placeholder:"https://example.com",className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Display Name"}),(0,a.jsx)("input",{type:"text",value:i.displayName,onChange:e=>c({...i,displayName:e.target.value}),placeholder:"Friendly name",className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm"})]}),(0,a.jsx)("div",{className:"flex items-end",children:(0,a.jsxs)("button",{onClick:b,disabled:!i.url||!i.displayName,className:"flex items-center px-4 py-2 rounded-md text-sm ".concat(i.url&&i.displayName?"bg-green-600 text-white hover:bg-green-700":"bg-gray-300 text-gray-500 cursor-not-allowed"),children:[(0,a.jsx)(R.Z,{className:"w-4 h-4 mr-1"}),"Add Link"]})})]})]}),(0,a.jsx)(Y.xv,{className:"text-sm font-medium text-gray-700 mb-2",children:"Manage Existing Links"}),(0,a.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)(Y.iA,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,a.jsx)(Y.ss,{children:(0,a.jsxs)(Y.SC,{children:[(0,a.jsx)(Y.xs,{className:"py-1 h-8",children:"Display Name"}),(0,a.jsx)(Y.xs,{className:"py-1 h-8",children:"URL"}),(0,a.jsx)(Y.xs,{className:"py-1 h-8",children:"Actions"})]})}),(0,a.jsxs)(Y.RM,{children:[t.map(e=>(0,a.jsx)(Y.SC,{className:"h-8",children:o&&o.id===e.id?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(Y.pj,{className:"py-0.5",children:(0,a.jsx)("input",{type:"text",value:o.displayName,onChange:e=>m({...o,displayName:e.target.value}),className:"w-full px-2 py-1 border border-gray-300 rounded-md text-sm"})}),(0,a.jsx)(Y.pj,{className:"py-0.5",children:(0,a.jsx)("input",{type:"text",value:o.url,onChange:e=>m({...o,url:e.target.value}),className:"w-full px-2 py-1 border border-gray-300 rounded-md text-sm"})}),(0,a.jsx)(Y.pj,{className:"py-0.5 whitespace-nowrap",children:(0,a.jsxs)("div",{className:"flex space-x-2",children:[(0,a.jsx)("button",{onClick:f,className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:"Save"}),(0,a.jsx)("button",{onClick:y,className:"text-xs bg-gray-50 text-gray-600 px-2 py-1 rounded hover:bg-gray-100",children:"Cancel"})]})})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(Y.pj,{className:"py-0.5 text-sm text-gray-900",children:e.displayName}),(0,a.jsx)(Y.pj,{className:"py-0.5 text-sm text-gray-500",children:e.url}),(0,a.jsx)(Y.pj,{className:"py-0.5 whitespace-nowrap",children:(0,a.jsxs)("div",{className:"flex space-x-2",children:[(0,a.jsx)("button",{onClick:()=>Z(e.url),className:"text-xs bg-green-50 text-green-600 px-2 py-1 rounded hover:bg-green-100",children:"Use"}),(0,a.jsx)("button",{onClick:()=>N(e),className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:(0,a.jsx)(B.Z,{className:"w-3 h-3"})}),(0,a.jsx)("button",{onClick:()=>w(e.id),className:"text-xs bg-red-50 text-red-600 px-2 py-1 rounded hover:bg-red-100",children:(0,a.jsx)(I.Z,{className:"w-3 h-3"})})]})})]})},e.id)),0===t.length&&(0,a.jsx)(Y.SC,{children:(0,a.jsx)(Y.pj,{colSpan:3,className:"py-0.5 text-sm text-gray-500 text-center",children:"No links added yet. Add a new link above."})})]})]})})})]})]})},W=e=>{var s,l,v,b;let{accessToken:N,publicPage:f,premiumUser:y,userRole:w}=e,[C,P]=(0,d.useState)(!1),[z,L]=(0,d.useState)(null),[D,O]=(0,d.useState)(!0),[K,T]=(0,d.useState)(!1),[H,R]=(0,d.useState)(!1),[B,I]=(0,d.useState)(null),[Y,W]=(0,d.useState)([]),[q,G]=(0,d.useState)(!1),[J,$]=(0,d.useState)(null),[Q,X]=(0,d.useState)(!1),[ee,es]=(0,d.useState)(!0),[el,ea]=(0,d.useState)(null),[et,er]=(0,d.useState)(!1),[en,ei]=(0,d.useState)(null),[ec,ed]=(0,d.useState)(!0),[eo,ex]=(0,d.useState)(null),[em,eh]=(0,d.useState)(!1),[eu,ep]=(0,d.useState)(!1),eg=(0,c.useRouter)(),ej=(0,d.useRef)(null),ev=(0,d.useRef)(null),eb=(0,d.useRef)(null);(0,d.useEffect)(()=>{let e=async e=>{try{O(!0);let s=await (0,_.modelHubCall)(e);console.log("ModelHubData:",s),L(s.data),(0,_.getConfigFieldSetting)(e,"enable_public_model_hub").then(e=>{console.log("data: ".concat(JSON.stringify(e))),!0==e.field_value&&P(!0)}).catch(e=>{})}catch(e){console.error("There was an error fetching the model data",e)}finally{O(!1)}},s=async()=>{try{var e,s;O(!0),await (0,_.getUiConfig)();let l=await (0,_.modelHubPublicModelsCall)();console.log("ModelHubData:",l),console.log("First model structure:",l[0]),console.log("Model has model_group?",null===(e=l[0])||void 0===e?void 0:e.model_group),console.log("Model has providers?",null===(s=l[0])||void 0===s?void 0:s.providers),L(l),P(!0)}catch(e){console.error("There was an error fetching the public model data",e)}finally{O(!1)}};N?e(N):f&&s()},[N,f]),(0,d.useEffect)(()=>{let e=async()=>{if(N)try{es(!0);let e=await (0,_.getAgentsList)(N);console.log("AgentHubData:",e);let s=e.agents.map(e=>({agent_id:e.agent_id,...e.agent_card_params,is_public:e.litellm_params.is_public}));$(s)}catch(e){console.error("There was an error fetching the agent data",e)}finally{es(!1)}};f||e()},[f,N]),(0,d.useEffect)(()=>{let e=async()=>{if(N)try{ed(!0);let e=await (0,_.fetchMCPServers)(N);console.log("MCPHubData:",e),ei(e)}catch(e){console.error("There was an error fetching the MCP server data",e)}finally{ed(!1)}};f||e()},[f,N]);let eN=()=>{N&&G(!0)},ef=()=>{N&&X(!0)},ey=()=>{N&&ep(!0)},e_=()=>{T(!1),R(!1),I(null),er(!1),ea(null),eh(!1),ex(null)},ek=()=>{T(!1),R(!1),I(null),er(!1),ea(null),eh(!1),ex(null)},ew=e=>{navigator.clipboard.writeText(e),k.Z.success("Copied to clipboard!")},eZ=e=>e.replace(/^supports_/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "),eC=e=>Object.entries(e).filter(e=>{let[s,l]=e;return s.startsWith("supports_")&&!0===l}).map(e=>{let[s]=e;return s}),eS=e=>"$".concat((1e6*e).toFixed(2)),eP=(0,d.useCallback)(e=>{W(e)},[]);return(console.log("publicPage: ",f),console.log("publicPageAllowed: ",C),f&&C)?(0,a.jsx)(E.Z,{accessToken:N}):(0,a.jsxs)("div",{className:"w-full mx-4 h-[75vh]",children:[!1==f?(0,a.jsxs)("div",{className:"w-full m-2 mt-2 p-8",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,a.jsxs)("div",{className:"flex flex-col items-start",children:[(0,a.jsx)(r.Dx,{className:"text-center",children:"AI Hub"}),(0,x.tY)(w||"")?(0,a.jsx)("p",{className:"text-sm text-gray-600",children:"Make models, agents, and MCP servers public for developers to know what's available."}):(0,a.jsx)("p",{className:"text-sm text-gray-600",children:"A list of all public model names personally available to you."})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,a.jsx)(r.xv,{children:"Model Hub URL:"}),(0,a.jsxs)("div",{className:"flex items-center bg-gray-200 px-2 py-1 rounded",children:[(0,a.jsx)(r.xv,{className:"mr-2",children:"".concat((0,_.getProxyBaseUrl)(),"/ui/model_hub_table")}),(0,a.jsx)("button",{onClick:()=>ew("".concat((0,_.getProxyBaseUrl)(),"/ui/model_hub_table")),className:"p-1 hover:bg-gray-300 rounded transition-colors",title:"Copy URL",children:(0,a.jsx)(i.Z,{size:16,className:"text-gray-600"})})]})]})]}),(0,x.tY)(w||"")&&(0,a.jsx)("div",{className:"mt-8 mb-2",children:(0,a.jsx)(V,{accessToken:N,userRole:w})}),(0,a.jsxs)(r.v0,{children:[(0,a.jsxs)(r.td,{className:"mb-4",children:[(0,a.jsx)(r.OK,{children:"Model Hub"}),(0,a.jsx)(r.OK,{children:"Agent Hub"}),(0,a.jsx)(r.OK,{children:"MCP Hub"})]}),(0,a.jsxs)(r.nP,{children:[(0,a.jsxs)(r.x4,{children:[(0,a.jsxs)(r.Zb,{children:[!1==f&&(0,x.tY)(w||"")&&(0,a.jsx)("div",{className:"flex justify-end mb-4",children:(0,a.jsx)(r.zx,{onClick:()=>eN(),children:"Select Models to Make Public"})}),(0,a.jsx)(M,{modelHubData:z||[],onFilteredDataChange:eP}),(0,a.jsx)(F.C,{columns:U(e=>{I(e),T(!0)},ew,f),data:Y,isLoading:D,table:ej,defaultSorting:[{id:"model_group",desc:!1}]})]}),(0,a.jsx)("div",{className:"mt-4 text-center space-y-2",children:(0,a.jsxs)(r.xv,{className:"text-sm text-gray-600",children:["Showing ",Y.length," of ",(null==z?void 0:z.length)||0," models"]})})]}),(0,a.jsxs)(r.x4,{children:[(0,a.jsxs)(r.Zb,{children:[!1==f&&(0,x.tY)(w||"")&&(0,a.jsx)("div",{className:"flex justify-end mb-4",children:(0,a.jsx)(r.zx,{onClick:()=>ef(),children:"Select Agents to Make Public"})}),(0,a.jsx)(F.C,{columns:function(e,s){return arguments.length>2&&void 0!==arguments[2]&&arguments[2],[{header:"Agent Name",accessorKey:"name",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:l}=e,r=l.original;return(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium text-sm",children:r.name}),(0,a.jsx)(p.Z,{title:"Copy agent name",children:(0,a.jsx)(t.Z,{onClick:()=>s(r.name),className:"cursor-pointer text-gray-500 hover:text-blue-500 text-xs"})})]}),(0,a.jsx)("div",{className:"md:hidden",children:(0,a.jsx)(u.Z,{className:"text-xs text-gray-600",children:r.description})})]})}},{header:"Description",accessorKey:"description",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsx)(u.Z,{className:"text-xs line-clamp-2",children:l.description||"-"})},meta:{className:"hidden md:table-cell"}},{header:"Version",accessorKey:"version",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsxs)(m.Z,{color:"blue",size:"sm",children:["v",l.version]})},meta:{className:"hidden lg:table-cell"}},{header:"Protocol",accessorKey:"protocolVersion",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsx)(u.Z,{className:"text-xs",children:l.protocolVersion||"-"})},meta:{className:"hidden lg:table-cell"}},{header:"Skills",accessorKey:"skills",enableSorting:!1,cell:e=>{let{row:s}=e,l=s.original.skills||[];return(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)(u.Z,{className:"text-xs font-medium",children:[l.length," skill",1!==l.length?"s":""]}),l.length>0&&(0,a.jsxs)("div",{className:"flex flex-wrap gap-1",children:[l.slice(0,2).map(e=>(0,a.jsx)(g.Z,{color:"purple",className:"text-xs",children:e.name},e.id)),l.length>2&&(0,a.jsxs)(u.Z,{className:"text-xs text-gray-500",children:["+",l.length-2]})]})]})}},{header:"Capabilities",accessorKey:"capabilities",enableSorting:!1,cell:e=>{let{row:s}=e,l=Object.entries(s.original.capabilities||{}).filter(e=>{let[s,l]=e;return!0===l}).map(e=>{let[s]=e;return s});return(0,a.jsx)("div",{className:"flex flex-wrap gap-1",children:0===l.length?(0,a.jsx)(u.Z,{className:"text-gray-500 text-xs",children:"-"}):l.map(e=>(0,a.jsx)(m.Z,{color:"green",size:"xs",children:e},e))})}},{header:"I/O Modes",accessorKey:"defaultInputModes",enableSorting:!1,cell:e=>{let{row:s}=e,l=s.original,t=l.defaultInputModes||[],r=l.defaultOutputModes||[];return(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)(u.Z,{className:"text-xs",children:[(0,a.jsx)("span",{className:"font-medium",children:"In:"})," ",t.join(", ")||"-"]}),(0,a.jsxs)(u.Z,{className:"text-xs",children:[(0,a.jsx)("span",{className:"font-medium",children:"Out:"})," ",r.join(", ")||"-"]})]})},meta:{className:"hidden xl:table-cell"}},{header:"Public",accessorKey:"is_public",enableSorting:!0,sortingFn:(e,s)=>(!0===e.original.is_public?1:0)-(!0===s.original.is_public?1:0),cell:e=>{let{row:s}=e;return console.log("CHECKPOINT 1: ".concat(JSON.stringify(s.original))),!0===s.original.is_public?(0,a.jsx)(m.Z,{color:"green",size:"xs",children:"Yes"}):(0,a.jsx)(m.Z,{color:"gray",size:"xs",children:"No"})},meta:{className:"hidden md:table-cell"}},{header:"Details",id:"details",enableSorting:!1,cell:s=>{let{row:l}=s,t=l.original;return(0,a.jsxs)(h.Z,{size:"xs",variant:"secondary",onClick:()=>e(t),icon:j.Z,children:[(0,a.jsx)("span",{className:"hidden lg:inline",children:"Details"}),(0,a.jsx)("span",{className:"lg:hidden",children:"Info"})]})}}]}(e=>{ea(e),er(!0)},ew,f),data:J||[],isLoading:ee,table:ev,defaultSorting:[{id:"name",desc:!1}]})]}),(0,a.jsx)("div",{className:"mt-4 text-center space-y-2",children:(0,a.jsxs)(r.xv,{className:"text-sm text-gray-600",children:["Showing ",(null==J?void 0:J.length)||0," agent",(null==J?void 0:J.length)!==1?"s":""]})})]}),(0,a.jsxs)(r.x4,{children:[(0,a.jsxs)(r.Zb,{children:[!1==f&&(0,x.tY)(w||"")&&(0,a.jsx)("div",{className:"flex justify-end mb-4",children:(0,a.jsx)(r.zx,{onClick:()=>ey(),children:"Select MCP Servers to Make Public"})}),(0,a.jsx)(F.C,{columns:function(e,s){return arguments.length>2&&void 0!==arguments[2]&&arguments[2],[{header:"Server Name",accessorKey:"server_name",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:l}=e,r=l.original;return(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium text-sm",children:r.server_name}),(0,a.jsx)(p.Z,{title:"Copy server name",children:(0,a.jsx)(t.Z,{onClick:()=>s(r.server_name),className:"cursor-pointer text-gray-500 hover:text-blue-500 text-xs"})})]}),(0,a.jsx)("div",{className:"md:hidden",children:(0,a.jsx)(u.Z,{className:"text-xs text-gray-600",children:r.description||"-"})})]})}},{header:"Description",accessorKey:"description",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsx)(u.Z,{className:"text-xs line-clamp-2",children:l.description||"-"})},meta:{className:"hidden md:table-cell"}},{header:"URL",accessorKey:"url",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:l}=e,r=l.original;return(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"text-xs truncate max-w-xs",children:r.url}),(0,a.jsx)(p.Z,{title:"Copy URL",children:(0,a.jsx)(t.Z,{onClick:()=>s(r.url),className:"cursor-pointer text-gray-500 hover:text-blue-500 text-xs flex-shrink-0"})})]})},meta:{className:"hidden lg:table-cell"}},{header:"Transport",accessorKey:"transport",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsx)(m.Z,{color:"blue",size:"sm",children:l.transport})},meta:{className:"hidden md:table-cell"}},{header:"Auth Type",accessorKey:"auth_type",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original,t="none"===l.auth_type?"gray":"green";return(0,a.jsx)(m.Z,{color:t,size:"sm",children:l.auth_type})},meta:{className:"hidden md:table-cell"}},{header:"Status",accessorKey:"status",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original,t={active:"green",inactive:"red",unknown:"gray",healthy:"green",unhealthy:"red"}[l.status]||"gray";return(0,a.jsx)(m.Z,{color:t,size:"sm",children:l.status||"unknown"})}},{header:"Tools",accessorKey:"allowed_tools",enableSorting:!1,cell:e=>{let{row:s}=e,l=s.original.allowed_tools||[];return(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)(u.Z,{className:"text-xs font-medium",children:l.length>0?"".concat(l.length," tool").concat(1!==l.length?"s":""):"All tools"}),l.length>0&&(0,a.jsxs)("div",{className:"flex flex-wrap gap-1",children:[l.slice(0,2).map((e,s)=>(0,a.jsx)(g.Z,{color:"purple",className:"text-xs",children:e},s)),l.length>2&&(0,a.jsxs)(u.Z,{className:"text-xs text-gray-500",children:["+",l.length-2]})]})]})},meta:{className:"hidden lg:table-cell"}},{header:"Created By",accessorKey:"created_by",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsx)(u.Z,{className:"text-xs",children:l.created_by||"-"})},meta:{className:"hidden xl:table-cell"}},{header:"Public",accessorKey:"mcp_info.is_public",enableSorting:!0,sortingFn:(e,s)=>{var l,a;return((null===(l=e.original.mcp_info)||void 0===l?void 0:l.is_public)===!0?1:0)-((null===(a=s.original.mcp_info)||void 0===a?void 0:a.is_public)===!0?1:0)},cell:e=>{var s;let{row:l}=e;return(null===(s=l.original.mcp_info)||void 0===s?void 0:s.is_public)===!0?(0,a.jsx)(m.Z,{color:"green",size:"xs",children:"Yes"}):(0,a.jsx)(m.Z,{color:"gray",size:"xs",children:"No"})},meta:{className:"hidden md:table-cell"}},{header:"Details",id:"details",enableSorting:!1,cell:s=>{let{row:l}=s,t=l.original;return(0,a.jsxs)(h.Z,{size:"xs",variant:"secondary",onClick:()=>e(t),icon:j.Z,children:[(0,a.jsx)("span",{className:"hidden lg:inline",children:"Details"}),(0,a.jsx)("span",{className:"lg:hidden",children:"Info"})]})}}]}(e=>{ex(e),eh(!0)},ew,f),data:en||[],isLoading:ec,table:eb,defaultSorting:[{id:"server_name",desc:!1}]})]}),(0,a.jsx)("div",{className:"mt-4 text-center space-y-2",children:(0,a.jsxs)(r.xv,{className:"text-sm text-gray-600",children:["Showing ",(null==en?void 0:en.length)||0," MCP server",(null==en?void 0:en.length)!==1?"s":""]})})]})]})]})]}):(0,a.jsxs)(r.Zb,{className:"mx-auto max-w-xl mt-10",children:[(0,a.jsx)(r.xv,{className:"text-xl text-center mb-2 text-black",children:"Public Model Hub not enabled."}),(0,a.jsx)("p",{className:"text-base text-center text-slate-800",children:"Ask your proxy admin to enable this on their Admin UI."})]}),(0,a.jsx)(n.Z,{title:"Public Model Hub",width:600,visible:H,footer:null,onOk:e_,onCancel:ek,children:(0,a.jsxs)("div",{className:"pt-5 pb-5",children:[(0,a.jsxs)("div",{className:"flex justify-between mb-4",children:[(0,a.jsx)(r.xv,{className:"text-base mr-2",children:"Shareable Link:"}),(0,a.jsx)(r.xv,{className:"max-w-sm ml-2 bg-gray-200 pr-2 pl-2 pt-1 pb-1 text-center rounded",children:"".concat((0,_.getProxyBaseUrl)(),"/ui/model_hub_table")})]}),(0,a.jsx)("div",{className:"flex justify-end",children:(0,a.jsx)(r.zx,{onClick:()=>{eg.replace("/model_hub_table?key=".concat(N))},children:"See Page"})})]})}),(0,a.jsx)(n.Z,{title:(null==B?void 0:B.model_group)||"Model Details",width:1e3,visible:K,footer:null,onOk:e_,onCancel:ek,children:B&&(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Model Overview"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Model Group:"}),(0,a.jsx)(r.xv,{children:B.model_group})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Mode:"}),(0,a.jsx)(r.xv,{children:B.mode||"Not specified"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Providers:"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:B.providers.map(e=>(0,a.jsx)(r.Ct,{color:"blue",children:e},e))})]})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Token & Cost Information"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Max Input Tokens:"}),(0,a.jsx)(r.xv,{children:(null===(s=B.max_input_tokens)||void 0===s?void 0:s.toLocaleString())||"Not specified"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Max Output Tokens:"}),(0,a.jsx)(r.xv,{children:(null===(l=B.max_output_tokens)||void 0===l?void 0:l.toLocaleString())||"Not specified"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Input Cost per 1M Tokens:"}),(0,a.jsx)(r.xv,{children:B.input_cost_per_token?eS(B.input_cost_per_token):"Not specified"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Output Cost per 1M Tokens:"}),(0,a.jsx)(r.xv,{children:B.output_cost_per_token?eS(B.output_cost_per_token):"Not specified"})]})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Capabilities"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:(()=>{let e=eC(B),s=["green","blue","purple","orange","red","yellow"];return 0===e.length?(0,a.jsx)(r.xv,{className:"text-gray-500",children:"No special capabilities listed"}):e.map((e,l)=>(0,a.jsx)(r.Ct,{color:s[l%s.length],children:eZ(e)},e))})()})]}),(B.tpm||B.rpm)&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Rate Limits"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[B.tpm&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Tokens per Minute:"}),(0,a.jsx)(r.xv,{children:B.tpm.toLocaleString()})]}),B.rpm&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Requests per Minute:"}),(0,a.jsx)(r.xv,{children:B.rpm.toLocaleString()})]})]})]}),B.supported_openai_params&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Supported OpenAI Parameters"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:B.supported_openai_params.map(e=>(0,a.jsx)(r.Ct,{color:"green",children:e},e))})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Usage Example"}),(0,a.jsx)(o.Z,{language:"python",className:"text-sm",children:'import openai\n\nclient = openai.OpenAI(\n api_key="your_api_key",\n base_url="http://0.0.0.0:4000" # Your LiteLLM Proxy URL\n)\n\nresponse = client.chat.completions.create(\n model="'.concat(B.model_group,'",\n messages=[\n {\n "role": "user",\n "content": "Hello, how are you?"\n }\n ]\n)\n\nprint(response.choices[0].message.content)')})]})]})}),(0,a.jsx)(n.Z,{title:(null==el?void 0:el.name)||"Agent Details",width:1e3,visible:et,footer:null,onOk:e_,onCancel:ek,children:el&&(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Agent Overview"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Name:"}),(0,a.jsx)(r.xv,{children:el.name})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Version:"}),(0,a.jsxs)(r.Ct,{color:"blue",children:["v",el.version]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Protocol Version:"}),(0,a.jsx)(r.xv,{children:el.protocolVersion})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"URL:"}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(r.xv,{className:"truncate",children:el.url}),(0,a.jsx)(t.Z,{onClick:()=>ew(el.url),className:"cursor-pointer text-gray-500 hover:text-blue-500"})]})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Description:"}),(0,a.jsx)(r.xv,{className:"mt-1",children:el.description})]})]}),el.capabilities&&Object.keys(el.capabilities).length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Capabilities"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:Object.entries(el.capabilities).filter(e=>{let[s,l]=e;return!0===l}).map(e=>{let[s]=e;return(0,a.jsx)(r.Ct,{color:"green",children:s},s)})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Input/Output Modes"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Input Modes:"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:(null===(v=el.defaultInputModes)||void 0===v?void 0:v.map(e=>(0,a.jsx)(r.Ct,{color:"blue",children:e},e)))||(0,a.jsx)(r.xv,{children:"Not specified"})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Output Modes:"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:(null===(b=el.defaultOutputModes)||void 0===b?void 0:b.map(e=>(0,a.jsx)(r.Ct,{color:"purple",children:e},e)))||(0,a.jsx)(r.xv,{children:"Not specified"})})]})]})]}),el.skills&&el.skills.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Skills"}),(0,a.jsx)("div",{className:"space-y-4",children:el.skills.map(e=>(0,a.jsxs)("div",{className:"border border-gray-200 rounded p-4",children:[(0,a.jsxs)("div",{className:"flex justify-between items-start mb-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium text-base",children:e.name}),(0,a.jsxs)(r.xv,{className:"text-xs text-gray-500",children:["ID: ",e.id]})]}),e.tags&&e.tags.length>0&&(0,a.jsx)("div",{className:"flex flex-wrap gap-1",children:e.tags.map(e=>(0,a.jsx)(r.Ct,{color:"purple",size:"xs",children:e},e))})]}),(0,a.jsx)(r.xv,{className:"text-sm mb-2",children:e.description}),e.examples&&e.examples.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-xs font-medium text-gray-700",children:"Examples:"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:e.examples.map((e,s)=>(0,a.jsx)(r.Ct,{color:"gray",size:"xs",children:e},s))})]})]},e.id))})]}),el.supportsAuthenticatedExtendedCard&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Additional Features"}),(0,a.jsx)(r.Ct,{color:"green",children:"Supports Authenticated Extended Card"})]})]})}),(0,a.jsx)(n.Z,{title:(null==eo?void 0:eo.server_name)||"MCP Server Details",width:1e3,visible:em,footer:null,onOk:e_,onCancel:ek,children:eo&&(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Server Overview"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Server Name:"}),(0,a.jsx)(r.xv,{children:eo.server_name})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Server ID:"}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(r.xv,{className:"text-xs truncate",children:eo.server_id}),(0,a.jsx)(t.Z,{onClick:()=>ew(eo.server_id),className:"cursor-pointer text-gray-500 hover:text-blue-500"})]})]}),eo.alias&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Alias:"}),(0,a.jsx)(r.xv,{children:eo.alias})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Transport:"}),(0,a.jsx)(r.Ct,{color:"blue",children:eo.transport})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Auth Type:"}),(0,a.jsx)(r.Ct,{color:"none"===eo.auth_type?"gray":"green",children:eo.auth_type})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Status:"}),(0,a.jsx)(r.Ct,{color:"active"===eo.status||"healthy"===eo.status?"green":"inactive"===eo.status||"unhealthy"===eo.status?"red":"gray",children:eo.status||"unknown"})]})]}),eo.description&&(0,a.jsxs)("div",{className:"mt-2",children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Description:"}),(0,a.jsx)(r.xv,{className:"mt-1",children:eo.description})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Connection Details"}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"URL:"}),(0,a.jsxs)("div",{className:"flex items-center space-x-2 mt-1",children:[(0,a.jsx)(r.xv,{className:"text-sm break-all bg-gray-100 p-2 rounded flex-1",children:eo.url}),(0,a.jsx)(t.Z,{onClick:()=>ew(eo.url),className:"cursor-pointer text-gray-500 hover:text-blue-500 flex-shrink-0"})]})]}),eo.command&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Command:"}),(0,a.jsx)(r.xv,{className:"text-sm bg-gray-100 p-2 rounded mt-1 font-mono",children:eo.command})]})]})]}),eo.allowed_tools&&eo.allowed_tools.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Allowed Tools"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:eo.allowed_tools.map((e,s)=>(0,a.jsx)(r.Ct,{color:"purple",children:e},s))})]}),eo.teams&&eo.teams.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Teams"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:eo.teams.map((e,s)=>(0,a.jsx)(r.Ct,{color:"blue",children:e},s))})]}),eo.mcp_access_groups&&eo.mcp_access_groups.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Access Groups"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:eo.mcp_access_groups.map((e,s)=>(0,a.jsx)(r.Ct,{color:"green",children:e},s))})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Metadata"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Created By:"}),(0,a.jsx)(r.xv,{children:eo.created_by})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Updated By:"}),(0,a.jsx)(r.xv,{children:eo.updated_by})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Created At:"}),(0,a.jsx)(r.xv,{className:"text-sm",children:new Date(eo.created_at).toLocaleString()})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Updated At:"}),(0,a.jsx)(r.xv,{className:"text-sm",children:new Date(eo.updated_at).toLocaleString()})]}),eo.last_health_check&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Last Health Check:"}),(0,a.jsx)(r.xv,{className:"text-sm",children:new Date(eo.last_health_check).toLocaleString()})]})]}),eo.health_check_error&&(0,a.jsxs)("div",{className:"mt-2 p-2 bg-red-50 rounded",children:[(0,a.jsx)(r.xv,{className:"font-medium text-red-700",children:"Health Check Error:"}),(0,a.jsx)(r.xv,{className:"text-sm text-red-600 mt-1",children:eo.health_check_error})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Usage Example"}),(0,a.jsx)(o.Z,{language:"python",className:"text-sm",children:'from fastmcp import Client\nimport asyncio\n\n# Standard MCP configuration\nconfig = {\n "mcpServers": {\n "'.concat(eo.server_name,'": {\n "url": "http://localhost:4000/').concat(eo.server_name,'/mcp",\n "headers": {\n "x-litellm-api-key": "Bearer sk-1234"\n }\n }\n }\n}\n\n# Create a client that connects to the server\nclient = Client(config)\n\nasync def main():\n async with client:\n # List available tools\n tools = await client.list_tools()\n print(f"Available tools: {[tool.name for tool in tools]}")\n\n # Call a tool\n response = await client.call_tool(\n name="tool_name", \n arguments={"arg": "value"}\n )\n print(f"Response: {response}")\n\nif __name__ == "__main__":\n asyncio.run(main())')})]})]})}),(0,a.jsx)(A,{visible:q,onClose:()=>G(!1),accessToken:N||"",modelHubData:z||[],onSuccess:()=>{N&&(async()=>{try{let e=await (0,_.modelHubCall)(N);L(e.data)}catch(e){console.error("Error refreshing model data:",e)}})()}}),(0,a.jsx)(Z,{visible:Q,onClose:()=>X(!1),accessToken:N||"",agentHubData:J||[],onSuccess:()=>{N&&(async()=>{try{let e=(await (0,_.getAgentsList)(N)).agents.map(e=>({agent_id:e.agent_id,...e.agent_card_params,is_public:e.is_public}));$(e)}catch(e){console.error("Error refreshing agent data:",e)}})()}}),(0,a.jsx)(S,{visible:eu,onClose:()=>ep(!1),accessToken:N||"",mcpHubData:en||[],onSuccess:()=>{N&&(async()=>{try{let e=await (0,_.fetchMCPServers)(N);ei(e)}catch(e){console.error("Error refreshing MCP server data:",e)}})()}})]})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/4679-215ebca3cb2114ee.js b/litellm/proxy/_experimental/out/_next/static/chunks/4679-215ebca3cb2114ee.js deleted file mode 100644 index 527a20e2fc..0000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/4679-215ebca3cb2114ee.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4679],{95704:function(e,t,a){a.d(t,{Dx:function(){return u.Z},RM:function(){return l.Z},SC:function(){return o.Z},Zb:function(){return s.Z},iA:function(){return r.Z},pj:function(){return n.Z},ss:function(){return i.Z},xs:function(){return c.Z},xv:function(){return d.Z}});var s=a(12514),r=a(21626),l=a(97214),n=a(28241),i=a(58834),c=a(69552),o=a(71876),d=a(84264),u=a(96761)},92280:function(e,t,a){a.d(t,{x:function(){return s.Z}});var s=a(84264)},56522:function(e,t,a){a.d(t,{o:function(){return r.Z},x:function(){return s.Z}});var s=a(84264),r=a(49566)},80443:function(e,t,a){var s=a(2265),r=a(99376),l=a(14474),n=a(3914),i=a(19250);t.Z=()=>{var e,t,a,c,o,d;let u=(0,r.useRouter)(),m="undefined"!=typeof document?(0,n.e)("token"):null;(0,s.useEffect)(()=>{m||u.replace("".concat((0,i.getProxyBaseUrl)(),"/ui/login"))},[m,u]);let g=(0,s.useMemo)(()=>{if(!m)return null;try{return(0,l.o)(m)}catch(e){return(0,n.b)(),u.replace("".concat((0,i.getProxyBaseUrl)(),"/ui/login")),null}},[m,u]);return{token:m,accessToken:null!==(e=null==g?void 0:g.key)&&void 0!==e?e:null,userId:null!==(t=null==g?void 0:g.user_id)&&void 0!==t?t:null,userEmail:null!==(a=null==g?void 0:g.user_email)&&void 0!==a?a:null,userRole:function(e){if(!e)return"Undefined Role";switch(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"org_admin":return"Org Admin";case"internal_user":return"Internal User";case"internal_user_viewer":case"internal_viewer":return"Internal Viewer";case"app_user":return"App User";default:return"Unknown Role"}}(null!==(c=null==g?void 0:g.user_role)&&void 0!==c?c:null),premiumUser:null!==(o=null==g?void 0:g.premium_user)&&void 0!==o?o:null,disabledPersonalKeyCreation:null!==(d=null==g?void 0:g.disabled_non_admin_personal_key_creation)&&void 0!==d?d:null,showSSOBanner:(null==g?void 0:g.login_method)==="username_password"}}},82586:function(e,t,a){var s=a(57437),r=a(2265),l=a(37592),n=a(19250);t.Z=e=>{let{onChange:t,value:a,className:i,accessToken:c,placeholder:o="Select agents",disabled:d=!1}=e,[u,m]=(0,r.useState)([]),[g,p]=(0,r.useState)([]),[x,h]=(0,r.useState)(!1);(0,r.useEffect)(()=>{(async()=>{if(c){h(!0);try{let e=await (0,n.getAgentsList)(c),t=(null==e?void 0:e.agents)||[];m(t);let a=new Set;t.forEach(e=>{let t=e.agent_access_groups;t&&Array.isArray(t)&&t.forEach(e=>a.add(e))}),p(Array.from(a))}catch(e){console.error("Error fetching agents:",e)}finally{h(!1)}}})()},[c]);let f=[...g.map(e=>({label:e,value:"group:".concat(e),isAccessGroup:!0,searchText:"".concat(e," Access Group")})),...u.map(e=>({label:"".concat(e.agent_name||e.agent_id),value:e.agent_id,isAccessGroup:!1,searchText:"".concat(e.agent_name||e.agent_id," ").concat(e.agent_id," Agent")}))],v=[...(null==a?void 0:a.agents)||[],...((null==a?void 0:a.accessGroups)||[]).map(e=>"group:".concat(e))];return(0,s.jsx)("div",{children:(0,s.jsx)(l.default,{mode:"multiple",placeholder:o,onChange:e=>{t({agents:e.filter(e=>!e.startsWith("group:")),accessGroups:e.filter(e=>e.startsWith("group:")).map(e=>e.replace("group:",""))})},value:v,loading:x,className:i,showSearch:!0,style:{width:"100%"},disabled:d,filterOption:(e,t)=>{var a;return((null===(a=f.find(e=>e.value===(null==t?void 0:t.value)))||void 0===a?void 0:a.searchText)||"").toLowerCase().includes(e.toLowerCase())},children:f.map(e=>(0,s.jsx)(l.default.Option,{value:e.value,label:e.label,children:(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,s.jsx)("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:e.isAccessGroup?"#52c41a":"#722ed1",flexShrink:0}}),(0,s.jsx)("span",{style:{flex:1},children:e.label}),(0,s.jsx)("span",{style:{color:e.isAccessGroup?"#52c41a":"#722ed1",fontSize:"12px",fontWeight:500,opacity:.8},children:e.isAccessGroup?"Access Group":"Agent"})]})},e.value))})})}},97434:function(e,t,a){a.d(t,{Dg:function(){return l},Lo:function(){return n},PA:function(){return o},RD:function(){return i},Z3:function(){return c}});let s="../ui/assets/logos/",r=[{id:"arize",displayName:"Arize",logo:"".concat(s,"arize.png"),supports_key_team_logging:!0,dynamic_params:{arize_api_key:"password",arize_space_id:"password"},description:"Arize Logging Integration"},{id:"braintrust",displayName:"Braintrust",logo:"".concat(s,"braintrust.png"),supports_key_team_logging:!1,dynamic_params:{braintrust_api_key:"password",braintrust_project_name:"text"},description:"Braintrust Logging Integration"},{id:"custom_callback_api",displayName:"Custom Callback API",logo:"".concat(s,"custom.svg"),supports_key_team_logging:!0,dynamic_params:{custom_callback_api_url:"text",custom_callback_api_headers:"text"},description:"Custom Callback API Logging Integration"},{id:"datadog",displayName:"Datadog",logo:"".concat(s,"datadog.png"),supports_key_team_logging:!1,dynamic_params:{dd_api_key:"password",dd_site:"text"},description:"Datadog Logging Integration"},{id:"lago",displayName:"Lago",logo:"".concat(s,"lago.svg"),supports_key_team_logging:!1,dynamic_params:{lago_api_url:"text",lago_api_key:"password"},description:"Lago Billing Logging Integration"},{id:"langfuse",displayName:"Langfuse",logo:"".concat(s,"langfuse.png"),supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v2 Logging Integration"},{id:"langfuse_otel",displayName:"Langfuse OTEL",logo:"".concat(s,"langfuse.png"),supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v3 OTEL Logging Integration"},{id:"langsmith",displayName:"LangSmith",logo:"".concat(s,"langsmith.png"),supports_key_team_logging:!0,dynamic_params:{langsmith_api_key:"password",langsmith_project:"text",langsmith_base_url:"text",langsmith_sampling_rate:"number"},description:"Langsmith Logging Integration"},{id:"openmeter",displayName:"OpenMeter",logo:"".concat(s,"openmeter.png"),supports_key_team_logging:!1,dynamic_params:{openmeter_api_key:"password",openmeter_base_url:"text"},description:"OpenMeter Logging Integration"},{id:"otel",displayName:"Open Telemetry",logo:"".concat(s,"otel.png"),supports_key_team_logging:!1,dynamic_params:{otel_endpoint:"text",otel_headers:"text"},description:"OpenTelemetry Logging Integration"},{id:"s3",displayName:"S3",logo:"".concat(s,"aws.svg"),supports_key_team_logging:!1,dynamic_params:{s3_bucket_name:"text",aws_access_key_id:"password",aws_secret_access_key:"password",aws_region:"text"},description:"S3 Bucket (AWS) Logging Integration"},{id:"SQS",displayName:"SQS",logo:"".concat(s,"aws.svg"),supports_key_team_logging:!1,dynamic_params:{sqs_queue_url:"text",aws_access_key_id:"password",aws_secret_access_key:"password",aws_region:"text"},description:"SQS Queue (AWS) Logging Integration"}],l=r.reduce((e,t)=>(e[t.displayName]=t,e),{}),n=r.reduce((e,t)=>(e[t.displayName]=t.id,e),{}),i=r.reduce((e,t)=>(e[t.id]=t.displayName,e),{}),c=e=>e.map(e=>n[e]||e),o=e=>e.map(e=>i[e]||e)},95096:function(e,t,a){var s=a(57437),r=a(2265),l=a(37592),n=a(19250);t.Z=e=>{let{onChange:t,value:a,className:i,accessToken:c,placeholder:o="Select pass through routes",disabled:d=!1,teamId:u}=e,[m,g]=(0,r.useState)([]),[p,x]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{(async()=>{if(c){x(!0);try{let e=await (0,n.getPassThroughEndpointsCall)(c,u);if(e.endpoints){let t=e.endpoints.map(e=>e.path);g(t)}}catch(e){console.error("Error fetching pass through routes:",e)}finally{x(!1)}}})()},[c,u]),(0,s.jsx)(l.default,{mode:"tags",placeholder:o,onChange:t,value:a,loading:p,className:i,options:m.map(e=>({label:e,value:e})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"},disabled:d})}},46468:function(e,t,a){a.d(t,{K2:function(){return r},Ob:function(){return n},W0:function(){return l}});var s=a(19250);let r=async(e,t,a)=>{try{if(null===e||null===t)return;if(null!==a){let r=(await (0,s.modelAvailableCall)(a,e,t,!0,null,!0)).data.map(e=>e.id),l=[],n=[];return r.forEach(e=>{e.endsWith("/*")?l.push(e):n.push(e)}),[...l,...n]}}catch(e){console.error("Error fetching user models:",e)}},l=e=>{if(e.endsWith("/*")){let t=e.replace("/*","");return"All ".concat(t," models")}return e},n=(e,t)=>{let a=[],s=[];return console.log("teamModels",e),console.log("allModels",t),e.forEach(e=>{if(e.endsWith("/*")){let r=e.replace("/*",""),l=t.filter(e=>e.startsWith(r+"/"));s.push(...l),a.push(e)}else s.push(e)}),[...a,...s].filter((e,t,a)=>a.indexOf(e)===t)}},95920:function(e,t,a){var s=a(57437),r=a(2265),l=a(37592),n=a(19250);t.Z=e=>{let{onChange:t,value:a,className:i,accessToken:c,placeholder:o="Select MCP servers",disabled:d=!1}=e,[u,m]=(0,r.useState)([]),[g,p]=(0,r.useState)([]),[x,h]=(0,r.useState)(!1);(0,r.useEffect)(()=>{(async()=>{if(c){h(!0);try{let[e,t]=await Promise.all([(0,n.fetchMCPServers)(c),(0,n.fetchMCPAccessGroups)(c)]),a=Array.isArray(e)?e:e.data||[],s=Array.isArray(t)?t:t.data||[];m(a),p(s)}catch(e){console.error("Error fetching MCP servers or access groups:",e)}finally{h(!1)}}})()},[c]);let f=[...g.map(e=>({label:e,value:e,isAccessGroup:!0,searchText:"".concat(e," Access Group")})),...u.map(e=>({label:"".concat(e.server_name||e.server_id," (").concat(e.server_id,")"),value:e.server_id,isAccessGroup:!1,searchText:"".concat(e.server_name||e.server_id," ").concat(e.server_id," MCP Server")}))],v=[...(null==a?void 0:a.servers)||[],...(null==a?void 0:a.accessGroups)||[]];return(0,s.jsx)("div",{children:(0,s.jsx)(l.default,{mode:"multiple",placeholder:o,onChange:e=>{t({servers:e.filter(e=>!g.includes(e)),accessGroups:e.filter(e=>g.includes(e))})},value:v,loading:x,className:i,showSearch:!0,style:{width:"100%"},disabled:d,filterOption:(e,t)=>{var a;return((null===(a=f.find(e=>e.value===(null==t?void 0:t.value)))||void 0===a?void 0:a.searchText)||"").toLowerCase().includes(e.toLowerCase())},children:f.map(e=>(0,s.jsx)(l.default.Option,{value:e.value,label:e.label,children:(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,s.jsx)("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:e.isAccessGroup?"#52c41a":"#1890ff",flexShrink:0}}),(0,s.jsx)("span",{style:{flex:1},children:e.label}),(0,s.jsx)("span",{style:{color:e.isAccessGroup?"#52c41a":"#1890ff",fontSize:"12px",fontWeight:500,opacity:.8},children:e.isAccessGroup?"Access Group":"MCP Server"})]})},e.value))})})}},68473:function(e,t,a){var s=a(57437),r=a(2265),l=a(19250),n=a(92280),i=a(10353),c=a(4156),o=a(32489);t.Z=e=>{let{accessToken:t,selectedServers:a,toolPermissions:d,onChange:u,disabled:m=!1}=e,[g,p]=(0,r.useState)([]),[x,h]=(0,r.useState)({}),[f,v]=(0,r.useState)({}),[_,y]=(0,r.useState)({});(0,r.useEffect)(()=>{(async()=>{if(0===a.length){p([]);return}try{let e=await (0,l.fetchMCPServers)(t),s=(Array.isArray(e)?e:e.data||[]).filter(e=>a.includes(e.server_id));p(s)}catch(e){console.error("Error fetching MCP servers:",e),p([])}})()},[a,t]);let b=async e=>{v(t=>({...t,[e]:!0})),y(t=>({...t,[e]:""}));try{let a=await (0,l.listMCPTools)(t,e);a.error?(y(t=>({...t,[e]:a.message||"Failed to fetch tools"})),h(t=>({...t,[e]:[]}))):h(t=>({...t,[e]:a.tools||[]}))}catch(t){console.error("Error fetching tools for server ".concat(e,":"),t),y(t=>({...t,[e]:"Failed to fetch tools"})),h(t=>({...t,[e]:[]}))}finally{v(t=>({...t,[e]:!1}))}};(0,r.useEffect)(()=>{g.forEach(e=>{x[e.server_id]||f[e.server_id]||b(e.server_id)})},[g]);let j=(e,t)=>{let a=d[e]||[],s=a.includes(t)?a.filter(e=>e!==t):[...a,t];u({...d,[e]:s})},N=e=>{let t=x[e]||[];u({...d,[e]:t.map(e=>e.name)})},w=e=>{u({...d,[e]:[]})};return 0===a.length?null:(0,s.jsx)("div",{className:"space-y-4",children:g.map(e=>{let t=e.server_name||e.alias||e.server_id,a=x[e.server_id]||[],r=d[e.server_id]||[],l=f[e.server_id],u=_[e.server_id];return(0,s.jsxs)("div",{className:"border rounded-lg bg-gray-50",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between p-4 border-b bg-white rounded-t-lg",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(n.x,{className:"font-semibold text-gray-900",children:t}),e.description&&(0,s.jsx)(n.x,{className:"text-sm text-gray-500",children:e.description})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("button",{className:"text-sm text-blue-600 hover:text-blue-700 font-medium",onClick:()=>N(e.server_id),disabled:m||l,children:"Select All"}),(0,s.jsx)("button",{className:"text-sm text-blue-600 hover:text-blue-700 font-medium",onClick:()=>w(e.server_id),disabled:m||l,children:"Deselect All"}),(0,s.jsx)("button",{className:"text-gray-400 hover:text-gray-600",onClick:()=>{},children:(0,s.jsx)(o.Z,{className:"w-4 h-4"})})]})]}),(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsx)(n.x,{className:"text-sm font-medium text-gray-700 mb-3",children:"Available Tools"}),l&&(0,s.jsxs)("div",{className:"flex items-center justify-center py-8",children:[(0,s.jsx)(i.Z,{size:"large"}),(0,s.jsx)(n.x,{className:"ml-3 text-gray-500",children:"Loading tools..."})]}),u&&!l&&(0,s.jsxs)("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg text-center",children:[(0,s.jsx)(n.x,{className:"text-red-600 font-medium",children:"Unable to load tools"}),(0,s.jsx)(n.x,{className:"text-sm text-red-500 mt-1",children:u})]}),!l&&!u&&a.length>0&&(0,s.jsx)("div",{className:"space-y-2",children:a.map(t=>{let a=r.includes(t.name);return(0,s.jsxs)("div",{className:"flex items-start gap-2",children:[(0,s.jsx)(c.Z,{checked:a,onChange:()=>j(e.server_id,t.name),disabled:m}),(0,s.jsx)("div",{className:"flex-1 min-w-0",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(n.x,{className:"font-medium text-gray-900",children:t.name}),(0,s.jsxs)(n.x,{className:"text-sm text-gray-500",children:["- ",t.description||"No description"]})]})})]},t.name)})}),!l&&!u&&0===a.length&&(0,s.jsx)("div",{className:"text-center py-6",children:(0,s.jsx)(n.x,{className:"text-gray-500",children:"No tools available"})})]})]},e.server_id)})})}},10703:function(e,t,a){a.d(t,{p:function(){return r}});var s=a(19250);let r=async e=>{try{let t=await (0,s.modelHubCall)(e);if(console.log("model_info:",t),(null==t?void 0:t.data.length)>0){let e=t.data.map(e=>({model_group:e.model_group,mode:null==e?void 0:e.mode}));return e.sort((e,t)=>e.model_group.localeCompare(t.model_group)),e}return[]}catch(e){throw console.error("Error fetching model info:",e),e}}},24199:function(e,t,a){a.d(t,{Z:function(){return l}});var s=a(57437);a(2265);var r=a(30150),l=e=>{let{step:t=.01,style:a={width:"100%"},placeholder:l="Enter a numerical value",min:n,max:i,onChange:c,...o}=e;return(0,s.jsx)(r.Z,{onWheel:e=>e.currentTarget.blur(),step:t,style:a,placeholder:l,min:n,max:i,onChange:c,...o})}},54507:function(e,t,a){a.d(t,{Z:function(){return v}});var s=a(57437);a(2265);var r=a(37592),l=a(99981),n=a(23496),i=a(15424),c=a(78489),o=a(12514),d=a(49566),u=a(91777),m=a(82182),g=a(22452),p=a(74998),x=a(97434),h=a(24199);let{Option:f}=r.default;var v=e=>{let{value:t=[],onChange:a,disabledCallbacks:v=[],onDisabledCallbacksChange:_}=e,y=Object.entries(x.Dg).filter(e=>{let[t,a]=e;return a.supports_key_team_logging}).map(e=>{let[t,a]=e;return t}),b=Object.keys(x.Dg),j=e=>{null==a||a(e)},N=e=>{j(t.filter((t,a)=>a!==e))},w=(e,a,s)=>{let r=[...t];if("callback_name"===a){let t=x.Lo[s]||s;r[e]={...r[e],[a]:t,callback_vars:{}}}else r[e]={...r[e],[a]:s};j(r)},k=(e,a,s)=>{let r=[...t];r[e]={...r[e],callback_vars:{...r[e].callback_vars,[a]:s}},j(r)},C=(e,t)=>{var a,r;if(!e.callback_name)return null;let n=null===(a=Object.entries(x.Lo).find(t=>{let[a,s]=t;return s===e.callback_name}))||void 0===a?void 0:a[0];if(!n)return null;let c=(null===(r=x.Dg[n])||void 0===r?void 0:r.dynamic_params)||{};return 0===Object.keys(c).length?null:(0,s.jsxs)("div",{className:"mt-6 pt-4 border-t border-gray-100",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2 mb-4",children:[(0,s.jsx)("div",{className:"w-3 h-3 bg-blue-100 rounded-full flex items-center justify-center",children:(0,s.jsx)("div",{className:"w-1.5 h-1.5 bg-blue-500 rounded-full"})}),(0,s.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Integration Parameters"})]}),(0,s.jsx)("div",{className:"grid grid-cols-1 gap-4",children:Object.entries(c).map(a=>{let[r,n]=a;return(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("label",{className:"text-sm font-medium text-gray-700 capitalize flex items-center space-x-1",children:[(0,s.jsx)("span",{children:r.replace(/_/g," ")}),(0,s.jsx)(l.Z,{title:"Environment variable reference recommended: os.environ/".concat(r.toUpperCase()),children:(0,s.jsx)(i.Z,{className:"text-gray-400 cursor-help text-xs"})}),"password"===n&&(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:"Sensitive"}),"number"===n&&(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:"Number"})]}),"number"===n&&(0,s.jsx)("span",{className:"text-xs text-gray-500",children:"Value must be between 0 and 1"}),"number"===n?(0,s.jsx)(h.Z,{step:.01,width:400,placeholder:"os.environ/".concat(r.toUpperCase()),value:e.callback_vars[r]||"",onChange:e=>k(t,r,e.target.value)}):(0,s.jsx)(d.Z,{type:"password"===n?"password":"text",placeholder:"os.environ/".concat(r.toUpperCase()),value:e.callback_vars[r]||"",onChange:e=>k(t,r,e.target.value)})]},r)})})]})};return(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(u.Z,{className:"w-5 h-5 text-red-500"}),(0,s.jsx)("span",{className:"text-base font-semibold text-gray-800",children:"Disabled Callbacks"}),(0,s.jsx)(l.Z,{title:"Select callbacks to disable for this key. Disabled callbacks will not receive any logging data.",children:(0,s.jsx)(i.Z,{className:"text-gray-400 cursor-help"})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Disabled Callbacks"}),(0,s.jsx)(r.default,{mode:"multiple",placeholder:"Select callbacks to disable",value:v,onChange:e=>{let t=(0,x.Z3)(e);null==_||_(t)},style:{width:"100%"},optionLabelProp:"label",children:b.map(e=>{var t,a;let r=null===(t=x.Dg[e])||void 0===t?void 0:t.logo,n=null===(a=x.Dg[e])||void 0===a?void 0:a.description;return(0,s.jsx)(f,{value:e,label:e,children:(0,s.jsx)(l.Z,{title:n,placement:"right",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[r&&(0,s.jsx)("img",{src:r,alt:e,className:"w-4 h-4 object-contain",onError:t=>{let a=t.target,s=a.parentElement;if(s){let t=document.createElement("div");t.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",t.textContent=e.charAt(0),s.replaceChild(t,a)}}}),(0,s.jsx)("span",{children:e})]})})},e)})}),(0,s.jsx)("div",{className:"text-xs text-gray-500",children:"Select callbacks that should be disabled for this key. These callbacks will not receive any logging data."})]})]}),(0,s.jsx)(n.Z,{}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(m.Z,{className:"w-5 h-5 text-blue-500"}),(0,s.jsx)("span",{className:"text-base font-semibold text-gray-800",children:"Logging Integrations"}),(0,s.jsx)(l.Z,{title:"Configure callback logging integrations for this team.",children:(0,s.jsx)(i.Z,{className:"text-gray-400 cursor-help"})})]}),(0,s.jsx)(c.Z,{variant:"secondary",onClick:()=>{j([...t,{callback_name:"",callback_type:"success",callback_vars:{}}])},icon:g.Z,size:"sm",className:"hover:border-blue-400 hover:text-blue-500",type:"button",children:"Add Integration"})]}),(0,s.jsx)("div",{className:"space-y-4",children:t.map((e,t)=>{var a,n;let i=e.callback_name?null===(a=Object.entries(x.Lo).find(t=>{let[a,s]=t;return s===e.callback_name}))||void 0===a?void 0:a[0]:void 0,d=i?null===(n=x.Dg[i])||void 0===n?void 0:n.logo:null;return(0,s.jsxs)(o.Z,{className:"border border-gray-200 shadow-sm hover:shadow-md transition-shadow duration-200",decoration:"top",decorationColor:"blue",children:[(0,s.jsxs)("div",{className:"flex justify-between items-start mb-4",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[d&&(0,s.jsx)("img",{src:d,alt:i,className:"w-5 h-5 object-contain"}),(0,s.jsxs)("span",{className:"text-sm font-medium",children:[i||"New Integration"," Configuration"]})]}),(0,s.jsx)(c.Z,{variant:"light",onClick:()=>N(t),icon:p.Z,size:"xs",color:"red",className:"hover:bg-red-50",type:"button",children:"Remove"})]}),(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Integration Type"}),(0,s.jsx)(r.default,{value:i,placeholder:"Select integration",onChange:e=>w(t,"callback_name",e),className:"w-full",optionLabelProp:"label",children:y.map(e=>{var t,a;let r=null===(t=x.Dg[e])||void 0===t?void 0:t.logo,n=null===(a=x.Dg[e])||void 0===a?void 0:a.description;return(0,s.jsx)(f,{value:e,label:e,children:(0,s.jsx)(l.Z,{title:n,placement:"right",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[r&&(0,s.jsx)("img",{src:r,alt:e,className:"w-4 h-4 object-contain",onError:t=>{let a=t.target,s=a.parentElement;if(s){let t=document.createElement("div");t.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",t.textContent=e.charAt(0),s.replaceChild(t,a)}}}),(0,s.jsx)("span",{children:e})]})})},e)})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Event Type"}),(0,s.jsxs)(r.default,{value:e.callback_type,onChange:e=>w(t,"callback_type",e),className:"w-full",children:[(0,s.jsx)(f,{value:"success",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,s.jsx)("span",{children:"Success Only"})]})}),(0,s.jsx)(f,{value:"failure",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-red-500 rounded-full"}),(0,s.jsx)("span",{children:"Failure Only"})]})}),(0,s.jsx)(f,{value:"success_and_failure",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,s.jsx)("span",{children:"Success & Failure"})]})})]})]})]}),C(e,t)]})]},t)})}),0===t.length&&(0,s.jsxs)("div",{className:"text-center py-12 text-gray-500 border-2 border-dashed border-gray-200 rounded-lg bg-gray-50/50",children:[(0,s.jsx)(m.Z,{className:"w-12 h-12 text-gray-300 mb-3 mx-auto"}),(0,s.jsx)("div",{className:"text-base font-medium mb-1",children:"No logging integrations configured"}),(0,s.jsx)("div",{className:"text-sm text-gray-400",children:'Click "Add Integration" to configure logging for this team'})]})]})}},97415:function(e,t,a){var s=a(57437),r=a(2265),l=a(37592),n=a(19250);t.Z=e=>{let{onChange:t,value:a,className:i,accessToken:c,placeholder:o="Select vector stores",disabled:d=!1}=e,[u,m]=(0,r.useState)([]),[g,p]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{(async()=>{if(c){p(!0);try{let e=await (0,n.vectorStoreListCall)(c);e.data&&m(e.data)}catch(e){console.error("Error fetching vector stores:",e)}finally{p(!1)}}})()},[c]),(0,s.jsx)("div",{children:(0,s.jsx)(l.default,{mode:"multiple",placeholder:o,onChange:t,value:a,loading:g,className:i,options:u.map(e=>({label:"".concat(e.vector_store_name||e.vector_store_id," (").concat(e.vector_store_id,")"),value:e.vector_store_id,title:e.vector_store_description||e.vector_store_id})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"},disabled:d})})}},59872:function(e,t,a){a.d(t,{nl:function(){return r},pw:function(){return l},vQ:function(){return n}});var s=a(9114);function r(e,t){let a=structuredClone(e);for(let[e,s]of Object.entries(t))e in a&&(a[e]=s);return a}let l=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(null==e||!Number.isFinite(e))return"-";let s={minimumFractionDigits:t,maximumFractionDigits:t};if(!a)return e.toLocaleString("en-US",s);let r=Math.abs(e),l=r,n="";return r>=1e6?(l=r/1e6,n="M"):r>=1e3&&(l=r/1e3,n="K"),"".concat(e<0?"-":"").concat(l.toLocaleString("en-US",s)).concat(n)},n=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Copied to clipboard";if(!e)return!1;if(!navigator||!navigator.clipboard||!navigator.clipboard.writeText)return i(e,t);try{return await navigator.clipboard.writeText(e),s.Z.success(t),!0}catch(a){return console.error("Clipboard API failed: ",a),i(e,t)}},i=(e,t)=>{try{let a=document.createElement("textarea");a.value=e,a.style.position="fixed",a.style.left="-999999px",a.style.top="-999999px",a.setAttribute("readonly",""),document.body.appendChild(a),a.focus(),a.select();let r=document.execCommand("copy");if(document.body.removeChild(a),r)return s.Z.success(t),!0;throw Error("execCommand failed")}catch(e){return s.Z.fromBackend("Failed to copy to clipboard"),console.error("Failed to copy: ",e),!1}}},20347:function(e,t,a){a.d(t,{LQ:function(){return l},P4:function(){return i},ZL:function(){return s},lo:function(){return r},tY:function(){return n}});let s=["Admin","Admin Viewer","proxy_admin","proxy_admin_viewer","org_admin"],r=["Internal User","Internal Viewer"],l=["Internal User","Admin","proxy_admin"],n=e=>s.includes(e),i=e=>"proxy_admin"===e||"Admin"===e}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/4679-bdd70e8457d0a482.js b/litellm/proxy/_experimental/out/_next/static/chunks/4679-bdd70e8457d0a482.js new file mode 100644 index 0000000000..2a001d732c --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/4679-bdd70e8457d0a482.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4679],{95704:function(e,t,a){a.d(t,{Dx:function(){return u.Z},RM:function(){return l.Z},SC:function(){return o.Z},Zb:function(){return s.Z},iA:function(){return r.Z},pj:function(){return n.Z},ss:function(){return i.Z},xs:function(){return c.Z},xv:function(){return d.Z}});var s=a(12514),r=a(21626),l=a(97214),n=a(28241),i=a(58834),c=a(69552),o=a(71876),d=a(84264),u=a(96761)},92280:function(e,t,a){a.d(t,{x:function(){return s.Z}});var s=a(84264)},56522:function(e,t,a){a.d(t,{o:function(){return r.Z},x:function(){return s.Z}});var s=a(84264),r=a(49566)},80443:function(e,t,a){var s=a(2265),r=a(99376),l=a(14474),n=a(3914),i=a(19250);t.Z=()=>{var e,t,a,c,o,d;let u=(0,r.useRouter)(),m="undefined"!=typeof document?(0,n.e)("token"):null;(0,s.useEffect)(()=>{m||u.replace("".concat((0,i.getProxyBaseUrl)(),"/ui/login"))},[m,u]);let g=(0,s.useMemo)(()=>{if(!m)return null;try{return(0,l.o)(m)}catch(e){return(0,n.b)(),u.replace("".concat((0,i.getProxyBaseUrl)(),"/ui/login")),null}},[m,u]);return{token:m,accessToken:null!==(e=null==g?void 0:g.key)&&void 0!==e?e:null,userId:null!==(t=null==g?void 0:g.user_id)&&void 0!==t?t:null,userEmail:null!==(a=null==g?void 0:g.user_email)&&void 0!==a?a:null,userRole:function(e){if(!e)return"Undefined Role";switch(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"org_admin":return"Org Admin";case"internal_user":return"Internal User";case"internal_user_viewer":case"internal_viewer":return"Internal Viewer";case"app_user":return"App User";default:return"Unknown Role"}}(null!==(c=null==g?void 0:g.user_role)&&void 0!==c?c:null),premiumUser:null!==(o=null==g?void 0:g.premium_user)&&void 0!==o?o:null,disabledPersonalKeyCreation:null!==(d=null==g?void 0:g.disabled_non_admin_personal_key_creation)&&void 0!==d?d:null,showSSOBanner:(null==g?void 0:g.login_method)==="username_password"}}},82586:function(e,t,a){var s=a(57437),r=a(2265),l=a(37592),n=a(19250);t.Z=e=>{let{onChange:t,value:a,className:i,accessToken:c,placeholder:o="Select agents",disabled:d=!1}=e,[u,m]=(0,r.useState)([]),[g,p]=(0,r.useState)([]),[x,h]=(0,r.useState)(!1);(0,r.useEffect)(()=>{(async()=>{if(c){h(!0);try{let e=await (0,n.getAgentsList)(c),t=(null==e?void 0:e.agents)||[];m(t);let a=new Set;t.forEach(e=>{let t=e.agent_access_groups;t&&Array.isArray(t)&&t.forEach(e=>a.add(e))}),p(Array.from(a))}catch(e){console.error("Error fetching agents:",e)}finally{h(!1)}}})()},[c]);let f=[...g.map(e=>({label:e,value:"group:".concat(e),isAccessGroup:!0,searchText:"".concat(e," Access Group")})),...u.map(e=>({label:"".concat(e.agent_name||e.agent_id),value:e.agent_id,isAccessGroup:!1,searchText:"".concat(e.agent_name||e.agent_id," ").concat(e.agent_id," Agent")}))],v=[...(null==a?void 0:a.agents)||[],...((null==a?void 0:a.accessGroups)||[]).map(e=>"group:".concat(e))];return(0,s.jsx)("div",{children:(0,s.jsx)(l.default,{mode:"multiple",placeholder:o,onChange:e=>{t({agents:e.filter(e=>!e.startsWith("group:")),accessGroups:e.filter(e=>e.startsWith("group:")).map(e=>e.replace("group:",""))})},value:v,loading:x,className:i,showSearch:!0,style:{width:"100%"},disabled:d,filterOption:(e,t)=>{var a;return((null===(a=f.find(e=>e.value===(null==t?void 0:t.value)))||void 0===a?void 0:a.searchText)||"").toLowerCase().includes(e.toLowerCase())},children:f.map(e=>(0,s.jsx)(l.default.Option,{value:e.value,label:e.label,children:(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,s.jsx)("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:e.isAccessGroup?"#52c41a":"#722ed1",flexShrink:0}}),(0,s.jsx)("span",{style:{flex:1},children:e.label}),(0,s.jsx)("span",{style:{color:e.isAccessGroup?"#52c41a":"#722ed1",fontSize:"12px",fontWeight:500,opacity:.8},children:e.isAccessGroup?"Access Group":"Agent"})]})},e.value))})})}},97434:function(e,t,a){a.d(t,{Dg:function(){return l},Lo:function(){return n},PA:function(){return o},RD:function(){return i},Z3:function(){return c}});let s="../ui/assets/logos/",r=[{id:"arize",displayName:"Arize",logo:"".concat(s,"arize.png"),supports_key_team_logging:!0,dynamic_params:{arize_api_key:"password",arize_space_id:"password"},description:"Arize Logging Integration"},{id:"braintrust",displayName:"Braintrust",logo:"".concat(s,"braintrust.png"),supports_key_team_logging:!1,dynamic_params:{braintrust_api_key:"password",braintrust_project_name:"text"},description:"Braintrust Logging Integration"},{id:"custom_callback_api",displayName:"Custom Callback API",logo:"".concat(s,"custom.svg"),supports_key_team_logging:!0,dynamic_params:{custom_callback_api_url:"text",custom_callback_api_headers:"text"},description:"Custom Callback API Logging Integration"},{id:"datadog",displayName:"Datadog",logo:"".concat(s,"datadog.png"),supports_key_team_logging:!1,dynamic_params:{dd_api_key:"password",dd_site:"text"},description:"Datadog Logging Integration"},{id:"lago",displayName:"Lago",logo:"".concat(s,"lago.svg"),supports_key_team_logging:!1,dynamic_params:{lago_api_url:"text",lago_api_key:"password"},description:"Lago Billing Logging Integration"},{id:"langfuse",displayName:"Langfuse",logo:"".concat(s,"langfuse.png"),supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v2 Logging Integration"},{id:"langfuse_otel",displayName:"Langfuse OTEL",logo:"".concat(s,"langfuse.png"),supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v3 OTEL Logging Integration"},{id:"langsmith",displayName:"LangSmith",logo:"".concat(s,"langsmith.png"),supports_key_team_logging:!0,dynamic_params:{langsmith_api_key:"password",langsmith_project:"text",langsmith_base_url:"text",langsmith_sampling_rate:"number"},description:"Langsmith Logging Integration"},{id:"openmeter",displayName:"OpenMeter",logo:"".concat(s,"openmeter.png"),supports_key_team_logging:!1,dynamic_params:{openmeter_api_key:"password",openmeter_base_url:"text"},description:"OpenMeter Logging Integration"},{id:"otel",displayName:"Open Telemetry",logo:"".concat(s,"otel.png"),supports_key_team_logging:!1,dynamic_params:{otel_endpoint:"text",otel_headers:"text"},description:"OpenTelemetry Logging Integration"},{id:"s3",displayName:"S3",logo:"".concat(s,"aws.svg"),supports_key_team_logging:!1,dynamic_params:{s3_bucket_name:"text",aws_access_key_id:"password",aws_secret_access_key:"password",aws_region:"text"},description:"S3 Bucket (AWS) Logging Integration"},{id:"SQS",displayName:"SQS",logo:"".concat(s,"aws.svg"),supports_key_team_logging:!1,dynamic_params:{sqs_queue_url:"text",aws_access_key_id:"password",aws_secret_access_key:"password",aws_region:"text"},description:"SQS Queue (AWS) Logging Integration"}],l=r.reduce((e,t)=>(e[t.displayName]=t,e),{}),n=r.reduce((e,t)=>(e[t.displayName]=t.id,e),{}),i=r.reduce((e,t)=>(e[t.id]=t.displayName,e),{}),c=e=>e.map(e=>n[e]||e),o=e=>e.map(e=>i[e]||e)},95096:function(e,t,a){var s=a(57437),r=a(2265),l=a(37592),n=a(19250);t.Z=e=>{let{onChange:t,value:a,className:i,accessToken:c,placeholder:o="Select pass through routes",disabled:d=!1,teamId:u}=e,[m,g]=(0,r.useState)([]),[p,x]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{(async()=>{if(c){x(!0);try{let e=await (0,n.getPassThroughEndpointsCall)(c,u);if(e.endpoints){let t=e.endpoints.map(e=>e.path);g(t)}}catch(e){console.error("Error fetching pass through routes:",e)}finally{x(!1)}}})()},[c,u]),(0,s.jsx)(l.default,{mode:"tags",placeholder:o,onChange:t,value:a,loading:p,className:i,options:m.map(e=>({label:e,value:e})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"},disabled:d})}},46468:function(e,t,a){a.d(t,{K2:function(){return r},Ob:function(){return n},W0:function(){return l}});var s=a(19250);let r=async(e,t,a)=>{try{if(null===e||null===t)return;if(null!==a){let r=(await (0,s.modelAvailableCall)(a,e,t,!0,null,!0)).data.map(e=>e.id),l=[],n=[];return r.forEach(e=>{e.endsWith("/*")?l.push(e):n.push(e)}),[...l,...n]}}catch(e){console.error("Error fetching user models:",e)}},l=e=>{if(e.endsWith("/*")){let t=e.replace("/*","");return"All ".concat(t," models")}return e},n=(e,t)=>{let a=[],s=[];return console.log("teamModels",e),console.log("allModels",t),e.forEach(e=>{if(e.endsWith("/*")){let r=e.replace("/*",""),l=t.filter(e=>e.startsWith(r+"/"));s.push(...l),a.push(e)}else s.push(e)}),[...a,...s].filter((e,t,a)=>a.indexOf(e)===t)}},95920:function(e,t,a){var s=a(57437),r=a(2265),l=a(37592),n=a(19250);t.Z=e=>{let{onChange:t,value:a,className:i,accessToken:c,placeholder:o="Select MCP servers",disabled:d=!1}=e,[u,m]=(0,r.useState)([]),[g,p]=(0,r.useState)([]),[x,h]=(0,r.useState)(!1);(0,r.useEffect)(()=>{(async()=>{if(c){h(!0);try{let[e,t]=await Promise.all([(0,n.fetchMCPServers)(c),(0,n.fetchMCPAccessGroups)(c)]),a=Array.isArray(e)?e:e.data||[],s=Array.isArray(t)?t:t.data||[];m(a),p(s)}catch(e){console.error("Error fetching MCP servers or access groups:",e)}finally{h(!1)}}})()},[c]);let f=[...g.map(e=>({label:e,value:e,isAccessGroup:!0,searchText:"".concat(e," Access Group")})),...u.map(e=>({label:"".concat(e.server_name||e.server_id," (").concat(e.server_id,")"),value:e.server_id,isAccessGroup:!1,searchText:"".concat(e.server_name||e.server_id," ").concat(e.server_id," MCP Server")}))],v=[...(null==a?void 0:a.servers)||[],...(null==a?void 0:a.accessGroups)||[]];return(0,s.jsx)("div",{children:(0,s.jsx)(l.default,{mode:"multiple",placeholder:o,onChange:e=>{t({servers:e.filter(e=>!g.includes(e)),accessGroups:e.filter(e=>g.includes(e))})},value:v,loading:x,className:i,showSearch:!0,style:{width:"100%"},disabled:d,filterOption:(e,t)=>{var a;return((null===(a=f.find(e=>e.value===(null==t?void 0:t.value)))||void 0===a?void 0:a.searchText)||"").toLowerCase().includes(e.toLowerCase())},children:f.map(e=>(0,s.jsx)(l.default.Option,{value:e.value,label:e.label,children:(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,s.jsx)("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:e.isAccessGroup?"#52c41a":"#1890ff",flexShrink:0}}),(0,s.jsx)("span",{style:{flex:1},children:e.label}),(0,s.jsx)("span",{style:{color:e.isAccessGroup?"#52c41a":"#1890ff",fontSize:"12px",fontWeight:500,opacity:.8},children:e.isAccessGroup?"Access Group":"MCP Server"})]})},e.value))})})}},68473:function(e,t,a){var s=a(57437),r=a(2265),l=a(19250),n=a(92280),i=a(10353),c=a(61994),o=a(32489);t.Z=e=>{let{accessToken:t,selectedServers:a,toolPermissions:d,onChange:u,disabled:m=!1}=e,[g,p]=(0,r.useState)([]),[x,h]=(0,r.useState)({}),[f,v]=(0,r.useState)({}),[_,y]=(0,r.useState)({});(0,r.useEffect)(()=>{(async()=>{if(0===a.length){p([]);return}try{let e=await (0,l.fetchMCPServers)(t),s=(Array.isArray(e)?e:e.data||[]).filter(e=>a.includes(e.server_id));p(s)}catch(e){console.error("Error fetching MCP servers:",e),p([])}})()},[a,t]);let b=async e=>{v(t=>({...t,[e]:!0})),y(t=>({...t,[e]:""}));try{let a=await (0,l.listMCPTools)(t,e);a.error?(y(t=>({...t,[e]:a.message||"Failed to fetch tools"})),h(t=>({...t,[e]:[]}))):h(t=>({...t,[e]:a.tools||[]}))}catch(t){console.error("Error fetching tools for server ".concat(e,":"),t),y(t=>({...t,[e]:"Failed to fetch tools"})),h(t=>({...t,[e]:[]}))}finally{v(t=>({...t,[e]:!1}))}};(0,r.useEffect)(()=>{g.forEach(e=>{x[e.server_id]||f[e.server_id]||b(e.server_id)})},[g]);let j=(e,t)=>{let a=d[e]||[],s=a.includes(t)?a.filter(e=>e!==t):[...a,t];u({...d,[e]:s})},N=e=>{let t=x[e]||[];u({...d,[e]:t.map(e=>e.name)})},w=e=>{u({...d,[e]:[]})};return 0===a.length?null:(0,s.jsx)("div",{className:"space-y-4",children:g.map(e=>{let t=e.server_name||e.alias||e.server_id,a=x[e.server_id]||[],r=d[e.server_id]||[],l=f[e.server_id],u=_[e.server_id];return(0,s.jsxs)("div",{className:"border rounded-lg bg-gray-50",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between p-4 border-b bg-white rounded-t-lg",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(n.x,{className:"font-semibold text-gray-900",children:t}),e.description&&(0,s.jsx)(n.x,{className:"text-sm text-gray-500",children:e.description})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("button",{className:"text-sm text-blue-600 hover:text-blue-700 font-medium",onClick:()=>N(e.server_id),disabled:m||l,children:"Select All"}),(0,s.jsx)("button",{className:"text-sm text-blue-600 hover:text-blue-700 font-medium",onClick:()=>w(e.server_id),disabled:m||l,children:"Deselect All"}),(0,s.jsx)("button",{className:"text-gray-400 hover:text-gray-600",onClick:()=>{},children:(0,s.jsx)(o.Z,{className:"w-4 h-4"})})]})]}),(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsx)(n.x,{className:"text-sm font-medium text-gray-700 mb-3",children:"Available Tools"}),l&&(0,s.jsxs)("div",{className:"flex items-center justify-center py-8",children:[(0,s.jsx)(i.Z,{size:"large"}),(0,s.jsx)(n.x,{className:"ml-3 text-gray-500",children:"Loading tools..."})]}),u&&!l&&(0,s.jsxs)("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg text-center",children:[(0,s.jsx)(n.x,{className:"text-red-600 font-medium",children:"Unable to load tools"}),(0,s.jsx)(n.x,{className:"text-sm text-red-500 mt-1",children:u})]}),!l&&!u&&a.length>0&&(0,s.jsx)("div",{className:"space-y-2",children:a.map(t=>{let a=r.includes(t.name);return(0,s.jsxs)("div",{className:"flex items-start gap-2",children:[(0,s.jsx)(c.Z,{checked:a,onChange:()=>j(e.server_id,t.name),disabled:m}),(0,s.jsx)("div",{className:"flex-1 min-w-0",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(n.x,{className:"font-medium text-gray-900",children:t.name}),(0,s.jsxs)(n.x,{className:"text-sm text-gray-500",children:["- ",t.description||"No description"]})]})})]},t.name)})}),!l&&!u&&0===a.length&&(0,s.jsx)("div",{className:"text-center py-6",children:(0,s.jsx)(n.x,{className:"text-gray-500",children:"No tools available"})})]})]},e.server_id)})})}},10703:function(e,t,a){a.d(t,{p:function(){return r}});var s=a(19250);let r=async e=>{try{let t=await (0,s.modelHubCall)(e);if(console.log("model_info:",t),(null==t?void 0:t.data.length)>0){let e=t.data.map(e=>({model_group:e.model_group,mode:null==e?void 0:e.mode}));return e.sort((e,t)=>e.model_group.localeCompare(t.model_group)),e}return[]}catch(e){throw console.error("Error fetching model info:",e),e}}},24199:function(e,t,a){a.d(t,{Z:function(){return l}});var s=a(57437);a(2265);var r=a(30150),l=e=>{let{step:t=.01,style:a={width:"100%"},placeholder:l="Enter a numerical value",min:n,max:i,onChange:c,...o}=e;return(0,s.jsx)(r.Z,{onWheel:e=>e.currentTarget.blur(),step:t,style:a,placeholder:l,min:n,max:i,onChange:c,...o})}},54507:function(e,t,a){a.d(t,{Z:function(){return v}});var s=a(57437);a(2265);var r=a(37592),l=a(99981),n=a(23496),i=a(15424),c=a(78489),o=a(12514),d=a(49566),u=a(91777),m=a(82182),g=a(22452),p=a(74998),x=a(97434),h=a(24199);let{Option:f}=r.default;var v=e=>{let{value:t=[],onChange:a,disabledCallbacks:v=[],onDisabledCallbacksChange:_}=e,y=Object.entries(x.Dg).filter(e=>{let[t,a]=e;return a.supports_key_team_logging}).map(e=>{let[t,a]=e;return t}),b=Object.keys(x.Dg),j=e=>{null==a||a(e)},N=e=>{j(t.filter((t,a)=>a!==e))},w=(e,a,s)=>{let r=[...t];if("callback_name"===a){let t=x.Lo[s]||s;r[e]={...r[e],[a]:t,callback_vars:{}}}else r[e]={...r[e],[a]:s};j(r)},k=(e,a,s)=>{let r=[...t];r[e]={...r[e],callback_vars:{...r[e].callback_vars,[a]:s}},j(r)},C=(e,t)=>{var a,r;if(!e.callback_name)return null;let n=null===(a=Object.entries(x.Lo).find(t=>{let[a,s]=t;return s===e.callback_name}))||void 0===a?void 0:a[0];if(!n)return null;let c=(null===(r=x.Dg[n])||void 0===r?void 0:r.dynamic_params)||{};return 0===Object.keys(c).length?null:(0,s.jsxs)("div",{className:"mt-6 pt-4 border-t border-gray-100",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2 mb-4",children:[(0,s.jsx)("div",{className:"w-3 h-3 bg-blue-100 rounded-full flex items-center justify-center",children:(0,s.jsx)("div",{className:"w-1.5 h-1.5 bg-blue-500 rounded-full"})}),(0,s.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Integration Parameters"})]}),(0,s.jsx)("div",{className:"grid grid-cols-1 gap-4",children:Object.entries(c).map(a=>{let[r,n]=a;return(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("label",{className:"text-sm font-medium text-gray-700 capitalize flex items-center space-x-1",children:[(0,s.jsx)("span",{children:r.replace(/_/g," ")}),(0,s.jsx)(l.Z,{title:"Environment variable reference recommended: os.environ/".concat(r.toUpperCase()),children:(0,s.jsx)(i.Z,{className:"text-gray-400 cursor-help text-xs"})}),"password"===n&&(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:"Sensitive"}),"number"===n&&(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:"Number"})]}),"number"===n&&(0,s.jsx)("span",{className:"text-xs text-gray-500",children:"Value must be between 0 and 1"}),"number"===n?(0,s.jsx)(h.Z,{step:.01,width:400,placeholder:"os.environ/".concat(r.toUpperCase()),value:e.callback_vars[r]||"",onChange:e=>k(t,r,e.target.value)}):(0,s.jsx)(d.Z,{type:"password"===n?"password":"text",placeholder:"os.environ/".concat(r.toUpperCase()),value:e.callback_vars[r]||"",onChange:e=>k(t,r,e.target.value)})]},r)})})]})};return(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(u.Z,{className:"w-5 h-5 text-red-500"}),(0,s.jsx)("span",{className:"text-base font-semibold text-gray-800",children:"Disabled Callbacks"}),(0,s.jsx)(l.Z,{title:"Select callbacks to disable for this key. Disabled callbacks will not receive any logging data.",children:(0,s.jsx)(i.Z,{className:"text-gray-400 cursor-help"})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Disabled Callbacks"}),(0,s.jsx)(r.default,{mode:"multiple",placeholder:"Select callbacks to disable",value:v,onChange:e=>{let t=(0,x.Z3)(e);null==_||_(t)},style:{width:"100%"},optionLabelProp:"label",children:b.map(e=>{var t,a;let r=null===(t=x.Dg[e])||void 0===t?void 0:t.logo,n=null===(a=x.Dg[e])||void 0===a?void 0:a.description;return(0,s.jsx)(f,{value:e,label:e,children:(0,s.jsx)(l.Z,{title:n,placement:"right",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[r&&(0,s.jsx)("img",{src:r,alt:e,className:"w-4 h-4 object-contain",onError:t=>{let a=t.target,s=a.parentElement;if(s){let t=document.createElement("div");t.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",t.textContent=e.charAt(0),s.replaceChild(t,a)}}}),(0,s.jsx)("span",{children:e})]})})},e)})}),(0,s.jsx)("div",{className:"text-xs text-gray-500",children:"Select callbacks that should be disabled for this key. These callbacks will not receive any logging data."})]})]}),(0,s.jsx)(n.Z,{}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(m.Z,{className:"w-5 h-5 text-blue-500"}),(0,s.jsx)("span",{className:"text-base font-semibold text-gray-800",children:"Logging Integrations"}),(0,s.jsx)(l.Z,{title:"Configure callback logging integrations for this team.",children:(0,s.jsx)(i.Z,{className:"text-gray-400 cursor-help"})})]}),(0,s.jsx)(c.Z,{variant:"secondary",onClick:()=>{j([...t,{callback_name:"",callback_type:"success",callback_vars:{}}])},icon:g.Z,size:"sm",className:"hover:border-blue-400 hover:text-blue-500",type:"button",children:"Add Integration"})]}),(0,s.jsx)("div",{className:"space-y-4",children:t.map((e,t)=>{var a,n;let i=e.callback_name?null===(a=Object.entries(x.Lo).find(t=>{let[a,s]=t;return s===e.callback_name}))||void 0===a?void 0:a[0]:void 0,d=i?null===(n=x.Dg[i])||void 0===n?void 0:n.logo:null;return(0,s.jsxs)(o.Z,{className:"border border-gray-200 shadow-sm hover:shadow-md transition-shadow duration-200",decoration:"top",decorationColor:"blue",children:[(0,s.jsxs)("div",{className:"flex justify-between items-start mb-4",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[d&&(0,s.jsx)("img",{src:d,alt:i,className:"w-5 h-5 object-contain"}),(0,s.jsxs)("span",{className:"text-sm font-medium",children:[i||"New Integration"," Configuration"]})]}),(0,s.jsx)(c.Z,{variant:"light",onClick:()=>N(t),icon:p.Z,size:"xs",color:"red",className:"hover:bg-red-50",type:"button",children:"Remove"})]}),(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Integration Type"}),(0,s.jsx)(r.default,{value:i,placeholder:"Select integration",onChange:e=>w(t,"callback_name",e),className:"w-full",optionLabelProp:"label",children:y.map(e=>{var t,a;let r=null===(t=x.Dg[e])||void 0===t?void 0:t.logo,n=null===(a=x.Dg[e])||void 0===a?void 0:a.description;return(0,s.jsx)(f,{value:e,label:e,children:(0,s.jsx)(l.Z,{title:n,placement:"right",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[r&&(0,s.jsx)("img",{src:r,alt:e,className:"w-4 h-4 object-contain",onError:t=>{let a=t.target,s=a.parentElement;if(s){let t=document.createElement("div");t.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",t.textContent=e.charAt(0),s.replaceChild(t,a)}}}),(0,s.jsx)("span",{children:e})]})})},e)})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Event Type"}),(0,s.jsxs)(r.default,{value:e.callback_type,onChange:e=>w(t,"callback_type",e),className:"w-full",children:[(0,s.jsx)(f,{value:"success",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,s.jsx)("span",{children:"Success Only"})]})}),(0,s.jsx)(f,{value:"failure",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-red-500 rounded-full"}),(0,s.jsx)("span",{children:"Failure Only"})]})}),(0,s.jsx)(f,{value:"success_and_failure",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,s.jsx)("span",{children:"Success & Failure"})]})})]})]})]}),C(e,t)]})]},t)})}),0===t.length&&(0,s.jsxs)("div",{className:"text-center py-12 text-gray-500 border-2 border-dashed border-gray-200 rounded-lg bg-gray-50/50",children:[(0,s.jsx)(m.Z,{className:"w-12 h-12 text-gray-300 mb-3 mx-auto"}),(0,s.jsx)("div",{className:"text-base font-medium mb-1",children:"No logging integrations configured"}),(0,s.jsx)("div",{className:"text-sm text-gray-400",children:'Click "Add Integration" to configure logging for this team'})]})]})}},97415:function(e,t,a){var s=a(57437),r=a(2265),l=a(37592),n=a(19250);t.Z=e=>{let{onChange:t,value:a,className:i,accessToken:c,placeholder:o="Select vector stores",disabled:d=!1}=e,[u,m]=(0,r.useState)([]),[g,p]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{(async()=>{if(c){p(!0);try{let e=await (0,n.vectorStoreListCall)(c);e.data&&m(e.data)}catch(e){console.error("Error fetching vector stores:",e)}finally{p(!1)}}})()},[c]),(0,s.jsx)("div",{children:(0,s.jsx)(l.default,{mode:"multiple",placeholder:o,onChange:t,value:a,loading:g,className:i,options:u.map(e=>({label:"".concat(e.vector_store_name||e.vector_store_id," (").concat(e.vector_store_id,")"),value:e.vector_store_id,title:e.vector_store_description||e.vector_store_id})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"},disabled:d})})}},59872:function(e,t,a){a.d(t,{nl:function(){return r},pw:function(){return l},vQ:function(){return n}});var s=a(9114);function r(e,t){let a=structuredClone(e);for(let[e,s]of Object.entries(t))e in a&&(a[e]=s);return a}let l=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(null==e||!Number.isFinite(e))return"-";let s={minimumFractionDigits:t,maximumFractionDigits:t};if(!a)return e.toLocaleString("en-US",s);let r=Math.abs(e),l=r,n="";return r>=1e6?(l=r/1e6,n="M"):r>=1e3&&(l=r/1e3,n="K"),"".concat(e<0?"-":"").concat(l.toLocaleString("en-US",s)).concat(n)},n=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Copied to clipboard";if(!e)return!1;if(!navigator||!navigator.clipboard||!navigator.clipboard.writeText)return i(e,t);try{return await navigator.clipboard.writeText(e),s.Z.success(t),!0}catch(a){return console.error("Clipboard API failed: ",a),i(e,t)}},i=(e,t)=>{try{let a=document.createElement("textarea");a.value=e,a.style.position="fixed",a.style.left="-999999px",a.style.top="-999999px",a.setAttribute("readonly",""),document.body.appendChild(a),a.focus(),a.select();let r=document.execCommand("copy");if(document.body.removeChild(a),r)return s.Z.success(t),!0;throw Error("execCommand failed")}catch(e){return s.Z.fromBackend("Failed to copy to clipboard"),console.error("Failed to copy: ",e),!1}}},20347:function(e,t,a){a.d(t,{LQ:function(){return l},P4:function(){return i},ZL:function(){return s},lo:function(){return r},tY:function(){return n}});let s=["Admin","Admin Viewer","proxy_admin","proxy_admin_viewer","org_admin"],r=["Internal User","Internal Viewer"],l=["Internal User","Admin","proxy_admin"],n=e=>s.includes(e),i=e=>"proxy_admin"===e||"Admin"===e}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/5301-92cec930d7b4b830.js b/litellm/proxy/_experimental/out/_next/static/chunks/5301-92cec930d7b4b830.js new file mode 100644 index 0000000000..4ddd9818c1 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/5301-92cec930d7b4b830.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5301],{19046:function(e,t,s){s.d(t,{Dx:function(){return l.Z},Zb:function(){return o.Z},oi:function(){return n.Z},xv:function(){return r.Z},zx:function(){return a.Z}});var a=s(78489),o=s(12514),r=s(84264),n=s(49566),l=s(96761)},88712:function(e,t,s){var a=s(57437);s(2265);var o=s(33145),r=s(66830),n=s(50010);t.Z=e=>{let{message:t}=e;if(!(0,r.br)(t))return null;let s="string"==typeof t.content&&t.content.includes("[PDF attached]");return(0,a.jsx)("div",{className:"mb-2",children:s?(0,a.jsx)("div",{className:"w-64 h-32 rounded-md border border-gray-200 bg-red-50 flex items-center justify-center",children:(0,a.jsx)(n.Z,{style:{fontSize:"48px",color:"#dc2626"}})}):(0,a.jsx)(o.default,{src:t.imagePreviewUrl||"",alt:"User uploaded image",width:256,height:200,className:"max-w-64 rounded-md border border-gray-200 shadow-sm",style:{maxHeight:"200px",width:"auto",height:"auto"}})})}},27930:function(e,t,s){var a=s(57437);s(2265);var o=s(65319),r=s(99981),n=s(53508);let{Dragger:l}=o.default;t.Z=e=>{let{chatUploadedImage:t,chatImagePreviewUrl:s,onImageUpload:o,onRemoveImage:i}=e;return(0,a.jsx)(a.Fragment,{children:!t&&(0,a.jsx)(l,{beforeUpload:o,accept:"image/*,.pdf",showUploadList:!1,className:"inline-block",style:{padding:0,border:"none",background:"none"},children:(0,a.jsx)(r.Z,{title:"Attach image or PDF",children:(0,a.jsx)("button",{type:"button",className:"flex items-center justify-center w-8 h-8 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-md transition-colors",children:(0,a.jsx)(n.Z,{style:{fontSize:"16px"}})})})})})}},66830:function(e,t,s){s.d(t,{Hk:function(){return r},Sn:function(){return o},br:function(){return n}});let a=e=>new Promise((t,s)=>{let a=new FileReader;a.onload=()=>{t(a.result)},a.onerror=s,a.readAsDataURL(e)}),o=async(e,t)=>({role:"user",content:[{type:"text",text:e},{type:"image_url",image_url:{url:await a(t)}}]}),r=(e,t,s,a)=>{let o="";t&&a&&(o=a.toLowerCase().endsWith(".pdf")?"[PDF attached]":"[Image attached]");let r={role:"user",content:t?"".concat(e," ").concat(o):e};return t&&s&&(r.imagePreviewUrl=s),r},n=e=>"user"===e.role&&"string"==typeof e.content&&(e.content.includes("[Image attached]")||e.content.includes("[PDF attached]"))&&!!e.imagePreviewUrl},75301:function(e,t,s){s.d(t,{Z:function(){return e0}});var a=s(57437),o=s(61935),r=s(92403),n=s(12660),l=s(25980),i=s(69993),c=s(55322),d=s(71891),m=s(58630),u=s(15424),x=s(44625),g=s(57400),p=s(26430),h=s(11894),f=s(15883),v=s(99890),b=s(26349),y=s(50010),j=s(79276),N=s(19046),w=s(4260),S=s(65319),k=s(57840),P=s(37592),A=s(79326),C=s(5545),Z=s(99981),T=s(10353),_=s(22116),E=s(2265),I=s(62831),R=s(17906),M=s(94263),L=s(93837),O=s(9309),K=s(67479),U=s(9114),D=s(99020),z=s(97415),F=s(92280),B=s(61994),H=s(19015),G=s(85847),q=e=>{let{temperature:t=1,maxTokens:s=2048,useAdvancedParams:o,onTemperatureChange:r,onMaxTokensChange:n,onUseAdvancedParamsChange:l}=e,[i,c]=(0,E.useState)(!1),d=void 0!==o?o:i,[m,x]=(0,E.useState)(t),[g,p]=(0,E.useState)(s);(0,E.useEffect)(()=>{x(t)},[t]),(0,E.useEffect)(()=>{p(s)},[s]);let h=e=>{let t=null!=e?e:1;x(t),null==r||r(t)},f=e=>{let t=null!=e?e:1e3;p(t),null==n||n(t)},v=d?"text-gray-700":"text-gray-400",b=e=>{l?l(e):c(e)};return(0,a.jsxs)("div",{className:"space-y-4 p-4 w-80",children:[(0,a.jsx)(B.Z,{checked:d,onChange:e=>b(e.target.checked),children:(0,a.jsx)("span",{className:"font-medium",children:"Use Advanced Parameters"})}),(0,a.jsxs)("div",{className:"space-y-4 transition-opacity duration-200",style:{opacity:d?1:.4},children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(F.x,{className:"text-sm ".concat(v),children:"Temperature"}),(0,a.jsx)(Z.Z,{title:"Controls randomness. Lower values make output more deterministic, higher values more creative.",children:(0,a.jsx)(u.Z,{className:"text-xs ".concat(v," cursor-help")})})]}),(0,a.jsx)(H.Z,{min:0,max:2,step:.1,value:m,onChange:h,disabled:!d,precision:1,className:"w-20"})]}),(0,a.jsx)(G.Z,{min:0,max:2,step:.1,value:m,onChange:h,disabled:!d,marks:{0:"0",1:"1.0",2:"2.0"}})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(F.x,{className:"text-sm ".concat(v),children:"Max Tokens"}),(0,a.jsx)(Z.Z,{title:"Maximum number of tokens to generate in the response.",children:(0,a.jsx)(u.Z,{className:"text-xs ".concat(v," cursor-help")})})]}),(0,a.jsx)(H.Z,{min:1,max:32768,step:1,value:g,onChange:f,disabled:!d})]}),(0,a.jsx)(G.Z,{min:1,max:32768,step:1,value:g,onChange:f,disabled:!d,marks:{1:"1",32768:"32768"}})]})]})]})},J=e=>{let{message:t}=e;return t.isAudio&&"string"==typeof t.content?(0,a.jsx)("div",{className:"mb-2",children:(0,a.jsx)("audio",{controls:!0,src:t.content,className:"max-w-full",style:{maxWidth:"500px"},children:"Your browser does not support the audio element."})}):null},V=s(8443);let W={ALLOY:"Alloy - Professional and confident",ASH:"Ash - Casual and relaxed",BALAD:"Ballad - Smooth and melodic",CORAL:"Coral - Warm and engaging",ECHO:"Echo - Friendly and conversational",FABLE:"Fable - Wise and measured",NOVA:"Nova - Friendly and conversational",ONYX:"Onyx - Deep and authoritative",SAGE:"Sage - Wise and measured",SHIMMER:"Shimmer - Bright and cheerful"},Y=Object.entries({ALLOY:"alloy",ASH:"ash",BALAD:"ballad",CORAL:"coral",ECHO:"echo",FABLE:"fable",NOVA:"nova",ONYX:"onyx",SAGE:"sage",SHIMMER:"shimmer"}).map(e=>{let[t,s]=e;return{value:s,label:W[t]}}),X=[{value:V.KP.CHAT,label:"/v1/chat/completions"},{value:V.KP.RESPONSES,label:"/v1/responses"},{value:V.KP.ANTHROPIC_MESSAGES,label:"/v1/messages"},{value:V.KP.IMAGE,label:"/v1/images/generations"},{value:V.KP.IMAGE_EDITS,label:"/v1/images/edits"},{value:V.KP.EMBEDDINGS,label:"/v1/embeddings"},{value:V.KP.SPEECH,label:"/v1/audio/speech"},{value:V.KP.TRANSCRIPTION,label:"/v1/audio/transcriptions"},{value:V.KP.A2A_AGENTS,label:"/v1/a2a/message/send"}];var $=s(88712),Q=s(27930),ee=s(66830),et=s(82971),es=e=>{let{endpointType:t,onEndpointChange:s,className:o}=e;return(0,a.jsx)("div",{className:o,children:(0,a.jsx)(P.default,{showSearch:!0,value:t,style:{width:"100%"},onChange:s,options:X,className:"rounded-md"})})},ea=s(85498),eo=s(19250);async function er(e,t,s,a){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],r=arguments.length>5?arguments[5]:void 0,n=arguments.length>6?arguments[6]:void 0,l=arguments.length>7?arguments[7]:void 0,i=arguments.length>8?arguments[8]:void 0,c=arguments.length>9?arguments[9]:void 0,d=arguments.length>10?arguments[10]:void 0,m=arguments.length>11?arguments[11]:void 0,u=arguments.length>12?arguments[12]:void 0;if(!a)throw Error("Virtual Key is required");console.log=function(){};let x=(0,eo.getProxyBaseUrl)(),g={};o&&o.length>0&&(g["x-litellm-tags"]=o.join(","));let p=new ea.ZP({apiKey:a,baseURL:x,dangerouslyAllowBrowser:!0,defaultHeaders:g});try{let o=Date.now(),g=!1,h=u&&u.length>0?[{type:"mcp",server_label:"litellm",server_url:"".concat(x,"/mcp"),require_approval:"never",allowed_tools:u,headers:{"x-litellm-api-key":"Bearer ".concat(a)}}]:void 0,f={model:s,messages:e.map(e=>({role:e.role,content:e.content})),stream:!0,max_tokens:1024,litellm_trace_id:c};for await(let e of(d&&(f.vector_store_ids=d),m&&(f.guardrails=m),h&&(f.tools=h,f.tool_choice="auto"),p.messages.stream(f,{signal:r}))){if(console.log("Stream event:",e),"content_block_delta"===e.type){let a=e.delta;if(!g){g=!0;let e=Date.now()-o;console.log("First token received! Time:",e,"ms"),l&&l(e)}"text_delta"===a.type?t("assistant",a.text,s):"reasoning_delta"===a.type&&n&&n(a.text)}if("message_delta"===e.type&&e.usage&&i){let t=e.usage;console.log("Usage data found:",t);let s={completionTokens:t.output_tokens,promptTokens:t.input_tokens,totalTokens:t.input_tokens+t.output_tokens};i(s)}}}catch(e){throw(null==r?void 0:r.aborted)?console.log("Anthropic messages request was cancelled"):U.Z.fromBackend("Error occurred while generating model response. Please try again. Error: ".concat(e)),e}}var en=s(7271);async function el(e,t,s,a,o,r,n,l,i){console.log=function(){},console.log("isLocal:",!1);let c=(0,eo.getProxyBaseUrl)(),d=new en.ZP.OpenAI({apiKey:o,baseURL:c,dangerouslyAllowBrowser:!0,defaultHeaders:r&&r.length>0?{"x-litellm-tags":r.join(",")}:void 0});try{let o=await d.audio.speech.create({model:a,input:e,voice:t,...l?{response_format:l}:{},...i?{speed:i}:{}},{signal:n}),r=await o.blob(),c=URL.createObjectURL(r);s(c,a)}catch(e){throw(null==n?void 0:n.aborted)?console.log("Audio speech request was cancelled"):U.Z.fromBackend("Error occurred while generating speech. Please try again. Error: ".concat(e)),e}}async function ei(e,t,s,a,o,r,n,l,i,c){console.log=function(){},console.log("isLocal:",!1);let d=(0,eo.getProxyBaseUrl)(),m=new en.ZP.OpenAI({apiKey:a,baseURL:d,dangerouslyAllowBrowser:!0,defaultHeaders:o&&o.length>0?{"x-litellm-tags":o.join(",")}:void 0});try{console.log("Processing audio file for transcription:",e.name);let a=await m.audio.transcriptions.create({model:s,file:e,...n?{language:n}:{},...l?{prompt:l}:{},...i?{response_format:i}:{},...void 0!==c?{temperature:c}:{}},{signal:r});if(console.log("Transcription response:",a),a&&a.text)t(a.text,s),U.Z.success("Audio transcribed successfully");else throw Error("No transcription text in response")}catch(e){if(console.error("Error making audio transcription request:",e),null==r?void 0:r.aborted)console.log("Audio transcription request was cancelled");else{var u;let t="Failed to transcribe audio";(null==e?void 0:null===(u=e.error)||void 0===u?void 0:u.message)?t=e.error.message:(null==e?void 0:e.message)&&(t=e.message),U.Z.fromBackend("Audio transcription failed: ".concat(t))}throw e}}var ec=s(95459);async function ed(e,t,s,a,o){if(!a)throw Error("Virtual Key is required");console.log=function(){};let r=(0,eo.getProxyBaseUrl)(),n={};o&&o.length>0&&(n["x-litellm-tags"]=o.join(","));try{var l,i,c;let o=r.endsWith("/")?r.slice(0,-1):r,d=await fetch("".concat(o,"/embeddings"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(a),...n},body:JSON.stringify({model:s,input:e})});if(!d.ok){let e=await d.text();throw Error(e||"Request failed with status ".concat(d.status))}let m=await d.json(),u=null==m?void 0:null===(i=m.data)||void 0===i?void 0:null===(l=i[0])||void 0===l?void 0:l.embedding;if(!u)throw Error("No embedding returned from server");t(JSON.stringify(u),null!==(c=null==m?void 0:m.model)&&void 0!==c?c:s)}catch(e){throw U.Z.fromBackend("Error occurred while making embeddings request. Please try again. Error: ".concat(e)),e}}async function em(e){try{return(await (0,eo.mcpToolsCall)(e)).tools||[]}catch(e){return console.error("Error fetching MCP tools:",e),[]}}var eu=s(10703);async function ex(e,t,s,a,o,r,n){console.log=function(){},console.log("isLocal:",!1);let l=(0,eo.getProxyBaseUrl)(),i=new en.ZP.OpenAI({apiKey:o,baseURL:l,dangerouslyAllowBrowser:!0,defaultHeaders:r&&r.length>0?{"x-litellm-tags":r.join(",")}:void 0});try{let o=Array.isArray(e)?e:[e],r=[];for(let e=0;e1&&U.Z.success("Successfully processed ".concat(r.length," images"))}catch(e){if(console.error("Error making image edit request:",e),null==n?void 0:n.aborted)console.log("Image edits request was cancelled");else{var c;let t="Failed to edit image(s)";(null==e?void 0:null===(c=e.error)||void 0===c?void 0:c.message)?t=e.error.message:(null==e?void 0:e.message)&&(t=e.message),U.Z.fromBackend("Image edit failed: ".concat(t))}throw e}}async function eg(e,t,s,a,o,r){console.log=function(){},console.log("isLocal:",!1);let n=(0,eo.getProxyBaseUrl)(),l=new en.ZP.OpenAI({apiKey:a,baseURL:n,dangerouslyAllowBrowser:!0,defaultHeaders:o&&o.length>0?{"x-litellm-tags":o.join(",")}:void 0});try{let a=await l.images.generate({model:s,prompt:e},{signal:r});if(console.log(a.data),a.data&&a.data[0]){if(a.data[0].url)t(a.data[0].url,s);else if(a.data[0].b64_json){let e=a.data[0].b64_json;t("data:image/png;base64,".concat(e),s)}else throw Error("No image data found in response")}else throw Error("Invalid response format")}catch(e){throw(null==r?void 0:r.aborted)?console.log("Image generation request was cancelled"):U.Z.fromBackend("Error occurred while generating image. Please try again. Error: ".concat(e)),e}}async function ep(e,t,s,a){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],r=arguments.length>5?arguments[5]:void 0,n=arguments.length>6?arguments[6]:void 0,l=arguments.length>7?arguments[7]:void 0,i=arguments.length>8?arguments[8]:void 0,c=arguments.length>9?arguments[9]:void 0,d=arguments.length>10?arguments[10]:void 0,m=arguments.length>11?arguments[11]:void 0,u=arguments.length>12?arguments[12]:void 0,x=arguments.length>13?arguments[13]:void 0,g=arguments.length>14?arguments[14]:void 0,p=arguments.length>15?arguments[15]:void 0;if(!a)throw Error("Virtual Key is required");console.log=function(){};let h=(0,eo.getProxyBaseUrl)(),f={};o&&o.length>0&&(f["x-litellm-tags"]=o.join(","));let v=new en.ZP.OpenAI({apiKey:a,baseURL:h,dangerouslyAllowBrowser:!0,defaultHeaders:f});try{let a=Date.now(),o=!1,h=e.map(e=>(Array.isArray(e.content),{role:e.role,content:e.content,type:"message"})),f=u&&u.length>0?[{type:"mcp",server_label:"litellm",server_url:"litellm_proxy/mcp",require_approval:"never",allowed_tools:u}]:void 0,P=await v.responses.create({model:s,input:h,stream:!0,litellm_trace_id:c,...x?{previous_response_id:x}:{},...d?{vector_store_ids:d}:{},...m?{guardrails:m}:{},...f?{tools:f,tool_choice:"required"}:{}},{signal:r}),A="";for await(let e of P)if(console.log("Response event:",e),"object"==typeof e&&null!==e){var b,y,j,N,w,S,k;if(((null===(b=e.type)||void 0===b?void 0:b.startsWith("response.mcp_"))||"response.output_item.done"===e.type&&((null===(y=e.item)||void 0===y?void 0:y.type)==="mcp_list_tools"||(null===(j=e.item)||void 0===j?void 0:j.type)==="mcp_call"))&&(console.log("MCP event received:",e),p)){let t={type:e.type,sequence_number:e.sequence_number,output_index:e.output_index,item_id:e.item_id||(null===(S=e.item)||void 0===S?void 0:S.id),item:e.item,delta:e.delta,arguments:e.arguments,timestamp:Date.now()};p(t)}if("response.output_item.done"===e.type&&(null===(N=e.item)||void 0===N?void 0:N.type)==="mcp_call"&&(null===(w=e.item)||void 0===w?void 0:w.name)&&(A=e.item.name,console.log("MCP tool used:",A)),"response.role.delta"===e.type)continue;if("response.output_text.delta"===e.type&&"string"==typeof e.delta){let r=e.delta;if(console.log("Text delta",r),r.trim().length>0&&(t("assistant",r,s),!o)){o=!0;let e=Date.now()-a;console.log("First token received! Time:",e,"ms"),l&&l(e)}}if("response.reasoning.delta"===e.type&&"delta"in e){let t=e.delta;"string"==typeof t&&n&&n(t)}if("response.completed"===e.type&&"response"in e){let t=e.response,s=t.usage;if(console.log("Usage data:",s),console.log("Response completed event:",t),t.id&&g&&(console.log("Response ID for session management:",t.id),g(t.id)),s&&i){console.log("Usage data:",s);let e={completionTokens:s.output_tokens,promptTokens:s.input_tokens,totalTokens:s.total_tokens};(null===(k=s.completion_tokens_details)||void 0===k?void 0:k.reasoning_tokens)&&(e.reasoningTokens=s.completion_tokens_details.reasoning_tokens),i(e,A)}}}return P}catch(e){throw(null==r?void 0:r.aborted)?console.log("Responses API request was cancelled"):U.Z.fromBackend("Error occurred while generating model response. Please try again. Error: ".concat(e)),e}}let eh=async e=>{try{let t=(0,eo.getProxyBaseUrl)(),s=await fetch(t?"".concat(t,"/v1/agents"):"/v1/agents",{method:"GET",headers:{Authorization:"Bearer ".concat(e),"Content-Type":"application/json"}});if(!s.ok){let e=await s.json();throw Error(e.detail||"Failed to fetch agents")}let a=await s.json();return console.log("Fetched agents:",a),a.sort((e,t)=>{let s=e.agent_name||e.agent_id,a=t.agent_name||t.agent_id;return s.localeCompare(a)}),a}catch(e){throw console.error("Error fetching agents:",e),e}},ef=e=>{if(!e)return;let t={};if(e.id&&(t.taskId=e.id),e.contextId&&(t.contextId=e.contextId),e.status){var s;if(t.status={state:e.status.state,timestamp:e.status.timestamp},null===(s=e.status.message)||void 0===s?void 0:s.parts){let s=e.status.message.parts.filter(e=>"text"===e.kind&&e.text).map(e=>e.text).join(" ");s&&(t.status.message=s)}}return e.metadata&&"object"==typeof e.metadata&&(t.metadata=e.metadata),Object.keys(t).length>0?t:void 0},ev=async(e,t,s,a,o,r,n,l)=>{let i;let c=(0,eo.getProxyBaseUrl)(),d=c?"".concat(c,"/a2a/").concat(e):"/a2a/".concat(e),m=(0,L.Z)(),u=(0,L.Z)().replace(/-/g,""),x=performance.now(),g=!1,p="";try{var h,f,v,b;let c=await fetch(d,{method:"POST",headers:{Authorization:"Bearer ".concat(a),"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:m,method:"message/stream",params:{message:{kind:"message",messageId:u,role:"user",parts:[{kind:"text",text:t}]}}}),signal:o});if(!c.ok){let e=await c.json();throw Error((null===(f=e.error)||void 0===f?void 0:f.message)||e.detail||"HTTP ".concat(c.status))}let y=null===(h=c.body)||void 0===h?void 0:h.getReader();if(!y)throw Error("No response body");let j=new TextDecoder,N="",w=!1;for(;!w;){let t=await y.read();w=t.done;let a=t.value;if(w)break;let o=(N+=j.decode(a,{stream:!0})).split("\n");for(let t of(N=o.pop()||"",o))if(t.trim())try{let a=JSON.parse(t);if(!g){g=!0;let e=performance.now()-x;r&&r(e)}let o=a.result;if(o){let t=ef(o);t&&(i={...i,...t});let a=o.kind;if("artifact-update"===a&&o.artifact){let t=o.artifact;if(t.parts&&Array.isArray(t.parts))for(let a of t.parts)"text"===a.kind&&a.text&&(p+=a.text,s(p,"a2a_agent/".concat(e)))}else if(o.artifacts&&Array.isArray(o.artifacts)){for(let t of o.artifacts)if(t.parts&&Array.isArray(t.parts))for(let a of t.parts)"text"===a.kind&&a.text&&(p+=a.text,s(p,"a2a_agent/".concat(e)))}else if("status-update"===a&&(null===(b=o.status)||void 0===b?void 0:null===(v=b.message)||void 0===v?void 0:v.parts)){if(!p)for(let t of o.status.message.parts)"text"===t.kind&&t.text&&s(t.text,"a2a_agent/".concat(e))}else if(o.parts&&Array.isArray(o.parts))for(let t of o.parts)"text"===t.kind&&t.text&&(p+=t.text,s(p,"a2a_agent/".concat(e)))}if(a.error)throw Error(a.error.message)}catch(e){t.trim().length>0&&console.warn("Failed to parse A2A streaming chunk:",t,e)}}let S=performance.now()-x;n&&n(S),i&&l&&l(i)}catch(e){if(null==o?void 0:o.aborted){console.log("A2A streaming request was cancelled");return}throw console.error("A2A stream message error:",e),e}};var eb=s(83669),ey=s(29271),ej=s(5540),eN=s(38434),ew=s(23639),eS=s(62272),ek=s(70464),eP=s(77565);let eA=e=>{switch(e){case"completed":return(0,a.jsx)(eb.Z,{className:"text-green-500"});case"working":case"submitted":return(0,a.jsx)(o.Z,{className:"text-blue-500"});case"failed":case"canceled":return(0,a.jsx)(ey.Z,{className:"text-red-500"});default:return(0,a.jsx)(ej.Z,{className:"text-gray-500"})}},eC=e=>{switch(e){case"completed":return"bg-green-100 text-green-700";case"working":case"submitted":return"bg-blue-100 text-blue-700";case"failed":case"canceled":return"bg-red-100 text-red-700";default:return"bg-gray-100 text-gray-700"}},eZ=e=>{if(!e)return null;try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch(t){return e}},eT=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return e?e.length>t?"".concat(e.substring(0,t),"…"):e:null},e_=e=>{navigator.clipboard.writeText(e)};var eE=e=>{let{a2aMetadata:t,timeToFirstToken:s,totalLatency:o}=e,[r,n]=(0,E.useState)(!1);if(!t&&!s&&!o)return null;let{taskId:l,contextId:c,status:d,metadata:m}=t||{},u=eZ(null==d?void 0:d.timestamp);return(0,a.jsxs)("div",{className:"a2a-metrics mt-3 pt-2 border-t border-gray-200 text-xs",children:[(0,a.jsxs)("div",{className:"flex items-center mb-2 text-gray-600",children:[(0,a.jsx)(i.Z,{className:"mr-1.5 text-blue-500"}),(0,a.jsx)("span",{className:"font-medium text-gray-700",children:"A2A Metadata"})]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-gray-500 ml-4",children:[(null==d?void 0:d.state)&&(0,a.jsxs)("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ".concat(eC(d.state)),children:[eA(d.state),(0,a.jsx)("span",{className:"ml-1 capitalize",children:d.state})]}),u&&(0,a.jsx)(Z.Z,{title:null==d?void 0:d.timestamp,children:(0,a.jsxs)("span",{className:"flex items-center",children:[(0,a.jsx)(ej.Z,{className:"mr-1"}),u]})}),void 0!==o&&(0,a.jsx)(Z.Z,{title:"Total latency",children:(0,a.jsxs)("span",{className:"flex items-center text-blue-600",children:[(0,a.jsx)(ej.Z,{className:"mr-1"}),(o/1e3).toFixed(2),"s"]})}),void 0!==s&&(0,a.jsx)(Z.Z,{title:"Time to first token",children:(0,a.jsxs)("span",{className:"flex items-center text-green-600",children:["TTFT: ",(s/1e3).toFixed(2),"s"]})})]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-3 text-gray-500 ml-4 mt-1.5",children:[l&&(0,a.jsx)(Z.Z,{title:"Click to copy: ".concat(l),children:(0,a.jsxs)("span",{className:"flex items-center cursor-pointer hover:text-gray-700",onClick:()=>e_(l),children:[(0,a.jsx)(eN.Z,{className:"mr-1"}),"Task: ",eT(l),(0,a.jsx)(ew.Z,{className:"ml-1 text-gray-400 hover:text-gray-600"})]})}),c&&(0,a.jsx)(Z.Z,{title:"Click to copy: ".concat(c),children:(0,a.jsxs)("span",{className:"flex items-center cursor-pointer hover:text-gray-700",onClick:()=>e_(c),children:[(0,a.jsx)(eS.Z,{className:"mr-1"}),"Session: ",eT(c),(0,a.jsx)(ew.Z,{className:"ml-1 text-gray-400 hover:text-gray-600"})]})}),(m||(null==d?void 0:d.message))&&(0,a.jsxs)(C.ZP,{type:"text",size:"small",className:"text-xs text-blue-500 hover:text-blue-700 p-0 h-auto",onClick:()=>n(!r),children:[r?(0,a.jsx)(ek.Z,{}):(0,a.jsx)(eP.Z,{}),(0,a.jsx)("span",{className:"ml-1",children:"Details"})]})]}),r&&(0,a.jsxs)("div",{className:"mt-2 ml-4 p-3 bg-gray-50 rounded-md text-gray-600 border border-gray-200",children:[(null==d?void 0:d.message)&&(0,a.jsxs)("div",{className:"mb-2",children:[(0,a.jsx)("span",{className:"font-medium text-gray-700",children:"Status Message:"}),(0,a.jsx)("span",{className:"ml-2",children:d.message})]}),l&&(0,a.jsxs)("div",{className:"mb-1.5 flex items-center",children:[(0,a.jsx)("span",{className:"font-medium text-gray-700 w-24",children:"Task ID:"}),(0,a.jsx)("code",{className:"ml-2 px-2 py-1 bg-white border border-gray-200 rounded text-xs font-mono",children:l}),(0,a.jsx)(ew.Z,{className:"ml-2 cursor-pointer text-gray-400 hover:text-blue-500",onClick:()=>e_(l)})]}),c&&(0,a.jsxs)("div",{className:"mb-1.5 flex items-center",children:[(0,a.jsx)("span",{className:"font-medium text-gray-700 w-24",children:"Session ID:"}),(0,a.jsx)("code",{className:"ml-2 px-2 py-1 bg-white border border-gray-200 rounded text-xs font-mono",children:c}),(0,a.jsx)(ew.Z,{className:"ml-2 cursor-pointer text-gray-400 hover:text-blue-500",onClick:()=>e_(c)})]}),m&&Object.keys(m).length>0&&(0,a.jsxs)("div",{className:"mt-3",children:[(0,a.jsx)("span",{className:"font-medium text-gray-700",children:"Custom Metadata:"}),(0,a.jsx)("pre",{className:"mt-1.5 p-2 bg-white border border-gray-200 rounded text-xs font-mono overflow-x-auto whitespace-pre-wrap",children:JSON.stringify(m,null,2)})]})]})]})},eI=s(29),eR=s.n(eI),eM=s(44851);let{Text:eL}=k.default,{Panel:eO}=eM.default;var eK=e=>{var t,s;let{events:o,className:r}=e;if(console.log("MCPEventsDisplay: Received events:",o),!o||0===o.length)return console.log("MCPEventsDisplay: No events, returning null"),null;let n=o.find(e=>{var t;return"response.output_item.done"===e.type&&(null===(t=e.item)||void 0===t?void 0:t.type)==="mcp_list_tools"&&e.item.tools&&e.item.tools.length>0}),l=o.filter(e=>{var t;return"response.output_item.done"===e.type&&(null===(t=e.item)||void 0===t?void 0:t.type)==="mcp_call"});return(console.log("MCPEventsDisplay: toolsEvent:",n),console.log("MCPEventsDisplay: mcpCallEvents:",l),n||0!==l.length)?(0,a.jsxs)("div",{className:"jsx-32b14b04f420f3ac "+"mcp-events-display ".concat(r||""),children:[(0,a.jsx)(eR(),{id:"32b14b04f420f3ac",children:'.openai-mcp-tools.jsx-32b14b04f420f3ac{position:relative;margin:0;padding:0}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse.jsx-32b14b04f420f3ac{background:transparent!important;border:none!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-item.jsx-32b14b04f420f3ac{border:none!important;background:transparent!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-header.jsx-32b14b04f420f3ac{padding:0 0 0 20px!important;background:transparent!important;border:none!important;font-size:14px!important;color:#9ca3af!important;font-weight:400!important;line-height:20px!important;min-height:20px!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-header.jsx-32b14b04f420f3ac:hover{background:transparent!important;color:#6b7280!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-content.jsx-32b14b04f420f3ac{border:none!important;background:transparent!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-content-box.jsx-32b14b04f420f3ac{padding:4px 0 0 20px!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-expand-icon.jsx-32b14b04f420f3ac{position:absolute!important;left:2px!important;top:2px!important;color:#9ca3af!important;font-size:10px!important;width:16px!important;height:16px!important;display:-webkit-box!important;display:-webkit-flex!important;display:-moz-box!important;display:-ms-flexbox!important;display:flex!important;-webkit-box-align:center!important;-webkit-align-items:center!important;-moz-box-align:center!important;-ms-flex-align:center!important;align-items:center!important;-webkit-box-pack:center!important;-webkit-justify-content:center!important;-moz-box-pack:center!important;-ms-flex-pack:center!important;justify-content:center!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-expand-icon.jsx-32b14b04f420f3ac:hover{color:#6b7280!important}.openai-vertical-line.jsx-32b14b04f420f3ac{position:absolute;left:9px;top:18px;bottom:0;width:.5px;background-color:#f3f4f6;opacity:.8}.tool-item.jsx-32b14b04f420f3ac{font-family:ui-monospace,SFMono-Regular,"SF Mono",Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:13px;color:#4b5563;line-height:18px;padding:0;margin:0;background:white;position:relative;z-index:1}.mcp-section.jsx-32b14b04f420f3ac{margin-bottom:12px;background:white;position:relative;z-index:1}.mcp-section.jsx-32b14b04f420f3ac:last-child{margin-bottom:0}.mcp-section-header.jsx-32b14b04f420f3ac{font-size:13px;color:#6b7280;font-weight:500;margin-bottom:4px}.mcp-code-block.jsx-32b14b04f420f3ac{background:#f9fafb;border:1px solid#f3f4f6;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;padding:8px;font-size:12px}.mcp-json.jsx-32b14b04f420f3ac{font-family:ui-monospace,SFMono-Regular,"SF Mono",Monaco,Consolas,"Liberation Mono","Courier New",monospace;color:#374151;margin:0;white-space:pre-wrap;word-wrap:break-word}.mcp-approved.jsx-32b14b04f420f3ac{display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-moz-box-align:center;-ms-flex-align:center;align-items:center;font-size:13px;color:#6b7280}.mcp-checkmark.jsx-32b14b04f420f3ac{color:#10b981;margin-right:6px;font-weight:bold}.mcp-response-content.jsx-32b14b04f420f3ac{font-size:13px;color:#374151;line-height:1.5;white-space:pre-wrap;font-family:ui-monospace,SFMono-Regular,"SF Mono",Monaco,Consolas,"Liberation Mono","Courier New",monospace}'}),(0,a.jsxs)("div",{className:"jsx-32b14b04f420f3ac openai-mcp-tools",children:[(0,a.jsx)("div",{className:"jsx-32b14b04f420f3ac openai-vertical-line"}),(0,a.jsxs)(eM.default,{ghost:!0,size:"small",expandIconPosition:"start",defaultActiveKey:n?["list-tools"]:l.map((e,t)=>"mcp-call-".concat(t)),children:[n&&(0,a.jsx)(eO,{header:"List tools",children:(0,a.jsx)("div",{className:"jsx-32b14b04f420f3ac",children:null===(s=n.item)||void 0===s?void 0:null===(t=s.tools)||void 0===t?void 0:t.map((e,t)=>(0,a.jsx)("div",{className:"jsx-32b14b04f420f3ac tool-item",children:e.name},t))})},"list-tools"),l.map((e,t)=>{var s,o,r;return(0,a.jsx)(eO,{header:(null===(s=e.item)||void 0===s?void 0:s.name)||"Tool call",children:(0,a.jsxs)("div",{className:"jsx-32b14b04f420f3ac",children:[(0,a.jsxs)("div",{className:"jsx-32b14b04f420f3ac mcp-section",children:[(0,a.jsx)("div",{className:"jsx-32b14b04f420f3ac mcp-section-header",children:"Request"}),(0,a.jsx)("div",{className:"jsx-32b14b04f420f3ac mcp-code-block",children:(null===(o=e.item)||void 0===o?void 0:o.arguments)&&(0,a.jsx)("pre",{className:"jsx-32b14b04f420f3ac mcp-json",children:(()=>{try{return JSON.stringify(JSON.parse(e.item.arguments),null,2)}catch(t){return e.item.arguments}})()})})]}),(0,a.jsx)("div",{className:"jsx-32b14b04f420f3ac mcp-section",children:(0,a.jsxs)("div",{className:"jsx-32b14b04f420f3ac mcp-approved",children:[(0,a.jsx)("span",{className:"jsx-32b14b04f420f3ac mcp-checkmark",children:"✓"})," Approved"]})}),(null===(r=e.item)||void 0===r?void 0:r.output)&&(0,a.jsxs)("div",{className:"jsx-32b14b04f420f3ac mcp-section",children:[(0,a.jsx)("div",{className:"jsx-32b14b04f420f3ac mcp-section-header",children:"Response"}),(0,a.jsx)("div",{className:"jsx-32b14b04f420f3ac mcp-response-content",children:e.item.output})]})]})},"mcp-call-".concat(t))})]})]})]}):(console.log("MCPEventsDisplay: No valid events found, returning null"),null)},eU=s(94331),eD=s(38398);let ez=e=>new Promise((t,s)=>{let a=new FileReader;a.onload=()=>{t(a.result.split(",")[1])},a.onerror=s,a.readAsDataURL(e)}),eF=async(e,t)=>{let s=await ez(t),a=t.type||(t.name.toLowerCase().endsWith(".pdf")?"application/pdf":"image/jpeg");return{role:"user",content:[{type:"input_text",text:e},{type:"input_image",image_url:"data:".concat(a,";base64,").concat(s)}]}},eB=(e,t,s,a)=>{let o="";t&&a&&(o=a.toLowerCase().endsWith(".pdf")?"[PDF attached]":"[Image attached]");let r={role:"user",content:t?"".concat(e," ").concat(o):e};return t&&s&&(r.imagePreviewUrl=s),r},eH=e=>"user"===e.role&&"string"==typeof e.content&&(e.content.includes("[Image attached]")||e.content.includes("[PDF attached]"))&&!!e.imagePreviewUrl;var eG=e=>{let{message:t}=e;if(!eH(t))return null;let s="string"==typeof t.content&&t.content.includes("[PDF attached]");return(0,a.jsx)("div",{className:"mb-2",children:s?(0,a.jsx)("div",{className:"w-64 h-32 rounded-md border border-gray-200 bg-red-50 flex items-center justify-center",children:(0,a.jsx)(y.Z,{style:{fontSize:"48px",color:"#dc2626"}})}):(0,a.jsx)("img",{src:t.imagePreviewUrl,alt:"User uploaded image",className:"max-w-64 rounded-md border border-gray-200 shadow-sm",style:{maxHeight:"200px"}})})},eq=s(53508);let{Dragger:eJ}=S.default;var eV=e=>{let{responsesUploadedImage:t,responsesImagePreviewUrl:s,onImageUpload:o,onRemoveImage:r}=e;return(0,a.jsx)(a.Fragment,{children:!t&&(0,a.jsx)(eJ,{beforeUpload:o,accept:"image/*,.pdf",showUploadList:!1,className:"inline-block",style:{padding:0,border:"none",background:"none"},children:(0,a.jsx)(Z.Z,{title:"Attach image or PDF",children:(0,a.jsx)("button",{type:"button",className:"flex items-center justify-center w-8 h-8 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-md transition-colors",children:(0,a.jsx)(eq.Z,{style:{fontSize:"16px"}})})})})})},eW=s(33152),eY=s(63709),eX=e=>{let{endpointType:t,responsesSessionId:s,useApiSessionManagement:o,onToggleSessionManagement:r}=e;return t!==V.KP.RESPONSES?null:(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Session Management"}),(0,a.jsx)(Z.Z,{title:"Choose between LiteLLM API session management (using previous_response_id) or UI-based session management (using chat history)",children:(0,a.jsx)(u.Z,{className:"text-gray-400",style:{fontSize:"12px"}})})]}),(0,a.jsx)(eY.Z,{checked:o,onChange:r,checkedChildren:"API",unCheckedChildren:"UI",size:"small"})]}),(0,a.jsxs)("div",{className:"text-xs p-2 rounded-md ".concat(s?"bg-green-50 text-green-700 border border-green-200":"bg-blue-50 text-blue-700 border border-blue-200"),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(u.Z,{style:{fontSize:"12px"}}),(()=>{if(!s)return o?"API Session: Ready":"UI Session: Ready";let e=o?"Response ID":"UI Session",t=s.slice(0,10);return"".concat(e,": ").concat(t,"...")})()]}),s&&(0,a.jsx)(Z.Z,{title:(0,a.jsxs)("div",{className:"text-xs",children:[(0,a.jsx)("div",{className:"mb-1",children:"Copy response ID to continue session:"}),(0,a.jsx)("div",{className:"bg-gray-800 text-gray-100 p-2 rounded font-mono text-xs whitespace-pre-wrap",children:'curl -X POST "your-proxy-url/v1/responses" \\\n -H "Authorization: Bearer your-api-key" \\\n -H "Content-Type: application/json" \\\n -d \'{\n "model": "your-model",\n "input": [{"role": "user", "content": "your message", "type": "message"}],\n "previous_response_id": "'.concat(s,'",\n "stream": true\n }\'')})]}),overlayStyle:{maxWidth:"500px"},children:(0,a.jsx)("button",{onClick:()=>{s&&(navigator.clipboard.writeText(s),U.Z.success("Response ID copied to clipboard!"))},className:"ml-2 p-1 hover:bg-green-100 rounded transition-colors",children:(0,a.jsx)(ew.Z,{style:{fontSize:"12px"}})})})]}),(0,a.jsx)("div",{className:"text-xs opacity-75 mt-1",children:s?o?"LiteLLM API session active - context maintained server-side":"UI session active - context maintained client-side":o?"LiteLLM will manage session using previous_response_id":"UI will manage session using chat history"})]})]})};let{TextArea:e$}=w.default,{Dragger:eQ}=S.default;var e0=e=>{let{accessToken:t,token:s,userRole:w,userID:S,disabledPersonalKeyCreation:F,proxySettings:B}=e,[H,G]=(0,E.useState)(!1),[W,X]=(0,E.useState)([]),[ea,eo]=(0,E.useState)(()=>{let e=sessionStorage.getItem("selectedMCPTools");try{let t=e?JSON.parse(e):[];return Array.isArray(t)?t:t?[t]:[]}catch(e){return console.error("Error parsing selectedMCPTools from sessionStorage",e),[]}}),[en,ef]=(0,E.useState)(!1),[eb,ey]=(0,E.useState)(()=>{let e=sessionStorage.getItem("apiKeySource");if(e)try{return JSON.parse(e)}catch(e){console.error("Error parsing apiKeySource from sessionStorage",e)}return F?"custom":"session"}),[ej,eN]=(0,E.useState)(()=>sessionStorage.getItem("apiKey")||""),[ew,eS]=(0,E.useState)(""),[ek,eP]=(0,E.useState)(()=>{try{let e=sessionStorage.getItem("chatHistory");return e?JSON.parse(e):[]}catch(e){return console.error("Error parsing chatHistory from sessionStorage",e),[]}}),[eA,eC]=(0,E.useState)(void 0),[eZ,eT]=(0,E.useState)(!1),[e_,eI]=(0,E.useState)([]),[eR,eM]=(0,E.useState)([]),[eL,eO]=(0,E.useState)(void 0),ez=(0,E.useRef)(null),[eH,eq]=(0,E.useState)(()=>sessionStorage.getItem("endpointType")||V.KP.CHAT),[eJ,eY]=(0,E.useState)(!1),e0=(0,E.useRef)(null),[e1,e2]=(0,E.useState)(()=>{let e=sessionStorage.getItem("selectedTags");try{return e?JSON.parse(e):[]}catch(e){return console.error("Error parsing selectedTags from sessionStorage",e),[]}}),[e4,e3]=(0,E.useState)(()=>{let e=sessionStorage.getItem("selectedVoice");if(!e)return"alloy";try{return JSON.parse(e)}catch(t){return e}}),[e5,e6]=(0,E.useState)(()=>{let e=sessionStorage.getItem("selectedVectorStores");try{return e?JSON.parse(e):[]}catch(e){return console.error("Error parsing selectedVectorStores from sessionStorage",e),[]}}),[e7,e8]=(0,E.useState)(()=>{let e=sessionStorage.getItem("selectedGuardrails");try{return e?JSON.parse(e):[]}catch(e){return console.error("Error parsing selectedGuardrails from sessionStorage",e),[]}}),[e9,te]=(0,E.useState)(()=>sessionStorage.getItem("messageTraceId")||null),[tt,ts]=(0,E.useState)(()=>sessionStorage.getItem("responsesSessionId")||null),[ta,to]=(0,E.useState)(()=>{let e=sessionStorage.getItem("useApiSessionManagement");return!e||JSON.parse(e)}),[tr,tn]=(0,E.useState)([]),[tl,ti]=(0,E.useState)([]),[tc,td]=(0,E.useState)(null),[tm,tu]=(0,E.useState)(null),[tx,tg]=(0,E.useState)(null),[tp,th]=(0,E.useState)(null),[tf,tv]=(0,E.useState)(null),[tb,ty]=(0,E.useState)(!1),[tj,tN]=(0,E.useState)(""),[tw,tS]=(0,E.useState)("openai"),[tk,tP]=(0,E.useState)([]),[tA,tC]=(0,E.useState)(1),[tZ,tT]=(0,E.useState)(2048),[t_,tE]=(0,E.useState)(!1),tI=(0,E.useRef)(null),tR=async()=>{let e="session"===eb?t:ej;if(e){ef(!0);try{let t=await em(e);X(t)}catch(e){console.error("Error fetching MCP tools:",e)}finally{ef(!1)}}};(0,E.useEffect)(()=>{H&&tR()},[H,t,ej,eb]),(0,E.useEffect)(()=>{tb&&tN((0,et.L)({apiKeySource:eb,accessToken:t,apiKey:ej,inputMessage:ew,chatHistory:ek,selectedTags:e1,selectedVectorStores:e5,selectedGuardrails:e7,selectedMCPTools:ea,endpointType:eH,selectedModel:eA,selectedSdk:tw,selectedVoice:e4,proxySettings:B}))},[tb,tw,eb,t,ej,ew,ek,e1,e5,e7,ea,eH,eA,B]),(0,E.useEffect)(()=>{let e=setTimeout(()=>{sessionStorage.setItem("chatHistory",JSON.stringify(ek))},500);return()=>{clearTimeout(e)}},[ek]),(0,E.useEffect)(()=>{sessionStorage.setItem("apiKeySource",JSON.stringify(eb)),sessionStorage.setItem("apiKey",ej),sessionStorage.setItem("endpointType",eH),sessionStorage.setItem("selectedTags",JSON.stringify(e1)),sessionStorage.setItem("selectedVectorStores",JSON.stringify(e5)),sessionStorage.setItem("selectedGuardrails",JSON.stringify(e7)),sessionStorage.setItem("selectedMCPTools",JSON.stringify(ea)),sessionStorage.setItem("selectedVoice",e4),eA?sessionStorage.setItem("selectedModel",eA):sessionStorage.removeItem("selectedModel"),e9?sessionStorage.setItem("messageTraceId",e9):sessionStorage.removeItem("messageTraceId"),tt?sessionStorage.setItem("responsesSessionId",tt):sessionStorage.removeItem("responsesSessionId"),sessionStorage.setItem("useApiSessionManagement",JSON.stringify(ta))},[eb,ej,eA,eH,e1,e5,e7,e9,tt,ta,ea,e4]),(0,E.useEffect)(()=>{let e="session"===eb?t:ej;if(!e||!s||!w||!S){console.log("userApiKey or token or userRole or userID is missing = ",e,s,w,S);return}(async()=>{try{if(!e){console.log("userApiKey is missing");return}let t=await (0,eu.p)(e);console.log("Fetched models:",t),eI(t);let s=t.some(e=>e.model_group===eA);t.length&&s||eC(void 0)}catch(e){console.error("Error fetching model info:",e)}})(),tR()},[t,S,w,eb,ej,s]),(0,E.useEffect)(()=>{let e="session"===eb?t:ej;e&&eH===V.KP.A2A_AGENTS&&(async()=>{try{let t=await eh(e);eM(t),eL&&!t.some(e=>e.agent_name===eL)&&eO(void 0)}catch(e){console.error("Error fetching agents:",e)}})()},[t,eb,ej,eH]),(0,E.useEffect)(()=>{tI.current&&setTimeout(()=>{var e;null===(e=tI.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"end"})},100)},[ek]);let tM=(e,t,s)=>{console.log("updateTextUI called with:",e,t,s),eP(a=>{let o=a[a.length-1];if(!o||o.role!==e||o.isImage||o.isAudio)return[...a,{role:e,content:t,model:s}];{var r;let e={...o,content:o.content+t,model:null!==(r=o.model)&&void 0!==r?r:s};return[...a.slice(0,-1),e]}})},tL=e=>{eP(t=>{let s=t[t.length-1];return!s||"assistant"!==s.role||s.isImage||s.isAudio?t.length>0&&"user"===t[t.length-1].role?[...t,{role:"assistant",content:"",reasoningContent:e}]:t:[...t.slice(0,t.length-1),{...s,reasoningContent:(s.reasoningContent||"")+e}]})},tO=e=>{console.log("updateTimingData called with:",e),eP(t=>{let s=t[t.length-1];if(console.log("Current last message:",s),s&&"assistant"===s.role){console.log("Updating assistant message with timeToFirstToken:",e);let a=[...t.slice(0,t.length-1),{...s,timeToFirstToken:e}];return console.log("Updated chat history:",a),a}return s&&"user"===s.role?(console.log("Creating new assistant message with timeToFirstToken:",e),[...t,{role:"assistant",content:"",timeToFirstToken:e}]):(console.log("No appropriate message found to update timing"),t)})},tK=(e,t)=>{console.log("Received usage data:",e),eP(s=>{let a=s[s.length-1];if(a&&"assistant"===a.role){console.log("Updating message with usage data:",e);let o={...a,usage:e,toolName:t};return console.log("Updated message:",o),[...s.slice(0,s.length-1),o]}return s})},tU=e=>{console.log("Received A2A metadata:",e),eP(t=>{let s=t[t.length-1];if(s&&"assistant"===s.role){let a={...s,a2aMetadata:e};return[...t.slice(0,t.length-1),a]}return t})},tD=e=>{eP(t=>{let s=t[t.length-1];return s&&"assistant"===s.role?[...t.slice(0,t.length-1),{...s,totalLatency:e}]:t})},tz=e=>{console.log("Received search results:",e),eP(t=>{let s=t[t.length-1];if(s&&"assistant"===s.role){console.log("Updating message with search results");let a={...s,searchResults:e};return[...t.slice(0,t.length-1),a]}return t})},tF=e=>{console.log("Received response ID for session management:",e),ta&&ts(e)},tB=e=>{console.log("ChatUI: Received MCP event:",e),tP(t=>{if(t.some(t=>t.item_id===e.item_id&&t.type===e.type&&t.sequence_number===e.sequence_number))return console.log("ChatUI: Duplicate MCP event, skipping"),t;let s=[...t,e];return console.log("ChatUI: Updated MCP events:",s),s})},tH=(e,t)=>{eP(s=>[...s,{role:"assistant",content:e,model:t,isImage:!0}])},tG=(e,t)=>{eP(s=>[...s,{role:"assistant",content:(0,O.aS)(e,100),model:t,isEmbeddings:!0}])},tq=(e,t)=>{eP(s=>[...s,{role:"assistant",content:e,model:t,isAudio:!0}])},tJ=(e,t)=>{eP(s=>{let a=s[s.length-1];if(!a||"assistant"!==a.role||a.isImage||a.isAudio)return[...s,{role:"assistant",content:"",model:t,image:{url:e,detail:"auto"}}];{var o;let r={...a,image:{url:e,detail:"auto"},model:null!==(o=a.model)&&void 0!==o?o:t};return[...s.slice(0,-1),r]}})},tV=e=>{tn(t=>[...t,e]);let t=URL.createObjectURL(e);return ti(e=>[...e,t]),!1},tW=e=>{tl[e]&&URL.revokeObjectURL(tl[e]),tn(t=>t.filter((t,s)=>s!==e)),ti(t=>t.filter((t,s)=>s!==e))},tY=()=>{tl.forEach(e=>{URL.revokeObjectURL(e)}),tn([]),ti([])},tX=()=>{tm&&URL.revokeObjectURL(tm),td(null),tu(null)},t$=()=>{tp&&URL.revokeObjectURL(tp),tg(null),th(null)},tQ=()=>{tv(null)},t0=async()=>{let e;if(""===ew.trim()&&eH!==V.KP.TRANSCRIPTION)return;if(eH===V.KP.IMAGE_EDITS&&0===tr.length){U.Z.fromBackend("Please upload at least one image for editing");return}if(eH===V.KP.TRANSCRIPTION&&!tf){U.Z.fromBackend("Please upload an audio file for transcription");return}if(eH===V.KP.A2A_AGENTS&&!eL){U.Z.fromBackend("Please select an agent to send a message");return}if(!s||!w||!S)return;let a="session"===eb?t:ej;if(!a){U.Z.fromBackend("Please provide a Virtual Key or select Current UI Session");return}e0.current=new AbortController;let o=e0.current.signal;if(eH===V.KP.RESPONSES&&tc)try{e=await eF(ew,tc)}catch(e){U.Z.fromBackend("Failed to process image. Please try again.");return}else if(eH===V.KP.CHAT&&tx)try{e=await (0,ee.Sn)(ew,tx)}catch(e){U.Z.fromBackend("Failed to process image. Please try again.");return}else e={role:"user",content:ew};let r=e9||(0,L.Z)();e9||te(r),eP([...ek,eH===V.KP.RESPONSES&&tc?eB(ew,!0,tm||void 0,tc.name):eH===V.KP.CHAT&&tx?(0,ee.Hk)(ew,!0,tp||void 0,tx.name):eH===V.KP.TRANSCRIPTION&&tf?eB(ew?"\uD83C\uDFB5 Audio file: ".concat(tf.name,"\nPrompt: ").concat(ew):"\uD83C\uDFB5 Audio file: ".concat(tf.name),!1):eB(ew,!1)]),tP([]),eY(!0);try{if(eA){if(eH===V.KP.CHAT){let t=[...ek.filter(e=>!e.isImage&&!e.isAudio).map(e=>{let{role:t,content:s}=e;return{role:t,content:"string"==typeof s?s:""}}),e];await (0,ec.n)(t,(e,t)=>tM("assistant",e,t),eA,a,e1,o,tL,tO,tK,r,e5.length>0?e5:void 0,e7.length>0?e7:void 0,ea,tJ,tz,t_?tA:void 0,t_?tZ:void 0,tD)}else if(eH===V.KP.IMAGE)await eg(ew,(e,t)=>tH(e,t),eA,a,e1,o);else if(eH===V.KP.SPEECH)await el(ew,e4,(e,t)=>tq(e,t),eA||"",a,e1,o);else if(eH===V.KP.IMAGE_EDITS)tr.length>0&&await ex(1===tr.length?tr[0]:tr,ew,(e,t)=>tH(e,t),eA,a,e1,o);else if(eH===V.KP.RESPONSES){let t;t=ta&&tt?[e]:[...ek.filter(e=>!e.isImage&&!e.isAudio).map(e=>{let{role:t,content:s}=e;return{role:t,content:s}}),e],await ep(t,(e,t,s)=>tM(e,t,s),eA,a,e1,o,tL,tO,tK,r,e5.length>0?e5:void 0,e7.length>0?e7:void 0,ea,ta?tt:null,tF,tB)}else if(eH===V.KP.ANTHROPIC_MESSAGES){let t=[...ek.filter(e=>!e.isImage&&!e.isAudio).map(e=>{let{role:t,content:s}=e;return{role:t,content:s}}),e];await er(t,(e,t,s)=>tM(e,t,s),eA,a,e1,o,tL,tO,tK,r,e5.length>0?e5:void 0,e7.length>0?e7:void 0,ea)}else eH===V.KP.EMBEDDINGS?await ed(ew,(e,t)=>tG(e,t),eA,a,e1):eH===V.KP.TRANSCRIPTION&&tf&&await ei(tf,(e,t)=>tM("assistant",e,t),eA,a,e1,o)}eH===V.KP.A2A_AGENTS&&eL&&await ev(eL,ew,(e,t)=>tM("assistant",e,t),a,o,tO,tD,tU)}catch(e){o.aborted?console.log("Request was cancelled"):(console.error("Error fetching response",e),tM("assistant","Error fetching response:"+e))}finally{eY(!1),e0.current=null,eH===V.KP.IMAGE_EDITS&&tY(),eH===V.KP.RESPONSES&&tc&&tX(),eH===V.KP.CHAT&&tx&&t$(),eH===V.KP.TRANSCRIPTION&&tf&&tQ()}eS("")};if(w&&"Admin Viewer"===w){let{Title:e,Paragraph:t}=k.default;return(0,a.jsxs)("div",{children:[(0,a.jsx)(e,{level:1,children:"Access Denied"}),(0,a.jsx)(t,{children:"Ask your proxy admin for access to test models"})]})}let t1=(0,a.jsx)(o.Z,{style:{fontSize:24},spin:!0});return(0,a.jsxs)("div",{className:"w-full p-4 pb-0 bg-white",children:[(0,a.jsx)(N.Zb,{className:"w-full rounded-xl shadow-md overflow-hidden",children:(0,a.jsxs)("div",{className:"flex h-[80vh] w-full gap-4",children:[(0,a.jsxs)("div",{className:"w-1/4 p-4 bg-gray-50 overflow-y-auto",children:[(0,a.jsx)(N.Dx,{className:"text-xl font-semibold mb-6 mt-2",children:"Configurations"}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)(N.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,a.jsx)(r.Z,{className:"mr-2"})," Virtual Key Source"]}),(0,a.jsx)(P.default,{disabled:F,value:eb,style:{width:"100%"},onChange:e=>{ey(e)},options:[{value:"session",label:"Current UI Session"},{value:"custom",label:"Virtual Key"}],className:"rounded-md"}),"custom"===eb&&(0,a.jsx)(N.oi,{className:"mt-2",placeholder:"Enter custom Virtual Key",type:"password",onValueChange:eN,value:ej,icon:r.Z})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)(N.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,a.jsx)(n.Z,{className:"mr-2"})," Endpoint Type"]}),(0,a.jsx)(es,{endpointType:eH,onEndpointChange:e=>{eq(e),eC(void 0),eO(void 0),eT(!1);try{sessionStorage.removeItem("selectedModel"),sessionStorage.removeItem("selectedAgent")}catch(e){}},className:"mb-4"}),eH===V.KP.SPEECH&&(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsxs)(N.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,a.jsx)(l.Z,{className:"mr-2"}),"Voice"]}),(0,a.jsx)(P.default,{value:e4,onChange:e=>{e3(e),sessionStorage.setItem("selectedVoice",e)},style:{width:"100%"},className:"rounded-md",options:Y})]}),(0,a.jsx)(eX,{endpointType:eH,responsesSessionId:tt,useApiSessionManagement:ta,onToggleSessionManagement:e=>{to(e),e||ts(null)}})]}),eH!==V.KP.A2A_AGENTS&&(0,a.jsxs)("div",{children:[(0,a.jsxs)(N.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center justify-between",children:[(0,a.jsxs)("span",{className:"flex items-center",children:[(0,a.jsx)(i.Z,{className:"mr-2"})," Select Model"]}),(()=>{if(!eA||"custom"===eA)return!1;let e=e_.find(e=>e.model_group===eA);return!!e&&(!e.mode||"chat"===e.mode)})()?(0,a.jsx)(A.Z,{content:(0,a.jsx)(q,{temperature:tA,maxTokens:tZ,useAdvancedParams:t_,onTemperatureChange:tC,onMaxTokensChange:tT,onUseAdvancedParamsChange:tE}),title:"Model Settings",trigger:"click",placement:"right",children:(0,a.jsx)(C.ZP,{type:"text",size:"small",icon:(0,a.jsx)(c.Z,{}),className:"text-gray-500 hover:text-gray-700"})}):(0,a.jsx)(Z.Z,{title:"Advanced parameters are only supported for chat models currently",children:(0,a.jsx)(C.ZP,{type:"text",size:"small",icon:(0,a.jsx)(c.Z,{}),className:"text-gray-300 cursor-not-allowed",disabled:!0})})]}),(0,a.jsx)(P.default,{value:eA,placeholder:"Select a Model",onChange:e=>{console.log("selected ".concat(e)),eC(e),eT("custom"===e)},options:[...Array.from(new Set(e_.filter(e=>{if(!e.mode)return!0;let t=(0,V.vf)(e.mode);return eH===V.KP.RESPONSES||eH===V.KP.ANTHROPIC_MESSAGES?t===eH||t===V.KP.CHAT:eH===V.KP.IMAGE_EDITS?t===eH||t===V.KP.IMAGE:t===eH}).map(e=>e.model_group))).map((e,t)=>({value:e,label:e,key:t})),{value:"custom",label:"Enter custom model",key:"custom"}],style:{width:"100%"},showSearch:!0,className:"rounded-md"}),eZ&&(0,a.jsx)(N.oi,{className:"mt-2",placeholder:"Enter custom model name",onValueChange:e=>{ez.current&&clearTimeout(ez.current),ez.current=setTimeout(()=>{eC(e)},500)}})]}),eH===V.KP.A2A_AGENTS&&(0,a.jsxs)("div",{children:[(0,a.jsxs)(N.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,a.jsx)(i.Z,{className:"mr-2"})," Select Agent"]}),(0,a.jsx)(P.default,{value:eL,placeholder:"Select an Agent",onChange:e=>eO(e),options:eR.map(e=>({value:e.agent_name,label:e.agent_name||e.agent_id,key:e.agent_id})),style:{width:"100%"},showSearch:!0,className:"rounded-md",optionLabelProp:"label",children:eR.map(e=>{var t;return(0,a.jsx)(P.default.Option,{value:e.agent_name,label:e.agent_name||e.agent_id,children:(0,a.jsxs)("div",{className:"flex flex-col py-1",children:[(0,a.jsx)("span",{className:"font-medium",children:e.agent_name||e.agent_id}),(null===(t=e.agent_card_params)||void 0===t?void 0:t.description)&&(0,a.jsx)("span",{className:"text-xs text-gray-500 mt-1",children:e.agent_card_params.description})]})},e.agent_id)})}),0===eR.length&&(0,a.jsx)(N.xv,{className:"text-xs text-gray-500 mt-2 block",children:"No agents found. Create agents via /v1/agents endpoint."})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)(N.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,a.jsx)(d.Z,{className:"mr-2"})," Tags"]}),(0,a.jsx)(D.Z,{value:e1,onChange:e2,className:"mb-4",accessToken:t||""})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)(N.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,a.jsx)(m.Z,{className:"mr-2"})," MCP Tool",(0,a.jsx)(Z.Z,{className:"ml-1",title:"Select MCP tools to use in your conversation, only available for /v1/responses endpoint",children:(0,a.jsx)(u.Z,{})})]}),(0,a.jsx)(P.default,{mode:"multiple",style:{width:"100%"},placeholder:"Select MCP tools",value:ea,onChange:e=>eo(e),loading:en,className:"mb-4",allowClear:!0,optionLabelProp:"label",disabled:eH!==V.KP.RESPONSES,maxTagCount:"responsive",children:Array.isArray(W)&&W.map(e=>(0,a.jsx)(P.default.Option,{value:e.name,label:(0,a.jsx)("div",{className:"font-medium",children:e.name}),children:(0,a.jsxs)("div",{className:"flex flex-col py-1",children:[(0,a.jsx)("span",{className:"font-medium",children:e.name}),(0,a.jsx)("span",{className:"text-xs text-gray-500 mt-1",children:e.description})]})},e.name))})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)(N.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,a.jsx)(x.Z,{className:"mr-2"})," Vector Store",(0,a.jsx)(Z.Z,{className:"ml-1",title:(0,a.jsxs)("span",{children:["Select vector store(s) to use for this LLM API call. You can set up your vector store"," ",(0,a.jsx)("a",{href:"?page=vector-stores",style:{color:"#1890ff"},children:"here"}),"."]}),children:(0,a.jsx)(u.Z,{})})]}),(0,a.jsx)(z.Z,{value:e5,onChange:e6,className:"mb-4",accessToken:t||""})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)(N.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,a.jsx)(g.Z,{className:"mr-2"})," Guardrails",(0,a.jsx)(Z.Z,{className:"ml-1",title:(0,a.jsxs)("span",{children:["Select guardrail(s) to use for this LLM API call. You can set up your guardrails"," ",(0,a.jsx)("a",{href:"?page=guardrails",style:{color:"#1890ff"},children:"here"}),"."]}),children:(0,a.jsx)(u.Z,{})})]}),(0,a.jsx)(K.Z,{value:e7,onChange:e8,className:"mb-4",accessToken:t||""})]})]})]}),(0,a.jsxs)("div",{className:"w-3/4 flex flex-col bg-white",children:[(0,a.jsxs)("div",{className:"p-4 border-b border-gray-200 flex justify-between items-center",children:[(0,a.jsx)(N.Dx,{className:"text-xl font-semibold mb-0",children:"Test Key"}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(N.zx,{onClick:()=>{ek.forEach(e=>{e.isAudio&&"string"==typeof e.content&&URL.revokeObjectURL(e.content)}),eP([]),te(null),ts(null),tP([]),tY(),tX(),t$(),tQ(),sessionStorage.removeItem("chatHistory"),sessionStorage.removeItem("messageTraceId"),sessionStorage.removeItem("responsesSessionId"),U.Z.success("Chat history cleared.")},className:"bg-gray-100 hover:bg-gray-200 text-gray-700 border-gray-300",icon:p.Z,children:"Clear Chat"}),(0,a.jsx)(N.zx,{onClick:()=>ty(!0),className:"bg-gray-100 hover:bg-gray-200 text-gray-700 border-gray-300",icon:h.Z,children:"Get Code"})]})]}),(0,a.jsxs)("div",{className:"flex-1 overflow-auto p-4 pb-0",children:[0===ek.length&&(0,a.jsxs)("div",{className:"h-full flex flex-col items-center justify-center text-gray-400",children:[(0,a.jsx)(i.Z,{style:{fontSize:"48px",marginBottom:"16px"}}),(0,a.jsx)(N.xv,{children:"Start a conversation, generate an image, or handle audio"})]}),ek.map((e,t)=>(0,a.jsx)("div",{children:(0,a.jsx)("div",{className:"mb-4 ".concat("user"===e.role?"text-right":"text-left"),children:(0,a.jsxs)("div",{className:"inline-block max-w-[80%] rounded-lg shadow-sm p-3.5 px-4",style:{backgroundColor:"user"===e.role?"#f0f8ff":"#ffffff",border:"user"===e.role?"1px solid #e6f0fa":"1px solid #f0f0f0",textAlign:"left"},children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-1.5",children:[(0,a.jsx)("div",{className:"flex items-center justify-center w-6 h-6 rounded-full mr-1",style:{backgroundColor:"user"===e.role?"#e6f0fa":"#f5f5f5"},children:"user"===e.role?(0,a.jsx)(f.Z,{style:{fontSize:"12px",color:"#2563eb"}}):(0,a.jsx)(i.Z,{style:{fontSize:"12px",color:"#4b5563"}})}),(0,a.jsx)("strong",{className:"text-sm capitalize",children:e.role}),"assistant"===e.role&&e.model&&(0,a.jsx)("span",{className:"text-xs px-2 py-0.5 rounded bg-gray-100 text-gray-600 font-normal",children:e.model})]}),e.reasoningContent&&(0,a.jsx)(eU.Z,{reasoningContent:e.reasoningContent}),"assistant"===e.role&&t===ek.length-1&&tk.length>0&&eH===V.KP.RESPONSES&&(0,a.jsx)("div",{className:"mb-3",children:(0,a.jsx)(eK,{events:tk})}),"assistant"===e.role&&e.searchResults&&(0,a.jsx)(eW.J,{searchResults:e.searchResults}),(0,a.jsxs)("div",{className:"whitespace-pre-wrap break-words max-w-full message-content",style:{wordWrap:"break-word",overflowWrap:"break-word",wordBreak:"break-word",hyphens:"auto"},children:[e.isImage?(0,a.jsx)("img",{src:"string"==typeof e.content?e.content:"",alt:"Generated image",className:"max-w-full rounded-md border border-gray-200 shadow-sm",style:{maxHeight:"500px"}}):e.isAudio?(0,a.jsx)(J,{message:e}):(0,a.jsxs)(a.Fragment,{children:[eH===V.KP.RESPONSES&&(0,a.jsx)(eG,{message:e}),eH===V.KP.CHAT&&(0,a.jsx)($.Z,{message:e}),(0,a.jsx)(I.UG,{components:{code(e){let{node:t,inline:s,className:o,children:r,...n}=e,l=/language-(\w+)/.exec(o||"");return!s&&l?(0,a.jsx)(R.Z,{style:M.Z,language:l[1],PreTag:"div",className:"rounded-md my-2",wrapLines:!0,wrapLongLines:!0,...n,children:String(r).replace(/\n$/,"")}):(0,a.jsx)("code",{className:"".concat(o," px-1.5 py-0.5 rounded bg-gray-100 text-sm font-mono"),style:{wordBreak:"break-word"},...n,children:r})},pre:e=>{let{node:t,...s}=e;return(0,a.jsx)("pre",{style:{overflowX:"auto",maxWidth:"100%"},...s})}},children:"string"==typeof e.content?e.content:""}),e.image&&(0,a.jsx)("div",{className:"mt-3",children:(0,a.jsx)("img",{src:e.image.url,alt:"Generated image",className:"max-w-full rounded-md border border-gray-200 shadow-sm",style:{maxHeight:"500px"}})})]}),"assistant"===e.role&&(e.timeToFirstToken||e.totalLatency||e.usage)&&!e.a2aMetadata&&(0,a.jsx)(eD.Z,{timeToFirstToken:e.timeToFirstToken,totalLatency:e.totalLatency,usage:e.usage,toolName:e.toolName}),"assistant"===e.role&&e.a2aMetadata&&(0,a.jsx)(eE,{a2aMetadata:e.a2aMetadata,timeToFirstToken:e.timeToFirstToken,totalLatency:e.totalLatency})]})]})})},t)),eJ&&tk.length>0&&eH===V.KP.RESPONSES&&ek.length>0&&"user"===ek[ek.length-1].role&&(0,a.jsx)("div",{className:"text-left mb-4",children:(0,a.jsxs)("div",{className:"inline-block max-w-[80%] rounded-lg shadow-sm p-3.5 px-4",style:{backgroundColor:"#ffffff",border:"1px solid #f0f0f0",textAlign:"left"},children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-1.5",children:[(0,a.jsx)("div",{className:"flex items-center justify-center w-6 h-6 rounded-full mr-1",style:{backgroundColor:"#f5f5f5"},children:(0,a.jsx)(i.Z,{style:{fontSize:"12px",color:"#4b5563"}})}),(0,a.jsx)("strong",{className:"text-sm capitalize",children:"Assistant"})]}),(0,a.jsx)(eK,{events:tk})]})}),eJ&&(0,a.jsx)("div",{className:"flex justify-center items-center my-4",children:(0,a.jsx)(T.Z,{indicator:t1})}),(0,a.jsx)("div",{ref:tI,style:{height:"1px"}})]}),(0,a.jsxs)("div",{className:"p-4 border-t border-gray-200 bg-white",children:[eH===V.KP.IMAGE_EDITS&&(0,a.jsx)("div",{className:"mb-4",children:0===tr.length?(0,a.jsxs)(eQ,{beforeUpload:tV,accept:"image/*",showUploadList:!1,children:[(0,a.jsx)("p",{className:"ant-upload-drag-icon",children:(0,a.jsx)(v.Z,{style:{fontSize:"24px",color:"#666"}})}),(0,a.jsx)("p",{className:"ant-upload-text text-sm",children:"Click or drag images to upload"}),(0,a.jsx)("p",{className:"ant-upload-hint text-xs text-gray-500",children:"Support for PNG, JPG, JPEG formats. Multiple images supported."})]}):(0,a.jsxs)("div",{className:"flex flex-wrap gap-2",children:[tr.map((e,t)=>(0,a.jsxs)("div",{className:"relative inline-block",children:[(0,a.jsx)("img",{src:tl[t]||"",alt:"Upload preview ".concat(t+1),className:"max-w-32 max-h-32 rounded-md border border-gray-200 object-cover"}),(0,a.jsx)("button",{className:"absolute top-1 right-1 bg-white shadow-sm border border-gray-200 rounded px-1 py-1 text-red-500 hover:bg-red-50 text-xs",onClick:()=>tW(t),children:(0,a.jsx)(b.Z,{})})]},t)),(0,a.jsxs)("div",{className:"flex items-center justify-center w-32 h-32 border-2 border-dashed border-gray-300 rounded-md hover:border-gray-400 cursor-pointer",onClick:()=>{var e;return null===(e=document.getElementById("additional-image-upload"))||void 0===e?void 0:e.click()},children:[(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)(v.Z,{style:{fontSize:"24px",color:"#666"}}),(0,a.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Add more"})]}),(0,a.jsx)("input",{id:"additional-image-upload",type:"file",accept:"image/*",multiple:!0,style:{display:"none"},onChange:e=>{Array.from(e.target.files||[]).forEach(e=>tV(e))}})]})]})}),eH===V.KP.TRANSCRIPTION&&(0,a.jsx)("div",{className:"mb-4",children:tf?(0,a.jsxs)("div",{className:"flex items-center gap-3 p-3 bg-gray-50 rounded-lg border border-gray-200",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 flex-1",children:[(0,a.jsx)(l.Z,{style:{fontSize:"20px",color:"#666"}}),(0,a.jsx)("span",{className:"text-sm font-medium",children:tf.name}),(0,a.jsxs)("span",{className:"text-xs text-gray-500",children:["(",(tf.size/1024/1024).toFixed(2)," MB)"]})]}),(0,a.jsxs)("button",{className:"bg-white shadow-sm border border-gray-200 rounded px-2 py-1 text-red-500 hover:bg-red-50 text-xs",onClick:tQ,children:[(0,a.jsx)(b.Z,{})," Remove"]})]}):(0,a.jsxs)(eQ,{beforeUpload:e=>(tv(e),!1),accept:"audio/*,.mp3,.mp4,.mpeg,.mpga,.m4a,.wav,.webm",showUploadList:!1,children:[(0,a.jsx)("p",{className:"ant-upload-drag-icon",children:(0,a.jsx)(l.Z,{style:{fontSize:"24px",color:"#666"}})}),(0,a.jsx)("p",{className:"ant-upload-text text-sm",children:"Click or drag audio file to upload"}),(0,a.jsx)("p",{className:"ant-upload-hint text-xs text-gray-500",children:"Support for MP3, MP4, MPEG, MPGA, M4A, WAV, WEBM formats. Max file size: 25 MB."})]})}),eH===V.KP.RESPONSES&&tc&&(0,a.jsx)("div",{className:"mb-2",children:(0,a.jsxs)("div",{className:"flex items-center gap-3 p-3 bg-gray-50 rounded-lg border border-gray-200",children:[(0,a.jsx)("div",{className:"relative inline-block",children:tc.name.toLowerCase().endsWith(".pdf")?(0,a.jsx)("div",{className:"w-10 h-10 rounded-md bg-red-500 flex items-center justify-center",children:(0,a.jsx)(y.Z,{style:{fontSize:"16px",color:"white"}})}):(0,a.jsx)("img",{src:tm||"",alt:"Upload preview",className:"w-10 h-10 rounded-md border border-gray-200 object-cover"})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("div",{className:"text-sm font-medium text-gray-900 truncate",children:tc.name}),(0,a.jsx)("div",{className:"text-xs text-gray-500",children:tc.name.toLowerCase().endsWith(".pdf")?"PDF":"Image"})]}),(0,a.jsx)("button",{className:"flex items-center justify-center w-6 h-6 text-gray-400 hover:text-gray-600 hover:bg-gray-200 rounded-full transition-colors",onClick:tX,children:(0,a.jsx)(b.Z,{style:{fontSize:"12px"}})})]})}),eH===V.KP.CHAT&&tx&&(0,a.jsx)("div",{className:"mb-2",children:(0,a.jsxs)("div",{className:"flex items-center gap-3 p-3 bg-gray-50 rounded-lg border border-gray-200",children:[(0,a.jsx)("div",{className:"relative inline-block",children:tx.name.toLowerCase().endsWith(".pdf")?(0,a.jsx)("div",{className:"w-10 h-10 rounded-md bg-red-500 flex items-center justify-center",children:(0,a.jsx)(y.Z,{style:{fontSize:"16px",color:"white"}})}):(0,a.jsx)("img",{src:tp||"",alt:"Upload preview",className:"w-10 h-10 rounded-md border border-gray-200 object-cover"})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("div",{className:"text-sm font-medium text-gray-900 truncate",children:tx.name}),(0,a.jsx)("div",{className:"text-xs text-gray-500",children:tx.name.toLowerCase().endsWith(".pdf")?"PDF":"Image"})]}),(0,a.jsx)("button",{className:"flex items-center justify-center w-6 h-6 text-gray-400 hover:text-gray-600 hover:bg-gray-200 rounded-full transition-colors",onClick:t$,children:(0,a.jsx)(b.Z,{style:{fontSize:"12px"}})})]})}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)("div",{className:"flex items-center flex-1 bg-white border border-gray-300 rounded-xl px-3 py-1 min-h-[44px]",children:[(0,a.jsxs)("div",{className:"flex-shrink-0 mr-2",children:[eH===V.KP.RESPONSES&&!tc&&(0,a.jsx)(eV,{responsesUploadedImage:tc,responsesImagePreviewUrl:tm,onImageUpload:e=>(td(e),tu(URL.createObjectURL(e)),!1),onRemoveImage:tX}),eH===V.KP.CHAT&&!tx&&(0,a.jsx)(Q.Z,{chatUploadedImage:tx,chatImagePreviewUrl:tp,onImageUpload:e=>(tg(e),th(URL.createObjectURL(e)),!1),onRemoveImage:t$})]}),(0,a.jsx)(e$,{value:ew,onChange:e=>eS(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),t0())},placeholder:eH===V.KP.CHAT||eH===V.KP.EMBEDDINGS||eH===V.KP.RESPONSES||eH===V.KP.ANTHROPIC_MESSAGES?"Type your message... (Shift+Enter for new line)":eH===V.KP.A2A_AGENTS?"Send a message to the A2A agent...":eH===V.KP.IMAGE_EDITS?"Describe how you want to edit the image...":eH===V.KP.SPEECH?"Enter text to convert to speech...":eH===V.KP.TRANSCRIPTION?"Optional: Add context or prompt for transcription...":"Describe the image you want to generate...",disabled:eJ,className:"flex-1",autoSize:{minRows:1,maxRows:4},style:{resize:"none",border:"none",boxShadow:"none",background:"transparent",padding:"4px 0",fontSize:"14px",lineHeight:"20px"}}),(0,a.jsx)(N.zx,{onClick:t0,disabled:eJ||(eH===V.KP.TRANSCRIPTION?!tf:!ew.trim()),className:"flex-shrink-0 ml-2 !w-8 !h-8 !min-w-8 !p-0 !rounded-full !bg-blue-600 hover:!bg-blue-700 disabled:!bg-gray-300 !border-none !text-white disabled:!text-gray-500 !flex !items-center !justify-center",children:(0,a.jsx)(j.Z,{style:{fontSize:"14px"}})})]}),eJ&&(0,a.jsx)(N.zx,{onClick:()=>{e0.current&&(e0.current.abort(),e0.current=null,eY(!1),U.Z.info("Request cancelled"))},className:"bg-red-50 hover:bg-red-100 text-red-600 border-red-200",icon:b.Z,children:"Cancel"})]})]})]})]})}),(0,a.jsxs)(_.Z,{title:"Generated Code",visible:tb,onCancel:()=>ty(!1),footer:null,width:800,children:[(0,a.jsxs)("div",{className:"flex justify-between items-end my-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(N.xv,{className:"font-medium block mb-1 text-gray-700",children:"SDK Type"}),(0,a.jsx)(P.default,{value:tw,onChange:e=>tS(e),style:{width:150},options:[{value:"openai",label:"OpenAI SDK"},{value:"azure",label:"Azure SDK"}]})]}),(0,a.jsx)(C.ZP,{onClick:()=>{navigator.clipboard.writeText(tj),U.Z.success("Copied to clipboard!")},children:"Copy to Clipboard"})]}),(0,a.jsx)(R.Z,{language:"python",style:M.Z,wrapLines:!0,wrapLongLines:!0,className:"rounded-md",customStyle:{maxHeight:"60vh",overflowY:"auto"},children:tj})]}),"custom"===eb&&(0,a.jsx)(_.Z,{title:"Select MCP Tool",visible:H,onCancel:()=>G(!1),onOk:()=>{G(!1),U.Z.success("MCP tool selection updated")},width:800,children:en?(0,a.jsx)("div",{className:"flex justify-center items-center py-8",children:(0,a.jsx)(T.Z,{indicator:(0,a.jsx)(o.Z,{style:{fontSize:24},spin:!0})})}):(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(N.xv,{className:"text-gray-600 block mb-4",children:"Select the MCP tools you want to use in your conversation."}),(0,a.jsx)(P.default,{mode:"multiple",style:{width:"100%"},placeholder:"Select MCP tools",value:ea,onChange:e=>eo(e),optionLabelProp:"label",allowClear:!0,maxTagCount:"responsive",children:W.map(e=>(0,a.jsx)(P.default.Option,{value:e.name,label:(0,a.jsx)("div",{className:"font-medium",children:e.name}),children:(0,a.jsxs)("div",{className:"flex flex-col py-1",children:[(0,a.jsx)("span",{className:"font-medium",children:e.name}),(0,a.jsx)("span",{className:"text-xs text-gray-500 mt-1",children:e.description})]})},e.name))})]})})]})}},94331:function(e,t,s){var a=s(57437),o=s(2265),r=s(5545),n=s(62831),l=s(17906),i=s(94263),c=s(83322),d=s(70464),m=s(77565);t.Z=e=>{let{reasoningContent:t}=e,[s,u]=(0,o.useState)(!0);return t?(0,a.jsxs)("div",{className:"reasoning-content mt-1 mb-2",children:[(0,a.jsxs)(r.ZP,{type:"text",className:"flex items-center text-xs text-gray-500 hover:text-gray-700",onClick:()=>u(!s),icon:(0,a.jsx)(c.Z,{}),children:[s?"Hide reasoning":"Show reasoning",s?(0,a.jsx)(d.Z,{className:"ml-1"}):(0,a.jsx)(m.Z,{className:"ml-1"})]}),s&&(0,a.jsx)("div",{className:"mt-2 p-3 bg-gray-50 border border-gray-200 rounded-md text-sm text-gray-700",children:(0,a.jsx)(n.UG,{components:{code(e){let{node:t,inline:s,className:o,children:r,...n}=e,c=/language-(\w+)/.exec(o||"");return!s&&c?(0,a.jsx)(l.Z,{style:i.Z,language:c[1],PreTag:"div",className:"rounded-md my-2",...n,children:String(r).replace(/\n$/,"")}):(0,a.jsx)("code",{className:"".concat(o," px-1.5 py-0.5 rounded bg-gray-100 text-sm font-mono"),...n,children:r})}},children:t})})]}):null}},38398:function(e,t,s){var a=s(57437);s(2265);var o=s(99981),r=s(5540),n=s(71282),l=s(11741),i=s(83322),c=s(16601),d=s(62670),m=s(58630);t.Z=e=>{let{timeToFirstToken:t,totalLatency:s,usage:u,toolName:x}=e;return t||s||u?(0,a.jsxs)("div",{className:"response-metrics mt-2 pt-2 border-t border-gray-100 text-xs text-gray-500 flex flex-wrap gap-3",children:[void 0!==t&&(0,a.jsx)(o.Z,{title:"Time to first token",children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(r.Z,{className:"mr-1"}),(0,a.jsxs)("span",{children:["TTFT: ",(t/1e3).toFixed(2),"s"]})]})}),void 0!==s&&(0,a.jsx)(o.Z,{title:"Total latency",children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(r.Z,{className:"mr-1"}),(0,a.jsxs)("span",{children:["Total Latency: ",(s/1e3).toFixed(2),"s"]})]})}),(null==u?void 0:u.promptTokens)!==void 0&&(0,a.jsx)(o.Z,{title:"Prompt tokens",children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(n.Z,{className:"mr-1"}),(0,a.jsxs)("span",{children:["In: ",u.promptTokens]})]})}),(null==u?void 0:u.completionTokens)!==void 0&&(0,a.jsx)(o.Z,{title:"Completion tokens",children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(l.Z,{className:"mr-1"}),(0,a.jsxs)("span",{children:["Out: ",u.completionTokens]})]})}),(null==u?void 0:u.reasoningTokens)!==void 0&&(0,a.jsx)(o.Z,{title:"Reasoning tokens",children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(i.Z,{className:"mr-1"}),(0,a.jsxs)("span",{children:["Reasoning: ",u.reasoningTokens]})]})}),(null==u?void 0:u.totalTokens)!==void 0&&(0,a.jsx)(o.Z,{title:"Total tokens",children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(c.Z,{className:"mr-1"}),(0,a.jsxs)("span",{children:["Total: ",u.totalTokens]})]})}),(null==u?void 0:u.cost)!==void 0&&(0,a.jsx)(o.Z,{title:"Cost",children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(d.Z,{className:"mr-1"}),(0,a.jsxs)("span",{children:["$",u.cost.toFixed(6)]})]})}),x&&(0,a.jsx)(o.Z,{title:"Tool used",children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(m.Z,{className:"mr-1"}),(0,a.jsxs)("span",{children:["Tool: ",x]})]})})]}):null}},33152:function(e,t,s){s.d(t,{J:function(){return d}});var a=s(57437),o=s(2265),r=s(5545),n=s(44625),l=s(70464),i=s(77565),c=s(38434);function d(e){let{searchResults:t}=e,[s,d]=(0,o.useState)(!0),[m,u]=(0,o.useState)({});if(!t||0===t.length)return null;let x=(e,t)=>{let s="".concat(e,"-").concat(t);u(e=>({...e,[s]:!e[s]}))},g=t.reduce((e,t)=>e+t.data.length,0);return(0,a.jsxs)("div",{className:"search-results-content mt-1 mb-2",children:[(0,a.jsxs)(r.ZP,{type:"text",className:"flex items-center text-xs text-gray-500 hover:text-gray-700",onClick:()=>d(!s),icon:(0,a.jsx)(n.Z,{}),children:[s?"Hide sources":"Show sources (".concat(g,")"),s?(0,a.jsx)(l.Z,{className:"ml-1"}):(0,a.jsx)(i.Z,{className:"ml-1"})]}),s&&(0,a.jsx)("div",{className:"mt-2 p-3 bg-gray-50 border border-gray-200 rounded-md text-sm",children:(0,a.jsx)("div",{className:"space-y-3",children:t.map((e,t)=>(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"text-xs text-gray-600 mb-2 flex items-center gap-2",children:[(0,a.jsx)("span",{className:"font-medium",children:"Query:"}),(0,a.jsxs)("span",{className:"italic",children:['"',e.search_query,'"']}),(0,a.jsx)("span",{className:"text-gray-400",children:"•"}),(0,a.jsxs)("span",{className:"text-gray-500",children:[e.data.length," result",1!==e.data.length?"s":""]})]}),(0,a.jsx)("div",{className:"space-y-2",children:e.data.map((e,s)=>{let o=m["".concat(t,"-").concat(s)]||!1;return(0,a.jsxs)("div",{className:"border border-gray-200 rounded-md overflow-hidden bg-white",children:[(0,a.jsx)("div",{className:"flex items-center justify-between p-2 cursor-pointer hover:bg-gray-50 transition-colors",onClick:()=>x(t,s),children:(0,a.jsxs)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[(0,a.jsx)("svg",{className:"w-4 h-4 text-gray-400 transition-transform flex-shrink-0 ".concat(o?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,a.jsx)(c.Z,{className:"text-gray-400 flex-shrink-0",style:{fontSize:"12px"}}),(0,a.jsx)("span",{className:"text-xs font-medium text-gray-700 truncate",children:e.filename||e.file_id||"Result ".concat(s+1)}),(0,a.jsx)("span",{className:"text-xs px-2 py-0.5 rounded bg-blue-100 text-blue-700 font-mono flex-shrink-0",children:e.score.toFixed(3)})]})}),o&&(0,a.jsx)("div",{className:"border-t border-gray-200 bg-white",children:(0,a.jsxs)("div",{className:"p-3 space-y-2",children:[e.content.map((e,t)=>(0,a.jsx)("div",{children:(0,a.jsx)("div",{className:"text-xs font-mono bg-gray-50 p-2 rounded text-gray-800 whitespace-pre-wrap break-words",children:e.text})},t)),e.attributes&&Object.keys(e.attributes).length>0&&(0,a.jsxs)("div",{className:"mt-2 pt-2 border-t border-gray-100",children:[(0,a.jsx)("div",{className:"text-xs text-gray-500 mb-1 font-medium",children:"Metadata:"}),(0,a.jsx)("div",{className:"space-y-1",children:Object.entries(e.attributes).map(e=>{let[t,s]=e;return(0,a.jsxs)("div",{className:"text-xs flex gap-2",children:[(0,a.jsxs)("span",{className:"text-gray-500 font-medium",children:[t,":"]}),(0,a.jsx)("span",{className:"text-gray-700 font-mono break-all",children:String(s)})]},t)})})]})]})})]},s)})})]},t))})})]})}},95459:function(e,t,s){s.d(t,{n:function(){return r}});var a=s(7271),o=s(19250);async function r(e,t,s,r,n,l,i,c,d,m,u,x,g,p,h,f,v,b){console.log=function(){},console.log("isLocal:",!1);let y=(0,o.getProxyBaseUrl)(),j={};n&&n.length>0&&(j["x-litellm-tags"]=n.join(","));let N=new a.ZP.OpenAI({apiKey:r,baseURL:y,dangerouslyAllowBrowser:!0,defaultHeaders:j});try{let a;let o=Date.now(),n=!1,j=g&&g.length>0?[{type:"mcp",server_label:"litellm",server_url:"".concat(y,"/mcp"),require_approval:"never",allowed_tools:g,headers:{"x-litellm-api-key":"Bearer ".concat(r)}}]:void 0;for await(let r of(await N.chat.completions.create({model:s,stream:!0,stream_options:{include_usage:!0},litellm_trace_id:m,messages:e,...u?{vector_store_ids:u}:{},...x?{guardrails:x}:{},...j?{tools:j,tool_choice:"auto"}:{},...void 0!==f?{temperature:f}:{},...void 0!==v?{max_tokens:v}:{}},{signal:l}))){var w,S,k,P,A,C,Z,T,_;console.log("Stream chunk:",r);let e=null===(w=r.choices[0])||void 0===w?void 0:w.delta;if(console.log("Delta content:",null===(k=r.choices[0])||void 0===k?void 0:null===(S=k.delta)||void 0===S?void 0:S.content),console.log("Delta reasoning content:",null==e?void 0:e.reasoning_content),!n&&((null===(A=r.choices[0])||void 0===A?void 0:null===(P=A.delta)||void 0===P?void 0:P.content)||e&&e.reasoning_content)&&(n=!0,a=Date.now()-o,console.log("First token received! Time:",a,"ms"),c?(console.log("Calling onTimingData with:",a),c(a)):console.log("onTimingData callback is not defined!")),null===(Z=r.choices[0])||void 0===Z?void 0:null===(C=Z.delta)||void 0===C?void 0:C.content){let e=r.choices[0].delta.content;t(e,r.model)}if(e&&e.image&&p&&(console.log("Image generated:",e.image),p(e.image.url,r.model)),e&&e.reasoning_content){let t=e.reasoning_content;i&&i(t)}if(e&&(null===(T=e.provider_specific_fields)||void 0===T?void 0:T.search_results)&&h&&(console.log("Search results found:",e.provider_specific_fields.search_results),h(e.provider_specific_fields.search_results)),r.usage&&d){console.log("Usage data found:",r.usage);let e={completionTokens:r.usage.completion_tokens,promptTokens:r.usage.prompt_tokens,totalTokens:r.usage.total_tokens};(null===(_=r.usage.completion_tokens_details)||void 0===_?void 0:_.reasoning_tokens)&&(e.reasoningTokens=r.usage.completion_tokens_details.reasoning_tokens),void 0!==r.usage.cost&&null!==r.usage.cost&&(e.cost=parseFloat(r.usage.cost)),d(e)}}let E=Date.now();b&&b(E-o)}catch(e){throw(null==l?void 0:l.aborted)&&console.log("Chat completion request was cancelled"),e}}},99020:function(e,t,s){var a=s(57437),o=s(2265),r=s(37592),n=s(19250);t.Z=e=>{let{onChange:t,value:s,className:l,accessToken:i}=e,[c,d]=(0,o.useState)([]),[m,u]=(0,o.useState)(!1);return(0,o.useEffect)(()=>{(async()=>{if(i)try{let e=await (0,n.tagListCall)(i);console.log("List tags response:",e),d(Object.values(e))}catch(e){console.error("Error fetching tags:",e)}finally{u(!1)}})()},[i]),(0,a.jsx)(r.default,{mode:"tags",showSearch:!0,placeholder:"Select or create tags",onChange:t,value:s,loading:m,className:l,options:c.map(e=>({label:e.name,value:e.name,title:e.description||e.name})),optionFilterProp:"label",tokenSeparators:[","],maxTagCount:"responsive",allowClear:!0,style:{width:"100%"}})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/5301-dc3323e921fbd17f.js b/litellm/proxy/_experimental/out/_next/static/chunks/5301-dc3323e921fbd17f.js deleted file mode 100644 index 1043835561..0000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/5301-dc3323e921fbd17f.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5301],{19046:function(e,t,s){s.d(t,{Dx:function(){return l.Z},Zb:function(){return o.Z},oi:function(){return n.Z},xv:function(){return r.Z},zx:function(){return a.Z}});var a=s(78489),o=s(12514),r=s(84264),n=s(49566),l=s(96761)},88712:function(e,t,s){var a=s(57437);s(2265);var o=s(33145),r=s(66830),n=s(50010);t.Z=e=>{let{message:t}=e;if(!(0,r.br)(t))return null;let s="string"==typeof t.content&&t.content.includes("[PDF attached]");return(0,a.jsx)("div",{className:"mb-2",children:s?(0,a.jsx)("div",{className:"w-64 h-32 rounded-md border border-gray-200 bg-red-50 flex items-center justify-center",children:(0,a.jsx)(n.Z,{style:{fontSize:"48px",color:"#dc2626"}})}):(0,a.jsx)(o.default,{src:t.imagePreviewUrl||"",alt:"User uploaded image",width:256,height:200,className:"max-w-64 rounded-md border border-gray-200 shadow-sm",style:{maxHeight:"200px",width:"auto",height:"auto"}})})}},27930:function(e,t,s){var a=s(57437);s(2265);var o=s(65319),r=s(99981),n=s(53508);let{Dragger:l}=o.default;t.Z=e=>{let{chatUploadedImage:t,chatImagePreviewUrl:s,onImageUpload:o,onRemoveImage:i}=e;return(0,a.jsx)(a.Fragment,{children:!t&&(0,a.jsx)(l,{beforeUpload:o,accept:"image/*,.pdf",showUploadList:!1,className:"inline-block",style:{padding:0,border:"none",background:"none"},children:(0,a.jsx)(r.Z,{title:"Attach image or PDF",children:(0,a.jsx)("button",{type:"button",className:"flex items-center justify-center w-8 h-8 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-md transition-colors",children:(0,a.jsx)(n.Z,{style:{fontSize:"16px"}})})})})})}},66830:function(e,t,s){s.d(t,{Hk:function(){return r},Sn:function(){return o},br:function(){return n}});let a=e=>new Promise((t,s)=>{let a=new FileReader;a.onload=()=>{t(a.result)},a.onerror=s,a.readAsDataURL(e)}),o=async(e,t)=>({role:"user",content:[{type:"text",text:e},{type:"image_url",image_url:{url:await a(t)}}]}),r=(e,t,s,a)=>{let o="";t&&a&&(o=a.toLowerCase().endsWith(".pdf")?"[PDF attached]":"[Image attached]");let r={role:"user",content:t?"".concat(e," ").concat(o):e};return t&&s&&(r.imagePreviewUrl=s),r},n=e=>"user"===e.role&&"string"==typeof e.content&&(e.content.includes("[Image attached]")||e.content.includes("[PDF attached]"))&&!!e.imagePreviewUrl},75301:function(e,t,s){s.d(t,{Z:function(){return e0}});var a=s(57437),o=s(61935),r=s(92403),n=s(12660),l=s(25980),i=s(69993),c=s(55322),d=s(71891),m=s(58630),u=s(15424),x=s(44625),g=s(57400),p=s(26430),h=s(11894),f=s(15883),v=s(99890),b=s(26349),y=s(50010),j=s(79276),N=s(19046),w=s(4260),S=s(65319),k=s(57840),P=s(37592),A=s(79326),C=s(5545),Z=s(99981),T=s(10353),_=s(22116),E=s(2265),I=s(62831),R=s(17906),M=s(94263),L=s(93837),O=s(9309),K=s(67479),U=s(9114),D=s(99020),z=s(97415),F=s(92280),B=s(4156),H=s(19015),G=s(85847),q=e=>{let{temperature:t=1,maxTokens:s=2048,useAdvancedParams:o,onTemperatureChange:r,onMaxTokensChange:n,onUseAdvancedParamsChange:l}=e,[i,c]=(0,E.useState)(!1),d=void 0!==o?o:i,[m,x]=(0,E.useState)(t),[g,p]=(0,E.useState)(s);(0,E.useEffect)(()=>{x(t)},[t]),(0,E.useEffect)(()=>{p(s)},[s]);let h=e=>{let t=null!=e?e:1;x(t),null==r||r(t)},f=e=>{let t=null!=e?e:1e3;p(t),null==n||n(t)},v=d?"text-gray-700":"text-gray-400",b=e=>{l?l(e):c(e)};return(0,a.jsxs)("div",{className:"space-y-4 p-4 w-80",children:[(0,a.jsx)(B.Z,{checked:d,onChange:e=>b(e.target.checked),children:(0,a.jsx)("span",{className:"font-medium",children:"Use Advanced Parameters"})}),(0,a.jsxs)("div",{className:"space-y-4 transition-opacity duration-200",style:{opacity:d?1:.4},children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(F.x,{className:"text-sm ".concat(v),children:"Temperature"}),(0,a.jsx)(Z.Z,{title:"Controls randomness. Lower values make output more deterministic, higher values more creative.",children:(0,a.jsx)(u.Z,{className:"text-xs ".concat(v," cursor-help")})})]}),(0,a.jsx)(H.Z,{min:0,max:2,step:.1,value:m,onChange:h,disabled:!d,precision:1,className:"w-20"})]}),(0,a.jsx)(G.Z,{min:0,max:2,step:.1,value:m,onChange:h,disabled:!d,marks:{0:"0",1:"1.0",2:"2.0"}})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(F.x,{className:"text-sm ".concat(v),children:"Max Tokens"}),(0,a.jsx)(Z.Z,{title:"Maximum number of tokens to generate in the response.",children:(0,a.jsx)(u.Z,{className:"text-xs ".concat(v," cursor-help")})})]}),(0,a.jsx)(H.Z,{min:1,max:32768,step:1,value:g,onChange:f,disabled:!d})]}),(0,a.jsx)(G.Z,{min:1,max:32768,step:1,value:g,onChange:f,disabled:!d,marks:{1:"1",32768:"32768"}})]})]})]})},J=e=>{let{message:t}=e;return t.isAudio&&"string"==typeof t.content?(0,a.jsx)("div",{className:"mb-2",children:(0,a.jsx)("audio",{controls:!0,src:t.content,className:"max-w-full",style:{maxWidth:"500px"},children:"Your browser does not support the audio element."})}):null},V=s(8443);let W={ALLOY:"Alloy - Professional and confident",ASH:"Ash - Casual and relaxed",BALAD:"Ballad - Smooth and melodic",CORAL:"Coral - Warm and engaging",ECHO:"Echo - Friendly and conversational",FABLE:"Fable - Wise and measured",NOVA:"Nova - Friendly and conversational",ONYX:"Onyx - Deep and authoritative",SAGE:"Sage - Wise and measured",SHIMMER:"Shimmer - Bright and cheerful"},Y=Object.entries({ALLOY:"alloy",ASH:"ash",BALAD:"ballad",CORAL:"coral",ECHO:"echo",FABLE:"fable",NOVA:"nova",ONYX:"onyx",SAGE:"sage",SHIMMER:"shimmer"}).map(e=>{let[t,s]=e;return{value:s,label:W[t]}}),X=[{value:V.KP.CHAT,label:"/v1/chat/completions"},{value:V.KP.RESPONSES,label:"/v1/responses"},{value:V.KP.ANTHROPIC_MESSAGES,label:"/v1/messages"},{value:V.KP.IMAGE,label:"/v1/images/generations"},{value:V.KP.IMAGE_EDITS,label:"/v1/images/edits"},{value:V.KP.EMBEDDINGS,label:"/v1/embeddings"},{value:V.KP.SPEECH,label:"/v1/audio/speech"},{value:V.KP.TRANSCRIPTION,label:"/v1/audio/transcriptions"},{value:V.KP.A2A_AGENTS,label:"/v1/a2a/message/send"}];var $=s(88712),Q=s(27930),ee=s(66830),et=s(82971),es=e=>{let{endpointType:t,onEndpointChange:s,className:o}=e;return(0,a.jsx)("div",{className:o,children:(0,a.jsx)(P.default,{showSearch:!0,value:t,style:{width:"100%"},onChange:s,options:X,className:"rounded-md"})})},ea=s(85498),eo=s(19250);async function er(e,t,s,a){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],r=arguments.length>5?arguments[5]:void 0,n=arguments.length>6?arguments[6]:void 0,l=arguments.length>7?arguments[7]:void 0,i=arguments.length>8?arguments[8]:void 0,c=arguments.length>9?arguments[9]:void 0,d=arguments.length>10?arguments[10]:void 0,m=arguments.length>11?arguments[11]:void 0,u=arguments.length>12?arguments[12]:void 0;if(!a)throw Error("Virtual Key is required");console.log=function(){};let x=(0,eo.getProxyBaseUrl)(),g={};o&&o.length>0&&(g["x-litellm-tags"]=o.join(","));let p=new ea.ZP({apiKey:a,baseURL:x,dangerouslyAllowBrowser:!0,defaultHeaders:g});try{let o=Date.now(),g=!1,h=u&&u.length>0?[{type:"mcp",server_label:"litellm",server_url:"".concat(x,"/mcp"),require_approval:"never",allowed_tools:u,headers:{"x-litellm-api-key":"Bearer ".concat(a)}}]:void 0,f={model:s,messages:e.map(e=>({role:e.role,content:e.content})),stream:!0,max_tokens:1024,litellm_trace_id:c};for await(let e of(d&&(f.vector_store_ids=d),m&&(f.guardrails=m),h&&(f.tools=h,f.tool_choice="auto"),p.messages.stream(f,{signal:r}))){if(console.log("Stream event:",e),"content_block_delta"===e.type){let a=e.delta;if(!g){g=!0;let e=Date.now()-o;console.log("First token received! Time:",e,"ms"),l&&l(e)}"text_delta"===a.type?t("assistant",a.text,s):"reasoning_delta"===a.type&&n&&n(a.text)}if("message_delta"===e.type&&e.usage&&i){let t=e.usage;console.log("Usage data found:",t);let s={completionTokens:t.output_tokens,promptTokens:t.input_tokens,totalTokens:t.input_tokens+t.output_tokens};i(s)}}}catch(e){throw(null==r?void 0:r.aborted)?console.log("Anthropic messages request was cancelled"):U.Z.fromBackend("Error occurred while generating model response. Please try again. Error: ".concat(e)),e}}var en=s(7271);async function el(e,t,s,a,o,r,n,l,i){console.log=function(){},console.log("isLocal:",!1);let c=(0,eo.getProxyBaseUrl)(),d=new en.ZP.OpenAI({apiKey:o,baseURL:c,dangerouslyAllowBrowser:!0,defaultHeaders:r&&r.length>0?{"x-litellm-tags":r.join(",")}:void 0});try{let o=await d.audio.speech.create({model:a,input:e,voice:t,...l?{response_format:l}:{},...i?{speed:i}:{}},{signal:n}),r=await o.blob(),c=URL.createObjectURL(r);s(c,a)}catch(e){throw(null==n?void 0:n.aborted)?console.log("Audio speech request was cancelled"):U.Z.fromBackend("Error occurred while generating speech. Please try again. Error: ".concat(e)),e}}async function ei(e,t,s,a,o,r,n,l,i,c){console.log=function(){},console.log("isLocal:",!1);let d=(0,eo.getProxyBaseUrl)(),m=new en.ZP.OpenAI({apiKey:a,baseURL:d,dangerouslyAllowBrowser:!0,defaultHeaders:o&&o.length>0?{"x-litellm-tags":o.join(",")}:void 0});try{console.log("Processing audio file for transcription:",e.name);let a=await m.audio.transcriptions.create({model:s,file:e,...n?{language:n}:{},...l?{prompt:l}:{},...i?{response_format:i}:{},...void 0!==c?{temperature:c}:{}},{signal:r});if(console.log("Transcription response:",a),a&&a.text)t(a.text,s),U.Z.success("Audio transcribed successfully");else throw Error("No transcription text in response")}catch(e){if(console.error("Error making audio transcription request:",e),null==r?void 0:r.aborted)console.log("Audio transcription request was cancelled");else{var u;let t="Failed to transcribe audio";(null==e?void 0:null===(u=e.error)||void 0===u?void 0:u.message)?t=e.error.message:(null==e?void 0:e.message)&&(t=e.message),U.Z.fromBackend("Audio transcription failed: ".concat(t))}throw e}}var ec=s(95459);async function ed(e,t,s,a,o){if(!a)throw Error("Virtual Key is required");console.log=function(){};let r=(0,eo.getProxyBaseUrl)(),n={};o&&o.length>0&&(n["x-litellm-tags"]=o.join(","));try{var l,i,c;let o=r.endsWith("/")?r.slice(0,-1):r,d=await fetch("".concat(o,"/embeddings"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(a),...n},body:JSON.stringify({model:s,input:e})});if(!d.ok){let e=await d.text();throw Error(e||"Request failed with status ".concat(d.status))}let m=await d.json(),u=null==m?void 0:null===(i=m.data)||void 0===i?void 0:null===(l=i[0])||void 0===l?void 0:l.embedding;if(!u)throw Error("No embedding returned from server");t(JSON.stringify(u),null!==(c=null==m?void 0:m.model)&&void 0!==c?c:s)}catch(e){throw U.Z.fromBackend("Error occurred while making embeddings request. Please try again. Error: ".concat(e)),e}}async function em(e){try{return(await (0,eo.mcpToolsCall)(e)).tools||[]}catch(e){return console.error("Error fetching MCP tools:",e),[]}}var eu=s(10703);async function ex(e,t,s,a,o,r,n){console.log=function(){},console.log("isLocal:",!1);let l=(0,eo.getProxyBaseUrl)(),i=new en.ZP.OpenAI({apiKey:o,baseURL:l,dangerouslyAllowBrowser:!0,defaultHeaders:r&&r.length>0?{"x-litellm-tags":r.join(",")}:void 0});try{let o=Array.isArray(e)?e:[e],r=[];for(let e=0;e1&&U.Z.success("Successfully processed ".concat(r.length," images"))}catch(e){if(console.error("Error making image edit request:",e),null==n?void 0:n.aborted)console.log("Image edits request was cancelled");else{var c;let t="Failed to edit image(s)";(null==e?void 0:null===(c=e.error)||void 0===c?void 0:c.message)?t=e.error.message:(null==e?void 0:e.message)&&(t=e.message),U.Z.fromBackend("Image edit failed: ".concat(t))}throw e}}async function eg(e,t,s,a,o,r){console.log=function(){},console.log("isLocal:",!1);let n=(0,eo.getProxyBaseUrl)(),l=new en.ZP.OpenAI({apiKey:a,baseURL:n,dangerouslyAllowBrowser:!0,defaultHeaders:o&&o.length>0?{"x-litellm-tags":o.join(",")}:void 0});try{let a=await l.images.generate({model:s,prompt:e},{signal:r});if(console.log(a.data),a.data&&a.data[0]){if(a.data[0].url)t(a.data[0].url,s);else if(a.data[0].b64_json){let e=a.data[0].b64_json;t("data:image/png;base64,".concat(e),s)}else throw Error("No image data found in response")}else throw Error("Invalid response format")}catch(e){throw(null==r?void 0:r.aborted)?console.log("Image generation request was cancelled"):U.Z.fromBackend("Error occurred while generating image. Please try again. Error: ".concat(e)),e}}async function ep(e,t,s,a){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],r=arguments.length>5?arguments[5]:void 0,n=arguments.length>6?arguments[6]:void 0,l=arguments.length>7?arguments[7]:void 0,i=arguments.length>8?arguments[8]:void 0,c=arguments.length>9?arguments[9]:void 0,d=arguments.length>10?arguments[10]:void 0,m=arguments.length>11?arguments[11]:void 0,u=arguments.length>12?arguments[12]:void 0,x=arguments.length>13?arguments[13]:void 0,g=arguments.length>14?arguments[14]:void 0,p=arguments.length>15?arguments[15]:void 0;if(!a)throw Error("Virtual Key is required");console.log=function(){};let h=(0,eo.getProxyBaseUrl)(),f={};o&&o.length>0&&(f["x-litellm-tags"]=o.join(","));let v=new en.ZP.OpenAI({apiKey:a,baseURL:h,dangerouslyAllowBrowser:!0,defaultHeaders:f});try{let a=Date.now(),o=!1,h=e.map(e=>(Array.isArray(e.content),{role:e.role,content:e.content,type:"message"})),f=u&&u.length>0?[{type:"mcp",server_label:"litellm",server_url:"litellm_proxy/mcp",require_approval:"never",allowed_tools:u}]:void 0,P=await v.responses.create({model:s,input:h,stream:!0,litellm_trace_id:c,...x?{previous_response_id:x}:{},...d?{vector_store_ids:d}:{},...m?{guardrails:m}:{},...f?{tools:f,tool_choice:"required"}:{}},{signal:r}),A="";for await(let e of P)if(console.log("Response event:",e),"object"==typeof e&&null!==e){var b,y,j,N,w,S,k;if(((null===(b=e.type)||void 0===b?void 0:b.startsWith("response.mcp_"))||"response.output_item.done"===e.type&&((null===(y=e.item)||void 0===y?void 0:y.type)==="mcp_list_tools"||(null===(j=e.item)||void 0===j?void 0:j.type)==="mcp_call"))&&(console.log("MCP event received:",e),p)){let t={type:e.type,sequence_number:e.sequence_number,output_index:e.output_index,item_id:e.item_id||(null===(S=e.item)||void 0===S?void 0:S.id),item:e.item,delta:e.delta,arguments:e.arguments,timestamp:Date.now()};p(t)}if("response.output_item.done"===e.type&&(null===(N=e.item)||void 0===N?void 0:N.type)==="mcp_call"&&(null===(w=e.item)||void 0===w?void 0:w.name)&&(A=e.item.name,console.log("MCP tool used:",A)),"response.role.delta"===e.type)continue;if("response.output_text.delta"===e.type&&"string"==typeof e.delta){let r=e.delta;if(console.log("Text delta",r),r.trim().length>0&&(t("assistant",r,s),!o)){o=!0;let e=Date.now()-a;console.log("First token received! Time:",e,"ms"),l&&l(e)}}if("response.reasoning.delta"===e.type&&"delta"in e){let t=e.delta;"string"==typeof t&&n&&n(t)}if("response.completed"===e.type&&"response"in e){let t=e.response,s=t.usage;if(console.log("Usage data:",s),console.log("Response completed event:",t),t.id&&g&&(console.log("Response ID for session management:",t.id),g(t.id)),s&&i){console.log("Usage data:",s);let e={completionTokens:s.output_tokens,promptTokens:s.input_tokens,totalTokens:s.total_tokens};(null===(k=s.completion_tokens_details)||void 0===k?void 0:k.reasoning_tokens)&&(e.reasoningTokens=s.completion_tokens_details.reasoning_tokens),i(e,A)}}}return P}catch(e){throw(null==r?void 0:r.aborted)?console.log("Responses API request was cancelled"):U.Z.fromBackend("Error occurred while generating model response. Please try again. Error: ".concat(e)),e}}let eh=async e=>{try{let t=(0,eo.getProxyBaseUrl)(),s=await fetch(t?"".concat(t,"/v1/agents"):"/v1/agents",{method:"GET",headers:{Authorization:"Bearer ".concat(e),"Content-Type":"application/json"}});if(!s.ok){let e=await s.json();throw Error(e.detail||"Failed to fetch agents")}let a=await s.json();return console.log("Fetched agents:",a),a.sort((e,t)=>{let s=e.agent_name||e.agent_id,a=t.agent_name||t.agent_id;return s.localeCompare(a)}),a}catch(e){throw console.error("Error fetching agents:",e),e}},ef=e=>{if(!e)return;let t={};if(e.id&&(t.taskId=e.id),e.contextId&&(t.contextId=e.contextId),e.status){var s;if(t.status={state:e.status.state,timestamp:e.status.timestamp},null===(s=e.status.message)||void 0===s?void 0:s.parts){let s=e.status.message.parts.filter(e=>"text"===e.kind&&e.text).map(e=>e.text).join(" ");s&&(t.status.message=s)}}return e.metadata&&"object"==typeof e.metadata&&(t.metadata=e.metadata),Object.keys(t).length>0?t:void 0},ev=async(e,t,s,a,o,r,n,l)=>{let i;let c=(0,eo.getProxyBaseUrl)(),d=c?"".concat(c,"/a2a/").concat(e):"/a2a/".concat(e),m=(0,L.Z)(),u=(0,L.Z)().replace(/-/g,""),x=performance.now(),g=!1,p="";try{var h,f,v,b;let c=await fetch(d,{method:"POST",headers:{Authorization:"Bearer ".concat(a),"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:m,method:"message/stream",params:{message:{kind:"message",messageId:u,role:"user",parts:[{kind:"text",text:t}]}}}),signal:o});if(!c.ok){let e=await c.json();throw Error((null===(f=e.error)||void 0===f?void 0:f.message)||e.detail||"HTTP ".concat(c.status))}let y=null===(h=c.body)||void 0===h?void 0:h.getReader();if(!y)throw Error("No response body");let j=new TextDecoder,N="",w=!1;for(;!w;){let t=await y.read();w=t.done;let a=t.value;if(w)break;let o=(N+=j.decode(a,{stream:!0})).split("\n");for(let t of(N=o.pop()||"",o))if(t.trim())try{let a=JSON.parse(t);if(!g){g=!0;let e=performance.now()-x;r&&r(e)}let o=a.result;if(o){let t=ef(o);t&&(i={...i,...t});let a=o.kind;if("artifact-update"===a&&o.artifact){let t=o.artifact;if(t.parts&&Array.isArray(t.parts))for(let a of t.parts)"text"===a.kind&&a.text&&(p+=a.text,s(p,"a2a_agent/".concat(e)))}else if(o.artifacts&&Array.isArray(o.artifacts)){for(let t of o.artifacts)if(t.parts&&Array.isArray(t.parts))for(let a of t.parts)"text"===a.kind&&a.text&&(p+=a.text,s(p,"a2a_agent/".concat(e)))}else if("status-update"===a&&(null===(b=o.status)||void 0===b?void 0:null===(v=b.message)||void 0===v?void 0:v.parts)){if(!p)for(let t of o.status.message.parts)"text"===t.kind&&t.text&&s(t.text,"a2a_agent/".concat(e))}else if(o.parts&&Array.isArray(o.parts))for(let t of o.parts)"text"===t.kind&&t.text&&(p+=t.text,s(p,"a2a_agent/".concat(e)))}if(a.error)throw Error(a.error.message)}catch(e){t.trim().length>0&&console.warn("Failed to parse A2A streaming chunk:",t,e)}}let S=performance.now()-x;n&&n(S),i&&l&&l(i)}catch(e){if(null==o?void 0:o.aborted){console.log("A2A streaming request was cancelled");return}throw console.error("A2A stream message error:",e),e}};var eb=s(83669),ey=s(29271),ej=s(5540),eN=s(38434),ew=s(23639),eS=s(62272),ek=s(70464),eP=s(77565);let eA=e=>{switch(e){case"completed":return(0,a.jsx)(eb.Z,{className:"text-green-500"});case"working":case"submitted":return(0,a.jsx)(o.Z,{className:"text-blue-500"});case"failed":case"canceled":return(0,a.jsx)(ey.Z,{className:"text-red-500"});default:return(0,a.jsx)(ej.Z,{className:"text-gray-500"})}},eC=e=>{switch(e){case"completed":return"bg-green-100 text-green-700";case"working":case"submitted":return"bg-blue-100 text-blue-700";case"failed":case"canceled":return"bg-red-100 text-red-700";default:return"bg-gray-100 text-gray-700"}},eZ=e=>{if(!e)return null;try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch(t){return e}},eT=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return e?e.length>t?"".concat(e.substring(0,t),"…"):e:null},e_=e=>{navigator.clipboard.writeText(e)};var eE=e=>{let{a2aMetadata:t,timeToFirstToken:s,totalLatency:o}=e,[r,n]=(0,E.useState)(!1);if(!t&&!s&&!o)return null;let{taskId:l,contextId:c,status:d,metadata:m}=t||{},u=eZ(null==d?void 0:d.timestamp);return(0,a.jsxs)("div",{className:"a2a-metrics mt-3 pt-2 border-t border-gray-200 text-xs",children:[(0,a.jsxs)("div",{className:"flex items-center mb-2 text-gray-600",children:[(0,a.jsx)(i.Z,{className:"mr-1.5 text-blue-500"}),(0,a.jsx)("span",{className:"font-medium text-gray-700",children:"A2A Metadata"})]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-gray-500 ml-4",children:[(null==d?void 0:d.state)&&(0,a.jsxs)("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ".concat(eC(d.state)),children:[eA(d.state),(0,a.jsx)("span",{className:"ml-1 capitalize",children:d.state})]}),u&&(0,a.jsx)(Z.Z,{title:null==d?void 0:d.timestamp,children:(0,a.jsxs)("span",{className:"flex items-center",children:[(0,a.jsx)(ej.Z,{className:"mr-1"}),u]})}),void 0!==o&&(0,a.jsx)(Z.Z,{title:"Total latency",children:(0,a.jsxs)("span",{className:"flex items-center text-blue-600",children:[(0,a.jsx)(ej.Z,{className:"mr-1"}),(o/1e3).toFixed(2),"s"]})}),void 0!==s&&(0,a.jsx)(Z.Z,{title:"Time to first token",children:(0,a.jsxs)("span",{className:"flex items-center text-green-600",children:["TTFT: ",(s/1e3).toFixed(2),"s"]})})]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-3 text-gray-500 ml-4 mt-1.5",children:[l&&(0,a.jsx)(Z.Z,{title:"Click to copy: ".concat(l),children:(0,a.jsxs)("span",{className:"flex items-center cursor-pointer hover:text-gray-700",onClick:()=>e_(l),children:[(0,a.jsx)(eN.Z,{className:"mr-1"}),"Task: ",eT(l),(0,a.jsx)(ew.Z,{className:"ml-1 text-gray-400 hover:text-gray-600"})]})}),c&&(0,a.jsx)(Z.Z,{title:"Click to copy: ".concat(c),children:(0,a.jsxs)("span",{className:"flex items-center cursor-pointer hover:text-gray-700",onClick:()=>e_(c),children:[(0,a.jsx)(eS.Z,{className:"mr-1"}),"Session: ",eT(c),(0,a.jsx)(ew.Z,{className:"ml-1 text-gray-400 hover:text-gray-600"})]})}),(m||(null==d?void 0:d.message))&&(0,a.jsxs)(C.ZP,{type:"text",size:"small",className:"text-xs text-blue-500 hover:text-blue-700 p-0 h-auto",onClick:()=>n(!r),children:[r?(0,a.jsx)(ek.Z,{}):(0,a.jsx)(eP.Z,{}),(0,a.jsx)("span",{className:"ml-1",children:"Details"})]})]}),r&&(0,a.jsxs)("div",{className:"mt-2 ml-4 p-3 bg-gray-50 rounded-md text-gray-600 border border-gray-200",children:[(null==d?void 0:d.message)&&(0,a.jsxs)("div",{className:"mb-2",children:[(0,a.jsx)("span",{className:"font-medium text-gray-700",children:"Status Message:"}),(0,a.jsx)("span",{className:"ml-2",children:d.message})]}),l&&(0,a.jsxs)("div",{className:"mb-1.5 flex items-center",children:[(0,a.jsx)("span",{className:"font-medium text-gray-700 w-24",children:"Task ID:"}),(0,a.jsx)("code",{className:"ml-2 px-2 py-1 bg-white border border-gray-200 rounded text-xs font-mono",children:l}),(0,a.jsx)(ew.Z,{className:"ml-2 cursor-pointer text-gray-400 hover:text-blue-500",onClick:()=>e_(l)})]}),c&&(0,a.jsxs)("div",{className:"mb-1.5 flex items-center",children:[(0,a.jsx)("span",{className:"font-medium text-gray-700 w-24",children:"Session ID:"}),(0,a.jsx)("code",{className:"ml-2 px-2 py-1 bg-white border border-gray-200 rounded text-xs font-mono",children:c}),(0,a.jsx)(ew.Z,{className:"ml-2 cursor-pointer text-gray-400 hover:text-blue-500",onClick:()=>e_(c)})]}),m&&Object.keys(m).length>0&&(0,a.jsxs)("div",{className:"mt-3",children:[(0,a.jsx)("span",{className:"font-medium text-gray-700",children:"Custom Metadata:"}),(0,a.jsx)("pre",{className:"mt-1.5 p-2 bg-white border border-gray-200 rounded text-xs font-mono overflow-x-auto whitespace-pre-wrap",children:JSON.stringify(m,null,2)})]})]})]})},eI=s(29),eR=s.n(eI),eM=s(44851);let{Text:eL}=k.default,{Panel:eO}=eM.default;var eK=e=>{var t,s;let{events:o,className:r}=e;if(console.log("MCPEventsDisplay: Received events:",o),!o||0===o.length)return console.log("MCPEventsDisplay: No events, returning null"),null;let n=o.find(e=>{var t;return"response.output_item.done"===e.type&&(null===(t=e.item)||void 0===t?void 0:t.type)==="mcp_list_tools"&&e.item.tools&&e.item.tools.length>0}),l=o.filter(e=>{var t;return"response.output_item.done"===e.type&&(null===(t=e.item)||void 0===t?void 0:t.type)==="mcp_call"});return(console.log("MCPEventsDisplay: toolsEvent:",n),console.log("MCPEventsDisplay: mcpCallEvents:",l),n||0!==l.length)?(0,a.jsxs)("div",{className:"jsx-32b14b04f420f3ac "+"mcp-events-display ".concat(r||""),children:[(0,a.jsx)(eR(),{id:"32b14b04f420f3ac",children:'.openai-mcp-tools.jsx-32b14b04f420f3ac{position:relative;margin:0;padding:0}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse.jsx-32b14b04f420f3ac{background:transparent!important;border:none!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-item.jsx-32b14b04f420f3ac{border:none!important;background:transparent!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-header.jsx-32b14b04f420f3ac{padding:0 0 0 20px!important;background:transparent!important;border:none!important;font-size:14px!important;color:#9ca3af!important;font-weight:400!important;line-height:20px!important;min-height:20px!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-header.jsx-32b14b04f420f3ac:hover{background:transparent!important;color:#6b7280!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-content.jsx-32b14b04f420f3ac{border:none!important;background:transparent!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-content-box.jsx-32b14b04f420f3ac{padding:4px 0 0 20px!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-expand-icon.jsx-32b14b04f420f3ac{position:absolute!important;left:2px!important;top:2px!important;color:#9ca3af!important;font-size:10px!important;width:16px!important;height:16px!important;display:-webkit-box!important;display:-webkit-flex!important;display:-moz-box!important;display:-ms-flexbox!important;display:flex!important;-webkit-box-align:center!important;-webkit-align-items:center!important;-moz-box-align:center!important;-ms-flex-align:center!important;align-items:center!important;-webkit-box-pack:center!important;-webkit-justify-content:center!important;-moz-box-pack:center!important;-ms-flex-pack:center!important;justify-content:center!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-expand-icon.jsx-32b14b04f420f3ac:hover{color:#6b7280!important}.openai-vertical-line.jsx-32b14b04f420f3ac{position:absolute;left:9px;top:18px;bottom:0;width:.5px;background-color:#f3f4f6;opacity:.8}.tool-item.jsx-32b14b04f420f3ac{font-family:ui-monospace,SFMono-Regular,"SF Mono",Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:13px;color:#4b5563;line-height:18px;padding:0;margin:0;background:white;position:relative;z-index:1}.mcp-section.jsx-32b14b04f420f3ac{margin-bottom:12px;background:white;position:relative;z-index:1}.mcp-section.jsx-32b14b04f420f3ac:last-child{margin-bottom:0}.mcp-section-header.jsx-32b14b04f420f3ac{font-size:13px;color:#6b7280;font-weight:500;margin-bottom:4px}.mcp-code-block.jsx-32b14b04f420f3ac{background:#f9fafb;border:1px solid#f3f4f6;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;padding:8px;font-size:12px}.mcp-json.jsx-32b14b04f420f3ac{font-family:ui-monospace,SFMono-Regular,"SF Mono",Monaco,Consolas,"Liberation Mono","Courier New",monospace;color:#374151;margin:0;white-space:pre-wrap;word-wrap:break-word}.mcp-approved.jsx-32b14b04f420f3ac{display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-moz-box-align:center;-ms-flex-align:center;align-items:center;font-size:13px;color:#6b7280}.mcp-checkmark.jsx-32b14b04f420f3ac{color:#10b981;margin-right:6px;font-weight:bold}.mcp-response-content.jsx-32b14b04f420f3ac{font-size:13px;color:#374151;line-height:1.5;white-space:pre-wrap;font-family:ui-monospace,SFMono-Regular,"SF Mono",Monaco,Consolas,"Liberation Mono","Courier New",monospace}'}),(0,a.jsxs)("div",{className:"jsx-32b14b04f420f3ac openai-mcp-tools",children:[(0,a.jsx)("div",{className:"jsx-32b14b04f420f3ac openai-vertical-line"}),(0,a.jsxs)(eM.default,{ghost:!0,size:"small",expandIconPosition:"start",defaultActiveKey:n?["list-tools"]:l.map((e,t)=>"mcp-call-".concat(t)),children:[n&&(0,a.jsx)(eO,{header:"List tools",children:(0,a.jsx)("div",{className:"jsx-32b14b04f420f3ac",children:null===(s=n.item)||void 0===s?void 0:null===(t=s.tools)||void 0===t?void 0:t.map((e,t)=>(0,a.jsx)("div",{className:"jsx-32b14b04f420f3ac tool-item",children:e.name},t))})},"list-tools"),l.map((e,t)=>{var s,o,r;return(0,a.jsx)(eO,{header:(null===(s=e.item)||void 0===s?void 0:s.name)||"Tool call",children:(0,a.jsxs)("div",{className:"jsx-32b14b04f420f3ac",children:[(0,a.jsxs)("div",{className:"jsx-32b14b04f420f3ac mcp-section",children:[(0,a.jsx)("div",{className:"jsx-32b14b04f420f3ac mcp-section-header",children:"Request"}),(0,a.jsx)("div",{className:"jsx-32b14b04f420f3ac mcp-code-block",children:(null===(o=e.item)||void 0===o?void 0:o.arguments)&&(0,a.jsx)("pre",{className:"jsx-32b14b04f420f3ac mcp-json",children:(()=>{try{return JSON.stringify(JSON.parse(e.item.arguments),null,2)}catch(t){return e.item.arguments}})()})})]}),(0,a.jsx)("div",{className:"jsx-32b14b04f420f3ac mcp-section",children:(0,a.jsxs)("div",{className:"jsx-32b14b04f420f3ac mcp-approved",children:[(0,a.jsx)("span",{className:"jsx-32b14b04f420f3ac mcp-checkmark",children:"✓"})," Approved"]})}),(null===(r=e.item)||void 0===r?void 0:r.output)&&(0,a.jsxs)("div",{className:"jsx-32b14b04f420f3ac mcp-section",children:[(0,a.jsx)("div",{className:"jsx-32b14b04f420f3ac mcp-section-header",children:"Response"}),(0,a.jsx)("div",{className:"jsx-32b14b04f420f3ac mcp-response-content",children:e.item.output})]})]})},"mcp-call-".concat(t))})]})]})]}):(console.log("MCPEventsDisplay: No valid events found, returning null"),null)},eU=s(94331),eD=s(38398);let ez=e=>new Promise((t,s)=>{let a=new FileReader;a.onload=()=>{t(a.result.split(",")[1])},a.onerror=s,a.readAsDataURL(e)}),eF=async(e,t)=>{let s=await ez(t),a=t.type||(t.name.toLowerCase().endsWith(".pdf")?"application/pdf":"image/jpeg");return{role:"user",content:[{type:"input_text",text:e},{type:"input_image",image_url:"data:".concat(a,";base64,").concat(s)}]}},eB=(e,t,s,a)=>{let o="";t&&a&&(o=a.toLowerCase().endsWith(".pdf")?"[PDF attached]":"[Image attached]");let r={role:"user",content:t?"".concat(e," ").concat(o):e};return t&&s&&(r.imagePreviewUrl=s),r},eH=e=>"user"===e.role&&"string"==typeof e.content&&(e.content.includes("[Image attached]")||e.content.includes("[PDF attached]"))&&!!e.imagePreviewUrl;var eG=e=>{let{message:t}=e;if(!eH(t))return null;let s="string"==typeof t.content&&t.content.includes("[PDF attached]");return(0,a.jsx)("div",{className:"mb-2",children:s?(0,a.jsx)("div",{className:"w-64 h-32 rounded-md border border-gray-200 bg-red-50 flex items-center justify-center",children:(0,a.jsx)(y.Z,{style:{fontSize:"48px",color:"#dc2626"}})}):(0,a.jsx)("img",{src:t.imagePreviewUrl,alt:"User uploaded image",className:"max-w-64 rounded-md border border-gray-200 shadow-sm",style:{maxHeight:"200px"}})})},eq=s(53508);let{Dragger:eJ}=S.default;var eV=e=>{let{responsesUploadedImage:t,responsesImagePreviewUrl:s,onImageUpload:o,onRemoveImage:r}=e;return(0,a.jsx)(a.Fragment,{children:!t&&(0,a.jsx)(eJ,{beforeUpload:o,accept:"image/*,.pdf",showUploadList:!1,className:"inline-block",style:{padding:0,border:"none",background:"none"},children:(0,a.jsx)(Z.Z,{title:"Attach image or PDF",children:(0,a.jsx)("button",{type:"button",className:"flex items-center justify-center w-8 h-8 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-md transition-colors",children:(0,a.jsx)(eq.Z,{style:{fontSize:"16px"}})})})})})},eW=s(33152),eY=s(63709),eX=e=>{let{endpointType:t,responsesSessionId:s,useApiSessionManagement:o,onToggleSessionManagement:r}=e;return t!==V.KP.RESPONSES?null:(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Session Management"}),(0,a.jsx)(Z.Z,{title:"Choose between LiteLLM API session management (using previous_response_id) or UI-based session management (using chat history)",children:(0,a.jsx)(u.Z,{className:"text-gray-400",style:{fontSize:"12px"}})})]}),(0,a.jsx)(eY.Z,{checked:o,onChange:r,checkedChildren:"API",unCheckedChildren:"UI",size:"small"})]}),(0,a.jsxs)("div",{className:"text-xs p-2 rounded-md ".concat(s?"bg-green-50 text-green-700 border border-green-200":"bg-blue-50 text-blue-700 border border-blue-200"),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(u.Z,{style:{fontSize:"12px"}}),(()=>{if(!s)return o?"API Session: Ready":"UI Session: Ready";let e=o?"Response ID":"UI Session",t=s.slice(0,10);return"".concat(e,": ").concat(t,"...")})()]}),s&&(0,a.jsx)(Z.Z,{title:(0,a.jsxs)("div",{className:"text-xs",children:[(0,a.jsx)("div",{className:"mb-1",children:"Copy response ID to continue session:"}),(0,a.jsx)("div",{className:"bg-gray-800 text-gray-100 p-2 rounded font-mono text-xs whitespace-pre-wrap",children:'curl -X POST "your-proxy-url/v1/responses" \\\n -H "Authorization: Bearer your-api-key" \\\n -H "Content-Type: application/json" \\\n -d \'{\n "model": "your-model",\n "input": [{"role": "user", "content": "your message", "type": "message"}],\n "previous_response_id": "'.concat(s,'",\n "stream": true\n }\'')})]}),overlayStyle:{maxWidth:"500px"},children:(0,a.jsx)("button",{onClick:()=>{s&&(navigator.clipboard.writeText(s),U.Z.success("Response ID copied to clipboard!"))},className:"ml-2 p-1 hover:bg-green-100 rounded transition-colors",children:(0,a.jsx)(ew.Z,{style:{fontSize:"12px"}})})})]}),(0,a.jsx)("div",{className:"text-xs opacity-75 mt-1",children:s?o?"LiteLLM API session active - context maintained server-side":"UI session active - context maintained client-side":o?"LiteLLM will manage session using previous_response_id":"UI will manage session using chat history"})]})]})};let{TextArea:e$}=w.default,{Dragger:eQ}=S.default;var e0=e=>{let{accessToken:t,token:s,userRole:w,userID:S,disabledPersonalKeyCreation:F,proxySettings:B}=e,[H,G]=(0,E.useState)(!1),[W,X]=(0,E.useState)([]),[ea,eo]=(0,E.useState)(()=>{let e=sessionStorage.getItem("selectedMCPTools");try{let t=e?JSON.parse(e):[];return Array.isArray(t)?t:t?[t]:[]}catch(e){return console.error("Error parsing selectedMCPTools from sessionStorage",e),[]}}),[en,ef]=(0,E.useState)(!1),[eb,ey]=(0,E.useState)(()=>{let e=sessionStorage.getItem("apiKeySource");if(e)try{return JSON.parse(e)}catch(e){console.error("Error parsing apiKeySource from sessionStorage",e)}return F?"custom":"session"}),[ej,eN]=(0,E.useState)(()=>sessionStorage.getItem("apiKey")||""),[ew,eS]=(0,E.useState)(""),[ek,eP]=(0,E.useState)(()=>{try{let e=sessionStorage.getItem("chatHistory");return e?JSON.parse(e):[]}catch(e){return console.error("Error parsing chatHistory from sessionStorage",e),[]}}),[eA,eC]=(0,E.useState)(void 0),[eZ,eT]=(0,E.useState)(!1),[e_,eI]=(0,E.useState)([]),[eR,eM]=(0,E.useState)([]),[eL,eO]=(0,E.useState)(void 0),ez=(0,E.useRef)(null),[eH,eq]=(0,E.useState)(()=>sessionStorage.getItem("endpointType")||V.KP.CHAT),[eJ,eY]=(0,E.useState)(!1),e0=(0,E.useRef)(null),[e1,e2]=(0,E.useState)(()=>{let e=sessionStorage.getItem("selectedTags");try{return e?JSON.parse(e):[]}catch(e){return console.error("Error parsing selectedTags from sessionStorage",e),[]}}),[e4,e3]=(0,E.useState)(()=>{let e=sessionStorage.getItem("selectedVoice");if(!e)return"alloy";try{return JSON.parse(e)}catch(t){return e}}),[e5,e6]=(0,E.useState)(()=>{let e=sessionStorage.getItem("selectedVectorStores");try{return e?JSON.parse(e):[]}catch(e){return console.error("Error parsing selectedVectorStores from sessionStorage",e),[]}}),[e7,e8]=(0,E.useState)(()=>{let e=sessionStorage.getItem("selectedGuardrails");try{return e?JSON.parse(e):[]}catch(e){return console.error("Error parsing selectedGuardrails from sessionStorage",e),[]}}),[e9,te]=(0,E.useState)(()=>sessionStorage.getItem("messageTraceId")||null),[tt,ts]=(0,E.useState)(()=>sessionStorage.getItem("responsesSessionId")||null),[ta,to]=(0,E.useState)(()=>{let e=sessionStorage.getItem("useApiSessionManagement");return!e||JSON.parse(e)}),[tr,tn]=(0,E.useState)([]),[tl,ti]=(0,E.useState)([]),[tc,td]=(0,E.useState)(null),[tm,tu]=(0,E.useState)(null),[tx,tg]=(0,E.useState)(null),[tp,th]=(0,E.useState)(null),[tf,tv]=(0,E.useState)(null),[tb,ty]=(0,E.useState)(!1),[tj,tN]=(0,E.useState)(""),[tw,tS]=(0,E.useState)("openai"),[tk,tP]=(0,E.useState)([]),[tA,tC]=(0,E.useState)(1),[tZ,tT]=(0,E.useState)(2048),[t_,tE]=(0,E.useState)(!1),tI=(0,E.useRef)(null),tR=async()=>{let e="session"===eb?t:ej;if(e){ef(!0);try{let t=await em(e);X(t)}catch(e){console.error("Error fetching MCP tools:",e)}finally{ef(!1)}}};(0,E.useEffect)(()=>{H&&tR()},[H,t,ej,eb]),(0,E.useEffect)(()=>{tb&&tN((0,et.L)({apiKeySource:eb,accessToken:t,apiKey:ej,inputMessage:ew,chatHistory:ek,selectedTags:e1,selectedVectorStores:e5,selectedGuardrails:e7,selectedMCPTools:ea,endpointType:eH,selectedModel:eA,selectedSdk:tw,selectedVoice:e4,proxySettings:B}))},[tb,tw,eb,t,ej,ew,ek,e1,e5,e7,ea,eH,eA,B]),(0,E.useEffect)(()=>{let e=setTimeout(()=>{sessionStorage.setItem("chatHistory",JSON.stringify(ek))},500);return()=>{clearTimeout(e)}},[ek]),(0,E.useEffect)(()=>{sessionStorage.setItem("apiKeySource",JSON.stringify(eb)),sessionStorage.setItem("apiKey",ej),sessionStorage.setItem("endpointType",eH),sessionStorage.setItem("selectedTags",JSON.stringify(e1)),sessionStorage.setItem("selectedVectorStores",JSON.stringify(e5)),sessionStorage.setItem("selectedGuardrails",JSON.stringify(e7)),sessionStorage.setItem("selectedMCPTools",JSON.stringify(ea)),sessionStorage.setItem("selectedVoice",e4),eA?sessionStorage.setItem("selectedModel",eA):sessionStorage.removeItem("selectedModel"),e9?sessionStorage.setItem("messageTraceId",e9):sessionStorage.removeItem("messageTraceId"),tt?sessionStorage.setItem("responsesSessionId",tt):sessionStorage.removeItem("responsesSessionId"),sessionStorage.setItem("useApiSessionManagement",JSON.stringify(ta))},[eb,ej,eA,eH,e1,e5,e7,e9,tt,ta,ea,e4]),(0,E.useEffect)(()=>{let e="session"===eb?t:ej;if(!e||!s||!w||!S){console.log("userApiKey or token or userRole or userID is missing = ",e,s,w,S);return}(async()=>{try{if(!e){console.log("userApiKey is missing");return}let t=await (0,eu.p)(e);console.log("Fetched models:",t),eI(t);let s=t.some(e=>e.model_group===eA);t.length&&s||eC(void 0)}catch(e){console.error("Error fetching model info:",e)}})(),tR()},[t,S,w,eb,ej,s]),(0,E.useEffect)(()=>{let e="session"===eb?t:ej;e&&eH===V.KP.A2A_AGENTS&&(async()=>{try{let t=await eh(e);eM(t),eL&&!t.some(e=>e.agent_name===eL)&&eO(void 0)}catch(e){console.error("Error fetching agents:",e)}})()},[t,eb,ej,eH]),(0,E.useEffect)(()=>{tI.current&&setTimeout(()=>{var e;null===(e=tI.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"end"})},100)},[ek]);let tM=(e,t,s)=>{console.log("updateTextUI called with:",e,t,s),eP(a=>{let o=a[a.length-1];if(!o||o.role!==e||o.isImage||o.isAudio)return[...a,{role:e,content:t,model:s}];{var r;let e={...o,content:o.content+t,model:null!==(r=o.model)&&void 0!==r?r:s};return[...a.slice(0,-1),e]}})},tL=e=>{eP(t=>{let s=t[t.length-1];return!s||"assistant"!==s.role||s.isImage||s.isAudio?t.length>0&&"user"===t[t.length-1].role?[...t,{role:"assistant",content:"",reasoningContent:e}]:t:[...t.slice(0,t.length-1),{...s,reasoningContent:(s.reasoningContent||"")+e}]})},tO=e=>{console.log("updateTimingData called with:",e),eP(t=>{let s=t[t.length-1];if(console.log("Current last message:",s),s&&"assistant"===s.role){console.log("Updating assistant message with timeToFirstToken:",e);let a=[...t.slice(0,t.length-1),{...s,timeToFirstToken:e}];return console.log("Updated chat history:",a),a}return s&&"user"===s.role?(console.log("Creating new assistant message with timeToFirstToken:",e),[...t,{role:"assistant",content:"",timeToFirstToken:e}]):(console.log("No appropriate message found to update timing"),t)})},tK=(e,t)=>{console.log("Received usage data:",e),eP(s=>{let a=s[s.length-1];if(a&&"assistant"===a.role){console.log("Updating message with usage data:",e);let o={...a,usage:e,toolName:t};return console.log("Updated message:",o),[...s.slice(0,s.length-1),o]}return s})},tU=e=>{console.log("Received A2A metadata:",e),eP(t=>{let s=t[t.length-1];if(s&&"assistant"===s.role){let a={...s,a2aMetadata:e};return[...t.slice(0,t.length-1),a]}return t})},tD=e=>{eP(t=>{let s=t[t.length-1];return s&&"assistant"===s.role?[...t.slice(0,t.length-1),{...s,totalLatency:e}]:t})},tz=e=>{console.log("Received search results:",e),eP(t=>{let s=t[t.length-1];if(s&&"assistant"===s.role){console.log("Updating message with search results");let a={...s,searchResults:e};return[...t.slice(0,t.length-1),a]}return t})},tF=e=>{console.log("Received response ID for session management:",e),ta&&ts(e)},tB=e=>{console.log("ChatUI: Received MCP event:",e),tP(t=>{if(t.some(t=>t.item_id===e.item_id&&t.type===e.type&&t.sequence_number===e.sequence_number))return console.log("ChatUI: Duplicate MCP event, skipping"),t;let s=[...t,e];return console.log("ChatUI: Updated MCP events:",s),s})},tH=(e,t)=>{eP(s=>[...s,{role:"assistant",content:e,model:t,isImage:!0}])},tG=(e,t)=>{eP(s=>[...s,{role:"assistant",content:(0,O.aS)(e,100),model:t,isEmbeddings:!0}])},tq=(e,t)=>{eP(s=>[...s,{role:"assistant",content:e,model:t,isAudio:!0}])},tJ=(e,t)=>{eP(s=>{let a=s[s.length-1];if(!a||"assistant"!==a.role||a.isImage||a.isAudio)return[...s,{role:"assistant",content:"",model:t,image:{url:e,detail:"auto"}}];{var o;let r={...a,image:{url:e,detail:"auto"},model:null!==(o=a.model)&&void 0!==o?o:t};return[...s.slice(0,-1),r]}})},tV=e=>{tn(t=>[...t,e]);let t=URL.createObjectURL(e);return ti(e=>[...e,t]),!1},tW=e=>{tl[e]&&URL.revokeObjectURL(tl[e]),tn(t=>t.filter((t,s)=>s!==e)),ti(t=>t.filter((t,s)=>s!==e))},tY=()=>{tl.forEach(e=>{URL.revokeObjectURL(e)}),tn([]),ti([])},tX=()=>{tm&&URL.revokeObjectURL(tm),td(null),tu(null)},t$=()=>{tp&&URL.revokeObjectURL(tp),tg(null),th(null)},tQ=()=>{tv(null)},t0=async()=>{let e;if(""===ew.trim()&&eH!==V.KP.TRANSCRIPTION)return;if(eH===V.KP.IMAGE_EDITS&&0===tr.length){U.Z.fromBackend("Please upload at least one image for editing");return}if(eH===V.KP.TRANSCRIPTION&&!tf){U.Z.fromBackend("Please upload an audio file for transcription");return}if(eH===V.KP.A2A_AGENTS&&!eL){U.Z.fromBackend("Please select an agent to send a message");return}if(!s||!w||!S)return;let a="session"===eb?t:ej;if(!a){U.Z.fromBackend("Please provide a Virtual Key or select Current UI Session");return}e0.current=new AbortController;let o=e0.current.signal;if(eH===V.KP.RESPONSES&&tc)try{e=await eF(ew,tc)}catch(e){U.Z.fromBackend("Failed to process image. Please try again.");return}else if(eH===V.KP.CHAT&&tx)try{e=await (0,ee.Sn)(ew,tx)}catch(e){U.Z.fromBackend("Failed to process image. Please try again.");return}else e={role:"user",content:ew};let r=e9||(0,L.Z)();e9||te(r),eP([...ek,eH===V.KP.RESPONSES&&tc?eB(ew,!0,tm||void 0,tc.name):eH===V.KP.CHAT&&tx?(0,ee.Hk)(ew,!0,tp||void 0,tx.name):eH===V.KP.TRANSCRIPTION&&tf?eB(ew?"\uD83C\uDFB5 Audio file: ".concat(tf.name,"\nPrompt: ").concat(ew):"\uD83C\uDFB5 Audio file: ".concat(tf.name),!1):eB(ew,!1)]),tP([]),eY(!0);try{if(eA){if(eH===V.KP.CHAT){let t=[...ek.filter(e=>!e.isImage&&!e.isAudio).map(e=>{let{role:t,content:s}=e;return{role:t,content:"string"==typeof s?s:""}}),e];await (0,ec.n)(t,(e,t)=>tM("assistant",e,t),eA,a,e1,o,tL,tO,tK,r,e5.length>0?e5:void 0,e7.length>0?e7:void 0,ea,tJ,tz,t_?tA:void 0,t_?tZ:void 0,tD)}else if(eH===V.KP.IMAGE)await eg(ew,(e,t)=>tH(e,t),eA,a,e1,o);else if(eH===V.KP.SPEECH)await el(ew,e4,(e,t)=>tq(e,t),eA||"",a,e1,o);else if(eH===V.KP.IMAGE_EDITS)tr.length>0&&await ex(1===tr.length?tr[0]:tr,ew,(e,t)=>tH(e,t),eA,a,e1,o);else if(eH===V.KP.RESPONSES){let t;t=ta&&tt?[e]:[...ek.filter(e=>!e.isImage&&!e.isAudio).map(e=>{let{role:t,content:s}=e;return{role:t,content:s}}),e],await ep(t,(e,t,s)=>tM(e,t,s),eA,a,e1,o,tL,tO,tK,r,e5.length>0?e5:void 0,e7.length>0?e7:void 0,ea,ta?tt:null,tF,tB)}else if(eH===V.KP.ANTHROPIC_MESSAGES){let t=[...ek.filter(e=>!e.isImage&&!e.isAudio).map(e=>{let{role:t,content:s}=e;return{role:t,content:s}}),e];await er(t,(e,t,s)=>tM(e,t,s),eA,a,e1,o,tL,tO,tK,r,e5.length>0?e5:void 0,e7.length>0?e7:void 0,ea)}else eH===V.KP.EMBEDDINGS?await ed(ew,(e,t)=>tG(e,t),eA,a,e1):eH===V.KP.TRANSCRIPTION&&tf&&await ei(tf,(e,t)=>tM("assistant",e,t),eA,a,e1,o)}eH===V.KP.A2A_AGENTS&&eL&&await ev(eL,ew,(e,t)=>tM("assistant",e,t),a,o,tO,tD,tU)}catch(e){o.aborted?console.log("Request was cancelled"):(console.error("Error fetching response",e),tM("assistant","Error fetching response:"+e))}finally{eY(!1),e0.current=null,eH===V.KP.IMAGE_EDITS&&tY(),eH===V.KP.RESPONSES&&tc&&tX(),eH===V.KP.CHAT&&tx&&t$(),eH===V.KP.TRANSCRIPTION&&tf&&tQ()}eS("")};if(w&&"Admin Viewer"===w){let{Title:e,Paragraph:t}=k.default;return(0,a.jsxs)("div",{children:[(0,a.jsx)(e,{level:1,children:"Access Denied"}),(0,a.jsx)(t,{children:"Ask your proxy admin for access to test models"})]})}let t1=(0,a.jsx)(o.Z,{style:{fontSize:24},spin:!0});return(0,a.jsxs)("div",{className:"w-full p-4 pb-0 bg-white",children:[(0,a.jsx)(N.Zb,{className:"w-full rounded-xl shadow-md overflow-hidden",children:(0,a.jsxs)("div",{className:"flex h-[80vh] w-full gap-4",children:[(0,a.jsxs)("div",{className:"w-1/4 p-4 bg-gray-50 overflow-y-auto",children:[(0,a.jsx)(N.Dx,{className:"text-xl font-semibold mb-6 mt-2",children:"Configurations"}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)(N.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,a.jsx)(r.Z,{className:"mr-2"})," Virtual Key Source"]}),(0,a.jsx)(P.default,{disabled:F,value:eb,style:{width:"100%"},onChange:e=>{ey(e)},options:[{value:"session",label:"Current UI Session"},{value:"custom",label:"Virtual Key"}],className:"rounded-md"}),"custom"===eb&&(0,a.jsx)(N.oi,{className:"mt-2",placeholder:"Enter custom Virtual Key",type:"password",onValueChange:eN,value:ej,icon:r.Z})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)(N.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,a.jsx)(n.Z,{className:"mr-2"})," Endpoint Type"]}),(0,a.jsx)(es,{endpointType:eH,onEndpointChange:e=>{eq(e),eC(void 0),eO(void 0),eT(!1);try{sessionStorage.removeItem("selectedModel"),sessionStorage.removeItem("selectedAgent")}catch(e){}},className:"mb-4"}),eH===V.KP.SPEECH&&(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsxs)(N.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,a.jsx)(l.Z,{className:"mr-2"}),"Voice"]}),(0,a.jsx)(P.default,{value:e4,onChange:e=>{e3(e),sessionStorage.setItem("selectedVoice",e)},style:{width:"100%"},className:"rounded-md",options:Y})]}),(0,a.jsx)(eX,{endpointType:eH,responsesSessionId:tt,useApiSessionManagement:ta,onToggleSessionManagement:e=>{to(e),e||ts(null)}})]}),eH!==V.KP.A2A_AGENTS&&(0,a.jsxs)("div",{children:[(0,a.jsxs)(N.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center justify-between",children:[(0,a.jsxs)("span",{className:"flex items-center",children:[(0,a.jsx)(i.Z,{className:"mr-2"})," Select Model"]}),(()=>{if(!eA||"custom"===eA)return!1;let e=e_.find(e=>e.model_group===eA);return!!e&&(!e.mode||"chat"===e.mode)})()?(0,a.jsx)(A.Z,{content:(0,a.jsx)(q,{temperature:tA,maxTokens:tZ,useAdvancedParams:t_,onTemperatureChange:tC,onMaxTokensChange:tT,onUseAdvancedParamsChange:tE}),title:"Model Settings",trigger:"click",placement:"right",children:(0,a.jsx)(C.ZP,{type:"text",size:"small",icon:(0,a.jsx)(c.Z,{}),className:"text-gray-500 hover:text-gray-700"})}):(0,a.jsx)(Z.Z,{title:"Advanced parameters are only supported for chat models currently",children:(0,a.jsx)(C.ZP,{type:"text",size:"small",icon:(0,a.jsx)(c.Z,{}),className:"text-gray-300 cursor-not-allowed",disabled:!0})})]}),(0,a.jsx)(P.default,{value:eA,placeholder:"Select a Model",onChange:e=>{console.log("selected ".concat(e)),eC(e),eT("custom"===e)},options:[...Array.from(new Set(e_.filter(e=>{if(!e.mode)return!0;let t=(0,V.vf)(e.mode);return eH===V.KP.RESPONSES||eH===V.KP.ANTHROPIC_MESSAGES?t===eH||t===V.KP.CHAT:eH===V.KP.IMAGE_EDITS?t===eH||t===V.KP.IMAGE:t===eH}).map(e=>e.model_group))).map((e,t)=>({value:e,label:e,key:t})),{value:"custom",label:"Enter custom model",key:"custom"}],style:{width:"100%"},showSearch:!0,className:"rounded-md"}),eZ&&(0,a.jsx)(N.oi,{className:"mt-2",placeholder:"Enter custom model name",onValueChange:e=>{ez.current&&clearTimeout(ez.current),ez.current=setTimeout(()=>{eC(e)},500)}})]}),eH===V.KP.A2A_AGENTS&&(0,a.jsxs)("div",{children:[(0,a.jsxs)(N.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,a.jsx)(i.Z,{className:"mr-2"})," Select Agent"]}),(0,a.jsx)(P.default,{value:eL,placeholder:"Select an Agent",onChange:e=>eO(e),options:eR.map(e=>({value:e.agent_name,label:e.agent_name||e.agent_id,key:e.agent_id})),style:{width:"100%"},showSearch:!0,className:"rounded-md",optionLabelProp:"label",children:eR.map(e=>{var t;return(0,a.jsx)(P.default.Option,{value:e.agent_name,label:e.agent_name||e.agent_id,children:(0,a.jsxs)("div",{className:"flex flex-col py-1",children:[(0,a.jsx)("span",{className:"font-medium",children:e.agent_name||e.agent_id}),(null===(t=e.agent_card_params)||void 0===t?void 0:t.description)&&(0,a.jsx)("span",{className:"text-xs text-gray-500 mt-1",children:e.agent_card_params.description})]})},e.agent_id)})}),0===eR.length&&(0,a.jsx)(N.xv,{className:"text-xs text-gray-500 mt-2 block",children:"No agents found. Create agents via /v1/agents endpoint."})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)(N.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,a.jsx)(d.Z,{className:"mr-2"})," Tags"]}),(0,a.jsx)(D.Z,{value:e1,onChange:e2,className:"mb-4",accessToken:t||""})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)(N.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,a.jsx)(m.Z,{className:"mr-2"})," MCP Tool",(0,a.jsx)(Z.Z,{className:"ml-1",title:"Select MCP tools to use in your conversation, only available for /v1/responses endpoint",children:(0,a.jsx)(u.Z,{})})]}),(0,a.jsx)(P.default,{mode:"multiple",style:{width:"100%"},placeholder:"Select MCP tools",value:ea,onChange:e=>eo(e),loading:en,className:"mb-4",allowClear:!0,optionLabelProp:"label",disabled:eH!==V.KP.RESPONSES,maxTagCount:"responsive",children:Array.isArray(W)&&W.map(e=>(0,a.jsx)(P.default.Option,{value:e.name,label:(0,a.jsx)("div",{className:"font-medium",children:e.name}),children:(0,a.jsxs)("div",{className:"flex flex-col py-1",children:[(0,a.jsx)("span",{className:"font-medium",children:e.name}),(0,a.jsx)("span",{className:"text-xs text-gray-500 mt-1",children:e.description})]})},e.name))})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)(N.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,a.jsx)(x.Z,{className:"mr-2"})," Vector Store",(0,a.jsx)(Z.Z,{className:"ml-1",title:(0,a.jsxs)("span",{children:["Select vector store(s) to use for this LLM API call. You can set up your vector store"," ",(0,a.jsx)("a",{href:"?page=vector-stores",style:{color:"#1890ff"},children:"here"}),"."]}),children:(0,a.jsx)(u.Z,{})})]}),(0,a.jsx)(z.Z,{value:e5,onChange:e6,className:"mb-4",accessToken:t||""})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)(N.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,a.jsx)(g.Z,{className:"mr-2"})," Guardrails",(0,a.jsx)(Z.Z,{className:"ml-1",title:(0,a.jsxs)("span",{children:["Select guardrail(s) to use for this LLM API call. You can set up your guardrails"," ",(0,a.jsx)("a",{href:"?page=guardrails",style:{color:"#1890ff"},children:"here"}),"."]}),children:(0,a.jsx)(u.Z,{})})]}),(0,a.jsx)(K.Z,{value:e7,onChange:e8,className:"mb-4",accessToken:t||""})]})]})]}),(0,a.jsxs)("div",{className:"w-3/4 flex flex-col bg-white",children:[(0,a.jsxs)("div",{className:"p-4 border-b border-gray-200 flex justify-between items-center",children:[(0,a.jsx)(N.Dx,{className:"text-xl font-semibold mb-0",children:"Test Key"}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(N.zx,{onClick:()=>{ek.forEach(e=>{e.isAudio&&"string"==typeof e.content&&URL.revokeObjectURL(e.content)}),eP([]),te(null),ts(null),tP([]),tY(),tX(),t$(),tQ(),sessionStorage.removeItem("chatHistory"),sessionStorage.removeItem("messageTraceId"),sessionStorage.removeItem("responsesSessionId"),U.Z.success("Chat history cleared.")},className:"bg-gray-100 hover:bg-gray-200 text-gray-700 border-gray-300",icon:p.Z,children:"Clear Chat"}),(0,a.jsx)(N.zx,{onClick:()=>ty(!0),className:"bg-gray-100 hover:bg-gray-200 text-gray-700 border-gray-300",icon:h.Z,children:"Get Code"})]})]}),(0,a.jsxs)("div",{className:"flex-1 overflow-auto p-4 pb-0",children:[0===ek.length&&(0,a.jsxs)("div",{className:"h-full flex flex-col items-center justify-center text-gray-400",children:[(0,a.jsx)(i.Z,{style:{fontSize:"48px",marginBottom:"16px"}}),(0,a.jsx)(N.xv,{children:"Start a conversation, generate an image, or handle audio"})]}),ek.map((e,t)=>(0,a.jsx)("div",{children:(0,a.jsx)("div",{className:"mb-4 ".concat("user"===e.role?"text-right":"text-left"),children:(0,a.jsxs)("div",{className:"inline-block max-w-[80%] rounded-lg shadow-sm p-3.5 px-4",style:{backgroundColor:"user"===e.role?"#f0f8ff":"#ffffff",border:"user"===e.role?"1px solid #e6f0fa":"1px solid #f0f0f0",textAlign:"left"},children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-1.5",children:[(0,a.jsx)("div",{className:"flex items-center justify-center w-6 h-6 rounded-full mr-1",style:{backgroundColor:"user"===e.role?"#e6f0fa":"#f5f5f5"},children:"user"===e.role?(0,a.jsx)(f.Z,{style:{fontSize:"12px",color:"#2563eb"}}):(0,a.jsx)(i.Z,{style:{fontSize:"12px",color:"#4b5563"}})}),(0,a.jsx)("strong",{className:"text-sm capitalize",children:e.role}),"assistant"===e.role&&e.model&&(0,a.jsx)("span",{className:"text-xs px-2 py-0.5 rounded bg-gray-100 text-gray-600 font-normal",children:e.model})]}),e.reasoningContent&&(0,a.jsx)(eU.Z,{reasoningContent:e.reasoningContent}),"assistant"===e.role&&t===ek.length-1&&tk.length>0&&eH===V.KP.RESPONSES&&(0,a.jsx)("div",{className:"mb-3",children:(0,a.jsx)(eK,{events:tk})}),"assistant"===e.role&&e.searchResults&&(0,a.jsx)(eW.J,{searchResults:e.searchResults}),(0,a.jsxs)("div",{className:"whitespace-pre-wrap break-words max-w-full message-content",style:{wordWrap:"break-word",overflowWrap:"break-word",wordBreak:"break-word",hyphens:"auto"},children:[e.isImage?(0,a.jsx)("img",{src:"string"==typeof e.content?e.content:"",alt:"Generated image",className:"max-w-full rounded-md border border-gray-200 shadow-sm",style:{maxHeight:"500px"}}):e.isAudio?(0,a.jsx)(J,{message:e}):(0,a.jsxs)(a.Fragment,{children:[eH===V.KP.RESPONSES&&(0,a.jsx)(eG,{message:e}),eH===V.KP.CHAT&&(0,a.jsx)($.Z,{message:e}),(0,a.jsx)(I.UG,{components:{code(e){let{node:t,inline:s,className:o,children:r,...n}=e,l=/language-(\w+)/.exec(o||"");return!s&&l?(0,a.jsx)(R.Z,{style:M.Z,language:l[1],PreTag:"div",className:"rounded-md my-2",wrapLines:!0,wrapLongLines:!0,...n,children:String(r).replace(/\n$/,"")}):(0,a.jsx)("code",{className:"".concat(o," px-1.5 py-0.5 rounded bg-gray-100 text-sm font-mono"),style:{wordBreak:"break-word"},...n,children:r})},pre:e=>{let{node:t,...s}=e;return(0,a.jsx)("pre",{style:{overflowX:"auto",maxWidth:"100%"},...s})}},children:"string"==typeof e.content?e.content:""}),e.image&&(0,a.jsx)("div",{className:"mt-3",children:(0,a.jsx)("img",{src:e.image.url,alt:"Generated image",className:"max-w-full rounded-md border border-gray-200 shadow-sm",style:{maxHeight:"500px"}})})]}),"assistant"===e.role&&(e.timeToFirstToken||e.totalLatency||e.usage)&&!e.a2aMetadata&&(0,a.jsx)(eD.Z,{timeToFirstToken:e.timeToFirstToken,totalLatency:e.totalLatency,usage:e.usage,toolName:e.toolName}),"assistant"===e.role&&e.a2aMetadata&&(0,a.jsx)(eE,{a2aMetadata:e.a2aMetadata,timeToFirstToken:e.timeToFirstToken,totalLatency:e.totalLatency})]})]})})},t)),eJ&&tk.length>0&&eH===V.KP.RESPONSES&&ek.length>0&&"user"===ek[ek.length-1].role&&(0,a.jsx)("div",{className:"text-left mb-4",children:(0,a.jsxs)("div",{className:"inline-block max-w-[80%] rounded-lg shadow-sm p-3.5 px-4",style:{backgroundColor:"#ffffff",border:"1px solid #f0f0f0",textAlign:"left"},children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-1.5",children:[(0,a.jsx)("div",{className:"flex items-center justify-center w-6 h-6 rounded-full mr-1",style:{backgroundColor:"#f5f5f5"},children:(0,a.jsx)(i.Z,{style:{fontSize:"12px",color:"#4b5563"}})}),(0,a.jsx)("strong",{className:"text-sm capitalize",children:"Assistant"})]}),(0,a.jsx)(eK,{events:tk})]})}),eJ&&(0,a.jsx)("div",{className:"flex justify-center items-center my-4",children:(0,a.jsx)(T.Z,{indicator:t1})}),(0,a.jsx)("div",{ref:tI,style:{height:"1px"}})]}),(0,a.jsxs)("div",{className:"p-4 border-t border-gray-200 bg-white",children:[eH===V.KP.IMAGE_EDITS&&(0,a.jsx)("div",{className:"mb-4",children:0===tr.length?(0,a.jsxs)(eQ,{beforeUpload:tV,accept:"image/*",showUploadList:!1,children:[(0,a.jsx)("p",{className:"ant-upload-drag-icon",children:(0,a.jsx)(v.Z,{style:{fontSize:"24px",color:"#666"}})}),(0,a.jsx)("p",{className:"ant-upload-text text-sm",children:"Click or drag images to upload"}),(0,a.jsx)("p",{className:"ant-upload-hint text-xs text-gray-500",children:"Support for PNG, JPG, JPEG formats. Multiple images supported."})]}):(0,a.jsxs)("div",{className:"flex flex-wrap gap-2",children:[tr.map((e,t)=>(0,a.jsxs)("div",{className:"relative inline-block",children:[(0,a.jsx)("img",{src:tl[t]||"",alt:"Upload preview ".concat(t+1),className:"max-w-32 max-h-32 rounded-md border border-gray-200 object-cover"}),(0,a.jsx)("button",{className:"absolute top-1 right-1 bg-white shadow-sm border border-gray-200 rounded px-1 py-1 text-red-500 hover:bg-red-50 text-xs",onClick:()=>tW(t),children:(0,a.jsx)(b.Z,{})})]},t)),(0,a.jsxs)("div",{className:"flex items-center justify-center w-32 h-32 border-2 border-dashed border-gray-300 rounded-md hover:border-gray-400 cursor-pointer",onClick:()=>{var e;return null===(e=document.getElementById("additional-image-upload"))||void 0===e?void 0:e.click()},children:[(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)(v.Z,{style:{fontSize:"24px",color:"#666"}}),(0,a.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Add more"})]}),(0,a.jsx)("input",{id:"additional-image-upload",type:"file",accept:"image/*",multiple:!0,style:{display:"none"},onChange:e=>{Array.from(e.target.files||[]).forEach(e=>tV(e))}})]})]})}),eH===V.KP.TRANSCRIPTION&&(0,a.jsx)("div",{className:"mb-4",children:tf?(0,a.jsxs)("div",{className:"flex items-center gap-3 p-3 bg-gray-50 rounded-lg border border-gray-200",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 flex-1",children:[(0,a.jsx)(l.Z,{style:{fontSize:"20px",color:"#666"}}),(0,a.jsx)("span",{className:"text-sm font-medium",children:tf.name}),(0,a.jsxs)("span",{className:"text-xs text-gray-500",children:["(",(tf.size/1024/1024).toFixed(2)," MB)"]})]}),(0,a.jsxs)("button",{className:"bg-white shadow-sm border border-gray-200 rounded px-2 py-1 text-red-500 hover:bg-red-50 text-xs",onClick:tQ,children:[(0,a.jsx)(b.Z,{})," Remove"]})]}):(0,a.jsxs)(eQ,{beforeUpload:e=>(tv(e),!1),accept:"audio/*,.mp3,.mp4,.mpeg,.mpga,.m4a,.wav,.webm",showUploadList:!1,children:[(0,a.jsx)("p",{className:"ant-upload-drag-icon",children:(0,a.jsx)(l.Z,{style:{fontSize:"24px",color:"#666"}})}),(0,a.jsx)("p",{className:"ant-upload-text text-sm",children:"Click or drag audio file to upload"}),(0,a.jsx)("p",{className:"ant-upload-hint text-xs text-gray-500",children:"Support for MP3, MP4, MPEG, MPGA, M4A, WAV, WEBM formats. Max file size: 25 MB."})]})}),eH===V.KP.RESPONSES&&tc&&(0,a.jsx)("div",{className:"mb-2",children:(0,a.jsxs)("div",{className:"flex items-center gap-3 p-3 bg-gray-50 rounded-lg border border-gray-200",children:[(0,a.jsx)("div",{className:"relative inline-block",children:tc.name.toLowerCase().endsWith(".pdf")?(0,a.jsx)("div",{className:"w-10 h-10 rounded-md bg-red-500 flex items-center justify-center",children:(0,a.jsx)(y.Z,{style:{fontSize:"16px",color:"white"}})}):(0,a.jsx)("img",{src:tm||"",alt:"Upload preview",className:"w-10 h-10 rounded-md border border-gray-200 object-cover"})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("div",{className:"text-sm font-medium text-gray-900 truncate",children:tc.name}),(0,a.jsx)("div",{className:"text-xs text-gray-500",children:tc.name.toLowerCase().endsWith(".pdf")?"PDF":"Image"})]}),(0,a.jsx)("button",{className:"flex items-center justify-center w-6 h-6 text-gray-400 hover:text-gray-600 hover:bg-gray-200 rounded-full transition-colors",onClick:tX,children:(0,a.jsx)(b.Z,{style:{fontSize:"12px"}})})]})}),eH===V.KP.CHAT&&tx&&(0,a.jsx)("div",{className:"mb-2",children:(0,a.jsxs)("div",{className:"flex items-center gap-3 p-3 bg-gray-50 rounded-lg border border-gray-200",children:[(0,a.jsx)("div",{className:"relative inline-block",children:tx.name.toLowerCase().endsWith(".pdf")?(0,a.jsx)("div",{className:"w-10 h-10 rounded-md bg-red-500 flex items-center justify-center",children:(0,a.jsx)(y.Z,{style:{fontSize:"16px",color:"white"}})}):(0,a.jsx)("img",{src:tp||"",alt:"Upload preview",className:"w-10 h-10 rounded-md border border-gray-200 object-cover"})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("div",{className:"text-sm font-medium text-gray-900 truncate",children:tx.name}),(0,a.jsx)("div",{className:"text-xs text-gray-500",children:tx.name.toLowerCase().endsWith(".pdf")?"PDF":"Image"})]}),(0,a.jsx)("button",{className:"flex items-center justify-center w-6 h-6 text-gray-400 hover:text-gray-600 hover:bg-gray-200 rounded-full transition-colors",onClick:t$,children:(0,a.jsx)(b.Z,{style:{fontSize:"12px"}})})]})}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)("div",{className:"flex items-center flex-1 bg-white border border-gray-300 rounded-xl px-3 py-1 min-h-[44px]",children:[(0,a.jsxs)("div",{className:"flex-shrink-0 mr-2",children:[eH===V.KP.RESPONSES&&!tc&&(0,a.jsx)(eV,{responsesUploadedImage:tc,responsesImagePreviewUrl:tm,onImageUpload:e=>(td(e),tu(URL.createObjectURL(e)),!1),onRemoveImage:tX}),eH===V.KP.CHAT&&!tx&&(0,a.jsx)(Q.Z,{chatUploadedImage:tx,chatImagePreviewUrl:tp,onImageUpload:e=>(tg(e),th(URL.createObjectURL(e)),!1),onRemoveImage:t$})]}),(0,a.jsx)(e$,{value:ew,onChange:e=>eS(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),t0())},placeholder:eH===V.KP.CHAT||eH===V.KP.EMBEDDINGS||eH===V.KP.RESPONSES||eH===V.KP.ANTHROPIC_MESSAGES?"Type your message... (Shift+Enter for new line)":eH===V.KP.A2A_AGENTS?"Send a message to the A2A agent...":eH===V.KP.IMAGE_EDITS?"Describe how you want to edit the image...":eH===V.KP.SPEECH?"Enter text to convert to speech...":eH===V.KP.TRANSCRIPTION?"Optional: Add context or prompt for transcription...":"Describe the image you want to generate...",disabled:eJ,className:"flex-1",autoSize:{minRows:1,maxRows:4},style:{resize:"none",border:"none",boxShadow:"none",background:"transparent",padding:"4px 0",fontSize:"14px",lineHeight:"20px"}}),(0,a.jsx)(N.zx,{onClick:t0,disabled:eJ||(eH===V.KP.TRANSCRIPTION?!tf:!ew.trim()),className:"flex-shrink-0 ml-2 !w-8 !h-8 !min-w-8 !p-0 !rounded-full !bg-blue-600 hover:!bg-blue-700 disabled:!bg-gray-300 !border-none !text-white disabled:!text-gray-500 !flex !items-center !justify-center",children:(0,a.jsx)(j.Z,{style:{fontSize:"14px"}})})]}),eJ&&(0,a.jsx)(N.zx,{onClick:()=>{e0.current&&(e0.current.abort(),e0.current=null,eY(!1),U.Z.info("Request cancelled"))},className:"bg-red-50 hover:bg-red-100 text-red-600 border-red-200",icon:b.Z,children:"Cancel"})]})]})]})]})}),(0,a.jsxs)(_.Z,{title:"Generated Code",visible:tb,onCancel:()=>ty(!1),footer:null,width:800,children:[(0,a.jsxs)("div",{className:"flex justify-between items-end my-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(N.xv,{className:"font-medium block mb-1 text-gray-700",children:"SDK Type"}),(0,a.jsx)(P.default,{value:tw,onChange:e=>tS(e),style:{width:150},options:[{value:"openai",label:"OpenAI SDK"},{value:"azure",label:"Azure SDK"}]})]}),(0,a.jsx)(C.ZP,{onClick:()=>{navigator.clipboard.writeText(tj),U.Z.success("Copied to clipboard!")},children:"Copy to Clipboard"})]}),(0,a.jsx)(R.Z,{language:"python",style:M.Z,wrapLines:!0,wrapLongLines:!0,className:"rounded-md",customStyle:{maxHeight:"60vh",overflowY:"auto"},children:tj})]}),"custom"===eb&&(0,a.jsx)(_.Z,{title:"Select MCP Tool",visible:H,onCancel:()=>G(!1),onOk:()=>{G(!1),U.Z.success("MCP tool selection updated")},width:800,children:en?(0,a.jsx)("div",{className:"flex justify-center items-center py-8",children:(0,a.jsx)(T.Z,{indicator:(0,a.jsx)(o.Z,{style:{fontSize:24},spin:!0})})}):(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(N.xv,{className:"text-gray-600 block mb-4",children:"Select the MCP tools you want to use in your conversation."}),(0,a.jsx)(P.default,{mode:"multiple",style:{width:"100%"},placeholder:"Select MCP tools",value:ea,onChange:e=>eo(e),optionLabelProp:"label",allowClear:!0,maxTagCount:"responsive",children:W.map(e=>(0,a.jsx)(P.default.Option,{value:e.name,label:(0,a.jsx)("div",{className:"font-medium",children:e.name}),children:(0,a.jsxs)("div",{className:"flex flex-col py-1",children:[(0,a.jsx)("span",{className:"font-medium",children:e.name}),(0,a.jsx)("span",{className:"text-xs text-gray-500 mt-1",children:e.description})]})},e.name))})]})})]})}},94331:function(e,t,s){var a=s(57437),o=s(2265),r=s(5545),n=s(62831),l=s(17906),i=s(94263),c=s(83322),d=s(70464),m=s(77565);t.Z=e=>{let{reasoningContent:t}=e,[s,u]=(0,o.useState)(!0);return t?(0,a.jsxs)("div",{className:"reasoning-content mt-1 mb-2",children:[(0,a.jsxs)(r.ZP,{type:"text",className:"flex items-center text-xs text-gray-500 hover:text-gray-700",onClick:()=>u(!s),icon:(0,a.jsx)(c.Z,{}),children:[s?"Hide reasoning":"Show reasoning",s?(0,a.jsx)(d.Z,{className:"ml-1"}):(0,a.jsx)(m.Z,{className:"ml-1"})]}),s&&(0,a.jsx)("div",{className:"mt-2 p-3 bg-gray-50 border border-gray-200 rounded-md text-sm text-gray-700",children:(0,a.jsx)(n.UG,{components:{code(e){let{node:t,inline:s,className:o,children:r,...n}=e,c=/language-(\w+)/.exec(o||"");return!s&&c?(0,a.jsx)(l.Z,{style:i.Z,language:c[1],PreTag:"div",className:"rounded-md my-2",...n,children:String(r).replace(/\n$/,"")}):(0,a.jsx)("code",{className:"".concat(o," px-1.5 py-0.5 rounded bg-gray-100 text-sm font-mono"),...n,children:r})}},children:t})})]}):null}},38398:function(e,t,s){var a=s(57437);s(2265);var o=s(99981),r=s(5540),n=s(71282),l=s(11741),i=s(83322),c=s(16601),d=s(62670),m=s(58630);t.Z=e=>{let{timeToFirstToken:t,totalLatency:s,usage:u,toolName:x}=e;return t||s||u?(0,a.jsxs)("div",{className:"response-metrics mt-2 pt-2 border-t border-gray-100 text-xs text-gray-500 flex flex-wrap gap-3",children:[void 0!==t&&(0,a.jsx)(o.Z,{title:"Time to first token",children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(r.Z,{className:"mr-1"}),(0,a.jsxs)("span",{children:["TTFT: ",(t/1e3).toFixed(2),"s"]})]})}),void 0!==s&&(0,a.jsx)(o.Z,{title:"Total latency",children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(r.Z,{className:"mr-1"}),(0,a.jsxs)("span",{children:["Total Latency: ",(s/1e3).toFixed(2),"s"]})]})}),(null==u?void 0:u.promptTokens)!==void 0&&(0,a.jsx)(o.Z,{title:"Prompt tokens",children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(n.Z,{className:"mr-1"}),(0,a.jsxs)("span",{children:["In: ",u.promptTokens]})]})}),(null==u?void 0:u.completionTokens)!==void 0&&(0,a.jsx)(o.Z,{title:"Completion tokens",children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(l.Z,{className:"mr-1"}),(0,a.jsxs)("span",{children:["Out: ",u.completionTokens]})]})}),(null==u?void 0:u.reasoningTokens)!==void 0&&(0,a.jsx)(o.Z,{title:"Reasoning tokens",children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(i.Z,{className:"mr-1"}),(0,a.jsxs)("span",{children:["Reasoning: ",u.reasoningTokens]})]})}),(null==u?void 0:u.totalTokens)!==void 0&&(0,a.jsx)(o.Z,{title:"Total tokens",children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(c.Z,{className:"mr-1"}),(0,a.jsxs)("span",{children:["Total: ",u.totalTokens]})]})}),(null==u?void 0:u.cost)!==void 0&&(0,a.jsx)(o.Z,{title:"Cost",children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(d.Z,{className:"mr-1"}),(0,a.jsxs)("span",{children:["$",u.cost.toFixed(6)]})]})}),x&&(0,a.jsx)(o.Z,{title:"Tool used",children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(m.Z,{className:"mr-1"}),(0,a.jsxs)("span",{children:["Tool: ",x]})]})})]}):null}},33152:function(e,t,s){s.d(t,{J:function(){return d}});var a=s(57437),o=s(2265),r=s(5545),n=s(44625),l=s(70464),i=s(77565),c=s(38434);function d(e){let{searchResults:t}=e,[s,d]=(0,o.useState)(!0),[m,u]=(0,o.useState)({});if(!t||0===t.length)return null;let x=(e,t)=>{let s="".concat(e,"-").concat(t);u(e=>({...e,[s]:!e[s]}))},g=t.reduce((e,t)=>e+t.data.length,0);return(0,a.jsxs)("div",{className:"search-results-content mt-1 mb-2",children:[(0,a.jsxs)(r.ZP,{type:"text",className:"flex items-center text-xs text-gray-500 hover:text-gray-700",onClick:()=>d(!s),icon:(0,a.jsx)(n.Z,{}),children:[s?"Hide sources":"Show sources (".concat(g,")"),s?(0,a.jsx)(l.Z,{className:"ml-1"}):(0,a.jsx)(i.Z,{className:"ml-1"})]}),s&&(0,a.jsx)("div",{className:"mt-2 p-3 bg-gray-50 border border-gray-200 rounded-md text-sm",children:(0,a.jsx)("div",{className:"space-y-3",children:t.map((e,t)=>(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"text-xs text-gray-600 mb-2 flex items-center gap-2",children:[(0,a.jsx)("span",{className:"font-medium",children:"Query:"}),(0,a.jsxs)("span",{className:"italic",children:['"',e.search_query,'"']}),(0,a.jsx)("span",{className:"text-gray-400",children:"•"}),(0,a.jsxs)("span",{className:"text-gray-500",children:[e.data.length," result",1!==e.data.length?"s":""]})]}),(0,a.jsx)("div",{className:"space-y-2",children:e.data.map((e,s)=>{let o=m["".concat(t,"-").concat(s)]||!1;return(0,a.jsxs)("div",{className:"border border-gray-200 rounded-md overflow-hidden bg-white",children:[(0,a.jsx)("div",{className:"flex items-center justify-between p-2 cursor-pointer hover:bg-gray-50 transition-colors",onClick:()=>x(t,s),children:(0,a.jsxs)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[(0,a.jsx)("svg",{className:"w-4 h-4 text-gray-400 transition-transform flex-shrink-0 ".concat(o?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,a.jsx)(c.Z,{className:"text-gray-400 flex-shrink-0",style:{fontSize:"12px"}}),(0,a.jsx)("span",{className:"text-xs font-medium text-gray-700 truncate",children:e.filename||e.file_id||"Result ".concat(s+1)}),(0,a.jsx)("span",{className:"text-xs px-2 py-0.5 rounded bg-blue-100 text-blue-700 font-mono flex-shrink-0",children:e.score.toFixed(3)})]})}),o&&(0,a.jsx)("div",{className:"border-t border-gray-200 bg-white",children:(0,a.jsxs)("div",{className:"p-3 space-y-2",children:[e.content.map((e,t)=>(0,a.jsx)("div",{children:(0,a.jsx)("div",{className:"text-xs font-mono bg-gray-50 p-2 rounded text-gray-800 whitespace-pre-wrap break-words",children:e.text})},t)),e.attributes&&Object.keys(e.attributes).length>0&&(0,a.jsxs)("div",{className:"mt-2 pt-2 border-t border-gray-100",children:[(0,a.jsx)("div",{className:"text-xs text-gray-500 mb-1 font-medium",children:"Metadata:"}),(0,a.jsx)("div",{className:"space-y-1",children:Object.entries(e.attributes).map(e=>{let[t,s]=e;return(0,a.jsxs)("div",{className:"text-xs flex gap-2",children:[(0,a.jsxs)("span",{className:"text-gray-500 font-medium",children:[t,":"]}),(0,a.jsx)("span",{className:"text-gray-700 font-mono break-all",children:String(s)})]},t)})})]})]})})]},s)})})]},t))})})]})}},95459:function(e,t,s){s.d(t,{n:function(){return r}});var a=s(7271),o=s(19250);async function r(e,t,s,r,n,l,i,c,d,m,u,x,g,p,h,f,v,b){console.log=function(){},console.log("isLocal:",!1);let y=(0,o.getProxyBaseUrl)(),j={};n&&n.length>0&&(j["x-litellm-tags"]=n.join(","));let N=new a.ZP.OpenAI({apiKey:r,baseURL:y,dangerouslyAllowBrowser:!0,defaultHeaders:j});try{let a;let o=Date.now(),n=!1,j=g&&g.length>0?[{type:"mcp",server_label:"litellm",server_url:"".concat(y,"/mcp"),require_approval:"never",allowed_tools:g,headers:{"x-litellm-api-key":"Bearer ".concat(r)}}]:void 0;for await(let r of(await N.chat.completions.create({model:s,stream:!0,stream_options:{include_usage:!0},litellm_trace_id:m,messages:e,...u?{vector_store_ids:u}:{},...x?{guardrails:x}:{},...j?{tools:j,tool_choice:"auto"}:{},...void 0!==f?{temperature:f}:{},...void 0!==v?{max_tokens:v}:{}},{signal:l}))){var w,S,k,P,A,C,Z,T,_;console.log("Stream chunk:",r);let e=null===(w=r.choices[0])||void 0===w?void 0:w.delta;if(console.log("Delta content:",null===(k=r.choices[0])||void 0===k?void 0:null===(S=k.delta)||void 0===S?void 0:S.content),console.log("Delta reasoning content:",null==e?void 0:e.reasoning_content),!n&&((null===(A=r.choices[0])||void 0===A?void 0:null===(P=A.delta)||void 0===P?void 0:P.content)||e&&e.reasoning_content)&&(n=!0,a=Date.now()-o,console.log("First token received! Time:",a,"ms"),c?(console.log("Calling onTimingData with:",a),c(a)):console.log("onTimingData callback is not defined!")),null===(Z=r.choices[0])||void 0===Z?void 0:null===(C=Z.delta)||void 0===C?void 0:C.content){let e=r.choices[0].delta.content;t(e,r.model)}if(e&&e.image&&p&&(console.log("Image generated:",e.image),p(e.image.url,r.model)),e&&e.reasoning_content){let t=e.reasoning_content;i&&i(t)}if(e&&(null===(T=e.provider_specific_fields)||void 0===T?void 0:T.search_results)&&h&&(console.log("Search results found:",e.provider_specific_fields.search_results),h(e.provider_specific_fields.search_results)),r.usage&&d){console.log("Usage data found:",r.usage);let e={completionTokens:r.usage.completion_tokens,promptTokens:r.usage.prompt_tokens,totalTokens:r.usage.total_tokens};(null===(_=r.usage.completion_tokens_details)||void 0===_?void 0:_.reasoning_tokens)&&(e.reasoningTokens=r.usage.completion_tokens_details.reasoning_tokens),void 0!==r.usage.cost&&null!==r.usage.cost&&(e.cost=parseFloat(r.usage.cost)),d(e)}}let E=Date.now();b&&b(E-o)}catch(e){throw(null==l?void 0:l.aborted)&&console.log("Chat completion request was cancelled"),e}}},99020:function(e,t,s){var a=s(57437),o=s(2265),r=s(37592),n=s(19250);t.Z=e=>{let{onChange:t,value:s,className:l,accessToken:i}=e,[c,d]=(0,o.useState)([]),[m,u]=(0,o.useState)(!1);return(0,o.useEffect)(()=>{(async()=>{if(i)try{let e=await (0,n.tagListCall)(i);console.log("List tags response:",e),d(Object.values(e))}catch(e){console.error("Error fetching tags:",e)}finally{u(!1)}})()},[i]),(0,a.jsx)(r.default,{mode:"tags",showSearch:!0,placeholder:"Select or create tags",onChange:t,value:s,loading:m,className:l,options:c.map(e=>({label:e.name,value:e.name,title:e.description||e.name})),optionFilterProp:"label",tokenSeparators:[","],maxTagCount:"responsive",allowClear:!0,style:{width:"100%"}})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/6043-9eb55b6feadeca26.js b/litellm/proxy/_experimental/out/_next/static/chunks/6043-4308da67f056896d.js similarity index 99% rename from litellm/proxy/_experimental/out/_next/static/chunks/6043-9eb55b6feadeca26.js rename to litellm/proxy/_experimental/out/_next/static/chunks/6043-4308da67f056896d.js index 50ea168c50..5c930593bc 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/6043-9eb55b6feadeca26.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/6043-4308da67f056896d.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6043],{51653:function(e,o,r){r.d(o,{Z:function(){return H}});var t=r(2265),n=r(8900),a=r(39725),l=r(49638),s=r(54537),i=r(55726),c=r(36760),d=r.n(c),m=r(66632),p=r(18242),u=r(28791),b=r(19722),f=r(71744),g=r(93463),h=r(12918),v=r(99320);let k=(e,o,r,t,n)=>({background:e,border:"".concat((0,g.bf)(t.lineWidth)," ").concat(t.lineType," ").concat(o),["".concat(n,"-icon")]:{color:r}}),x=e=>{let{componentCls:o,motionDurationSlow:r,marginXS:t,marginSM:n,fontSize:a,fontSizeLG:l,lineHeight:s,borderRadiusLG:i,motionEaseInOutCirc:c,withDescriptionIconSize:d,colorText:m,colorTextHeading:p,withDescriptionPadding:u,defaultPadding:b}=e;return{[o]:Object.assign(Object.assign({},(0,h.Wf)(e)),{position:"relative",display:"flex",alignItems:"center",padding:b,wordWrap:"break-word",borderRadius:i,["&".concat(o,"-rtl")]:{direction:"rtl"},["".concat(o,"-content")]:{flex:1,minWidth:0},["".concat(o,"-icon")]:{marginInlineEnd:t,lineHeight:0},"&-description":{display:"none",fontSize:a,lineHeight:s},"&-message":{color:p},["&".concat(o,"-motion-leave")]:{overflow:"hidden",opacity:1,transition:"max-height ".concat(r," ").concat(c,", opacity ").concat(r," ").concat(c,",\n padding-top ").concat(r," ").concat(c,", padding-bottom ").concat(r," ").concat(c,",\n margin-bottom ").concat(r," ").concat(c)},["&".concat(o,"-motion-leave-active")]:{maxHeight:0,marginBottom:"0 !important",paddingTop:0,paddingBottom:0,opacity:0}}),["".concat(o,"-with-description")]:{alignItems:"flex-start",padding:u,["".concat(o,"-icon")]:{marginInlineEnd:n,fontSize:d,lineHeight:0},["".concat(o,"-message")]:{display:"block",marginBottom:t,color:p,fontSize:l},["".concat(o,"-description")]:{display:"block",color:m}},["".concat(o,"-banner")]:{marginBottom:0,border:"0 !important",borderRadius:0}}},w=e=>{let{componentCls:o,colorSuccess:r,colorSuccessBorder:t,colorSuccessBg:n,colorWarning:a,colorWarningBorder:l,colorWarningBg:s,colorError:i,colorErrorBorder:c,colorErrorBg:d,colorInfo:m,colorInfoBorder:p,colorInfoBg:u}=e;return{[o]:{"&-success":k(n,t,r,e,o),"&-info":k(u,p,m,e,o),"&-warning":k(s,l,a,e,o),"&-error":Object.assign(Object.assign({},k(d,c,i,e,o)),{["".concat(o,"-description > pre")]:{margin:0,padding:0}})}}},y=e=>{let{componentCls:o,iconCls:r,motionDurationMid:t,marginXS:n,fontSizeIcon:a,colorIcon:l,colorIconHover:s}=e;return{[o]:{"&-action":{marginInlineStart:n},["".concat(o,"-close-icon")]:{marginInlineStart:n,padding:0,overflow:"hidden",fontSize:a,lineHeight:(0,g.bf)(a),backgroundColor:"transparent",border:"none",outline:"none",cursor:"pointer",["".concat(r,"-close")]:{color:l,transition:"color ".concat(t),"&:hover":{color:s}}},"&-close-text":{color:l,transition:"color ".concat(t),"&:hover":{color:s}}}}};var z=(0,v.I$)("Alert",e=>[x(e),w(e),y(e)],e=>({withDescriptionIconSize:e.fontSizeHeading3,defaultPadding:"".concat(e.paddingContentVerticalSM,"px ").concat(12,"px"),withDescriptionPadding:"".concat(e.paddingMD,"px ").concat(e.paddingContentHorizontalLG,"px")})),j=function(e,o){var r={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&0>o.indexOf(t)&&(r[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,t=Object.getOwnPropertySymbols(e);no.indexOf(t[n])&&Object.prototype.propertyIsEnumerable.call(e,t[n])&&(r[t[n]]=e[t[n]]);return r};let N={success:n.Z,info:i.Z,error:a.Z,warning:s.Z},O=e=>{let{icon:o,prefixCls:r,type:n}=e,a=N[n]||null;return o?(0,b.wm)(o,t.createElement("span",{className:"".concat(r,"-icon")},o),()=>({className:d()("".concat(r,"-icon"),o.props.className)})):t.createElement(a,{className:"".concat(r,"-icon")})},C=e=>{let{isClosable:o,prefixCls:r,closeIcon:n,handleClose:a,ariaProps:s}=e,i=!0===n||void 0===n?t.createElement(l.Z,null):n;return o?t.createElement("button",Object.assign({type:"button",onClick:a,className:"".concat(r,"-close-icon"),tabIndex:0},s),i):null},I=t.forwardRef((e,o)=>{let{description:r,prefixCls:n,message:a,banner:l,className:s,rootClassName:i,style:c,onMouseEnter:b,onMouseLeave:g,onClick:h,afterClose:v,showIcon:k,closable:x,closeText:w,closeIcon:y,action:N,id:I}=e,E=j(e,["description","prefixCls","message","banner","className","rootClassName","style","onMouseEnter","onMouseLeave","onClick","afterClose","showIcon","closable","closeText","closeIcon","action","id"]),[S,M]=t.useState(!1),Z=t.useRef(null);t.useImperativeHandle(o,()=>({nativeElement:Z.current}));let{getPrefixCls:G,direction:W,closable:P,closeIcon:H,className:$,style:A}=(0,f.dj)("alert"),D=G("alert",n),[L,T,_]=z(D),B=o=>{var r;M(!0),null===(r=e.onClose)||void 0===r||r.call(e,o)},R=t.useMemo(()=>void 0!==e.type?e.type:l?"warning":"info",[e.type,l]),q=t.useMemo(()=>"object"==typeof x&&!!x.closeIcon||!!w||("boolean"==typeof x?x:!1!==y&&null!=y||!!P),[w,y,x,P]),V=!!l&&void 0===k||k,Q=d()(D,"".concat(D,"-").concat(R),{["".concat(D,"-with-description")]:!!r,["".concat(D,"-no-icon")]:!V,["".concat(D,"-banner")]:!!l,["".concat(D,"-rtl")]:"rtl"===W},$,s,i,_,T),X=(0,p.Z)(E,{aria:!0,data:!0}),F=t.useMemo(()=>"object"==typeof x&&x.closeIcon?x.closeIcon:w||(void 0!==y?y:"object"==typeof P&&P.closeIcon?P.closeIcon:H),[y,x,P,w,H]),J=t.useMemo(()=>{let e=null!=x?x:P;if("object"==typeof e){let{closeIcon:o}=e;return j(e,["closeIcon"])}return{}},[x,P]);return L(t.createElement(m.ZP,{visible:!S,motionName:"".concat(D,"-motion"),motionAppear:!1,motionEnter:!1,onLeaveStart:e=>({maxHeight:e.offsetHeight}),onLeaveEnd:v},(o,n)=>{let{className:l,style:s}=o;return t.createElement("div",Object.assign({id:I,ref:(0,u.sQ)(Z,n),"data-show":!S,className:d()(Q,l),style:Object.assign(Object.assign(Object.assign({},A),c),s),onMouseEnter:b,onMouseLeave:g,onClick:h,role:"alert"},X),V?t.createElement(O,{description:r,icon:e.icon,prefixCls:D,type:R}):null,t.createElement("div",{className:"".concat(D,"-content")},a?t.createElement("div",{className:"".concat(D,"-message")},a):null,r?t.createElement("div",{className:"".concat(D,"-description")},r):null),N?t.createElement("div",{className:"".concat(D,"-action")},N):null,t.createElement(C,{isClosable:q,prefixCls:D,closeIcon:F,handleClose:B,ariaProps:J}))}))});var E=r(76405),S=r(25049),M=r(24995),Z=r(63929),G=r(37977),W=r(41690);let P=function(e){function o(){var e,r,t;return(0,E.Z)(this,o),r=o,t=arguments,r=(0,M.Z)(r),(e=(0,G.Z)(this,(0,Z.Z)()?Reflect.construct(r,t||[],(0,M.Z)(this).constructor):r.apply(this,t))).state={error:void 0,info:{componentStack:""}},e}return(0,W.Z)(o,e),(0,S.Z)(o,[{key:"componentDidCatch",value:function(e,o){this.setState({error:e,info:o})}},{key:"render",value:function(){let{message:e,description:o,id:r,children:n}=this.props,{error:a,info:l}=this.state,s=(null==l?void 0:l.componentStack)||null,i=void 0===e?(a||"").toString():e;return a?t.createElement(I,{id:r,type:"error",message:i,description:t.createElement("pre",{style:{fontSize:"0.9em",overflowX:"auto"}},void 0===o?s:o)}):n}}])}(t.Component);I.ErrorBoundary=P;var H=I},49096:function(e,o,r){r.d(o,{ZD:function(){return a}});var t=r(61994);let n=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,a=e=>{let o=function(){for(var o,r,n=arguments.length,a=Array(n),l=0;l{let t=Object.fromEntries(Object.entries(e||{}).filter(e=>{let[o]=e;return!["class","className"].includes(o)}));return o(r.map(e=>e(t)),null==e?void 0:e.class,null==e?void 0:e.className)}},cva:e=>r=>{var t;if((null==e?void 0:e.variants)==null)return o(null==e?void 0:e.base,null==r?void 0:r.class,null==r?void 0:r.className);let{variants:a,defaultVariants:l}=e,s=Object.keys(a).map(e=>{let o=null==r?void 0:r[e],t=null==l?void 0:l[e],s=n(o)||n(t);return a[e][s]}),i={...l,...r&&Object.entries(r).reduce((e,o)=>{let[r,t]=o;return void 0===t?e:{...e,[r]:t}},{})},c=null==e?void 0:null===(t=e.compoundVariants)||void 0===t?void 0:t.reduce((e,o)=>{let{class:r,className:t,...n}=o;return Object.entries(n).every(e=>{let[o,r]=e,t=i[o];return Array.isArray(r)?r.includes(t):t===r})?[...e,r,t]:e},[]);return o(null==e?void 0:e.base,s,c,null==r?void 0:r.class,null==r?void 0:r.className)},cx:o}},{compose:l,cva:s,cx:i}=a()},53335:function(e,o,r){r.d(o,{m6:function(){return ek}});let t=(e,o)=>{let r=Array(e.length+o.length);for(let o=0;o({classGroupId:e,validator:o}),a=(e=new Map,o=null,r)=>({nextPart:e,validators:o,classGroupId:r}),l=[],s=e=>{let o=d(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]"))return c(e);let r=e.split("-"),t=""===r[0]&&r.length>1?1:0;return i(r,t,o)},getConflictingClassGroupIds:(e,o)=>{if(o){let o=n[e],a=r[e];return o?a?t(a,o):o:a||l}return r[e]||l}}},i=(e,o,r)=>{if(0==e.length-o)return r.classGroupId;let t=e[o],n=r.nextPart.get(t);if(n){let r=i(e,o+1,n);if(r)return r}let a=r.validators;if(null===a)return;let l=0===o?e.join("-"):e.slice(o).join("-"),s=a.length;for(let e=0;e-1===e.slice(1,-1).indexOf(":")?void 0:(()=>{let o=e.slice(1,-1),r=o.indexOf(":"),t=o.slice(0,r);return t?"arbitrary.."+t:void 0})(),d=e=>{let{theme:o,classGroups:r}=e;return m(r,o)},m=(e,o)=>{let r=a();for(let t in e)p(e[t],r,t,o);return r},p=(e,o,r,t)=>{let n=e.length;for(let a=0;a{if("string"==typeof e){b(e,o,r);return}if("function"==typeof e){f(e,o,r,t);return}g(e,o,r,t)},b=(e,o,r)=>{(""===e?o:h(o,e)).classGroupId=r},f=(e,o,r,t)=>{if(v(e)){p(e(t),o,r,t);return}null===o.validators&&(o.validators=[]),o.validators.push(n(r,e))},g=(e,o,r,t)=>{let n=Object.entries(e),a=n.length;for(let e=0;e{let r=e,t=o.split("-"),n=t.length;for(let e=0;e"isThemeGetter"in e&&!0===e.isThemeGetter,k=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let o=0,r=Object.create(null),t=Object.create(null),n=(n,a)=>{r[n]=a,++o>e&&(o=0,t=r,r=Object.create(null))};return{get(e){let o=r[e];return void 0!==o?o:void 0!==(o=t[e])?(n(e,o),o):void 0},set(e,o){e in r?r[e]=o:n(e,o)}}},x=[],w=(e,o,r,t,n)=>({modifiers:e,hasImportantModifier:o,baseClassName:r,maybePostfixModifierPosition:t,isExternal:n}),y=e=>{let{prefix:o,experimentalParseClassName:r}=e,t=e=>{let o;let r=[],t=0,n=0,a=0,l=e.length;for(let s=0;sa?o-a:void 0)};if(o){let e=o+":",r=t;t=o=>o.startsWith(e)?r(o.slice(e.length)):w(x,!1,o,void 0,!0)}if(r){let e=t;t=o=>r({className:o,parseClassName:e})}return t},z=e=>{let o=new Map;return e.orderSensitiveModifiers.forEach((e,r)=>{o.set(e,1e6+r)}),e=>{let r=[],t=[];for(let n=0;n0&&(t.sort(),r.push(...t),t=[]),r.push(a)):t.push(a)}return t.length>0&&(t.sort(),r.push(...t)),r}},j=e=>({cache:k(e.cacheSize),parseClassName:y(e),sortModifiers:z(e),...s(e)}),N=/\s+/,O=(e,o)=>{let{parseClassName:r,getClassGroupId:t,getConflictingClassGroupIds:n,sortModifiers:a}=o,l=[],s=e.trim().split(N),i="";for(let e=s.length-1;e>=0;e-=1){let o=s[e],{isExternal:c,modifiers:d,hasImportantModifier:m,baseClassName:p,maybePostfixModifierPosition:u}=r(o);if(c){i=o+(i.length>0?" "+i:i);continue}let b=!!u,f=t(b?p.substring(0,u):p);if(!f){if(!b||!(f=t(p))){i=o+(i.length>0?" "+i:i);continue}b=!1}let g=0===d.length?"":1===d.length?d[0]:a(d).join(":"),h=m?g+"!":g,v=h+f;if(l.indexOf(v)>-1)continue;l.push(v);let k=n(f,b);for(let e=0;e0?" "+i:i)}return i},C=(...e)=>{let o,r,t=0,n="";for(;t{let o;if("string"==typeof e)return e;let r="";for(let t=0;t{let o=o=>o[e]||E;return o.isThemeGetter=!0,o},M=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Z=/^\((?:(\w[\w-]*):)?(.+)\)$/i,G=/^\d+\/\d+$/,W=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,P=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,H=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,$=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,A=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,D=e=>G.test(e),L=e=>!!e&&!Number.isNaN(Number(e)),T=e=>!!e&&Number.isInteger(Number(e)),_=e=>e.endsWith("%")&&L(e.slice(0,-1)),B=e=>W.test(e),R=()=>!0,q=e=>P.test(e)&&!H.test(e),V=()=>!1,Q=e=>$.test(e),X=e=>A.test(e),F=e=>!K(e)&&!et(e),J=e=>ed(e,eb,V),K=e=>M.test(e),U=e=>ed(e,ef,q),Y=e=>ed(e,eg,L),ee=e=>ed(e,ep,V),eo=e=>ed(e,eu,X),er=e=>ed(e,ev,Q),et=e=>Z.test(e),en=e=>em(e,ef),ea=e=>em(e,eh),el=e=>em(e,ep),es=e=>em(e,eb),ei=e=>em(e,eu),ec=e=>em(e,ev,!0),ed=(e,o,r)=>{let t=M.exec(e);return!!t&&(t[1]?o(t[1]):r(t[2]))},em=(e,o,r=!1)=>{let t=Z.exec(e);return!!t&&(t[1]?o(t[1]):r)},ep=e=>"position"===e||"percentage"===e,eu=e=>"image"===e||"url"===e,eb=e=>"length"===e||"size"===e||"bg-size"===e,ef=e=>"length"===e,eg=e=>"number"===e,eh=e=>"family-name"===e,ev=e=>"shadow"===e,ek=((e,...o)=>{let r,t,n,a;let l=e=>{let o=t(e);if(o)return o;let a=O(e,r);return n(e,a),a};return a=s=>(t=(r=j(o.reduce((e,o)=>o(e),e()))).cache.get,n=r.cache.set,a=l,l(s)),(...e)=>a(C(...e))})(()=>{let e=S("color"),o=S("font"),r=S("text"),t=S("font-weight"),n=S("tracking"),a=S("leading"),l=S("breakpoint"),s=S("container"),i=S("spacing"),c=S("radius"),d=S("shadow"),m=S("inset-shadow"),p=S("text-shadow"),u=S("drop-shadow"),b=S("blur"),f=S("perspective"),g=S("aspect"),h=S("ease"),v=S("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],x=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],w=()=>[...x(),et,K],y=()=>["auto","hidden","clip","visible","scroll"],z=()=>["auto","contain","none"],j=()=>[et,K,i],N=()=>[D,"full","auto",...j()],O=()=>[T,"none","subgrid",et,K],C=()=>["auto",{span:["full",T,et,K]},T,et,K],I=()=>[T,"auto",et,K],E=()=>["auto","min","max","fr",et,K],M=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Z=()=>["start","end","center","stretch","center-safe","end-safe"],G=()=>["auto",...j()],W=()=>[D,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...j()],P=()=>[e,et,K],H=()=>[...x(),el,ee,{position:[et,K]}],$=()=>["no-repeat",{repeat:["","x","y","space","round"]}],A=()=>["auto","cover","contain",es,J,{size:[et,K]}],q=()=>[_,en,U],V=()=>["","none","full",c,et,K],Q=()=>["",L,en,U],X=()=>["solid","dashed","dotted","double"],ed=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],em=()=>[L,_,el,ee],ep=()=>["","none",b,et,K],eu=()=>["none",L,et,K],eb=()=>["none",L,et,K],ef=()=>[L,et,K],eg=()=>[D,"full",...j()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[B],breakpoint:[B],color:[R],container:[B],"drop-shadow":[B],ease:["in","out","in-out"],font:[F],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[B],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[B],shadow:[B],spacing:["px",L],text:[B],"text-shadow":[B],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",D,K,et,g]}],container:["container"],columns:[{columns:[L,K,et,s]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:w()}],overflow:[{overflow:y()}],"overflow-x":[{"overflow-x":y()}],"overflow-y":[{"overflow-y":y()}],overscroll:[{overscroll:z()}],"overscroll-x":[{"overscroll-x":z()}],"overscroll-y":[{"overscroll-y":z()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:N()}],"inset-x":[{"inset-x":N()}],"inset-y":[{"inset-y":N()}],start:[{start:N()}],end:[{end:N()}],top:[{top:N()}],right:[{right:N()}],bottom:[{bottom:N()}],left:[{left:N()}],visibility:["visible","invisible","collapse"],z:[{z:[T,"auto",et,K]}],basis:[{basis:[D,"full","auto",s,...j()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[L,D,"auto","initial","none",K]}],grow:[{grow:["",L,et,K]}],shrink:[{shrink:["",L,et,K]}],order:[{order:[T,"first","last","none",et,K]}],"grid-cols":[{"grid-cols":O()}],"col-start-end":[{col:C()}],"col-start":[{"col-start":I()}],"col-end":[{"col-end":I()}],"grid-rows":[{"grid-rows":O()}],"row-start-end":[{row:C()}],"row-start":[{"row-start":I()}],"row-end":[{"row-end":I()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":E()}],"auto-rows":[{"auto-rows":E()}],gap:[{gap:j()}],"gap-x":[{"gap-x":j()}],"gap-y":[{"gap-y":j()}],"justify-content":[{justify:[...M(),"normal"]}],"justify-items":[{"justify-items":[...Z(),"normal"]}],"justify-self":[{"justify-self":["auto",...Z()]}],"align-content":[{content:["normal",...M()]}],"align-items":[{items:[...Z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Z(),{baseline:["","last"]}]}],"place-content":[{"place-content":M()}],"place-items":[{"place-items":[...Z(),"baseline"]}],"place-self":[{"place-self":["auto",...Z()]}],p:[{p:j()}],px:[{px:j()}],py:[{py:j()}],ps:[{ps:j()}],pe:[{pe:j()}],pt:[{pt:j()}],pr:[{pr:j()}],pb:[{pb:j()}],pl:[{pl:j()}],m:[{m:G()}],mx:[{mx:G()}],my:[{my:G()}],ms:[{ms:G()}],me:[{me:G()}],mt:[{mt:G()}],mr:[{mr:G()}],mb:[{mb:G()}],ml:[{ml:G()}],"space-x":[{"space-x":j()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":j()}],"space-y-reverse":["space-y-reverse"],size:[{size:W()}],w:[{w:[s,"screen",...W()]}],"min-w":[{"min-w":[s,"screen","none",...W()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[l]},...W()]}],h:[{h:["screen","lh",...W()]}],"min-h":[{"min-h":["screen","lh","none",...W()]}],"max-h":[{"max-h":["screen","lh",...W()]}],"font-size":[{text:["base",r,en,U]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[t,et,Y]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",_,K]}],"font-family":[{font:[ea,K,o]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[n,et,K]}],"line-clamp":[{"line-clamp":[L,"none",et,Y]}],leading:[{leading:[a,...j()]}],"list-image":[{"list-image":["none",et,K]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",et,K]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...X(),"wavy"]}],"text-decoration-thickness":[{decoration:[L,"from-font","auto",et,U]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[L,"auto",et,K]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:j()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",et,K]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",et,K]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:H()}],"bg-repeat":[{bg:$()}],"bg-size":[{bg:A()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},T,et,K],radial:["",et,K],conic:[T,et,K]},ei,eo]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:q()}],"gradient-via-pos":[{via:q()}],"gradient-to-pos":[{to:q()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:V()}],"rounded-s":[{"rounded-s":V()}],"rounded-e":[{"rounded-e":V()}],"rounded-t":[{"rounded-t":V()}],"rounded-r":[{"rounded-r":V()}],"rounded-b":[{"rounded-b":V()}],"rounded-l":[{"rounded-l":V()}],"rounded-ss":[{"rounded-ss":V()}],"rounded-se":[{"rounded-se":V()}],"rounded-ee":[{"rounded-ee":V()}],"rounded-es":[{"rounded-es":V()}],"rounded-tl":[{"rounded-tl":V()}],"rounded-tr":[{"rounded-tr":V()}],"rounded-br":[{"rounded-br":V()}],"rounded-bl":[{"rounded-bl":V()}],"border-w":[{border:Q()}],"border-w-x":[{"border-x":Q()}],"border-w-y":[{"border-y":Q()}],"border-w-s":[{"border-s":Q()}],"border-w-e":[{"border-e":Q()}],"border-w-t":[{"border-t":Q()}],"border-w-r":[{"border-r":Q()}],"border-w-b":[{"border-b":Q()}],"border-w-l":[{"border-l":Q()}],"divide-x":[{"divide-x":Q()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Q()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...X(),"hidden","none"]}],"divide-style":[{divide:[...X(),"hidden","none"]}],"border-color":[{border:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:[...X(),"none","hidden"]}],"outline-offset":[{"outline-offset":[L,et,K]}],"outline-w":[{outline:["",L,en,U]}],"outline-color":[{outline:P()}],shadow:[{shadow:["","none",d,ec,er]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":["none",m,ec,er]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:Q()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[L,U]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":Q()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":["none",p,ec,er]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[L,et,K]}],"mix-blend":[{"mix-blend":[...ed(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ed()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[L]}],"mask-image-linear-from-pos":[{"mask-linear-from":em()}],"mask-image-linear-to-pos":[{"mask-linear-to":em()}],"mask-image-linear-from-color":[{"mask-linear-from":P()}],"mask-image-linear-to-color":[{"mask-linear-to":P()}],"mask-image-t-from-pos":[{"mask-t-from":em()}],"mask-image-t-to-pos":[{"mask-t-to":em()}],"mask-image-t-from-color":[{"mask-t-from":P()}],"mask-image-t-to-color":[{"mask-t-to":P()}],"mask-image-r-from-pos":[{"mask-r-from":em()}],"mask-image-r-to-pos":[{"mask-r-to":em()}],"mask-image-r-from-color":[{"mask-r-from":P()}],"mask-image-r-to-color":[{"mask-r-to":P()}],"mask-image-b-from-pos":[{"mask-b-from":em()}],"mask-image-b-to-pos":[{"mask-b-to":em()}],"mask-image-b-from-color":[{"mask-b-from":P()}],"mask-image-b-to-color":[{"mask-b-to":P()}],"mask-image-l-from-pos":[{"mask-l-from":em()}],"mask-image-l-to-pos":[{"mask-l-to":em()}],"mask-image-l-from-color":[{"mask-l-from":P()}],"mask-image-l-to-color":[{"mask-l-to":P()}],"mask-image-x-from-pos":[{"mask-x-from":em()}],"mask-image-x-to-pos":[{"mask-x-to":em()}],"mask-image-x-from-color":[{"mask-x-from":P()}],"mask-image-x-to-color":[{"mask-x-to":P()}],"mask-image-y-from-pos":[{"mask-y-from":em()}],"mask-image-y-to-pos":[{"mask-y-to":em()}],"mask-image-y-from-color":[{"mask-y-from":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[et,K]}],"mask-image-radial-from-pos":[{"mask-radial-from":em()}],"mask-image-radial-to-pos":[{"mask-radial-to":em()}],"mask-image-radial-from-color":[{"mask-radial-from":P()}],"mask-image-radial-to-color":[{"mask-radial-to":P()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":x()}],"mask-image-conic-pos":[{"mask-conic":[L]}],"mask-image-conic-from-pos":[{"mask-conic-from":em()}],"mask-image-conic-to-pos":[{"mask-conic-to":em()}],"mask-image-conic-from-color":[{"mask-conic-from":P()}],"mask-image-conic-to-color":[{"mask-conic-to":P()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:H()}],"mask-repeat":[{mask:$()}],"mask-size":[{mask:A()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",et,K]}],filter:[{filter:["","none",et,K]}],blur:[{blur:ep()}],brightness:[{brightness:[L,et,K]}],contrast:[{contrast:[L,et,K]}],"drop-shadow":[{"drop-shadow":["","none",u,ec,er]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:["",L,et,K]}],"hue-rotate":[{"hue-rotate":[L,et,K]}],invert:[{invert:["",L,et,K]}],saturate:[{saturate:[L,et,K]}],sepia:[{sepia:["",L,et,K]}],"backdrop-filter":[{"backdrop-filter":["","none",et,K]}],"backdrop-blur":[{"backdrop-blur":ep()}],"backdrop-brightness":[{"backdrop-brightness":[L,et,K]}],"backdrop-contrast":[{"backdrop-contrast":[L,et,K]}],"backdrop-grayscale":[{"backdrop-grayscale":["",L,et,K]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[L,et,K]}],"backdrop-invert":[{"backdrop-invert":["",L,et,K]}],"backdrop-opacity":[{"backdrop-opacity":[L,et,K]}],"backdrop-saturate":[{"backdrop-saturate":[L,et,K]}],"backdrop-sepia":[{"backdrop-sepia":["",L,et,K]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":j()}],"border-spacing-x":[{"border-spacing-x":j()}],"border-spacing-y":[{"border-spacing-y":j()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",et,K]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[L,"initial",et,K]}],ease:[{ease:["linear","initial",h,et,K]}],delay:[{delay:[L,et,K]}],animate:[{animate:["none",v,et,K]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[f,et,K]}],"perspective-origin":[{"perspective-origin":w()}],rotate:[{rotate:eu()}],"rotate-x":[{"rotate-x":eu()}],"rotate-y":[{"rotate-y":eu()}],"rotate-z":[{"rotate-z":eu()}],scale:[{scale:eb()}],"scale-x":[{"scale-x":eb()}],"scale-y":[{"scale-y":eb()}],"scale-z":[{"scale-z":eb()}],"scale-3d":["scale-3d"],skew:[{skew:ef()}],"skew-x":[{"skew-x":ef()}],"skew-y":[{"skew-y":ef()}],transform:[{transform:[et,K,"","none","gpu","cpu"]}],"transform-origin":[{origin:w()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:eg()}],"translate-x":[{"translate-x":eg()}],"translate-y":[{"translate-y":eg()}],"translate-z":[{"translate-z":eg()}],"translate-none":["translate-none"],accent:[{accent:P()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:P()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",et,K]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":j()}],"scroll-mx":[{"scroll-mx":j()}],"scroll-my":[{"scroll-my":j()}],"scroll-ms":[{"scroll-ms":j()}],"scroll-me":[{"scroll-me":j()}],"scroll-mt":[{"scroll-mt":j()}],"scroll-mr":[{"scroll-mr":j()}],"scroll-mb":[{"scroll-mb":j()}],"scroll-ml":[{"scroll-ml":j()}],"scroll-p":[{"scroll-p":j()}],"scroll-px":[{"scroll-px":j()}],"scroll-py":[{"scroll-py":j()}],"scroll-ps":[{"scroll-ps":j()}],"scroll-pe":[{"scroll-pe":j()}],"scroll-pt":[{"scroll-pt":j()}],"scroll-pr":[{"scroll-pr":j()}],"scroll-pb":[{"scroll-pb":j()}],"scroll-pl":[{"scroll-pl":j()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",et,K]}],fill:[{fill:["none",...P()]}],"stroke-w":[{stroke:[L,en,U,Y]}],stroke:[{stroke:["none",...P()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}})}}]); \ No newline at end of file +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6043],{51653:function(e,o,r){r.d(o,{Z:function(){return H}});var t=r(2265),n=r(8900),a=r(39725),l=r(49638),s=r(54537),i=r(55726),c=r(36760),d=r.n(c),m=r(66632),p=r(18242),u=r(28791),b=r(19722),f=r(71744),g=r(93463),h=r(12918),v=r(99320);let k=(e,o,r,t,n)=>({background:e,border:"".concat((0,g.bf)(t.lineWidth)," ").concat(t.lineType," ").concat(o),["".concat(n,"-icon")]:{color:r}}),x=e=>{let{componentCls:o,motionDurationSlow:r,marginXS:t,marginSM:n,fontSize:a,fontSizeLG:l,lineHeight:s,borderRadiusLG:i,motionEaseInOutCirc:c,withDescriptionIconSize:d,colorText:m,colorTextHeading:p,withDescriptionPadding:u,defaultPadding:b}=e;return{[o]:Object.assign(Object.assign({},(0,h.Wf)(e)),{position:"relative",display:"flex",alignItems:"center",padding:b,wordWrap:"break-word",borderRadius:i,["&".concat(o,"-rtl")]:{direction:"rtl"},["".concat(o,"-content")]:{flex:1,minWidth:0},["".concat(o,"-icon")]:{marginInlineEnd:t,lineHeight:0},"&-description":{display:"none",fontSize:a,lineHeight:s},"&-message":{color:p},["&".concat(o,"-motion-leave")]:{overflow:"hidden",opacity:1,transition:"max-height ".concat(r," ").concat(c,", opacity ").concat(r," ").concat(c,",\n padding-top ").concat(r," ").concat(c,", padding-bottom ").concat(r," ").concat(c,",\n margin-bottom ").concat(r," ").concat(c)},["&".concat(o,"-motion-leave-active")]:{maxHeight:0,marginBottom:"0 !important",paddingTop:0,paddingBottom:0,opacity:0}}),["".concat(o,"-with-description")]:{alignItems:"flex-start",padding:u,["".concat(o,"-icon")]:{marginInlineEnd:n,fontSize:d,lineHeight:0},["".concat(o,"-message")]:{display:"block",marginBottom:t,color:p,fontSize:l},["".concat(o,"-description")]:{display:"block",color:m}},["".concat(o,"-banner")]:{marginBottom:0,border:"0 !important",borderRadius:0}}},w=e=>{let{componentCls:o,colorSuccess:r,colorSuccessBorder:t,colorSuccessBg:n,colorWarning:a,colorWarningBorder:l,colorWarningBg:s,colorError:i,colorErrorBorder:c,colorErrorBg:d,colorInfo:m,colorInfoBorder:p,colorInfoBg:u}=e;return{[o]:{"&-success":k(n,t,r,e,o),"&-info":k(u,p,m,e,o),"&-warning":k(s,l,a,e,o),"&-error":Object.assign(Object.assign({},k(d,c,i,e,o)),{["".concat(o,"-description > pre")]:{margin:0,padding:0}})}}},y=e=>{let{componentCls:o,iconCls:r,motionDurationMid:t,marginXS:n,fontSizeIcon:a,colorIcon:l,colorIconHover:s}=e;return{[o]:{"&-action":{marginInlineStart:n},["".concat(o,"-close-icon")]:{marginInlineStart:n,padding:0,overflow:"hidden",fontSize:a,lineHeight:(0,g.bf)(a),backgroundColor:"transparent",border:"none",outline:"none",cursor:"pointer",["".concat(r,"-close")]:{color:l,transition:"color ".concat(t),"&:hover":{color:s}}},"&-close-text":{color:l,transition:"color ".concat(t),"&:hover":{color:s}}}}};var z=(0,v.I$)("Alert",e=>[x(e),w(e),y(e)],e=>({withDescriptionIconSize:e.fontSizeHeading3,defaultPadding:"".concat(e.paddingContentVerticalSM,"px ").concat(12,"px"),withDescriptionPadding:"".concat(e.paddingMD,"px ").concat(e.paddingContentHorizontalLG,"px")})),j=function(e,o){var r={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&0>o.indexOf(t)&&(r[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,t=Object.getOwnPropertySymbols(e);no.indexOf(t[n])&&Object.prototype.propertyIsEnumerable.call(e,t[n])&&(r[t[n]]=e[t[n]]);return r};let N={success:n.Z,info:i.Z,error:a.Z,warning:s.Z},O=e=>{let{icon:o,prefixCls:r,type:n}=e,a=N[n]||null;return o?(0,b.wm)(o,t.createElement("span",{className:"".concat(r,"-icon")},o),()=>({className:d()("".concat(r,"-icon"),o.props.className)})):t.createElement(a,{className:"".concat(r,"-icon")})},C=e=>{let{isClosable:o,prefixCls:r,closeIcon:n,handleClose:a,ariaProps:s}=e,i=!0===n||void 0===n?t.createElement(l.Z,null):n;return o?t.createElement("button",Object.assign({type:"button",onClick:a,className:"".concat(r,"-close-icon"),tabIndex:0},s),i):null},I=t.forwardRef((e,o)=>{let{description:r,prefixCls:n,message:a,banner:l,className:s,rootClassName:i,style:c,onMouseEnter:b,onMouseLeave:g,onClick:h,afterClose:v,showIcon:k,closable:x,closeText:w,closeIcon:y,action:N,id:I}=e,E=j(e,["description","prefixCls","message","banner","className","rootClassName","style","onMouseEnter","onMouseLeave","onClick","afterClose","showIcon","closable","closeText","closeIcon","action","id"]),[S,M]=t.useState(!1),Z=t.useRef(null);t.useImperativeHandle(o,()=>({nativeElement:Z.current}));let{getPrefixCls:G,direction:W,closable:P,closeIcon:H,className:$,style:A}=(0,f.dj)("alert"),D=G("alert",n),[L,T,_]=z(D),B=o=>{var r;M(!0),null===(r=e.onClose)||void 0===r||r.call(e,o)},R=t.useMemo(()=>void 0!==e.type?e.type:l?"warning":"info",[e.type,l]),q=t.useMemo(()=>"object"==typeof x&&!!x.closeIcon||!!w||("boolean"==typeof x?x:!1!==y&&null!=y||!!P),[w,y,x,P]),V=!!l&&void 0===k||k,Q=d()(D,"".concat(D,"-").concat(R),{["".concat(D,"-with-description")]:!!r,["".concat(D,"-no-icon")]:!V,["".concat(D,"-banner")]:!!l,["".concat(D,"-rtl")]:"rtl"===W},$,s,i,_,T),X=(0,p.Z)(E,{aria:!0,data:!0}),F=t.useMemo(()=>"object"==typeof x&&x.closeIcon?x.closeIcon:w||(void 0!==y?y:"object"==typeof P&&P.closeIcon?P.closeIcon:H),[y,x,P,w,H]),J=t.useMemo(()=>{let e=null!=x?x:P;if("object"==typeof e){let{closeIcon:o}=e;return j(e,["closeIcon"])}return{}},[x,P]);return L(t.createElement(m.ZP,{visible:!S,motionName:"".concat(D,"-motion"),motionAppear:!1,motionEnter:!1,onLeaveStart:e=>({maxHeight:e.offsetHeight}),onLeaveEnd:v},(o,n)=>{let{className:l,style:s}=o;return t.createElement("div",Object.assign({id:I,ref:(0,u.sQ)(Z,n),"data-show":!S,className:d()(Q,l),style:Object.assign(Object.assign(Object.assign({},A),c),s),onMouseEnter:b,onMouseLeave:g,onClick:h,role:"alert"},X),V?t.createElement(O,{description:r,icon:e.icon,prefixCls:D,type:R}):null,t.createElement("div",{className:"".concat(D,"-content")},a?t.createElement("div",{className:"".concat(D,"-message")},a):null,r?t.createElement("div",{className:"".concat(D,"-description")},r):null),N?t.createElement("div",{className:"".concat(D,"-action")},N):null,t.createElement(C,{isClosable:q,prefixCls:D,closeIcon:F,handleClose:B,ariaProps:J}))}))});var E=r(76405),S=r(25049),M=r(24995),Z=r(63929),G=r(37977),W=r(41690);let P=function(e){function o(){var e,r,t;return(0,E.Z)(this,o),r=o,t=arguments,r=(0,M.Z)(r),(e=(0,G.Z)(this,(0,Z.Z)()?Reflect.construct(r,t||[],(0,M.Z)(this).constructor):r.apply(this,t))).state={error:void 0,info:{componentStack:""}},e}return(0,W.Z)(o,e),(0,S.Z)(o,[{key:"componentDidCatch",value:function(e,o){this.setState({error:e,info:o})}},{key:"render",value:function(){let{message:e,description:o,id:r,children:n}=this.props,{error:a,info:l}=this.state,s=(null==l?void 0:l.componentStack)||null,i=void 0===e?(a||"").toString():e;return a?t.createElement(I,{id:r,type:"error",message:i,description:t.createElement("pre",{style:{fontSize:"0.9em",overflowX:"auto"}},void 0===o?s:o)}):n}}])}(t.Component);I.ErrorBoundary=P;var H=I},49096:function(e,o,r){r.d(o,{ZD:function(){return a}});var t=r(87602);let n=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,a=e=>{let o=function(){for(var o,r,n=arguments.length,a=Array(n),l=0;l{let t=Object.fromEntries(Object.entries(e||{}).filter(e=>{let[o]=e;return!["class","className"].includes(o)}));return o(r.map(e=>e(t)),null==e?void 0:e.class,null==e?void 0:e.className)}},cva:e=>r=>{var t;if((null==e?void 0:e.variants)==null)return o(null==e?void 0:e.base,null==r?void 0:r.class,null==r?void 0:r.className);let{variants:a,defaultVariants:l}=e,s=Object.keys(a).map(e=>{let o=null==r?void 0:r[e],t=null==l?void 0:l[e],s=n(o)||n(t);return a[e][s]}),i={...l,...r&&Object.entries(r).reduce((e,o)=>{let[r,t]=o;return void 0===t?e:{...e,[r]:t}},{})},c=null==e?void 0:null===(t=e.compoundVariants)||void 0===t?void 0:t.reduce((e,o)=>{let{class:r,className:t,...n}=o;return Object.entries(n).every(e=>{let[o,r]=e,t=i[o];return Array.isArray(r)?r.includes(t):t===r})?[...e,r,t]:e},[]);return o(null==e?void 0:e.base,s,c,null==r?void 0:r.class,null==r?void 0:r.className)},cx:o}},{compose:l,cva:s,cx:i}=a()},53335:function(e,o,r){r.d(o,{m6:function(){return ek}});let t=(e,o)=>{let r=Array(e.length+o.length);for(let o=0;o({classGroupId:e,validator:o}),a=(e=new Map,o=null,r)=>({nextPart:e,validators:o,classGroupId:r}),l=[],s=e=>{let o=d(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]"))return c(e);let r=e.split("-"),t=""===r[0]&&r.length>1?1:0;return i(r,t,o)},getConflictingClassGroupIds:(e,o)=>{if(o){let o=n[e],a=r[e];return o?a?t(a,o):o:a||l}return r[e]||l}}},i=(e,o,r)=>{if(0==e.length-o)return r.classGroupId;let t=e[o],n=r.nextPart.get(t);if(n){let r=i(e,o+1,n);if(r)return r}let a=r.validators;if(null===a)return;let l=0===o?e.join("-"):e.slice(o).join("-"),s=a.length;for(let e=0;e-1===e.slice(1,-1).indexOf(":")?void 0:(()=>{let o=e.slice(1,-1),r=o.indexOf(":"),t=o.slice(0,r);return t?"arbitrary.."+t:void 0})(),d=e=>{let{theme:o,classGroups:r}=e;return m(r,o)},m=(e,o)=>{let r=a();for(let t in e)p(e[t],r,t,o);return r},p=(e,o,r,t)=>{let n=e.length;for(let a=0;a{if("string"==typeof e){b(e,o,r);return}if("function"==typeof e){f(e,o,r,t);return}g(e,o,r,t)},b=(e,o,r)=>{(""===e?o:h(o,e)).classGroupId=r},f=(e,o,r,t)=>{if(v(e)){p(e(t),o,r,t);return}null===o.validators&&(o.validators=[]),o.validators.push(n(r,e))},g=(e,o,r,t)=>{let n=Object.entries(e),a=n.length;for(let e=0;e{let r=e,t=o.split("-"),n=t.length;for(let e=0;e"isThemeGetter"in e&&!0===e.isThemeGetter,k=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let o=0,r=Object.create(null),t=Object.create(null),n=(n,a)=>{r[n]=a,++o>e&&(o=0,t=r,r=Object.create(null))};return{get(e){let o=r[e];return void 0!==o?o:void 0!==(o=t[e])?(n(e,o),o):void 0},set(e,o){e in r?r[e]=o:n(e,o)}}},x=[],w=(e,o,r,t,n)=>({modifiers:e,hasImportantModifier:o,baseClassName:r,maybePostfixModifierPosition:t,isExternal:n}),y=e=>{let{prefix:o,experimentalParseClassName:r}=e,t=e=>{let o;let r=[],t=0,n=0,a=0,l=e.length;for(let s=0;sa?o-a:void 0)};if(o){let e=o+":",r=t;t=o=>o.startsWith(e)?r(o.slice(e.length)):w(x,!1,o,void 0,!0)}if(r){let e=t;t=o=>r({className:o,parseClassName:e})}return t},z=e=>{let o=new Map;return e.orderSensitiveModifiers.forEach((e,r)=>{o.set(e,1e6+r)}),e=>{let r=[],t=[];for(let n=0;n0&&(t.sort(),r.push(...t),t=[]),r.push(a)):t.push(a)}return t.length>0&&(t.sort(),r.push(...t)),r}},j=e=>({cache:k(e.cacheSize),parseClassName:y(e),sortModifiers:z(e),...s(e)}),N=/\s+/,O=(e,o)=>{let{parseClassName:r,getClassGroupId:t,getConflictingClassGroupIds:n,sortModifiers:a}=o,l=[],s=e.trim().split(N),i="";for(let e=s.length-1;e>=0;e-=1){let o=s[e],{isExternal:c,modifiers:d,hasImportantModifier:m,baseClassName:p,maybePostfixModifierPosition:u}=r(o);if(c){i=o+(i.length>0?" "+i:i);continue}let b=!!u,f=t(b?p.substring(0,u):p);if(!f){if(!b||!(f=t(p))){i=o+(i.length>0?" "+i:i);continue}b=!1}let g=0===d.length?"":1===d.length?d[0]:a(d).join(":"),h=m?g+"!":g,v=h+f;if(l.indexOf(v)>-1)continue;l.push(v);let k=n(f,b);for(let e=0;e0?" "+i:i)}return i},C=(...e)=>{let o,r,t=0,n="";for(;t{let o;if("string"==typeof e)return e;let r="";for(let t=0;t{let o=o=>o[e]||E;return o.isThemeGetter=!0,o},M=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Z=/^\((?:(\w[\w-]*):)?(.+)\)$/i,G=/^\d+\/\d+$/,W=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,P=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,H=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,$=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,A=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,D=e=>G.test(e),L=e=>!!e&&!Number.isNaN(Number(e)),T=e=>!!e&&Number.isInteger(Number(e)),_=e=>e.endsWith("%")&&L(e.slice(0,-1)),B=e=>W.test(e),R=()=>!0,q=e=>P.test(e)&&!H.test(e),V=()=>!1,Q=e=>$.test(e),X=e=>A.test(e),F=e=>!K(e)&&!et(e),J=e=>ed(e,eb,V),K=e=>M.test(e),U=e=>ed(e,ef,q),Y=e=>ed(e,eg,L),ee=e=>ed(e,ep,V),eo=e=>ed(e,eu,X),er=e=>ed(e,ev,Q),et=e=>Z.test(e),en=e=>em(e,ef),ea=e=>em(e,eh),el=e=>em(e,ep),es=e=>em(e,eb),ei=e=>em(e,eu),ec=e=>em(e,ev,!0),ed=(e,o,r)=>{let t=M.exec(e);return!!t&&(t[1]?o(t[1]):r(t[2]))},em=(e,o,r=!1)=>{let t=Z.exec(e);return!!t&&(t[1]?o(t[1]):r)},ep=e=>"position"===e||"percentage"===e,eu=e=>"image"===e||"url"===e,eb=e=>"length"===e||"size"===e||"bg-size"===e,ef=e=>"length"===e,eg=e=>"number"===e,eh=e=>"family-name"===e,ev=e=>"shadow"===e,ek=((e,...o)=>{let r,t,n,a;let l=e=>{let o=t(e);if(o)return o;let a=O(e,r);return n(e,a),a};return a=s=>(t=(r=j(o.reduce((e,o)=>o(e),e()))).cache.get,n=r.cache.set,a=l,l(s)),(...e)=>a(C(...e))})(()=>{let e=S("color"),o=S("font"),r=S("text"),t=S("font-weight"),n=S("tracking"),a=S("leading"),l=S("breakpoint"),s=S("container"),i=S("spacing"),c=S("radius"),d=S("shadow"),m=S("inset-shadow"),p=S("text-shadow"),u=S("drop-shadow"),b=S("blur"),f=S("perspective"),g=S("aspect"),h=S("ease"),v=S("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],x=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],w=()=>[...x(),et,K],y=()=>["auto","hidden","clip","visible","scroll"],z=()=>["auto","contain","none"],j=()=>[et,K,i],N=()=>[D,"full","auto",...j()],O=()=>[T,"none","subgrid",et,K],C=()=>["auto",{span:["full",T,et,K]},T,et,K],I=()=>[T,"auto",et,K],E=()=>["auto","min","max","fr",et,K],M=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Z=()=>["start","end","center","stretch","center-safe","end-safe"],G=()=>["auto",...j()],W=()=>[D,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...j()],P=()=>[e,et,K],H=()=>[...x(),el,ee,{position:[et,K]}],$=()=>["no-repeat",{repeat:["","x","y","space","round"]}],A=()=>["auto","cover","contain",es,J,{size:[et,K]}],q=()=>[_,en,U],V=()=>["","none","full",c,et,K],Q=()=>["",L,en,U],X=()=>["solid","dashed","dotted","double"],ed=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],em=()=>[L,_,el,ee],ep=()=>["","none",b,et,K],eu=()=>["none",L,et,K],eb=()=>["none",L,et,K],ef=()=>[L,et,K],eg=()=>[D,"full",...j()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[B],breakpoint:[B],color:[R],container:[B],"drop-shadow":[B],ease:["in","out","in-out"],font:[F],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[B],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[B],shadow:[B],spacing:["px",L],text:[B],"text-shadow":[B],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",D,K,et,g]}],container:["container"],columns:[{columns:[L,K,et,s]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:w()}],overflow:[{overflow:y()}],"overflow-x":[{"overflow-x":y()}],"overflow-y":[{"overflow-y":y()}],overscroll:[{overscroll:z()}],"overscroll-x":[{"overscroll-x":z()}],"overscroll-y":[{"overscroll-y":z()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:N()}],"inset-x":[{"inset-x":N()}],"inset-y":[{"inset-y":N()}],start:[{start:N()}],end:[{end:N()}],top:[{top:N()}],right:[{right:N()}],bottom:[{bottom:N()}],left:[{left:N()}],visibility:["visible","invisible","collapse"],z:[{z:[T,"auto",et,K]}],basis:[{basis:[D,"full","auto",s,...j()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[L,D,"auto","initial","none",K]}],grow:[{grow:["",L,et,K]}],shrink:[{shrink:["",L,et,K]}],order:[{order:[T,"first","last","none",et,K]}],"grid-cols":[{"grid-cols":O()}],"col-start-end":[{col:C()}],"col-start":[{"col-start":I()}],"col-end":[{"col-end":I()}],"grid-rows":[{"grid-rows":O()}],"row-start-end":[{row:C()}],"row-start":[{"row-start":I()}],"row-end":[{"row-end":I()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":E()}],"auto-rows":[{"auto-rows":E()}],gap:[{gap:j()}],"gap-x":[{"gap-x":j()}],"gap-y":[{"gap-y":j()}],"justify-content":[{justify:[...M(),"normal"]}],"justify-items":[{"justify-items":[...Z(),"normal"]}],"justify-self":[{"justify-self":["auto",...Z()]}],"align-content":[{content:["normal",...M()]}],"align-items":[{items:[...Z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Z(),{baseline:["","last"]}]}],"place-content":[{"place-content":M()}],"place-items":[{"place-items":[...Z(),"baseline"]}],"place-self":[{"place-self":["auto",...Z()]}],p:[{p:j()}],px:[{px:j()}],py:[{py:j()}],ps:[{ps:j()}],pe:[{pe:j()}],pt:[{pt:j()}],pr:[{pr:j()}],pb:[{pb:j()}],pl:[{pl:j()}],m:[{m:G()}],mx:[{mx:G()}],my:[{my:G()}],ms:[{ms:G()}],me:[{me:G()}],mt:[{mt:G()}],mr:[{mr:G()}],mb:[{mb:G()}],ml:[{ml:G()}],"space-x":[{"space-x":j()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":j()}],"space-y-reverse":["space-y-reverse"],size:[{size:W()}],w:[{w:[s,"screen",...W()]}],"min-w":[{"min-w":[s,"screen","none",...W()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[l]},...W()]}],h:[{h:["screen","lh",...W()]}],"min-h":[{"min-h":["screen","lh","none",...W()]}],"max-h":[{"max-h":["screen","lh",...W()]}],"font-size":[{text:["base",r,en,U]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[t,et,Y]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",_,K]}],"font-family":[{font:[ea,K,o]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[n,et,K]}],"line-clamp":[{"line-clamp":[L,"none",et,Y]}],leading:[{leading:[a,...j()]}],"list-image":[{"list-image":["none",et,K]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",et,K]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...X(),"wavy"]}],"text-decoration-thickness":[{decoration:[L,"from-font","auto",et,U]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[L,"auto",et,K]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:j()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",et,K]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",et,K]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:H()}],"bg-repeat":[{bg:$()}],"bg-size":[{bg:A()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},T,et,K],radial:["",et,K],conic:[T,et,K]},ei,eo]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:q()}],"gradient-via-pos":[{via:q()}],"gradient-to-pos":[{to:q()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:V()}],"rounded-s":[{"rounded-s":V()}],"rounded-e":[{"rounded-e":V()}],"rounded-t":[{"rounded-t":V()}],"rounded-r":[{"rounded-r":V()}],"rounded-b":[{"rounded-b":V()}],"rounded-l":[{"rounded-l":V()}],"rounded-ss":[{"rounded-ss":V()}],"rounded-se":[{"rounded-se":V()}],"rounded-ee":[{"rounded-ee":V()}],"rounded-es":[{"rounded-es":V()}],"rounded-tl":[{"rounded-tl":V()}],"rounded-tr":[{"rounded-tr":V()}],"rounded-br":[{"rounded-br":V()}],"rounded-bl":[{"rounded-bl":V()}],"border-w":[{border:Q()}],"border-w-x":[{"border-x":Q()}],"border-w-y":[{"border-y":Q()}],"border-w-s":[{"border-s":Q()}],"border-w-e":[{"border-e":Q()}],"border-w-t":[{"border-t":Q()}],"border-w-r":[{"border-r":Q()}],"border-w-b":[{"border-b":Q()}],"border-w-l":[{"border-l":Q()}],"divide-x":[{"divide-x":Q()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Q()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...X(),"hidden","none"]}],"divide-style":[{divide:[...X(),"hidden","none"]}],"border-color":[{border:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:[...X(),"none","hidden"]}],"outline-offset":[{"outline-offset":[L,et,K]}],"outline-w":[{outline:["",L,en,U]}],"outline-color":[{outline:P()}],shadow:[{shadow:["","none",d,ec,er]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":["none",m,ec,er]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:Q()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[L,U]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":Q()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":["none",p,ec,er]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[L,et,K]}],"mix-blend":[{"mix-blend":[...ed(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ed()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[L]}],"mask-image-linear-from-pos":[{"mask-linear-from":em()}],"mask-image-linear-to-pos":[{"mask-linear-to":em()}],"mask-image-linear-from-color":[{"mask-linear-from":P()}],"mask-image-linear-to-color":[{"mask-linear-to":P()}],"mask-image-t-from-pos":[{"mask-t-from":em()}],"mask-image-t-to-pos":[{"mask-t-to":em()}],"mask-image-t-from-color":[{"mask-t-from":P()}],"mask-image-t-to-color":[{"mask-t-to":P()}],"mask-image-r-from-pos":[{"mask-r-from":em()}],"mask-image-r-to-pos":[{"mask-r-to":em()}],"mask-image-r-from-color":[{"mask-r-from":P()}],"mask-image-r-to-color":[{"mask-r-to":P()}],"mask-image-b-from-pos":[{"mask-b-from":em()}],"mask-image-b-to-pos":[{"mask-b-to":em()}],"mask-image-b-from-color":[{"mask-b-from":P()}],"mask-image-b-to-color":[{"mask-b-to":P()}],"mask-image-l-from-pos":[{"mask-l-from":em()}],"mask-image-l-to-pos":[{"mask-l-to":em()}],"mask-image-l-from-color":[{"mask-l-from":P()}],"mask-image-l-to-color":[{"mask-l-to":P()}],"mask-image-x-from-pos":[{"mask-x-from":em()}],"mask-image-x-to-pos":[{"mask-x-to":em()}],"mask-image-x-from-color":[{"mask-x-from":P()}],"mask-image-x-to-color":[{"mask-x-to":P()}],"mask-image-y-from-pos":[{"mask-y-from":em()}],"mask-image-y-to-pos":[{"mask-y-to":em()}],"mask-image-y-from-color":[{"mask-y-from":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[et,K]}],"mask-image-radial-from-pos":[{"mask-radial-from":em()}],"mask-image-radial-to-pos":[{"mask-radial-to":em()}],"mask-image-radial-from-color":[{"mask-radial-from":P()}],"mask-image-radial-to-color":[{"mask-radial-to":P()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":x()}],"mask-image-conic-pos":[{"mask-conic":[L]}],"mask-image-conic-from-pos":[{"mask-conic-from":em()}],"mask-image-conic-to-pos":[{"mask-conic-to":em()}],"mask-image-conic-from-color":[{"mask-conic-from":P()}],"mask-image-conic-to-color":[{"mask-conic-to":P()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:H()}],"mask-repeat":[{mask:$()}],"mask-size":[{mask:A()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",et,K]}],filter:[{filter:["","none",et,K]}],blur:[{blur:ep()}],brightness:[{brightness:[L,et,K]}],contrast:[{contrast:[L,et,K]}],"drop-shadow":[{"drop-shadow":["","none",u,ec,er]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:["",L,et,K]}],"hue-rotate":[{"hue-rotate":[L,et,K]}],invert:[{invert:["",L,et,K]}],saturate:[{saturate:[L,et,K]}],sepia:[{sepia:["",L,et,K]}],"backdrop-filter":[{"backdrop-filter":["","none",et,K]}],"backdrop-blur":[{"backdrop-blur":ep()}],"backdrop-brightness":[{"backdrop-brightness":[L,et,K]}],"backdrop-contrast":[{"backdrop-contrast":[L,et,K]}],"backdrop-grayscale":[{"backdrop-grayscale":["",L,et,K]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[L,et,K]}],"backdrop-invert":[{"backdrop-invert":["",L,et,K]}],"backdrop-opacity":[{"backdrop-opacity":[L,et,K]}],"backdrop-saturate":[{"backdrop-saturate":[L,et,K]}],"backdrop-sepia":[{"backdrop-sepia":["",L,et,K]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":j()}],"border-spacing-x":[{"border-spacing-x":j()}],"border-spacing-y":[{"border-spacing-y":j()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",et,K]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[L,"initial",et,K]}],ease:[{ease:["linear","initial",h,et,K]}],delay:[{delay:[L,et,K]}],animate:[{animate:["none",v,et,K]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[f,et,K]}],"perspective-origin":[{"perspective-origin":w()}],rotate:[{rotate:eu()}],"rotate-x":[{"rotate-x":eu()}],"rotate-y":[{"rotate-y":eu()}],"rotate-z":[{"rotate-z":eu()}],scale:[{scale:eb()}],"scale-x":[{"scale-x":eb()}],"scale-y":[{"scale-y":eb()}],"scale-z":[{"scale-z":eb()}],"scale-3d":["scale-3d"],skew:[{skew:ef()}],"skew-x":[{"skew-x":ef()}],"skew-y":[{"skew-y":ef()}],transform:[{transform:[et,K,"","none","gpu","cpu"]}],"transform-origin":[{origin:w()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:eg()}],"translate-x":[{"translate-x":eg()}],"translate-y":[{"translate-y":eg()}],"translate-z":[{"translate-z":eg()}],"translate-none":["translate-none"],accent:[{accent:P()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:P()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",et,K]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":j()}],"scroll-mx":[{"scroll-mx":j()}],"scroll-my":[{"scroll-my":j()}],"scroll-ms":[{"scroll-ms":j()}],"scroll-me":[{"scroll-me":j()}],"scroll-mt":[{"scroll-mt":j()}],"scroll-mr":[{"scroll-mr":j()}],"scroll-mb":[{"scroll-mb":j()}],"scroll-ml":[{"scroll-ml":j()}],"scroll-p":[{"scroll-p":j()}],"scroll-px":[{"scroll-px":j()}],"scroll-py":[{"scroll-py":j()}],"scroll-ps":[{"scroll-ps":j()}],"scroll-pe":[{"scroll-pe":j()}],"scroll-pt":[{"scroll-pt":j()}],"scroll-pr":[{"scroll-pr":j()}],"scroll-pb":[{"scroll-pb":j()}],"scroll-pl":[{"scroll-pl":j()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",et,K]}],fill:[{fill:["none",...P()]}],"stroke-w":[{stroke:[L,en,U,Y]}],stroke:[{stroke:["none",...P()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}})}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/630-9c30ebb65854ac3f.js b/litellm/proxy/_experimental/out/_next/static/chunks/630-9c30ebb65854ac3f.js new file mode 100644 index 0000000000..8fc423a056 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/630-9c30ebb65854ac3f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[630],{1309:function(e,l,a){a.d(l,{C:function(){return t.Z}});var t=a(41649)},2967:function(e,l,a){a.d(l,{JO:function(){return i.Z},RM:function(){return s.Z},SC:function(){return c.Z},iA:function(){return r.Z},pj:function(){return n.Z},ss:function(){return o.Z},xs:function(){return d.Z},zx:function(){return t.Z}});var t=a(78489),i=a(47323),r=a(21626),s=a(97214),n=a(28241),o=a(58834),d=a(69552),c=a(71876)},50630:function(e,l,a){a.d(l,{Z:function(){return lC}});var t,i,r,s,n=a(57437),o=a(2265),d=a(78489),c=a(12485),u=a(18135),m=a(35242),x=a(29706),p=a(77991),h=a(19250),g=a(57840),f=a(37592),j=a(15690),v=a(10032),y=a(3810),_=a(22116),b=a(64504);(t=r||(r={})).PresidioPII="Presidio PII",t.Bedrock="Bedrock Guardrail",t.Lakera="Lakera";let N={},w=e=>{let l={};return l.PresidioPII="Presidio PII",l.Bedrock="Bedrock Guardrail",l.Lakera="Lakera",Object.entries(e).forEach(e=>{let[a,t]=e;t&&"object"==typeof t&&"ui_friendly_name"in t&&(l[a.split("_").map((e,l)=>e.charAt(0).toUpperCase()+e.slice(1)).join("")]=t.ui_friendly_name)}),N=l,l},k=()=>Object.keys(N).length>0?N:r,C={PresidioPII:"presidio",Bedrock:"bedrock",Lakera:"lakera_v2",LitellmContentFilter:"litellm_content_filter",ToolPermission:"tool_permission"},S=e=>{Object.entries(e).forEach(e=>{let[l,a]=e;a&&"object"==typeof a&&"ui_friendly_name"in a&&(C[l.split("_").map((e,l)=>e.charAt(0).toUpperCase()+e.slice(1)).join("")]=l)})},Z=e=>!!e&&"Presidio PII"===k()[e],P=e=>!!e&&"LiteLLM Content Filter"===k()[e],O="../ui/assets/logos/",I={"Presidio PII":"".concat(O,"presidio.png"),"Bedrock Guardrail":"".concat(O,"bedrock.svg"),Lakera:"".concat(O,"lakeraai.jpeg"),"Azure Content Safety Prompt Shield":"".concat(O,"presidio.png"),"Azure Content Safety Text Moderation":"".concat(O,"presidio.png"),"Aporia AI":"".concat(O,"aporia.png"),"PANW Prisma AIRS":"".concat(O,"palo_alto_networks.jpeg"),"Noma Security":"".concat(O,"noma_security.png"),"Javelin Guardrails":"".concat(O,"javelin.png"),"Pillar Guardrail":"".concat(O,"pillar.jpeg"),"Google Cloud Model Armor":"".concat(O,"google.svg"),"Guardrails AI":"".concat(O,"guardrails_ai.jpeg"),"Lasso Guardrail":"".concat(O,"lasso.png"),"Pangea Guardrail":"".concat(O,"pangea.png"),"AIM Guardrail":"".concat(O,"aim_security.jpeg"),"OpenAI Moderation":"".concat(O,"openai_small.svg"),EnkryptAI:"".concat(O,"enkrypt_ai.avif"),"Prompt Security":"".concat(O,"prompt_security.png"),"LiteLLM Content Filter":"".concat(O,"litellm_logo.jpg")},A=e=>{if(!e)return{logo:"",displayName:"-"};let l=Object.keys(C).find(l=>C[l].toLowerCase()===e.toLowerCase());if(!l)return{logo:"",displayName:e};let a=k()[l];return{logo:I[a]||"",displayName:a||e}};var L=a(99981),E=a(5545),T=a(61994),z=a(97416),B=a(8881),G=a(10798),M=a(49638);let{Text:F}=g.default,{Option:K}=f.default,D=e=>e.replace(/_/g," "),R=e=>{switch(e){case"MASK":return(0,n.jsx)(z.Z,{style:{marginRight:4}});case"BLOCK":return(0,n.jsx)(B.Z,{style:{marginRight:4}});default:return null}},J=e=>{let{categories:l,selectedCategories:a,onChange:t}=e;return(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"flex items-center mb-2",children:[(0,n.jsx)(G.Z,{className:"text-gray-500 mr-1"}),(0,n.jsx)(F,{className:"text-gray-500 font-medium",children:"Filter by category"})]}),(0,n.jsx)(f.default,{mode:"multiple",placeholder:"Select categories to filter by",style:{width:"100%"},onChange:t,value:a,allowClear:!0,showSearch:!0,optionFilterProp:"children",className:"mb-4",tagRender:e=>(0,n.jsx)(y.Z,{color:"blue",closable:e.closable,onClose:e.onClose,className:"mr-2 mb-2",children:e.label}),children:l.map(e=>(0,n.jsx)(K,{value:e.category,children:e.category},e.category))})]})},V=e=>{let{onSelectAll:l,onUnselectAll:a,hasSelectedEntities:t}=e;return(0,n.jsxs)("div",{className:"bg-gray-50 p-5 rounded-lg mb-6 border border-gray-200 shadow-sm",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)(F,{strong:!0,className:"text-gray-700 text-base",children:"Quick Actions"}),(0,n.jsx)(L.Z,{title:"Apply action to all PII types at once",children:(0,n.jsx)("div",{className:"ml-2 text-gray-400 cursor-help text-xs",children:"ⓘ"})})]}),(0,n.jsx)(E.ZP,{color:"danger",variant:"outlined",onClick:a,disabled:!t,icon:(0,n.jsx)(M.Z,{}),children:"Unselect All"})]}),(0,n.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,n.jsx)(E.ZP,{color:"primary",variant:"outlined",onClick:()=>l("MASK"),className:"h-10",block:!0,icon:(0,n.jsx)(z.Z,{}),children:"Select All & Mask"}),(0,n.jsx)(E.ZP,{color:"danger",variant:"outlined",onClick:()=>l("BLOCK"),className:"h-10 hover:bg-red-100",block:!0,icon:(0,n.jsx)(B.Z,{}),children:"Select All & Block"})]})]})},U=e=>{let{entities:l,selectedEntities:a,selectedActions:t,actions:i,onEntitySelect:r,onActionSelect:s,entityToCategoryMap:o}=e;return(0,n.jsxs)("div",{className:"border rounded-lg overflow-hidden shadow-sm",children:[(0,n.jsxs)("div",{className:"bg-gray-50 px-5 py-3 border-b flex",children:[(0,n.jsx)(F,{strong:!0,className:"flex-1 text-gray-700",children:"PII Type"}),(0,n.jsx)(F,{strong:!0,className:"w-32 text-right text-gray-700",children:"Action"})]}),(0,n.jsx)("div",{className:"max-h-[400px] overflow-y-auto",children:0===l.length?(0,n.jsx)("div",{className:"py-10 text-center text-gray-500",children:"No PII types match your filter criteria"}):l.map(e=>(0,n.jsxs)("div",{className:"px-5 py-3 flex items-center justify-between hover:bg-gray-50 border-b ".concat(a.includes(e)?"bg-blue-50":""),children:[(0,n.jsxs)("div",{className:"flex items-center flex-1",children:[(0,n.jsx)(T.Z,{checked:a.includes(e),onChange:()=>r(e),className:"mr-3"}),(0,n.jsx)(F,{className:a.includes(e)?"font-medium text-gray-900":"text-gray-700",children:D(e)}),o.get(e)&&(0,n.jsx)(y.Z,{className:"ml-2 text-xs",color:"blue",children:o.get(e)})]}),(0,n.jsx)("div",{className:"w-32",children:(0,n.jsx)(f.default,{value:a.includes(e)&&t[e]||"MASK",onChange:l=>s(e,l),style:{width:120},disabled:!a.includes(e),className:"".concat(a.includes(e)?"":"opacity-50"),dropdownMatchSelectWidth:!1,children:i.map(e=>(0,n.jsx)(K,{value:e,children:(0,n.jsxs)("div",{className:"flex items-center",children:[R(e),e]})},e))})})]},e))})]})},{Title:q,Text:W}=g.default;var Y=e=>{let{entities:l,actions:a,selectedEntities:t,selectedActions:i,onEntitySelect:r,onActionSelect:s,entityCategories:d=[]}=e,[c,u]=(0,o.useState)([]),m=new Map;d.forEach(e=>{e.entities.forEach(l=>{m.set(l,e.category)})});let x=l.filter(e=>0===c.length||c.includes(m.get(e)||""));return(0,n.jsxs)("div",{className:"pii-configuration",children:[(0,n.jsxs)("div",{className:"flex justify-between items-center mb-5",children:[(0,n.jsx)("div",{className:"flex items-center",children:(0,n.jsx)(q,{level:4,className:"!m-0 font-semibold text-gray-800",children:"Configure PII Protection"})}),(0,n.jsxs)(W,{className:"text-gray-500",children:[t.length," items selected"]})]}),(0,n.jsxs)("div",{className:"mb-6",children:[(0,n.jsx)(J,{categories:d,selectedCategories:c,onChange:u}),(0,n.jsx)(V,{onSelectAll:e=>{l.forEach(l=>{t.includes(l)||r(l),s(l,e)})},onUnselectAll:()=>{t.forEach(e=>{r(e)})},hasSelectedEntities:t.length>0})]}),(0,n.jsx)(U,{entities:x,selectedEntities:t,selectedActions:i,actions:a,onEntitySelect:r,onActionSelect:s,entityToCategoryMap:m})]})},H=a(10353),$=a(31283),Q=a(24199),X=e=>{var l;let{selectedProvider:a,accessToken:t,providerParams:i=null,value:r=null}=e,[s,d]=(0,o.useState)(!1),[c,u]=(0,o.useState)(i),[m,x]=(0,o.useState)(null);if((0,o.useEffect)(()=>{if(i){u(i);return}let e=async()=>{if(t){d(!0),x(null);try{let e=await (0,h.getGuardrailProviderSpecificParams)(t);console.log("Provider params API response:",e),u(e),w(e),S(e)}catch(e){console.error("Error fetching provider params:",e),x("Failed to load provider parameters")}finally{d(!1)}}};i||e()},[t,i]),!a)return null;if(s)return(0,n.jsx)(H.Z,{tip:"Loading provider parameters..."});if(m)return(0,n.jsx)("div",{className:"text-red-500",children:m});let p=null===(l=C[a])||void 0===l?void 0:l.toLowerCase(),g=c&&c[p];if(console.log("Provider key:",p),console.log("Provider fields:",g),!g||0===Object.keys(g).length)return(0,n.jsx)("div",{children:"No configuration fields available for this provider."});console.log("Value:",r);let j=function(e){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",a=arguments.length>2?arguments[2]:void 0;return Object.entries(e).map(e=>{let[t,i]=e,s=l?"".concat(l,".").concat(t):t,o=a?a[t]:null==r?void 0:r[t];return(console.log("Field value:",o),"ui_friendly_name"===t||"optional_params"===t&&"nested"===i.type&&i.fields)?null:"nested"===i.type&&i.fields?(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"mb-2 font-medium",children:t}),(0,n.jsx)("div",{className:"ml-4 border-l-2 border-gray-200 pl-4",children:j(i.fields,s,o)})]},s):(0,n.jsx)(v.Z.Item,{name:s,label:t,tooltip:i.description,rules:i.required?[{required:!0,message:"".concat(t," is required")}]:void 0,children:"select"===i.type&&i.options?(0,n.jsx)(f.default,{placeholder:i.description,defaultValue:o||i.default_value,children:i.options.map(e=>(0,n.jsx)(f.default.Option,{value:e,children:e},e))}):"multiselect"===i.type&&i.options?(0,n.jsx)(f.default,{mode:"multiple",placeholder:i.description,defaultValue:o||i.default_value,children:i.options.map(e=>(0,n.jsx)(f.default.Option,{value:e,children:e},e))}):"bool"===i.type||"boolean"===i.type?(0,n.jsxs)(f.default,{placeholder:i.description,defaultValue:void 0!==o?String(o):i.default_value,children:[(0,n.jsx)(f.default.Option,{value:"true",children:"True"}),(0,n.jsx)(f.default.Option,{value:"false",children:"False"})]}):"number"===i.type?(0,n.jsx)(Q.Z,{step:1,width:400,placeholder:i.description,defaultValue:void 0!==o?Number(o):void 0}):t.includes("password")||t.includes("secret")||t.includes("key")?(0,n.jsx)($.o,{placeholder:i.description,type:"password",defaultValue:o||""}):(0,n.jsx)($.o,{placeholder:i.description,type:"text",defaultValue:o||""})},s)})};return(0,n.jsx)(n.Fragment,{children:j(g)})};let{Title:ee}=g.default,el=e=>{let{field:l,fieldKey:a,fullFieldKey:t,value:i}=e,[r,s]=o.useState([]),[d,c]=o.useState(l.dict_key_options||[]);o.useEffect(()=>{if(i&&"object"==typeof i){let e=Object.keys(i);s(e.map(e=>({key:e,id:"".concat(e,"_").concat(Date.now(),"_").concat(Math.random())}))),c((l.dict_key_options||[]).filter(l=>!e.includes(l)))}},[i,l.dict_key_options]);let u=e=>{e&&(s([...r,{key:e,id:"".concat(e,"_").concat(Date.now())}]),c(d.filter(l=>l!==e)))},m=(e,l)=>{s(r.filter(l=>l.id!==e)),c([...d,l].sort())};return(0,n.jsxs)("div",{className:"space-y-3",children:[r.map(e=>(0,n.jsxs)("div",{className:"flex items-center space-x-3 p-3 border rounded-lg",children:[(0,n.jsx)("div",{className:"w-24 font-medium text-sm",children:e.key}),(0,n.jsx)("div",{className:"flex-1",children:(0,n.jsx)(v.Z.Item,{name:Array.isArray(t)?[...t,e.key]:[t,e.key],style:{marginBottom:0},initialValue:i&&"object"==typeof i?i[e.key]:void 0,normalize:"number"===l.dict_value_type?e=>{if(null==e||""===e)return;let l=Number(e);return isNaN(l)?e:l}:void 0,children:"number"===l.dict_value_type?(0,n.jsx)(Q.Z,{step:1,width:200,placeholder:"Enter ".concat(e.key," value")}):"boolean"===l.dict_value_type?(0,n.jsxs)(f.default,{placeholder:"Select ".concat(e.key," value"),children:[(0,n.jsx)(f.default.Option,{value:!0,children:"True"}),(0,n.jsx)(f.default.Option,{value:!1,children:"False"})]}):(0,n.jsx)($.o,{placeholder:"Enter ".concat(e.key," value"),type:"text"})})}),(0,n.jsx)("button",{type:"button",className:"text-red-500 hover:text-red-700 text-sm",onClick:()=>m(e.id,e.key),children:"Remove"})]},e.id)),d.length>0&&(0,n.jsxs)("div",{className:"flex items-center space-x-3 mt-2",children:[(0,n.jsx)(f.default,{placeholder:"Select category to configure",style:{width:200},onSelect:e=>e&&u(e),value:void 0,children:d.map(e=>(0,n.jsx)(f.default.Option,{value:e,children:e},e))}),(0,n.jsx)("span",{className:"text-sm text-gray-500",children:"Select a category to add threshold configuration"})]})]})};var ea=e=>{let{optionalParams:l,parentFieldKey:a,values:t}=e,i=(e,l)=>{let i="".concat(a,".").concat(e),r=null==t?void 0:t[e];return(console.log("value",r),"dict"===l.type&&l.dict_key_options)?(0,n.jsxs)("div",{className:"mb-8 p-6 bg-gray-50 rounded-lg border border-gray-200",children:[(0,n.jsx)("div",{className:"mb-4 font-medium text-gray-900 text-base",children:e}),(0,n.jsx)("p",{className:"text-sm text-gray-600 mb-4",children:l.description}),(0,n.jsx)(el,{field:l,fieldKey:e,fullFieldKey:[a,e],value:r})]},i):(0,n.jsx)("div",{className:"mb-8 p-6 bg-white rounded-lg border border-gray-200 shadow-sm",children:(0,n.jsx)(v.Z.Item,{name:[a,e],label:(0,n.jsxs)("div",{className:"mb-2",children:[(0,n.jsx)("div",{className:"font-medium text-gray-900 text-base",children:e}),(0,n.jsx)("p",{className:"text-sm text-gray-600 mt-1",children:l.description})]}),rules:l.required?[{required:!0,message:"".concat(e," is required")}]:void 0,className:"mb-0",initialValue:void 0!==r?r:l.default_value,normalize:"number"===l.type?e=>{if(null==e||""===e)return;let l=Number(e);return isNaN(l)?e:l}:void 0,children:"select"===l.type&&l.options?(0,n.jsx)(f.default,{placeholder:l.description,children:l.options.map(e=>(0,n.jsx)(f.default.Option,{value:e,children:e},e))}):"multiselect"===l.type&&l.options?(0,n.jsx)(f.default,{mode:"multiple",placeholder:l.description,children:l.options.map(e=>(0,n.jsx)(f.default.Option,{value:e,children:e},e))}):"bool"===l.type||"boolean"===l.type?(0,n.jsxs)(f.default,{placeholder:l.description,children:[(0,n.jsx)(f.default.Option,{value:"true",children:"True"}),(0,n.jsx)(f.default.Option,{value:"false",children:"False"})]}):"number"===l.type?(0,n.jsx)(Q.Z,{step:1,width:400,placeholder:l.description}):e.includes("password")||e.includes("secret")||e.includes("key")?(0,n.jsx)($.o,{placeholder:l.description,type:"password"}):(0,n.jsx)($.o,{placeholder:l.description,type:"text"})})},i)};return l.fields&&0!==Object.keys(l.fields).length?(0,n.jsxs)("div",{className:"guardrail-optional-params",children:[(0,n.jsxs)("div",{className:"mb-8 pb-4 border-b border-gray-100",children:[(0,n.jsx)(ee,{level:3,className:"mb-2 font-semibold text-gray-900",children:"Optional Parameters"}),(0,n.jsx)("p",{className:"text-gray-600 text-sm",children:l.description||"Configure additional settings for this guardrail provider"})]}),(0,n.jsx)("div",{className:"space-y-8",children:Object.entries(l.fields).map(e=>{let[l,a]=e;return i(l,a)})})]}):null},et=a(9114),ei=a(5945),er=a(58760),es=a(65319),en=a(96473),eo=a(3632),ed=a(16312);let{Text:ec}=g.default,{Option:eu}=f.default;var em=e=>{let{visible:l,prebuiltPatterns:a,categories:t,selectedPatternName:i,patternAction:r,onPatternNameChange:s,onActionChange:o,onAdd:d,onCancel:c}=e;return(0,n.jsxs)(_.Z,{title:"Add prebuilt pattern",open:l,onCancel:c,footer:null,width:800,children:[(0,n.jsxs)(er.Z,{direction:"vertical",style:{width:"100%"},size:"large",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(ec,{strong:!0,children:"Pattern type"}),(0,n.jsx)(f.default,{placeholder:"Choose pattern type",value:i,onChange:s,style:{width:"100%",marginTop:8},showSearch:!0,filterOption:(e,l)=>{let t=a.find(e=>e.name===(null==l?void 0:l.value));return!!t&&(t.display_name.toLowerCase().includes(e.toLowerCase())||t.name.toLowerCase().includes(e.toLowerCase()))},children:t.map(e=>{let l=a.filter(l=>l.category===e);return 0===l.length?null:(0,n.jsx)(f.default.OptGroup,{label:e,children:l.map(e=>(0,n.jsx)(eu,{value:e.name,children:e.display_name},e.name))},e)})})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(ec,{strong:!0,children:"Action"}),(0,n.jsx)(ec,{type:"secondary",style:{display:"block",marginTop:4,marginBottom:8},children:"Choose what action the guardrail should take when this pattern is detected"}),(0,n.jsxs)(f.default,{value:r,onChange:o,style:{width:"100%"},children:[(0,n.jsx)(eu,{value:"BLOCK",children:"Block"}),(0,n.jsx)(eu,{value:"MASK",children:"Mask"})]})]})]}),(0,n.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"24px"},children:[(0,n.jsx)(ed.z,{variant:"secondary",onClick:c,children:"Cancel"}),(0,n.jsx)(ed.z,{onClick:d,children:"Add"})]})]})};let{Text:ex}=g.default,{Option:ep}=f.default;var eh=e=>{let{visible:l,patternName:a,patternRegex:t,patternAction:i,onNameChange:r,onRegexChange:s,onActionChange:o,onAdd:d,onCancel:c}=e;return(0,n.jsxs)(_.Z,{title:"Add custom regex pattern",open:l,onCancel:c,footer:null,width:800,children:[(0,n.jsxs)(er.Z,{direction:"vertical",style:{width:"100%"},size:"large",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(ex,{strong:!0,children:"Pattern name"}),(0,n.jsx)(b.o,{placeholder:"e.g., internal_id, employee_code",value:a,onValueChange:r,style:{marginTop:8}})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(ex,{strong:!0,children:"Regex pattern"}),(0,n.jsx)(b.o,{placeholder:"e.g., ID-[0-9]{6}",value:t,onValueChange:s,style:{marginTop:8}}),(0,n.jsx)(ex,{type:"secondary",style:{fontSize:12},children:"Enter a valid regular expression to match sensitive data"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(ex,{strong:!0,children:"Action"}),(0,n.jsx)(ex,{type:"secondary",style:{display:"block",marginTop:4,marginBottom:8},children:"Choose what action the guardrail should take when this pattern is detected"}),(0,n.jsxs)(f.default,{value:i,onChange:o,style:{width:"100%"},children:[(0,n.jsx)(ep,{value:"BLOCK",children:"Block"}),(0,n.jsx)(ep,{value:"MASK",children:"Mask"})]})]})]}),(0,n.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"24px"},children:[(0,n.jsx)(b.z,{variant:"secondary",onClick:c,children:"Cancel"}),(0,n.jsx)(b.z,{onClick:d,children:"Add"})]})]})},eg=a(49566),ef=a(16853);let{Text:ej}=g.default,{Option:ev}=f.default;var ey=e=>{let{visible:l,keyword:a,action:t,description:i,onKeywordChange:r,onActionChange:s,onDescriptionChange:o,onAdd:c,onCancel:u}=e;return(0,n.jsxs)(_.Z,{title:"Add blocked keyword",open:l,onCancel:u,footer:null,width:800,children:[(0,n.jsxs)(er.Z,{direction:"vertical",style:{width:"100%"},size:"large",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(ej,{strong:!0,children:"Keyword"}),(0,n.jsx)(eg.Z,{placeholder:"Enter sensitive keyword or phrase",value:a,onValueChange:r,style:{marginTop:8}})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(ej,{strong:!0,children:"Action"}),(0,n.jsx)(ej,{type:"secondary",style:{display:"block",marginTop:4,marginBottom:8},children:"Choose what action the guardrail should take when this keyword is detected"}),(0,n.jsxs)(f.default,{value:t,onChange:s,style:{width:"100%"},children:[(0,n.jsx)(ev,{value:"BLOCK",children:"Block"}),(0,n.jsx)(ev,{value:"MASK",children:"Mask"})]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(ej,{strong:!0,children:"Description (optional)"}),(0,n.jsx)(ef.Z,{placeholder:"Explain why this keyword is sensitive",value:i,onValueChange:o,rows:3,style:{marginTop:8}})]})]}),(0,n.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"24px"},children:[(0,n.jsx)(d.Z,{variant:"secondary",onClick:u,children:"Cancel"}),(0,n.jsx)(d.Z,{onClick:c,children:"Add"})]})]})},e_=a(56609),eb=a(26349);let{Text:eN}=g.default,{Option:ew}=f.default;var ek=e=>{let{patterns:l,onActionChange:a,onRemove:t}=e,i=[{title:"Type",dataIndex:"type",key:"type",width:100,render:e=>(0,n.jsx)(y.Z,{color:"prebuilt"===e?"blue":"green",children:"prebuilt"===e?"Prebuilt":"Custom"})},{title:"Pattern name",dataIndex:"name",key:"name",render:(e,l)=>l.display_name||l.name},{title:"Regex pattern",dataIndex:"pattern",key:"pattern",render:e=>e?(0,n.jsxs)(eN,{code:!0,style:{fontSize:12},children:[e.substring(0,40),"..."]}):"-"},{title:"Action",dataIndex:"action",key:"action",width:150,render:(e,l)=>(0,n.jsxs)(f.default,{value:e,onChange:e=>a(l.id,e),style:{width:120},size:"small",children:[(0,n.jsx)(ew,{value:"BLOCK",children:"Block"}),(0,n.jsx)(ew,{value:"MASK",children:"Mask"})]})},{title:"",key:"actions",width:100,render:(e,l)=>(0,n.jsx)(ed.z,{type:"button",variant:"light",color:"red",size:"xs",icon:eb.Z,onClick:()=>t(l.id),children:"Delete"})}];return 0===l.length?(0,n.jsx)("div",{style:{textAlign:"center",padding:"40px 0",color:"#999"},children:"No patterns added."}):(0,n.jsx)(e_.Z,{dataSource:l,columns:i,rowKey:"id",pagination:!1,size:"small"})};let{Text:eC}=g.default,{Option:eS}=f.default;var eZ=e=>{let{keywords:l,onActionChange:a,onRemove:t}=e,i=[{title:"Keyword",dataIndex:"keyword",key:"keyword"},{title:"Action",dataIndex:"action",key:"action",width:150,render:(e,l)=>(0,n.jsxs)(f.default,{value:e,onChange:e=>a(l.id,"action",e),style:{width:120},size:"small",children:[(0,n.jsx)(eS,{value:"BLOCK",children:"Block"}),(0,n.jsx)(eS,{value:"MASK",children:"Mask"})]})},{title:"Description",dataIndex:"description",key:"description",render:e=>e||"-"},{title:"",key:"actions",width:100,render:(e,l)=>(0,n.jsx)(ed.z,{type:"button",variant:"light",color:"red",size:"xs",icon:eb.Z,onClick:()=>t(l.id),children:"Delete"})}];return 0===l.length?(0,n.jsx)("div",{style:{textAlign:"center",padding:"40px 0",color:"#999"},children:"No keywords added."}):(0,n.jsx)(e_.Z,{dataSource:l,columns:i,rowKey:"id",pagination:!1,size:"small"})};let{Title:eP,Text:eO}=g.default;var eI=e=>{let{prebuiltPatterns:l,categories:a,selectedPatterns:t,blockedWords:i,onPatternAdd:r,onPatternRemove:s,onPatternActionChange:d,onBlockedWordAdd:c,onBlockedWordRemove:u,onBlockedWordUpdate:m,onFileUpload:x,accessToken:p,showStep:g}=e,[f,j]=(0,o.useState)(!1),[v,y]=(0,o.useState)(!1),[_,b]=(0,o.useState)(!1),[N,w]=(0,o.useState)(""),[k,C]=(0,o.useState)("BLOCK"),[S,Z]=(0,o.useState)(""),[P,O]=(0,o.useState)(""),[I,A]=(0,o.useState)("BLOCK"),[L,E]=(0,o.useState)(""),[T,z]=(0,o.useState)("BLOCK"),[B,G]=(0,o.useState)(""),[M,F]=(0,o.useState)(!1),K=async e=>{F(!0);try{let l=await e.text();if(p){let e=await (0,h.validateBlockedWordsFile)(p,l);if(e.valid)x&&x(l),et.Z.success(e.message||"File uploaded successfully");else{let l=e.error||e.errors&&e.errors.join(", ")||"Invalid file";et.Z.error("Validation failed: ".concat(l))}}}catch(e){et.Z.error("Failed to upload file: ".concat(e))}finally{F(!1)}return!1};return(0,n.jsxs)("div",{className:"space-y-6",children:[!g&&(0,n.jsx)("div",{children:(0,n.jsx)(eO,{type:"secondary",children:"Configure patterns and keywords to detect and filter sensitive information in requests and responses."})}),(!g||"patterns"===g)&&(0,n.jsxs)(ei.Z,{title:(0,n.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,n.jsx)(eP,{level:5,style:{margin:0},children:"Pattern Detection"}),(0,n.jsx)(eO,{type:"secondary",style:{fontSize:14,fontWeight:400},children:"Detect sensitive information using regex patterns (SSN, credit cards, API keys, etc.)"})]}),size:"small",children:[(0,n.jsx)("div",{style:{marginBottom:16},children:(0,n.jsxs)(er.Z,{children:[(0,n.jsx)(ed.z,{type:"button",onClick:()=>j(!0),icon:en.Z,children:"Add prebuilt pattern"}),(0,n.jsx)(ed.z,{type:"button",onClick:()=>b(!0),variant:"secondary",icon:en.Z,children:"Add custom regex"})]})}),(0,n.jsx)(ek,{patterns:t,onActionChange:d,onRemove:s})]}),(!g||"keywords"===g)&&(0,n.jsxs)(ei.Z,{title:(0,n.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,n.jsx)(eP,{level:5,style:{margin:0},children:"Blocked Keywords"}),(0,n.jsx)(eO,{type:"secondary",style:{fontSize:14,fontWeight:400},children:"Block or mask specific sensitive terms and phrases"})]}),size:"small",children:[(0,n.jsx)("div",{style:{marginBottom:16},children:(0,n.jsxs)(er.Z,{children:[(0,n.jsx)(ed.z,{type:"button",onClick:()=>y(!0),icon:en.Z,children:"Add keyword"}),(0,n.jsx)(es.default,{beforeUpload:K,accept:".yaml,.yml",showUploadList:!1,children:(0,n.jsx)(ed.z,{type:"button",variant:"secondary",icon:eo.Z,loading:M,children:"Upload YAML file"})})]})}),(0,n.jsx)(eZ,{keywords:i,onActionChange:m,onRemove:u})]}),(0,n.jsx)(em,{visible:f,prebuiltPatterns:l,categories:a,selectedPatternName:N,patternAction:k,onPatternNameChange:w,onActionChange:e=>C(e),onAdd:()=>{if(!N){et.Z.error("Please select a pattern");return}let e=l.find(e=>e.name===N);r({id:"pattern-".concat(Date.now()),type:"prebuilt",name:N,display_name:null==e?void 0:e.display_name,action:k}),j(!1),w(""),C("BLOCK")},onCancel:()=>{j(!1),w(""),C("BLOCK")}}),(0,n.jsx)(eh,{visible:_,patternName:S,patternRegex:P,patternAction:I,onNameChange:Z,onRegexChange:O,onActionChange:e=>A(e),onAdd:()=>{if(!S||!P){et.Z.error("Please provide pattern name and regex");return}r({id:"custom-".concat(Date.now()),type:"custom",name:S,pattern:P,action:I}),b(!1),Z(""),O(""),A("BLOCK")},onCancel:()=>{b(!1),Z(""),O(""),A("BLOCK")}}),(0,n.jsx)(ey,{visible:v,keyword:L,action:T,description:B,onKeywordChange:E,onActionChange:e=>z(e),onDescriptionChange:G,onAdd:()=>{if(!L){et.Z.error("Please enter a keyword");return}c({id:"word-".concat(Date.now()),keyword:L,action:T,description:B||void 0}),y(!1),E(""),G(""),z("BLOCK")},onCancel:()=>{y(!1),E(""),G(""),z("BLOCK")}})]})},eA=a(78801),eL=a(4260),eE=a(23496),eT=a(85180),ez=a(15424);let eB={rules:[],default_action:"deny",on_disallowed_action:"block",violation_message_template:""},eG=e=>({...eB,...e||{},rules:(null==e?void 0:e.rules)?[...e.rules]:[]});var eM=e=>{let{value:l,onChange:a,disabled:t=!1}=e,i=eG(l),r=e=>{let l={...i,...e};null==a||a(l)},s=(e,l)=>{r({rules:i.rules.map((a,t)=>t===e?{...a,...l}:a)})},o=e=>{r({rules:i.rules.filter((l,a)=>a!==e)})},d=(e,l)=>{let a=i.rules[e];if(!a)return;let t=Object.entries(a.allowed_param_patterns||{});l(t);let r={};t.forEach(e=>{let[l,a]=e;r[l]=a}),s(e,{allowed_param_patterns:Object.keys(r).length>0?r:void 0})},c=(e,l,a)=>{d(e,e=>{if(!e[l])return;let[,t]=e[l];e[l]=[a,t]})},u=(e,l,a)=>{d(e,e=>{if(!e[l])return;let[t]=e[l];e[l]=[t,a]})},m=(e,l)=>{let a=Object.entries(e.allowed_param_patterns||{});return 0===a.length?(0,n.jsx)(E.ZP,{disabled:t,size:"small",onClick:()=>s(l,{allowed_param_patterns:{"":""}}),children:"+ Restrict tool arguments (optional)"}):(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)(eA.x,{className:"text-sm text-gray-600",children:"Argument constraints (dot or array paths)"}),a.map((a,i)=>{let[r,s]=a;return(0,n.jsxs)(er.Z,{align:"start",children:[(0,n.jsx)(eL.default,{disabled:t,placeholder:"messages[0].content",value:r,onChange:e=>c(l,i,e.target.value)}),(0,n.jsx)(eL.default,{disabled:t,placeholder:"^email@.*$",value:s,onChange:e=>u(l,i,e.target.value)}),(0,n.jsx)(E.ZP,{disabled:t,icon:(0,n.jsx)(eb.Z,{}),danger:!0,onClick:()=>d(l,e=>{e.splice(i,1)})})]},"".concat(e.id||l,"-").concat(i))}),(0,n.jsx)(E.ZP,{disabled:t,size:"small",onClick:()=>s(l,{allowed_param_patterns:{...e.allowed_param_patterns||{},"":""}}),children:"+ Add another constraint"})]})};return(0,n.jsxs)(eA.Z,{children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(eA.x,{className:"text-lg font-semibold",children:"LiteLLM Tool Permission Guardrail"}),(0,n.jsx)(eA.x,{className:"text-sm text-gray-500",children:"Provide regex patterns (e.g., ^mcp__github_.*$) for tool names or types and optionally constrain payload fields."})]}),!t&&(0,n.jsx)(E.ZP,{icon:(0,n.jsx)(en.Z,{}),type:"primary",onClick:()=>{r({rules:[...i.rules,{id:"rule_".concat(Math.random().toString(36).slice(2,8)),decision:"allow",allowed_param_patterns:void 0}]})},className:"!bg-blue-600 !text-white hover:!bg-blue-500",children:"Add Rule"})]}),(0,n.jsx)(eE.Z,{}),0===i.rules.length?(0,n.jsx)(eT.Z,{description:"No tool rules added yet"}):(0,n.jsx)("div",{className:"space-y-4",children:i.rules.map((e,l)=>{var a,i;return(0,n.jsxs)(eA.Z,{className:"bg-gray-50",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,n.jsxs)(eA.x,{className:"font-semibold",children:["Rule ",l+1]}),(0,n.jsx)(E.ZP,{icon:(0,n.jsx)(eb.Z,{}),danger:!0,type:"text",disabled:t,onClick:()=>o(l),children:"Remove"})]}),(0,n.jsxs)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(eA.x,{className:"text-sm font-medium",children:"Rule ID"}),(0,n.jsx)(eL.default,{disabled:t,placeholder:"unique_rule_id",value:e.id,onChange:e=>s(l,{id:e.target.value})})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(eA.x,{className:"text-sm font-medium",children:"Tool Name (optional)"}),(0,n.jsx)(eL.default,{disabled:t,placeholder:"^mcp__github_.*$",value:null!==(a=e.tool_name)&&void 0!==a?a:"",onChange:e=>s(l,{tool_name:""===e.target.value.trim()?void 0:e.target.value})})]})]}),(0,n.jsx)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 mt-4",children:(0,n.jsxs)("div",{children:[(0,n.jsx)(eA.x,{className:"text-sm font-medium",children:"Tool Type (optional)"}),(0,n.jsx)(eL.default,{disabled:t,placeholder:"^function$",value:null!==(i=e.tool_type)&&void 0!==i?i:"",onChange:e=>s(l,{tool_type:""===e.target.value.trim()?void 0:e.target.value})})]})}),(0,n.jsxs)("div",{className:"mt-4 flex flex-col gap-2",children:[(0,n.jsx)(eA.x,{className:"text-sm font-medium",children:"Decision"}),(0,n.jsxs)(f.default,{disabled:t,value:e.decision,style:{width:200},onChange:e=>s(l,{decision:e}),children:[(0,n.jsx)(f.default.Option,{value:"allow",children:"Allow"}),(0,n.jsx)(f.default.Option,{value:"deny",children:"Deny"})]})]}),(0,n.jsx)("div",{className:"mt-4",children:m(e,l)})]},e.id||l)})}),(0,n.jsx)(eE.Z,{}),(0,n.jsxs)("div",{className:"grid gap-4 md:grid-cols-2",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(eA.x,{className:"text-sm font-medium",children:"Default action"}),(0,n.jsxs)(f.default,{disabled:t,value:i.default_action,onChange:e=>r({default_action:e}),children:[(0,n.jsx)(f.default.Option,{value:"allow",children:"Allow"}),(0,n.jsx)(f.default.Option,{value:"deny",children:"Deny"})]})]}),(0,n.jsxs)("div",{children:[(0,n.jsxs)(eA.x,{className:"text-sm font-medium flex items-center gap-1",children:["On disallowed action",(0,n.jsx)(L.Z,{title:"Block returns an error when a forbidden tool is invoked. Rewrite strips the tool call but lets the rest of the response continue.",children:(0,n.jsx)(ez.Z,{})})]}),(0,n.jsxs)(f.default,{disabled:t,value:i.on_disallowed_action,onChange:e=>r({on_disallowed_action:e}),children:[(0,n.jsx)(f.default.Option,{value:"block",children:"Block"}),(0,n.jsx)(f.default.Option,{value:"rewrite",children:"Rewrite"})]})]})]}),(0,n.jsxs)("div",{className:"mt-4",children:[(0,n.jsx)(eA.x,{className:"text-sm font-medium",children:"Violation message (optional)"}),(0,n.jsx)(eL.default.TextArea,{disabled:t,rows:3,placeholder:"This violates our org policy...",value:i.violation_message_template,onChange:e=>r({violation_message_template:e.target.value})})]})]})};let{Title:eF,Text:eK,Link:eD}=g.default,{Option:eR}=f.default,{Step:eJ}=j.default,eV={pre_call:"Before LLM Call - Runs before the LLM call and checks the input (Recommended)",during_call:"During LLM Call - Runs in parallel with the LLM call, with response held until check completes",post_call:"After LLM Call - Runs after the LLM call and checks only the output",logging_only:"Logging Only - Only runs on logging callbacks without affecting the LLM call",pre_mcp_call:"Before MCP Tool Call - Runs before MCP tool execution and validates tool calls",during_mcp_call:"During MCP Tool Call - Runs in parallel with MCP tool execution for monitoring"};var eU=e=>{let{visible:l,onClose:a,accessToken:t,onSuccess:i}=e,[r]=v.Z.useForm(),[s,d]=(0,o.useState)(!1),[c,u]=(0,o.useState)(null),[m,x]=(0,o.useState)(null),[p,g]=(0,o.useState)([]),[N,O]=(0,o.useState)({}),[A,L]=(0,o.useState)(0),[E,T]=(0,o.useState)(null),[z,B]=(0,o.useState)([]),[G,M]=(0,o.useState)(2),[F,K]=(0,o.useState)({}),[D,R]=(0,o.useState)([]),[J,V]=(0,o.useState)([]),[U,q]=(0,o.useState)({rules:[],default_action:"deny",on_disallowed_action:"block",violation_message_template:""}),W=(0,o.useMemo)(()=>!!c&&"tool_permission"===(C[c]||"").toLowerCase(),[c]);(0,o.useEffect)(()=>{t&&(async()=>{try{let[e,l]=await Promise.all([(0,h.getGuardrailUISettings)(t),(0,h.getGuardrailProviderSpecificParams)(t)]);x(e),T(l),w(l),S(l)}catch(e){console.error("Error fetching guardrail data:",e),et.Z.fromBackend("Failed to load guardrail configuration")}})()},[t]);let H=e=>{u(e),r.setFieldsValue({config:void 0,presidio_analyzer_api_base:void 0,presidio_anonymizer_api_base:void 0}),g([]),O({}),B([]),M(2),K({}),q({rules:[],default_action:"deny",on_disallowed_action:"block",violation_message_template:""})},$=e=>{g(l=>l.includes(e)?l.filter(l=>l!==e):[...l,e])},Q=(e,l)=>{O(a=>({...a,[e]:l}))},ee=async()=>{try{if(0===A&&(await r.validateFields(["guardrail_name","provider","mode","default_on"]),c)){let e=["guardrail_name","provider","mode","default_on"];"PresidioPII"===c&&e.push("presidio_analyzer_api_base","presidio_anonymizer_api_base"),await r.validateFields(e)}if(1===A&&Z(c)&&0===p.length){et.Z.fromBackend("Please select at least one PII entity to continue");return}L(A+1)}catch(e){console.error("Form validation failed:",e)}},el=()=>{L(A-1)},ei=()=>{r.resetFields(),u(null),g([]),O({}),B([]),M(2),K({}),R([]),V([]),q({rules:[],default_action:"deny",on_disallowed_action:"block",violation_message_template:""}),L(0)},er=()=>{ei(),a()},es=async()=>{try{d(!0),await r.validateFields();let l=r.getFieldsValue(!0),s=C[l.provider],n={guardrail_name:l.guardrail_name,litellm_params:{guardrail:s,mode:l.mode,default_on:l.default_on},guardrail_info:{}};if("PresidioPII"===l.provider&&p.length>0){let e={};p.forEach(l=>{e[l]=N[l]||"MASK"}),n.litellm_params.pii_entities_config=e,l.presidio_analyzer_api_base&&(n.litellm_params.presidio_analyzer_api_base=l.presidio_analyzer_api_base),l.presidio_anonymizer_api_base&&(n.litellm_params.presidio_anonymizer_api_base=l.presidio_anonymizer_api_base)}if(P(l.provider))D.length>0&&(n.litellm_params.patterns=D.map(e=>({pattern_type:"prebuilt"===e.type?"prebuilt":"regex",pattern_name:"prebuilt"===e.type?e.name:void 0,pattern:"custom"===e.type?e.pattern:void 0,name:e.name,action:e.action}))),J.length>0&&(n.litellm_params.blocked_words=J.map(e=>({keyword:e.keyword,action:e.action,description:e.description})));else if(l.config)try{let e=JSON.parse(l.config);n.guardrail_info=e}catch(e){et.Z.fromBackend("Invalid JSON in configuration"),d(!1);return}if("tool_permission"===s){if(0===U.rules.length){et.Z.fromBackend("Add at least one tool permission rule"),d(!1);return}n.litellm_params.rules=U.rules,n.litellm_params.default_action=U.default_action,n.litellm_params.on_disallowed_action=U.on_disallowed_action,U.violation_message_template&&(n.litellm_params.violation_message_template=U.violation_message_template)}if(console.log("values: ",JSON.stringify(l)),E&&c){var e;let a=null===(e=C[c])||void 0===e?void 0:e.toLowerCase();console.log("providerKey: ",a);let t=E[a]||{},i=new Set;console.log("providerSpecificParams: ",JSON.stringify(t)),Object.keys(t).forEach(e=>{"optional_params"!==e&&i.add(e)}),t.optional_params&&t.optional_params.fields&&Object.keys(t.optional_params.fields).forEach(e=>{i.add(e)}),console.log("allowedParams: ",i),i.forEach(e=>{let a=l[e];if(null==a||""===a){var t;a=null===(t=l.optional_params)||void 0===t?void 0:t[e]}null!=a&&""!==a&&(n.litellm_params[e]=a)})}if(!t)throw Error("No access token available");console.log("Sending guardrail data:",JSON.stringify(n)),await (0,h.createGuardrailCall)(t,n),et.Z.success("Guardrail created successfully"),ei(),i(),a()}catch(e){console.error("Failed to create guardrail:",e),et.Z.fromBackend("Failed to create guardrail: "+(e instanceof Error?e.message:String(e)))}finally{d(!1)}},en=()=>{var e;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(v.Z.Item,{name:"guardrail_name",label:"Guardrail Name",rules:[{required:!0,message:"Please enter a guardrail name"}],children:(0,n.jsx)(b.o,{placeholder:"Enter a name for this guardrail"})}),(0,n.jsx)(v.Z.Item,{name:"provider",label:"Guardrail Provider",rules:[{required:!0,message:"Please select a provider"}],children:(0,n.jsx)(f.default,{placeholder:"Select a guardrail provider",onChange:H,labelInValue:!1,optionLabelProp:"label",dropdownRender:e=>e,showSearch:!0,children:Object.entries(k()).map(e=>{let[l,a]=e;return(0,n.jsx)(eR,{value:l,label:(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[I[a]&&(0,n.jsx)("img",{src:I[a],alt:"",style:{height:"20px",width:"20px",marginRight:"8px",objectFit:"contain"},onError:e=>{e.currentTarget.style.display="none"}}),(0,n.jsx)("span",{children:a})]}),children:(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[I[a]&&(0,n.jsx)("img",{src:I[a],alt:"",style:{height:"20px",width:"20px",marginRight:"8px",objectFit:"contain"},onError:e=>{e.currentTarget.style.display="none"}}),(0,n.jsx)("span",{children:a})]})},l)})})}),(0,n.jsx)(v.Z.Item,{name:"mode",label:"Mode",tooltip:"How the guardrail should be applied",rules:[{required:!0,message:"Please select a mode"}],children:(0,n.jsx)(f.default,{optionLabelProp:"label",mode:"multiple",children:(null==m?void 0:null===(e=m.supported_modes)||void 0===e?void 0:e.map(e=>(0,n.jsx)(eR,{value:e,label:e,children:(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("strong",{children:e}),"pre_call"===e&&(0,n.jsx)(y.Z,{color:"green",style:{marginLeft:"8px"},children:"Recommended"})]}),(0,n.jsx)("div",{style:{fontSize:"12px",color:"#888"},children:eV[e]})]})},e)))||(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(eR,{value:"pre_call",label:"pre_call",children:(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("strong",{children:"pre_call"})," ",(0,n.jsx)(y.Z,{color:"green",children:"Recommended"})]}),(0,n.jsx)("div",{style:{fontSize:"12px",color:"#888"},children:eV.pre_call})]})}),(0,n.jsx)(eR,{value:"during_call",label:"during_call",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{children:(0,n.jsx)("strong",{children:"during_call"})}),(0,n.jsx)("div",{style:{fontSize:"12px",color:"#888"},children:eV.during_call})]})}),(0,n.jsx)(eR,{value:"post_call",label:"post_call",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{children:(0,n.jsx)("strong",{children:"post_call"})}),(0,n.jsx)("div",{style:{fontSize:"12px",color:"#888"},children:eV.post_call})]})}),(0,n.jsx)(eR,{value:"logging_only",label:"logging_only",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{children:(0,n.jsx)("strong",{children:"logging_only"})}),(0,n.jsx)("div",{style:{fontSize:"12px",color:"#888"},children:eV.logging_only})]})})]})})}),(0,n.jsx)(v.Z.Item,{name:"default_on",label:"Always On",tooltip:"If enabled, this guardrail will be applied to all requests by default.",children:(0,n.jsxs)(f.default,{children:[(0,n.jsx)(f.default.Option,{value:!0,children:"Yes"}),(0,n.jsx)(f.default.Option,{value:!1,children:"No"})]})}),!W&&(0,n.jsx)(X,{selectedProvider:c,accessToken:t,providerParams:E})]})},eo=()=>m&&"PresidioPII"===c?(0,n.jsx)(Y,{entities:m.supported_entities,actions:m.supported_actions,selectedEntities:p,selectedActions:N,onEntitySelect:$,onActionSelect:Q,entityCategories:m.pii_entity_categories}):null,ed=e=>{if(!m||!P(c))return null;let l=m.content_filter_settings;return l?(0,n.jsx)(eI,{prebuiltPatterns:l.prebuilt_patterns||[],categories:l.pattern_categories||[],selectedPatterns:D,blockedWords:J,onPatternAdd:e=>R([...D,e]),onPatternRemove:e=>R(D.filter(l=>l.id!==e)),onPatternActionChange:(e,l)=>{R(D.map(a=>a.id===e?{...a,action:l}:a))},onBlockedWordAdd:e=>V([...J,e]),onBlockedWordRemove:e=>V(J.filter(l=>l.id!==e)),onBlockedWordUpdate:(e,l,a)=>{V(J.map(t=>t.id===e?{...t,[l]:a}:t))},accessToken:t,showStep:e}):null},ec=()=>{var e;if(!c)return null;if(W)return(0,n.jsx)(eM,{value:U,onChange:q});if(!E)return null;console.log("guardrail_provider_map: ",C),console.log("selectedProvider: ",c);let l=null===(e=C[c])||void 0===e?void 0:e.toLowerCase(),a=E&&E[l];return a&&a.optional_params?(0,n.jsx)(ea,{optionalParams:a.optional_params,parentFieldKey:"optional_params"}):null};return(0,n.jsx)(_.Z,{title:"Add Guardrail",open:l,onCancel:er,footer:null,width:700,children:(0,n.jsxs)(v.Z,{form:r,layout:"vertical",initialValues:{mode:"pre_call",default_on:!1},children:[(0,n.jsxs)(j.default,{current:A,className:"mb-6",children:[(0,n.jsx)(eJ,{title:"Basic Info"}),(0,n.jsx)(eJ,{title:Z(c)?"PII Configuration":P(c)?"Pattern Detection":"Provider Configuration"}),P(c)&&(0,n.jsx)(eJ,{title:"Blocked Keywords"})]}),(()=>{switch(A){case 0:return en();case 1:if(Z(c))return eo();if(P(c))return ed("patterns");return ec();case 2:if(P(c))return ed("keywords");return null;default:return null}})(),(()=>{let e=A===(P(c)?3:2)-1;return(0,n.jsxs)("div",{className:"flex justify-end space-x-2 mt-4",children:[A>0&&(0,n.jsx)(b.z,{variant:"secondary",onClick:el,children:"Previous"}),!e&&(0,n.jsx)(b.z,{onClick:ee,children:"Next"}),e&&(0,n.jsx)(b.z,{onClick:es,loading:s,children:"Create Guardrail"}),(0,n.jsx)(b.z,{variant:"secondary",onClick:er,children:"Cancel"})]})})()]})})},eq=a(2967),eW=a(74998),eY=a(44633),eH=a(86462),e$=a(49084),eQ=a(1309),eX=a(71594),e0=a(24525),e1=a(63709);let{Title:e4,Text:e2}=g.default,{Option:e5}=f.default;var e8=e=>{var l;let{visible:a,onClose:t,accessToken:i,onSuccess:r,guardrailId:s,initialValues:d}=e,[c]=v.Z.useForm(),[u,m]=(0,o.useState)(!1),[x,p]=(0,o.useState)((null==d?void 0:d.provider)||null),[g,j]=(0,o.useState)(null),[y,N]=(0,o.useState)([]),[w,S]=(0,o.useState)({});(0,o.useEffect)(()=>{(async()=>{try{if(!i)return;let e=await (0,h.getGuardrailUISettings)(i);j(e)}catch(e){console.error("Error fetching guardrail settings:",e),et.Z.fromBackend("Failed to load guardrail settings")}})()},[i]),(0,o.useEffect)(()=>{(null==d?void 0:d.pii_entities_config)&&Object.keys(d.pii_entities_config).length>0&&(N(Object.keys(d.pii_entities_config)),S(d.pii_entities_config))},[d]);let Z=e=>{N(l=>l.includes(e)?l.filter(l=>l!==e):[...l,e])},P=(e,l)=>{S(a=>({...a,[e]:l}))},O=async()=>{try{m(!0);let e=await c.validateFields(),l=C[e.provider],a={guardrail_id:s,guardrail:{guardrail_name:e.guardrail_name,litellm_params:{guardrail:l,mode:e.mode,default_on:e.default_on},guardrail_info:{}}};if("PresidioPII"===e.provider&&y.length>0){let e={};y.forEach(l=>{e[l]=w[l]||"MASK"}),a.guardrail.litellm_params.pii_entities_config=e}else if(e.config)try{let l=JSON.parse(e.config);"Bedrock"===e.provider&&l?(l.guardrail_id&&(a.guardrail.litellm_params.guardrailIdentifier=l.guardrail_id),l.guardrail_version&&(a.guardrail.litellm_params.guardrailVersion=l.guardrail_version)):a.guardrail.guardrail_info=l}catch(e){et.Z.fromBackend("Invalid JSON in configuration"),m(!1);return}if(!i)throw Error("No access token available");console.log("Sending guardrail update data:",JSON.stringify(a));let n=await fetch("/guardrails/".concat(s),{method:"PUT",headers:{Authorization:"Bearer ".concat(i),"Content-Type":"application/json"},body:JSON.stringify(a)});if(!n.ok){let e=await n.text();throw Error(e||"Failed to update guardrail")}et.Z.success("Guardrail updated successfully"),r(),t()}catch(e){console.error("Failed to update guardrail:",e),et.Z.fromBackend("Failed to update guardrail: "+(e instanceof Error?e.message:String(e)))}finally{m(!1)}},A=()=>g&&x&&"PresidioPII"===x?(0,n.jsx)(Y,{entities:g.supported_entities,actions:g.supported_actions,selectedEntities:y,selectedActions:w,onEntitySelect:Z,onActionSelect:P,entityCategories:g.pii_entity_categories}):null;return(0,n.jsx)(_.Z,{title:"Edit Guardrail",open:a,onCancel:t,footer:null,width:700,children:(0,n.jsxs)(v.Z,{form:c,layout:"vertical",initialValues:d,children:[(0,n.jsx)(v.Z.Item,{name:"guardrail_name",label:"Guardrail Name",rules:[{required:!0,message:"Please enter a guardrail name"}],children:(0,n.jsx)(b.o,{placeholder:"Enter a name for this guardrail"})}),(0,n.jsx)(v.Z.Item,{name:"provider",label:"Guardrail Provider",rules:[{required:!0,message:"Please select a provider"}],children:(0,n.jsx)(f.default,{placeholder:"Select a guardrail provider",onChange:e=>{p(e),c.setFieldsValue({config:void 0}),N([]),S({})},disabled:!0,optionLabelProp:"label",children:Object.entries(k()).map(e=>{let[l,a]=e;return(0,n.jsx)(e5,{value:l,label:a,children:(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[I[a]&&(0,n.jsx)("img",{src:I[a],alt:"",style:{height:"20px",width:"20px",marginRight:"8px",objectFit:"contain"},onError:e=>{e.currentTarget.style.display="none"}}),(0,n.jsx)("span",{children:a})]})},l)})})}),(0,n.jsx)(v.Z.Item,{name:"mode",label:"Mode",tooltip:"How the guardrail should be applied",rules:[{required:!0,message:"Please select a mode"}],children:(0,n.jsx)(f.default,{children:(null==g?void 0:null===(l=g.supported_modes)||void 0===l?void 0:l.map(e=>(0,n.jsx)(e5,{value:e,children:e},e)))||(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(e5,{value:"pre_call",children:"pre_call"}),(0,n.jsx)(e5,{value:"post_call",children:"post_call"})]})})}),(0,n.jsx)(v.Z.Item,{name:"default_on",label:"Always On",tooltip:"If enabled, this guardrail will be applied to all requests by default",valuePropName:"checked",children:(0,n.jsx)(e1.Z,{})}),(()=>{if(!x)return null;if("PresidioPII"===x)return A();switch(x){case"Aporia":return(0,n.jsx)(v.Z.Item,{label:"Aporia Configuration",name:"config",tooltip:"JSON configuration for Aporia",children:(0,n.jsx)(eL.default.TextArea,{rows:4,placeholder:'{\n "api_key": "your_aporia_api_key",\n "project_name": "your_project_name"\n}'})});case"AimSecurity":return(0,n.jsx)(v.Z.Item,{label:"Aim Security Configuration",name:"config",tooltip:"JSON configuration for Aim Security",children:(0,n.jsx)(eL.default.TextArea,{rows:4,placeholder:'{\n "api_key": "your_aim_api_key"\n}'})});case"Bedrock":return(0,n.jsx)(v.Z.Item,{label:"Amazon Bedrock Configuration",name:"config",tooltip:"JSON configuration for Amazon Bedrock guardrails",children:(0,n.jsx)(eL.default.TextArea,{rows:4,placeholder:'{\n "guardrail_id": "your_guardrail_id",\n "guardrail_version": "your_guardrail_version"\n}'})});case"GuardrailsAI":return(0,n.jsx)(v.Z.Item,{label:"Guardrails.ai Configuration",name:"config",tooltip:"JSON configuration for Guardrails.ai",children:(0,n.jsx)(eL.default.TextArea,{rows:4,placeholder:'{\n "api_key": "your_guardrails_api_key",\n "guardrail_id": "your_guardrail_id"\n}'})});case"LakeraAI":return(0,n.jsx)(v.Z.Item,{label:"Lakera AI Configuration",name:"config",tooltip:"JSON configuration for Lakera AI",children:(0,n.jsx)(eL.default.TextArea,{rows:4,placeholder:'{\n "api_key": "your_lakera_api_key"\n}'})});case"PromptInjection":return(0,n.jsx)(v.Z.Item,{label:"Prompt Injection Configuration",name:"config",tooltip:"JSON configuration for prompt injection detection",children:(0,n.jsx)(eL.default.TextArea,{rows:4,placeholder:'{\n "threshold": 0.8\n}'})});default:return(0,n.jsx)(v.Z.Item,{label:"Custom Configuration",name:"config",tooltip:"JSON configuration for your custom guardrail",children:(0,n.jsx)(eL.default.TextArea,{rows:4,placeholder:'{\n "key1": "value1",\n "key2": "value2"\n}'})})}})(),(0,n.jsxs)("div",{className:"flex justify-end space-x-2 mt-4",children:[(0,n.jsx)(b.z,{variant:"secondary",onClick:t,children:"Cancel"}),(0,n.jsx)(b.z,{onClick:O,loading:u,children:"Update Guardrail"})]})]})})};(i=s||(s={})).DB="db",i.CONFIG="config";var e6=e=>{let{guardrailsList:l,isLoading:a,onDeleteClick:t,accessToken:i,onGuardrailUpdated:r,isAdmin:d=!1,onGuardrailClick:c}=e,[u,m]=(0,o.useState)([{id:"created_at",desc:!0}]),[x,p]=(0,o.useState)(!1),[h,g]=(0,o.useState)(null),f=e=>e?new Date(e).toLocaleString():"-",j=[{header:"Guardrail ID",accessorKey:"guardrail_id",cell:e=>(0,n.jsx)(L.Z,{title:String(e.getValue()||""),children:(0,n.jsx)(eq.zx,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left overflow-hidden truncate max-w-[200px]",onClick:()=>e.getValue()&&c(e.getValue()),children:e.getValue()?"".concat(String(e.getValue()).slice(0,7),"..."):""})})},{header:"Name",accessorKey:"guardrail_name",cell:e=>{let{row:l}=e,a=l.original;return(0,n.jsx)(L.Z,{title:a.guardrail_name,children:(0,n.jsx)("span",{className:"text-xs font-medium",children:a.guardrail_name||"-"})})}},{header:"Provider",accessorKey:"litellm_params.guardrail",cell:e=>{let{row:l}=e,{logo:a,displayName:t}=A(l.original.litellm_params.guardrail);return(0,n.jsxs)("div",{className:"flex items-center space-x-2",children:[a&&(0,n.jsx)("img",{src:a,alt:"".concat(t," logo"),className:"w-4 h-4",onError:e=>{e.target.style.display="none"}}),(0,n.jsx)("span",{className:"text-xs",children:t})]})}},{header:"Mode",accessorKey:"litellm_params.mode",cell:e=>{let{row:l}=e,a=l.original;return(0,n.jsx)("span",{className:"text-xs",children:a.litellm_params.mode})}},{header:"Default On",accessorKey:"litellm_params.default_on",cell:e=>{var l,a;let{row:t}=e,i=t.original;return(0,n.jsx)(eQ.C,{color:(null===(l=i.litellm_params)||void 0===l?void 0:l.default_on)?"green":"gray",className:"text-xs font-normal",size:"xs",children:(null===(a=i.litellm_params)||void 0===a?void 0:a.default_on)?"Default On":"Default Off"})}},{header:"Created At",accessorKey:"created_at",cell:e=>{let{row:l}=e,a=l.original;return(0,n.jsx)(L.Z,{title:a.created_at,children:(0,n.jsx)("span",{className:"text-xs",children:f(a.created_at)})})}},{header:"Updated At",accessorKey:"updated_at",cell:e=>{let{row:l}=e,a=l.original;return(0,n.jsx)(L.Z,{title:a.updated_at,children:(0,n.jsx)("span",{className:"text-xs",children:f(a.updated_at)})})}},{id:"actions",header:"Actions",cell:e=>{let{row:l}=e,a=l.original,i=a.guardrail_definition_location===s.CONFIG;return(0,n.jsx)("div",{className:"flex space-x-2",children:i?(0,n.jsx)(L.Z,{title:"Config guardrail cannot be deleted on the dashboard. Please delete it from the config file.",children:(0,n.jsx)(eq.JO,{"data-testid":"config-delete-icon",icon:eW.Z,size:"sm",className:"cursor-not-allowed text-gray-400",title:"Config guardrail cannot be deleted on the dashboard. Please delete it from the config file.","aria-label":"Delete guardrail (config)"})}):(0,n.jsx)(L.Z,{title:"Delete guardrail",children:(0,n.jsx)(eq.JO,{icon:eW.Z,size:"sm",onClick:()=>a.guardrail_id&&t(a.guardrail_id,a.guardrail_name||"Unnamed Guardrail"),className:"cursor-pointer hover:text-red-500"})})})}}],v=(0,eX.b7)({data:l,columns:j,state:{sorting:u},onSortingChange:m,getCoreRowModel:(0,e0.sC)(),getSortedRowModel:(0,e0.tj)(),enableSorting:!0});return(0,n.jsxs)("div",{className:"rounded-lg custom-border relative",children:[(0,n.jsx)("div",{className:"overflow-x-auto",children:(0,n.jsxs)(eq.iA,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,n.jsx)(eq.ss,{children:v.getHeaderGroups().map(e=>(0,n.jsx)(eq.SC,{children:e.headers.map(e=>(0,n.jsx)(eq.xs,{className:"py-1 h-8 ".concat("actions"===e.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""),onClick:e.column.getToggleSortingHandler(),children:(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,eX.ie)(e.column.columnDef.header,e.getContext())}),"actions"!==e.id&&(0,n.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,n.jsx)(eY.Z,{className:"h-4 w-4 text-blue-500"}),desc:(0,n.jsx)(eH.Z,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,n.jsx)(e$.Z,{className:"h-4 w-4 text-gray-400"})})]})},e.id))},e.id))}),(0,n.jsx)(eq.RM,{children:a?(0,n.jsx)(eq.SC,{children:(0,n.jsx)(eq.pj,{colSpan:j.length,className:"h-8 text-center",children:(0,n.jsx)("div",{className:"text-center text-gray-500",children:(0,n.jsx)("p",{children:"Loading..."})})})}):l.length>0?v.getRowModel().rows.map(e=>(0,n.jsx)(eq.SC,{className:"h-8",children:e.getVisibleCells().map(e=>(0,n.jsx)(eq.pj,{className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap ".concat("actions"===e.column.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""),children:(0,eX.ie)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,n.jsx)(eq.SC,{children:(0,n.jsx)(eq.pj,{colSpan:j.length,className:"h-8 text-center",children:(0,n.jsx)("div",{className:"text-center text-gray-500",children:(0,n.jsx)("p",{children:"No guardrails found"})})})})})]})}),h&&(0,n.jsx)(e8,{visible:x,onClose:()=>p(!1),accessToken:i,onSuccess:()=>{p(!1),g(null),r()},guardrailId:h.guardrail_id||"",initialValues:{guardrail_name:h.guardrail_name||"",provider:Object.keys(C).find(e=>C[e]===(null==h?void 0:h.litellm_params.guardrail))||"",mode:h.litellm_params.mode,default_on:h.litellm_params.default_on,pii_entities_config:h.litellm_params.pii_entities_config,...h.guardrail_info}})]})},e3=a(20347),e9=a(30078),e7=a(41649),le=a(12514),ll=a(84264),la=e=>{let{patterns:l,blockedWords:a,readOnly:t=!0,onPatternActionChange:i,onPatternRemove:r,onBlockedWordUpdate:s,onBlockedWordRemove:o}=e;if(0===l.length&&0===a.length)return null;let d=()=>{};return(0,n.jsxs)(n.Fragment,{children:[l.length>0&&(0,n.jsxs)(le.Z,{className:"mt-6",children:[(0,n.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,n.jsx)(ll.Z,{className:"text-lg font-semibold",children:"Pattern Detection"}),(0,n.jsxs)(e7.Z,{color:"blue",children:[l.length," patterns configured"]})]}),(0,n.jsx)(ek,{patterns:l,onActionChange:t?d:i||d,onRemove:t?d:r||d})]}),a.length>0&&(0,n.jsxs)(le.Z,{className:"mt-6",children:[(0,n.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,n.jsx)(ll.Z,{className:"text-lg font-semibold",children:"Blocked Keywords"}),(0,n.jsxs)(e7.Z,{color:"blue",children:[a.length," keywords configured"]})]}),(0,n.jsx)(eZ,{keywords:a,onActionChange:t?d:s||d,onRemove:t?d:o||d})]})]})},lt=e=>{var l;let{guardrailData:a,guardrailSettings:t,isEditing:i,accessToken:r,onDataChange:s,onUnsavedChanges:d}=e,[c,u]=(0,o.useState)([]),[m,x]=(0,o.useState)([]),[p,h]=(0,o.useState)([]),[g,f]=(0,o.useState)([]);(0,o.useEffect)(()=>{var e,l;if(null==a?void 0:null===(e=a.litellm_params)||void 0===e?void 0:e.patterns){let e=a.litellm_params.patterns.map((e,l)=>({id:"pattern-".concat(l),type:"prebuilt"===e.pattern_type?"prebuilt":"custom",name:e.pattern_name||e.name,display_name:e.display_name,pattern:e.pattern,action:e.action||"BLOCK"}));u(e),h(e)}else u([]),h([]);if(null==a?void 0:null===(l=a.litellm_params)||void 0===l?void 0:l.blocked_words){let e=a.litellm_params.blocked_words.map((e,l)=>({id:"word-".concat(l),keyword:e.keyword,action:e.action||"BLOCK",description:e.description}));x(e),f(e)}else x([]),f([])},[a]),(0,o.useEffect)(()=>{s&&s(c,m)},[c,m,s]);let j=o.useMemo(()=>{let e=JSON.stringify(c)!==JSON.stringify(p),l=JSON.stringify(m)!==JSON.stringify(g);return e||l},[c,m,p,g]);return((0,o.useEffect)(()=>{i&&d&&d(j)},[j,i,d]),(null==a?void 0:null===(l=a.litellm_params)||void 0===l?void 0:l.guardrail)!=="litellm_content_filter")?null:i?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(eE.Z,{orientation:"left",children:"Content Filter Configuration"}),j&&(0,n.jsx)("div",{className:"mb-4 px-4 py-3 bg-yellow-50 border border-yellow-200 rounded-md",children:(0,n.jsx)("p",{className:"text-sm text-yellow-800 font-medium",children:'⚠️ You have unsaved changes to patterns or keywords. Remember to click "Save Changes" at the bottom.'})}),(0,n.jsx)("div",{className:"mb-6",children:t&&t.content_filter_settings&&(0,n.jsx)(eI,{prebuiltPatterns:t.content_filter_settings.prebuilt_patterns||[],categories:t.content_filter_settings.pattern_categories||[],selectedPatterns:c,blockedWords:m,onPatternAdd:e=>u([...c,e]),onPatternRemove:e=>u(c.filter(l=>l.id!==e)),onPatternActionChange:(e,l)=>u(c.map(a=>a.id===e?{...a,action:l}:a)),onBlockedWordAdd:e=>x([...m,e]),onBlockedWordRemove:e=>x(m.filter(l=>l.id!==e)),onBlockedWordUpdate:(e,l,a)=>x(m.map(t=>t.id===e?{...t,[l]:a}:t)),onFileUpload:e=>{console.log("File uploaded:",e)},accessToken:r})})]}):(0,n.jsx)(la,{patterns:c,blockedWords:m,readOnly:!0})};let li=(e,l)=>({patterns:e.map(e=>({pattern_type:"prebuilt"===e.type?"prebuilt":"regex",pattern_name:"prebuilt"===e.type?e.name:void 0,pattern:"custom"===e.type?e.pattern:void 0,name:e.name,action:e.action})),blocked_words:l.map(e=>({keyword:e.keyword,action:e.action,description:e.description}))});var lr=a(10900),ls=a(59872),ln=a(30401),lo=a(78867),ld=e=>{var l,a,t,i,r,s,d,c,u,m,x,p,g,j,y,_;let{guardrailId:b,onClose:N,accessToken:w,isAdmin:k}=e,[S,Z]=(0,o.useState)(null),[P,O]=(0,o.useState)(null),[I,T]=(0,o.useState)(!0),[G,M]=(0,o.useState)(!1),[F]=v.Z.useForm(),[K,D]=(0,o.useState)([]),[R,J]=(0,o.useState)({}),[V,U]=(0,o.useState)(null),[q,W]=(0,o.useState)({}),[H,$]=(0,o.useState)(!1),Q={rules:[],default_action:"deny",on_disallowed_action:"block",violation_message_template:""},[ee,el]=(0,o.useState)(Q),[ei,er]=(0,o.useState)(!1),es=o.useRef({patterns:[],blockedWords:[]}),en=(0,o.useCallback)((e,l)=>{es.current={patterns:e,blockedWords:l}},[]),eo=async()=>{try{var e;if(T(!0),!w)return;let l=await (0,h.getGuardrailInfo)(w,b);if(Z(l),null===(e=l.litellm_params)||void 0===e?void 0:e.pii_entities_config){let e=l.litellm_params.pii_entities_config;if(D([]),J({}),Object.keys(e).length>0){let l=[],a={};Object.entries(e).forEach(e=>{let[t,i]=e;l.push(t),a[t]="string"==typeof i?i:"MASK"}),D(l),J(a)}}else D([]),J({})}catch(e){et.Z.fromBackend("Failed to load guardrail information"),console.error("Error fetching guardrail info:",e)}finally{T(!1)}},ed=async()=>{try{if(!w)return;let e=await (0,h.getGuardrailProviderSpecificParams)(w);O(e)}catch(e){console.error("Error fetching guardrail provider specific params:",e)}},ec=async()=>{try{if(!w)return;let e=await (0,h.getGuardrailUISettings)(w);U(e)}catch(e){console.error("Error fetching guardrail UI settings:",e)}};(0,o.useEffect)(()=>{ed()},[w]),(0,o.useEffect)(()=>{eo(),ec()},[b,w]),(0,o.useEffect)(()=>{if(S&&F){var e;F.setFieldsValue({guardrail_name:S.guardrail_name,...S.litellm_params,guardrail_info:S.guardrail_info?JSON.stringify(S.guardrail_info,null,2):"",...(null===(e=S.litellm_params)||void 0===e?void 0:e.optional_params)&&{optional_params:S.litellm_params.optional_params}})}},[S,P,F]);let eu=(0,o.useCallback)(()=>{var e,l,a,t,i;(null==S?void 0:null===(e=S.litellm_params)||void 0===e?void 0:e.guardrail)==="tool_permission"?el({rules:(null===(l=S.litellm_params)||void 0===l?void 0:l.rules)||[],default_action:((null===(a=S.litellm_params)||void 0===a?void 0:a.default_action)||"deny").toLowerCase(),on_disallowed_action:((null===(t=S.litellm_params)||void 0===t?void 0:t.on_disallowed_action)||"block").toLowerCase(),violation_message_template:(null===(i=S.litellm_params)||void 0===i?void 0:i.violation_message_template)||""}):el(Q),er(!1)},[S]);(0,o.useEffect)(()=>{eu()},[eu]);let em=async e=>{try{var l,a,t,i,r,s,n,o,d,c,u,m;if(!w)return;let x={litellm_params:{}};e.guardrail_name!==S.guardrail_name&&(x.guardrail_name=e.guardrail_name),e.default_on!==(null===(l=S.litellm_params)||void 0===l?void 0:l.default_on)&&(x.litellm_params.default_on=e.default_on);let p=S.guardrail_info,g=e.guardrail_info?JSON.parse(e.guardrail_info):void 0;JSON.stringify(p)!==JSON.stringify(g)&&(x.guardrail_info=g);let f=(null===(a=S.litellm_params)||void 0===a?void 0:a.pii_entities_config)||{},j={};if(K.forEach(e=>{j[e]=R[e]||"MASK"}),JSON.stringify(f)!==JSON.stringify(j)&&(x.litellm_params.pii_entities_config=j),(null===(t=S.litellm_params)||void 0===t?void 0:t.guardrail)==="litellm_content_filter"){let e=(null===(s=S.litellm_params)||void 0===s?void 0:s.patterns)||[],l=(null===(n=S.litellm_params)||void 0===n?void 0:n.blocked_words)||[],a=li(es.current.patterns,es.current.blockedWords);JSON.stringify(e)!==JSON.stringify(a.patterns)&&(x.litellm_params.patterns=a.patterns),JSON.stringify(l)!==JSON.stringify(a.blocked_words)&&(x.litellm_params.blocked_words=a.blocked_words)}if((null===(i=S.litellm_params)||void 0===i?void 0:i.guardrail)==="tool_permission"){let e=(null===(o=S.litellm_params)||void 0===o?void 0:o.rules)||[],l=ee.rules||[],a=JSON.stringify(e)!==JSON.stringify(l),t=((null===(d=S.litellm_params)||void 0===d?void 0:d.default_action)||"deny").toLowerCase(),i=(ee.default_action||"deny").toLowerCase(),r=t!==i,s=((null===(c=S.litellm_params)||void 0===c?void 0:c.on_disallowed_action)||"block").toLowerCase(),n=(ee.on_disallowed_action||"block").toLowerCase(),m=s!==n,p=(null===(u=S.litellm_params)||void 0===u?void 0:u.violation_message_template)||"",h=ee.violation_message_template||"",g=p!==h;(ei||a||r||m||g)&&(x.litellm_params.rules=l,x.litellm_params.default_action=i,x.litellm_params.on_disallowed_action=n,x.litellm_params.violation_message_template=h||null)}let v=Object.keys(C).find(e=>{var l;return C[e]===(null===(l=S.litellm_params)||void 0===l?void 0:l.guardrail)});console.log("values: ",JSON.stringify(e)),console.log("currentProvider: ",v);let y=(null===(r=S.litellm_params)||void 0===r?void 0:r.guardrail)==="tool_permission";if(P&&v&&!y){let l=P[null===(m=C[v])||void 0===m?void 0:m.toLowerCase()]||{},a=new Set;console.log("providerSpecificParams: ",JSON.stringify(l)),Object.keys(l).forEach(e=>{"optional_params"!==e&&a.add(e)}),l.optional_params&&l.optional_params.fields&&Object.keys(l.optional_params.fields).forEach(e=>{a.add(e)}),console.log("allowedParams: ",a),a.forEach(l=>{var a,t;let i=e[l];(null==i||""===i)&&(i=null===(t=e.optional_params)||void 0===t?void 0:t[l]);let r=null===(a=S.litellm_params)||void 0===a?void 0:a[l];JSON.stringify(i)!==JSON.stringify(r)&&(null!=i&&""!==i?x.litellm_params[l]=i:null!=r&&""!==r&&(x.litellm_params[l]=null))})}if(0===Object.keys(x.litellm_params).length&&delete x.litellm_params,0===Object.keys(x).length){et.Z.info("No changes detected"),M(!1);return}await (0,h.updateGuardrailCall)(w,b,x),et.Z.success("Guardrail updated successfully"),$(!1),eo(),M(!1)}catch(e){console.error("Error updating guardrail:",e),et.Z.fromBackend("Failed to update guardrail")}};if(I)return(0,n.jsx)("div",{className:"p-4",children:"Loading..."});if(!S)return(0,n.jsx)("div",{className:"p-4",children:"Guardrail not found"});let ex=e=>e?new Date(e).toLocaleString():"-",{logo:ep,displayName:eh}=A((null===(l=S.litellm_params)||void 0===l?void 0:l.guardrail)||""),eg=async(e,l)=>{await (0,ls.vQ)(e)&&(W(e=>({...e,[l]:!0})),setTimeout(()=>{W(e=>({...e,[l]:!1}))},2e3))},ef="config"===S.guardrail_definition_location;return(0,n.jsxs)("div",{className:"p-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(e9.zx,{icon:lr.Z,variant:"light",onClick:N,className:"mb-4",children:"Back to Guardrails"}),(0,n.jsx)(e9.Dx,{children:S.guardrail_name||"Unnamed Guardrail"}),(0,n.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,n.jsx)(e9.xv,{className:"text-gray-500 font-mono",children:S.guardrail_id}),(0,n.jsx)(E.ZP,{type:"text",size:"small",icon:q["guardrail-id"]?(0,n.jsx)(ln.Z,{size:12}):(0,n.jsx)(lo.Z,{size:12}),onClick:()=>eg(S.guardrail_id,"guardrail-id"),className:"left-2 z-10 transition-all duration-200 ".concat(q["guardrail-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]}),(0,n.jsxs)(e9.v0,{children:[(0,n.jsxs)(e9.td,{className:"mb-4",children:[(0,n.jsx)(e9.OK,{children:"Overview"},"overview"),k?(0,n.jsx)(e9.OK,{children:"Settings"},"settings"):(0,n.jsx)(n.Fragment,{})]}),(0,n.jsxs)(e9.nP,{children:[(0,n.jsxs)(e9.x4,{children:[(0,n.jsxs)(e9.rj,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,n.jsxs)(e9.Zb,{children:[(0,n.jsx)(e9.xv,{children:"Provider"}),(0,n.jsxs)("div",{className:"mt-2 flex items-center space-x-2",children:[ep&&(0,n.jsx)("img",{src:ep,alt:"".concat(eh," logo"),className:"w-6 h-6",onError:e=>{e.target.style.display="none"}}),(0,n.jsx)(e9.Dx,{children:eh})]})]}),(0,n.jsxs)(e9.Zb,{children:[(0,n.jsx)(e9.xv,{children:"Mode"}),(0,n.jsxs)("div",{className:"mt-2",children:[(0,n.jsx)(e9.Dx,{children:(null===(a=S.litellm_params)||void 0===a?void 0:a.mode)||"-"}),(0,n.jsx)(e9.Ct,{color:(null===(t=S.litellm_params)||void 0===t?void 0:t.default_on)?"green":"gray",children:(null===(i=S.litellm_params)||void 0===i?void 0:i.default_on)?"Default On":"Default Off"})]})]}),(0,n.jsxs)(e9.Zb,{children:[(0,n.jsx)(e9.xv,{children:"Created At"}),(0,n.jsxs)("div",{className:"mt-2",children:[(0,n.jsx)(e9.Dx,{children:ex(S.created_at)}),(0,n.jsxs)(e9.xv,{children:["Last Updated: ",ex(S.updated_at)]})]})]})]}),(null===(r=S.litellm_params)||void 0===r?void 0:r.pii_entities_config)&&Object.keys(S.litellm_params.pii_entities_config).length>0&&(0,n.jsx)(e9.Zb,{className:"mt-6",children:(0,n.jsxs)("div",{className:"flex justify-between items-center",children:[(0,n.jsx)(e9.xv,{className:"font-medium",children:"PII Protection"}),(0,n.jsxs)(e9.Ct,{color:"blue",children:[Object.keys(S.litellm_params.pii_entities_config).length," PII entities configured"]})]})}),(null===(s=S.litellm_params)||void 0===s?void 0:s.pii_entities_config)&&Object.keys(S.litellm_params.pii_entities_config).length>0&&(0,n.jsxs)(e9.Zb,{className:"mt-6",children:[(0,n.jsx)(e9.xv,{className:"mb-4 text-lg font-semibold",children:"PII Entity Configuration"}),(0,n.jsxs)("div",{className:"border rounded-lg overflow-hidden shadow-sm",children:[(0,n.jsxs)("div",{className:"bg-gray-50 px-5 py-3 border-b flex",children:[(0,n.jsx)(e9.xv,{className:"flex-1 font-semibold text-gray-700",children:"Entity Type"}),(0,n.jsx)(e9.xv,{className:"flex-1 font-semibold text-gray-700",children:"Configuration"})]}),(0,n.jsx)("div",{className:"max-h-[400px] overflow-y-auto",children:Object.entries(null===(d=S.litellm_params)||void 0===d?void 0:d.pii_entities_config).map(e=>{let[l,a]=e;return(0,n.jsxs)("div",{className:"px-5 py-3 flex border-b hover:bg-gray-50 transition-colors",children:[(0,n.jsx)(e9.xv,{className:"flex-1 font-medium text-gray-900",children:l}),(0,n.jsx)(e9.xv,{className:"flex-1",children:(0,n.jsxs)("span",{className:"inline-flex items-center gap-1.5 ".concat("MASK"===a?"text-blue-600":"text-red-600"),children:["MASK"===a?(0,n.jsx)(z.Z,{}):(0,n.jsx)(B.Z,{}),String(a)]})})]},l)})})]})]}),(null===(c=S.litellm_params)||void 0===c?void 0:c.guardrail)==="tool_permission"&&(0,n.jsx)(e9.Zb,{className:"mt-6",children:(0,n.jsx)(eM,{value:ee,disabled:!0})}),(0,n.jsx)(lt,{guardrailData:S,guardrailSettings:V,isEditing:!1,accessToken:w})]}),k&&(0,n.jsx)(e9.x4,{children:(0,n.jsxs)(e9.Zb,{children:[(0,n.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,n.jsx)(e9.Dx,{children:"Guardrail Settings"}),ef&&(0,n.jsx)(L.Z,{title:"Guardrail is defined in the config file and cannot be edited.",children:(0,n.jsx)(ez.Z,{})}),!G&&!ef&&(0,n.jsx)(e9.zx,{onClick:()=>M(!0),children:"Edit Settings"})]}),G?(0,n.jsxs)(v.Z,{form:F,onFinish:em,initialValues:{guardrail_name:S.guardrail_name,...S.litellm_params,guardrail_info:S.guardrail_info?JSON.stringify(S.guardrail_info,null,2):"",...(null===(u=S.litellm_params)||void 0===u?void 0:u.optional_params)&&{optional_params:S.litellm_params.optional_params}},layout:"vertical",children:[(0,n.jsx)(v.Z.Item,{label:"Guardrail Name",name:"guardrail_name",rules:[{required:!0,message:"Please input a guardrail name"}],children:(0,n.jsx)(e9.oi,{})}),(0,n.jsx)(v.Z.Item,{label:"Default On",name:"default_on",children:(0,n.jsxs)(f.default,{children:[(0,n.jsx)(f.default.Option,{value:!0,children:"Yes"}),(0,n.jsx)(f.default.Option,{value:!1,children:"No"})]})}),(null===(m=S.litellm_params)||void 0===m?void 0:m.guardrail)==="presidio"&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(eE.Z,{orientation:"left",children:"PII Protection"}),(0,n.jsx)("div",{className:"mb-6",children:V&&(0,n.jsx)(Y,{entities:V.supported_entities,actions:V.supported_actions,selectedEntities:K,selectedActions:R,onEntitySelect:e=>{D(l=>l.includes(e)?l.filter(l=>l!==e):[...l,e])},onActionSelect:(e,l)=>{J(a=>({...a,[e]:l}))},entityCategories:V.pii_entity_categories})})]}),(0,n.jsx)(lt,{guardrailData:S,guardrailSettings:V,isEditing:!0,accessToken:w,onDataChange:en,onUnsavedChanges:$}),(0,n.jsx)(eE.Z,{orientation:"left",children:"Provider Settings"}),(null===(x=S.litellm_params)||void 0===x?void 0:x.guardrail)==="tool_permission"?(0,n.jsx)(eM,{value:ee,onChange:el}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(X,{selectedProvider:Object.keys(C).find(e=>{var l;return C[e]===(null===(l=S.litellm_params)||void 0===l?void 0:l.guardrail)})||null,accessToken:w,providerParams:P,value:S.litellm_params}),P&&(()=>{var e;let l=Object.keys(C).find(e=>{var l;return C[e]===(null===(l=S.litellm_params)||void 0===l?void 0:l.guardrail)});if(!l)return null;let a=P[null===(e=C[l])||void 0===e?void 0:e.toLowerCase()];return a&&a.optional_params?(0,n.jsx)(ea,{optionalParams:a.optional_params,parentFieldKey:"optional_params",values:S.litellm_params}):null})()]}),(0,n.jsx)(eE.Z,{orientation:"left",children:"Advanced Settings"}),(0,n.jsx)(v.Z.Item,{label:"Guardrail Information",name:"guardrail_info",children:(0,n.jsx)(eL.default.TextArea,{rows:5})}),(0,n.jsxs)("div",{className:"flex justify-end gap-2 mt-6",children:[(0,n.jsx)(E.ZP,{onClick:()=>{M(!1),$(!1),eu()},children:"Cancel"}),(0,n.jsx)(e9.zx,{children:"Save Changes"})]})]}):(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(e9.xv,{className:"font-medium",children:"Guardrail ID"}),(0,n.jsx)("div",{className:"font-mono",children:S.guardrail_id})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(e9.xv,{className:"font-medium",children:"Guardrail Name"}),(0,n.jsx)("div",{children:S.guardrail_name||"Unnamed Guardrail"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(e9.xv,{className:"font-medium",children:"Provider"}),(0,n.jsx)("div",{children:eh})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(e9.xv,{className:"font-medium",children:"Mode"}),(0,n.jsx)("div",{children:(null===(p=S.litellm_params)||void 0===p?void 0:p.mode)||"-"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(e9.xv,{className:"font-medium",children:"Default On"}),(0,n.jsx)(e9.Ct,{color:(null===(g=S.litellm_params)||void 0===g?void 0:g.default_on)?"green":"gray",children:(null===(j=S.litellm_params)||void 0===j?void 0:j.default_on)?"Yes":"No"})]}),(null===(y=S.litellm_params)||void 0===y?void 0:y.pii_entities_config)&&Object.keys(S.litellm_params.pii_entities_config).length>0&&(0,n.jsxs)("div",{children:[(0,n.jsx)(e9.xv,{className:"font-medium",children:"PII Protection"}),(0,n.jsx)("div",{className:"mt-2",children:(0,n.jsxs)(e9.Ct,{color:"blue",children:[Object.keys(S.litellm_params.pii_entities_config).length," PII entities configured"]})})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(e9.xv,{className:"font-medium",children:"Created At"}),(0,n.jsx)("div",{children:ex(S.created_at)})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(e9.xv,{className:"font-medium",children:"Last Updated"}),(0,n.jsx)("div",{children:ex(S.updated_at)})]}),(null===(_=S.litellm_params)||void 0===_?void 0:_.guardrail)==="tool_permission"&&(0,n.jsx)(eM,{value:ee,disabled:!0})]})]})})]})]})]})},lc=a(96761),lu=a(35631),lm=a(29436),lx=a(41169),lp=a(23639),lh=a(77565),lg=a(70464),lf=a(83669),lj=a(5540);let{Text:lv}=g.default;var ly=function(e){let{results:l,errors:a}=e,[t,i]=(0,o.useState)(new Set),r=e=>{let l=new Set(t);l.has(e)?l.delete(e):l.add(e),i(l)},s=async e=>{try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0;{let l=document.createElement("textarea");l.value=e,l.style.position="fixed",l.style.opacity="0",document.body.appendChild(l),l.focus(),l.select();let a=document.execCommand("copy");if(document.body.removeChild(l),!a)throw Error("execCommand failed");return!0}}catch(e){return console.error("Copy failed:",e),!1}};return l||a?(0,n.jsxs)("div",{className:"space-y-3 pt-4 border-t border-gray-200",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-gray-900",children:"Results"}),l&&l.map(e=>{let l=t.has(e.guardrailName);return(0,n.jsx)(le.Z,{className:"bg-green-50 border-green-200",children:(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{className:"flex items-center space-x-2 cursor-pointer flex-1",onClick:()=>r(e.guardrailName),children:[l?(0,n.jsx)(lh.Z,{className:"text-gray-500 text-xs"}):(0,n.jsx)(lg.Z,{className:"text-gray-500 text-xs"}),(0,n.jsx)(lf.Z,{className:"text-green-600 text-lg"}),(0,n.jsx)("span",{className:"text-sm font-medium text-green-800",children:e.guardrailName})]}),(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsxs)("div",{className:"flex items-center space-x-1 text-xs text-gray-600",children:[(0,n.jsx)(lj.Z,{}),(0,n.jsxs)("span",{className:"font-medium",children:[e.latency,"ms"]})]}),!l&&(0,n.jsx)(d.Z,{size:"xs",variant:"secondary",icon:lp.Z,onClick:async()=>{await s(e.response_text)?et.Z.success("Result copied to clipboard"):et.Z.fromBackend("Failed to copy result")},children:"Copy"})]})]}),!l&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"bg-white border border-green-200 rounded p-3",children:[(0,n.jsx)("label",{className:"text-xs font-medium text-gray-600 mb-2 block",children:"Output Text"}),(0,n.jsx)("div",{className:"font-mono text-sm text-gray-900 whitespace-pre-wrap break-words",children:e.response_text})]}),(0,n.jsxs)("div",{className:"text-xs text-gray-600",children:[(0,n.jsx)("span",{className:"font-medium",children:"Characters:"})," ",e.response_text.length]})]})]})},e.guardrailName)}),a&&a.map(e=>{let l=t.has(e.guardrailName);return(0,n.jsx)(le.Z,{className:"bg-red-50 border-red-200",children:(0,n.jsxs)("div",{className:"flex items-start space-x-2",children:[(0,n.jsx)("div",{className:"cursor-pointer mt-0.5",onClick:()=>r(e.guardrailName),children:l?(0,n.jsx)(lh.Z,{className:"text-gray-500 text-xs"}):(0,n.jsx)(lg.Z,{className:"text-gray-500 text-xs"})}),(0,n.jsx)("div",{className:"text-red-600 mt-0.5",children:(0,n.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 20 20",children:(0,n.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),(0,n.jsxs)("div",{className:"flex-1",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,n.jsxs)("p",{className:"text-sm font-medium text-red-800 cursor-pointer",onClick:()=>r(e.guardrailName),children:[e.guardrailName," - Error"]}),(0,n.jsxs)("div",{className:"flex items-center space-x-1 text-xs text-gray-600",children:[(0,n.jsx)(lj.Z,{}),(0,n.jsxs)("span",{className:"font-medium",children:[e.latency,"ms"]})]})]}),!l&&(0,n.jsx)("p",{className:"text-sm text-red-700 mt-1",children:e.error.message})]})]})},e.guardrailName)})]}):null};let{TextArea:l_}=eL.default,{Text:lb}=g.default;var lN=function(e){let{guardrailNames:l,onSubmit:a,isLoading:t,results:i,errors:r,onClose:s}=e,[d,c]=(0,o.useState)(""),u=()=>{if(!d.trim()){et.Z.fromBackend("Please enter text to test");return}a(d)},m=async e=>{try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0;{let l=document.createElement("textarea");l.value=e,l.style.position="fixed",l.style.opacity="0",document.body.appendChild(l),l.focus(),l.select();let a=document.execCommand("copy");if(document.body.removeChild(l),!a)throw Error("execCommand failed");return!0}}catch(e){return console.error("Copy failed:",e),!1}},x=async()=>{await m(d)?et.Z.success("Input copied to clipboard"):et.Z.fromBackend("Failed to copy input")};return(0,n.jsxs)("div",{className:"space-y-4 h-full flex flex-col",children:[(0,n.jsx)("div",{className:"flex items-center justify-between pb-3 border-b border-gray-200",children:(0,n.jsx)("div",{className:"flex items-center space-x-3",children:(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsxs)("div",{className:"flex items-center space-x-2 mb-1",children:[(0,n.jsx)("h2",{className:"text-lg font-semibold text-gray-900",children:"Test Guardrails:"}),(0,n.jsx)("div",{className:"flex flex-wrap gap-2",children:l.map(e=>(0,n.jsx)("div",{className:"inline-flex items-center space-x-1 bg-blue-50 px-3 py-1 rounded-md border border-blue-200",children:(0,n.jsx)("span",{className:"font-mono text-blue-700 font-medium text-sm",children:e})},e))})]}),(0,n.jsxs)("p",{className:"text-sm text-gray-500",children:["Test ",l.length>1?"guardrails":"guardrail"," and compare results"]})]})})}),(0,n.jsxs)("div",{className:"flex-1 overflow-auto space-y-4",children:[(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"flex justify-between items-center mb-2",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Input Text"}),(0,n.jsx)(L.Z,{title:"Press Enter to submit. Use Shift+Enter for new line.",children:(0,n.jsx)(ez.Z,{className:"text-gray-400 cursor-help"})})]}),d&&(0,n.jsx)(ed.z,{size:"xs",variant:"secondary",icon:lp.Z,onClick:x,children:"Copy Input"})]}),(0,n.jsx)(l_,{value:d,onChange:e=>c(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||e.ctrlKey||e.metaKey||(e.preventDefault(),u())},placeholder:"Enter text to test with guardrails...",rows:8,className:"font-mono text-sm"}),(0,n.jsxs)("div",{className:"flex justify-between items-center mt-1",children:[(0,n.jsxs)(lb,{className:"text-xs text-gray-500",children:["Press ",(0,n.jsx)("kbd",{className:"px-1 py-0.5 bg-gray-100 border border-gray-300 rounded text-xs",children:"Enter"})," to submit • ",(0,n.jsx)("kbd",{className:"px-1 py-0.5 bg-gray-100 border border-gray-300 rounded text-xs",children:"Shift+Enter"})," for new line"]}),(0,n.jsxs)(lb,{className:"text-xs text-gray-500",children:["Characters: ",d.length]})]})]}),(0,n.jsx)("div",{className:"pt-2",children:(0,n.jsx)(ed.z,{onClick:u,loading:t,disabled:!d.trim(),className:"w-full",children:t?"Testing ".concat(l.length," guardrail").concat(l.length>1?"s":"","..."):"Test ".concat(l.length," guardrail").concat(l.length>1?"s":"")})})]}),(0,n.jsx)(ly,{results:i,errors:r})]})]})},lw=e=>{let{guardrailsList:l,isLoading:a,accessToken:t,onClose:i}=e,[r,s]=(0,o.useState)(new Set),[d,c]=(0,o.useState)(""),[u,m]=(0,o.useState)([]),[x,p]=(0,o.useState)([]),[g,f]=(0,o.useState)(!1),j=l.filter(e=>{var l;return null===(l=e.guardrail_name)||void 0===l?void 0:l.toLowerCase().includes(d.toLowerCase())}),v=e=>{let l=new Set(r);l.has(e)?l.delete(e):l.add(e),s(l)},y=async e=>{if(0===r.size||!t)return;f(!0),m([]),p([]);let l=[],a=[];await Promise.all(Array.from(r).map(async i=>{let r=Date.now();try{let a=await (0,h.applyGuardrail)(t,i,e,null,null),s=Date.now()-r;l.push({guardrailName:i,response_text:a.response_text,latency:s})}catch(l){let e=Date.now()-r;console.error("Error testing guardrail ".concat(i,":"),l),a.push({guardrailName:i,error:l,latency:e})}})),m(l),p(a),f(!1),l.length>0&&et.Z.success("".concat(l.length," guardrail").concat(l.length>1?"s":""," applied successfully")),a.length>0&&et.Z.fromBackend("".concat(a.length," guardrail").concat(a.length>1?"s":""," failed"))};return(0,n.jsx)("div",{className:"w-full h-[calc(100vh-200px)]",children:(0,n.jsx)(le.Z,{className:"h-full",children:(0,n.jsxs)("div",{className:"flex h-full",children:[(0,n.jsxs)("div",{className:"w-1/4 border-r border-gray-200 flex flex-col overflow-hidden",children:[(0,n.jsx)("div",{className:"p-4 border-b border-gray-200",children:(0,n.jsxs)("div",{className:"mb-3",children:[(0,n.jsx)(lc.Z,{className:"text-lg font-semibold mb-3",children:"Guardrails"}),(0,n.jsx)(eg.Z,{icon:lm.Z,placeholder:"Search guardrails...",value:d,onValueChange:c})]})}),(0,n.jsx)("div",{className:"flex-1 overflow-auto",children:a?(0,n.jsx)("div",{className:"flex items-center justify-center h-32",children:(0,n.jsx)(H.Z,{})}):0===j.length?(0,n.jsx)("div",{className:"p-4",children:(0,n.jsx)(eT.Z,{description:d?"No guardrails match your search":"No guardrails available"})}):(0,n.jsx)(lu.Z,{dataSource:j,renderItem:e=>(0,n.jsx)(lu.Z.Item,{onClick:()=>{e.guardrail_name&&v(e.guardrail_name)},className:"cursor-pointer hover:bg-gray-50 transition-colors px-4 ".concat(r.has(e.guardrail_name||"")?"bg-blue-50 border-l-4 border-l-blue-500":"border-l-4 border-l-transparent"),children:(0,n.jsx)(lu.Z.Item.Meta,{avatar:(0,n.jsx)(T.Z,{checked:r.has(e.guardrail_name||""),onClick:l=>{l.stopPropagation(),e.guardrail_name&&v(e.guardrail_name)}}),title:(0,n.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,n.jsx)(lx.Z,{className:"text-gray-400"}),(0,n.jsx)("span",{className:"font-medium text-gray-900",children:e.guardrail_name})]}),description:(0,n.jsxs)("div",{className:"text-xs space-y-1 mt-1",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"font-medium",children:"Type: "}),(0,n.jsx)("span",{className:"text-gray-600",children:e.litellm_params.guardrail})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"font-medium",children:"Mode: "}),(0,n.jsx)("span",{className:"text-gray-600",children:e.litellm_params.mode})]})]})})})})}),(0,n.jsx)("div",{className:"p-3 border-t border-gray-200 bg-gray-50",children:(0,n.jsxs)(ll.Z,{className:"text-xs text-gray-600",children:[r.size," of ",j.length," selected"]})})]}),(0,n.jsxs)("div",{className:"w-3/4 flex flex-col bg-white",children:[(0,n.jsx)("div",{className:"p-4 border-b border-gray-200 flex justify-between items-center",children:(0,n.jsx)(lc.Z,{className:"text-xl font-semibold mb-0",children:"Guardrail Testing Playground"})}),(0,n.jsx)("div",{className:"flex-1 overflow-auto p-4",children:0===r.size?(0,n.jsxs)("div",{className:"h-full flex flex-col items-center justify-center text-gray-400",children:[(0,n.jsx)(lx.Z,{style:{fontSize:"48px",marginBottom:"16px"}}),(0,n.jsx)(ll.Z,{className:"text-lg font-medium text-gray-600 mb-2",children:"Select Guardrails to Test"}),(0,n.jsx)(ll.Z,{className:"text-center text-gray-500 max-w-md",children:"Choose one or more guardrails from the left sidebar to start testing and comparing results."})]}):(0,n.jsx)("div",{className:"h-full",children:(0,n.jsx)(lN,{guardrailNames:Array.from(r),onSubmit:y,results:u.length>0?u:null,errors:x.length>0?x:null,isLoading:g,onClose:()=>s(new Set)})})})]})]})})})},lk=a(21609),lC=e=>{let{accessToken:l,userRole:a}=e,[t,i]=(0,o.useState)([]),[r,s]=(0,o.useState)(!1),[g,f]=(0,o.useState)(!1),[j,v]=(0,o.useState)(!1),[y,_]=(0,o.useState)(null),[b,N]=(0,o.useState)(!1),[w,k]=(0,o.useState)(null),[C,S]=(0,o.useState)(0),Z=!!a&&(0,e3.tY)(a),P=async()=>{if(l){f(!0);try{let e=await (0,h.getGuardrailsList)(l);console.log("guardrails: ".concat(JSON.stringify(e))),i(e.guardrails)}catch(e){console.error("Error fetching guardrails:",e)}finally{f(!1)}}};(0,o.useEffect)(()=>{P()},[l]);let O=async()=>{if(y&&l){v(!0);try{await (0,h.deleteGuardrailCall)(l,y.guardrail_id),et.Z.success('Guardrail "'.concat(y.guardrail_name,'" deleted successfully')),await P()}catch(e){console.error("Error deleting guardrail:",e),et.Z.fromBackend("Failed to delete guardrail")}finally{v(!1),N(!1),_(null)}}},I=y&&y.litellm_params?A(y.litellm_params.guardrail).displayName:void 0;return(0,n.jsx)("div",{className:"w-full mx-auto flex-auto overflow-y-auto m-8 p-2",children:(0,n.jsxs)(u.Z,{index:C,onIndexChange:S,children:[(0,n.jsxs)(m.Z,{className:"mb-4",children:[(0,n.jsx)(c.Z,{children:"Guardrails"}),(0,n.jsx)(c.Z,{disabled:!l||0===t.length,children:"Test Playground"})]}),(0,n.jsxs)(p.Z,{children:[(0,n.jsxs)(x.Z,{children:[(0,n.jsx)("div",{className:"flex justify-between items-center mb-4",children:(0,n.jsx)(d.Z,{onClick:()=>{w&&k(null),s(!0)},disabled:!l,children:"+ Add New Guardrail"})}),w?(0,n.jsx)(ld,{guardrailId:w,onClose:()=>k(null),accessToken:l,isAdmin:Z}):(0,n.jsx)(e6,{guardrailsList:t,isLoading:g,onDeleteClick:(e,l)=>{_(t.find(l=>l.guardrail_id===e)||null),N(!0)},accessToken:l,onGuardrailUpdated:P,isAdmin:Z,onGuardrailClick:e=>k(e)}),(0,n.jsx)(eU,{visible:r,onClose:()=>{s(!1)},accessToken:l,onSuccess:()=>{P()}}),(0,n.jsx)(lk.Z,{isOpen:b,title:"Delete Guardrail",message:"Are you sure you want to delete guardrail: ".concat(null==y?void 0:y.guardrail_name,"? This action cannot be undone."),resourceInformationTitle:"Guardrail Information",resourceInformation:[{label:"Name",value:null==y?void 0:y.guardrail_name},{label:"ID",value:null==y?void 0:y.guardrail_id,code:!0},{label:"Provider",value:I},{label:"Mode",value:null==y?void 0:y.litellm_params.mode},{label:"Default On",value:(null==y?void 0:y.litellm_params.default_on)?"Yes":"No"}],onCancel:()=>{N(!1),_(null)},onOk:O,confirmLoading:j})]}),(0,n.jsx)(x.Z,{children:(0,n.jsx)(lw,{guardrailsList:t,isLoading:g,accessToken:l,onClose:()=>S(0)})})]})]})})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/630-ee7666aae80dd1c2.js b/litellm/proxy/_experimental/out/_next/static/chunks/630-ee7666aae80dd1c2.js deleted file mode 100644 index ae8af79a3d..0000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/630-ee7666aae80dd1c2.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[630],{1309:function(e,l,a){a.d(l,{C:function(){return t.Z}});var t=a(41649)},2967:function(e,l,a){a.d(l,{JO:function(){return i.Z},RM:function(){return s.Z},SC:function(){return c.Z},iA:function(){return r.Z},pj:function(){return n.Z},ss:function(){return o.Z},xs:function(){return d.Z},zx:function(){return t.Z}});var t=a(78489),i=a(47323),r=a(21626),s=a(97214),n=a(28241),o=a(58834),d=a(69552),c=a(71876)},50630:function(e,l,a){a.d(l,{Z:function(){return lC}});var t,i,r,s,n=a(57437),o=a(2265),d=a(78489),c=a(12485),u=a(18135),m=a(35242),x=a(29706),p=a(77991),h=a(19250),g=a(57840),f=a(37592),j=a(15690),v=a(10032),y=a(3810),_=a(22116),b=a(64504);(t=r||(r={})).PresidioPII="Presidio PII",t.Bedrock="Bedrock Guardrail",t.Lakera="Lakera";let N={},w=e=>{let l={};return l.PresidioPII="Presidio PII",l.Bedrock="Bedrock Guardrail",l.Lakera="Lakera",Object.entries(e).forEach(e=>{let[a,t]=e;t&&"object"==typeof t&&"ui_friendly_name"in t&&(l[a.split("_").map((e,l)=>e.charAt(0).toUpperCase()+e.slice(1)).join("")]=t.ui_friendly_name)}),N=l,l},k=()=>Object.keys(N).length>0?N:r,C={PresidioPII:"presidio",Bedrock:"bedrock",Lakera:"lakera_v2",LitellmContentFilter:"litellm_content_filter",ToolPermission:"tool_permission"},S=e=>{Object.entries(e).forEach(e=>{let[l,a]=e;a&&"object"==typeof a&&"ui_friendly_name"in a&&(C[l.split("_").map((e,l)=>e.charAt(0).toUpperCase()+e.slice(1)).join("")]=l)})},Z=e=>!!e&&"Presidio PII"===k()[e],P=e=>!!e&&"LiteLLM Content Filter"===k()[e],O="../ui/assets/logos/",I={"Presidio PII":"".concat(O,"presidio.png"),"Bedrock Guardrail":"".concat(O,"bedrock.svg"),Lakera:"".concat(O,"lakeraai.jpeg"),"Azure Content Safety Prompt Shield":"".concat(O,"presidio.png"),"Azure Content Safety Text Moderation":"".concat(O,"presidio.png"),"Aporia AI":"".concat(O,"aporia.png"),"PANW Prisma AIRS":"".concat(O,"palo_alto_networks.jpeg"),"Noma Security":"".concat(O,"noma_security.png"),"Javelin Guardrails":"".concat(O,"javelin.png"),"Pillar Guardrail":"".concat(O,"pillar.jpeg"),"Google Cloud Model Armor":"".concat(O,"google.svg"),"Guardrails AI":"".concat(O,"guardrails_ai.jpeg"),"Lasso Guardrail":"".concat(O,"lasso.png"),"Pangea Guardrail":"".concat(O,"pangea.png"),"AIM Guardrail":"".concat(O,"aim_security.jpeg"),"OpenAI Moderation":"".concat(O,"openai_small.svg"),EnkryptAI:"".concat(O,"enkrypt_ai.avif"),"Prompt Security":"".concat(O,"prompt_security.png"),"LiteLLM Content Filter":"".concat(O,"litellm_logo.jpg")},A=e=>{if(!e)return{logo:"",displayName:"-"};let l=Object.keys(C).find(l=>C[l].toLowerCase()===e.toLowerCase());if(!l)return{logo:"",displayName:e};let a=k()[l];return{logo:I[a]||"",displayName:a||e}};var L=a(99981),E=a(5545),T=a(4156),z=a(97416),B=a(8881),G=a(10798),M=a(49638);let{Text:F}=g.default,{Option:K}=f.default,D=e=>e.replace(/_/g," "),R=e=>{switch(e){case"MASK":return(0,n.jsx)(z.Z,{style:{marginRight:4}});case"BLOCK":return(0,n.jsx)(B.Z,{style:{marginRight:4}});default:return null}},J=e=>{let{categories:l,selectedCategories:a,onChange:t}=e;return(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"flex items-center mb-2",children:[(0,n.jsx)(G.Z,{className:"text-gray-500 mr-1"}),(0,n.jsx)(F,{className:"text-gray-500 font-medium",children:"Filter by category"})]}),(0,n.jsx)(f.default,{mode:"multiple",placeholder:"Select categories to filter by",style:{width:"100%"},onChange:t,value:a,allowClear:!0,showSearch:!0,optionFilterProp:"children",className:"mb-4",tagRender:e=>(0,n.jsx)(y.Z,{color:"blue",closable:e.closable,onClose:e.onClose,className:"mr-2 mb-2",children:e.label}),children:l.map(e=>(0,n.jsx)(K,{value:e.category,children:e.category},e.category))})]})},V=e=>{let{onSelectAll:l,onUnselectAll:a,hasSelectedEntities:t}=e;return(0,n.jsxs)("div",{className:"bg-gray-50 p-5 rounded-lg mb-6 border border-gray-200 shadow-sm",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)(F,{strong:!0,className:"text-gray-700 text-base",children:"Quick Actions"}),(0,n.jsx)(L.Z,{title:"Apply action to all PII types at once",children:(0,n.jsx)("div",{className:"ml-2 text-gray-400 cursor-help text-xs",children:"ⓘ"})})]}),(0,n.jsx)(E.ZP,{color:"danger",variant:"outlined",onClick:a,disabled:!t,icon:(0,n.jsx)(M.Z,{}),children:"Unselect All"})]}),(0,n.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,n.jsx)(E.ZP,{color:"primary",variant:"outlined",onClick:()=>l("MASK"),className:"h-10",block:!0,icon:(0,n.jsx)(z.Z,{}),children:"Select All & Mask"}),(0,n.jsx)(E.ZP,{color:"danger",variant:"outlined",onClick:()=>l("BLOCK"),className:"h-10 hover:bg-red-100",block:!0,icon:(0,n.jsx)(B.Z,{}),children:"Select All & Block"})]})]})},U=e=>{let{entities:l,selectedEntities:a,selectedActions:t,actions:i,onEntitySelect:r,onActionSelect:s,entityToCategoryMap:o}=e;return(0,n.jsxs)("div",{className:"border rounded-lg overflow-hidden shadow-sm",children:[(0,n.jsxs)("div",{className:"bg-gray-50 px-5 py-3 border-b flex",children:[(0,n.jsx)(F,{strong:!0,className:"flex-1 text-gray-700",children:"PII Type"}),(0,n.jsx)(F,{strong:!0,className:"w-32 text-right text-gray-700",children:"Action"})]}),(0,n.jsx)("div",{className:"max-h-[400px] overflow-y-auto",children:0===l.length?(0,n.jsx)("div",{className:"py-10 text-center text-gray-500",children:"No PII types match your filter criteria"}):l.map(e=>(0,n.jsxs)("div",{className:"px-5 py-3 flex items-center justify-between hover:bg-gray-50 border-b ".concat(a.includes(e)?"bg-blue-50":""),children:[(0,n.jsxs)("div",{className:"flex items-center flex-1",children:[(0,n.jsx)(T.Z,{checked:a.includes(e),onChange:()=>r(e),className:"mr-3"}),(0,n.jsx)(F,{className:a.includes(e)?"font-medium text-gray-900":"text-gray-700",children:D(e)}),o.get(e)&&(0,n.jsx)(y.Z,{className:"ml-2 text-xs",color:"blue",children:o.get(e)})]}),(0,n.jsx)("div",{className:"w-32",children:(0,n.jsx)(f.default,{value:a.includes(e)&&t[e]||"MASK",onChange:l=>s(e,l),style:{width:120},disabled:!a.includes(e),className:"".concat(a.includes(e)?"":"opacity-50"),dropdownMatchSelectWidth:!1,children:i.map(e=>(0,n.jsx)(K,{value:e,children:(0,n.jsxs)("div",{className:"flex items-center",children:[R(e),e]})},e))})})]},e))})]})},{Title:q,Text:W}=g.default;var Y=e=>{let{entities:l,actions:a,selectedEntities:t,selectedActions:i,onEntitySelect:r,onActionSelect:s,entityCategories:d=[]}=e,[c,u]=(0,o.useState)([]),m=new Map;d.forEach(e=>{e.entities.forEach(l=>{m.set(l,e.category)})});let x=l.filter(e=>0===c.length||c.includes(m.get(e)||""));return(0,n.jsxs)("div",{className:"pii-configuration",children:[(0,n.jsxs)("div",{className:"flex justify-between items-center mb-5",children:[(0,n.jsx)("div",{className:"flex items-center",children:(0,n.jsx)(q,{level:4,className:"!m-0 font-semibold text-gray-800",children:"Configure PII Protection"})}),(0,n.jsxs)(W,{className:"text-gray-500",children:[t.length," items selected"]})]}),(0,n.jsxs)("div",{className:"mb-6",children:[(0,n.jsx)(J,{categories:d,selectedCategories:c,onChange:u}),(0,n.jsx)(V,{onSelectAll:e=>{l.forEach(l=>{t.includes(l)||r(l),s(l,e)})},onUnselectAll:()=>{t.forEach(e=>{r(e)})},hasSelectedEntities:t.length>0})]}),(0,n.jsx)(U,{entities:x,selectedEntities:t,selectedActions:i,actions:a,onEntitySelect:r,onActionSelect:s,entityToCategoryMap:m})]})},H=a(10353),$=a(31283),Q=a(24199),X=e=>{var l;let{selectedProvider:a,accessToken:t,providerParams:i=null,value:r=null}=e,[s,d]=(0,o.useState)(!1),[c,u]=(0,o.useState)(i),[m,x]=(0,o.useState)(null);if((0,o.useEffect)(()=>{if(i){u(i);return}let e=async()=>{if(t){d(!0),x(null);try{let e=await (0,h.getGuardrailProviderSpecificParams)(t);console.log("Provider params API response:",e),u(e),w(e),S(e)}catch(e){console.error("Error fetching provider params:",e),x("Failed to load provider parameters")}finally{d(!1)}}};i||e()},[t,i]),!a)return null;if(s)return(0,n.jsx)(H.Z,{tip:"Loading provider parameters..."});if(m)return(0,n.jsx)("div",{className:"text-red-500",children:m});let p=null===(l=C[a])||void 0===l?void 0:l.toLowerCase(),g=c&&c[p];if(console.log("Provider key:",p),console.log("Provider fields:",g),!g||0===Object.keys(g).length)return(0,n.jsx)("div",{children:"No configuration fields available for this provider."});console.log("Value:",r);let j=function(e){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",a=arguments.length>2?arguments[2]:void 0;return Object.entries(e).map(e=>{let[t,i]=e,s=l?"".concat(l,".").concat(t):t,o=a?a[t]:null==r?void 0:r[t];return(console.log("Field value:",o),"ui_friendly_name"===t||"optional_params"===t&&"nested"===i.type&&i.fields)?null:"nested"===i.type&&i.fields?(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"mb-2 font-medium",children:t}),(0,n.jsx)("div",{className:"ml-4 border-l-2 border-gray-200 pl-4",children:j(i.fields,s,o)})]},s):(0,n.jsx)(v.Z.Item,{name:s,label:t,tooltip:i.description,rules:i.required?[{required:!0,message:"".concat(t," is required")}]:void 0,children:"select"===i.type&&i.options?(0,n.jsx)(f.default,{placeholder:i.description,defaultValue:o||i.default_value,children:i.options.map(e=>(0,n.jsx)(f.default.Option,{value:e,children:e},e))}):"multiselect"===i.type&&i.options?(0,n.jsx)(f.default,{mode:"multiple",placeholder:i.description,defaultValue:o||i.default_value,children:i.options.map(e=>(0,n.jsx)(f.default.Option,{value:e,children:e},e))}):"bool"===i.type||"boolean"===i.type?(0,n.jsxs)(f.default,{placeholder:i.description,defaultValue:void 0!==o?String(o):i.default_value,children:[(0,n.jsx)(f.default.Option,{value:"true",children:"True"}),(0,n.jsx)(f.default.Option,{value:"false",children:"False"})]}):"number"===i.type?(0,n.jsx)(Q.Z,{step:1,width:400,placeholder:i.description,defaultValue:void 0!==o?Number(o):void 0}):t.includes("password")||t.includes("secret")||t.includes("key")?(0,n.jsx)($.o,{placeholder:i.description,type:"password",defaultValue:o||""}):(0,n.jsx)($.o,{placeholder:i.description,type:"text",defaultValue:o||""})},s)})};return(0,n.jsx)(n.Fragment,{children:j(g)})};let{Title:ee}=g.default,el=e=>{let{field:l,fieldKey:a,fullFieldKey:t,value:i}=e,[r,s]=o.useState([]),[d,c]=o.useState(l.dict_key_options||[]);o.useEffect(()=>{if(i&&"object"==typeof i){let e=Object.keys(i);s(e.map(e=>({key:e,id:"".concat(e,"_").concat(Date.now(),"_").concat(Math.random())}))),c((l.dict_key_options||[]).filter(l=>!e.includes(l)))}},[i,l.dict_key_options]);let u=e=>{e&&(s([...r,{key:e,id:"".concat(e,"_").concat(Date.now())}]),c(d.filter(l=>l!==e)))},m=(e,l)=>{s(r.filter(l=>l.id!==e)),c([...d,l].sort())};return(0,n.jsxs)("div",{className:"space-y-3",children:[r.map(e=>(0,n.jsxs)("div",{className:"flex items-center space-x-3 p-3 border rounded-lg",children:[(0,n.jsx)("div",{className:"w-24 font-medium text-sm",children:e.key}),(0,n.jsx)("div",{className:"flex-1",children:(0,n.jsx)(v.Z.Item,{name:Array.isArray(t)?[...t,e.key]:[t,e.key],style:{marginBottom:0},initialValue:i&&"object"==typeof i?i[e.key]:void 0,normalize:"number"===l.dict_value_type?e=>{if(null==e||""===e)return;let l=Number(e);return isNaN(l)?e:l}:void 0,children:"number"===l.dict_value_type?(0,n.jsx)(Q.Z,{step:1,width:200,placeholder:"Enter ".concat(e.key," value")}):"boolean"===l.dict_value_type?(0,n.jsxs)(f.default,{placeholder:"Select ".concat(e.key," value"),children:[(0,n.jsx)(f.default.Option,{value:!0,children:"True"}),(0,n.jsx)(f.default.Option,{value:!1,children:"False"})]}):(0,n.jsx)($.o,{placeholder:"Enter ".concat(e.key," value"),type:"text"})})}),(0,n.jsx)("button",{type:"button",className:"text-red-500 hover:text-red-700 text-sm",onClick:()=>m(e.id,e.key),children:"Remove"})]},e.id)),d.length>0&&(0,n.jsxs)("div",{className:"flex items-center space-x-3 mt-2",children:[(0,n.jsx)(f.default,{placeholder:"Select category to configure",style:{width:200},onSelect:e=>e&&u(e),value:void 0,children:d.map(e=>(0,n.jsx)(f.default.Option,{value:e,children:e},e))}),(0,n.jsx)("span",{className:"text-sm text-gray-500",children:"Select a category to add threshold configuration"})]})]})};var ea=e=>{let{optionalParams:l,parentFieldKey:a,values:t}=e,i=(e,l)=>{let i="".concat(a,".").concat(e),r=null==t?void 0:t[e];return(console.log("value",r),"dict"===l.type&&l.dict_key_options)?(0,n.jsxs)("div",{className:"mb-8 p-6 bg-gray-50 rounded-lg border border-gray-200",children:[(0,n.jsx)("div",{className:"mb-4 font-medium text-gray-900 text-base",children:e}),(0,n.jsx)("p",{className:"text-sm text-gray-600 mb-4",children:l.description}),(0,n.jsx)(el,{field:l,fieldKey:e,fullFieldKey:[a,e],value:r})]},i):(0,n.jsx)("div",{className:"mb-8 p-6 bg-white rounded-lg border border-gray-200 shadow-sm",children:(0,n.jsx)(v.Z.Item,{name:[a,e],label:(0,n.jsxs)("div",{className:"mb-2",children:[(0,n.jsx)("div",{className:"font-medium text-gray-900 text-base",children:e}),(0,n.jsx)("p",{className:"text-sm text-gray-600 mt-1",children:l.description})]}),rules:l.required?[{required:!0,message:"".concat(e," is required")}]:void 0,className:"mb-0",initialValue:void 0!==r?r:l.default_value,normalize:"number"===l.type?e=>{if(null==e||""===e)return;let l=Number(e);return isNaN(l)?e:l}:void 0,children:"select"===l.type&&l.options?(0,n.jsx)(f.default,{placeholder:l.description,children:l.options.map(e=>(0,n.jsx)(f.default.Option,{value:e,children:e},e))}):"multiselect"===l.type&&l.options?(0,n.jsx)(f.default,{mode:"multiple",placeholder:l.description,children:l.options.map(e=>(0,n.jsx)(f.default.Option,{value:e,children:e},e))}):"bool"===l.type||"boolean"===l.type?(0,n.jsxs)(f.default,{placeholder:l.description,children:[(0,n.jsx)(f.default.Option,{value:"true",children:"True"}),(0,n.jsx)(f.default.Option,{value:"false",children:"False"})]}):"number"===l.type?(0,n.jsx)(Q.Z,{step:1,width:400,placeholder:l.description}):e.includes("password")||e.includes("secret")||e.includes("key")?(0,n.jsx)($.o,{placeholder:l.description,type:"password"}):(0,n.jsx)($.o,{placeholder:l.description,type:"text"})})},i)};return l.fields&&0!==Object.keys(l.fields).length?(0,n.jsxs)("div",{className:"guardrail-optional-params",children:[(0,n.jsxs)("div",{className:"mb-8 pb-4 border-b border-gray-100",children:[(0,n.jsx)(ee,{level:3,className:"mb-2 font-semibold text-gray-900",children:"Optional Parameters"}),(0,n.jsx)("p",{className:"text-gray-600 text-sm",children:l.description||"Configure additional settings for this guardrail provider"})]}),(0,n.jsx)("div",{className:"space-y-8",children:Object.entries(l.fields).map(e=>{let[l,a]=e;return i(l,a)})})]}):null},et=a(9114),ei=a(5945),er=a(58760),es=a(65319),en=a(96473),eo=a(3632),ed=a(16312);let{Text:ec}=g.default,{Option:eu}=f.default;var em=e=>{let{visible:l,prebuiltPatterns:a,categories:t,selectedPatternName:i,patternAction:r,onPatternNameChange:s,onActionChange:o,onAdd:d,onCancel:c}=e;return(0,n.jsxs)(_.Z,{title:"Add prebuilt pattern",open:l,onCancel:c,footer:null,width:800,children:[(0,n.jsxs)(er.Z,{direction:"vertical",style:{width:"100%"},size:"large",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(ec,{strong:!0,children:"Pattern type"}),(0,n.jsx)(f.default,{placeholder:"Choose pattern type",value:i,onChange:s,style:{width:"100%",marginTop:8},showSearch:!0,filterOption:(e,l)=>{let t=a.find(e=>e.name===(null==l?void 0:l.value));return!!t&&(t.display_name.toLowerCase().includes(e.toLowerCase())||t.name.toLowerCase().includes(e.toLowerCase()))},children:t.map(e=>{let l=a.filter(l=>l.category===e);return 0===l.length?null:(0,n.jsx)(f.default.OptGroup,{label:e,children:l.map(e=>(0,n.jsx)(eu,{value:e.name,children:e.display_name},e.name))},e)})})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(ec,{strong:!0,children:"Action"}),(0,n.jsx)(ec,{type:"secondary",style:{display:"block",marginTop:4,marginBottom:8},children:"Choose what action the guardrail should take when this pattern is detected"}),(0,n.jsxs)(f.default,{value:r,onChange:o,style:{width:"100%"},children:[(0,n.jsx)(eu,{value:"BLOCK",children:"Block"}),(0,n.jsx)(eu,{value:"MASK",children:"Mask"})]})]})]}),(0,n.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"24px"},children:[(0,n.jsx)(ed.z,{variant:"secondary",onClick:c,children:"Cancel"}),(0,n.jsx)(ed.z,{onClick:d,children:"Add"})]})]})};let{Text:ex}=g.default,{Option:ep}=f.default;var eh=e=>{let{visible:l,patternName:a,patternRegex:t,patternAction:i,onNameChange:r,onRegexChange:s,onActionChange:o,onAdd:d,onCancel:c}=e;return(0,n.jsxs)(_.Z,{title:"Add custom regex pattern",open:l,onCancel:c,footer:null,width:800,children:[(0,n.jsxs)(er.Z,{direction:"vertical",style:{width:"100%"},size:"large",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(ex,{strong:!0,children:"Pattern name"}),(0,n.jsx)(b.o,{placeholder:"e.g., internal_id, employee_code",value:a,onValueChange:r,style:{marginTop:8}})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(ex,{strong:!0,children:"Regex pattern"}),(0,n.jsx)(b.o,{placeholder:"e.g., ID-[0-9]{6}",value:t,onValueChange:s,style:{marginTop:8}}),(0,n.jsx)(ex,{type:"secondary",style:{fontSize:12},children:"Enter a valid regular expression to match sensitive data"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(ex,{strong:!0,children:"Action"}),(0,n.jsx)(ex,{type:"secondary",style:{display:"block",marginTop:4,marginBottom:8},children:"Choose what action the guardrail should take when this pattern is detected"}),(0,n.jsxs)(f.default,{value:i,onChange:o,style:{width:"100%"},children:[(0,n.jsx)(ep,{value:"BLOCK",children:"Block"}),(0,n.jsx)(ep,{value:"MASK",children:"Mask"})]})]})]}),(0,n.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"24px"},children:[(0,n.jsx)(b.z,{variant:"secondary",onClick:c,children:"Cancel"}),(0,n.jsx)(b.z,{onClick:d,children:"Add"})]})]})},eg=a(49566),ef=a(16853);let{Text:ej}=g.default,{Option:ev}=f.default;var ey=e=>{let{visible:l,keyword:a,action:t,description:i,onKeywordChange:r,onActionChange:s,onDescriptionChange:o,onAdd:c,onCancel:u}=e;return(0,n.jsxs)(_.Z,{title:"Add blocked keyword",open:l,onCancel:u,footer:null,width:800,children:[(0,n.jsxs)(er.Z,{direction:"vertical",style:{width:"100%"},size:"large",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(ej,{strong:!0,children:"Keyword"}),(0,n.jsx)(eg.Z,{placeholder:"Enter sensitive keyword or phrase",value:a,onValueChange:r,style:{marginTop:8}})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(ej,{strong:!0,children:"Action"}),(0,n.jsx)(ej,{type:"secondary",style:{display:"block",marginTop:4,marginBottom:8},children:"Choose what action the guardrail should take when this keyword is detected"}),(0,n.jsxs)(f.default,{value:t,onChange:s,style:{width:"100%"},children:[(0,n.jsx)(ev,{value:"BLOCK",children:"Block"}),(0,n.jsx)(ev,{value:"MASK",children:"Mask"})]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(ej,{strong:!0,children:"Description (optional)"}),(0,n.jsx)(ef.Z,{placeholder:"Explain why this keyword is sensitive",value:i,onValueChange:o,rows:3,style:{marginTop:8}})]})]}),(0,n.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"24px"},children:[(0,n.jsx)(d.Z,{variant:"secondary",onClick:u,children:"Cancel"}),(0,n.jsx)(d.Z,{onClick:c,children:"Add"})]})]})},e_=a(56609),eb=a(26349);let{Text:eN}=g.default,{Option:ew}=f.default;var ek=e=>{let{patterns:l,onActionChange:a,onRemove:t}=e,i=[{title:"Type",dataIndex:"type",key:"type",width:100,render:e=>(0,n.jsx)(y.Z,{color:"prebuilt"===e?"blue":"green",children:"prebuilt"===e?"Prebuilt":"Custom"})},{title:"Pattern name",dataIndex:"name",key:"name",render:(e,l)=>l.display_name||l.name},{title:"Regex pattern",dataIndex:"pattern",key:"pattern",render:e=>e?(0,n.jsxs)(eN,{code:!0,style:{fontSize:12},children:[e.substring(0,40),"..."]}):"-"},{title:"Action",dataIndex:"action",key:"action",width:150,render:(e,l)=>(0,n.jsxs)(f.default,{value:e,onChange:e=>a(l.id,e),style:{width:120},size:"small",children:[(0,n.jsx)(ew,{value:"BLOCK",children:"Block"}),(0,n.jsx)(ew,{value:"MASK",children:"Mask"})]})},{title:"",key:"actions",width:100,render:(e,l)=>(0,n.jsx)(ed.z,{type:"button",variant:"light",color:"red",size:"xs",icon:eb.Z,onClick:()=>t(l.id),children:"Delete"})}];return 0===l.length?(0,n.jsx)("div",{style:{textAlign:"center",padding:"40px 0",color:"#999"},children:"No patterns added."}):(0,n.jsx)(e_.Z,{dataSource:l,columns:i,rowKey:"id",pagination:!1,size:"small"})};let{Text:eC}=g.default,{Option:eS}=f.default;var eZ=e=>{let{keywords:l,onActionChange:a,onRemove:t}=e,i=[{title:"Keyword",dataIndex:"keyword",key:"keyword"},{title:"Action",dataIndex:"action",key:"action",width:150,render:(e,l)=>(0,n.jsxs)(f.default,{value:e,onChange:e=>a(l.id,"action",e),style:{width:120},size:"small",children:[(0,n.jsx)(eS,{value:"BLOCK",children:"Block"}),(0,n.jsx)(eS,{value:"MASK",children:"Mask"})]})},{title:"Description",dataIndex:"description",key:"description",render:e=>e||"-"},{title:"",key:"actions",width:100,render:(e,l)=>(0,n.jsx)(ed.z,{type:"button",variant:"light",color:"red",size:"xs",icon:eb.Z,onClick:()=>t(l.id),children:"Delete"})}];return 0===l.length?(0,n.jsx)("div",{style:{textAlign:"center",padding:"40px 0",color:"#999"},children:"No keywords added."}):(0,n.jsx)(e_.Z,{dataSource:l,columns:i,rowKey:"id",pagination:!1,size:"small"})};let{Title:eP,Text:eO}=g.default;var eI=e=>{let{prebuiltPatterns:l,categories:a,selectedPatterns:t,blockedWords:i,onPatternAdd:r,onPatternRemove:s,onPatternActionChange:d,onBlockedWordAdd:c,onBlockedWordRemove:u,onBlockedWordUpdate:m,onFileUpload:x,accessToken:p,showStep:g}=e,[f,j]=(0,o.useState)(!1),[v,y]=(0,o.useState)(!1),[_,b]=(0,o.useState)(!1),[N,w]=(0,o.useState)(""),[k,C]=(0,o.useState)("BLOCK"),[S,Z]=(0,o.useState)(""),[P,O]=(0,o.useState)(""),[I,A]=(0,o.useState)("BLOCK"),[L,E]=(0,o.useState)(""),[T,z]=(0,o.useState)("BLOCK"),[B,G]=(0,o.useState)(""),[M,F]=(0,o.useState)(!1),K=async e=>{F(!0);try{let l=await e.text();if(p){let e=await (0,h.validateBlockedWordsFile)(p,l);if(e.valid)x&&x(l),et.Z.success(e.message||"File uploaded successfully");else{let l=e.error||e.errors&&e.errors.join(", ")||"Invalid file";et.Z.error("Validation failed: ".concat(l))}}}catch(e){et.Z.error("Failed to upload file: ".concat(e))}finally{F(!1)}return!1};return(0,n.jsxs)("div",{className:"space-y-6",children:[!g&&(0,n.jsx)("div",{children:(0,n.jsx)(eO,{type:"secondary",children:"Configure patterns and keywords to detect and filter sensitive information in requests and responses."})}),(!g||"patterns"===g)&&(0,n.jsxs)(ei.Z,{title:(0,n.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,n.jsx)(eP,{level:5,style:{margin:0},children:"Pattern Detection"}),(0,n.jsx)(eO,{type:"secondary",style:{fontSize:14,fontWeight:400},children:"Detect sensitive information using regex patterns (SSN, credit cards, API keys, etc.)"})]}),size:"small",children:[(0,n.jsx)("div",{style:{marginBottom:16},children:(0,n.jsxs)(er.Z,{children:[(0,n.jsx)(ed.z,{type:"button",onClick:()=>j(!0),icon:en.Z,children:"Add prebuilt pattern"}),(0,n.jsx)(ed.z,{type:"button",onClick:()=>b(!0),variant:"secondary",icon:en.Z,children:"Add custom regex"})]})}),(0,n.jsx)(ek,{patterns:t,onActionChange:d,onRemove:s})]}),(!g||"keywords"===g)&&(0,n.jsxs)(ei.Z,{title:(0,n.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,n.jsx)(eP,{level:5,style:{margin:0},children:"Blocked Keywords"}),(0,n.jsx)(eO,{type:"secondary",style:{fontSize:14,fontWeight:400},children:"Block or mask specific sensitive terms and phrases"})]}),size:"small",children:[(0,n.jsx)("div",{style:{marginBottom:16},children:(0,n.jsxs)(er.Z,{children:[(0,n.jsx)(ed.z,{type:"button",onClick:()=>y(!0),icon:en.Z,children:"Add keyword"}),(0,n.jsx)(es.default,{beforeUpload:K,accept:".yaml,.yml",showUploadList:!1,children:(0,n.jsx)(ed.z,{type:"button",variant:"secondary",icon:eo.Z,loading:M,children:"Upload YAML file"})})]})}),(0,n.jsx)(eZ,{keywords:i,onActionChange:m,onRemove:u})]}),(0,n.jsx)(em,{visible:f,prebuiltPatterns:l,categories:a,selectedPatternName:N,patternAction:k,onPatternNameChange:w,onActionChange:e=>C(e),onAdd:()=>{if(!N){et.Z.error("Please select a pattern");return}let e=l.find(e=>e.name===N);r({id:"pattern-".concat(Date.now()),type:"prebuilt",name:N,display_name:null==e?void 0:e.display_name,action:k}),j(!1),w(""),C("BLOCK")},onCancel:()=>{j(!1),w(""),C("BLOCK")}}),(0,n.jsx)(eh,{visible:_,patternName:S,patternRegex:P,patternAction:I,onNameChange:Z,onRegexChange:O,onActionChange:e=>A(e),onAdd:()=>{if(!S||!P){et.Z.error("Please provide pattern name and regex");return}r({id:"custom-".concat(Date.now()),type:"custom",name:S,pattern:P,action:I}),b(!1),Z(""),O(""),A("BLOCK")},onCancel:()=>{b(!1),Z(""),O(""),A("BLOCK")}}),(0,n.jsx)(ey,{visible:v,keyword:L,action:T,description:B,onKeywordChange:E,onActionChange:e=>z(e),onDescriptionChange:G,onAdd:()=>{if(!L){et.Z.error("Please enter a keyword");return}c({id:"word-".concat(Date.now()),keyword:L,action:T,description:B||void 0}),y(!1),E(""),G(""),z("BLOCK")},onCancel:()=>{y(!1),E(""),G(""),z("BLOCK")}})]})},eA=a(78801),eL=a(4260),eE=a(23496),eT=a(85180),ez=a(15424);let eB={rules:[],default_action:"deny",on_disallowed_action:"block",violation_message_template:""},eG=e=>({...eB,...e||{},rules:(null==e?void 0:e.rules)?[...e.rules]:[]});var eM=e=>{let{value:l,onChange:a,disabled:t=!1}=e,i=eG(l),r=e=>{let l={...i,...e};null==a||a(l)},s=(e,l)=>{r({rules:i.rules.map((a,t)=>t===e?{...a,...l}:a)})},o=e=>{r({rules:i.rules.filter((l,a)=>a!==e)})},d=(e,l)=>{let a=i.rules[e];if(!a)return;let t=Object.entries(a.allowed_param_patterns||{});l(t);let r={};t.forEach(e=>{let[l,a]=e;r[l]=a}),s(e,{allowed_param_patterns:Object.keys(r).length>0?r:void 0})},c=(e,l,a)=>{d(e,e=>{if(!e[l])return;let[,t]=e[l];e[l]=[a,t]})},u=(e,l,a)=>{d(e,e=>{if(!e[l])return;let[t]=e[l];e[l]=[t,a]})},m=(e,l)=>{let a=Object.entries(e.allowed_param_patterns||{});return 0===a.length?(0,n.jsx)(E.ZP,{disabled:t,size:"small",onClick:()=>s(l,{allowed_param_patterns:{"":""}}),children:"+ Restrict tool arguments (optional)"}):(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)(eA.x,{className:"text-sm text-gray-600",children:"Argument constraints (dot or array paths)"}),a.map((a,i)=>{let[r,s]=a;return(0,n.jsxs)(er.Z,{align:"start",children:[(0,n.jsx)(eL.default,{disabled:t,placeholder:"messages[0].content",value:r,onChange:e=>c(l,i,e.target.value)}),(0,n.jsx)(eL.default,{disabled:t,placeholder:"^email@.*$",value:s,onChange:e=>u(l,i,e.target.value)}),(0,n.jsx)(E.ZP,{disabled:t,icon:(0,n.jsx)(eb.Z,{}),danger:!0,onClick:()=>d(l,e=>{e.splice(i,1)})})]},"".concat(e.id||l,"-").concat(i))}),(0,n.jsx)(E.ZP,{disabled:t,size:"small",onClick:()=>s(l,{allowed_param_patterns:{...e.allowed_param_patterns||{},"":""}}),children:"+ Add another constraint"})]})};return(0,n.jsxs)(eA.Z,{children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(eA.x,{className:"text-lg font-semibold",children:"LiteLLM Tool Permission Guardrail"}),(0,n.jsx)(eA.x,{className:"text-sm text-gray-500",children:"Provide regex patterns (e.g., ^mcp__github_.*$) for tool names or types and optionally constrain payload fields."})]}),!t&&(0,n.jsx)(E.ZP,{icon:(0,n.jsx)(en.Z,{}),type:"primary",onClick:()=>{r({rules:[...i.rules,{id:"rule_".concat(Math.random().toString(36).slice(2,8)),decision:"allow",allowed_param_patterns:void 0}]})},className:"!bg-blue-600 !text-white hover:!bg-blue-500",children:"Add Rule"})]}),(0,n.jsx)(eE.Z,{}),0===i.rules.length?(0,n.jsx)(eT.Z,{description:"No tool rules added yet"}):(0,n.jsx)("div",{className:"space-y-4",children:i.rules.map((e,l)=>{var a,i;return(0,n.jsxs)(eA.Z,{className:"bg-gray-50",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,n.jsxs)(eA.x,{className:"font-semibold",children:["Rule ",l+1]}),(0,n.jsx)(E.ZP,{icon:(0,n.jsx)(eb.Z,{}),danger:!0,type:"text",disabled:t,onClick:()=>o(l),children:"Remove"})]}),(0,n.jsxs)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(eA.x,{className:"text-sm font-medium",children:"Rule ID"}),(0,n.jsx)(eL.default,{disabled:t,placeholder:"unique_rule_id",value:e.id,onChange:e=>s(l,{id:e.target.value})})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(eA.x,{className:"text-sm font-medium",children:"Tool Name (optional)"}),(0,n.jsx)(eL.default,{disabled:t,placeholder:"^mcp__github_.*$",value:null!==(a=e.tool_name)&&void 0!==a?a:"",onChange:e=>s(l,{tool_name:""===e.target.value.trim()?void 0:e.target.value})})]})]}),(0,n.jsx)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 mt-4",children:(0,n.jsxs)("div",{children:[(0,n.jsx)(eA.x,{className:"text-sm font-medium",children:"Tool Type (optional)"}),(0,n.jsx)(eL.default,{disabled:t,placeholder:"^function$",value:null!==(i=e.tool_type)&&void 0!==i?i:"",onChange:e=>s(l,{tool_type:""===e.target.value.trim()?void 0:e.target.value})})]})}),(0,n.jsxs)("div",{className:"mt-4 flex flex-col gap-2",children:[(0,n.jsx)(eA.x,{className:"text-sm font-medium",children:"Decision"}),(0,n.jsxs)(f.default,{disabled:t,value:e.decision,style:{width:200},onChange:e=>s(l,{decision:e}),children:[(0,n.jsx)(f.default.Option,{value:"allow",children:"Allow"}),(0,n.jsx)(f.default.Option,{value:"deny",children:"Deny"})]})]}),(0,n.jsx)("div",{className:"mt-4",children:m(e,l)})]},e.id||l)})}),(0,n.jsx)(eE.Z,{}),(0,n.jsxs)("div",{className:"grid gap-4 md:grid-cols-2",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(eA.x,{className:"text-sm font-medium",children:"Default action"}),(0,n.jsxs)(f.default,{disabled:t,value:i.default_action,onChange:e=>r({default_action:e}),children:[(0,n.jsx)(f.default.Option,{value:"allow",children:"Allow"}),(0,n.jsx)(f.default.Option,{value:"deny",children:"Deny"})]})]}),(0,n.jsxs)("div",{children:[(0,n.jsxs)(eA.x,{className:"text-sm font-medium flex items-center gap-1",children:["On disallowed action",(0,n.jsx)(L.Z,{title:"Block returns an error when a forbidden tool is invoked. Rewrite strips the tool call but lets the rest of the response continue.",children:(0,n.jsx)(ez.Z,{})})]}),(0,n.jsxs)(f.default,{disabled:t,value:i.on_disallowed_action,onChange:e=>r({on_disallowed_action:e}),children:[(0,n.jsx)(f.default.Option,{value:"block",children:"Block"}),(0,n.jsx)(f.default.Option,{value:"rewrite",children:"Rewrite"})]})]})]}),(0,n.jsxs)("div",{className:"mt-4",children:[(0,n.jsx)(eA.x,{className:"text-sm font-medium",children:"Violation message (optional)"}),(0,n.jsx)(eL.default.TextArea,{disabled:t,rows:3,placeholder:"This violates our org policy...",value:i.violation_message_template,onChange:e=>r({violation_message_template:e.target.value})})]})]})};let{Title:eF,Text:eK,Link:eD}=g.default,{Option:eR}=f.default,{Step:eJ}=j.default,eV={pre_call:"Before LLM Call - Runs before the LLM call and checks the input (Recommended)",during_call:"During LLM Call - Runs in parallel with the LLM call, with response held until check completes",post_call:"After LLM Call - Runs after the LLM call and checks only the output",logging_only:"Logging Only - Only runs on logging callbacks without affecting the LLM call",pre_mcp_call:"Before MCP Tool Call - Runs before MCP tool execution and validates tool calls",during_mcp_call:"During MCP Tool Call - Runs in parallel with MCP tool execution for monitoring"};var eU=e=>{let{visible:l,onClose:a,accessToken:t,onSuccess:i}=e,[r]=v.Z.useForm(),[s,d]=(0,o.useState)(!1),[c,u]=(0,o.useState)(null),[m,x]=(0,o.useState)(null),[p,g]=(0,o.useState)([]),[N,O]=(0,o.useState)({}),[A,L]=(0,o.useState)(0),[E,T]=(0,o.useState)(null),[z,B]=(0,o.useState)([]),[G,M]=(0,o.useState)(2),[F,K]=(0,o.useState)({}),[D,R]=(0,o.useState)([]),[J,V]=(0,o.useState)([]),[U,q]=(0,o.useState)({rules:[],default_action:"deny",on_disallowed_action:"block",violation_message_template:""}),W=(0,o.useMemo)(()=>!!c&&"tool_permission"===(C[c]||"").toLowerCase(),[c]);(0,o.useEffect)(()=>{t&&(async()=>{try{let[e,l]=await Promise.all([(0,h.getGuardrailUISettings)(t),(0,h.getGuardrailProviderSpecificParams)(t)]);x(e),T(l),w(l),S(l)}catch(e){console.error("Error fetching guardrail data:",e),et.Z.fromBackend("Failed to load guardrail configuration")}})()},[t]);let H=e=>{u(e),r.setFieldsValue({config:void 0,presidio_analyzer_api_base:void 0,presidio_anonymizer_api_base:void 0}),g([]),O({}),B([]),M(2),K({}),q({rules:[],default_action:"deny",on_disallowed_action:"block",violation_message_template:""})},$=e=>{g(l=>l.includes(e)?l.filter(l=>l!==e):[...l,e])},Q=(e,l)=>{O(a=>({...a,[e]:l}))},ee=async()=>{try{if(0===A&&(await r.validateFields(["guardrail_name","provider","mode","default_on"]),c)){let e=["guardrail_name","provider","mode","default_on"];"PresidioPII"===c&&e.push("presidio_analyzer_api_base","presidio_anonymizer_api_base"),await r.validateFields(e)}if(1===A&&Z(c)&&0===p.length){et.Z.fromBackend("Please select at least one PII entity to continue");return}L(A+1)}catch(e){console.error("Form validation failed:",e)}},el=()=>{L(A-1)},ei=()=>{r.resetFields(),u(null),g([]),O({}),B([]),M(2),K({}),R([]),V([]),q({rules:[],default_action:"deny",on_disallowed_action:"block",violation_message_template:""}),L(0)},er=()=>{ei(),a()},es=async()=>{try{d(!0),await r.validateFields();let l=r.getFieldsValue(!0),s=C[l.provider],n={guardrail_name:l.guardrail_name,litellm_params:{guardrail:s,mode:l.mode,default_on:l.default_on},guardrail_info:{}};if("PresidioPII"===l.provider&&p.length>0){let e={};p.forEach(l=>{e[l]=N[l]||"MASK"}),n.litellm_params.pii_entities_config=e,l.presidio_analyzer_api_base&&(n.litellm_params.presidio_analyzer_api_base=l.presidio_analyzer_api_base),l.presidio_anonymizer_api_base&&(n.litellm_params.presidio_anonymizer_api_base=l.presidio_anonymizer_api_base)}if(P(l.provider))D.length>0&&(n.litellm_params.patterns=D.map(e=>({pattern_type:"prebuilt"===e.type?"prebuilt":"regex",pattern_name:"prebuilt"===e.type?e.name:void 0,pattern:"custom"===e.type?e.pattern:void 0,name:e.name,action:e.action}))),J.length>0&&(n.litellm_params.blocked_words=J.map(e=>({keyword:e.keyword,action:e.action,description:e.description})));else if(l.config)try{let e=JSON.parse(l.config);n.guardrail_info=e}catch(e){et.Z.fromBackend("Invalid JSON in configuration"),d(!1);return}if("tool_permission"===s){if(0===U.rules.length){et.Z.fromBackend("Add at least one tool permission rule"),d(!1);return}n.litellm_params.rules=U.rules,n.litellm_params.default_action=U.default_action,n.litellm_params.on_disallowed_action=U.on_disallowed_action,U.violation_message_template&&(n.litellm_params.violation_message_template=U.violation_message_template)}if(console.log("values: ",JSON.stringify(l)),E&&c){var e;let a=null===(e=C[c])||void 0===e?void 0:e.toLowerCase();console.log("providerKey: ",a);let t=E[a]||{},i=new Set;console.log("providerSpecificParams: ",JSON.stringify(t)),Object.keys(t).forEach(e=>{"optional_params"!==e&&i.add(e)}),t.optional_params&&t.optional_params.fields&&Object.keys(t.optional_params.fields).forEach(e=>{i.add(e)}),console.log("allowedParams: ",i),i.forEach(e=>{let a=l[e];if(null==a||""===a){var t;a=null===(t=l.optional_params)||void 0===t?void 0:t[e]}null!=a&&""!==a&&(n.litellm_params[e]=a)})}if(!t)throw Error("No access token available");console.log("Sending guardrail data:",JSON.stringify(n)),await (0,h.createGuardrailCall)(t,n),et.Z.success("Guardrail created successfully"),ei(),i(),a()}catch(e){console.error("Failed to create guardrail:",e),et.Z.fromBackend("Failed to create guardrail: "+(e instanceof Error?e.message:String(e)))}finally{d(!1)}},en=()=>{var e;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(v.Z.Item,{name:"guardrail_name",label:"Guardrail Name",rules:[{required:!0,message:"Please enter a guardrail name"}],children:(0,n.jsx)(b.o,{placeholder:"Enter a name for this guardrail"})}),(0,n.jsx)(v.Z.Item,{name:"provider",label:"Guardrail Provider",rules:[{required:!0,message:"Please select a provider"}],children:(0,n.jsx)(f.default,{placeholder:"Select a guardrail provider",onChange:H,labelInValue:!1,optionLabelProp:"label",dropdownRender:e=>e,showSearch:!0,children:Object.entries(k()).map(e=>{let[l,a]=e;return(0,n.jsx)(eR,{value:l,label:(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[I[a]&&(0,n.jsx)("img",{src:I[a],alt:"",style:{height:"20px",width:"20px",marginRight:"8px",objectFit:"contain"},onError:e=>{e.currentTarget.style.display="none"}}),(0,n.jsx)("span",{children:a})]}),children:(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[I[a]&&(0,n.jsx)("img",{src:I[a],alt:"",style:{height:"20px",width:"20px",marginRight:"8px",objectFit:"contain"},onError:e=>{e.currentTarget.style.display="none"}}),(0,n.jsx)("span",{children:a})]})},l)})})}),(0,n.jsx)(v.Z.Item,{name:"mode",label:"Mode",tooltip:"How the guardrail should be applied",rules:[{required:!0,message:"Please select a mode"}],children:(0,n.jsx)(f.default,{optionLabelProp:"label",mode:"multiple",children:(null==m?void 0:null===(e=m.supported_modes)||void 0===e?void 0:e.map(e=>(0,n.jsx)(eR,{value:e,label:e,children:(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("strong",{children:e}),"pre_call"===e&&(0,n.jsx)(y.Z,{color:"green",style:{marginLeft:"8px"},children:"Recommended"})]}),(0,n.jsx)("div",{style:{fontSize:"12px",color:"#888"},children:eV[e]})]})},e)))||(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(eR,{value:"pre_call",label:"pre_call",children:(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("strong",{children:"pre_call"})," ",(0,n.jsx)(y.Z,{color:"green",children:"Recommended"})]}),(0,n.jsx)("div",{style:{fontSize:"12px",color:"#888"},children:eV.pre_call})]})}),(0,n.jsx)(eR,{value:"during_call",label:"during_call",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{children:(0,n.jsx)("strong",{children:"during_call"})}),(0,n.jsx)("div",{style:{fontSize:"12px",color:"#888"},children:eV.during_call})]})}),(0,n.jsx)(eR,{value:"post_call",label:"post_call",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{children:(0,n.jsx)("strong",{children:"post_call"})}),(0,n.jsx)("div",{style:{fontSize:"12px",color:"#888"},children:eV.post_call})]})}),(0,n.jsx)(eR,{value:"logging_only",label:"logging_only",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{children:(0,n.jsx)("strong",{children:"logging_only"})}),(0,n.jsx)("div",{style:{fontSize:"12px",color:"#888"},children:eV.logging_only})]})})]})})}),(0,n.jsx)(v.Z.Item,{name:"default_on",label:"Always On",tooltip:"If enabled, this guardrail will be applied to all requests by default.",children:(0,n.jsxs)(f.default,{children:[(0,n.jsx)(f.default.Option,{value:!0,children:"Yes"}),(0,n.jsx)(f.default.Option,{value:!1,children:"No"})]})}),!W&&(0,n.jsx)(X,{selectedProvider:c,accessToken:t,providerParams:E})]})},eo=()=>m&&"PresidioPII"===c?(0,n.jsx)(Y,{entities:m.supported_entities,actions:m.supported_actions,selectedEntities:p,selectedActions:N,onEntitySelect:$,onActionSelect:Q,entityCategories:m.pii_entity_categories}):null,ed=e=>{if(!m||!P(c))return null;let l=m.content_filter_settings;return l?(0,n.jsx)(eI,{prebuiltPatterns:l.prebuilt_patterns||[],categories:l.pattern_categories||[],selectedPatterns:D,blockedWords:J,onPatternAdd:e=>R([...D,e]),onPatternRemove:e=>R(D.filter(l=>l.id!==e)),onPatternActionChange:(e,l)=>{R(D.map(a=>a.id===e?{...a,action:l}:a))},onBlockedWordAdd:e=>V([...J,e]),onBlockedWordRemove:e=>V(J.filter(l=>l.id!==e)),onBlockedWordUpdate:(e,l,a)=>{V(J.map(t=>t.id===e?{...t,[l]:a}:t))},accessToken:t,showStep:e}):null},ec=()=>{var e;if(!c)return null;if(W)return(0,n.jsx)(eM,{value:U,onChange:q});if(!E)return null;console.log("guardrail_provider_map: ",C),console.log("selectedProvider: ",c);let l=null===(e=C[c])||void 0===e?void 0:e.toLowerCase(),a=E&&E[l];return a&&a.optional_params?(0,n.jsx)(ea,{optionalParams:a.optional_params,parentFieldKey:"optional_params"}):null};return(0,n.jsx)(_.Z,{title:"Add Guardrail",open:l,onCancel:er,footer:null,width:700,children:(0,n.jsxs)(v.Z,{form:r,layout:"vertical",initialValues:{mode:"pre_call",default_on:!1},children:[(0,n.jsxs)(j.default,{current:A,className:"mb-6",children:[(0,n.jsx)(eJ,{title:"Basic Info"}),(0,n.jsx)(eJ,{title:Z(c)?"PII Configuration":P(c)?"Pattern Detection":"Provider Configuration"}),P(c)&&(0,n.jsx)(eJ,{title:"Blocked Keywords"})]}),(()=>{switch(A){case 0:return en();case 1:if(Z(c))return eo();if(P(c))return ed("patterns");return ec();case 2:if(P(c))return ed("keywords");return null;default:return null}})(),(()=>{let e=A===(P(c)?3:2)-1;return(0,n.jsxs)("div",{className:"flex justify-end space-x-2 mt-4",children:[A>0&&(0,n.jsx)(b.z,{variant:"secondary",onClick:el,children:"Previous"}),!e&&(0,n.jsx)(b.z,{onClick:ee,children:"Next"}),e&&(0,n.jsx)(b.z,{onClick:es,loading:s,children:"Create Guardrail"}),(0,n.jsx)(b.z,{variant:"secondary",onClick:er,children:"Cancel"})]})})()]})})},eq=a(2967),eW=a(74998),eY=a(44633),eH=a(86462),e$=a(49084),eQ=a(1309),eX=a(71594),e0=a(24525),e1=a(63709);let{Title:e4,Text:e2}=g.default,{Option:e5}=f.default;var e8=e=>{var l;let{visible:a,onClose:t,accessToken:i,onSuccess:r,guardrailId:s,initialValues:d}=e,[c]=v.Z.useForm(),[u,m]=(0,o.useState)(!1),[x,p]=(0,o.useState)((null==d?void 0:d.provider)||null),[g,j]=(0,o.useState)(null),[y,N]=(0,o.useState)([]),[w,S]=(0,o.useState)({});(0,o.useEffect)(()=>{(async()=>{try{if(!i)return;let e=await (0,h.getGuardrailUISettings)(i);j(e)}catch(e){console.error("Error fetching guardrail settings:",e),et.Z.fromBackend("Failed to load guardrail settings")}})()},[i]),(0,o.useEffect)(()=>{(null==d?void 0:d.pii_entities_config)&&Object.keys(d.pii_entities_config).length>0&&(N(Object.keys(d.pii_entities_config)),S(d.pii_entities_config))},[d]);let Z=e=>{N(l=>l.includes(e)?l.filter(l=>l!==e):[...l,e])},P=(e,l)=>{S(a=>({...a,[e]:l}))},O=async()=>{try{m(!0);let e=await c.validateFields(),l=C[e.provider],a={guardrail_id:s,guardrail:{guardrail_name:e.guardrail_name,litellm_params:{guardrail:l,mode:e.mode,default_on:e.default_on},guardrail_info:{}}};if("PresidioPII"===e.provider&&y.length>0){let e={};y.forEach(l=>{e[l]=w[l]||"MASK"}),a.guardrail.litellm_params.pii_entities_config=e}else if(e.config)try{let l=JSON.parse(e.config);"Bedrock"===e.provider&&l?(l.guardrail_id&&(a.guardrail.litellm_params.guardrailIdentifier=l.guardrail_id),l.guardrail_version&&(a.guardrail.litellm_params.guardrailVersion=l.guardrail_version)):a.guardrail.guardrail_info=l}catch(e){et.Z.fromBackend("Invalid JSON in configuration"),m(!1);return}if(!i)throw Error("No access token available");console.log("Sending guardrail update data:",JSON.stringify(a));let n=await fetch("/guardrails/".concat(s),{method:"PUT",headers:{Authorization:"Bearer ".concat(i),"Content-Type":"application/json"},body:JSON.stringify(a)});if(!n.ok){let e=await n.text();throw Error(e||"Failed to update guardrail")}et.Z.success("Guardrail updated successfully"),r(),t()}catch(e){console.error("Failed to update guardrail:",e),et.Z.fromBackend("Failed to update guardrail: "+(e instanceof Error?e.message:String(e)))}finally{m(!1)}},A=()=>g&&x&&"PresidioPII"===x?(0,n.jsx)(Y,{entities:g.supported_entities,actions:g.supported_actions,selectedEntities:y,selectedActions:w,onEntitySelect:Z,onActionSelect:P,entityCategories:g.pii_entity_categories}):null;return(0,n.jsx)(_.Z,{title:"Edit Guardrail",open:a,onCancel:t,footer:null,width:700,children:(0,n.jsxs)(v.Z,{form:c,layout:"vertical",initialValues:d,children:[(0,n.jsx)(v.Z.Item,{name:"guardrail_name",label:"Guardrail Name",rules:[{required:!0,message:"Please enter a guardrail name"}],children:(0,n.jsx)(b.o,{placeholder:"Enter a name for this guardrail"})}),(0,n.jsx)(v.Z.Item,{name:"provider",label:"Guardrail Provider",rules:[{required:!0,message:"Please select a provider"}],children:(0,n.jsx)(f.default,{placeholder:"Select a guardrail provider",onChange:e=>{p(e),c.setFieldsValue({config:void 0}),N([]),S({})},disabled:!0,optionLabelProp:"label",children:Object.entries(k()).map(e=>{let[l,a]=e;return(0,n.jsx)(e5,{value:l,label:a,children:(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[I[a]&&(0,n.jsx)("img",{src:I[a],alt:"",style:{height:"20px",width:"20px",marginRight:"8px",objectFit:"contain"},onError:e=>{e.currentTarget.style.display="none"}}),(0,n.jsx)("span",{children:a})]})},l)})})}),(0,n.jsx)(v.Z.Item,{name:"mode",label:"Mode",tooltip:"How the guardrail should be applied",rules:[{required:!0,message:"Please select a mode"}],children:(0,n.jsx)(f.default,{children:(null==g?void 0:null===(l=g.supported_modes)||void 0===l?void 0:l.map(e=>(0,n.jsx)(e5,{value:e,children:e},e)))||(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(e5,{value:"pre_call",children:"pre_call"}),(0,n.jsx)(e5,{value:"post_call",children:"post_call"})]})})}),(0,n.jsx)(v.Z.Item,{name:"default_on",label:"Always On",tooltip:"If enabled, this guardrail will be applied to all requests by default",valuePropName:"checked",children:(0,n.jsx)(e1.Z,{})}),(()=>{if(!x)return null;if("PresidioPII"===x)return A();switch(x){case"Aporia":return(0,n.jsx)(v.Z.Item,{label:"Aporia Configuration",name:"config",tooltip:"JSON configuration for Aporia",children:(0,n.jsx)(eL.default.TextArea,{rows:4,placeholder:'{\n "api_key": "your_aporia_api_key",\n "project_name": "your_project_name"\n}'})});case"AimSecurity":return(0,n.jsx)(v.Z.Item,{label:"Aim Security Configuration",name:"config",tooltip:"JSON configuration for Aim Security",children:(0,n.jsx)(eL.default.TextArea,{rows:4,placeholder:'{\n "api_key": "your_aim_api_key"\n}'})});case"Bedrock":return(0,n.jsx)(v.Z.Item,{label:"Amazon Bedrock Configuration",name:"config",tooltip:"JSON configuration for Amazon Bedrock guardrails",children:(0,n.jsx)(eL.default.TextArea,{rows:4,placeholder:'{\n "guardrail_id": "your_guardrail_id",\n "guardrail_version": "your_guardrail_version"\n}'})});case"GuardrailsAI":return(0,n.jsx)(v.Z.Item,{label:"Guardrails.ai Configuration",name:"config",tooltip:"JSON configuration for Guardrails.ai",children:(0,n.jsx)(eL.default.TextArea,{rows:4,placeholder:'{\n "api_key": "your_guardrails_api_key",\n "guardrail_id": "your_guardrail_id"\n}'})});case"LakeraAI":return(0,n.jsx)(v.Z.Item,{label:"Lakera AI Configuration",name:"config",tooltip:"JSON configuration for Lakera AI",children:(0,n.jsx)(eL.default.TextArea,{rows:4,placeholder:'{\n "api_key": "your_lakera_api_key"\n}'})});case"PromptInjection":return(0,n.jsx)(v.Z.Item,{label:"Prompt Injection Configuration",name:"config",tooltip:"JSON configuration for prompt injection detection",children:(0,n.jsx)(eL.default.TextArea,{rows:4,placeholder:'{\n "threshold": 0.8\n}'})});default:return(0,n.jsx)(v.Z.Item,{label:"Custom Configuration",name:"config",tooltip:"JSON configuration for your custom guardrail",children:(0,n.jsx)(eL.default.TextArea,{rows:4,placeholder:'{\n "key1": "value1",\n "key2": "value2"\n}'})})}})(),(0,n.jsxs)("div",{className:"flex justify-end space-x-2 mt-4",children:[(0,n.jsx)(b.z,{variant:"secondary",onClick:t,children:"Cancel"}),(0,n.jsx)(b.z,{onClick:O,loading:u,children:"Update Guardrail"})]})]})})};(i=s||(s={})).DB="db",i.CONFIG="config";var e6=e=>{let{guardrailsList:l,isLoading:a,onDeleteClick:t,accessToken:i,onGuardrailUpdated:r,isAdmin:d=!1,onGuardrailClick:c}=e,[u,m]=(0,o.useState)([{id:"created_at",desc:!0}]),[x,p]=(0,o.useState)(!1),[h,g]=(0,o.useState)(null),f=e=>e?new Date(e).toLocaleString():"-",j=[{header:"Guardrail ID",accessorKey:"guardrail_id",cell:e=>(0,n.jsx)(L.Z,{title:String(e.getValue()||""),children:(0,n.jsx)(eq.zx,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left overflow-hidden truncate max-w-[200px]",onClick:()=>e.getValue()&&c(e.getValue()),children:e.getValue()?"".concat(String(e.getValue()).slice(0,7),"..."):""})})},{header:"Name",accessorKey:"guardrail_name",cell:e=>{let{row:l}=e,a=l.original;return(0,n.jsx)(L.Z,{title:a.guardrail_name,children:(0,n.jsx)("span",{className:"text-xs font-medium",children:a.guardrail_name||"-"})})}},{header:"Provider",accessorKey:"litellm_params.guardrail",cell:e=>{let{row:l}=e,{logo:a,displayName:t}=A(l.original.litellm_params.guardrail);return(0,n.jsxs)("div",{className:"flex items-center space-x-2",children:[a&&(0,n.jsx)("img",{src:a,alt:"".concat(t," logo"),className:"w-4 h-4",onError:e=>{e.target.style.display="none"}}),(0,n.jsx)("span",{className:"text-xs",children:t})]})}},{header:"Mode",accessorKey:"litellm_params.mode",cell:e=>{let{row:l}=e,a=l.original;return(0,n.jsx)("span",{className:"text-xs",children:a.litellm_params.mode})}},{header:"Default On",accessorKey:"litellm_params.default_on",cell:e=>{var l,a;let{row:t}=e,i=t.original;return(0,n.jsx)(eQ.C,{color:(null===(l=i.litellm_params)||void 0===l?void 0:l.default_on)?"green":"gray",className:"text-xs font-normal",size:"xs",children:(null===(a=i.litellm_params)||void 0===a?void 0:a.default_on)?"Default On":"Default Off"})}},{header:"Created At",accessorKey:"created_at",cell:e=>{let{row:l}=e,a=l.original;return(0,n.jsx)(L.Z,{title:a.created_at,children:(0,n.jsx)("span",{className:"text-xs",children:f(a.created_at)})})}},{header:"Updated At",accessorKey:"updated_at",cell:e=>{let{row:l}=e,a=l.original;return(0,n.jsx)(L.Z,{title:a.updated_at,children:(0,n.jsx)("span",{className:"text-xs",children:f(a.updated_at)})})}},{id:"actions",header:"Actions",cell:e=>{let{row:l}=e,a=l.original,i=a.guardrail_definition_location===s.CONFIG;return(0,n.jsx)("div",{className:"flex space-x-2",children:i?(0,n.jsx)(L.Z,{title:"Config guardrail cannot be deleted on the dashboard. Please delete it from the config file.",children:(0,n.jsx)(eq.JO,{"data-testid":"config-delete-icon",icon:eW.Z,size:"sm",className:"cursor-not-allowed text-gray-400",title:"Config guardrail cannot be deleted on the dashboard. Please delete it from the config file.","aria-label":"Delete guardrail (config)"})}):(0,n.jsx)(L.Z,{title:"Delete guardrail",children:(0,n.jsx)(eq.JO,{icon:eW.Z,size:"sm",onClick:()=>a.guardrail_id&&t(a.guardrail_id,a.guardrail_name||"Unnamed Guardrail"),className:"cursor-pointer hover:text-red-500"})})})}}],v=(0,eX.b7)({data:l,columns:j,state:{sorting:u},onSortingChange:m,getCoreRowModel:(0,e0.sC)(),getSortedRowModel:(0,e0.tj)(),enableSorting:!0});return(0,n.jsxs)("div",{className:"rounded-lg custom-border relative",children:[(0,n.jsx)("div",{className:"overflow-x-auto",children:(0,n.jsxs)(eq.iA,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,n.jsx)(eq.ss,{children:v.getHeaderGroups().map(e=>(0,n.jsx)(eq.SC,{children:e.headers.map(e=>(0,n.jsx)(eq.xs,{className:"py-1 h-8 ".concat("actions"===e.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""),onClick:e.column.getToggleSortingHandler(),children:(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,eX.ie)(e.column.columnDef.header,e.getContext())}),"actions"!==e.id&&(0,n.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,n.jsx)(eY.Z,{className:"h-4 w-4 text-blue-500"}),desc:(0,n.jsx)(eH.Z,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,n.jsx)(e$.Z,{className:"h-4 w-4 text-gray-400"})})]})},e.id))},e.id))}),(0,n.jsx)(eq.RM,{children:a?(0,n.jsx)(eq.SC,{children:(0,n.jsx)(eq.pj,{colSpan:j.length,className:"h-8 text-center",children:(0,n.jsx)("div",{className:"text-center text-gray-500",children:(0,n.jsx)("p",{children:"Loading..."})})})}):l.length>0?v.getRowModel().rows.map(e=>(0,n.jsx)(eq.SC,{className:"h-8",children:e.getVisibleCells().map(e=>(0,n.jsx)(eq.pj,{className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap ".concat("actions"===e.column.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""),children:(0,eX.ie)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,n.jsx)(eq.SC,{children:(0,n.jsx)(eq.pj,{colSpan:j.length,className:"h-8 text-center",children:(0,n.jsx)("div",{className:"text-center text-gray-500",children:(0,n.jsx)("p",{children:"No guardrails found"})})})})})]})}),h&&(0,n.jsx)(e8,{visible:x,onClose:()=>p(!1),accessToken:i,onSuccess:()=>{p(!1),g(null),r()},guardrailId:h.guardrail_id||"",initialValues:{guardrail_name:h.guardrail_name||"",provider:Object.keys(C).find(e=>C[e]===(null==h?void 0:h.litellm_params.guardrail))||"",mode:h.litellm_params.mode,default_on:h.litellm_params.default_on,pii_entities_config:h.litellm_params.pii_entities_config,...h.guardrail_info}})]})},e3=a(20347),e9=a(30078),e7=a(41649),le=a(12514),ll=a(84264),la=e=>{let{patterns:l,blockedWords:a,readOnly:t=!0,onPatternActionChange:i,onPatternRemove:r,onBlockedWordUpdate:s,onBlockedWordRemove:o}=e;if(0===l.length&&0===a.length)return null;let d=()=>{};return(0,n.jsxs)(n.Fragment,{children:[l.length>0&&(0,n.jsxs)(le.Z,{className:"mt-6",children:[(0,n.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,n.jsx)(ll.Z,{className:"text-lg font-semibold",children:"Pattern Detection"}),(0,n.jsxs)(e7.Z,{color:"blue",children:[l.length," patterns configured"]})]}),(0,n.jsx)(ek,{patterns:l,onActionChange:t?d:i||d,onRemove:t?d:r||d})]}),a.length>0&&(0,n.jsxs)(le.Z,{className:"mt-6",children:[(0,n.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,n.jsx)(ll.Z,{className:"text-lg font-semibold",children:"Blocked Keywords"}),(0,n.jsxs)(e7.Z,{color:"blue",children:[a.length," keywords configured"]})]}),(0,n.jsx)(eZ,{keywords:a,onActionChange:t?d:s||d,onRemove:t?d:o||d})]})]})},lt=e=>{var l;let{guardrailData:a,guardrailSettings:t,isEditing:i,accessToken:r,onDataChange:s,onUnsavedChanges:d}=e,[c,u]=(0,o.useState)([]),[m,x]=(0,o.useState)([]),[p,h]=(0,o.useState)([]),[g,f]=(0,o.useState)([]);(0,o.useEffect)(()=>{var e,l;if(null==a?void 0:null===(e=a.litellm_params)||void 0===e?void 0:e.patterns){let e=a.litellm_params.patterns.map((e,l)=>({id:"pattern-".concat(l),type:"prebuilt"===e.pattern_type?"prebuilt":"custom",name:e.pattern_name||e.name,display_name:e.display_name,pattern:e.pattern,action:e.action||"BLOCK"}));u(e),h(e)}else u([]),h([]);if(null==a?void 0:null===(l=a.litellm_params)||void 0===l?void 0:l.blocked_words){let e=a.litellm_params.blocked_words.map((e,l)=>({id:"word-".concat(l),keyword:e.keyword,action:e.action||"BLOCK",description:e.description}));x(e),f(e)}else x([]),f([])},[a]),(0,o.useEffect)(()=>{s&&s(c,m)},[c,m,s]);let j=o.useMemo(()=>{let e=JSON.stringify(c)!==JSON.stringify(p),l=JSON.stringify(m)!==JSON.stringify(g);return e||l},[c,m,p,g]);return((0,o.useEffect)(()=>{i&&d&&d(j)},[j,i,d]),(null==a?void 0:null===(l=a.litellm_params)||void 0===l?void 0:l.guardrail)!=="litellm_content_filter")?null:i?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(eE.Z,{orientation:"left",children:"Content Filter Configuration"}),j&&(0,n.jsx)("div",{className:"mb-4 px-4 py-3 bg-yellow-50 border border-yellow-200 rounded-md",children:(0,n.jsx)("p",{className:"text-sm text-yellow-800 font-medium",children:'⚠️ You have unsaved changes to patterns or keywords. Remember to click "Save Changes" at the bottom.'})}),(0,n.jsx)("div",{className:"mb-6",children:t&&t.content_filter_settings&&(0,n.jsx)(eI,{prebuiltPatterns:t.content_filter_settings.prebuilt_patterns||[],categories:t.content_filter_settings.pattern_categories||[],selectedPatterns:c,blockedWords:m,onPatternAdd:e=>u([...c,e]),onPatternRemove:e=>u(c.filter(l=>l.id!==e)),onPatternActionChange:(e,l)=>u(c.map(a=>a.id===e?{...a,action:l}:a)),onBlockedWordAdd:e=>x([...m,e]),onBlockedWordRemove:e=>x(m.filter(l=>l.id!==e)),onBlockedWordUpdate:(e,l,a)=>x(m.map(t=>t.id===e?{...t,[l]:a}:t)),onFileUpload:e=>{console.log("File uploaded:",e)},accessToken:r})})]}):(0,n.jsx)(la,{patterns:c,blockedWords:m,readOnly:!0})};let li=(e,l)=>({patterns:e.map(e=>({pattern_type:"prebuilt"===e.type?"prebuilt":"regex",pattern_name:"prebuilt"===e.type?e.name:void 0,pattern:"custom"===e.type?e.pattern:void 0,name:e.name,action:e.action})),blocked_words:l.map(e=>({keyword:e.keyword,action:e.action,description:e.description}))});var lr=a(10900),ls=a(59872),ln=a(30401),lo=a(78867),ld=e=>{var l,a,t,i,r,s,d,c,u,m,x,p,g,j,y,_;let{guardrailId:b,onClose:N,accessToken:w,isAdmin:k}=e,[S,Z]=(0,o.useState)(null),[P,O]=(0,o.useState)(null),[I,T]=(0,o.useState)(!0),[G,M]=(0,o.useState)(!1),[F]=v.Z.useForm(),[K,D]=(0,o.useState)([]),[R,J]=(0,o.useState)({}),[V,U]=(0,o.useState)(null),[q,W]=(0,o.useState)({}),[H,$]=(0,o.useState)(!1),Q={rules:[],default_action:"deny",on_disallowed_action:"block",violation_message_template:""},[ee,el]=(0,o.useState)(Q),[ei,er]=(0,o.useState)(!1),es=o.useRef({patterns:[],blockedWords:[]}),en=(0,o.useCallback)((e,l)=>{es.current={patterns:e,blockedWords:l}},[]),eo=async()=>{try{var e;if(T(!0),!w)return;let l=await (0,h.getGuardrailInfo)(w,b);if(Z(l),null===(e=l.litellm_params)||void 0===e?void 0:e.pii_entities_config){let e=l.litellm_params.pii_entities_config;if(D([]),J({}),Object.keys(e).length>0){let l=[],a={};Object.entries(e).forEach(e=>{let[t,i]=e;l.push(t),a[t]="string"==typeof i?i:"MASK"}),D(l),J(a)}}else D([]),J({})}catch(e){et.Z.fromBackend("Failed to load guardrail information"),console.error("Error fetching guardrail info:",e)}finally{T(!1)}},ed=async()=>{try{if(!w)return;let e=await (0,h.getGuardrailProviderSpecificParams)(w);O(e)}catch(e){console.error("Error fetching guardrail provider specific params:",e)}},ec=async()=>{try{if(!w)return;let e=await (0,h.getGuardrailUISettings)(w);U(e)}catch(e){console.error("Error fetching guardrail UI settings:",e)}};(0,o.useEffect)(()=>{ed()},[w]),(0,o.useEffect)(()=>{eo(),ec()},[b,w]),(0,o.useEffect)(()=>{if(S&&F){var e;F.setFieldsValue({guardrail_name:S.guardrail_name,...S.litellm_params,guardrail_info:S.guardrail_info?JSON.stringify(S.guardrail_info,null,2):"",...(null===(e=S.litellm_params)||void 0===e?void 0:e.optional_params)&&{optional_params:S.litellm_params.optional_params}})}},[S,P,F]);let eu=(0,o.useCallback)(()=>{var e,l,a,t,i;(null==S?void 0:null===(e=S.litellm_params)||void 0===e?void 0:e.guardrail)==="tool_permission"?el({rules:(null===(l=S.litellm_params)||void 0===l?void 0:l.rules)||[],default_action:((null===(a=S.litellm_params)||void 0===a?void 0:a.default_action)||"deny").toLowerCase(),on_disallowed_action:((null===(t=S.litellm_params)||void 0===t?void 0:t.on_disallowed_action)||"block").toLowerCase(),violation_message_template:(null===(i=S.litellm_params)||void 0===i?void 0:i.violation_message_template)||""}):el(Q),er(!1)},[S]);(0,o.useEffect)(()=>{eu()},[eu]);let em=async e=>{try{var l,a,t,i,r,s,n,o,d,c,u,m;if(!w)return;let x={litellm_params:{}};e.guardrail_name!==S.guardrail_name&&(x.guardrail_name=e.guardrail_name),e.default_on!==(null===(l=S.litellm_params)||void 0===l?void 0:l.default_on)&&(x.litellm_params.default_on=e.default_on);let p=S.guardrail_info,g=e.guardrail_info?JSON.parse(e.guardrail_info):void 0;JSON.stringify(p)!==JSON.stringify(g)&&(x.guardrail_info=g);let f=(null===(a=S.litellm_params)||void 0===a?void 0:a.pii_entities_config)||{},j={};if(K.forEach(e=>{j[e]=R[e]||"MASK"}),JSON.stringify(f)!==JSON.stringify(j)&&(x.litellm_params.pii_entities_config=j),(null===(t=S.litellm_params)||void 0===t?void 0:t.guardrail)==="litellm_content_filter"){let e=(null===(s=S.litellm_params)||void 0===s?void 0:s.patterns)||[],l=(null===(n=S.litellm_params)||void 0===n?void 0:n.blocked_words)||[],a=li(es.current.patterns,es.current.blockedWords);JSON.stringify(e)!==JSON.stringify(a.patterns)&&(x.litellm_params.patterns=a.patterns),JSON.stringify(l)!==JSON.stringify(a.blocked_words)&&(x.litellm_params.blocked_words=a.blocked_words)}if((null===(i=S.litellm_params)||void 0===i?void 0:i.guardrail)==="tool_permission"){let e=(null===(o=S.litellm_params)||void 0===o?void 0:o.rules)||[],l=ee.rules||[],a=JSON.stringify(e)!==JSON.stringify(l),t=((null===(d=S.litellm_params)||void 0===d?void 0:d.default_action)||"deny").toLowerCase(),i=(ee.default_action||"deny").toLowerCase(),r=t!==i,s=((null===(c=S.litellm_params)||void 0===c?void 0:c.on_disallowed_action)||"block").toLowerCase(),n=(ee.on_disallowed_action||"block").toLowerCase(),m=s!==n,p=(null===(u=S.litellm_params)||void 0===u?void 0:u.violation_message_template)||"",h=ee.violation_message_template||"",g=p!==h;(ei||a||r||m||g)&&(x.litellm_params.rules=l,x.litellm_params.default_action=i,x.litellm_params.on_disallowed_action=n,x.litellm_params.violation_message_template=h||null)}let v=Object.keys(C).find(e=>{var l;return C[e]===(null===(l=S.litellm_params)||void 0===l?void 0:l.guardrail)});console.log("values: ",JSON.stringify(e)),console.log("currentProvider: ",v);let y=(null===(r=S.litellm_params)||void 0===r?void 0:r.guardrail)==="tool_permission";if(P&&v&&!y){let l=P[null===(m=C[v])||void 0===m?void 0:m.toLowerCase()]||{},a=new Set;console.log("providerSpecificParams: ",JSON.stringify(l)),Object.keys(l).forEach(e=>{"optional_params"!==e&&a.add(e)}),l.optional_params&&l.optional_params.fields&&Object.keys(l.optional_params.fields).forEach(e=>{a.add(e)}),console.log("allowedParams: ",a),a.forEach(l=>{var a,t;let i=e[l];(null==i||""===i)&&(i=null===(t=e.optional_params)||void 0===t?void 0:t[l]);let r=null===(a=S.litellm_params)||void 0===a?void 0:a[l];JSON.stringify(i)!==JSON.stringify(r)&&(null!=i&&""!==i?x.litellm_params[l]=i:null!=r&&""!==r&&(x.litellm_params[l]=null))})}if(0===Object.keys(x.litellm_params).length&&delete x.litellm_params,0===Object.keys(x).length){et.Z.info("No changes detected"),M(!1);return}await (0,h.updateGuardrailCall)(w,b,x),et.Z.success("Guardrail updated successfully"),$(!1),eo(),M(!1)}catch(e){console.error("Error updating guardrail:",e),et.Z.fromBackend("Failed to update guardrail")}};if(I)return(0,n.jsx)("div",{className:"p-4",children:"Loading..."});if(!S)return(0,n.jsx)("div",{className:"p-4",children:"Guardrail not found"});let ex=e=>e?new Date(e).toLocaleString():"-",{logo:ep,displayName:eh}=A((null===(l=S.litellm_params)||void 0===l?void 0:l.guardrail)||""),eg=async(e,l)=>{await (0,ls.vQ)(e)&&(W(e=>({...e,[l]:!0})),setTimeout(()=>{W(e=>({...e,[l]:!1}))},2e3))},ef="config"===S.guardrail_definition_location;return(0,n.jsxs)("div",{className:"p-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(e9.zx,{icon:lr.Z,variant:"light",onClick:N,className:"mb-4",children:"Back to Guardrails"}),(0,n.jsx)(e9.Dx,{children:S.guardrail_name||"Unnamed Guardrail"}),(0,n.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,n.jsx)(e9.xv,{className:"text-gray-500 font-mono",children:S.guardrail_id}),(0,n.jsx)(E.ZP,{type:"text",size:"small",icon:q["guardrail-id"]?(0,n.jsx)(ln.Z,{size:12}):(0,n.jsx)(lo.Z,{size:12}),onClick:()=>eg(S.guardrail_id,"guardrail-id"),className:"left-2 z-10 transition-all duration-200 ".concat(q["guardrail-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]}),(0,n.jsxs)(e9.v0,{children:[(0,n.jsxs)(e9.td,{className:"mb-4",children:[(0,n.jsx)(e9.OK,{children:"Overview"},"overview"),k?(0,n.jsx)(e9.OK,{children:"Settings"},"settings"):(0,n.jsx)(n.Fragment,{})]}),(0,n.jsxs)(e9.nP,{children:[(0,n.jsxs)(e9.x4,{children:[(0,n.jsxs)(e9.rj,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,n.jsxs)(e9.Zb,{children:[(0,n.jsx)(e9.xv,{children:"Provider"}),(0,n.jsxs)("div",{className:"mt-2 flex items-center space-x-2",children:[ep&&(0,n.jsx)("img",{src:ep,alt:"".concat(eh," logo"),className:"w-6 h-6",onError:e=>{e.target.style.display="none"}}),(0,n.jsx)(e9.Dx,{children:eh})]})]}),(0,n.jsxs)(e9.Zb,{children:[(0,n.jsx)(e9.xv,{children:"Mode"}),(0,n.jsxs)("div",{className:"mt-2",children:[(0,n.jsx)(e9.Dx,{children:(null===(a=S.litellm_params)||void 0===a?void 0:a.mode)||"-"}),(0,n.jsx)(e9.Ct,{color:(null===(t=S.litellm_params)||void 0===t?void 0:t.default_on)?"green":"gray",children:(null===(i=S.litellm_params)||void 0===i?void 0:i.default_on)?"Default On":"Default Off"})]})]}),(0,n.jsxs)(e9.Zb,{children:[(0,n.jsx)(e9.xv,{children:"Created At"}),(0,n.jsxs)("div",{className:"mt-2",children:[(0,n.jsx)(e9.Dx,{children:ex(S.created_at)}),(0,n.jsxs)(e9.xv,{children:["Last Updated: ",ex(S.updated_at)]})]})]})]}),(null===(r=S.litellm_params)||void 0===r?void 0:r.pii_entities_config)&&Object.keys(S.litellm_params.pii_entities_config).length>0&&(0,n.jsx)(e9.Zb,{className:"mt-6",children:(0,n.jsxs)("div",{className:"flex justify-between items-center",children:[(0,n.jsx)(e9.xv,{className:"font-medium",children:"PII Protection"}),(0,n.jsxs)(e9.Ct,{color:"blue",children:[Object.keys(S.litellm_params.pii_entities_config).length," PII entities configured"]})]})}),(null===(s=S.litellm_params)||void 0===s?void 0:s.pii_entities_config)&&Object.keys(S.litellm_params.pii_entities_config).length>0&&(0,n.jsxs)(e9.Zb,{className:"mt-6",children:[(0,n.jsx)(e9.xv,{className:"mb-4 text-lg font-semibold",children:"PII Entity Configuration"}),(0,n.jsxs)("div",{className:"border rounded-lg overflow-hidden shadow-sm",children:[(0,n.jsxs)("div",{className:"bg-gray-50 px-5 py-3 border-b flex",children:[(0,n.jsx)(e9.xv,{className:"flex-1 font-semibold text-gray-700",children:"Entity Type"}),(0,n.jsx)(e9.xv,{className:"flex-1 font-semibold text-gray-700",children:"Configuration"})]}),(0,n.jsx)("div",{className:"max-h-[400px] overflow-y-auto",children:Object.entries(null===(d=S.litellm_params)||void 0===d?void 0:d.pii_entities_config).map(e=>{let[l,a]=e;return(0,n.jsxs)("div",{className:"px-5 py-3 flex border-b hover:bg-gray-50 transition-colors",children:[(0,n.jsx)(e9.xv,{className:"flex-1 font-medium text-gray-900",children:l}),(0,n.jsx)(e9.xv,{className:"flex-1",children:(0,n.jsxs)("span",{className:"inline-flex items-center gap-1.5 ".concat("MASK"===a?"text-blue-600":"text-red-600"),children:["MASK"===a?(0,n.jsx)(z.Z,{}):(0,n.jsx)(B.Z,{}),String(a)]})})]},l)})})]})]}),(null===(c=S.litellm_params)||void 0===c?void 0:c.guardrail)==="tool_permission"&&(0,n.jsx)(e9.Zb,{className:"mt-6",children:(0,n.jsx)(eM,{value:ee,disabled:!0})}),(0,n.jsx)(lt,{guardrailData:S,guardrailSettings:V,isEditing:!1,accessToken:w})]}),k&&(0,n.jsx)(e9.x4,{children:(0,n.jsxs)(e9.Zb,{children:[(0,n.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,n.jsx)(e9.Dx,{children:"Guardrail Settings"}),ef&&(0,n.jsx)(L.Z,{title:"Guardrail is defined in the config file and cannot be edited.",children:(0,n.jsx)(ez.Z,{})}),!G&&!ef&&(0,n.jsx)(e9.zx,{onClick:()=>M(!0),children:"Edit Settings"})]}),G?(0,n.jsxs)(v.Z,{form:F,onFinish:em,initialValues:{guardrail_name:S.guardrail_name,...S.litellm_params,guardrail_info:S.guardrail_info?JSON.stringify(S.guardrail_info,null,2):"",...(null===(u=S.litellm_params)||void 0===u?void 0:u.optional_params)&&{optional_params:S.litellm_params.optional_params}},layout:"vertical",children:[(0,n.jsx)(v.Z.Item,{label:"Guardrail Name",name:"guardrail_name",rules:[{required:!0,message:"Please input a guardrail name"}],children:(0,n.jsx)(e9.oi,{})}),(0,n.jsx)(v.Z.Item,{label:"Default On",name:"default_on",children:(0,n.jsxs)(f.default,{children:[(0,n.jsx)(f.default.Option,{value:!0,children:"Yes"}),(0,n.jsx)(f.default.Option,{value:!1,children:"No"})]})}),(null===(m=S.litellm_params)||void 0===m?void 0:m.guardrail)==="presidio"&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(eE.Z,{orientation:"left",children:"PII Protection"}),(0,n.jsx)("div",{className:"mb-6",children:V&&(0,n.jsx)(Y,{entities:V.supported_entities,actions:V.supported_actions,selectedEntities:K,selectedActions:R,onEntitySelect:e=>{D(l=>l.includes(e)?l.filter(l=>l!==e):[...l,e])},onActionSelect:(e,l)=>{J(a=>({...a,[e]:l}))},entityCategories:V.pii_entity_categories})})]}),(0,n.jsx)(lt,{guardrailData:S,guardrailSettings:V,isEditing:!0,accessToken:w,onDataChange:en,onUnsavedChanges:$}),(0,n.jsx)(eE.Z,{orientation:"left",children:"Provider Settings"}),(null===(x=S.litellm_params)||void 0===x?void 0:x.guardrail)==="tool_permission"?(0,n.jsx)(eM,{value:ee,onChange:el}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(X,{selectedProvider:Object.keys(C).find(e=>{var l;return C[e]===(null===(l=S.litellm_params)||void 0===l?void 0:l.guardrail)})||null,accessToken:w,providerParams:P,value:S.litellm_params}),P&&(()=>{var e;let l=Object.keys(C).find(e=>{var l;return C[e]===(null===(l=S.litellm_params)||void 0===l?void 0:l.guardrail)});if(!l)return null;let a=P[null===(e=C[l])||void 0===e?void 0:e.toLowerCase()];return a&&a.optional_params?(0,n.jsx)(ea,{optionalParams:a.optional_params,parentFieldKey:"optional_params",values:S.litellm_params}):null})()]}),(0,n.jsx)(eE.Z,{orientation:"left",children:"Advanced Settings"}),(0,n.jsx)(v.Z.Item,{label:"Guardrail Information",name:"guardrail_info",children:(0,n.jsx)(eL.default.TextArea,{rows:5})}),(0,n.jsxs)("div",{className:"flex justify-end gap-2 mt-6",children:[(0,n.jsx)(E.ZP,{onClick:()=>{M(!1),$(!1),eu()},children:"Cancel"}),(0,n.jsx)(e9.zx,{children:"Save Changes"})]})]}):(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(e9.xv,{className:"font-medium",children:"Guardrail ID"}),(0,n.jsx)("div",{className:"font-mono",children:S.guardrail_id})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(e9.xv,{className:"font-medium",children:"Guardrail Name"}),(0,n.jsx)("div",{children:S.guardrail_name||"Unnamed Guardrail"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(e9.xv,{className:"font-medium",children:"Provider"}),(0,n.jsx)("div",{children:eh})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(e9.xv,{className:"font-medium",children:"Mode"}),(0,n.jsx)("div",{children:(null===(p=S.litellm_params)||void 0===p?void 0:p.mode)||"-"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(e9.xv,{className:"font-medium",children:"Default On"}),(0,n.jsx)(e9.Ct,{color:(null===(g=S.litellm_params)||void 0===g?void 0:g.default_on)?"green":"gray",children:(null===(j=S.litellm_params)||void 0===j?void 0:j.default_on)?"Yes":"No"})]}),(null===(y=S.litellm_params)||void 0===y?void 0:y.pii_entities_config)&&Object.keys(S.litellm_params.pii_entities_config).length>0&&(0,n.jsxs)("div",{children:[(0,n.jsx)(e9.xv,{className:"font-medium",children:"PII Protection"}),(0,n.jsx)("div",{className:"mt-2",children:(0,n.jsxs)(e9.Ct,{color:"blue",children:[Object.keys(S.litellm_params.pii_entities_config).length," PII entities configured"]})})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(e9.xv,{className:"font-medium",children:"Created At"}),(0,n.jsx)("div",{children:ex(S.created_at)})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(e9.xv,{className:"font-medium",children:"Last Updated"}),(0,n.jsx)("div",{children:ex(S.updated_at)})]}),(null===(_=S.litellm_params)||void 0===_?void 0:_.guardrail)==="tool_permission"&&(0,n.jsx)(eM,{value:ee,disabled:!0})]})]})})]})]})]})},lc=a(96761),lu=a(35631),lm=a(29436),lx=a(41169),lp=a(23639),lh=a(77565),lg=a(70464),lf=a(83669),lj=a(5540);let{Text:lv}=g.default;var ly=function(e){let{results:l,errors:a}=e,[t,i]=(0,o.useState)(new Set),r=e=>{let l=new Set(t);l.has(e)?l.delete(e):l.add(e),i(l)},s=async e=>{try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0;{let l=document.createElement("textarea");l.value=e,l.style.position="fixed",l.style.opacity="0",document.body.appendChild(l),l.focus(),l.select();let a=document.execCommand("copy");if(document.body.removeChild(l),!a)throw Error("execCommand failed");return!0}}catch(e){return console.error("Copy failed:",e),!1}};return l||a?(0,n.jsxs)("div",{className:"space-y-3 pt-4 border-t border-gray-200",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-gray-900",children:"Results"}),l&&l.map(e=>{let l=t.has(e.guardrailName);return(0,n.jsx)(le.Z,{className:"bg-green-50 border-green-200",children:(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{className:"flex items-center space-x-2 cursor-pointer flex-1",onClick:()=>r(e.guardrailName),children:[l?(0,n.jsx)(lh.Z,{className:"text-gray-500 text-xs"}):(0,n.jsx)(lg.Z,{className:"text-gray-500 text-xs"}),(0,n.jsx)(lf.Z,{className:"text-green-600 text-lg"}),(0,n.jsx)("span",{className:"text-sm font-medium text-green-800",children:e.guardrailName})]}),(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsxs)("div",{className:"flex items-center space-x-1 text-xs text-gray-600",children:[(0,n.jsx)(lj.Z,{}),(0,n.jsxs)("span",{className:"font-medium",children:[e.latency,"ms"]})]}),!l&&(0,n.jsx)(d.Z,{size:"xs",variant:"secondary",icon:lp.Z,onClick:async()=>{await s(e.response_text)?et.Z.success("Result copied to clipboard"):et.Z.fromBackend("Failed to copy result")},children:"Copy"})]})]}),!l&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"bg-white border border-green-200 rounded p-3",children:[(0,n.jsx)("label",{className:"text-xs font-medium text-gray-600 mb-2 block",children:"Output Text"}),(0,n.jsx)("div",{className:"font-mono text-sm text-gray-900 whitespace-pre-wrap break-words",children:e.response_text})]}),(0,n.jsxs)("div",{className:"text-xs text-gray-600",children:[(0,n.jsx)("span",{className:"font-medium",children:"Characters:"})," ",e.response_text.length]})]})]})},e.guardrailName)}),a&&a.map(e=>{let l=t.has(e.guardrailName);return(0,n.jsx)(le.Z,{className:"bg-red-50 border-red-200",children:(0,n.jsxs)("div",{className:"flex items-start space-x-2",children:[(0,n.jsx)("div",{className:"cursor-pointer mt-0.5",onClick:()=>r(e.guardrailName),children:l?(0,n.jsx)(lh.Z,{className:"text-gray-500 text-xs"}):(0,n.jsx)(lg.Z,{className:"text-gray-500 text-xs"})}),(0,n.jsx)("div",{className:"text-red-600 mt-0.5",children:(0,n.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 20 20",children:(0,n.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),(0,n.jsxs)("div",{className:"flex-1",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,n.jsxs)("p",{className:"text-sm font-medium text-red-800 cursor-pointer",onClick:()=>r(e.guardrailName),children:[e.guardrailName," - Error"]}),(0,n.jsxs)("div",{className:"flex items-center space-x-1 text-xs text-gray-600",children:[(0,n.jsx)(lj.Z,{}),(0,n.jsxs)("span",{className:"font-medium",children:[e.latency,"ms"]})]})]}),!l&&(0,n.jsx)("p",{className:"text-sm text-red-700 mt-1",children:e.error.message})]})]})},e.guardrailName)})]}):null};let{TextArea:l_}=eL.default,{Text:lb}=g.default;var lN=function(e){let{guardrailNames:l,onSubmit:a,isLoading:t,results:i,errors:r,onClose:s}=e,[d,c]=(0,o.useState)(""),u=()=>{if(!d.trim()){et.Z.fromBackend("Please enter text to test");return}a(d)},m=async e=>{try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0;{let l=document.createElement("textarea");l.value=e,l.style.position="fixed",l.style.opacity="0",document.body.appendChild(l),l.focus(),l.select();let a=document.execCommand("copy");if(document.body.removeChild(l),!a)throw Error("execCommand failed");return!0}}catch(e){return console.error("Copy failed:",e),!1}},x=async()=>{await m(d)?et.Z.success("Input copied to clipboard"):et.Z.fromBackend("Failed to copy input")};return(0,n.jsxs)("div",{className:"space-y-4 h-full flex flex-col",children:[(0,n.jsx)("div",{className:"flex items-center justify-between pb-3 border-b border-gray-200",children:(0,n.jsx)("div",{className:"flex items-center space-x-3",children:(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsxs)("div",{className:"flex items-center space-x-2 mb-1",children:[(0,n.jsx)("h2",{className:"text-lg font-semibold text-gray-900",children:"Test Guardrails:"}),(0,n.jsx)("div",{className:"flex flex-wrap gap-2",children:l.map(e=>(0,n.jsx)("div",{className:"inline-flex items-center space-x-1 bg-blue-50 px-3 py-1 rounded-md border border-blue-200",children:(0,n.jsx)("span",{className:"font-mono text-blue-700 font-medium text-sm",children:e})},e))})]}),(0,n.jsxs)("p",{className:"text-sm text-gray-500",children:["Test ",l.length>1?"guardrails":"guardrail"," and compare results"]})]})})}),(0,n.jsxs)("div",{className:"flex-1 overflow-auto space-y-4",children:[(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"flex justify-between items-center mb-2",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Input Text"}),(0,n.jsx)(L.Z,{title:"Press Enter to submit. Use Shift+Enter for new line.",children:(0,n.jsx)(ez.Z,{className:"text-gray-400 cursor-help"})})]}),d&&(0,n.jsx)(ed.z,{size:"xs",variant:"secondary",icon:lp.Z,onClick:x,children:"Copy Input"})]}),(0,n.jsx)(l_,{value:d,onChange:e=>c(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||e.ctrlKey||e.metaKey||(e.preventDefault(),u())},placeholder:"Enter text to test with guardrails...",rows:8,className:"font-mono text-sm"}),(0,n.jsxs)("div",{className:"flex justify-between items-center mt-1",children:[(0,n.jsxs)(lb,{className:"text-xs text-gray-500",children:["Press ",(0,n.jsx)("kbd",{className:"px-1 py-0.5 bg-gray-100 border border-gray-300 rounded text-xs",children:"Enter"})," to submit • ",(0,n.jsx)("kbd",{className:"px-1 py-0.5 bg-gray-100 border border-gray-300 rounded text-xs",children:"Shift+Enter"})," for new line"]}),(0,n.jsxs)(lb,{className:"text-xs text-gray-500",children:["Characters: ",d.length]})]})]}),(0,n.jsx)("div",{className:"pt-2",children:(0,n.jsx)(ed.z,{onClick:u,loading:t,disabled:!d.trim(),className:"w-full",children:t?"Testing ".concat(l.length," guardrail").concat(l.length>1?"s":"","..."):"Test ".concat(l.length," guardrail").concat(l.length>1?"s":"")})})]}),(0,n.jsx)(ly,{results:i,errors:r})]})]})},lw=e=>{let{guardrailsList:l,isLoading:a,accessToken:t,onClose:i}=e,[r,s]=(0,o.useState)(new Set),[d,c]=(0,o.useState)(""),[u,m]=(0,o.useState)([]),[x,p]=(0,o.useState)([]),[g,f]=(0,o.useState)(!1),j=l.filter(e=>{var l;return null===(l=e.guardrail_name)||void 0===l?void 0:l.toLowerCase().includes(d.toLowerCase())}),v=e=>{let l=new Set(r);l.has(e)?l.delete(e):l.add(e),s(l)},y=async e=>{if(0===r.size||!t)return;f(!0),m([]),p([]);let l=[],a=[];await Promise.all(Array.from(r).map(async i=>{let r=Date.now();try{let a=await (0,h.applyGuardrail)(t,i,e,null,null),s=Date.now()-r;l.push({guardrailName:i,response_text:a.response_text,latency:s})}catch(l){let e=Date.now()-r;console.error("Error testing guardrail ".concat(i,":"),l),a.push({guardrailName:i,error:l,latency:e})}})),m(l),p(a),f(!1),l.length>0&&et.Z.success("".concat(l.length," guardrail").concat(l.length>1?"s":""," applied successfully")),a.length>0&&et.Z.fromBackend("".concat(a.length," guardrail").concat(a.length>1?"s":""," failed"))};return(0,n.jsx)("div",{className:"w-full h-[calc(100vh-200px)]",children:(0,n.jsx)(le.Z,{className:"h-full",children:(0,n.jsxs)("div",{className:"flex h-full",children:[(0,n.jsxs)("div",{className:"w-1/4 border-r border-gray-200 flex flex-col overflow-hidden",children:[(0,n.jsx)("div",{className:"p-4 border-b border-gray-200",children:(0,n.jsxs)("div",{className:"mb-3",children:[(0,n.jsx)(lc.Z,{className:"text-lg font-semibold mb-3",children:"Guardrails"}),(0,n.jsx)(eg.Z,{icon:lm.Z,placeholder:"Search guardrails...",value:d,onValueChange:c})]})}),(0,n.jsx)("div",{className:"flex-1 overflow-auto",children:a?(0,n.jsx)("div",{className:"flex items-center justify-center h-32",children:(0,n.jsx)(H.Z,{})}):0===j.length?(0,n.jsx)("div",{className:"p-4",children:(0,n.jsx)(eT.Z,{description:d?"No guardrails match your search":"No guardrails available"})}):(0,n.jsx)(lu.Z,{dataSource:j,renderItem:e=>(0,n.jsx)(lu.Z.Item,{onClick:()=>{e.guardrail_name&&v(e.guardrail_name)},className:"cursor-pointer hover:bg-gray-50 transition-colors px-4 ".concat(r.has(e.guardrail_name||"")?"bg-blue-50 border-l-4 border-l-blue-500":"border-l-4 border-l-transparent"),children:(0,n.jsx)(lu.Z.Item.Meta,{avatar:(0,n.jsx)(T.Z,{checked:r.has(e.guardrail_name||""),onClick:l=>{l.stopPropagation(),e.guardrail_name&&v(e.guardrail_name)}}),title:(0,n.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,n.jsx)(lx.Z,{className:"text-gray-400"}),(0,n.jsx)("span",{className:"font-medium text-gray-900",children:e.guardrail_name})]}),description:(0,n.jsxs)("div",{className:"text-xs space-y-1 mt-1",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"font-medium",children:"Type: "}),(0,n.jsx)("span",{className:"text-gray-600",children:e.litellm_params.guardrail})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"font-medium",children:"Mode: "}),(0,n.jsx)("span",{className:"text-gray-600",children:e.litellm_params.mode})]})]})})})})}),(0,n.jsx)("div",{className:"p-3 border-t border-gray-200 bg-gray-50",children:(0,n.jsxs)(ll.Z,{className:"text-xs text-gray-600",children:[r.size," of ",j.length," selected"]})})]}),(0,n.jsxs)("div",{className:"w-3/4 flex flex-col bg-white",children:[(0,n.jsx)("div",{className:"p-4 border-b border-gray-200 flex justify-between items-center",children:(0,n.jsx)(lc.Z,{className:"text-xl font-semibold mb-0",children:"Guardrail Testing Playground"})}),(0,n.jsx)("div",{className:"flex-1 overflow-auto p-4",children:0===r.size?(0,n.jsxs)("div",{className:"h-full flex flex-col items-center justify-center text-gray-400",children:[(0,n.jsx)(lx.Z,{style:{fontSize:"48px",marginBottom:"16px"}}),(0,n.jsx)(ll.Z,{className:"text-lg font-medium text-gray-600 mb-2",children:"Select Guardrails to Test"}),(0,n.jsx)(ll.Z,{className:"text-center text-gray-500 max-w-md",children:"Choose one or more guardrails from the left sidebar to start testing and comparing results."})]}):(0,n.jsx)("div",{className:"h-full",children:(0,n.jsx)(lN,{guardrailNames:Array.from(r),onSubmit:y,results:u.length>0?u:null,errors:x.length>0?x:null,isLoading:g,onClose:()=>s(new Set)})})})]})]})})})},lk=a(21609),lC=e=>{let{accessToken:l,userRole:a}=e,[t,i]=(0,o.useState)([]),[r,s]=(0,o.useState)(!1),[g,f]=(0,o.useState)(!1),[j,v]=(0,o.useState)(!1),[y,_]=(0,o.useState)(null),[b,N]=(0,o.useState)(!1),[w,k]=(0,o.useState)(null),[C,S]=(0,o.useState)(0),Z=!!a&&(0,e3.tY)(a),P=async()=>{if(l){f(!0);try{let e=await (0,h.getGuardrailsList)(l);console.log("guardrails: ".concat(JSON.stringify(e))),i(e.guardrails)}catch(e){console.error("Error fetching guardrails:",e)}finally{f(!1)}}};(0,o.useEffect)(()=>{P()},[l]);let O=async()=>{if(y&&l){v(!0);try{await (0,h.deleteGuardrailCall)(l,y.guardrail_id),et.Z.success('Guardrail "'.concat(y.guardrail_name,'" deleted successfully')),await P()}catch(e){console.error("Error deleting guardrail:",e),et.Z.fromBackend("Failed to delete guardrail")}finally{v(!1),N(!1),_(null)}}},I=y&&y.litellm_params?A(y.litellm_params.guardrail).displayName:void 0;return(0,n.jsx)("div",{className:"w-full mx-auto flex-auto overflow-y-auto m-8 p-2",children:(0,n.jsxs)(u.Z,{index:C,onIndexChange:S,children:[(0,n.jsxs)(m.Z,{className:"mb-4",children:[(0,n.jsx)(c.Z,{children:"Guardrails"}),(0,n.jsx)(c.Z,{disabled:!l||0===t.length,children:"Test Playground"})]}),(0,n.jsxs)(p.Z,{children:[(0,n.jsxs)(x.Z,{children:[(0,n.jsx)("div",{className:"flex justify-between items-center mb-4",children:(0,n.jsx)(d.Z,{onClick:()=>{w&&k(null),s(!0)},disabled:!l,children:"+ Add New Guardrail"})}),w?(0,n.jsx)(ld,{guardrailId:w,onClose:()=>k(null),accessToken:l,isAdmin:Z}):(0,n.jsx)(e6,{guardrailsList:t,isLoading:g,onDeleteClick:(e,l)=>{_(t.find(l=>l.guardrail_id===e)||null),N(!0)},accessToken:l,onGuardrailUpdated:P,isAdmin:Z,onGuardrailClick:e=>k(e)}),(0,n.jsx)(eU,{visible:r,onClose:()=>{s(!1)},accessToken:l,onSuccess:()=>{P()}}),(0,n.jsx)(lk.Z,{isOpen:b,title:"Delete Guardrail",message:"Are you sure you want to delete guardrail: ".concat(null==y?void 0:y.guardrail_name,"? This action cannot be undone."),resourceInformationTitle:"Guardrail Information",resourceInformation:[{label:"Name",value:null==y?void 0:y.guardrail_name},{label:"ID",value:null==y?void 0:y.guardrail_id,code:!0},{label:"Provider",value:I},{label:"Mode",value:null==y?void 0:y.litellm_params.mode},{label:"Default On",value:(null==y?void 0:y.litellm_params.default_on)?"Yes":"No"}],onCancel:()=>{N(!1),_(null)},onOk:O,confirmLoading:j})]}),(0,n.jsx)(x.Z,{children:(0,n.jsx)(lw,{guardrailsList:t,isLoading:g,accessToken:l,onClose:()=>S(0)})})]})]})})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/6609-3e081758ffbe3786.js b/litellm/proxy/_experimental/out/_next/static/chunks/6609-3e081758ffbe3786.js deleted file mode 100644 index 494360f33c..0000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/6609-3e081758ffbe3786.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6609],{29967:function(e,t,n){n.d(t,{ZP:function(){return B}});var o=n(2265),r=n(36760),a=n.n(r),l=n(92491),c=n(50506),i=n(18242),d=n(71744),s=n(64024),u=n(33759);let f=o.createContext(null),p=f.Provider,m=o.createContext(null),h=m.Provider;var v=n(20873),g=n(28791),b=n(6694),y=n(34709),x=n(66531),w=n(86586),k=n(39109),C=n(93463),E=n(12918),S=n(99320),Z=n(71140);let N=e=>{let{componentCls:t,antCls:n}=e,o="".concat(t,"-group");return{[o]:Object.assign(Object.assign({},(0,E.Wf)(e)),{display:"inline-block",fontSize:0,["&".concat(o,"-rtl")]:{direction:"rtl"},["&".concat(o,"-block")]:{display:"flex"},["".concat(n,"-badge ").concat(n,"-badge-count")]:{zIndex:1},["> ".concat(n,"-badge:not(:first-child) > ").concat(n,"-button-wrapper")]:{borderInlineStart:"none"}})}},K=e=>{let{componentCls:t,wrapperMarginInlineEnd:n,colorPrimary:o,radioSize:r,motionDurationSlow:a,motionDurationMid:l,motionEaseInOutCirc:c,colorBgContainer:i,colorBorder:d,lineWidth:s,colorBgContainerDisabled:u,colorTextDisabled:f,paddingXS:p,dotColorDisabled:m,lineType:h,radioColor:v,radioBgColor:g,calc:b}=e,y="".concat(t,"-inner"),x=b(r).sub(b(4).mul(2)),w=b(1).mul(r).equal({unit:!0});return{["".concat(t,"-wrapper")]:Object.assign(Object.assign({},(0,E.Wf)(e)),{display:"inline-flex",alignItems:"baseline",marginInlineStart:0,marginInlineEnd:n,cursor:"pointer","&:last-child":{marginInlineEnd:0},["&".concat(t,"-wrapper-rtl")]:{direction:"rtl"},"&-disabled":{cursor:"not-allowed",color:e.colorTextDisabled},"&::after":{display:"inline-block",width:0,overflow:"hidden",content:'"\\a0"'},"&-block":{flex:1,justifyContent:"center"},["".concat(t,"-checked::after")]:{position:"absolute",insetBlockStart:0,insetInlineStart:0,width:"100%",height:"100%",border:"".concat((0,C.bf)(s)," ").concat(h," ").concat(o),borderRadius:"50%",visibility:"hidden",opacity:0,content:'""'},[t]:Object.assign(Object.assign({},(0,E.Wf)(e)),{position:"relative",display:"inline-block",outline:"none",cursor:"pointer",alignSelf:"center",borderRadius:"50%"}),["".concat(t,"-wrapper:hover &,\n &:hover ").concat(y)]:{borderColor:o},["".concat(t,"-input:focus-visible + ").concat(y)]:(0,E.oN)(e),["".concat(t,":hover::after, ").concat(t,"-wrapper:hover &::after")]:{visibility:"visible"},["".concat(t,"-inner")]:{"&::after":{boxSizing:"border-box",position:"absolute",insetBlockStart:"50%",insetInlineStart:"50%",display:"block",width:w,height:w,marginBlockStart:b(1).mul(r).div(-2).equal({unit:!0}),marginInlineStart:b(1).mul(r).div(-2).equal({unit:!0}),backgroundColor:v,borderBlockStart:0,borderInlineStart:0,borderRadius:w,transform:"scale(0)",opacity:0,transition:"all ".concat(a," ").concat(c),content:'""'},boxSizing:"border-box",position:"relative",insetBlockStart:0,insetInlineStart:0,display:"block",width:w,height:w,backgroundColor:i,borderColor:d,borderStyle:"solid",borderWidth:s,borderRadius:"50%",transition:"all ".concat(l)},["".concat(t,"-input")]:{position:"absolute",inset:0,zIndex:1,cursor:"pointer",opacity:0},["".concat(t,"-checked")]:{[y]:{borderColor:o,backgroundColor:g,"&::after":{transform:"scale(".concat(e.calc(e.dotSize).div(r).equal(),")"),opacity:1,transition:"all ".concat(a," ").concat(c)}}},["".concat(t,"-disabled")]:{cursor:"not-allowed",[y]:{backgroundColor:u,borderColor:d,cursor:"not-allowed","&::after":{backgroundColor:m}},["".concat(t,"-input")]:{cursor:"not-allowed"},["".concat(t,"-disabled + span")]:{color:f,cursor:"not-allowed"},["&".concat(t,"-checked")]:{[y]:{"&::after":{transform:"scale(".concat(b(x).div(r).equal(),")")}}}},["span".concat(t," + *")]:{paddingInlineStart:p,paddingInlineEnd:p}})}},O=e=>{let{buttonColor:t,controlHeight:n,componentCls:o,lineWidth:r,lineType:a,colorBorder:l,motionDurationMid:c,buttonPaddingInline:i,fontSize:d,buttonBg:s,fontSizeLG:u,controlHeightLG:f,controlHeightSM:p,paddingXS:m,borderRadius:h,borderRadiusSM:v,borderRadiusLG:g,buttonCheckedBg:b,buttonSolidCheckedColor:y,colorTextDisabled:x,colorBgContainerDisabled:w,buttonCheckedBgDisabled:k,buttonCheckedColorDisabled:S,colorPrimary:Z,colorPrimaryHover:N,colorPrimaryActive:K,buttonSolidCheckedBg:O,buttonSolidCheckedHoverBg:I,buttonSolidCheckedActiveBg:R,calc:P}=e;return{["".concat(o,"-button-wrapper")]:{position:"relative",display:"inline-block",height:n,margin:0,paddingInline:i,paddingBlock:0,color:t,fontSize:d,lineHeight:(0,C.bf)(P(n).sub(P(r).mul(2)).equal()),background:s,border:"".concat((0,C.bf)(r)," ").concat(a," ").concat(l),borderBlockStartWidth:P(r).add(.02).equal(),borderInlineEndWidth:r,cursor:"pointer",transition:["color ".concat(c),"background ".concat(c),"box-shadow ".concat(c)].join(","),a:{color:t},["> ".concat(o,"-button")]:{position:"absolute",insetBlockStart:0,insetInlineStart:0,zIndex:-1,width:"100%",height:"100%"},"&:not(:last-child)":{marginInlineEnd:P(r).mul(-1).equal()},"&:first-child":{borderInlineStart:"".concat((0,C.bf)(r)," ").concat(a," ").concat(l),borderStartStartRadius:h,borderEndStartRadius:h},"&:last-child":{borderStartEndRadius:h,borderEndEndRadius:h},"&:first-child:last-child":{borderRadius:h},["".concat(o,"-group-large &")]:{height:f,fontSize:u,lineHeight:(0,C.bf)(P(f).sub(P(r).mul(2)).equal()),"&:first-child":{borderStartStartRadius:g,borderEndStartRadius:g},"&:last-child":{borderStartEndRadius:g,borderEndEndRadius:g}},["".concat(o,"-group-small &")]:{height:p,paddingInline:P(m).sub(r).equal(),paddingBlock:0,lineHeight:(0,C.bf)(P(p).sub(P(r).mul(2)).equal()),"&:first-child":{borderStartStartRadius:v,borderEndStartRadius:v},"&:last-child":{borderStartEndRadius:v,borderEndEndRadius:v}},"&:hover":{position:"relative",color:Z},"&:has(:focus-visible)":(0,E.oN)(e),["".concat(o,"-inner, input[type='checkbox'], input[type='radio']")]:{width:0,height:0,opacity:0,pointerEvents:"none"},["&-checked:not(".concat(o,"-button-wrapper-disabled)")]:{zIndex:1,color:Z,background:b,borderColor:Z,"&::before":{backgroundColor:Z},"&:first-child":{borderColor:Z},"&:hover":{color:N,borderColor:N,"&::before":{backgroundColor:N}},"&:active":{color:K,borderColor:K,"&::before":{backgroundColor:K}}},["".concat(o,"-group-solid &-checked:not(").concat(o,"-button-wrapper-disabled)")]:{color:y,background:O,borderColor:O,"&:hover":{color:y,background:I,borderColor:I},"&:active":{color:y,background:R,borderColor:R}},"&-disabled":{color:x,backgroundColor:w,borderColor:l,cursor:"not-allowed","&:first-child, &:hover":{color:x,backgroundColor:w,borderColor:l}},["&-disabled".concat(o,"-button-wrapper-checked")]:{color:S,backgroundColor:k,borderColor:l,boxShadow:"none"},"&-block":{flex:1,textAlign:"center"}}}};var I=(0,S.I$)("Radio",e=>{let{controlOutline:t,controlOutlineWidth:n}=e,o="0 0 0 ".concat((0,C.bf)(n)," ").concat(t),r=(0,Z.IX)(e,{radioFocusShadow:o,radioButtonFocusShadow:o});return[N(r),K(r),O(r)]},e=>{let{wireframe:t,padding:n,marginXS:o,lineWidth:r,fontSizeLG:a,colorText:l,colorBgContainer:c,colorTextDisabled:i,controlItemBgActiveDisabled:d,colorTextLightSolid:s,colorPrimary:u,colorPrimaryHover:f,colorPrimaryActive:p,colorWhite:m}=e;return{radioSize:a,dotSize:t?a-8:a-(4+r)*2,dotColorDisabled:i,buttonSolidCheckedColor:s,buttonSolidCheckedBg:u,buttonSolidCheckedHoverBg:f,buttonSolidCheckedActiveBg:p,buttonBg:c,buttonCheckedBg:c,buttonColor:l,buttonCheckedBgDisabled:d,buttonCheckedColorDisabled:i,buttonPaddingInline:n-r,wrapperMarginInlineEnd:o,radioColor:t?u:m,radioBgColor:t?c:u}},{unitless:{radioSize:!0,dotSize:!0}}),R=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,o=Object.getOwnPropertySymbols(e);rt.indexOf(o[r])&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]]);return n};let P=o.forwardRef((e,t)=>{var n,r;let l=o.useContext(f),c=o.useContext(m),{getPrefixCls:i,direction:u,radio:p}=o.useContext(d.E_),h=o.useRef(null),C=(0,g.sQ)(t,h),{isFormItemInput:E}=o.useContext(k.aM),{prefixCls:S,className:Z,rootClassName:N,children:K,style:O,title:P}=e,M=R(e,["prefixCls","className","rootClassName","children","style","title"]),T=i("radio",S),D="button"===((null==l?void 0:l.optionType)||c),L=D?"".concat(T,"-button"):T,j=(0,s.Z)(T),[B,H,z]=I(T,j),A=Object.assign({},M),W=o.useContext(w.Z);l&&(A.name=l.name,A.onChange=t=>{var n,o;null===(n=e.onChange)||void 0===n||n.call(e,t),null===(o=null==l?void 0:l.onChange)||void 0===o||o.call(l,t)},A.checked=e.value===l.value,A.disabled=null!==(n=A.disabled)&&void 0!==n?n:l.disabled),A.disabled=null!==(r=A.disabled)&&void 0!==r?r:W;let _=a()("".concat(L,"-wrapper"),{["".concat(L,"-wrapper-checked")]:A.checked,["".concat(L,"-wrapper-disabled")]:A.disabled,["".concat(L,"-wrapper-rtl")]:"rtl"===u,["".concat(L,"-wrapper-in-form-item")]:E,["".concat(L,"-wrapper-block")]:!!(null==l?void 0:l.block)},null==p?void 0:p.className,Z,N,H,z,j),[F,q]=(0,x.Z)(A.onClick);return B(o.createElement(b.Z,{component:"Radio",disabled:A.disabled},o.createElement("label",{className:_,style:Object.assign(Object.assign({},null==p?void 0:p.style),O),onMouseEnter:e.onMouseEnter,onMouseLeave:e.onMouseLeave,title:P,onClick:F},o.createElement(v.Z,Object.assign({},A,{className:a()(A.className,{[y.A]:!D}),type:"radio",prefixCls:L,ref:C,onClick:q})),void 0!==K?o.createElement("span",{className:"".concat(L,"-label")},K):null)))});var M=n(29487);let T=o.forwardRef((e,t)=>{let{getPrefixCls:n,direction:r}=o.useContext(d.E_),{name:f}=o.useContext(k.aM),m=(0,l.Z)((0,M.S)(f)),{prefixCls:h,className:v,rootClassName:g,options:b,buttonStyle:y="outline",disabled:x,children:w,size:C,style:E,id:S,optionType:Z,name:N=m,defaultValue:K,value:O,block:R=!1,onChange:T,onMouseEnter:D,onMouseLeave:L,onFocus:j,onBlur:B}=e,[H,z]=(0,c.Z)(K,{value:O}),A=o.useCallback(t=>{let n=t.target.value;"value"in e||z(n),n!==H&&(null==T||T(t))},[H,z,T]),W=n("radio",h),_="".concat(W,"-group"),F=(0,s.Z)(W),[q,V,X]=I(W,F),U=w;b&&b.length>0&&(U=b.map(e=>"string"==typeof e||"number"==typeof e?o.createElement(P,{key:e.toString(),prefixCls:W,disabled:x,value:e,checked:H===e},e):o.createElement(P,{key:"radio-group-value-options-".concat(e.value),prefixCls:W,disabled:e.disabled||x,value:e.value,checked:H===e.value,title:e.title,style:e.style,className:e.className,id:e.id,required:e.required},e.label)));let G=(0,u.Z)(C),Y=a()(_,"".concat(_,"-").concat(y),{["".concat(_,"-").concat(G)]:G,["".concat(_,"-rtl")]:"rtl"===r,["".concat(_,"-block")]:R},v,g,V,X,F),$=o.useMemo(()=>({onChange:A,value:H,disabled:x,name:N,optionType:Z,block:R}),[A,H,x,N,Z,R]);return q(o.createElement("div",Object.assign({},(0,i.Z)(e,{aria:!0,data:!0}),{className:Y,style:E,onMouseEnter:D,onMouseLeave:L,onFocus:j,onBlur:B,id:S,ref:t}),o.createElement(p,{value:$},U)))});var D=o.memo(T),L=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,o=Object.getOwnPropertySymbols(e);rt.indexOf(o[r])&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]]);return n},j=o.forwardRef((e,t)=>{let{getPrefixCls:n}=o.useContext(d.E_),{prefixCls:r}=e,a=L(e,["prefixCls"]),l=n("radio",r);return o.createElement(h,{value:"button"},o.createElement(P,Object.assign({prefixCls:l},a,{type:"radio",ref:t})))});P.Button=j,P.Group=D,P.__ANT_RADIO=!0;var B=P},56609:function(e,t,n){n.d(t,{Z:function(){return oj}});var o=n(2265),r={},a="rc-table-internal-hook",l=n(26365),c=n(58525),i=n(27380),d=n(16671),s=n(54887);function u(e){var t=o.createContext(void 0);return{Context:t,Provider:function(e){var n=e.value,r=e.children,a=o.useRef(n);a.current=n;var c=o.useState(function(){return{getValue:function(){return a.current},listeners:new Set}}),d=(0,l.Z)(c,1)[0];return(0,i.Z)(function(){(0,s.unstable_batchedUpdates)(function(){d.listeners.forEach(function(e){e(n)})})},[n]),o.createElement(t.Provider,{value:d},r)},defaultValue:e}}function f(e,t){var n=(0,c.Z)("function"==typeof t?t:function(e){if(void 0===t)return e;if(!Array.isArray(t))return e[t];var n={};return t.forEach(function(t){n[t]=e[t]}),n}),r=o.useContext(null==e?void 0:e.Context),a=r||{},s=a.listeners,u=a.getValue,f=o.useRef();f.current=n(r?u():null==e?void 0:e.defaultValue);var p=o.useState({}),m=(0,l.Z)(p,2)[1];return(0,i.Z)(function(){if(r)return s.add(e),function(){s.delete(e)};function e(e){var t=n(e);(0,d.Z)(f.current,t,!0)||m({})}},[r]),f.current}var p=n(1119),m=n(28791);function h(){var e=o.createContext(null);function t(){return o.useContext(e)}return{makeImmutable:function(n,r){var a=(0,m.Yr)(n),l=function(l,c){var i=a?{ref:c}:{},d=o.useRef(0),s=o.useRef(l);return null!==t()?o.createElement(n,(0,p.Z)({},l,i)):((!r||r(s.current,l))&&(d.current+=1),s.current=l,o.createElement(e.Provider,{value:d.current},o.createElement(n,(0,p.Z)({},l,i))))};return a?o.forwardRef(l):l},responseImmutable:function(e,n){var r=(0,m.Yr)(e),a=function(n,a){return t(),o.createElement(e,(0,p.Z)({},n,r?{ref:a}:{}))};return r?o.memo(o.forwardRef(a),n):o.memo(a,n)},useImmutableMark:t}}var v=h();v.makeImmutable,v.responseImmutable,v.useImmutableMark;var g=h(),b=g.makeImmutable,y=g.responseImmutable,x=g.useImmutableMark,w=u(),k=n(41154),C=n(31686),E=n(11993),S=n(36760),Z=n.n(S),N=n(6397),K=n(16847),O=n(32559),I=o.createContext({renderWithProps:!1});function R(e){var t=[],n={};return e.forEach(function(e){for(var o=e||{},r=o.key,a=o.dataIndex,l=r||(null==a?[]:Array.isArray(a)?a:[a]).join("-")||"RC_TABLE_KEY";n[l];)l="".concat(l,"_next");n[l]=!0,t.push(l)}),t}var P=n(74126),M=function(e){var t,n=e.ellipsis,r=e.rowType,a=e.children,l=!0===n?{showTitle:!0}:n;return l&&(l.showTitle||"header"===r)&&("string"==typeof a||"number"==typeof a?t=a.toString():o.isValidElement(a)&&"string"==typeof a.props.children&&(t=a.props.children)),t},T=o.memo(function(e){var t,n,r,a,c,i,s,u,m,h,v=e.component,g=e.children,b=e.ellipsis,y=e.scope,S=e.prefixCls,O=e.className,R=e.align,T=e.record,D=e.render,L=e.dataIndex,j=e.renderIndex,B=e.shouldCellUpdate,H=e.index,z=e.rowType,A=e.colSpan,W=e.rowSpan,_=e.fixLeft,F=e.fixRight,q=e.firstFixLeft,V=e.lastFixLeft,X=e.firstFixRight,U=e.lastFixRight,G=e.appendNode,Y=e.additionalProps,$=void 0===Y?{}:Y,J=e.isSticky,Q="".concat(S,"-cell"),ee=f(w,["supportSticky","allColumnsFixedLeft","rowHoverable"]),et=ee.supportSticky,en=ee.allColumnsFixedLeft,eo=ee.rowHoverable,er=(t=o.useContext(I),n=x(),(0,N.Z)(function(){if(null!=g)return[g];var e=null==L||""===L?[]:Array.isArray(L)?L:[L],n=(0,K.Z)(T,e),r=n,a=void 0;if(D){var l=D(n,T,j);!l||"object"!==(0,k.Z)(l)||Array.isArray(l)||o.isValidElement(l)?r=l:(r=l.children,a=l.props,t.renderWithProps=!0)}return[r,a]},[n,T,g,L,D,j],function(e,n){if(B){var o=(0,l.Z)(e,2)[1];return B((0,l.Z)(n,2)[1],o)}return!!t.renderWithProps||!(0,d.Z)(e,n,!0)})),ea=(0,l.Z)(er,2),el=ea[0],ec=ea[1],ei={},ed="number"==typeof _&&et,es="number"==typeof F&&et;ed&&(ei.position="sticky",ei.left=_),es&&(ei.position="sticky",ei.right=F);var eu=null!==(r=null!==(a=null!==(c=null==ec?void 0:ec.colSpan)&&void 0!==c?c:$.colSpan)&&void 0!==a?a:A)&&void 0!==r?r:1,ef=null!==(i=null!==(s=null!==(u=null==ec?void 0:ec.rowSpan)&&void 0!==u?u:$.rowSpan)&&void 0!==s?s:W)&&void 0!==i?i:1,ep=f(w,function(e){var t,n;return[(t=ef||1,n=e.hoverStartRow,H<=e.hoverEndRow&&H+t-1>=n),e.onHover]}),em=(0,l.Z)(ep,2),eh=em[0],ev=em[1],eg=(0,P.zX)(function(e){var t;T&&ev(H,H+ef-1),null==$||null===(t=$.onMouseEnter)||void 0===t||t.call($,e)}),eb=(0,P.zX)(function(e){var t;T&&ev(-1,-1),null==$||null===(t=$.onMouseLeave)||void 0===t||t.call($,e)});if(0===eu||0===ef)return null;var ey=null!==(m=$.title)&&void 0!==m?m:M({rowType:z,ellipsis:b,children:el}),ex=Z()(Q,O,(h={},(0,E.Z)((0,E.Z)((0,E.Z)((0,E.Z)((0,E.Z)((0,E.Z)((0,E.Z)((0,E.Z)((0,E.Z)((0,E.Z)(h,"".concat(Q,"-fix-left"),ed&&et),"".concat(Q,"-fix-left-first"),q&&et),"".concat(Q,"-fix-left-last"),V&&et),"".concat(Q,"-fix-left-all"),V&&en&&et),"".concat(Q,"-fix-right"),es&&et),"".concat(Q,"-fix-right-first"),X&&et),"".concat(Q,"-fix-right-last"),U&&et),"".concat(Q,"-ellipsis"),b),"".concat(Q,"-with-append"),G),"".concat(Q,"-fix-sticky"),(ed||es)&&J&&et),(0,E.Z)(h,"".concat(Q,"-row-hover"),!ec&&eh)),$.className,null==ec?void 0:ec.className),ew={};R&&(ew.textAlign=R);var ek=(0,C.Z)((0,C.Z)((0,C.Z)((0,C.Z)({},null==ec?void 0:ec.style),ei),ew),$.style),eC=el;return"object"!==(0,k.Z)(eC)||Array.isArray(eC)||o.isValidElement(eC)||(eC=null),b&&(V||X)&&(eC=o.createElement("span",{className:"".concat(Q,"-content")},eC)),o.createElement(v,(0,p.Z)({},ec,$,{className:ex,style:ek,title:ey,scope:y,onMouseEnter:eo?eg:void 0,onMouseLeave:eo?eb:void 0,colSpan:1!==eu?eu:null,rowSpan:1!==ef?ef:null}),G,eC)});function D(e,t,n,o,r){var a,l,c=n[e]||{},i=n[t]||{};"left"===c.fixed?a=o.left["rtl"===r?t:e]:"right"===i.fixed&&(l=o.right["rtl"===r?e:t]);var d=!1,s=!1,u=!1,f=!1,p=n[t+1],m=n[e-1],h=p&&!p.fixed||m&&!m.fixed||n.every(function(e){return"left"===e.fixed});return"rtl"===r?void 0!==a?f=!(m&&"left"===m.fixed)&&h:void 0!==l&&(u=!(p&&"right"===p.fixed)&&h):void 0!==a?d=!(p&&"left"===p.fixed)&&h:void 0!==l&&(s=!(m&&"right"===m.fixed)&&h),{fixLeft:a,fixRight:l,lastFixLeft:d,firstFixRight:s,lastFixRight:u,firstFixLeft:f,isSticky:o.isSticky}}var L=o.createContext({}),j=n(6989),B=["children"];function H(e){return e.children}H.Row=function(e){var t=e.children,n=(0,j.Z)(e,B);return o.createElement("tr",n,t)},H.Cell=function(e){var t=e.className,n=e.index,r=e.children,a=e.colSpan,l=void 0===a?1:a,c=e.rowSpan,i=e.align,d=f(w,["prefixCls","direction"]),s=d.prefixCls,u=d.direction,m=o.useContext(L),h=m.scrollColumnIndex,v=m.stickyOffsets,g=m.flattenColumns,b=n+l-1+1===h?l+1:l,y=D(n,n+b-1,g,v,u);return o.createElement(T,(0,p.Z)({className:t,index:n,component:"td",prefixCls:s,record:null,dataIndex:null,align:i,colSpan:b,rowSpan:c,render:function(){return r}},y))};var z=y(function(e){var t=e.children,n=e.stickyOffsets,r=e.flattenColumns,a=f(w,"prefixCls"),l=r.length-1,c=r[l],i=o.useMemo(function(){return{stickyOffsets:n,flattenColumns:r,scrollColumnIndex:null!=c&&c.scrollbar?l:null}},[c,r,l,n]);return o.createElement(L.Provider,{value:i},o.createElement("tfoot",{className:"".concat(a,"-summary")},t))}),A=n(31474),W=n(10281),_=n(3208),F=n(18242);function q(e,t,n,r){return o.useMemo(function(){if(null!=n&&n.size){for(var o=[],a=0;a<(null==e?void 0:e.length);a+=1)!function e(t,n,o,r,a,l,c){var i=l(n,c);t.push({record:n,indent:o,index:c,rowKey:i});var d=null==a?void 0:a.has(i);if(n&&Array.isArray(n[r])&&d)for(var s=0;s1?n-1:0),r=1;r5&&void 0!==arguments[5]?arguments[5]:[],d=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,s=e.record,u=e.prefixCls,f=e.columnsKey,p=e.fixedInfoList,m=e.expandIconColumnIndex,h=e.nestExpandable,v=e.indentSize,g=e.expandIcon,b=e.expanded,y=e.hasNestChildren,x=e.onTriggerExpand,w=e.expandable,k=e.expandedKeys,C=f[n],E=p[n];n===(m||0)&&h&&(c=o.createElement(o.Fragment,null,o.createElement("span",{style:{paddingLeft:"".concat(v*r,"px")},className:"".concat(u,"-row-indent indent-level-").concat(r)}),g({prefixCls:u,expanded:b,expandable:y,record:s,onExpand:x})));var S=(null===(l=t.onCell)||void 0===l?void 0:l.call(t,s,a))||{};if(d){var Z=S.rowSpan,N=void 0===Z?1:Z;if(w&&N&&n=1)),style:(0,C.Z)((0,C.Z)({},r),null==k?void 0:k.style)}),y.map(function(e,t){var n=e.render,r=e.dataIndex,i=e.className,s=Y(g,e,t,u,l,d,null==v?void 0:v.offset),f=s.key,y=s.fixedInfo,x=s.appendCellNode,w=s.additionalCellProps;return o.createElement(T,(0,p.Z)({className:i,ellipsis:e.ellipsis,align:e.align,scope:e.rowScope,component:e.rowScope?h:m,prefixCls:b,key:f,record:a,index:l,renderIndex:c,dataIndex:r,render:n,shouldCellUpdate:e.shouldCellUpdate},y,{appendNode:x,additionalProps:w}))}));if(N&&(K.current||S)){var R=w(a,l,u+1,S);t=o.createElement(X,{expanded:S,className:Z()("".concat(b,"-expanded-row"),"".concat(b,"-expanded-row-level-").concat(u+1),O),prefixCls:b,component:f,cellComponent:m,colSpan:v?v.colSpan:y.length,stickyOffset:null==v?void 0:v.sticky,isEmpty:!1},R)}return o.createElement(o.Fragment,null,I,t)});function J(e){var t=e.columnKey,n=e.onColumnResize,r=e.prefixCls,a=e.title,l=o.useRef();return(0,i.Z)(function(){l.current&&n(t,l.current.offsetWidth)},[]),o.createElement(A.Z,{data:t},o.createElement("th",{ref:l,className:"".concat(r,"-measure-cell")},o.createElement("div",{className:"".concat(r,"-measure-cell-content")},a||"\xa0")))}var Q=n(2857);function ee(e){var t=e.prefixCls,n=e.columnsKey,r=e.onColumnResize,a=e.columns,l=o.useRef(null),c=f(w,["measureRowRender"]).measureRowRender,i=o.createElement("tr",{"aria-hidden":"true",className:"".concat(t,"-measure-row"),ref:l,tabIndex:-1},o.createElement(A.Z.Collection,{onBatchResize:function(e){(0,Q.Z)(l.current)&&e.forEach(function(e){r(e.data,e.size.offsetWidth)})}},n.map(function(e){var n=a.find(function(t){return t.key===e}),l=null==n?void 0:n.title,c=o.isValidElement(l)?o.cloneElement(l,{ref:null}):l;return o.createElement(J,{prefixCls:t,key:e,columnKey:e,onColumnResize:r,title:c})})));return c?c(i):i}var et=y(function(e){var t,n=e.data,r=e.measureColumnWidth,a=f(w,["prefixCls","getComponent","onColumnResize","flattenColumns","getRowKey","expandedKeys","childrenColumnName","emptyNode","expandedRowOffset","fixedInfoList","colWidths"]),l=a.prefixCls,c=a.getComponent,i=a.onColumnResize,d=a.flattenColumns,s=a.getRowKey,u=a.expandedKeys,p=a.childrenColumnName,m=a.emptyNode,h=a.expandedRowOffset,v=void 0===h?0:h,g=a.colWidths,b=q(n,p,u,s),y=o.useMemo(function(){return b.map(function(e){return e.rowKey})},[b]),x=o.useRef({renderWithProps:!1}),k=o.useMemo(function(){for(var e=d.length-v,t=0,n=0;n=0;d-=1){var s=t[d],u=n&&n[d],m=void 0,h=void 0;if(u&&(m=u[eo],"auto"===a&&(h=u.minWidth)),s||h||m||i){var v=m||{},g=(v.columnType,(0,j.Z)(v,er));l.unshift(o.createElement("col",(0,p.Z)({key:d,style:{width:s,minWidth:h}},g))),i=!0}}return l.length>0?o.createElement("colgroup",null,l):null},el=n(83145),ec=["className","noData","columns","flattenColumns","colWidths","colGroup","columCount","stickyOffsets","direction","fixHeader","stickyTopOffset","stickyBottomOffset","stickyClassName","scrollX","tableLayout","onScroll","children"],ei=o.forwardRef(function(e,t){var n=e.className,r=e.noData,a=e.columns,l=e.flattenColumns,c=e.colWidths,i=e.colGroup,d=e.columCount,s=e.stickyOffsets,u=e.direction,p=e.fixHeader,h=e.stickyTopOffset,v=e.stickyBottomOffset,g=e.stickyClassName,b=e.scrollX,y=e.tableLayout,x=e.onScroll,k=e.children,S=(0,j.Z)(e,ec),N=f(w,["prefixCls","scrollbarSize","isSticky","getComponent"]),K=N.prefixCls,O=N.scrollbarSize,I=N.isSticky,R=(0,N.getComponent)(["header","table"],"table"),P=I&&!p?0:O,M=o.useRef(null),T=o.useCallback(function(e){(0,m.mH)(t,e),(0,m.mH)(M,e)},[]);o.useEffect(function(){function e(e){var t=e.currentTarget,n=e.deltaX;n&&(x({currentTarget:t,scrollLeft:t.scrollLeft+n}),e.preventDefault())}var t=M.current;return null==t||t.addEventListener("wheel",e,{passive:!1}),function(){null==t||t.removeEventListener("wheel",e)}},[]);var D=l[l.length-1],L={fixed:D?D.fixed:null,scrollbar:!0,onHeaderCell:function(){return{className:"".concat(K,"-cell-scrollbar")}}},B=(0,o.useMemo)(function(){return P?[].concat((0,el.Z)(a),[L]):a},[P,a]),H=(0,o.useMemo)(function(){return P?[].concat((0,el.Z)(l),[L]):l},[P,l]),z=(0,o.useMemo)(function(){var e=s.right,t=s.left;return(0,C.Z)((0,C.Z)({},s),{},{left:"rtl"===u?[].concat((0,el.Z)(t.map(function(e){return e+P})),[0]):t,right:"rtl"===u?e:[].concat((0,el.Z)(e.map(function(e){return e+P})),[0]),isSticky:I})},[P,s,I]),A=(0,o.useMemo)(function(){for(var e=[],t=0;t1?"colgroup":"col":null,ellipsis:l.ellipsis,align:l.align,component:c,prefixCls:u,key:h[t]},i,{additionalProps:n,rowType:"header"}))}))},eu=y(function(e){var t=e.stickyOffsets,n=e.columns,r=e.flattenColumns,a=e.onHeaderRow,l=f(w,["prefixCls","getComponent"]),c=l.prefixCls,i=l.getComponent,d=o.useMemo(function(){return function(e){var t=[];!function e(n,o){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;t[r]=t[r]||[];var a=o;return n.filter(Boolean).map(function(n){var o={key:n.key,className:n.className||"",children:n.title,column:n,colStart:a},l=1,c=n.children;return c&&c.length>0&&(l=e(c,a,r+1).reduce(function(e,t){return e+t},0),o.hasSubColumns=!0),"colSpan"in n&&(l=n.colSpan),"rowSpan"in n&&(o.rowSpan=n.rowSpan),o.colSpan=l,o.colEnd=o.colStart+l-1,t[r].push(o),a+=l,l})}(e,0);for(var n=t.length,o=function(e){t[e].forEach(function(t){("rowSpan"in t)||t.hasSubColumns||(t.rowSpan=n-e)})},r=0;r1&&void 0!==arguments[1]?arguments[1]:"";return"number"==typeof t?t:t.endsWith("%")?e*parseFloat(t)/100:null}var em=["children"],eh=["fixed"];function ev(e){return(0,ef.Z)(e).filter(function(e){return o.isValidElement(e)}).map(function(e){var t=e.key,n=e.props,o=n.children,r=(0,j.Z)(n,em),a=(0,C.Z)({key:t},r);return o&&(a.children=ev(o)),a})}function eg(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"key";return e.filter(function(e){return e&&"object"===(0,k.Z)(e)}).reduce(function(e,n,o){var r=n.fixed,a=!0===r?"left":r,l="".concat(t,"-").concat(o),c=n.children;return c&&c.length>0?[].concat((0,el.Z)(e),(0,el.Z)(eg(c,l).map(function(e){var t;return(0,C.Z)((0,C.Z)({},e),{},{fixed:null!==(t=e.fixed)&&void 0!==t?t:a})}))):[].concat((0,el.Z)(e),[(0,C.Z)((0,C.Z)({key:l},n),{},{fixed:a})])},[])}var eb=function(e,t){var n=e.prefixCls,a=e.columns,c=e.children,i=e.expandable,d=e.expandedKeys,s=e.columnTitle,u=e.getRowKey,f=e.onTriggerExpand,p=e.expandIcon,m=e.rowExpandable,h=e.expandIconColumnIndex,v=e.expandedRowOffset,g=void 0===v?0:v,b=e.direction,y=e.expandRowByClick,x=e.columnWidth,w=e.fixed,S=e.scrollWidth,Z=e.clientWidth,N=o.useMemo(function(){return function e(t){return t.filter(function(e){return e&&"object"===(0,k.Z)(e)&&!e.hidden}).map(function(t){var n=t.children;return n&&n.length>0?(0,C.Z)((0,C.Z)({},t),{},{children:e(n)}):t})}((a||ev(c)||[]).slice())},[a,c]),K=o.useMemo(function(){if(i){var e,t=N.slice();if(!t.includes(r)){var a=h||0,l=0===a&&"right"===w?N.length:a;l>=0&&t.splice(l,0,r)}var c=t.indexOf(r);t=t.filter(function(e,t){return e!==r||t===c});var v=N[c];e=w||(v?v.fixed:null);var b=(0,E.Z)((0,E.Z)((0,E.Z)((0,E.Z)((0,E.Z)((0,E.Z)({},eo,{className:"".concat(n,"-expand-icon-col"),columnType:"EXPAND_COLUMN"}),"title",s),"fixed",e),"className","".concat(n,"-row-expand-icon-cell")),"width",x),"render",function(e,t,r){var a=u(t,r),l=p({prefixCls:n,expanded:d.has(a),expandable:!m||m(t),record:t,onExpand:f});return y?o.createElement("span",{onClick:function(e){return e.stopPropagation()}},l):l});return t.map(function(e,t){var n=e===r?b:e;return t=0;t-=1){var n=I[t].fixed;if("left"===n||!0===n){e=t;break}}if(e>=0)for(var o=0;o<=e;o+=1){var r=I[o].fixed;if("left"!==r&&!0!==r)return!0}var a=I.findIndex(function(e){return"right"===e.fixed});if(a>=0){for(var l=a;l0){var e=0,t=0;I.forEach(function(n){var o=ep(S,n.width);o?e+=o:t+=1});var n=Math.max(S,Z),o=Math.max(n-e,t),r=t,a=o/t,l=0,c=I.map(function(e){var t=(0,C.Z)({},e),n=ep(S,t.width);if(n)t.width=n;else{var c=Math.floor(a);t.width=1===r?o:c,o-=c,r-=1}return l+=t.width,t});if(l=n-h})})}})},z=function(e){I(function(t){return(0,C.Z)((0,C.Z)({},t),{},{scrollLeft:y?e/y*x:0})})};return(o.useImperativeHandle(t,function(){return{setScrollLeft:z,checkScrollBarVisible:H}}),o.useEffect(function(){var e=ew(document.body,"mouseup",j,!1),t=ew(document.body,"mousemove",B,!1);return H(),function(){e.remove(),t.remove()}},[k,T]),o.useEffect(function(){if(p.current){for(var e=[],t=(0,eC.bn)(p.current);t;)e.push(t),t=t.parentElement;return e.forEach(function(e){return e.addEventListener("scroll",H,!1)}),window.addEventListener("resize",H,!1),window.addEventListener("scroll",H,!1),v.addEventListener("scroll",H,!1),function(){e.forEach(function(e){return e.removeEventListener("scroll",H)}),window.removeEventListener("resize",H),window.removeEventListener("scroll",H),v.removeEventListener("scroll",H)}}},[v]),o.useEffect(function(){O.isHiddenScrollBar||I(function(e){var t=p.current;return t?(0,C.Z)((0,C.Z)({},e),{},{scrollLeft:t.scrollLeft/t.scrollWidth*t.clientWidth}):e})},[O.isHiddenScrollBar]),y<=x||!k||O.isHiddenScrollBar)?null:o.createElement("div",{style:{height:(0,_.Z)(),width:x,bottom:h},className:"".concat(b,"-sticky-scroll")},o.createElement("div",{onMouseDown:function(e){e.persist(),R.current.delta=e.pageX-O.scrollLeft,R.current.x=0,D(!0),e.preventDefault()},ref:S,className:Z()("".concat(b,"-sticky-scroll-bar"),(0,E.Z)({},"".concat(b,"-sticky-scroll-bar-active"),T)),style:{width:"".concat(k,"px"),transform:"translate3d(".concat(O.scrollLeft,"px, 0, 0)")}}))}),eZ="rc-table",eN=[],eK={};function eO(){return"No Data"}var eI=o.forwardRef(function(e,t){var n,r=(0,C.Z)({rowKey:"key",prefixCls:eZ,emptyText:eO},e),s=r.prefixCls,u=r.className,f=r.rowClassName,m=r.style,h=r.data,v=r.rowKey,g=r.scroll,b=r.tableLayout,y=r.direction,x=r.title,S=r.footer,O=r.summary,I=r.caption,P=r.id,M=r.showHeader,T=r.components,L=r.emptyText,B=r.onRow,q=r.onHeaderRow,V=r.measureRowRender,X=r.onScroll,G=r.internalHooks,Y=r.transformColumns,$=r.internalRefs,J=r.tailor,Q=r.getContainerWidth,ee=r.sticky,eo=r.rowHoverable,er=void 0===eo||eo,ec=h||eN,ei=!!ec.length,es=G===a,ef=o.useCallback(function(e,t){return(0,K.Z)(T,e)||t},[T]),ep=o.useMemo(function(){return"function"==typeof v?v:function(e){return e&&e[v]}},[v]),em=ef(["body"]),eh=(tU=o.useState(-1),tY=(tG=(0,l.Z)(tU,2))[0],t$=tG[1],tJ=o.useState(-1),t0=(tQ=(0,l.Z)(tJ,2))[0],t1=tQ[1],[tY,t0,o.useCallback(function(e,t){t$(e),t1(t)},[])]),ev=(0,l.Z)(eh,3),eg=ev[0],ew=ev[1],ek=ev[2],eE=(t8=(t3=r.expandable,t4=(0,j.Z)(r,en),!1===(t2="expandable"in r?(0,C.Z)((0,C.Z)({},t4),t3):t4).showExpandColumn&&(t2.expandIconColumnIndex=-1),t2).expandIcon,t6=t2.expandedRowKeys,t5=t2.defaultExpandedRowKeys,t7=t2.defaultExpandAllRows,t9=t2.expandedRowRender,ne=t2.onExpand,nt=t2.onExpandedRowsChange,nn=t2.childrenColumnName||"children",no=o.useMemo(function(){return t9?"row":!!(r.expandable&&r.internalHooks===a&&r.expandable.__PARENT_RENDER_ICON__||ec.some(function(e){return e&&"object"===(0,k.Z)(e)&&e[nn]}))&&"nest"},[!!t9,ec]),nr=o.useState(function(){if(t5)return t5;if(t7){var e;return e=[],function t(n){(n||[]).forEach(function(n,o){e.push(ep(n,o)),t(n[nn])})}(ec),e}return[]}),nl=(na=(0,l.Z)(nr,2))[0],nc=na[1],ni=o.useMemo(function(){return new Set(t6||nl||[])},[t6,nl]),nd=o.useCallback(function(e){var t,n=ep(e,ec.indexOf(e)),o=ni.has(n);o?(ni.delete(n),t=(0,el.Z)(ni)):t=[].concat((0,el.Z)(ni),[n]),nc(t),ne&&ne(!o,e),nt&&nt(t)},[ep,ni,ec,ne,nt]),[t2,no,ni,t8||U,nn,nd]),eI=(0,l.Z)(eE,6),eR=eI[0],eP=eI[1],eM=eI[2],eT=eI[3],eD=eI[4],eL=eI[5],ej=null==g?void 0:g.x,eB=o.useState(0),eH=(0,l.Z)(eB,2),ez=eH[0],eA=eH[1],eW=eb((0,C.Z)((0,C.Z)((0,C.Z)({},r),eR),{},{expandable:!!eR.expandedRowRender,columnTitle:eR.columnTitle,expandedKeys:eM,getRowKey:ep,onTriggerExpand:eL,expandIcon:eT,expandIconColumnIndex:eR.expandIconColumnIndex,direction:y,scrollWidth:es&&J&&"number"==typeof ej?ej:null,clientWidth:ez}),es?Y:null),e_=(0,l.Z)(eW,4),eF=e_[0],eq=e_[1],eV=e_[2],eX=e_[3],eU=null!=eV?eV:ej,eG=o.useMemo(function(){return{columns:eF,flattenColumns:eq}},[eF,eq]),eY=o.useRef(),e$=o.useRef(),eJ=o.useRef(),eQ=o.useRef();o.useImperativeHandle(t,function(){return{nativeElement:eY.current,scrollTo:function(e){var t;if(eJ.current instanceof HTMLElement){var n=e.index,o=e.top,r=e.key;if("number"!=typeof o||Number.isNaN(o)){var a,l,c=null!=r?r:ep(ec[n]);null===(l=eJ.current.querySelector('[data-row-key="'.concat(c,'"]')))||void 0===l||l.scrollIntoView()}else null===(a=eJ.current)||void 0===a||a.scrollTo({top:o})}else null!==(t=eJ.current)&&void 0!==t&&t.scrollTo&&eJ.current.scrollTo(e)}}});var e0=o.useRef(),e1=o.useState(!1),e2=(0,l.Z)(e1,2),e3=e2[0],e4=e2[1],e8=o.useState(!1),e6=(0,l.Z)(e8,2),e5=e6[0],e7=e6[1],e9=o.useState(new Map),te=(0,l.Z)(e9,2),tt=te[0],tn=te[1],to=R(eq).map(function(e){return tt.get(e)}),tr=o.useMemo(function(){return to},[to.join("_")]),ta=(0,o.useMemo)(function(){var e=eq.length,t=function(e,t,n){for(var o=[],r=0,a=e;a!==t;a+=n)o.push(r),eq[a].fixed&&(r+=tr[a]||0);return o},n=t(0,e,1),o=t(e-1,-1,-1).reverse();return"rtl"===y?{left:o,right:n}:{left:n,right:o}},[tr,eq,y]),tl=g&&null!=g.y,tc=g&&null!=eU||!!eR.fixed,ti=tc&&eq.some(function(e){return e.fixed}),td=o.useRef(),ts=(nf=void 0===(nu=(ns="object"===(0,k.Z)(ee)?ee:{}).offsetHeader)?0:nu,nm=void 0===(np=ns.offsetSummary)?0:np,nv=void 0===(nh=ns.offsetScroll)?0:nh,nb=(void 0===(ng=ns.getContainer)?function(){return ey}:ng)()||ey,ny=!!ee,o.useMemo(function(){return{isSticky:ny,stickyClassName:ny?"".concat(s,"-sticky-holder"):"",offsetHeader:nf,offsetSummary:nm,offsetScroll:nv,container:nb}},[ny,nv,nf,nm,s,nb])),tu=ts.isSticky,tf=ts.offsetHeader,tp=ts.offsetSummary,tm=ts.offsetScroll,th=ts.stickyClassName,tv=ts.container,tg=o.useMemo(function(){return null==O?void 0:O(ec)},[O,ec]),tb=(tl||tu)&&o.isValidElement(tg)&&tg.type===H&&tg.props.fixed;tl&&(nw={overflowY:ei?"scroll":"auto",maxHeight:g.y}),tc&&(nx={overflowX:"auto"},tl||(nw={overflowY:"hidden"}),nk={width:!0===eU?"auto":eU,minWidth:"100%"});var ty=o.useCallback(function(e,t){tn(function(n){if(n.get(e)!==t){var o=new Map(n);return o.set(e,t),o}return n})},[]),tx=function(e){var t=(0,o.useRef)(null),n=(0,o.useRef)();function r(){window.clearTimeout(n.current)}return(0,o.useEffect)(function(){return r},[]),[function(e){t.current=e,r(),n.current=window.setTimeout(function(){t.current=null,n.current=void 0},100)},function(){return t.current}]}(0),tw=(0,l.Z)(tx,2),tk=tw[0],tC=tw[1];function tE(e,t){t&&("function"==typeof t?t(e):t.scrollLeft!==e&&(t.scrollLeft=e,t.scrollLeft!==e&&setTimeout(function(){t.scrollLeft=e},0)))}var tS=(0,c.Z)(function(e){var t,n=e.currentTarget,o=e.scrollLeft,r="rtl"===y,a="number"==typeof o?o:n.scrollLeft,l=n||eK;tC()&&tC()!==l||(tk(l),tE(a,e$.current),tE(a,eJ.current),tE(a,e0.current),tE(a,null===(t=td.current)||void 0===t?void 0:t.setScrollLeft));var c=n||e$.current;if(c){var i=es&&J&&"number"==typeof eU?eU:c.scrollWidth,d=c.clientWidth;if(i===d){e4(!1),e7(!1);return}r?(e4(-a0)):(e4(a>0),e7(a1?x-D:0,pointerEvents:"auto"}),j=o.useMemo(function(){return h?M<=1:0===R||0===M||M>1},[M,R,h]);j?L.visibility="hidden":h&&(L.height=null==v?void 0:v(M));var B={};return(0===M||0===R)&&(B.rowSpan=1,B.colSpan=1),o.createElement(T,(0,p.Z)({className:Z()(y,m),ellipsis:r.ellipsis,align:r.align,scope:r.rowScope,component:i,prefixCls:n.prefixCls,key:E,record:s,index:c,renderIndex:d,dataIndex:b,render:j?function(){return null}:g,shouldCellUpdate:r.shouldCellUpdate},S,{appendNode:N,additionalProps:(0,C.Z)((0,C.Z)({},K),{},{style:L},B)}))},eL=["data","index","className","rowKey","style","extra","getHeight"],ej=y(o.forwardRef(function(e,t){var n,r=e.data,a=e.index,l=e.className,c=e.rowKey,i=e.style,d=e.extra,s=e.getHeight,u=(0,j.Z)(e,eL),m=r.record,h=r.indent,v=r.index,g=f(w,["prefixCls","flattenColumns","fixColumn","componentWidth","scrollX"]),b=g.scrollX,y=g.flattenColumns,x=g.prefixCls,k=g.fixColumn,S=g.componentWidth,N=f(eM,["getComponent"]).getComponent,K=V(m,c,a,h),O=N(["body","row"],"div"),I=N(["body","cell"],"div"),R=K.rowSupportExpand,P=K.expanded,M=K.rowProps,D=K.expandedRowRender,L=K.expandedRowClassName;if(R&&P){var B=D(m,a,h+1,P),H=G(L,m,a,h),z={};k&&(z={style:(0,E.Z)({},"--virtual-width","".concat(S,"px"))});var A="".concat(x,"-expanded-row-cell");n=o.createElement(O,{className:Z()("".concat(x,"-expanded-row"),"".concat(x,"-expanded-row-level-").concat(h+1),H)},o.createElement(T,{component:I,prefixCls:x,className:Z()(A,(0,E.Z)({},"".concat(A,"-fixed"),k)),additionalProps:z},B))}var W=(0,C.Z)((0,C.Z)({},i),{},{width:b});d&&(W.position="absolute",W.pointerEvents="none");var _=o.createElement(O,(0,p.Z)({},M,u,{"data-row-key":c,ref:R?null:t,className:Z()(l,"".concat(x,"-row"),null==M?void 0:M.className,(0,E.Z)({},"".concat(x,"-row-extra"),d)),style:(0,C.Z)((0,C.Z)({},W),null==M?void 0:M.style)}),y.map(function(e,t){return o.createElement(eD,{key:t,component:I,rowInfo:K,column:e,colIndex:t,indent:h,index:a,renderIndex:v,record:m,inverse:d,getHeight:s})}));return R?o.createElement("div",{ref:t},_,n):_})),eB=y(o.forwardRef(function(e,t){var n=e.data,r=e.onScroll,a=f(w,["flattenColumns","onColumnResize","getRowKey","prefixCls","expandedKeys","childrenColumnName","scrollX","direction"]),c=a.flattenColumns,i=a.onColumnResize,d=a.getRowKey,s=a.expandedKeys,u=a.prefixCls,p=a.childrenColumnName,m=a.scrollX,h=a.direction,v=f(eM),g=v.sticky,b=v.scrollY,y=v.listItemHeight,x=v.getComponent,C=v.onScroll,E=o.useRef(),S=q(n,p,s,d),Z=o.useMemo(function(){var e=0;return c.map(function(t){var n=t.width,o=t.minWidth,r=t.key,a=Math.max(n||0,o||0);return e+=a,[r,a,e]})},[c]),N=o.useMemo(function(){return Z.map(function(e){return e[2]})},[Z]);o.useEffect(function(){Z.forEach(function(e){var t=(0,l.Z)(e,2);i(t[0],t[1])})},[Z]),o.useImperativeHandle(t,function(){var e,t={scrollTo:function(e){var t;null===(t=E.current)||void 0===t||t.scrollTo(e)},nativeElement:null===(e=E.current)||void 0===e?void 0:e.nativeElement};return Object.defineProperty(t,"scrollLeft",{get:function(){var e;return(null===(e=E.current)||void 0===e?void 0:e.getScrollInfo().x)||0},set:function(e){var t;null===(t=E.current)||void 0===t||t.scrollTo({left:e})}}),Object.defineProperty(t,"scrollTop",{get:function(){var e;return(null===(e=E.current)||void 0===e?void 0:e.getScrollInfo().y)||0},set:function(e){var t;null===(t=E.current)||void 0===t||t.scrollTo({top:e})}}),t});var K=function(e,t){var n=null===(r=S[t])||void 0===r?void 0:r.record,o=e.onCell;if(o){var r,a,l=o(n,t);return null!==(a=null==l?void 0:l.rowSpan)&&void 0!==a?a:1}return 1},O=o.useMemo(function(){return{columnsOffset:N}},[N]),I="".concat(u,"-tbody"),R=x(["body","wrapper"]),P={};return g&&(P.position="sticky",P.bottom=0,"object"===(0,k.Z)(g)&&g.offsetScroll&&(P.bottom=g.offsetScroll)),o.createElement(eT.Provider,{value:O},o.createElement(eP.Z,{fullHeight:!1,ref:E,prefixCls:"".concat(I,"-virtual"),styles:{horizontalScrollBar:P},className:I,height:b,itemHeight:y||24,data:S,itemKey:function(e){return d(e.record)},component:R,scrollWidth:m,direction:h,onVirtualScroll:function(e){var t,n=e.x;r({currentTarget:null===(t=E.current)||void 0===t?void 0:t.nativeElement,scrollLeft:n})},onScroll:C,extraRender:function(e){var t=e.start,n=e.end,r=e.getSize,a=e.offsetY;if(n<0)return null;for(var l=c.filter(function(e){return 0===K(e,t)}),i=t,s=function(e){if(!(l=l.filter(function(t){return 0===K(t,e)})).length)return i=e,1},u=t;u>=0&&!s(u);u-=1);for(var f=c.filter(function(e){return 1!==K(e,n)}),p=n,m=function(e){if(!(f=f.filter(function(t){return 1!==K(t,e)})).length)return p=Math.max(e-1,n),1},h=n;h1})&&v.push(e)},b=i;b<=p;b+=1)if(g(b))continue;return v.map(function(e){var t=S[e],n=d(t.record,e),l=r(n);return o.createElement(ej,{key:e,data:t,rowKey:n,index:e,style:{top:-a+l.top},extra:!0,getHeight:function(t){var o=e+t-1,a=r(n,d(S[o].record,o));return a.bottom-a.top}})})}},function(e,t,n){var r=d(e.record,t);return o.createElement(ej,{data:e,rowKey:r,index:t,style:n.style})}))})),eH=function(e,t){var n=t.ref,r=t.onScroll;return o.createElement(eB,{ref:n,data:e,onScroll:r})},ez=o.forwardRef(function(e,t){var n=e.data,r=e.columns,l=e.scroll,c=e.sticky,i=e.prefixCls,d=void 0===i?eZ:i,s=e.className,u=e.listItemHeight,f=e.components,m=e.onScroll,h=l||{},v=h.x,g=h.y;"number"!=typeof v&&(v=1),"number"!=typeof g&&(g=500);var b=(0,P.zX)(function(e,t){return(0,K.Z)(f,e)||t}),y=(0,P.zX)(m),x=o.useMemo(function(){return{sticky:c,scrollY:g,listItemHeight:u,getComponent:b,onScroll:y}},[c,g,u,b,y]);return o.createElement(eM.Provider,{value:x},o.createElement(eR,(0,p.Z)({},e,{className:Z()(s,"".concat(d,"-virtual")),scroll:(0,C.Z)((0,C.Z)({},l),{},{x:v}),components:(0,C.Z)((0,C.Z)({},f),{},{body:null!=n&&n.length?eH:void 0}),columns:r,internalHooks:a,tailor:!0,ref:t})))});b(ez,void 0);var eA=n(70464),eW=o.createContext(null),e_=o.createContext({}),eF=o.memo(function(e){for(var t=e.prefixCls,n=e.level,r=e.isStart,a=e.isEnd,l="".concat(t,"-indent-unit"),c=[],i=0;i1&&void 0!==arguments[1]?arguments[1]:null;return n.map(function(d,s){for(var u,f=eX(o?o.pos:"0",s),p=eU(d[a],f),m=0;m1&&void 0!==arguments[1]?arguments[1]:{},f=u.initWrapper,p=u.processEntity,m=u.onProcessFinished,h=u.externalGetKey,v=u.childrenPropName,g=u.fieldNames,b=arguments.length>2?arguments[2]:void 0,y={},x={},w={posEntities:y,keyEntities:x};return f&&(w=f(w)||w),t=function(e){var t=e.node,n=e.index,o=e.pos,r=e.key,a=e.parentPos,l=e.level,c={node:t,nodes:e.nodes,index:n,key:r,pos:o,level:l},i=eU(r,o);y[o]=c,x[i]=c,c.parent=y[a],c.parent&&(c.parent.children=c.parent.children||[],c.parent.children.push(c)),p&&p(c,w)},n={externalGetKey:h||b,childrenPropName:v,fieldNames:g},a=(r=("object"===(0,k.Z)(n)?n:{externalGetKey:n})||{}).childrenPropName,l=r.externalGetKey,i=(c=eG(r.fieldNames)).key,d=c.children,s=a||d,l?"string"==typeof l?o=function(e){return e[l]}:"function"==typeof l&&(o=function(e){return l(e)}):o=function(e,t){return eU(e[i],t)},function n(r,a,l,c){var i=r?r[s]:e,d=r?eX(l.pos,a):"0",u=r?[].concat((0,el.Z)(c),[r]):[];if(r){var f=o(r,d);t({node:r,index:a,pos:d,key:f,parentPos:l.node?l.pos:null,level:l.level+1,nodes:u})}i&&i.forEach(function(e,t){n(e,t,{node:r,pos:d,level:l?l.level+1:-1},u)})}(null),m&&m(w),w}function eQ(e,t){var n=t.expandedKeys,o=t.selectedKeys,r=t.loadedKeys,a=t.loadingKeys,l=t.checkedKeys,c=t.halfCheckedKeys,i=t.dragOverNodeKey,d=t.dropPosition,s=t.keyEntities[e];return{eventKey:e,expanded:-1!==n.indexOf(e),selected:-1!==o.indexOf(e),loaded:-1!==r.indexOf(e),loading:-1!==a.indexOf(e),checked:-1!==l.indexOf(e),halfChecked:-1!==c.indexOf(e),pos:String(s?s.pos:""),dragOver:i===e&&0===d,dragOverGapTop:i===e&&-1===d,dragOverGapBottom:i===e&&1===d}}function e0(e){var t=e.data,n=e.expanded,o=e.selected,r=e.checked,a=e.loaded,l=e.loading,c=e.halfChecked,i=e.dragOver,d=e.dragOverGapTop,s=e.dragOverGapBottom,u=e.pos,f=e.active,p=e.eventKey,m=(0,C.Z)((0,C.Z)({},t),{},{expanded:n,selected:o,checked:r,loaded:a,loading:l,halfChecked:c,dragOver:i,dragOverGapTop:d,dragOverGapBottom:s,pos:u,active:f,key:p});return"props"in m||Object.defineProperty(m,"props",{get:function(){return(0,O.ZP)(!1,"Second param return from event is node data instead of TreeNode instance. Please read value directly instead of reading from `props`."),e}}),m}var e1=["eventKey","className","style","dragOver","dragOverGapTop","dragOverGapBottom","isLeaf","isStart","isEnd","expanded","selected","checked","halfChecked","loading","domRef","active","data","onMouseMove","selectable"],e2="open",e3="close",e4=function(e){var t,n,r,a=e.eventKey,c=e.className,i=e.style,d=e.dragOver,s=e.dragOverGapTop,u=e.dragOverGapBottom,f=e.isLeaf,m=e.isStart,h=e.isEnd,v=e.expanded,g=e.selected,b=e.checked,y=e.halfChecked,x=e.loading,w=e.domRef,k=e.active,S=e.data,N=e.onMouseMove,K=e.selectable,O=(0,j.Z)(e,e1),I=o.useContext(eW),R=o.useContext(e_),P=o.useRef(null),M=o.useState(!1),T=(0,l.Z)(M,2),D=T[0],L=T[1],B=!!(I.disabled||e.disabled||null!==(t=R.nodeDisabled)&&void 0!==t&&t.call(R,S)),H=o.useMemo(function(){return!!I.checkable&&!1!==e.checkable&&I.checkable},[I.checkable,e.checkable]),z=function(t){B||I.onNodeSelect(t,e0(e))},A=function(t){B||!H||e.disableCheckbox||I.onNodeCheck(t,e0(e),!b)},W=o.useMemo(function(){return"boolean"==typeof K?K:I.selectable},[K,I.selectable]),_=function(t){I.onNodeClick(t,e0(e)),W?z(t):A(t)},q=function(t){I.onNodeDoubleClick(t,e0(e))},V=function(t){I.onNodeMouseEnter(t,e0(e))},X=function(t){I.onNodeMouseLeave(t,e0(e))},U=function(t){I.onNodeContextMenu(t,e0(e))},G=o.useMemo(function(){return!!(I.draggable&&(!I.draggable.nodeDraggable||I.draggable.nodeDraggable(S)))},[I.draggable,S]),Y=function(t){x||I.onNodeExpand(t,e0(e))},$=o.useMemo(function(){return!!((I.keyEntities[a]||{}).children||[]).length},[I.keyEntities,a]),J=o.useMemo(function(){return!1!==f&&(f||!I.loadData&&!$||I.loadData&&e.loaded&&!$)},[f,I.loadData,$,e.loaded]);o.useEffect(function(){!x&&("function"!=typeof I.loadData||!v||J||e.loaded||I.onNodeLoad(e0(e)))},[x,I.loadData,I.onNodeLoad,v,J,e]);var Q=o.useMemo(function(){var e;return null!==(e=I.draggable)&&void 0!==e&&e.icon?o.createElement("span",{className:"".concat(I.prefixCls,"-draggable-icon")},I.draggable.icon):null},[I.draggable]),ee=function(t){var n=e.switcherIcon||I.switcherIcon;return"function"==typeof n?n((0,C.Z)((0,C.Z)({},e),{},{isLeaf:t})):n},et=o.useMemo(function(){if(!H)return null;var t="boolean"!=typeof H?H:null;return o.createElement("span",{className:Z()("".concat(I.prefixCls,"-checkbox"),(0,E.Z)((0,E.Z)((0,E.Z)({},"".concat(I.prefixCls,"-checkbox-checked"),b),"".concat(I.prefixCls,"-checkbox-indeterminate"),!b&&y),"".concat(I.prefixCls,"-checkbox-disabled"),B||e.disableCheckbox)),onClick:A,role:"checkbox","aria-checked":y?"mixed":b,"aria-disabled":B||e.disableCheckbox,"aria-label":"Select ".concat("string"==typeof e.title?e.title:"tree node")},t)},[H,b,y,B,e.disableCheckbox,e.title]),en=o.useMemo(function(){return J?null:v?e2:e3},[J,v]),eo=o.useMemo(function(){return o.createElement("span",{className:Z()("".concat(I.prefixCls,"-iconEle"),"".concat(I.prefixCls,"-icon__").concat(en||"docu"),(0,E.Z)({},"".concat(I.prefixCls,"-icon_loading"),x))})},[I.prefixCls,en,x]),er=o.useMemo(function(){var t=!!I.draggable;return!e.disabled&&t&&I.dragOverNodeKey===a?I.dropIndicatorRender({dropPosition:I.dropPosition,dropLevelOffset:I.dropLevelOffset,indent:I.indent,prefixCls:I.prefixCls,direction:I.direction}):null},[I.dropPosition,I.dropLevelOffset,I.indent,I.prefixCls,I.direction,I.draggable,I.dragOverNodeKey,I.dropIndicatorRender]),ea=o.useMemo(function(){var t,n,r=e.title,a=void 0===r?"---":r,l="".concat(I.prefixCls,"-node-content-wrapper");if(I.showIcon){var c=e.icon||I.icon;t=c?o.createElement("span",{className:Z()("".concat(I.prefixCls,"-iconEle"),"".concat(I.prefixCls,"-icon__customize"))},"function"==typeof c?c(e):c):eo}else I.loadData&&x&&(t=eo);return n="function"==typeof a?a(S):I.titleRender?I.titleRender(S):a,o.createElement("span",{ref:P,title:"string"==typeof a?a:"",className:Z()(l,"".concat(l,"-").concat(en||"normal"),(0,E.Z)({},"".concat(I.prefixCls,"-node-selected"),!B&&(g||D))),onMouseEnter:V,onMouseLeave:X,onContextMenu:U,onClick:_,onDoubleClick:q},t,o.createElement("span",{className:"".concat(I.prefixCls,"-title")},n),er)},[I.prefixCls,I.showIcon,e,I.icon,eo,I.titleRender,S,en,V,X,U,_,q]),el=(0,F.Z)(O,{aria:!0,data:!0}),ec=(I.keyEntities[a]||{}).level,ei=h[h.length-1],ed=!B&&G,es=I.draggingNodeKey===a;return o.createElement("div",(0,p.Z)({ref:w,role:"treeitem","aria-expanded":f?void 0:v,className:Z()(c,"".concat(I.prefixCls,"-treenode"),(r={},(0,E.Z)((0,E.Z)((0,E.Z)((0,E.Z)((0,E.Z)((0,E.Z)((0,E.Z)((0,E.Z)((0,E.Z)((0,E.Z)(r,"".concat(I.prefixCls,"-treenode-disabled"),B),"".concat(I.prefixCls,"-treenode-switcher-").concat(v?"open":"close"),!f),"".concat(I.prefixCls,"-treenode-checkbox-checked"),b),"".concat(I.prefixCls,"-treenode-checkbox-indeterminate"),y),"".concat(I.prefixCls,"-treenode-selected"),g),"".concat(I.prefixCls,"-treenode-loading"),x),"".concat(I.prefixCls,"-treenode-active"),k),"".concat(I.prefixCls,"-treenode-leaf-last"),ei),"".concat(I.prefixCls,"-treenode-draggable"),G),"dragging",es),(0,E.Z)((0,E.Z)((0,E.Z)((0,E.Z)((0,E.Z)((0,E.Z)((0,E.Z)(r,"drop-target",I.dropTargetKey===a),"drop-container",I.dropContainerKey===a),"drag-over",!B&&d),"drag-over-gap-top",!B&&s),"drag-over-gap-bottom",!B&&u),"filter-node",null===(n=I.filterTreeNode)||void 0===n?void 0:n.call(I,e0(e))),"".concat(I.prefixCls,"-treenode-leaf"),J))),style:i,draggable:ed,onDragStart:ed?function(t){t.stopPropagation(),L(!0),I.onNodeDragStart(t,e);try{t.dataTransfer.setData("text/plain","")}catch(e){}}:void 0,onDragEnter:G?function(t){t.preventDefault(),t.stopPropagation(),I.onNodeDragEnter(t,e)}:void 0,onDragOver:G?function(t){t.preventDefault(),t.stopPropagation(),I.onNodeDragOver(t,e)}:void 0,onDragLeave:G?function(t){t.stopPropagation(),I.onNodeDragLeave(t,e)}:void 0,onDrop:G?function(t){t.preventDefault(),t.stopPropagation(),L(!1),I.onNodeDrop(t,e)}:void 0,onDragEnd:G?function(t){t.stopPropagation(),L(!1),I.onNodeDragEnd(t,e)}:void 0,onMouseMove:N},void 0!==K?{"aria-selected":!!K}:void 0,el),o.createElement(eF,{prefixCls:I.prefixCls,level:ec,isStart:m,isEnd:h}),Q,function(){if(J){var e=ee(!0);return!1!==e?o.createElement("span",{className:Z()("".concat(I.prefixCls,"-switcher"),"".concat(I.prefixCls,"-switcher-noop"))},e):null}var t=ee(!1);return!1!==t?o.createElement("span",{onClick:Y,className:Z()("".concat(I.prefixCls,"-switcher"),"".concat(I.prefixCls,"-switcher_").concat(v?e2:e3))},t):null}(),et,ea)};function e8(e,t){if(!e)return[];var n=e.slice(),o=n.indexOf(t);return o>=0&&n.splice(o,1),n}function e6(e,t){var n=(e||[]).slice();return -1===n.indexOf(t)&&n.push(t),n}function e5(e){return e.split("-")}function e7(e,t,n,o,r,a,l,c,i,d){var s,u,f=e.clientX,p=e.clientY,m=e.target.getBoundingClientRect(),h=m.top,v=m.height,g=(("rtl"===d?-1:1)*(((null==r?void 0:r.x)||0)-f)-12)/o,b=i.filter(function(e){var t;return null===(t=c[e])||void 0===t||null===(t=t.children)||void 0===t?void 0:t.length}),y=c[n.eventKey];if(p-1.5?a({dragNode:N,dropNode:K,dropPosition:1})?E=1:O=!1:a({dragNode:N,dropNode:K,dropPosition:0})?E=0:a({dragNode:N,dropNode:K,dropPosition:1})?E=1:O=!1:a({dragNode:N,dropNode:K,dropPosition:1})?E=1:O=!1,{dropPosition:E,dropLevelOffset:S,dropTargetKey:y.key,dropTargetPos:y.pos,dragOverNodeKey:C,dropContainerKey:0===E?null:(null===(u=y.parent)||void 0===u?void 0:u.key)||null,dropAllowed:O}}function e9(e,t){if(e)return t.multiple?e.slice():e.length?[e[0]]:e}function te(e){var t;if(!e)return null;if(Array.isArray(e))t={checkedKeys:e,halfCheckedKeys:void 0};else{if("object"!==(0,k.Z)(e))return(0,O.ZP)(!1,"`checkedKeys` is not an array or an object"),null;t={checkedKeys:e.checked||void 0,halfCheckedKeys:e.halfChecked||void 0}}return t}function tt(e,t){var n=new Set;return(e||[]).forEach(function(e){!function e(o){if(!n.has(o)){var r=t[o];if(r){n.add(o);var a=r.parent;!r.node.disabled&&a&&e(a.key)}}}(e)}),(0,el.Z)(n)}function tn(e,t){var n=new Set;return e.forEach(function(e){t.has(e)||n.add(e)}),n}function to(e){var t=e||{},n=t.disabled,o=t.disableCheckbox,r=t.checkable;return!!(n||o)||!1===r}function tr(e,t,n,o){var r,a=[];r=o||to;var l=new Set(e.filter(function(e){var t=!!n[e];return t||a.push(e),t})),c=new Map,i=0;return Object.keys(n).forEach(function(e){var t=n[e],o=t.level,r=c.get(o);r||(r=new Set,c.set(o,r)),r.add(t),i=Math.max(i,o)}),(0,O.ZP)(!a.length,"Tree missing follow keys: ".concat(a.slice(0,100).map(function(e){return"'".concat(e,"'")}).join(", "))),!0===t?function(e,t,n,o){for(var r=new Set(e),a=new Set,l=0;l<=n;l+=1)(t.get(l)||new Set).forEach(function(e){var t=e.key,n=e.node,a=e.children,l=void 0===a?[]:a;r.has(t)&&!o(n)&&l.filter(function(e){return!o(e.node)}).forEach(function(e){r.add(e.key)})});for(var c=new Set,i=n;i>=0;i-=1)(t.get(i)||new Set).forEach(function(e){var t=e.parent;if(!(o(e.node)||!e.parent||c.has(e.parent.key))){if(o(e.parent.node)){c.add(t.key);return}var n=!0,l=!1;(t.children||[]).filter(function(e){return!o(e.node)}).forEach(function(e){var t=e.key,o=r.has(t);n&&!o&&(n=!1),!l&&(o||a.has(t))&&(l=!0)}),n&&r.add(t.key),l&&a.add(t.key),c.add(t.key)}});return{checkedKeys:Array.from(r),halfCheckedKeys:Array.from(tn(a,r))}}(l,c,i,r):function(e,t,n,o,r){for(var a=new Set(e),l=new Set(t),c=0;c<=o;c+=1)(n.get(c)||new Set).forEach(function(e){var t=e.key,n=e.node,o=e.children,c=void 0===o?[]:o;a.has(t)||l.has(t)||r(n)||c.filter(function(e){return!r(e.node)}).forEach(function(e){a.delete(e.key)})});l=new Set;for(var i=new Set,d=o;d>=0;d-=1)(n.get(d)||new Set).forEach(function(e){var t=e.parent;if(!(r(e.node)||!e.parent||i.has(e.parent.key))){if(r(e.parent.node)){i.add(t.key);return}var n=!0,o=!1;(t.children||[]).filter(function(e){return!r(e.node)}).forEach(function(e){var t=e.key,r=a.has(t);n&&!r&&(n=!1),!o&&(r||l.has(t))&&(o=!0)}),n||a.delete(t.key),o&&l.add(t.key),i.add(t.key)}});return{checkedKeys:Array.from(a),halfCheckedKeys:Array.from(tn(l,a))}}(l,t.halfCheckedKeys,c,i,r)}e4.isTreeNode=1;var ta=n(50506);let tl=e=>{let[t,n]=(0,o.useState)(null);return[(0,o.useCallback)((o,r,a)=>{let l=null!=t?t:o,c=Math.max(l||0,o),i=r.slice(Math.min(l||0,o),c+1).map(e),d=i.some(e=>!a.has(e)),s=[];return i.forEach(e=>{d?(a.has(e)||s.push(e),a.add(e)):(a.delete(e),s.push(e))}),n(d?c:null),s},[t]),n]};var tc=n(13613),ti=n(4156),td=n(73705),ts=n(29967);let tu={},tf="SELECT_ALL",tp="SELECT_INVERT",tm="SELECT_NONE",th=[],tv=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return(t||[]).forEach(t=>{n.push(t),t&&"object"==typeof t&&e in t&&tv(e,t[e],n)}),n};var tg=(e,t)=>{let{preserveSelectedRowKeys:n,selectedRowKeys:r,defaultSelectedRowKeys:a,getCheckboxProps:l,getTitleCheckboxProps:c,onChange:i,onSelect:d,onSelectAll:s,onSelectInvert:u,onSelectNone:f,onSelectMultiple:p,columnWidth:m,type:h,selections:v,fixed:g,renderCell:b,hideSelectAll:y,checkStrictly:x=!0}=t||{},{prefixCls:w,data:k,pageData:C,getRecordByKey:E,getRowKey:S,expandType:N,childrenColumnName:K,locale:O,getPopupContainer:I}=e,R=(0,tc.ln)("Table"),[P,M]=tl(e=>e),[T,D]=(0,ta.Z)(r||a||th,{value:r}),L=o.useRef(new Map),j=(0,o.useCallback)(e=>{if(n){let t=new Map;e.forEach(e=>{let n=E(e);!n&&L.current.has(e)&&(n=L.current.get(e)),t.set(e,n)}),L.current=t}},[E,n]);o.useEffect(()=>{j(T)},[T]);let B=(0,o.useMemo)(()=>tv(K,C),[K,C]),{keyEntities:H}=(0,o.useMemo)(()=>{if(x)return{keyEntities:null};let e=k;if(n){let t=new Set(B.map((e,t)=>S(e,t))),n=Array.from(L.current).reduce((e,n)=>{let[o,r]=n;return t.has(o)?e:e.concat(r)},[]);e=[].concat((0,el.Z)(e),(0,el.Z)(n))}return eJ(e,{externalGetKey:S,childrenPropName:K})},[k,S,x,K,n,B]),z=(0,o.useMemo)(()=>{let e=new Map;return B.forEach((t,n)=>{let o=S(t,n),r=(l?l(t):null)||{};e.set(o,r)}),e},[B,S,l]),A=(0,o.useCallback)(e=>{let t;let n=S(e);return!!(null==(t=z.has(n)?z.get(S(e)):l?l(e):void 0)?void 0:t.disabled)},[z,S]),[W,_]=(0,o.useMemo)(()=>{if(x)return[T||[],[]];let{checkedKeys:e,halfCheckedKeys:t}=tr(T,!0,H,A);return[e||[],t]},[T,x,H,A]),F=(0,o.useMemo)(()=>new Set("radio"===h?W.slice(0,1):W),[W,h]),q=(0,o.useMemo)(()=>"radio"===h?new Set:new Set(_),[_,h]);o.useEffect(()=>{t||D(th)},[!!t]);let V=(0,o.useCallback)((e,t)=>{let o,r;j(e),n?(o=e,r=e.map(e=>L.current.get(e))):(o=[],r=[],e.forEach(e=>{let t=E(e);void 0!==t&&(o.push(e),r.push(t))})),D(o),null==i||i(o,r,{type:t})},[D,E,i,n]),X=(0,o.useCallback)((e,t,n,o)=>{if(d){let r=n.map(e=>E(e));d(E(e),t,r,o)}V(n,"single")},[d,E,V]),U=(0,o.useMemo)(()=>!v||y?null:(!0===v?[tf,tp,tm]:v).map(e=>e===tf?{key:"all",text:O.selectionAll,onSelect(){V(k.map((e,t)=>S(e,t)).filter(e=>{let t=z.get(e);return!(null==t?void 0:t.disabled)||F.has(e)}),"all")}}:e===tp?{key:"invert",text:O.selectInvert,onSelect(){let e=new Set(F);C.forEach((t,n)=>{let o=S(t,n),r=z.get(o);(null==r?void 0:r.disabled)||(e.has(o)?e.delete(o):e.add(o))});let t=Array.from(e);u&&(R.deprecated(!1,"onSelectInvert","onChange"),u(t)),V(t,"invert")}}:e===tm?{key:"none",text:O.selectNone,onSelect(){null==f||f(),V(Array.from(F).filter(e=>{let t=z.get(e);return null==t?void 0:t.disabled}),"none")}}:e).map(e=>Object.assign(Object.assign({},e),{onSelect:function(){for(var t,n=arguments.length,o=Array(n),r=0;r{var n;let r,a,l;if(!t)return e.filter(e=>e!==tu);let i=(0,el.Z)(e),d=new Set(F),u=B.map(S).filter(e=>!z.get(e).disabled),f=u.every(e=>d.has(e)),k=u.some(e=>d.has(e)),C=()=>{let e=[];f?u.forEach(t=>{d.delete(t),e.push(t)}):u.forEach(t=>{d.has(t)||(d.add(t),e.push(t))});let t=Array.from(d);null==s||s(!f,t.map(e=>E(e)),e.map(e=>E(e))),V(t,"all"),M(null)};if("radio"!==h){let e;if(U){let t={getPopupContainer:I,items:U.map((e,t)=>{let{key:n,text:o,onSelect:r}=e;return{key:null!=n?n:t,onClick:()=>{null==r||r(u)},label:o}})};e=o.createElement("div",{className:"".concat(w,"-selection-extra")},o.createElement(td.Z,{menu:t,getPopupContainer:I},o.createElement("span",null,o.createElement(eA.Z,null))))}let t=B.map((e,t)=>{let n=S(e,t),o=z.get(n)||{};return Object.assign({checked:d.has(n)},o)}).filter(e=>{let{disabled:t}=e;return t}),n=!!t.length&&t.length===B.length,l=n&&t.every(e=>{let{checked:t}=e;return t}),i=n&&t.some(e=>{let{checked:t}=e;return t}),s=(null==c?void 0:c())||{},{onChange:p,disabled:m}=s;a=o.createElement(ti.Z,Object.assign({"aria-label":e?"Custom selection":"Select all"},s,{checked:n?l:!!B.length&&f,indeterminate:n?!l&&i:!f&&k,onChange:e=>{C(),null==p||p(e)},disabled:null!=m?m:0===B.length||n,skipGroup:!0})),r=!y&&o.createElement("div",{className:"".concat(w,"-selection")},a,e)}if(l="radio"===h?(e,t,n)=>{let r=S(t,n),a=d.has(r),l=z.get(r);return{node:o.createElement(ts.ZP,Object.assign({},l,{checked:a,onClick:e=>{var t;e.stopPropagation(),null===(t=null==l?void 0:l.onClick)||void 0===t||t.call(l,e)},onChange:e=>{var t;d.has(r)||X(r,!0,[r],e.nativeEvent),null===(t=null==l?void 0:l.onChange)||void 0===t||t.call(l,e)}})),checked:a}}:(e,t,n)=>{var r;let a;let l=S(t,n),c=d.has(l),i=q.has(l),s=z.get(l);return a="nest"===N?i:null!==(r=null==s?void 0:s.indeterminate)&&void 0!==r?r:i,{node:o.createElement(ti.Z,Object.assign({},s,{indeterminate:a,checked:c,skipGroup:!0,onClick:e=>{var t;e.stopPropagation(),null===(t=null==s?void 0:s.onClick)||void 0===t||t.call(s,e)},onChange:e=>{var t;let{nativeEvent:n}=e,{shiftKey:o}=n,r=u.indexOf(l),a=W.some(e=>u.includes(e));if(o&&x&&a){let e=P(r,u,d),t=Array.from(d);null==p||p(!c,t.map(e=>E(e)),e.map(e=>E(e))),V(t,"multiple")}else if(x){let e=c?e8(W,l):e6(W,l);X(l,!c,e,n)}else{let{checkedKeys:e,halfCheckedKeys:t}=tr([].concat((0,el.Z)(W),[l]),!0,H,A),o=e;if(c){let n=new Set(e);n.delete(l),o=tr(Array.from(n),{checked:!1,halfCheckedKeys:t},H,A).checkedKeys}X(l,!c,o,n)}c?M(null):M(r),null===(t=null==s?void 0:s.onChange)||void 0===t||t.call(s,e)}})),checked:c}},!i.includes(tu)){if(0===i.findIndex(e=>{var t;return(null===(t=e[eo])||void 0===t?void 0:t.columnType)==="EXPAND_COLUMN"})){let[e,...t]=i;i=[e,tu].concat((0,el.Z)(t))}else i=[tu].concat((0,el.Z)(i))}let K=i.indexOf(tu),O=(i=i.filter((e,t)=>e!==tu||t===K))[K-1],R=i[K+1],T=g;void 0===T&&((null==R?void 0:R.fixed)!==void 0?T=R.fixed:(null==O?void 0:O.fixed)!==void 0&&(T=O.fixed)),T&&O&&(null===(n=O[eo])||void 0===n?void 0:n.columnType)==="EXPAND_COLUMN"&&void 0===O.fixed&&(O.fixed=T);let D=Z()("".concat(w,"-selection-col"),{["".concat(w,"-selection-col-with-dropdown")]:v&&"checkbox"===h}),L={fixed:T,width:m,className:"".concat(w,"-selection-column"),title:(null==t?void 0:t.columnTitle)?"function"==typeof t.columnTitle?t.columnTitle(a):t.columnTitle:r,render:(e,t,n)=>{let{node:o,checked:r}=l(e,t,n);return b?b(r,t,n,o):o},onCell:t.onCell,align:t.align,[eo]:{className:D}};return i.map(e=>e===tu?L:e)},[S,B,t,W,F,q,m,U,N,z,p,X,A]),F]};let tb=(e,t)=>(0,o.useImperativeHandle)(e,()=>{let e=t(),{nativeElement:n}=e;return"undefined"!=typeof Proxy?new Proxy(n,{get:(t,n)=>e[n]?e[n]:Reflect.get(t,n)}):(n._antProxy=n._antProxy||{},Object.keys(e).forEach(t=>{if(!(t in n._antProxy)){let o=n[t];n._antProxy[t]=o,n[t]=e[t]}}),n)});function ty(e){return null!=e&&e===e.window}var tx=e=>{var t,n;if("undefined"==typeof window)return 0;let o=0;return ty(e)?o=e.pageYOffset:e instanceof Document?o=e.documentElement.scrollTop:e instanceof HTMLElement?o=e.scrollTop:e&&(o=e.scrollTop),e&&!ty(e)&&"number"!=typeof o&&(o=null===(n=(null!==(t=e.ownerDocument)&&void 0!==t?t:e).documentElement)||void 0===n?void 0:n.scrollTop),o},tw=n(18310),tk=n(71744),tC=n(91086),tE=n(64024),tS=n(33759),tZ=n(28617),tN=n(37381),tK=n(40049),tO=n(10353),tI=n(84951);let tR=(e,t)=>"key"in e&&void 0!==e.key&&null!==e.key?e.key:e.dataIndex?Array.isArray(e.dataIndex)?e.dataIndex.join("."):e.dataIndex:t;function tP(e,t){return t?"".concat(t,"-").concat(e):"".concat(e)}let tM=(e,t)=>"function"==typeof e?e(t):e,tT=(e,t)=>{let n=tM(e,t);return"[object Object]"===Object.prototype.toString.call(n)?"":n};var tD={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M349 838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V642H349v196zm531.1-684H143.9c-24.5 0-39.8 26.7-27.5 48l221.3 376h348.8l221.3-376c12.1-21.3-3.2-48-27.7-48z"}}]},name:"filter",theme:"filled"},tL=n(55015),tj=o.forwardRef(function(e,t){return o.createElement(tL.Z,(0,p.Z)({},e,{ref:t,icon:tD}))}),tB=n(53253),tH=n(51646);let tz=e=>{let t=o.useRef(e),[,n]=(0,tH.N)();return[()=>t.current,e=>{t.current=e,n()}]};var tA=n(5545),tW=n(85180),t_=n(60985),tF=n(88208),tq=n(76405),tV=n(25049),tX=n(63496),tU=n(41690),tG=n(15900),tY=n(95814);function t$(e){if(null==e)throw TypeError("Cannot destructure "+e)}var tJ=n(66632),tQ=function(e,t){var n=o.useState(!1),r=(0,l.Z)(n,2),a=r[0],c=r[1];(0,i.Z)(function(){if(a)return e(),function(){t()}},[a]),(0,i.Z)(function(){return c(!0),function(){c(!1)}},[])},t0=["className","style","motion","motionNodes","motionType","onMotionStart","onMotionEnd","active","treeNodeRequiredProps"],t1=o.forwardRef(function(e,t){var n=e.className,r=e.style,a=e.motion,c=e.motionNodes,d=e.motionType,s=e.onMotionStart,u=e.onMotionEnd,f=e.active,m=e.treeNodeRequiredProps,h=(0,j.Z)(e,t0),v=o.useState(!0),g=(0,l.Z)(v,2),b=g[0],y=g[1],x=o.useContext(eW).prefixCls,w=c&&"hide"!==d;(0,i.Z)(function(){c&&w!==b&&y(w)},[c]);var k=o.useRef(!1),C=function(){c&&!k.current&&(k.current=!0,u())};return(tQ(function(){c&&s()},C),c)?o.createElement(tJ.ZP,(0,p.Z)({ref:t,visible:b},a,{motionAppear:"show"===d,onVisibleChanged:function(e){w===e&&C()}}),function(e,t){var n=e.className,r=e.style;return o.createElement("div",{ref:t,className:Z()("".concat(x,"-treenode-motion"),n),style:r},c.map(function(e){var t=Object.assign({},(t$(e.data),e.data)),n=e.title,r=e.key,a=e.isStart,l=e.isEnd;delete t.children;var c=eQ(r,m);return o.createElement(e4,(0,p.Z)({},t,c,{title:n,active:f,data:e.data,key:r,isStart:a,isEnd:l}))}))}):o.createElement(e4,(0,p.Z)({domRef:t,className:n,style:r},h,{active:f}))});function t2(e,t,n){var o=e.findIndex(function(e){return e.key===n}),r=e[o+1],a=t.findIndex(function(e){return e.key===n});if(r){var l=t.findIndex(function(e){return e.key===r.key});return t.slice(a+1,l)}return t.slice(a+1)}var t3=["prefixCls","data","selectable","checkable","expandedKeys","selectedKeys","checkedKeys","loadedKeys","loadingKeys","halfCheckedKeys","keyEntities","disabled","dragging","dragOverNodeKey","dropPosition","motion","height","itemHeight","virtual","scrollWidth","focusable","activeItem","focused","tabIndex","onKeyDown","onFocus","onBlur","onActiveChange","onListChangeStart","onListChangeEnd"],t4={width:0,height:0,display:"flex",overflow:"hidden",opacity:0,border:0,padding:0,margin:0},t8=function(){},t6="RC_TREE_MOTION_".concat(Math.random()),t5={key:t6},t7={key:t6,level:0,index:0,pos:"0",node:t5,nodes:[t5]},t9={parent:null,children:[],pos:t7.pos,data:t5,title:null,key:t6,isStart:[],isEnd:[]};function ne(e,t,n,o){return!1!==t&&n?e.slice(0,Math.ceil(n/o)+1):e}function nt(e){return eU(e.key,e.pos)}var nn=o.forwardRef(function(e,t){var n=e.prefixCls,r=e.data,a=(e.selectable,e.checkable,e.expandedKeys),c=e.selectedKeys,d=e.checkedKeys,s=e.loadedKeys,u=e.loadingKeys,f=e.halfCheckedKeys,m=e.keyEntities,h=e.disabled,v=e.dragging,g=e.dragOverNodeKey,b=e.dropPosition,y=e.motion,x=e.height,w=e.itemHeight,k=e.virtual,C=e.scrollWidth,E=e.focusable,S=e.activeItem,Z=e.focused,N=e.tabIndex,K=e.onKeyDown,O=e.onFocus,I=e.onBlur,R=e.onActiveChange,P=e.onListChangeStart,M=e.onListChangeEnd,T=(0,j.Z)(e,t3),D=o.useRef(null),L=o.useRef(null);o.useImperativeHandle(t,function(){return{scrollTo:function(e){D.current.scrollTo(e)},getIndentWidth:function(){return L.current.offsetWidth}}});var B=o.useState(a),H=(0,l.Z)(B,2),z=H[0],A=H[1],W=o.useState(r),_=(0,l.Z)(W,2),F=_[0],q=_[1],V=o.useState(r),X=(0,l.Z)(V,2),U=X[0],G=X[1],Y=o.useState([]),$=(0,l.Z)(Y,2),J=$[0],Q=$[1],ee=o.useState(null),et=(0,l.Z)(ee,2),en=et[0],eo=et[1],er=o.useRef(r);function ea(){var e=er.current;q(e),G(e),Q([]),eo(null),M()}er.current=r,(0,i.Z)(function(){A(a);var e=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=e.length,o=t.length;if(1!==Math.abs(n-o))return{add:!1,key:null};function r(e,t){var n=new Map;e.forEach(function(e){n.set(e,!0)});var o=t.filter(function(e){return!n.has(e)});return 1===o.length?o[0]:null}return n ").concat(t);return t}(S)),o.createElement("div",null,o.createElement("input",{style:t4,disabled:!1===E||h,tabIndex:!1!==E?N:null,onKeyDown:K,onFocus:O,onBlur:I,value:"",onChange:t8,"aria-label":"for screen reader"})),o.createElement("div",{className:"".concat(n,"-treenode"),"aria-hidden":!0,style:{position:"absolute",pointerEvents:"none",visibility:"hidden",height:0,overflow:"hidden",border:0,padding:0}},o.createElement("div",{className:"".concat(n,"-indent")},o.createElement("div",{ref:L,className:"".concat(n,"-indent-unit")}))),o.createElement(eP.Z,(0,p.Z)({},T,{data:el,itemKey:nt,height:x,fullHeight:!1,virtual:k,itemHeight:w,scrollWidth:C,prefixCls:"".concat(n,"-list"),ref:D,role:"tree",onVisibleChange:function(e){e.every(function(e){return nt(e)!==t6})&&ea()}}),function(e){var t=e.pos,n=Object.assign({},(t$(e.data),e.data)),r=e.title,a=e.key,l=e.isStart,c=e.isEnd,i=eU(a,t);delete n.key,delete n.children;var d=eQ(i,ec);return o.createElement(t1,(0,p.Z)({},n,d,{title:r,active:!!S&&a===S.key,pos:t,data:e.data,isStart:l,isEnd:c,motion:y,motionNodes:a===t6?J:null,motionType:en,onMotionStart:P,onMotionEnd:ea,treeNodeRequiredProps:ec,onMouseMove:function(){R(null)}}))}))}),no=function(e){(0,tU.Z)(n,e);var t=(0,tG.Z)(n);function n(){var e;(0,tq.Z)(this,n);for(var r=arguments.length,a=Array(r),l=0;l0&&void 0!==arguments[0]?arguments[0]:[];t.forEach(function(t){var n=t.key,r=t.children;o.push(n),e(r)})}(l[i].children),o),indent:e.listRef.current.getIndentWidth()}),e.setExpandedKeys(d),window.addEventListener("dragend",e.onWindowDragEnd),null==c||c({event:t,node:e0(n)})}),(0,E.Z)((0,tX.Z)(e),"onNodeDragEnter",function(t,n){var o=e.state,r=o.expandedKeys,a=o.keyEntities,l=o.dragChildrenKeys,c=o.flattenNodes,i=o.indent,d=e.props,s=d.onDragEnter,u=d.onExpand,f=d.allowDrop,p=d.direction,m=n.pos,h=n.eventKey;if(e.currentMouseOverDroppableNodeKey!==h&&(e.currentMouseOverDroppableNodeKey=h),!e.dragNodeProps){e.resetDragState();return}var v=e7(t,e.dragNodeProps,n,i,e.dragStartMousePosition,f,c,a,r,p),g=v.dropPosition,b=v.dropLevelOffset,y=v.dropTargetKey,x=v.dropContainerKey,w=v.dropTargetPos,k=v.dropAllowed,C=v.dragOverNodeKey;if(l.includes(y)||!k||(e.delayedDragEnterLogic||(e.delayedDragEnterLogic={}),Object.keys(e.delayedDragEnterLogic).forEach(function(t){clearTimeout(e.delayedDragEnterLogic[t])}),e.dragNodeProps.eventKey!==n.eventKey&&(t.persist(),e.delayedDragEnterLogic[m]=window.setTimeout(function(){if(null!==e.state.draggingNodeKey){var o=(0,el.Z)(r),l=a[n.eventKey];l&&(l.children||[]).length&&(o=e6(r,n.eventKey)),e.props.hasOwnProperty("expandedKeys")||e.setExpandedKeys(o),null==u||u(o,{node:e0(n),expanded:!0,nativeEvent:t.nativeEvent})}},800)),e.dragNodeProps.eventKey===y&&0===b)){e.resetDragState();return}e.setState({dragOverNodeKey:C,dropPosition:g,dropLevelOffset:b,dropTargetKey:y,dropContainerKey:x,dropTargetPos:w,dropAllowed:k}),null==s||s({event:t,node:e0(n),expandedKeys:r})}),(0,E.Z)((0,tX.Z)(e),"onNodeDragOver",function(t,n){var o=e.state,r=o.dragChildrenKeys,a=o.flattenNodes,l=o.keyEntities,c=o.expandedKeys,i=o.indent,d=e.props,s=d.onDragOver,u=d.allowDrop,f=d.direction;if(e.dragNodeProps){var p=e7(t,e.dragNodeProps,n,i,e.dragStartMousePosition,u,a,l,c,f),m=p.dropPosition,h=p.dropLevelOffset,v=p.dropTargetKey,g=p.dropContainerKey,b=p.dropTargetPos,y=p.dropAllowed,x=p.dragOverNodeKey;!r.includes(v)&&y&&(e.dragNodeProps.eventKey===v&&0===h?null===e.state.dropPosition&&null===e.state.dropLevelOffset&&null===e.state.dropTargetKey&&null===e.state.dropContainerKey&&null===e.state.dropTargetPos&&!1===e.state.dropAllowed&&null===e.state.dragOverNodeKey||e.resetDragState():m===e.state.dropPosition&&h===e.state.dropLevelOffset&&v===e.state.dropTargetKey&&g===e.state.dropContainerKey&&b===e.state.dropTargetPos&&y===e.state.dropAllowed&&x===e.state.dragOverNodeKey||e.setState({dropPosition:m,dropLevelOffset:h,dropTargetKey:v,dropContainerKey:g,dropTargetPos:b,dropAllowed:y,dragOverNodeKey:x}),null==s||s({event:t,node:e0(n)}))}}),(0,E.Z)((0,tX.Z)(e),"onNodeDragLeave",function(t,n){e.currentMouseOverDroppableNodeKey!==n.eventKey||t.currentTarget.contains(t.relatedTarget)||(e.resetDragState(),e.currentMouseOverDroppableNodeKey=null);var o=e.props.onDragLeave;null==o||o({event:t,node:e0(n)})}),(0,E.Z)((0,tX.Z)(e),"onWindowDragEnd",function(t){e.onNodeDragEnd(t,null,!0),window.removeEventListener("dragend",e.onWindowDragEnd)}),(0,E.Z)((0,tX.Z)(e),"onNodeDragEnd",function(t,n){var o=e.props.onDragEnd;e.setState({dragOverNodeKey:null}),e.cleanDragState(),null==o||o({event:t,node:e0(n)}),e.dragNodeProps=null,window.removeEventListener("dragend",e.onWindowDragEnd)}),(0,E.Z)((0,tX.Z)(e),"onNodeDrop",function(t,n){var o,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=e.state,l=a.dragChildrenKeys,c=a.dropPosition,i=a.dropTargetKey,d=a.dropTargetPos;if(a.dropAllowed){var s=e.props.onDrop;if(e.setState({dragOverNodeKey:null}),e.cleanDragState(),null!==i){var u=(0,C.Z)((0,C.Z)({},eQ(i,e.getTreeNodeRequiredProps())),{},{active:(null===(o=e.getActiveItem())||void 0===o?void 0:o.key)===i,data:e.state.keyEntities[i].node}),f=l.includes(i);(0,O.ZP)(!f,"Can not drop to dragNode's children node. This is a bug of rc-tree. Please report an issue.");var p=e5(d),m={event:t,node:e0(u),dragNode:e.dragNodeProps?e0(e.dragNodeProps):null,dragNodesKeys:[e.dragNodeProps.eventKey].concat(l),dropToGap:0!==c,dropPosition:c+Number(p[p.length-1])};r||null==s||s(m),e.dragNodeProps=null}}}),(0,E.Z)((0,tX.Z)(e),"cleanDragState",function(){null!==e.state.draggingNodeKey&&e.setState({draggingNodeKey:null,dropPosition:null,dropContainerKey:null,dropTargetKey:null,dropLevelOffset:null,dropAllowed:!0,dragOverNodeKey:null}),e.dragStartMousePosition=null,e.currentMouseOverDroppableNodeKey=null}),(0,E.Z)((0,tX.Z)(e),"triggerExpandActionExpand",function(t,n){var o=e.state,r=o.expandedKeys,a=o.flattenNodes,l=n.expanded,c=n.key;if(!n.isLeaf&&!t.shiftKey&&!t.metaKey&&!t.ctrlKey){var i=a.filter(function(e){return e.key===c})[0],d=e0((0,C.Z)((0,C.Z)({},eQ(c,e.getTreeNodeRequiredProps())),{},{data:i.data}));e.setExpandedKeys(l?e8(r,c):e6(r,c)),e.onNodeExpand(t,d)}}),(0,E.Z)((0,tX.Z)(e),"onNodeClick",function(t,n){var o=e.props,r=o.onClick;"click"===o.expandAction&&e.triggerExpandActionExpand(t,n),null==r||r(t,n)}),(0,E.Z)((0,tX.Z)(e),"onNodeDoubleClick",function(t,n){var o=e.props,r=o.onDoubleClick;"doubleClick"===o.expandAction&&e.triggerExpandActionExpand(t,n),null==r||r(t,n)}),(0,E.Z)((0,tX.Z)(e),"onNodeSelect",function(t,n){var o=e.state.selectedKeys,r=e.state,a=r.keyEntities,l=r.fieldNames,c=e.props,i=c.onSelect,d=c.multiple,s=n.selected,u=n[l.key],f=!s,p=(o=f?d?e6(o,u):[u]:e8(o,u)).map(function(e){var t=a[e];return t?t.node:null}).filter(Boolean);e.setUncontrolledState({selectedKeys:o}),null==i||i(o,{event:"select",selected:f,node:n,selectedNodes:p,nativeEvent:t.nativeEvent})}),(0,E.Z)((0,tX.Z)(e),"onNodeCheck",function(t,n,o){var r,a=e.state,l=a.keyEntities,c=a.checkedKeys,i=a.halfCheckedKeys,d=e.props,s=d.checkStrictly,u=d.onCheck,f=n.key,p={event:"check",node:n,checked:o,nativeEvent:t.nativeEvent};if(s){var m=o?e6(c,f):e8(c,f);r={checked:m,halfChecked:e8(i,f)},p.checkedNodes=m.map(function(e){return l[e]}).filter(Boolean).map(function(e){return e.node}),e.setUncontrolledState({checkedKeys:m})}else{var h=tr([].concat((0,el.Z)(c),[f]),!0,l),v=h.checkedKeys,g=h.halfCheckedKeys;if(!o){var b=new Set(v);b.delete(f);var y=tr(Array.from(b),{checked:!1,halfCheckedKeys:g},l);v=y.checkedKeys,g=y.halfCheckedKeys}r=v,p.checkedNodes=[],p.checkedNodesPositions=[],p.halfCheckedKeys=g,v.forEach(function(e){var t=l[e];if(t){var n=t.node,o=t.pos;p.checkedNodes.push(n),p.checkedNodesPositions.push({node:n,pos:o})}}),e.setUncontrolledState({checkedKeys:v},!1,{halfCheckedKeys:g})}null==u||u(r,p)}),(0,E.Z)((0,tX.Z)(e),"onNodeLoad",function(t){var n,o=t.key,r=e.state.keyEntities[o];if(null==r||null===(n=r.children)||void 0===n||!n.length){var a=new Promise(function(n,r){e.setState(function(a){var l=a.loadedKeys,c=a.loadingKeys,i=void 0===c?[]:c,d=e.props,s=d.loadData,u=d.onLoad;return!s||(void 0===l?[]:l).includes(o)||i.includes(o)?null:(s(t).then(function(){var r=e6(e.state.loadedKeys,o);null==u||u(r,{event:"load",node:t}),e.setUncontrolledState({loadedKeys:r}),e.setState(function(e){return{loadingKeys:e8(e.loadingKeys,o)}}),n()}).catch(function(t){if(e.setState(function(e){return{loadingKeys:e8(e.loadingKeys,o)}}),e.loadingRetryTimes[o]=(e.loadingRetryTimes[o]||0)+1,e.loadingRetryTimes[o]>=10){var a=e.state.loadedKeys;(0,O.ZP)(!1,"Retry for `loadData` many times but still failed. No more retry."),e.setUncontrolledState({loadedKeys:e6(a,o)}),n()}r(t)}),{loadingKeys:e6(i,o)})})});return a.catch(function(){}),a}}),(0,E.Z)((0,tX.Z)(e),"onNodeMouseEnter",function(t,n){var o=e.props.onMouseEnter;null==o||o({event:t,node:n})}),(0,E.Z)((0,tX.Z)(e),"onNodeMouseLeave",function(t,n){var o=e.props.onMouseLeave;null==o||o({event:t,node:n})}),(0,E.Z)((0,tX.Z)(e),"onNodeContextMenu",function(t,n){var o=e.props.onRightClick;o&&(t.preventDefault(),o({event:t,node:n}))}),(0,E.Z)((0,tX.Z)(e),"onFocus",function(){var t=e.props.onFocus;e.setState({focused:!0});for(var n=arguments.length,o=Array(n),r=0;r1&&void 0!==arguments[1]&&arguments[1],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!e.destroyed){var r=!1,a=!0,l={};Object.keys(t).forEach(function(n){if(e.props.hasOwnProperty(n)){a=!1;return}r=!0,l[n]=t[n]}),r&&(!n||a)&&e.setState((0,C.Z)((0,C.Z)({},l),o))}}),(0,E.Z)((0,tX.Z)(e),"scrollTo",function(t){e.listRef.current.scrollTo(t)}),e}return(0,tV.Z)(n,[{key:"componentDidMount",value:function(){this.destroyed=!1,this.onUpdated()}},{key:"componentDidUpdate",value:function(){this.onUpdated()}},{key:"onUpdated",value:function(){var e=this.props,t=e.activeKey,n=e.itemScrollOffset;void 0!==t&&t!==this.state.activeKey&&(this.setState({activeKey:t}),null!==t&&this.scrollTo({key:t,offset:void 0===n?0:n}))}},{key:"componentWillUnmount",value:function(){window.removeEventListener("dragend",this.onWindowDragEnd),this.destroyed=!0}},{key:"resetDragState",value:function(){this.setState({dragOverNodeKey:null,dropPosition:null,dropLevelOffset:null,dropTargetKey:null,dropContainerKey:null,dropTargetPos:null,dropAllowed:!1})}},{key:"render",value:function(){var e,t=this.state,n=t.focused,r=t.flattenNodes,a=t.keyEntities,l=t.draggingNodeKey,c=t.activeKey,i=t.dropLevelOffset,d=t.dropContainerKey,s=t.dropTargetKey,u=t.dropPosition,f=t.dragOverNodeKey,m=t.indent,h=this.props,v=h.prefixCls,g=h.className,b=h.style,y=h.showLine,x=h.focusable,w=h.tabIndex,C=h.selectable,S=h.showIcon,N=h.icon,K=h.switcherIcon,O=h.draggable,I=h.checkable,R=h.checkStrictly,P=h.disabled,M=h.motion,T=h.loadData,D=h.filterTreeNode,L=h.height,j=h.itemHeight,B=h.scrollWidth,H=h.virtual,z=h.titleRender,A=h.dropIndicatorRender,W=h.onContextMenu,_=h.onScroll,q=h.direction,V=h.rootClassName,X=h.rootStyle,U=(0,F.Z)(this.props,{aria:!0,data:!0});O&&(e="object"===(0,k.Z)(O)?O:"function"==typeof O?{nodeDraggable:O}:{});var G={prefixCls:v,selectable:C,showIcon:S,icon:N,switcherIcon:K,draggable:e,draggingNodeKey:l,checkable:I,checkStrictly:R,disabled:P,keyEntities:a,dropLevelOffset:i,dropContainerKey:d,dropTargetKey:s,dropPosition:u,dragOverNodeKey:f,indent:m,direction:q,dropIndicatorRender:A,loadData:T,filterTreeNode:D,titleRender:z,onNodeClick:this.onNodeClick,onNodeDoubleClick:this.onNodeDoubleClick,onNodeExpand:this.onNodeExpand,onNodeSelect:this.onNodeSelect,onNodeCheck:this.onNodeCheck,onNodeLoad:this.onNodeLoad,onNodeMouseEnter:this.onNodeMouseEnter,onNodeMouseLeave:this.onNodeMouseLeave,onNodeContextMenu:this.onNodeContextMenu,onNodeDragStart:this.onNodeDragStart,onNodeDragEnter:this.onNodeDragEnter,onNodeDragOver:this.onNodeDragOver,onNodeDragLeave:this.onNodeDragLeave,onNodeDragEnd:this.onNodeDragEnd,onNodeDrop:this.onNodeDrop};return o.createElement(eW.Provider,{value:G},o.createElement("div",{className:Z()(v,g,V,(0,E.Z)((0,E.Z)((0,E.Z)({},"".concat(v,"-show-line"),y),"".concat(v,"-focused"),n),"".concat(v,"-active-focused"),null!==c)),style:X},o.createElement(nn,(0,p.Z)({ref:this.listRef,prefixCls:v,style:b,data:r,disabled:P,selectable:C,checkable:!!I,motion:M,dragging:null!==l,height:L,itemHeight:j,virtual:H,focusable:x,focused:n,tabIndex:void 0===w?0:w,activeItem:this.getActiveItem(),onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onActiveChange:this.onActiveChange,onListChangeStart:this.onListChangeStart,onListChangeEnd:this.onListChangeEnd,onContextMenu:W,onScroll:_,scrollWidth:B},this.getTreeNodeRequiredProps(),U))))}}],[{key:"getDerivedStateFromProps",value:function(e,t){var n,o,r=t.prevProps,a={prevProps:e};function l(t){return!r&&e.hasOwnProperty(t)||r&&r[t]!==e[t]}var c=t.fieldNames;if(l("fieldNames")&&(c=eG(e.fieldNames),a.fieldNames=c),l("treeData")?n=e.treeData:l("children")&&((0,O.ZP)(!1,"`children` of Tree is deprecated. Please use `treeData` instead."),n=eY(e.children)),n){a.treeData=n;var i=eJ(n,{fieldNames:c});a.keyEntities=(0,C.Z)((0,E.Z)({},t6,t7),i.keyEntities)}var d=a.keyEntities||t.keyEntities;if(l("expandedKeys")||r&&l("autoExpandParent"))a.expandedKeys=e.autoExpandParent||!r&&e.defaultExpandParent?tt(e.expandedKeys,d):e.expandedKeys;else if(!r&&e.defaultExpandAll){var s=(0,C.Z)({},d);delete s[t6];var u=[];Object.keys(s).forEach(function(e){var t=s[e];t.children&&t.children.length&&u.push(t.key)}),a.expandedKeys=u}else!r&&e.defaultExpandedKeys&&(a.expandedKeys=e.autoExpandParent||e.defaultExpandParent?tt(e.defaultExpandedKeys,d):e.defaultExpandedKeys);if(a.expandedKeys||delete a.expandedKeys,n||a.expandedKeys){var f=e$(n||t.treeData,a.expandedKeys||t.expandedKeys,c);a.flattenNodes=f}if(e.selectable&&(l("selectedKeys")?a.selectedKeys=e9(e.selectedKeys,e):!r&&e.defaultSelectedKeys&&(a.selectedKeys=e9(e.defaultSelectedKeys,e))),e.checkable&&(l("checkedKeys")?o=te(e.checkedKeys)||{}:!r&&e.defaultCheckedKeys?o=te(e.defaultCheckedKeys)||{}:n&&(o=te(e.checkedKeys)||{checkedKeys:t.checkedKeys,halfCheckedKeys:t.halfCheckedKeys}),o)){var p=o,m=p.checkedKeys,h=void 0===m?[]:m,v=p.halfCheckedKeys,g=void 0===v?[]:v;if(!e.checkStrictly){var b=tr(h,!0,d);h=b.checkedKeys,g=b.halfCheckedKeys}a.checkedKeys=h,a.halfCheckedKeys=g}return l("loadedKeys")&&(a.loadedKeys=e.loadedKeys),a}}]),n}(o.Component);(0,E.Z)(no,"defaultProps",{prefixCls:"rc-tree",showLine:!1,showIcon:!0,selectable:!0,multiple:!1,checkable:!1,disabled:!1,checkStrictly:!1,draggable:!1,defaultExpandParent:!0,autoExpandParent:!1,defaultExpandAll:!1,defaultExpandedKeys:[],defaultCheckedKeys:[],defaultSelectedKeys:[],dropIndicatorRender:function(e){var t=e.dropPosition,n=e.dropLevelOffset,r=e.indent,a={pointerEvents:"none",position:"absolute",right:0,backgroundColor:"red",height:2};switch(t){case -1:a.top=0,a.left=-n*r;break;case 1:a.bottom=0,a.left=-n*r;break;case 0:a.bottom=0,a.left=r}return o.createElement("div",{style:a})},allowDrop:function(){return!0},expandAction:!1}),(0,E.Z)(no,"TreeNode",e4);var nr={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494z"}}]},name:"file",theme:"outlined"},na=o.forwardRef(function(e,t){return o.createElement(tL.Z,(0,p.Z)({},e,{ref:t,icon:nr}))}),nl={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M928 444H820V330.4c0-17.7-14.3-32-32-32H473L355.7 186.2a8.15 8.15 0 00-5.5-2.2H96c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h698c13 0 24.8-7.9 29.7-20l134-332c1.5-3.8 2.3-7.9 2.3-12 0-17.7-14.3-32-32-32zM136 256h188.5l119.6 114.4H748V444H238c-13 0-24.8 7.9-29.7 20L136 643.2V256zm635.3 512H159l103.3-256h612.4L771.3 768z"}}]},name:"folder-open",theme:"outlined"},nc=o.forwardRef(function(e,t){return o.createElement(tL.Z,(0,p.Z)({},e,{ref:t,icon:nl}))}),ni={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 298.4H521L403.7 186.2a8.15 8.15 0 00-5.5-2.2H144c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V330.4c0-17.7-14.3-32-32-32zM840 768H184V256h188.5l119.6 114.4H840V768z"}}]},name:"folder",theme:"outlined"},nd=o.forwardRef(function(e,t){return o.createElement(tL.Z,(0,p.Z)({},e,{ref:t,icon:ni}))}),ns={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M300 276.5a56 56 0 1056-97 56 56 0 00-56 97zm0 284a56 56 0 1056-97 56 56 0 00-56 97zM640 228a56 56 0 10112 0 56 56 0 00-112 0zm0 284a56 56 0 10112 0 56 56 0 00-112 0zM300 844.5a56 56 0 1056-97 56 56 0 00-56 97zM640 796a56 56 0 10112 0 56 56 0 00-112 0z"}}]},name:"holder",theme:"outlined"},nu=o.forwardRef(function(e,t){return o.createElement(tL.Z,(0,p.Z)({},e,{ref:t,icon:ns}))}),nf=n(68710),np=n(86586),nm=n(93463),nh=n(23159),nv=n(12918),ng=n(63074),nb=n(71140),ny=n(99320);let nx=e=>{let{treeCls:t,treeNodeCls:n,directoryNodeSelectedBg:o,directoryNodeSelectedColor:r,motionDurationMid:a,borderRadius:l,controlItemBgHover:c}=e;return{["".concat(t).concat(t,"-directory ").concat(n)]:{["".concat(t,"-node-content-wrapper")]:{position:"static",["&:has(".concat(t,"-drop-indicator)")]:{position:"relative"},["> *:not(".concat(t,"-drop-indicator)")]:{position:"relative"},"&:hover":{background:"transparent"},"&:before":{position:"absolute",inset:0,transition:"background-color ".concat(a),content:'""',borderRadius:l},"&:hover:before":{background:c}},["".concat(t,"-switcher, ").concat(t,"-checkbox, ").concat(t,"-draggable-icon")]:{zIndex:1},"&-selected":{background:o,borderRadius:l,["".concat(t,"-switcher, ").concat(t,"-draggable-icon")]:{color:r},["".concat(t,"-node-content-wrapper")]:{color:r,background:"transparent","&, &:hover":{color:r},"&:before, &:hover:before":{background:o}}}}}},nw=new nm.E4("ant-tree-node-fx-do-not-use",{"0%":{opacity:0},"100%":{opacity:1}}),nk=(e,t)=>({[".".concat(e,"-switcher-icon")]:{display:"inline-block",fontSize:10,verticalAlign:"baseline",svg:{transition:"transform ".concat(t.motionDurationSlow)}}}),nC=(e,t)=>({[".".concat(e,"-drop-indicator")]:{position:"absolute",zIndex:1,height:2,backgroundColor:t.colorPrimary,borderRadius:1,pointerEvents:"none","&:after":{position:"absolute",top:-3,insetInlineStart:-6,width:8,height:8,backgroundColor:"transparent",border:"".concat((0,nm.bf)(t.lineWidthBold)," solid ").concat(t.colorPrimary),borderRadius:"50%",content:'""'}}}),nE=(e,t)=>{let{treeCls:n,treeNodeCls:o,treeNodePadding:r,titleHeight:a,indentSize:l,nodeSelectedBg:c,nodeHoverBg:i,colorTextQuaternary:d,controlItemBgActiveDisabled:s}=t;return{[n]:Object.assign(Object.assign({},(0,nv.Wf)(t)),{"--rc-virtual-list-scrollbar-bg":t.colorSplit,background:t.colorBgContainer,borderRadius:t.borderRadius,transition:"background-color ".concat(t.motionDurationSlow),"&-rtl":{direction:"rtl"},["&".concat(n,"-rtl ").concat(n,"-switcher_close ").concat(n,"-switcher-icon svg")]:{transform:"rotate(90deg)"},["&-focused:not(:hover):not(".concat(n,"-active-focused)")]:(0,nv.oN)(t),["".concat(n,"-list-holder-inner")]:{alignItems:"flex-start"},["&".concat(n,"-block-node")]:{["".concat(n,"-list-holder-inner")]:{alignItems:"stretch",["".concat(n,"-node-content-wrapper")]:{flex:"auto"},["".concat(o,".dragging:after")]:{position:"absolute",inset:0,border:"1px solid ".concat(t.colorPrimary),opacity:0,animationName:nw,animationDuration:t.motionDurationSlow,animationPlayState:"running",animationFillMode:"forwards",content:'""',pointerEvents:"none",borderRadius:t.borderRadius}}},[o]:{display:"flex",alignItems:"flex-start",marginBottom:r,lineHeight:(0,nm.bf)(a),position:"relative","&:before":{content:'""',position:"absolute",zIndex:1,insetInlineStart:0,width:"100%",top:"100%",height:r},["&-disabled ".concat(n,"-node-content-wrapper")]:{color:t.colorTextDisabled,cursor:"not-allowed","&:hover":{background:"transparent"}},["".concat(n,"-checkbox-disabled + ").concat(n,"-node-selected,&").concat(o,"-disabled").concat(o,"-selected ").concat(n,"-node-content-wrapper")]:{backgroundColor:s},["".concat(n,"-checkbox-disabled")]:{pointerEvents:"unset"},["&:not(".concat(o,"-disabled)")]:{["".concat(n,"-node-content-wrapper")]:{"&:hover":{color:t.nodeHoverColor}}},["&-active ".concat(n,"-node-content-wrapper")]:{background:t.controlItemBgHover},["&:not(".concat(o,"-disabled).filter-node ").concat(n,"-title")]:{color:t.colorPrimary,fontWeight:t.fontWeightStrong},"&-draggable":{cursor:"grab",["".concat(n,"-draggable-icon")]:{flexShrink:0,width:a,textAlign:"center",visibility:"visible",color:d},["&".concat(o,"-disabled ").concat(n,"-draggable-icon")]:{visibility:"hidden"}}},["".concat(n,"-indent")]:{alignSelf:"stretch",whiteSpace:"nowrap",userSelect:"none","&-unit":{display:"inline-block",width:l}},["".concat(n,"-draggable-icon")]:{visibility:"hidden"},["".concat(n,"-switcher, ").concat(n,"-checkbox")]:{marginInlineEnd:t.calc(t.calc(a).sub(t.controlInteractiveSize)).div(2).equal()},["".concat(n,"-switcher")]:Object.assign(Object.assign({},nk(e,t)),{position:"relative",flex:"none",alignSelf:"stretch",width:a,textAlign:"center",cursor:"pointer",userSelect:"none",transition:"all ".concat(t.motionDurationSlow),"&-noop":{cursor:"unset"},"&:before":{pointerEvents:"none",content:'""',width:a,height:a,position:"absolute",left:{_skip_check_:!0,value:0},top:0,borderRadius:t.borderRadius,transition:"all ".concat(t.motionDurationSlow)},["&:not(".concat(n,"-switcher-noop):hover:before")]:{backgroundColor:t.colorBgTextHover},["&_close ".concat(n,"-switcher-icon svg")]:{transform:"rotate(-90deg)"},"&-loading-icon":{color:t.colorPrimary},"&-leaf-line":{position:"relative",zIndex:1,display:"inline-block",width:"100%",height:"100%","&:before":{position:"absolute",top:0,insetInlineEnd:t.calc(a).div(2).equal(),bottom:t.calc(r).mul(-1).equal(),marginInlineStart:-1,borderInlineEnd:"1px solid ".concat(t.colorBorder),content:'""'},"&:after":{position:"absolute",width:t.calc(t.calc(a).div(2).equal()).mul(.8).equal(),height:t.calc(a).div(2).equal(),borderBottom:"1px solid ".concat(t.colorBorder),content:'""'}}}),["".concat(n,"-node-content-wrapper")]:Object.assign(Object.assign({position:"relative",minHeight:a,paddingBlock:0,paddingInline:t.paddingXS,background:"transparent",borderRadius:t.borderRadius,cursor:"pointer",transition:"all ".concat(t.motionDurationMid,", border 0s, line-height 0s, box-shadow 0s")},nC(e,t)),{"&:hover":{backgroundColor:i},["&".concat(n,"-node-selected")]:{color:t.nodeSelectedColor,backgroundColor:c},["".concat(n,"-iconEle")]:{display:"inline-block",width:a,height:a,textAlign:"center",verticalAlign:"top","&:empty":{display:"none"}}}),["".concat(n,"-unselectable ").concat(n,"-node-content-wrapper:hover")]:{backgroundColor:"transparent"},["".concat(o,".drop-container > [draggable]")]:{boxShadow:"0 0 0 2px ".concat(t.colorPrimary)},"&-show-line":{["".concat(n,"-indent-unit")]:{position:"relative",height:"100%","&:before":{position:"absolute",top:0,insetInlineEnd:t.calc(a).div(2).equal(),bottom:t.calc(r).mul(-1).equal(),borderInlineEnd:"1px solid ".concat(t.colorBorder),content:'""'},"&-end:before":{display:"none"}},["".concat(n,"-switcher")]:{background:"transparent","&-line-icon":{verticalAlign:"-0.15em"}}},["".concat(o,"-leaf-last ").concat(n,"-switcher-leaf-line:before")]:{top:"auto !important",bottom:"auto !important",height:"".concat((0,nm.bf)(t.calc(a).div(2).equal())," !important")}})}},nS=function(e,t){let n=!(arguments.length>2)||void 0===arguments[2]||arguments[2],o=".".concat(e),r=t.calc(t.paddingXS).div(2).equal(),a=(0,nb.IX)(t,{treeCls:o,treeNodeCls:"".concat(o,"-treenode"),treeNodePadding:r});return[nE(e,a),n&&nx(a)].filter(Boolean)},nZ=e=>{let{controlHeightSM:t,controlItemBgHover:n,controlItemBgActive:o}=e;return{titleHeight:t,indentSize:t,nodeHoverBg:n,nodeHoverColor:e.colorText,nodeSelectedBg:o,nodeSelectedColor:e.colorText}};var nN=(0,ny.I$)("Tree",(e,t)=>{let{prefixCls:n}=t;return[{[e.componentCls]:(0,nh.C2)("".concat(n,"-checkbox"),e)},nS(n,e),(0,ng.Z)(e)]},e=>{let{colorTextLightSolid:t,colorPrimary:n}=e;return Object.assign(Object.assign({},nZ(e)),{directoryNodeSelectedColor:t,directoryNodeSelectedBg:n})}),nK=function(e){let{dropPosition:t,dropLevelOffset:n,prefixCls:r,indent:a,direction:l="ltr"}=e,c="ltr"===l?"left":"right",i={[c]:-n*a+4,["ltr"===l?"right":"left"]:0};switch(t){case -1:i.top=-3;break;case 1:i.bottom=-3;break;default:i.bottom=-3,i[c]=a+4}return o.createElement("div",{style:i,className:"".concat(r,"-drop-indicator")})},nO={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z"}}]},name:"caret-down",theme:"filled"},nI=o.forwardRef(function(e,t){return o.createElement(tL.Z,(0,p.Z)({},e,{ref:t,icon:nO}))}),nR=n(61935),nP={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M328 544h368c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z"}},{tag:"path",attrs:{d:"M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z"}}]},name:"minus-square",theme:"outlined"},nM=o.forwardRef(function(e,t){return o.createElement(tL.Z,(0,p.Z)({},e,{ref:t,icon:nP}))}),nT={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M328 544h152v152c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V544h152c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H544V328c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v152H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z"}},{tag:"path",attrs:{d:"M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z"}}]},name:"plus-square",theme:"outlined"},nD=o.forwardRef(function(e,t){return o.createElement(tL.Z,(0,p.Z)({},e,{ref:t,icon:nT}))}),nL=n(19722),nj=e=>{var t,n;let r;let{prefixCls:a,switcherIcon:l,treeNodeProps:c,showLine:i,switcherLoadingIcon:d}=e,{isLeaf:s,expanded:u,loading:f}=c;if(f)return o.isValidElement(d)?d:o.createElement(nR.Z,{className:"".concat(a,"-switcher-loading-icon")});if(i&&"object"==typeof i&&(r=i.showLeafIcon),s){if(!i)return null;if("boolean"!=typeof r&&r){let e="function"==typeof r?r(c):r;return o.isValidElement(e)?(0,nL.Tm)(e,{className:Z()(null===(t=e.props)||void 0===t?void 0:t.className,"".concat(a,"-switcher-line-custom-icon"))}):e}return r?o.createElement(na,{className:"".concat(a,"-switcher-line-icon")}):o.createElement("span",{className:"".concat(a,"-switcher-leaf-line")})}let p="".concat(a,"-switcher-icon"),m="function"==typeof l?l(c):l;return o.isValidElement(m)?(0,nL.Tm)(m,{className:Z()(null===(n=m.props)||void 0===n?void 0:n.className,p)}):void 0!==m?m:i?u?o.createElement(nM,{className:"".concat(a,"-switcher-line-icon")}):o.createElement(nD,{className:"".concat(a,"-switcher-line-icon")}):o.createElement(nI,{className:p})};let nB=o.forwardRef((e,t)=>{var n;let{getPrefixCls:r,direction:a,virtual:l,tree:c}=o.useContext(tk.E_),{prefixCls:i,className:d,showIcon:s=!1,showLine:u,switcherIcon:f,switcherLoadingIcon:p,blockNode:m=!1,children:h,checkable:v=!1,selectable:g=!0,draggable:b,disabled:y,motion:x,style:w}=e,k=r("tree",i),C=r(),E=o.useContext(np.Z),S=null!=y?y:E,N=null!=x?x:Object.assign(Object.assign({},(0,nf.Z)(C)),{motionAppear:!1}),K=Object.assign(Object.assign({},e),{checkable:v,selectable:g,showIcon:s,motion:N,blockNode:m,disabled:S,showLine:!!u,dropIndicatorRender:nK}),[O,I,R]=nN(k),[,P]=(0,tI.ZP)(),M=P.paddingXS/2+((null===(n=P.Tree)||void 0===n?void 0:n.titleHeight)||P.controlHeightSM),T=o.useMemo(()=>{if(!b)return!1;let e={};switch(typeof b){case"function":e.nodeDraggable=b;break;case"object":e=Object.assign({},b)}return!1!==e.icon&&(e.icon=e.icon||o.createElement(nu,null)),e},[b]);return O(o.createElement(no,Object.assign({itemHeight:M,ref:t,virtual:l},K,{style:Object.assign(Object.assign({},null==c?void 0:c.style),w),prefixCls:k,className:Z()({["".concat(k,"-icon-hide")]:!s,["".concat(k,"-block-node")]:m,["".concat(k,"-unselectable")]:!g,["".concat(k,"-rtl")]:"rtl"===a,["".concat(k,"-disabled")]:S},null==c?void 0:c.className,d,I,R),direction:a,checkable:v?o.createElement("span",{className:"".concat(k,"-checkbox-inner")}):v,selectable:g,switcherIcon:e=>o.createElement(nj,{prefixCls:k,switcherIcon:f,switcherLoadingIcon:p,treeNodeProps:e,showLine:u}),draggable:T}),h))});function nH(e,t,n){let{key:o,children:r}=n;e.forEach(function(e){let a=e[o],l=e[r];!1!==t(a,e)&&nH(l||[],t,n)})}var nz=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,o=Object.getOwnPropertySymbols(e);rt.indexOf(o[r])&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]]);return n};function nA(e){let{isLeaf:t,expanded:n}=e;return t?o.createElement(na,null):n?o.createElement(nc,null):o.createElement(nd,null)}function nW(e){let{treeData:t,children:n}=e;return t||eY(n)}let n_=o.forwardRef((e,t)=>{var{defaultExpandAll:n,defaultExpandParent:r,defaultExpandedKeys:a}=e,l=nz(e,["defaultExpandAll","defaultExpandParent","defaultExpandedKeys"]);let c=o.useRef(null),i=o.useRef(null),d=()=>{let{keyEntities:e}=eJ(nW(l),{fieldNames:l.fieldNames});return n?Object.keys(e):r?tt(l.expandedKeys||a||[],e):l.expandedKeys||a||[]},[s,u]=o.useState(l.selectedKeys||l.defaultSelectedKeys||[]),[f,p]=o.useState(()=>d());o.useEffect(()=>{"selectedKeys"in l&&u(l.selectedKeys)},[l.selectedKeys]),o.useEffect(()=>{"expandedKeys"in l&&p(l.expandedKeys)},[l.expandedKeys]);let{getPrefixCls:m,direction:h}=o.useContext(tk.E_),{prefixCls:v,className:g,showIcon:b=!0,expandAction:y="click"}=l,x=nz(l,["prefixCls","className","showIcon","expandAction"]),w=m("tree",v),k=Z()("".concat(w,"-directory"),{["".concat(w,"-directory-rtl")]:"rtl"===h},g);return o.createElement(nB,Object.assign({icon:nA,ref:t,blockNode:!0},x,{showIcon:b,expandAction:y,prefixCls:w,className:k,expandedKeys:f,selectedKeys:s,onSelect:(e,t)=>{var n;let o;let{multiple:r,fieldNames:a}=l,{node:d,nativeEvent:s}=t,{key:p=""}=d,m=nW(l),h=Object.assign(Object.assign({},t),{selected:!0}),v=(null==s?void 0:s.ctrlKey)||(null==s?void 0:s.metaKey),g=null==s?void 0:s.shiftKey;r&&v?(o=e,c.current=p,i.current=o):r&&g?o=Array.from(new Set([].concat((0,el.Z)(i.current||[]),(0,el.Z)(function(e){let{treeData:t,expandedKeys:n,startKey:o,endKey:r,fieldNames:a}=e,l=[],c=0;return o&&o===r?[o]:o&&r?(nH(t,e=>{if(2===c)return!1;if(e===o||e===r){if(l.push(e),0===c)c=1;else if(1===c)return c=2,!1}else 1===c&&l.push(e);return n.includes(e)},eG(a)),l):[]}({treeData:m,expandedKeys:f,startKey:p,endKey:c.current,fieldNames:a}))))):(o=[p],c.current=p,i.current=o),h.selectedNodes=function(e,t,n){let o=(0,el.Z)(t),r=[];return nH(e,(e,t)=>{let n=o.indexOf(e);return -1!==n&&(r.push(t),o.splice(n,1)),!!o.length},eG(n)),r}(m,o,a),null===(n=l.onSelect)||void 0===n||n.call(l,o,h),"selectedKeys"in l||u(o)},onExpand:(e,t)=>{var n;return"expandedKeys"in l||p(e),null===(n=l.onExpand)||void 0===n?void 0:n.call(l,e,t)}}))});nB.DirectoryTree=n_,nB.TreeNode=e4;var nF=n(29436),nq=n(39454),nV=e=>{let{value:t,filterSearch:n,tablePrefixCls:r,locale:a,onChange:l}=e;return n?o.createElement("div",{className:"".concat(r,"-filter-dropdown-search")},o.createElement(nq.Z,{prefix:o.createElement(nF.Z,null),placeholder:a.filterSearchPlaceholder,onChange:l,value:t,htmlSize:1,className:"".concat(r,"-filter-dropdown-search-input")})):null};let nX=e=>{let{keyCode:t}=e;t===tY.Z.ENTER&&e.stopPropagation()},nU=o.forwardRef((e,t)=>o.createElement("div",{className:e.className,onClick:e=>e.stopPropagation(),onKeyDown:nX,ref:t},e.children));function nG(e){let t=[];return(e||[]).forEach(e=>{let{value:n,children:o}=e;t.push(n),o&&(t=[].concat((0,el.Z)(t),(0,el.Z)(nG(o))))}),t}function nY(e,t){return("string"==typeof t||"number"==typeof t)&&(null==t?void 0:t.toString().toLowerCase().includes(e.trim().toLowerCase()))}var n$=e=>{var t,n,r,a;let l,c;let{tablePrefixCls:i,prefixCls:s,column:u,dropdownPrefixCls:f,columnKey:p,filterOnClose:m,filterMultiple:h,filterMode:v="menu",filterSearch:g=!1,filterState:b,triggerFilter:y,locale:x,children:w,getPopupContainer:k,rootClassName:C}=e,{filterResetToDefaultFilteredValue:E,defaultFilteredValue:S,filterDropdownProps:N={},filterDropdownOpen:K,filterDropdownVisible:O,onFilterDropdownVisibleChange:I,onFilterDropdownOpenChange:R}=u,[P,M]=o.useState(!1),T=!!(b&&((null===(t=b.filteredKeys)||void 0===t?void 0:t.length)||b.forceFiltered)),D=e=>{var t;M(e),null===(t=N.onOpenChange)||void 0===t||t.call(N,e),null==R||R(e),null==I||I(e)},L=null!==(a=null!==(r=null!==(n=N.open)&&void 0!==n?n:K)&&void 0!==r?r:O)&&void 0!==a?a:P,j=null==b?void 0:b.filteredKeys,[B,H]=tz(j||[]),z=e=>{let{selectedKeys:t}=e;H(t)},A=(e,t)=>{let{node:n,checked:o}=t;h?z({selectedKeys:e}):z({selectedKeys:o&&n.key?[n.key]:[]})};o.useEffect(()=>{P&&z({selectedKeys:j||[]})},[j]);let[W,_]=o.useState([]),F=e=>{_(e)},[q,V]=o.useState(""),X=e=>{let{value:t}=e.target;V(t)};o.useEffect(()=>{P||V("")},[P]);let U=e=>{let t=(null==e?void 0:e.length)?e:null;if(null===t&&(!b||!b.filteredKeys)||(0,d.Z)(t,null==b?void 0:b.filteredKeys,!0))return null;y({column:u,key:p,filteredKeys:t})},G=()=>{D(!1),U(B())},Y=function(){let{confirm:e,closeDropdown:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{confirm:!1,closeDropdown:!1};e&&U([]),t&&D(!1),V(""),E?H((S||[]).map(e=>String(e))):H([])},$=Z()({["".concat(f,"-menu-without-submenu")]:!(u.filters||[]).some(e=>{let{children:t}=e;return t})}),J=e=>{e.target.checked?H(nG(null==u?void 0:u.filters).map(e=>String(e))):H([])},Q=e=>{let{filters:t}=e;return(t||[]).map((e,t)=>{let n=String(e.value),o={title:e.text,key:void 0!==e.value?n:String(t)};return e.children&&(o.children=Q({filters:e.children})),o})},ee=e=>{var t;return Object.assign(Object.assign({},e),{text:e.title,value:e.key,children:(null===(t=e.children)||void 0===t?void 0:t.map(e=>ee(e)))||[]})},{direction:et,renderEmpty:en}=o.useContext(tk.E_);if("function"==typeof u.filterDropdown)l=u.filterDropdown({prefixCls:"".concat(f,"-custom"),setSelectedKeys:e=>z({selectedKeys:e}),selectedKeys:B(),confirm:function(){let{closeDropdown:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{closeDropdown:!0};e&&D(!1),U(B())},clearFilters:Y,filters:u.filters,visible:L,close:()=>{D(!1)}});else if(u.filterDropdown)l=u.filterDropdown;else{let e=B()||[];l=o.createElement(o.Fragment,null,(()=>{var t,n;let r=null!==(t=null==en?void 0:en("Table.filter"))&&void 0!==t?t:o.createElement(tW.Z,{image:tW.Z.PRESENTED_IMAGE_SIMPLE,description:x.filterEmptyText,styles:{image:{height:24}},style:{margin:0,padding:"16px 0"}});if(0===(u.filters||[]).length)return r;if("tree"===v)return o.createElement(o.Fragment,null,o.createElement(nV,{filterSearch:g,value:q,onChange:X,tablePrefixCls:i,locale:x}),o.createElement("div",{className:"".concat(i,"-filter-dropdown-tree")},h?o.createElement(ti.Z,{checked:e.length===nG(u.filters).length,indeterminate:e.length>0&&e.length"function"==typeof g?g(q,ee(e)):nY(q,e.title):void 0})));let a=function e(t){let{filters:n,prefixCls:r,filteredKeys:a,filterMultiple:l,searchValue:c,filterSearch:i}=t;return n.map((t,n)=>{let d=String(t.value);if(t.children)return{key:d||n,label:t.text,popupClassName:"".concat(r,"-dropdown-submenu"),children:e({filters:t.children,prefixCls:r,filteredKeys:a,filterMultiple:l,searchValue:c,filterSearch:i})};let s=l?ti.Z:ts.ZP,u={key:void 0!==t.value?d:n,label:o.createElement(o.Fragment,null,o.createElement(s,{checked:a.includes(d)}),o.createElement("span",null,t.text))};return c.trim()?"function"==typeof i?i(c,t)?u:null:nY(c,t.text)?u:null:u})}({filters:u.filters||[],filterSearch:g,prefixCls:s,filteredKeys:B(),filterMultiple:h,searchValue:q}),l=a.every(e=>null===e);return o.createElement(o.Fragment,null,o.createElement(nV,{filterSearch:g,value:q,onChange:X,tablePrefixCls:i,locale:x}),l?r:o.createElement(t_.Z,{selectable:!0,multiple:h,prefixCls:"".concat(f,"-menu"),className:$,onSelect:z,onDeselect:z,selectedKeys:e,getPopupContainer:k,openKeys:W,onOpenChange:F,items:a}))})(),o.createElement("div",{className:"".concat(s,"-dropdown-btns")},o.createElement(tA.ZP,{type:"link",size:"small",disabled:E?(0,d.Z)((S||[]).map(e=>String(e)),e,!0):0===e.length,onClick:()=>Y()},x.filterReset),o.createElement(tA.ZP,{type:"primary",size:"small",onClick:G},x.filterConfirm)))}u.filterDropdown&&(l=o.createElement(tF.J,{selectable:void 0},l)),l=o.createElement(nU,{className:"".concat(s,"-dropdown")},l);let eo=(0,tB.Z)({trigger:["click"],placement:"rtl"===et?"bottomLeft":"bottomRight",children:(c="function"==typeof u.filterIcon?u.filterIcon(T):u.filterIcon?u.filterIcon:o.createElement(tj,null),o.createElement("span",{role:"button",tabIndex:-1,className:Z()("".concat(s,"-trigger"),{active:T}),onClick:e=>{e.stopPropagation()}},c)),getPopupContainer:k},Object.assign(Object.assign({},N),{rootClassName:Z()(C,N.rootClassName),open:L,onOpenChange:(e,t)=>{"trigger"===t.source&&(e&&void 0!==j&&H(j||[]),D(e),e||u.filterDropdown||!m||G())},popupRender:()=>"function"==typeof(null==N?void 0:N.dropdownRender)?N.dropdownRender(l):l}));return o.createElement("div",{className:"".concat(s,"-column")},o.createElement("span",{className:"".concat(i,"-column-title")},w),o.createElement(td.Z,Object.assign({},eo)))};let nJ=(e,t,n)=>{let o=[];return(e||[]).forEach((e,r)=>{var a;let l=tP(r,n),c=void 0!==e.filterDropdown;if(e.filters||c||"onFilter"in e){if("filteredValue"in e){let t=e.filteredValue;c||(t=null!==(a=null==t?void 0:t.map(String))&&void 0!==a?a:t),o.push({column:e,key:tR(e,l),filteredKeys:t,forceFiltered:e.filtered})}else o.push({column:e,key:tR(e,l),filteredKeys:t&&e.defaultFilteredValue?e.defaultFilteredValue:void 0,forceFiltered:e.filtered})}"children"in e&&(o=[].concat((0,el.Z)(o),(0,el.Z)(nJ(e.children,t,l))))}),o},nQ=e=>{let t={};return e.forEach(e=>{let{key:n,filteredKeys:o,column:r}=e,{filters:a,filterDropdown:l}=r;if(l)t[n]=o||null;else if(Array.isArray(o)){let e=nG(a);t[n]=e.filter(e=>o.includes(String(e)))}else t[n]=null}),t},n0=(e,t,n)=>t.reduce((e,o)=>{let{column:{onFilter:r,filters:a},filteredKeys:l}=o;return r&&l&&l.length?e.map(e=>Object.assign({},e)).filter(e=>l.some(o=>{let l=nG(a),c=l.findIndex(e=>String(e)===String(o)),i=-1!==c?l[c]:o;return e[n]&&(e[n]=n0(e[n],t,n)),r(i,e)})):e},e),n1=e=>e.flatMap(e=>"children"in e?[e].concat((0,el.Z)(n1(e.children||[]))):[e]);var n2=e=>{let{prefixCls:t,dropdownPrefixCls:n,mergedColumns:r,onFilterChange:a,getPopupContainer:l,locale:c,rootClassName:i}=e;(0,tc.ln)("Table");let d=o.useMemo(()=>n1(r||[]),[r]),[s,u]=o.useState(()=>nJ(d,!0)),f=o.useMemo(()=>{let e=nJ(d,!1);if(0===e.length)return e;let t=!0;if(e.forEach(e=>{let{filteredKeys:n}=e;void 0!==n&&(t=!1)}),t){let e=(d||[]).map((e,t)=>tR(e,tP(t)));return s.filter(t=>{let{key:n}=t;return e.includes(n)}).map(t=>{let n=d[e.indexOf(t.key)];return Object.assign(Object.assign({},t),{column:Object.assign(Object.assign({},t.column),n),forceFiltered:n.filtered})})}return e},[d,s]),p=o.useMemo(()=>nQ(f),[f]),m=e=>{let t=f.filter(t=>{let{key:n}=t;return n!==e.key});t.push(e),u(t),a(nQ(t),t)};return[e=>(function e(t,n,r,a,l,c,i,d,s){return r.map((r,u)=>{let f=tP(u,d),{filterOnClose:p=!0,filterMultiple:m=!0,filterMode:h,filterSearch:v}=r,g=r;if(g.filters||g.filterDropdown){let e=tR(g,f),d=a.find(t=>{let{key:n}=t;return e===n});g=Object.assign(Object.assign({},g),{title:a=>o.createElement(n$,{tablePrefixCls:t,prefixCls:"".concat(t,"-filter"),dropdownPrefixCls:n,column:g,columnKey:e,filterState:d,filterOnClose:p,filterMultiple:m,filterMode:h,filterSearch:v,triggerFilter:c,locale:l,getPopupContainer:i,rootClassName:s},tM(r.title,a))})}return"children"in g&&(g=Object.assign(Object.assign({},g),{children:e(t,n,g.children,a,l,c,i,f,s)})),g})})(t,n,e,f,c,m,l,void 0,i),f,p]},n3=(e,t,n)=>{let r=o.useRef({});return[function(o){var a;if(!r.current||r.current.data!==e||r.current.childrenColumnName!==t||r.current.getRowKey!==n){let o=new Map;!function e(r){r.forEach((r,a)=>{let l=n(r,a);o.set(l,r),r&&"object"==typeof r&&t in r&&e(r[t]||[])})}(e),r.current={data:e,childrenColumnName:t,kvMap:o,getRowKey:n}}return null===(a=r.current.kvMap)||void 0===a?void 0:a.get(o)}]},n4=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,o=Object.getOwnPropertySymbols(e);rt.indexOf(o[r])&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]]);return n},n8=function(e,t,n){let r=n&&"object"==typeof n?n:{},{total:a=0}=r,l=n4(r,["total"]),[c,i]=(0,o.useState)(()=>({current:"defaultCurrent"in l?l.defaultCurrent:1,pageSize:"defaultPageSize"in l?l.defaultPageSize:10})),d=(0,tB.Z)(c,l,{total:a>0?a:e}),s=Math.ceil((a||e)/d.pageSize);d.current>s&&(d.current=s||1);let u=(e,t)=>{i({current:null!=e?e:1,pageSize:t||d.pageSize})};return!1===n?[{},()=>{}]:[Object.assign(Object.assign({},d),{onChange:(e,o)=>{var r;n&&(null===(r=n.onChange)||void 0===r||r.call(n,e,o)),u(e,o),t(e,o||(null==d?void 0:d.pageSize))}}),u]},n6={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z"}}]},name:"caret-down",theme:"outlined"},n5=o.forwardRef(function(e,t){return o.createElement(tL.Z,(0,p.Z)({},e,{ref:t,icon:n6}))}),n7={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M858.9 689L530.5 308.2c-9.4-10.9-27.5-10.9-37 0L165.1 689c-12.2 14.2-1.2 35 18.5 35h656.8c19.7 0 30.7-20.8 18.5-35z"}}]},name:"caret-up",theme:"outlined"},n9=o.forwardRef(function(e,t){return o.createElement(tL.Z,(0,p.Z)({},e,{ref:t,icon:n7}))}),oe=n(99981);let ot="ascend",on="descend",oo=e=>"object"==typeof e.sorter&&"number"==typeof e.sorter.multiple&&e.sorter.multiple,or=e=>"function"==typeof e?e:!!e&&"object"==typeof e&&!!e.compare&&e.compare,oa=(e,t)=>t?e[e.indexOf(t)+1]:e[0],ol=(e,t,n)=>{let o=[],r=(e,t)=>{o.push({column:e,key:tR(e,t),multiplePriority:oo(e),sortOrder:e.sortOrder})};return(e||[]).forEach((e,a)=>{let l=tP(a,n);e.children?("sortOrder"in e&&r(e,l),o=[].concat((0,el.Z)(o),(0,el.Z)(ol(e.children,t,l)))):e.sorter&&("sortOrder"in e?r(e,l):t&&e.defaultSortOrder&&o.push({column:e,key:tR(e,l),multiplePriority:oo(e),sortOrder:e.defaultSortOrder}))}),o},oc=(e,t,n,r,a,l,c,i)=>(t||[]).map((t,d)=>{let s=tP(d,i),u=t;if(u.sorter){let i;let d=u.sortDirections||a,f=void 0===u.showSorterTooltip?c:u.showSorterTooltip,p=tR(u,s),m=n.find(e=>{let{key:t}=e;return t===p}),h=m?m.sortOrder:null,v=oa(d,h);if(t.sortIcon)i=t.sortIcon({sortOrder:h});else{let t=d.includes(ot)&&o.createElement(n9,{className:Z()("".concat(e,"-column-sorter-up"),{active:h===ot})}),n=d.includes(on)&&o.createElement(n5,{className:Z()("".concat(e,"-column-sorter-down"),{active:h===on})});i=o.createElement("span",{className:Z()("".concat(e,"-column-sorter"),{["".concat(e,"-column-sorter-full")]:!!(t&&n)})},o.createElement("span",{className:"".concat(e,"-column-sorter-inner"),"aria-hidden":"true"},t,n))}let{cancelSort:g,triggerAsc:b,triggerDesc:y}=l||{},x=g;v===on?x=y:v===ot&&(x=b);let w="object"==typeof f?Object.assign({title:x},f):{title:x};u=Object.assign(Object.assign({},u),{className:Z()(u.className,{["".concat(e,"-column-sort")]:h}),title:n=>{let r="".concat(e,"-column-sorters"),a=o.createElement("span",{className:"".concat(e,"-column-title")},tM(t.title,n)),l=o.createElement("div",{className:r},a,i);return f?"boolean"!=typeof f&&(null==f?void 0:f.target)==="sorter-icon"?o.createElement("div",{className:Z()(r,"".concat(r,"-tooltip-target-sorter"))},a,o.createElement(oe.Z,Object.assign({},w),i)):o.createElement(oe.Z,Object.assign({},w),l):l},onHeaderCell:n=>{var o;let a=(null===(o=t.onHeaderCell)||void 0===o?void 0:o.call(t,n))||{},l=a.onClick,c=a.onKeyDown;a.onClick=e=>{r({column:t,key:p,sortOrder:v,multiplePriority:oo(t)}),null==l||l(e)},a.onKeyDown=e=>{e.keyCode===tY.Z.ENTER&&(r({column:t,key:p,sortOrder:v,multiplePriority:oo(t)}),null==c||c(e))};let i=tT(t.title,{}),d=null==i?void 0:i.toString();return h&&(a["aria-sort"]="ascend"===h?"ascending":"descending"),a["aria-label"]=d||"",a.className=Z()(a.className,"".concat(e,"-column-has-sorters")),a.tabIndex=0,t.ellipsis&&(a.title=(null!=i?i:"").toString()),a}})}return"children"in u&&(u=Object.assign(Object.assign({},u),{children:oc(e,u.children,n,r,a,l,c,s)})),u}),oi=e=>{let{column:t,sortOrder:n}=e;return{column:t,order:n,field:t.dataIndex,columnKey:t.key}},od=e=>{let t=e.filter(e=>{let{sortOrder:t}=e;return t}).map(oi);if(0===t.length&&e.length){let t=e.length-1;return Object.assign(Object.assign({},oi(e[t])),{column:void 0,order:void 0,field:void 0,columnKey:void 0})}return t.length<=1?t[0]||{}:t},os=(e,t,n)=>{let o=t.slice().sort((e,t)=>t.multiplePriority-e.multiplePriority),r=e.slice(),a=o.filter(e=>{let{column:{sorter:t},sortOrder:n}=e;return or(t)&&n});return a.length?r.sort((e,t)=>{for(let n=0;n{let o=e[n];return o?Object.assign(Object.assign({},e),{[n]:os(o,t,n)}):e}):r};var ou=e=>{let{prefixCls:t,mergedColumns:n,sortDirections:r,tableLocale:a,showSorterTooltip:l,onSorterChange:c}=e,[i,d]=o.useState(()=>ol(n,!0)),s=(e,t)=>{let n=[];return e.forEach((e,o)=>{let r=tP(o,t);if(n.push(tR(e,r)),Array.isArray(e.children)){let t=s(e.children,r);n.push.apply(n,(0,el.Z)(t))}}),n},u=o.useMemo(()=>{let e=!0,t=ol(n,!1);if(!t.length){let e=s(n);return i.filter(t=>{let{key:n}=t;return e.includes(n)})}let o=[];function r(t){e?o.push(t):o.push(Object.assign(Object.assign({},t),{sortOrder:null}))}let a=null;return t.forEach(t=>{null===a?(r(t),t.sortOrder&&(!1===t.multiplePriority?e=!1:a=!0)):(a&&!1!==t.multiplePriority||(e=!1),r(t))}),o},[n,i]),f=o.useMemo(()=>{var e,t;let n=u.map(e=>{let{column:t,sortOrder:n}=e;return{column:t,order:n}});return{sortColumns:n,sortColumn:null===(e=n[0])||void 0===e?void 0:e.column,sortOrder:null===(t=n[0])||void 0===t?void 0:t.order}},[u]),p=e=>{let t;d(t=!1!==e.multiplePriority&&u.length&&!1!==u[0].multiplePriority?[].concat((0,el.Z)(u.filter(t=>{let{key:n}=t;return n!==e.key})),[e]):[e]),c(od(t),t)};return[e=>oc(t,e,u,p,r,a,l),u,f,()=>od(u)]};let of=(e,t)=>e.map(e=>{let n=Object.assign({},e);return n.title=tM(e.title,t),"children"in n&&(n.children=of(n.children,t)),n});var op=e=>[o.useCallback(t=>of(t,e),[e])];let om=b(eI,(e,t)=>{let{_renderTimes:n}=e,{_renderTimes:o}=t;return n!==o}),oh=b(ez,(e,t)=>{let{_renderTimes:n}=e,{_renderTimes:o}=t;return n!==o});var ov=n(54558),og=e=>{let{componentCls:t,lineWidth:n,lineType:o,tableBorderColor:r,tableHeaderBg:a,tablePaddingVertical:l,tablePaddingHorizontal:c,calc:i}=e,d="".concat((0,nm.bf)(n)," ").concat(o," ").concat(r),s=(e,o,r)=>({["&".concat(t,"-").concat(e)]:{["> ".concat(t,"-container")]:{["> ".concat(t,"-content, > ").concat(t,"-body")]:{"\n > table > tbody > tr > th,\n > table > tbody > tr > td\n ":{["> ".concat(t,"-expanded-row-fixed")]:{margin:"".concat((0,nm.bf)(i(o).mul(-1).equal()),"\n ").concat((0,nm.bf)(i(i(r).add(n)).mul(-1).equal()))}}}}}});return{["".concat(t,"-wrapper")]:{["".concat(t).concat(t,"-bordered")]:Object.assign(Object.assign(Object.assign({["> ".concat(t,"-title")]:{border:d,borderBottom:0},["> ".concat(t,"-container")]:{borderInlineStart:d,borderTop:d,["\n > ".concat(t,"-content,\n > ").concat(t,"-header,\n > ").concat(t,"-body,\n > ").concat(t,"-summary\n ")]:{"> table":{"\n > thead > tr > th,\n > thead > tr > td,\n > tbody > tr > th,\n > tbody > tr > td,\n > tfoot > tr > th,\n > tfoot > tr > td\n ":{borderInlineEnd:d},"> thead":{"> tr:not(:last-child) > th":{borderBottom:d},"> tr > th::before":{backgroundColor:"transparent !important"}},"\n > thead > tr,\n > tbody > tr,\n > tfoot > tr\n ":{["> ".concat(t,"-cell-fix-right-first::after")]:{borderInlineEnd:d}},"\n > tbody > tr > th,\n > tbody > tr > td\n ":{["> ".concat(t,"-expanded-row-fixed")]:{margin:"".concat((0,nm.bf)(i(l).mul(-1).equal())," ").concat((0,nm.bf)(i(i(c).add(n)).mul(-1).equal())),"&::after":{position:"absolute",top:0,insetInlineEnd:n,bottom:0,borderInlineEnd:d,content:'""'}}}}}},["&".concat(t,"-scroll-horizontal")]:{["> ".concat(t,"-container > ").concat(t,"-body")]:{"> table > tbody":{["\n > tr".concat(t,"-expanded-row,\n > tr").concat(t,"-placeholder\n ")]:{"> th, > td":{borderInlineEnd:0}}}}}},s("middle",e.tablePaddingVerticalMiddle,e.tablePaddingHorizontalMiddle)),s("small",e.tablePaddingVerticalSmall,e.tablePaddingHorizontalSmall)),{["> ".concat(t,"-footer")]:{border:d,borderTop:0}}),["".concat(t,"-cell")]:{["".concat(t,"-container:first-child")]:{borderTop:0},"&-scrollbar:not([rowspan])":{boxShadow:"0 ".concat((0,nm.bf)(n)," 0 ").concat((0,nm.bf)(n)," ").concat(a)}},["".concat(t,"-bordered ").concat(t,"-cell-scrollbar")]:{borderInlineEnd:d}}}},ob=e=>{let{componentCls:t}=e;return{["".concat(t,"-wrapper")]:{["".concat(t,"-cell-ellipsis")]:Object.assign(Object.assign({},nv.vS),{wordBreak:"keep-all",["\n &".concat(t,"-cell-fix-left-last,\n &").concat(t,"-cell-fix-right-first\n ")]:{overflow:"visible",["".concat(t,"-cell-content")]:{display:"block",overflow:"hidden",textOverflow:"ellipsis"}},["".concat(t,"-column-title")]:{overflow:"hidden",textOverflow:"ellipsis",wordBreak:"keep-all"}})}}},oy=e=>{let{componentCls:t}=e;return{["".concat(t,"-wrapper")]:{["".concat(t,"-tbody > tr").concat(t,"-placeholder")]:{textAlign:"center",color:e.colorTextDisabled,"\n &:hover > th,\n &:hover > td,\n ":{background:e.colorBgContainer}}}}},ox=e=>{let{componentCls:t,antCls:n,motionDurationSlow:o,lineWidth:r,paddingXS:a,lineType:l,tableBorderColor:c,tableExpandIconBg:i,tableExpandColumnWidth:d,borderRadius:s,tablePaddingVertical:u,tablePaddingHorizontal:f,tableExpandedRowBg:p,paddingXXS:m,expandIconMarginTop:h,expandIconSize:v,expandIconHalfInner:g,expandIconScale:b,calc:y}=e,x="".concat((0,nm.bf)(r)," ").concat(l," ").concat(c),w=y(m).sub(r).equal();return{["".concat(t,"-wrapper")]:{["".concat(t,"-expand-icon-col")]:{width:d},["".concat(t,"-row-expand-icon-cell")]:{textAlign:"center",["".concat(t,"-row-expand-icon")]:{display:"inline-flex",float:"none",verticalAlign:"sub"}},["".concat(t,"-row-indent")]:{height:1,float:"left"},["".concat(t,"-row-expand-icon")]:Object.assign(Object.assign({},(0,nv.Nd)(e)),{position:"relative",float:"left",width:v,height:v,color:"inherit",lineHeight:(0,nm.bf)(v),background:i,border:x,borderRadius:s,transform:"scale(".concat(b,")"),"&:focus, &:hover, &:active":{borderColor:"currentcolor"},"&::before, &::after":{position:"absolute",background:"currentcolor",transition:"transform ".concat(o," ease-out"),content:'""'},"&::before":{top:g,insetInlineEnd:w,insetInlineStart:w,height:r},"&::after":{top:w,bottom:w,insetInlineStart:g,width:r,transform:"rotate(90deg)"},"&-collapsed::before":{transform:"rotate(-180deg)"},"&-collapsed::after":{transform:"rotate(0deg)"},"&-spaced":{"&::before, &::after":{display:"none",content:"none"},background:"transparent",border:0,visibility:"hidden"}}),["".concat(t,"-row-indent + ").concat(t,"-row-expand-icon")]:{marginTop:h,marginInlineEnd:a},["tr".concat(t,"-expanded-row")]:{"&, &:hover":{"> th, > td":{background:p}},["".concat(n,"-descriptions-view")]:{display:"flex",table:{flex:"auto",width:"100%"}}},["".concat(t,"-expanded-row-fixed")]:{position:"relative",margin:"".concat((0,nm.bf)(y(u).mul(-1).equal())," ").concat((0,nm.bf)(y(f).mul(-1).equal())),padding:"".concat((0,nm.bf)(u)," ").concat((0,nm.bf)(f))}}}},ow=e=>{let{componentCls:t,antCls:n,iconCls:o,tableFilterDropdownWidth:r,tableFilterDropdownSearchWidth:a,paddingXXS:l,paddingXS:c,colorText:i,lineWidth:d,lineType:s,tableBorderColor:u,headerIconColor:f,fontSizeSM:p,tablePaddingHorizontal:m,borderRadius:h,motionDurationSlow:v,colorIcon:g,colorPrimary:b,tableHeaderFilterActiveBg:y,colorTextDisabled:x,tableFilterDropdownBg:w,tableFilterDropdownHeight:k,controlItemBgHover:C,controlItemBgActive:E,boxShadowSecondary:S,filterDropdownMenuBg:Z,calc:N}=e,K="".concat(n,"-dropdown"),O="".concat(t,"-filter-dropdown"),I="".concat(n,"-tree"),R="".concat((0,nm.bf)(d)," ").concat(s," ").concat(u);return[{["".concat(t,"-wrapper")]:{["".concat(t,"-filter-column")]:{display:"flex",justifyContent:"space-between"},["".concat(t,"-filter-trigger")]:{position:"relative",display:"flex",alignItems:"center",marginBlock:N(l).mul(-1).equal(),marginInline:"".concat((0,nm.bf)(l)," ").concat((0,nm.bf)(N(m).div(2).mul(-1).equal())),padding:"0 ".concat((0,nm.bf)(l)),color:f,fontSize:p,borderRadius:h,cursor:"pointer",transition:"all ".concat(v),"&:hover":{color:g,background:y},"&.active":{color:b}}}},{["".concat(n,"-dropdown")]:{[O]:Object.assign(Object.assign({},(0,nv.Wf)(e)),{minWidth:r,backgroundColor:w,borderRadius:h,boxShadow:S,overflow:"hidden",["".concat(K,"-menu")]:{maxHeight:k,overflowX:"hidden",border:0,boxShadow:"none",borderRadius:"unset",backgroundColor:Z,"&:empty::after":{display:"block",padding:"".concat((0,nm.bf)(c)," 0"),color:x,fontSize:p,textAlign:"center",content:'"Not Found"'}},["".concat(O,"-tree")]:{paddingBlock:"".concat((0,nm.bf)(c)," 0"),paddingInline:c,[I]:{padding:0},["".concat(I,"-treenode ").concat(I,"-node-content-wrapper:hover")]:{backgroundColor:C},["".concat(I,"-treenode-checkbox-checked ").concat(I,"-node-content-wrapper")]:{"&, &:hover":{backgroundColor:E}}},["".concat(O,"-search")]:{padding:c,borderBottom:R,"&-input":{input:{minWidth:a},[o]:{color:x}}},["".concat(O,"-checkall")]:{width:"100%",marginBottom:l,marginInlineStart:l},["".concat(O,"-btns")]:{display:"flex",justifyContent:"space-between",padding:"".concat((0,nm.bf)(N(c).sub(d).equal())," ").concat((0,nm.bf)(c)),overflow:"hidden",borderTop:R}})}},{["".concat(n,"-dropdown ").concat(O,", ").concat(O,"-submenu")]:{["".concat(n,"-checkbox-wrapper + span")]:{paddingInlineStart:c,color:i},"> ul":{maxHeight:"calc(100vh - 130px)",overflowX:"hidden",overflowY:"auto"}}}]},ok=e=>{let{componentCls:t,lineWidth:n,colorSplit:o,motionDurationSlow:r,zIndexTableFixed:a,tableBg:l,zIndexTableSticky:c,calc:i}=e;return{["".concat(t,"-wrapper")]:{["\n ".concat(t,"-cell-fix-left,\n ").concat(t,"-cell-fix-right\n ")]:{position:"sticky !important",zIndex:a,background:l},["\n ".concat(t,"-cell-fix-left-first::after,\n ").concat(t,"-cell-fix-left-last::after\n ")]:{position:"absolute",top:0,right:{_skip_check_:!0,value:0},bottom:i(n).mul(-1).equal(),width:30,transform:"translateX(100%)",transition:"box-shadow ".concat(r),content:'""',pointerEvents:"none",willChange:"transform"},["".concat(t,"-cell-fix-left-all::after")]:{display:"none"},["\n ".concat(t,"-cell-fix-right-first::after,\n ").concat(t,"-cell-fix-right-last::after\n ")]:{position:"absolute",top:0,bottom:i(n).mul(-1).equal(),left:{_skip_check_:!0,value:0},width:30,transform:"translateX(-100%)",transition:"box-shadow ".concat(r),content:'""',pointerEvents:"none"},["".concat(t,"-container")]:{position:"relative","&::before, &::after":{position:"absolute",top:0,bottom:0,zIndex:i(c).add(1).equal({unit:!1}),width:30,transition:"box-shadow ".concat(r),content:'""',pointerEvents:"none"},"&::before":{insetInlineStart:0},"&::after":{insetInlineEnd:0}},["".concat(t,"-ping-left")]:{["&:not(".concat(t,"-has-fix-left) ").concat(t,"-container::before")]:{boxShadow:"inset 10px 0 8px -8px ".concat(o)},["\n ".concat(t,"-cell-fix-left-first::after,\n ").concat(t,"-cell-fix-left-last::after\n ")]:{boxShadow:"inset 10px 0 8px -8px ".concat(o)},["".concat(t,"-cell-fix-left-last::before")]:{backgroundColor:"transparent !important"}},["".concat(t,"-ping-right")]:{["&:not(".concat(t,"-has-fix-right) ").concat(t,"-container::after")]:{boxShadow:"inset -10px 0 8px -8px ".concat(o)},["\n ".concat(t,"-cell-fix-right-first::after,\n ").concat(t,"-cell-fix-right-last::after\n ")]:{boxShadow:"inset -10px 0 8px -8px ".concat(o)}},["".concat(t,"-fixed-column-gapped")]:{["\n ".concat(t,"-cell-fix-left-first::after,\n ").concat(t,"-cell-fix-left-last::after,\n ").concat(t,"-cell-fix-right-first::after,\n ").concat(t,"-cell-fix-right-last::after\n ")]:{boxShadow:"none"}}}}},oC=e=>{let{componentCls:t,antCls:n,margin:o}=e;return{["".concat(t,"-wrapper ").concat(t,"-pagination").concat(n,"-pagination")]:{margin:"".concat((0,nm.bf)(o)," 0")}}},oE=e=>{let{componentCls:t,tableRadius:n}=e;return{["".concat(t,"-wrapper")]:{[t]:{["".concat(t,"-title, ").concat(t,"-header")]:{borderRadius:"".concat((0,nm.bf)(n)," ").concat((0,nm.bf)(n)," 0 0")},["".concat(t,"-title + ").concat(t,"-container")]:{borderStartStartRadius:0,borderStartEndRadius:0,["".concat(t,"-header, table")]:{borderRadius:0},"table > thead > tr:first-child":{"th:first-child, th:last-child, td:first-child, td:last-child":{borderRadius:0}}},"&-container":{borderStartStartRadius:n,borderStartEndRadius:n,"table > thead > tr:first-child":{"> *:first-child":{borderStartStartRadius:n},"> *:last-child":{borderStartEndRadius:n}}},"&-footer":{borderRadius:"0 0 ".concat((0,nm.bf)(n)," ").concat((0,nm.bf)(n))}}}}},oS=e=>{let{componentCls:t}=e;return{["".concat(t,"-wrapper-rtl")]:{direction:"rtl",table:{direction:"rtl"},["".concat(t,"-pagination-left")]:{justifyContent:"flex-end"},["".concat(t,"-pagination-right")]:{justifyContent:"flex-start"},["".concat(t,"-row-expand-icon")]:{float:"right","&::after":{transform:"rotate(-90deg)"},"&-collapsed::before":{transform:"rotate(180deg)"},"&-collapsed::after":{transform:"rotate(0deg)"}},["".concat(t,"-container")]:{"&::before":{insetInlineStart:"unset",insetInlineEnd:0},"&::after":{insetInlineStart:0,insetInlineEnd:"unset"},["".concat(t,"-row-indent")]:{float:"right"}}}}},oZ=e=>{let{componentCls:t,antCls:n,iconCls:o,fontSizeIcon:r,padding:a,paddingXS:l,headerIconColor:c,headerIconHoverColor:i,tableSelectionColumnWidth:d,tableSelectedRowBg:s,tableSelectedRowHoverBg:u,tableRowHoverBg:f,tablePaddingHorizontal:p,calc:m}=e;return{["".concat(t,"-wrapper")]:{["".concat(t,"-selection-col")]:{width:d,["&".concat(t,"-selection-col-with-dropdown")]:{width:m(d).add(r).add(m(a).div(4)).equal()}},["".concat(t,"-bordered ").concat(t,"-selection-col")]:{width:m(d).add(m(l).mul(2)).equal(),["&".concat(t,"-selection-col-with-dropdown")]:{width:m(d).add(r).add(m(a).div(4)).add(m(l).mul(2)).equal()}},["\n table tr th".concat(t,"-selection-column,\n table tr td").concat(t,"-selection-column,\n ").concat(t,"-selection-column\n ")]:{paddingInlineEnd:e.paddingXS,paddingInlineStart:e.paddingXS,textAlign:"center",["".concat(n,"-radio-wrapper")]:{marginInlineEnd:0}},["table tr th".concat(t,"-selection-column").concat(t,"-cell-fix-left")]:{zIndex:m(e.zIndexTableFixed).add(1).equal({unit:!1})},["table tr th".concat(t,"-selection-column::after")]:{backgroundColor:"transparent !important"},["".concat(t,"-selection")]:{position:"relative",display:"inline-flex",flexDirection:"column"},["".concat(t,"-selection-extra")]:{position:"absolute",top:0,zIndex:1,cursor:"pointer",transition:"all ".concat(e.motionDurationSlow),marginInlineStart:"100%",paddingInlineStart:(0,nm.bf)(m(p).div(4).equal()),[o]:{color:c,fontSize:r,verticalAlign:"baseline","&:hover":{color:i}}},["".concat(t,"-tbody")]:{["".concat(t,"-row")]:{["&".concat(t,"-row-selected")]:{["> ".concat(t,"-cell")]:{background:s,"&-row-hover":{background:u}}},["> ".concat(t,"-cell-row-hover")]:{background:f}}}}}},oN=e=>{let{componentCls:t,tableExpandColumnWidth:n,calc:o}=e,r=(e,r,a,l)=>({["".concat(t).concat(t,"-").concat(e)]:{fontSize:l,["\n ".concat(t,"-title,\n ").concat(t,"-footer,\n ").concat(t,"-cell,\n ").concat(t,"-thead > tr > th,\n ").concat(t,"-tbody > tr > th,\n ").concat(t,"-tbody > tr > td,\n tfoot > tr > th,\n tfoot > tr > td\n ")]:{padding:"".concat((0,nm.bf)(r)," ").concat((0,nm.bf)(a))},["".concat(t,"-filter-trigger")]:{marginInlineEnd:(0,nm.bf)(o(a).div(2).mul(-1).equal())},["".concat(t,"-expanded-row-fixed")]:{margin:"".concat((0,nm.bf)(o(r).mul(-1).equal())," ").concat((0,nm.bf)(o(a).mul(-1).equal()))},["".concat(t,"-tbody")]:{["".concat(t,"-wrapper:only-child ").concat(t)]:{marginBlock:(0,nm.bf)(o(r).mul(-1).equal()),marginInline:"".concat((0,nm.bf)(o(n).sub(a).equal())," ").concat((0,nm.bf)(o(a).mul(-1).equal()))}},["".concat(t,"-selection-extra")]:{paddingInlineStart:(0,nm.bf)(o(a).div(4).equal())}}});return{["".concat(t,"-wrapper")]:Object.assign(Object.assign({},r("middle",e.tablePaddingVerticalMiddle,e.tablePaddingHorizontalMiddle,e.tableFontSizeMiddle)),r("small",e.tablePaddingVerticalSmall,e.tablePaddingHorizontalSmall,e.tableFontSizeSmall))}},oK=e=>{let{componentCls:t,marginXXS:n,fontSizeIcon:o,headerIconColor:r,headerIconHoverColor:a}=e;return{["".concat(t,"-wrapper")]:{["".concat(t,"-thead th").concat(t,"-column-has-sorters")]:{outline:"none",cursor:"pointer",transition:"all ".concat(e.motionDurationSlow,", left 0s"),"&:hover":{background:e.tableHeaderSortHoverBg,"&::before":{backgroundColor:"transparent !important"}},"&:focus-visible":{color:e.colorPrimary},["\n &".concat(t,"-cell-fix-left:hover,\n &").concat(t,"-cell-fix-right:hover\n ")]:{background:e.tableFixedHeaderSortActiveBg}},["".concat(t,"-thead th").concat(t,"-column-sort")]:{background:e.tableHeaderSortBg,"&::before":{backgroundColor:"transparent !important"}},["td".concat(t,"-column-sort")]:{background:e.tableBodySortBg},["".concat(t,"-column-title")]:{position:"relative",zIndex:1,flex:1,minWidth:0},["".concat(t,"-column-sorters")]:{display:"flex",flex:"auto",alignItems:"center",justifyContent:"space-between","&::after":{position:"absolute",inset:0,width:"100%",height:"100%",content:'""'}},["".concat(t,"-column-sorters-tooltip-target-sorter")]:{"&::after":{content:"none"}},["".concat(t,"-column-sorter")]:{marginInlineStart:n,color:r,fontSize:0,transition:"color ".concat(e.motionDurationSlow),"&-inner":{display:"inline-flex",flexDirection:"column",alignItems:"center"},"&-up, &-down":{fontSize:o,"&.active":{color:e.colorPrimary}},["".concat(t,"-column-sorter-up + ").concat(t,"-column-sorter-down")]:{marginTop:"-0.3em"}},["".concat(t,"-column-sorters:hover ").concat(t,"-column-sorter")]:{color:a}}}},oO=e=>{let{componentCls:t,opacityLoading:n,tableScrollThumbBg:o,tableScrollThumbBgHover:r,tableScrollThumbSize:a,tableScrollBg:l,zIndexTableSticky:c,stickyScrollBarBorderRadius:i,lineWidth:d,lineType:s,tableBorderColor:u}=e,f="".concat((0,nm.bf)(d)," ").concat(s," ").concat(u);return{["".concat(t,"-wrapper")]:{["".concat(t,"-sticky")]:{"&-holder":{position:"sticky",zIndex:c,background:e.colorBgContainer},"&-scroll":{position:"sticky",bottom:0,height:"".concat((0,nm.bf)(a)," !important"),zIndex:c,display:"flex",alignItems:"center",background:l,borderTop:f,opacity:n,"&:hover":{transformOrigin:"center bottom"},"&-bar":{height:a,backgroundColor:o,borderRadius:i,transition:"all ".concat(e.motionDurationSlow,", transform 0s"),position:"absolute",bottom:0,"&:hover, &-active":{backgroundColor:r}}}}}}},oI=e=>{let{componentCls:t,lineWidth:n,tableBorderColor:o,calc:r}=e,a="".concat((0,nm.bf)(n)," ").concat(e.lineType," ").concat(o);return{["".concat(t,"-wrapper")]:{["".concat(t,"-summary")]:{position:"relative",zIndex:e.zIndexTableFixed,background:e.tableBg,"> tr":{"> th, > td":{borderBottom:a}}},["div".concat(t,"-summary")]:{boxShadow:"0 ".concat((0,nm.bf)(r(n).mul(-1).equal())," 0 ").concat(o)}}}},oR=e=>{let{componentCls:t,motionDurationMid:n,lineWidth:o,lineType:r,tableBorderColor:a,calc:l}=e,c="".concat((0,nm.bf)(o)," ").concat(r," ").concat(a),i="".concat(t,"-expanded-row-cell");return{["".concat(t,"-wrapper")]:{["".concat(t,"-tbody-virtual")]:{["".concat(t,"-tbody-virtual-holder-inner")]:{["\n & > ".concat(t,"-row, \n & > div:not(").concat(t,"-row) > ").concat(t,"-row\n ")]:{display:"flex",boxSizing:"border-box",width:"100%"}},["".concat(t,"-cell")]:{borderBottom:c,transition:"background ".concat(n)},["".concat(t,"-expanded-row")]:{["".concat(i).concat(i,"-fixed")]:{position:"sticky",insetInlineStart:0,overflow:"hidden",width:"calc(var(--virtual-width) - ".concat((0,nm.bf)(o),")"),borderInlineEnd:"none"}}},["".concat(t,"-bordered")]:{["".concat(t,"-tbody-virtual")]:{"&:after":{content:'""',insetInline:0,bottom:0,borderBottom:c,position:"absolute"},["".concat(t,"-cell")]:{borderInlineEnd:c,["&".concat(t,"-cell-fix-right-first:before")]:{content:'""',position:"absolute",insetBlock:0,insetInlineStart:l(o).mul(-1).equal(),borderInlineStart:c}}},["&".concat(t,"-virtual")]:{["".concat(t,"-placeholder ").concat(t,"-cell")]:{borderInlineEnd:c,borderBottom:c}}}}}};let oP=e=>{let{componentCls:t,fontWeightStrong:n,tablePaddingVertical:o,tablePaddingHorizontal:r,tableExpandColumnWidth:a,lineWidth:l,lineType:c,tableBorderColor:i,tableFontSize:d,tableBg:s,tableRadius:u,tableHeaderTextColor:f,motionDurationMid:p,tableHeaderBg:m,tableHeaderCellSplitColor:h,tableFooterTextColor:v,tableFooterBg:g,calc:b}=e,y="".concat((0,nm.bf)(l)," ").concat(c," ").concat(i);return{["".concat(t,"-wrapper")]:Object.assign(Object.assign({clear:"both",maxWidth:"100%","--rc-virtual-list-scrollbar-bg":e.tableScrollBg},(0,nv.dF)()),{[t]:Object.assign(Object.assign({},(0,nv.Wf)(e)),{fontSize:d,background:s,borderRadius:"".concat((0,nm.bf)(u)," ").concat((0,nm.bf)(u)," 0 0"),scrollbarColor:"".concat(e.tableScrollThumbBg," ").concat(e.tableScrollBg)}),table:{width:"100%",textAlign:"start",borderRadius:"".concat((0,nm.bf)(u)," ").concat((0,nm.bf)(u)," 0 0"),borderCollapse:"separate",borderSpacing:0},["\n ".concat(t,"-cell,\n ").concat(t,"-thead > tr > th,\n ").concat(t,"-tbody > tr > th,\n ").concat(t,"-tbody > tr > td,\n tfoot > tr > th,\n tfoot > tr > td\n ")]:{position:"relative",padding:"".concat((0,nm.bf)(o)," ").concat((0,nm.bf)(r)),overflowWrap:"break-word"},["".concat(t,"-title")]:{padding:"".concat((0,nm.bf)(o)," ").concat((0,nm.bf)(r))},["".concat(t,"-thead")]:{"\n > tr > th,\n > tr > td\n ":{position:"relative",color:f,fontWeight:n,textAlign:"start",background:m,borderBottom:y,transition:"background ".concat(p," ease"),"&[colspan]:not([colspan='1'])":{textAlign:"center"},["&:not(:last-child):not(".concat(t,"-selection-column):not(").concat(t,"-row-expand-icon-cell):not([colspan])::before")]:{position:"absolute",top:"50%",insetInlineEnd:0,width:1,height:"1.6em",backgroundColor:h,transform:"translateY(-50%)",transition:"background-color ".concat(p),content:'""'}},"> tr:not(:last-child) > th[colspan]":{borderBottom:0}},["".concat(t,"-tbody")]:{"> tr":{"> th, > td":{transition:"background ".concat(p,", border-color ").concat(p),borderBottom:y,["\n > ".concat(t,"-wrapper:only-child,\n > ").concat(t,"-expanded-row-fixed > ").concat(t,"-wrapper:only-child\n ")]:{[t]:{marginBlock:(0,nm.bf)(b(o).mul(-1).equal()),marginInline:"".concat((0,nm.bf)(b(a).sub(r).equal()),"\n ").concat((0,nm.bf)(b(r).mul(-1).equal())),["".concat(t,"-tbody > tr:last-child > td")]:{borderBottomWidth:0,"&:first-child, &:last-child":{borderRadius:0}}}}},"> th":{position:"relative",color:f,fontWeight:n,textAlign:"start",background:m,borderBottom:y,transition:"background ".concat(p," ease")},["& > ".concat(t,"-measure-cell")]:{paddingBlock:"0 !important",borderBlock:"0 !important",["".concat(t,"-measure-cell-content")]:{height:0,overflow:"hidden",pointerEvents:"none"}}}},["".concat(t,"-footer")]:{padding:"".concat((0,nm.bf)(o)," ").concat((0,nm.bf)(r)),color:v,background:g}})}};var oM=(0,ny.I$)("Table",e=>{let{colorTextHeading:t,colorSplit:n,colorBgContainer:o,controlInteractiveSize:r,headerBg:a,headerColor:l,headerSortActiveBg:c,headerSortHoverBg:i,bodySortBg:d,rowHoverBg:s,rowSelectedBg:u,rowSelectedHoverBg:f,rowExpandedBg:p,cellPaddingBlock:m,cellPaddingInline:h,cellPaddingBlockMD:v,cellPaddingInlineMD:g,cellPaddingBlockSM:b,cellPaddingInlineSM:y,borderColor:x,footerBg:w,footerColor:k,headerBorderRadius:C,cellFontSize:E,cellFontSizeMD:S,cellFontSizeSM:Z,headerSplitColor:N,fixedHeaderSortActiveBg:K,headerFilterHoverBg:O,filterDropdownBg:I,expandIconBg:R,selectionColumnWidth:P,stickyScrollBarBg:M,calc:T}=e,D=(0,nb.IX)(e,{tableFontSize:E,tableBg:o,tableRadius:C,tablePaddingVertical:m,tablePaddingHorizontal:h,tablePaddingVerticalMiddle:v,tablePaddingHorizontalMiddle:g,tablePaddingVerticalSmall:b,tablePaddingHorizontalSmall:y,tableBorderColor:x,tableHeaderTextColor:l,tableHeaderBg:a,tableFooterTextColor:k,tableFooterBg:w,tableHeaderCellSplitColor:N,tableHeaderSortBg:c,tableHeaderSortHoverBg:i,tableBodySortBg:d,tableFixedHeaderSortActiveBg:K,tableHeaderFilterActiveBg:O,tableFilterDropdownBg:I,tableRowHoverBg:s,tableSelectedRowBg:u,tableSelectedRowHoverBg:f,zIndexTableFixed:2,zIndexTableSticky:T(2).add(1).equal({unit:!1}),tableFontSizeMiddle:S,tableFontSizeSmall:Z,tableSelectionColumnWidth:P,tableExpandIconBg:R,tableExpandColumnWidth:T(r).add(T(e.padding).mul(2)).equal(),tableExpandedRowBg:p,tableFilterDropdownWidth:120,tableFilterDropdownHeight:264,tableFilterDropdownSearchWidth:140,tableScrollThumbSize:8,tableScrollThumbBg:M,tableScrollThumbBgHover:t,tableScrollBg:n});return[oP(D),oC(D),oI(D),oK(D),ow(D),og(D),oE(D),ox(D),oI(D),oy(D),oZ(D),ok(D),oO(D),ob(D),oN(D),oS(D),oR(D)]},e=>{let{colorFillAlter:t,colorBgContainer:n,colorTextHeading:o,colorFillSecondary:r,colorFillContent:a,controlItemBgActive:l,controlItemBgActiveHover:c,padding:i,paddingSM:d,paddingXS:s,colorBorderSecondary:u,borderRadiusLG:f,controlHeight:p,colorTextPlaceholder:m,fontSize:h,fontSizeSM:v,lineHeight:g,lineWidth:b,colorIcon:y,colorIconHover:x,opacityLoading:w,controlInteractiveSize:k}=e,C=new ov.t(r).onBackground(n).toHexString(),E=new ov.t(a).onBackground(n).toHexString(),S=new ov.t(t).onBackground(n).toHexString(),Z=new ov.t(y),N=new ov.t(x),K=k/2-b,O=2*K+3*b;return{headerBg:S,headerColor:o,headerSortActiveBg:C,headerSortHoverBg:E,bodySortBg:S,rowHoverBg:S,rowSelectedBg:l,rowSelectedHoverBg:c,rowExpandedBg:t,cellPaddingBlock:i,cellPaddingInline:i,cellPaddingBlockMD:d,cellPaddingInlineMD:s,cellPaddingBlockSM:s,cellPaddingInlineSM:s,borderColor:u,headerBorderRadius:f,footerBg:S,footerColor:o,cellFontSize:h,cellFontSizeMD:h,cellFontSizeSM:h,headerSplitColor:u,fixedHeaderSortActiveBg:C,headerFilterHoverBg:a,filterDropdownMenuBg:n,filterDropdownBg:n,expandIconBg:n,selectionColumnWidth:p,stickyScrollBarBg:m,stickyScrollBarBorderRadius:100,expandIconMarginTop:(h*g-3*b)/2-Math.ceil((1.4*v-3*b)/2),headerIconColor:Z.clone().setA(Z.a*w).toRgbString(),headerIconHoverColor:N.clone().setA(N.a*w).toRgbString(),expandIconHalfInner:K,expandIconSize:O,expandIconScale:k/O}},{unitless:{expandIconScale:!0}});let oT=[];var oD=o.forwardRef((e,t)=>{var n,r;let{prefixCls:l,className:c,rootClassName:i,style:d,size:s,bordered:u,dropdownPrefixCls:f,dataSource:p,pagination:m,rowSelection:h,rowKey:v="key",rowClassName:g,columns:b,children:y,childrenColumnName:x,onChange:w,getPopupContainer:k,loading:C,expandIcon:E,expandable:S,expandedRowRender:N,expandIconColumnIndex:K,indentSize:O,scroll:I,sortDirections:R,locale:P,showSorterTooltip:M={target:"full-header"},virtual:T}=e;(0,tc.ln)("Table");let D=o.useMemo(()=>b||ev(y),[b,y]),L=o.useMemo(()=>D.some(e=>e.responsive),[D]),j=(0,tZ.Z)(L),B=o.useMemo(()=>{let e=new Set(Object.keys(j).filter(e=>j[e]));return D.filter(t=>!t.responsive||t.responsive.some(t=>e.has(t)))},[D,j]),H=(0,eq.Z)(e,["className","style","columns"]),{locale:z=tN.Z,direction:A,table:W,renderEmpty:_,getPrefixCls:F,getPopupContainer:q}=o.useContext(tk.E_),V=(0,tS.Z)(s),X=Object.assign(Object.assign({},z.Table),P),U=p||oT,G=F("table",l),Y=F("dropdown",f),[,$]=(0,tI.ZP)(),J=(0,tE.Z)(G),[Q,ee,et]=oM(G,J),en=Object.assign(Object.assign({childrenColumnName:x,expandIconColumnIndex:K},S),{expandIcon:null!==(n=null==S?void 0:S.expandIcon)&&void 0!==n?n:null===(r=null==W?void 0:W.expandable)||void 0===r?void 0:r.expandIcon}),{childrenColumnName:eo="children"}=en,er=o.useMemo(()=>U.some(e=>null==e?void 0:e[eo])?"nest":N||(null==S?void 0:S.expandedRowRender)?"row":null,[U]),ea={body:o.useRef(null)},el=o.useRef(null),ec=o.useRef(null);tb(t,()=>Object.assign(Object.assign({},ec.current),{nativeElement:el.current}));let ei=o.useMemo(()=>"function"==typeof v?v:e=>null==e?void 0:e[v],[v]),[ed]=n3(U,eo,ei),es={},eu=function(e,t){var n,o,r,a;let l=arguments.length>2&&void 0!==arguments[2]&&arguments[2],c=Object.assign(Object.assign({},es),e);l&&(null===(n=es.resetPagination)||void 0===n||n.call(es),(null===(o=c.pagination)||void 0===o?void 0:o.current)&&(c.pagination.current=1),m&&(null===(r=m.onChange)||void 0===r||r.call(m,1,null===(a=c.pagination)||void 0===a?void 0:a.pageSize))),I&&!1!==I.scrollToFirstRowOnChange&&ea.body.current&&function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{getContainer:n=()=>window,callback:o,duration:r=450}=t,a=n(),l=tx(a),c=Date.now(),i=()=>{let t=Date.now()-c,n=function(e,t,n,o){let r=n-t;return(e/=o/2)<1?r/2*e*e*e+t:r/2*((e-=2)*e*e+2)+t}(t>r?r:t,l,e,r);ty(a)?a.scrollTo(window.pageXOffset,n):a instanceof Document||"HTMLDocument"===a.constructor.name?a.documentElement.scrollTop=n:a.scrollTop=n,tea.body.current}),null==w||w(c.pagination,c.filters,c.sorter,{currentDataSource:n0(os(U,c.sorterStates,eo),c.filterStates,eo),action:t})},[ef,ep,em,eh]=ou({prefixCls:G,mergedColumns:B,onSorterChange:(e,t)=>{eu({sorter:e,sorterStates:t},"sort",!1)},sortDirections:R||["ascend","descend"],tableLocale:X,showSorterTooltip:M}),eg=o.useMemo(()=>os(U,ep,eo),[U,ep]);es.sorter=eh(),es.sorterStates=ep;let[eb,ey,ex]=n2({prefixCls:G,locale:X,dropdownPrefixCls:Y,mergedColumns:B,onFilterChange:(e,t)=>{eu({filters:e,filterStates:t},"filter",!0)},getPopupContainer:k||q,rootClassName:Z()(i,J)}),ew=n0(eg,ey,eo);es.filters=ex,es.filterStates=ey;let[eC]=op(o.useMemo(()=>{let e={};return Object.keys(ex).forEach(t=>{null!==ex[t]&&(e[t]=ex[t])}),Object.assign(Object.assign({},em),{filters:e})},[em,ex])),[eE,eS]=n8(ew.length,(e,t)=>{eu({pagination:Object.assign(Object.assign({},es.pagination),{current:e,pageSize:t})},"paginate")},m);es.pagination=!1===m?{}:function(e,t){let n={current:e.current,pageSize:e.pageSize};return Object.keys(t&&"object"==typeof t?t:{}).forEach(t=>{let o=e[t];"function"!=typeof o&&(n[t]=o)}),n}(eE,m),es.resetPagination=eS;let eZ=o.useMemo(()=>{if(!1===m||!eE.pageSize)return ew;let{current:e=1,total:t,pageSize:n=10}=eE;return ew.lengthn?ew.slice((e-1)*n,e*n):ew:ew.slice((e-1)*n,e*n)},[!!m,ew,null==eE?void 0:eE.current,null==eE?void 0:eE.pageSize,null==eE?void 0:eE.total]),[eN,eK]=tg({prefixCls:G,data:ew,pageData:eZ,getRowKey:ei,getRecordByKey:ed,expandType:er,childrenColumnName:eo,locale:X,getPopupContainer:k||q},h);en.__PARENT_RENDER_ICON__=en.expandIcon,en.expandIcon=en.expandIcon||E||(e=>{let{prefixCls:t,onExpand:n,record:r,expanded:a,expandable:l}=e,c="".concat(t,"-row-expand-icon");return o.createElement("button",{type:"button",onClick:e=>{n(r,e),e.stopPropagation()},className:Z()(c,{["".concat(c,"-spaced")]:!l,["".concat(c,"-expanded")]:l&&a,["".concat(c,"-collapsed")]:l&&!a}),"aria-label":a?X.collapse:X.expand,"aria-expanded":a})}),"nest"===er&&void 0===en.expandIconColumnIndex?en.expandIconColumnIndex=h?1:0:en.expandIconColumnIndex>0&&h&&(en.expandIconColumnIndex-=1),"number"!=typeof en.indentSize&&(en.indentSize="number"==typeof O?O:15);let eO=o.useCallback(e=>eC(eN(eb(ef(e)))),[ef,eb,eN]),eI=o.useMemo(()=>"boolean"==typeof C?{spinning:C}:"object"==typeof C&&null!==C?Object.assign({spinning:!0},C):void 0,[C]),eR=Z()(et,J,"".concat(G,"-wrapper"),null==W?void 0:W.className,{["".concat(G,"-wrapper-rtl")]:"rtl"===A},c,i,ee),eP=Object.assign(Object.assign({},null==W?void 0:W.style),d),eM=o.useMemo(()=>(null==eI?void 0:eI.spinning)&&U===oT?null:void 0!==(null==P?void 0:P.emptyText)?P.emptyText:(null==_?void 0:_("Table"))||o.createElement(tC.Z,{componentName:"Table"}),[null==eI?void 0:eI.spinning,U,null==P?void 0:P.emptyText,_]),eT={},eD=o.useMemo(()=>{let{fontSize:e,lineHeight:t,lineWidth:n,padding:o,paddingXS:r,paddingSM:a}=$,l=Math.floor(e*t);switch(V){case"middle":return 2*a+l+n;case"small":return 2*r+l+n;default:return 2*o+l+n}},[$,V]);T&&(eT.listItemHeight=eD);let{top:eL,bottom:ej}=(()=>{if(!1===m||!(null==eE?void 0:eE.total))return{};let e=()=>eE.size||("small"===V||"middle"===V?"small":void 0),t=t=>o.createElement(tK.Z,Object.assign({},eE,{align:eE.align||("left"===t?"start":"right"===t?"end":t),className:Z()("".concat(G,"-pagination"),eE.className),size:e()})),n="rtl"===A?"left":"right",r=eE.position;if(null===r||!Array.isArray(r))return{bottom:t(n)};let a=r.find(e=>"string"==typeof e&&e.toLowerCase().includes("top")),l=r.find(e=>"string"==typeof e&&e.toLowerCase().includes("bottom")),c=r.every(e=>"none"==="".concat(e)),i=a?a.toLowerCase().replace("top",""):"",d=l?l.toLowerCase().replace("bottom",""):"";return{top:i?t(i):void 0,bottom:d?t(d):a||l||c?void 0:t(n)}})();return Q(o.createElement("div",{ref:el,className:eR,style:eP},o.createElement(tO.Z,Object.assign({spinning:!1},eI),eL,o.createElement(T?oh:om,Object.assign({},eT,H,{ref:ec,columns:B,direction:A,expandable:en,prefixCls:G,className:Z()({["".concat(G,"-middle")]:"middle"===V,["".concat(G,"-small")]:"small"===V,["".concat(G,"-bordered")]:u,["".concat(G,"-empty")]:0===U.length},et,J,ee),data:eZ,rowKey:ei,rowClassName:(e,t,n)=>{let o;return o="function"==typeof g?Z()(g(e,t,n)):Z()(g),Z()({["".concat(G,"-row-selected")]:eK.has(ei(e,t))},o)},emptyText:eM,internalHooks:a,internalRefs:ea,transformColumns:eO,getContainerWidth:(e,t)=>{let n=e.querySelector(".".concat(G,"-container")),o=t;if(n){let e=getComputedStyle(n);o=t-Number.parseInt(e.borderLeftWidth,10)-Number.parseInt(e.borderRightWidth,10)}return o},measureRowRender:e=>o.createElement(tw.ZP,{getPopupContainer:e=>e},e)})),ej)))});let oL=o.forwardRef((e,t)=>{let n=o.useRef(0);return n.current+=1,o.createElement(oD,Object.assign({},e,{ref:t,_renderTimes:n.current}))});oL.SELECTION_COLUMN=tu,oL.EXPAND_COLUMN=r,oL.SELECTION_ALL=tf,oL.SELECTION_INVERT=tp,oL.SELECTION_NONE=tm,oL.Column=e=>null,oL.ColumnGroup=e=>null,oL.Summary=H;var oj=oL}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/6609-d93906f43161f066.js b/litellm/proxy/_experimental/out/_next/static/chunks/6609-d93906f43161f066.js new file mode 100644 index 0000000000..8e0a0e5f3b --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/6609-d93906f43161f066.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6609],{29967:function(e,t,n){n.d(t,{ZP:function(){return B}});var o=n(2265),r=n(36760),a=n.n(r),l=n(92491),c=n(50506),i=n(18242),d=n(71744),s=n(64024),u=n(33759);let f=o.createContext(null),p=f.Provider,m=o.createContext(null),h=m.Provider;var v=n(20873),g=n(28791),b=n(6694),y=n(34709),x=n(66531),w=n(86586),k=n(39109),C=n(93463),E=n(12918),S=n(99320),Z=n(71140);let N=e=>{let{componentCls:t,antCls:n}=e,o="".concat(t,"-group");return{[o]:Object.assign(Object.assign({},(0,E.Wf)(e)),{display:"inline-block",fontSize:0,["&".concat(o,"-rtl")]:{direction:"rtl"},["&".concat(o,"-block")]:{display:"flex"},["".concat(n,"-badge ").concat(n,"-badge-count")]:{zIndex:1},["> ".concat(n,"-badge:not(:first-child) > ").concat(n,"-button-wrapper")]:{borderInlineStart:"none"}})}},K=e=>{let{componentCls:t,wrapperMarginInlineEnd:n,colorPrimary:o,radioSize:r,motionDurationSlow:a,motionDurationMid:l,motionEaseInOutCirc:c,colorBgContainer:i,colorBorder:d,lineWidth:s,colorBgContainerDisabled:u,colorTextDisabled:f,paddingXS:p,dotColorDisabled:m,lineType:h,radioColor:v,radioBgColor:g,calc:b}=e,y="".concat(t,"-inner"),x=b(r).sub(b(4).mul(2)),w=b(1).mul(r).equal({unit:!0});return{["".concat(t,"-wrapper")]:Object.assign(Object.assign({},(0,E.Wf)(e)),{display:"inline-flex",alignItems:"baseline",marginInlineStart:0,marginInlineEnd:n,cursor:"pointer","&:last-child":{marginInlineEnd:0},["&".concat(t,"-wrapper-rtl")]:{direction:"rtl"},"&-disabled":{cursor:"not-allowed",color:e.colorTextDisabled},"&::after":{display:"inline-block",width:0,overflow:"hidden",content:'"\\a0"'},"&-block":{flex:1,justifyContent:"center"},["".concat(t,"-checked::after")]:{position:"absolute",insetBlockStart:0,insetInlineStart:0,width:"100%",height:"100%",border:"".concat((0,C.bf)(s)," ").concat(h," ").concat(o),borderRadius:"50%",visibility:"hidden",opacity:0,content:'""'},[t]:Object.assign(Object.assign({},(0,E.Wf)(e)),{position:"relative",display:"inline-block",outline:"none",cursor:"pointer",alignSelf:"center",borderRadius:"50%"}),["".concat(t,"-wrapper:hover &,\n &:hover ").concat(y)]:{borderColor:o},["".concat(t,"-input:focus-visible + ").concat(y)]:(0,E.oN)(e),["".concat(t,":hover::after, ").concat(t,"-wrapper:hover &::after")]:{visibility:"visible"},["".concat(t,"-inner")]:{"&::after":{boxSizing:"border-box",position:"absolute",insetBlockStart:"50%",insetInlineStart:"50%",display:"block",width:w,height:w,marginBlockStart:b(1).mul(r).div(-2).equal({unit:!0}),marginInlineStart:b(1).mul(r).div(-2).equal({unit:!0}),backgroundColor:v,borderBlockStart:0,borderInlineStart:0,borderRadius:w,transform:"scale(0)",opacity:0,transition:"all ".concat(a," ").concat(c),content:'""'},boxSizing:"border-box",position:"relative",insetBlockStart:0,insetInlineStart:0,display:"block",width:w,height:w,backgroundColor:i,borderColor:d,borderStyle:"solid",borderWidth:s,borderRadius:"50%",transition:"all ".concat(l)},["".concat(t,"-input")]:{position:"absolute",inset:0,zIndex:1,cursor:"pointer",opacity:0},["".concat(t,"-checked")]:{[y]:{borderColor:o,backgroundColor:g,"&::after":{transform:"scale(".concat(e.calc(e.dotSize).div(r).equal(),")"),opacity:1,transition:"all ".concat(a," ").concat(c)}}},["".concat(t,"-disabled")]:{cursor:"not-allowed",[y]:{backgroundColor:u,borderColor:d,cursor:"not-allowed","&::after":{backgroundColor:m}},["".concat(t,"-input")]:{cursor:"not-allowed"},["".concat(t,"-disabled + span")]:{color:f,cursor:"not-allowed"},["&".concat(t,"-checked")]:{[y]:{"&::after":{transform:"scale(".concat(b(x).div(r).equal(),")")}}}},["span".concat(t," + *")]:{paddingInlineStart:p,paddingInlineEnd:p}})}},O=e=>{let{buttonColor:t,controlHeight:n,componentCls:o,lineWidth:r,lineType:a,colorBorder:l,motionDurationMid:c,buttonPaddingInline:i,fontSize:d,buttonBg:s,fontSizeLG:u,controlHeightLG:f,controlHeightSM:p,paddingXS:m,borderRadius:h,borderRadiusSM:v,borderRadiusLG:g,buttonCheckedBg:b,buttonSolidCheckedColor:y,colorTextDisabled:x,colorBgContainerDisabled:w,buttonCheckedBgDisabled:k,buttonCheckedColorDisabled:S,colorPrimary:Z,colorPrimaryHover:N,colorPrimaryActive:K,buttonSolidCheckedBg:O,buttonSolidCheckedHoverBg:I,buttonSolidCheckedActiveBg:R,calc:P}=e;return{["".concat(o,"-button-wrapper")]:{position:"relative",display:"inline-block",height:n,margin:0,paddingInline:i,paddingBlock:0,color:t,fontSize:d,lineHeight:(0,C.bf)(P(n).sub(P(r).mul(2)).equal()),background:s,border:"".concat((0,C.bf)(r)," ").concat(a," ").concat(l),borderBlockStartWidth:P(r).add(.02).equal(),borderInlineEndWidth:r,cursor:"pointer",transition:["color ".concat(c),"background ".concat(c),"box-shadow ".concat(c)].join(","),a:{color:t},["> ".concat(o,"-button")]:{position:"absolute",insetBlockStart:0,insetInlineStart:0,zIndex:-1,width:"100%",height:"100%"},"&:not(:last-child)":{marginInlineEnd:P(r).mul(-1).equal()},"&:first-child":{borderInlineStart:"".concat((0,C.bf)(r)," ").concat(a," ").concat(l),borderStartStartRadius:h,borderEndStartRadius:h},"&:last-child":{borderStartEndRadius:h,borderEndEndRadius:h},"&:first-child:last-child":{borderRadius:h},["".concat(o,"-group-large &")]:{height:f,fontSize:u,lineHeight:(0,C.bf)(P(f).sub(P(r).mul(2)).equal()),"&:first-child":{borderStartStartRadius:g,borderEndStartRadius:g},"&:last-child":{borderStartEndRadius:g,borderEndEndRadius:g}},["".concat(o,"-group-small &")]:{height:p,paddingInline:P(m).sub(r).equal(),paddingBlock:0,lineHeight:(0,C.bf)(P(p).sub(P(r).mul(2)).equal()),"&:first-child":{borderStartStartRadius:v,borderEndStartRadius:v},"&:last-child":{borderStartEndRadius:v,borderEndEndRadius:v}},"&:hover":{position:"relative",color:Z},"&:has(:focus-visible)":(0,E.oN)(e),["".concat(o,"-inner, input[type='checkbox'], input[type='radio']")]:{width:0,height:0,opacity:0,pointerEvents:"none"},["&-checked:not(".concat(o,"-button-wrapper-disabled)")]:{zIndex:1,color:Z,background:b,borderColor:Z,"&::before":{backgroundColor:Z},"&:first-child":{borderColor:Z},"&:hover":{color:N,borderColor:N,"&::before":{backgroundColor:N}},"&:active":{color:K,borderColor:K,"&::before":{backgroundColor:K}}},["".concat(o,"-group-solid &-checked:not(").concat(o,"-button-wrapper-disabled)")]:{color:y,background:O,borderColor:O,"&:hover":{color:y,background:I,borderColor:I},"&:active":{color:y,background:R,borderColor:R}},"&-disabled":{color:x,backgroundColor:w,borderColor:l,cursor:"not-allowed","&:first-child, &:hover":{color:x,backgroundColor:w,borderColor:l}},["&-disabled".concat(o,"-button-wrapper-checked")]:{color:S,backgroundColor:k,borderColor:l,boxShadow:"none"},"&-block":{flex:1,textAlign:"center"}}}};var I=(0,S.I$)("Radio",e=>{let{controlOutline:t,controlOutlineWidth:n}=e,o="0 0 0 ".concat((0,C.bf)(n)," ").concat(t),r=(0,Z.IX)(e,{radioFocusShadow:o,radioButtonFocusShadow:o});return[N(r),K(r),O(r)]},e=>{let{wireframe:t,padding:n,marginXS:o,lineWidth:r,fontSizeLG:a,colorText:l,colorBgContainer:c,colorTextDisabled:i,controlItemBgActiveDisabled:d,colorTextLightSolid:s,colorPrimary:u,colorPrimaryHover:f,colorPrimaryActive:p,colorWhite:m}=e;return{radioSize:a,dotSize:t?a-8:a-(4+r)*2,dotColorDisabled:i,buttonSolidCheckedColor:s,buttonSolidCheckedBg:u,buttonSolidCheckedHoverBg:f,buttonSolidCheckedActiveBg:p,buttonBg:c,buttonCheckedBg:c,buttonColor:l,buttonCheckedBgDisabled:d,buttonCheckedColorDisabled:i,buttonPaddingInline:n-r,wrapperMarginInlineEnd:o,radioColor:t?u:m,radioBgColor:t?c:u}},{unitless:{radioSize:!0,dotSize:!0}}),R=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,o=Object.getOwnPropertySymbols(e);rt.indexOf(o[r])&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]]);return n};let P=o.forwardRef((e,t)=>{var n,r;let l=o.useContext(f),c=o.useContext(m),{getPrefixCls:i,direction:u,radio:p}=o.useContext(d.E_),h=o.useRef(null),C=(0,g.sQ)(t,h),{isFormItemInput:E}=o.useContext(k.aM),{prefixCls:S,className:Z,rootClassName:N,children:K,style:O,title:P}=e,M=R(e,["prefixCls","className","rootClassName","children","style","title"]),T=i("radio",S),D="button"===((null==l?void 0:l.optionType)||c),L=D?"".concat(T,"-button"):T,j=(0,s.Z)(T),[B,H,z]=I(T,j),A=Object.assign({},M),W=o.useContext(w.Z);l&&(A.name=l.name,A.onChange=t=>{var n,o;null===(n=e.onChange)||void 0===n||n.call(e,t),null===(o=null==l?void 0:l.onChange)||void 0===o||o.call(l,t)},A.checked=e.value===l.value,A.disabled=null!==(n=A.disabled)&&void 0!==n?n:l.disabled),A.disabled=null!==(r=A.disabled)&&void 0!==r?r:W;let _=a()("".concat(L,"-wrapper"),{["".concat(L,"-wrapper-checked")]:A.checked,["".concat(L,"-wrapper-disabled")]:A.disabled,["".concat(L,"-wrapper-rtl")]:"rtl"===u,["".concat(L,"-wrapper-in-form-item")]:E,["".concat(L,"-wrapper-block")]:!!(null==l?void 0:l.block)},null==p?void 0:p.className,Z,N,H,z,j),[F,q]=(0,x.Z)(A.onClick);return B(o.createElement(b.Z,{component:"Radio",disabled:A.disabled},o.createElement("label",{className:_,style:Object.assign(Object.assign({},null==p?void 0:p.style),O),onMouseEnter:e.onMouseEnter,onMouseLeave:e.onMouseLeave,title:P,onClick:F},o.createElement(v.Z,Object.assign({},A,{className:a()(A.className,{[y.A]:!D}),type:"radio",prefixCls:L,ref:C,onClick:q})),void 0!==K?o.createElement("span",{className:"".concat(L,"-label")},K):null)))});var M=n(29487);let T=o.forwardRef((e,t)=>{let{getPrefixCls:n,direction:r}=o.useContext(d.E_),{name:f}=o.useContext(k.aM),m=(0,l.Z)((0,M.S)(f)),{prefixCls:h,className:v,rootClassName:g,options:b,buttonStyle:y="outline",disabled:x,children:w,size:C,style:E,id:S,optionType:Z,name:N=m,defaultValue:K,value:O,block:R=!1,onChange:T,onMouseEnter:D,onMouseLeave:L,onFocus:j,onBlur:B}=e,[H,z]=(0,c.Z)(K,{value:O}),A=o.useCallback(t=>{let n=t.target.value;"value"in e||z(n),n!==H&&(null==T||T(t))},[H,z,T]),W=n("radio",h),_="".concat(W,"-group"),F=(0,s.Z)(W),[q,V,X]=I(W,F),U=w;b&&b.length>0&&(U=b.map(e=>"string"==typeof e||"number"==typeof e?o.createElement(P,{key:e.toString(),prefixCls:W,disabled:x,value:e,checked:H===e},e):o.createElement(P,{key:"radio-group-value-options-".concat(e.value),prefixCls:W,disabled:e.disabled||x,value:e.value,checked:H===e.value,title:e.title,style:e.style,className:e.className,id:e.id,required:e.required},e.label)));let G=(0,u.Z)(C),Y=a()(_,"".concat(_,"-").concat(y),{["".concat(_,"-").concat(G)]:G,["".concat(_,"-rtl")]:"rtl"===r,["".concat(_,"-block")]:R},v,g,V,X,F),$=o.useMemo(()=>({onChange:A,value:H,disabled:x,name:N,optionType:Z,block:R}),[A,H,x,N,Z,R]);return q(o.createElement("div",Object.assign({},(0,i.Z)(e,{aria:!0,data:!0}),{className:Y,style:E,onMouseEnter:D,onMouseLeave:L,onFocus:j,onBlur:B,id:S,ref:t}),o.createElement(p,{value:$},U)))});var D=o.memo(T),L=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,o=Object.getOwnPropertySymbols(e);rt.indexOf(o[r])&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]]);return n},j=o.forwardRef((e,t)=>{let{getPrefixCls:n}=o.useContext(d.E_),{prefixCls:r}=e,a=L(e,["prefixCls"]),l=n("radio",r);return o.createElement(h,{value:"button"},o.createElement(P,Object.assign({prefixCls:l},a,{type:"radio",ref:t})))});P.Button=j,P.Group=D,P.__ANT_RADIO=!0;var B=P},56609:function(e,t,n){n.d(t,{Z:function(){return oj}});var o=n(2265),r={},a="rc-table-internal-hook",l=n(26365),c=n(58525),i=n(27380),d=n(16671),s=n(54887);function u(e){var t=o.createContext(void 0);return{Context:t,Provider:function(e){var n=e.value,r=e.children,a=o.useRef(n);a.current=n;var c=o.useState(function(){return{getValue:function(){return a.current},listeners:new Set}}),d=(0,l.Z)(c,1)[0];return(0,i.Z)(function(){(0,s.unstable_batchedUpdates)(function(){d.listeners.forEach(function(e){e(n)})})},[n]),o.createElement(t.Provider,{value:d},r)},defaultValue:e}}function f(e,t){var n=(0,c.Z)("function"==typeof t?t:function(e){if(void 0===t)return e;if(!Array.isArray(t))return e[t];var n={};return t.forEach(function(t){n[t]=e[t]}),n}),r=o.useContext(null==e?void 0:e.Context),a=r||{},s=a.listeners,u=a.getValue,f=o.useRef();f.current=n(r?u():null==e?void 0:e.defaultValue);var p=o.useState({}),m=(0,l.Z)(p,2)[1];return(0,i.Z)(function(){if(r)return s.add(e),function(){s.delete(e)};function e(e){var t=n(e);(0,d.Z)(f.current,t,!0)||m({})}},[r]),f.current}var p=n(1119),m=n(28791);function h(){var e=o.createContext(null);function t(){return o.useContext(e)}return{makeImmutable:function(n,r){var a=(0,m.Yr)(n),l=function(l,c){var i=a?{ref:c}:{},d=o.useRef(0),s=o.useRef(l);return null!==t()?o.createElement(n,(0,p.Z)({},l,i)):((!r||r(s.current,l))&&(d.current+=1),s.current=l,o.createElement(e.Provider,{value:d.current},o.createElement(n,(0,p.Z)({},l,i))))};return a?o.forwardRef(l):l},responseImmutable:function(e,n){var r=(0,m.Yr)(e),a=function(n,a){return t(),o.createElement(e,(0,p.Z)({},n,r?{ref:a}:{}))};return r?o.memo(o.forwardRef(a),n):o.memo(a,n)},useImmutableMark:t}}var v=h();v.makeImmutable,v.responseImmutable,v.useImmutableMark;var g=h(),b=g.makeImmutable,y=g.responseImmutable,x=g.useImmutableMark,w=u(),k=n(41154),C=n(31686),E=n(11993),S=n(36760),Z=n.n(S),N=n(6397),K=n(16847),O=n(32559),I=o.createContext({renderWithProps:!1});function R(e){var t=[],n={};return e.forEach(function(e){for(var o=e||{},r=o.key,a=o.dataIndex,l=r||(null==a?[]:Array.isArray(a)?a:[a]).join("-")||"RC_TABLE_KEY";n[l];)l="".concat(l,"_next");n[l]=!0,t.push(l)}),t}var P=n(74126),M=function(e){var t,n=e.ellipsis,r=e.rowType,a=e.children,l=!0===n?{showTitle:!0}:n;return l&&(l.showTitle||"header"===r)&&("string"==typeof a||"number"==typeof a?t=a.toString():o.isValidElement(a)&&"string"==typeof a.props.children&&(t=a.props.children)),t},T=o.memo(function(e){var t,n,r,a,c,i,s,u,m,h,v=e.component,g=e.children,b=e.ellipsis,y=e.scope,S=e.prefixCls,O=e.className,R=e.align,T=e.record,D=e.render,L=e.dataIndex,j=e.renderIndex,B=e.shouldCellUpdate,H=e.index,z=e.rowType,A=e.colSpan,W=e.rowSpan,_=e.fixLeft,F=e.fixRight,q=e.firstFixLeft,V=e.lastFixLeft,X=e.firstFixRight,U=e.lastFixRight,G=e.appendNode,Y=e.additionalProps,$=void 0===Y?{}:Y,J=e.isSticky,Q="".concat(S,"-cell"),ee=f(w,["supportSticky","allColumnsFixedLeft","rowHoverable"]),et=ee.supportSticky,en=ee.allColumnsFixedLeft,eo=ee.rowHoverable,er=(t=o.useContext(I),n=x(),(0,N.Z)(function(){if(null!=g)return[g];var e=null==L||""===L?[]:Array.isArray(L)?L:[L],n=(0,K.Z)(T,e),r=n,a=void 0;if(D){var l=D(n,T,j);!l||"object"!==(0,k.Z)(l)||Array.isArray(l)||o.isValidElement(l)?r=l:(r=l.children,a=l.props,t.renderWithProps=!0)}return[r,a]},[n,T,g,L,D,j],function(e,n){if(B){var o=(0,l.Z)(e,2)[1];return B((0,l.Z)(n,2)[1],o)}return!!t.renderWithProps||!(0,d.Z)(e,n,!0)})),ea=(0,l.Z)(er,2),el=ea[0],ec=ea[1],ei={},ed="number"==typeof _&&et,es="number"==typeof F&&et;ed&&(ei.position="sticky",ei.left=_),es&&(ei.position="sticky",ei.right=F);var eu=null!==(r=null!==(a=null!==(c=null==ec?void 0:ec.colSpan)&&void 0!==c?c:$.colSpan)&&void 0!==a?a:A)&&void 0!==r?r:1,ef=null!==(i=null!==(s=null!==(u=null==ec?void 0:ec.rowSpan)&&void 0!==u?u:$.rowSpan)&&void 0!==s?s:W)&&void 0!==i?i:1,ep=f(w,function(e){var t,n;return[(t=ef||1,n=e.hoverStartRow,H<=e.hoverEndRow&&H+t-1>=n),e.onHover]}),em=(0,l.Z)(ep,2),eh=em[0],ev=em[1],eg=(0,P.zX)(function(e){var t;T&&ev(H,H+ef-1),null==$||null===(t=$.onMouseEnter)||void 0===t||t.call($,e)}),eb=(0,P.zX)(function(e){var t;T&&ev(-1,-1),null==$||null===(t=$.onMouseLeave)||void 0===t||t.call($,e)});if(0===eu||0===ef)return null;var ey=null!==(m=$.title)&&void 0!==m?m:M({rowType:z,ellipsis:b,children:el}),ex=Z()(Q,O,(h={},(0,E.Z)((0,E.Z)((0,E.Z)((0,E.Z)((0,E.Z)((0,E.Z)((0,E.Z)((0,E.Z)((0,E.Z)((0,E.Z)(h,"".concat(Q,"-fix-left"),ed&&et),"".concat(Q,"-fix-left-first"),q&&et),"".concat(Q,"-fix-left-last"),V&&et),"".concat(Q,"-fix-left-all"),V&&en&&et),"".concat(Q,"-fix-right"),es&&et),"".concat(Q,"-fix-right-first"),X&&et),"".concat(Q,"-fix-right-last"),U&&et),"".concat(Q,"-ellipsis"),b),"".concat(Q,"-with-append"),G),"".concat(Q,"-fix-sticky"),(ed||es)&&J&&et),(0,E.Z)(h,"".concat(Q,"-row-hover"),!ec&&eh)),$.className,null==ec?void 0:ec.className),ew={};R&&(ew.textAlign=R);var ek=(0,C.Z)((0,C.Z)((0,C.Z)((0,C.Z)({},null==ec?void 0:ec.style),ei),ew),$.style),eC=el;return"object"!==(0,k.Z)(eC)||Array.isArray(eC)||o.isValidElement(eC)||(eC=null),b&&(V||X)&&(eC=o.createElement("span",{className:"".concat(Q,"-content")},eC)),o.createElement(v,(0,p.Z)({},ec,$,{className:ex,style:ek,title:ey,scope:y,onMouseEnter:eo?eg:void 0,onMouseLeave:eo?eb:void 0,colSpan:1!==eu?eu:null,rowSpan:1!==ef?ef:null}),G,eC)});function D(e,t,n,o,r){var a,l,c=n[e]||{},i=n[t]||{};"left"===c.fixed?a=o.left["rtl"===r?t:e]:"right"===i.fixed&&(l=o.right["rtl"===r?e:t]);var d=!1,s=!1,u=!1,f=!1,p=n[t+1],m=n[e-1],h=p&&!p.fixed||m&&!m.fixed||n.every(function(e){return"left"===e.fixed});return"rtl"===r?void 0!==a?f=!(m&&"left"===m.fixed)&&h:void 0!==l&&(u=!(p&&"right"===p.fixed)&&h):void 0!==a?d=!(p&&"left"===p.fixed)&&h:void 0!==l&&(s=!(m&&"right"===m.fixed)&&h),{fixLeft:a,fixRight:l,lastFixLeft:d,firstFixRight:s,lastFixRight:u,firstFixLeft:f,isSticky:o.isSticky}}var L=o.createContext({}),j=n(6989),B=["children"];function H(e){return e.children}H.Row=function(e){var t=e.children,n=(0,j.Z)(e,B);return o.createElement("tr",n,t)},H.Cell=function(e){var t=e.className,n=e.index,r=e.children,a=e.colSpan,l=void 0===a?1:a,c=e.rowSpan,i=e.align,d=f(w,["prefixCls","direction"]),s=d.prefixCls,u=d.direction,m=o.useContext(L),h=m.scrollColumnIndex,v=m.stickyOffsets,g=m.flattenColumns,b=n+l-1+1===h?l+1:l,y=D(n,n+b-1,g,v,u);return o.createElement(T,(0,p.Z)({className:t,index:n,component:"td",prefixCls:s,record:null,dataIndex:null,align:i,colSpan:b,rowSpan:c,render:function(){return r}},y))};var z=y(function(e){var t=e.children,n=e.stickyOffsets,r=e.flattenColumns,a=f(w,"prefixCls"),l=r.length-1,c=r[l],i=o.useMemo(function(){return{stickyOffsets:n,flattenColumns:r,scrollColumnIndex:null!=c&&c.scrollbar?l:null}},[c,r,l,n]);return o.createElement(L.Provider,{value:i},o.createElement("tfoot",{className:"".concat(a,"-summary")},t))}),A=n(31474),W=n(10281),_=n(3208),F=n(18242);function q(e,t,n,r){return o.useMemo(function(){if(null!=n&&n.size){for(var o=[],a=0;a<(null==e?void 0:e.length);a+=1)!function e(t,n,o,r,a,l,c){var i=l(n,c);t.push({record:n,indent:o,index:c,rowKey:i});var d=null==a?void 0:a.has(i);if(n&&Array.isArray(n[r])&&d)for(var s=0;s1?n-1:0),r=1;r5&&void 0!==arguments[5]?arguments[5]:[],d=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,s=e.record,u=e.prefixCls,f=e.columnsKey,p=e.fixedInfoList,m=e.expandIconColumnIndex,h=e.nestExpandable,v=e.indentSize,g=e.expandIcon,b=e.expanded,y=e.hasNestChildren,x=e.onTriggerExpand,w=e.expandable,k=e.expandedKeys,C=f[n],E=p[n];n===(m||0)&&h&&(c=o.createElement(o.Fragment,null,o.createElement("span",{style:{paddingLeft:"".concat(v*r,"px")},className:"".concat(u,"-row-indent indent-level-").concat(r)}),g({prefixCls:u,expanded:b,expandable:y,record:s,onExpand:x})));var S=(null===(l=t.onCell)||void 0===l?void 0:l.call(t,s,a))||{};if(d){var Z=S.rowSpan,N=void 0===Z?1:Z;if(w&&N&&n=1)),style:(0,C.Z)((0,C.Z)({},r),null==k?void 0:k.style)}),y.map(function(e,t){var n=e.render,r=e.dataIndex,i=e.className,s=Y(g,e,t,u,l,d,null==v?void 0:v.offset),f=s.key,y=s.fixedInfo,x=s.appendCellNode,w=s.additionalCellProps;return o.createElement(T,(0,p.Z)({className:i,ellipsis:e.ellipsis,align:e.align,scope:e.rowScope,component:e.rowScope?h:m,prefixCls:b,key:f,record:a,index:l,renderIndex:c,dataIndex:r,render:n,shouldCellUpdate:e.shouldCellUpdate},y,{appendNode:x,additionalProps:w}))}));if(N&&(K.current||S)){var R=w(a,l,u+1,S);t=o.createElement(X,{expanded:S,className:Z()("".concat(b,"-expanded-row"),"".concat(b,"-expanded-row-level-").concat(u+1),O),prefixCls:b,component:f,cellComponent:m,colSpan:v?v.colSpan:y.length,stickyOffset:null==v?void 0:v.sticky,isEmpty:!1},R)}return o.createElement(o.Fragment,null,I,t)});function J(e){var t=e.columnKey,n=e.onColumnResize,r=e.prefixCls,a=e.title,l=o.useRef();return(0,i.Z)(function(){l.current&&n(t,l.current.offsetWidth)},[]),o.createElement(A.Z,{data:t},o.createElement("th",{ref:l,className:"".concat(r,"-measure-cell")},o.createElement("div",{className:"".concat(r,"-measure-cell-content")},a||"\xa0")))}var Q=n(2857);function ee(e){var t=e.prefixCls,n=e.columnsKey,r=e.onColumnResize,a=e.columns,l=o.useRef(null),c=f(w,["measureRowRender"]).measureRowRender,i=o.createElement("tr",{"aria-hidden":"true",className:"".concat(t,"-measure-row"),ref:l,tabIndex:-1},o.createElement(A.Z.Collection,{onBatchResize:function(e){(0,Q.Z)(l.current)&&e.forEach(function(e){r(e.data,e.size.offsetWidth)})}},n.map(function(e){var n=a.find(function(t){return t.key===e}),l=null==n?void 0:n.title,c=o.isValidElement(l)?o.cloneElement(l,{ref:null}):l;return o.createElement(J,{prefixCls:t,key:e,columnKey:e,onColumnResize:r,title:c})})));return c?c(i):i}var et=y(function(e){var t,n=e.data,r=e.measureColumnWidth,a=f(w,["prefixCls","getComponent","onColumnResize","flattenColumns","getRowKey","expandedKeys","childrenColumnName","emptyNode","expandedRowOffset","fixedInfoList","colWidths"]),l=a.prefixCls,c=a.getComponent,i=a.onColumnResize,d=a.flattenColumns,s=a.getRowKey,u=a.expandedKeys,p=a.childrenColumnName,m=a.emptyNode,h=a.expandedRowOffset,v=void 0===h?0:h,g=a.colWidths,b=q(n,p,u,s),y=o.useMemo(function(){return b.map(function(e){return e.rowKey})},[b]),x=o.useRef({renderWithProps:!1}),k=o.useMemo(function(){for(var e=d.length-v,t=0,n=0;n=0;d-=1){var s=t[d],u=n&&n[d],m=void 0,h=void 0;if(u&&(m=u[eo],"auto"===a&&(h=u.minWidth)),s||h||m||i){var v=m||{},g=(v.columnType,(0,j.Z)(v,er));l.unshift(o.createElement("col",(0,p.Z)({key:d,style:{width:s,minWidth:h}},g))),i=!0}}return l.length>0?o.createElement("colgroup",null,l):null},el=n(83145),ec=["className","noData","columns","flattenColumns","colWidths","colGroup","columCount","stickyOffsets","direction","fixHeader","stickyTopOffset","stickyBottomOffset","stickyClassName","scrollX","tableLayout","onScroll","children"],ei=o.forwardRef(function(e,t){var n=e.className,r=e.noData,a=e.columns,l=e.flattenColumns,c=e.colWidths,i=e.colGroup,d=e.columCount,s=e.stickyOffsets,u=e.direction,p=e.fixHeader,h=e.stickyTopOffset,v=e.stickyBottomOffset,g=e.stickyClassName,b=e.scrollX,y=e.tableLayout,x=e.onScroll,k=e.children,S=(0,j.Z)(e,ec),N=f(w,["prefixCls","scrollbarSize","isSticky","getComponent"]),K=N.prefixCls,O=N.scrollbarSize,I=N.isSticky,R=(0,N.getComponent)(["header","table"],"table"),P=I&&!p?0:O,M=o.useRef(null),T=o.useCallback(function(e){(0,m.mH)(t,e),(0,m.mH)(M,e)},[]);o.useEffect(function(){function e(e){var t=e.currentTarget,n=e.deltaX;n&&(x({currentTarget:t,scrollLeft:t.scrollLeft+n}),e.preventDefault())}var t=M.current;return null==t||t.addEventListener("wheel",e,{passive:!1}),function(){null==t||t.removeEventListener("wheel",e)}},[]);var D=l[l.length-1],L={fixed:D?D.fixed:null,scrollbar:!0,onHeaderCell:function(){return{className:"".concat(K,"-cell-scrollbar")}}},B=(0,o.useMemo)(function(){return P?[].concat((0,el.Z)(a),[L]):a},[P,a]),H=(0,o.useMemo)(function(){return P?[].concat((0,el.Z)(l),[L]):l},[P,l]),z=(0,o.useMemo)(function(){var e=s.right,t=s.left;return(0,C.Z)((0,C.Z)({},s),{},{left:"rtl"===u?[].concat((0,el.Z)(t.map(function(e){return e+P})),[0]):t,right:"rtl"===u?e:[].concat((0,el.Z)(e.map(function(e){return e+P})),[0]),isSticky:I})},[P,s,I]),A=(0,o.useMemo)(function(){for(var e=[],t=0;t1?"colgroup":"col":null,ellipsis:l.ellipsis,align:l.align,component:c,prefixCls:u,key:h[t]},i,{additionalProps:n,rowType:"header"}))}))},eu=y(function(e){var t=e.stickyOffsets,n=e.columns,r=e.flattenColumns,a=e.onHeaderRow,l=f(w,["prefixCls","getComponent"]),c=l.prefixCls,i=l.getComponent,d=o.useMemo(function(){return function(e){var t=[];!function e(n,o){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;t[r]=t[r]||[];var a=o;return n.filter(Boolean).map(function(n){var o={key:n.key,className:n.className||"",children:n.title,column:n,colStart:a},l=1,c=n.children;return c&&c.length>0&&(l=e(c,a,r+1).reduce(function(e,t){return e+t},0),o.hasSubColumns=!0),"colSpan"in n&&(l=n.colSpan),"rowSpan"in n&&(o.rowSpan=n.rowSpan),o.colSpan=l,o.colEnd=o.colStart+l-1,t[r].push(o),a+=l,l})}(e,0);for(var n=t.length,o=function(e){t[e].forEach(function(t){("rowSpan"in t)||t.hasSubColumns||(t.rowSpan=n-e)})},r=0;r1&&void 0!==arguments[1]?arguments[1]:"";return"number"==typeof t?t:t.endsWith("%")?e*parseFloat(t)/100:null}var em=["children"],eh=["fixed"];function ev(e){return(0,ef.Z)(e).filter(function(e){return o.isValidElement(e)}).map(function(e){var t=e.key,n=e.props,o=n.children,r=(0,j.Z)(n,em),a=(0,C.Z)({key:t},r);return o&&(a.children=ev(o)),a})}function eg(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"key";return e.filter(function(e){return e&&"object"===(0,k.Z)(e)}).reduce(function(e,n,o){var r=n.fixed,a=!0===r?"left":r,l="".concat(t,"-").concat(o),c=n.children;return c&&c.length>0?[].concat((0,el.Z)(e),(0,el.Z)(eg(c,l).map(function(e){var t;return(0,C.Z)((0,C.Z)({},e),{},{fixed:null!==(t=e.fixed)&&void 0!==t?t:a})}))):[].concat((0,el.Z)(e),[(0,C.Z)((0,C.Z)({key:l},n),{},{fixed:a})])},[])}var eb=function(e,t){var n=e.prefixCls,a=e.columns,c=e.children,i=e.expandable,d=e.expandedKeys,s=e.columnTitle,u=e.getRowKey,f=e.onTriggerExpand,p=e.expandIcon,m=e.rowExpandable,h=e.expandIconColumnIndex,v=e.expandedRowOffset,g=void 0===v?0:v,b=e.direction,y=e.expandRowByClick,x=e.columnWidth,w=e.fixed,S=e.scrollWidth,Z=e.clientWidth,N=o.useMemo(function(){return function e(t){return t.filter(function(e){return e&&"object"===(0,k.Z)(e)&&!e.hidden}).map(function(t){var n=t.children;return n&&n.length>0?(0,C.Z)((0,C.Z)({},t),{},{children:e(n)}):t})}((a||ev(c)||[]).slice())},[a,c]),K=o.useMemo(function(){if(i){var e,t=N.slice();if(!t.includes(r)){var a=h||0,l=0===a&&"right"===w?N.length:a;l>=0&&t.splice(l,0,r)}var c=t.indexOf(r);t=t.filter(function(e,t){return e!==r||t===c});var v=N[c];e=w||(v?v.fixed:null);var b=(0,E.Z)((0,E.Z)((0,E.Z)((0,E.Z)((0,E.Z)((0,E.Z)({},eo,{className:"".concat(n,"-expand-icon-col"),columnType:"EXPAND_COLUMN"}),"title",s),"fixed",e),"className","".concat(n,"-row-expand-icon-cell")),"width",x),"render",function(e,t,r){var a=u(t,r),l=p({prefixCls:n,expanded:d.has(a),expandable:!m||m(t),record:t,onExpand:f});return y?o.createElement("span",{onClick:function(e){return e.stopPropagation()}},l):l});return t.map(function(e,t){var n=e===r?b:e;return t=0;t-=1){var n=I[t].fixed;if("left"===n||!0===n){e=t;break}}if(e>=0)for(var o=0;o<=e;o+=1){var r=I[o].fixed;if("left"!==r&&!0!==r)return!0}var a=I.findIndex(function(e){return"right"===e.fixed});if(a>=0){for(var l=a;l0){var e=0,t=0;I.forEach(function(n){var o=ep(S,n.width);o?e+=o:t+=1});var n=Math.max(S,Z),o=Math.max(n-e,t),r=t,a=o/t,l=0,c=I.map(function(e){var t=(0,C.Z)({},e),n=ep(S,t.width);if(n)t.width=n;else{var c=Math.floor(a);t.width=1===r?o:c,o-=c,r-=1}return l+=t.width,t});if(l=n-h})})}})},z=function(e){I(function(t){return(0,C.Z)((0,C.Z)({},t),{},{scrollLeft:y?e/y*x:0})})};return(o.useImperativeHandle(t,function(){return{setScrollLeft:z,checkScrollBarVisible:H}}),o.useEffect(function(){var e=ew(document.body,"mouseup",j,!1),t=ew(document.body,"mousemove",B,!1);return H(),function(){e.remove(),t.remove()}},[k,T]),o.useEffect(function(){if(p.current){for(var e=[],t=(0,eC.bn)(p.current);t;)e.push(t),t=t.parentElement;return e.forEach(function(e){return e.addEventListener("scroll",H,!1)}),window.addEventListener("resize",H,!1),window.addEventListener("scroll",H,!1),v.addEventListener("scroll",H,!1),function(){e.forEach(function(e){return e.removeEventListener("scroll",H)}),window.removeEventListener("resize",H),window.removeEventListener("scroll",H),v.removeEventListener("scroll",H)}}},[v]),o.useEffect(function(){O.isHiddenScrollBar||I(function(e){var t=p.current;return t?(0,C.Z)((0,C.Z)({},e),{},{scrollLeft:t.scrollLeft/t.scrollWidth*t.clientWidth}):e})},[O.isHiddenScrollBar]),y<=x||!k||O.isHiddenScrollBar)?null:o.createElement("div",{style:{height:(0,_.Z)(),width:x,bottom:h},className:"".concat(b,"-sticky-scroll")},o.createElement("div",{onMouseDown:function(e){e.persist(),R.current.delta=e.pageX-O.scrollLeft,R.current.x=0,D(!0),e.preventDefault()},ref:S,className:Z()("".concat(b,"-sticky-scroll-bar"),(0,E.Z)({},"".concat(b,"-sticky-scroll-bar-active"),T)),style:{width:"".concat(k,"px"),transform:"translate3d(".concat(O.scrollLeft,"px, 0, 0)")}}))}),eZ="rc-table",eN=[],eK={};function eO(){return"No Data"}var eI=o.forwardRef(function(e,t){var n,r=(0,C.Z)({rowKey:"key",prefixCls:eZ,emptyText:eO},e),s=r.prefixCls,u=r.className,f=r.rowClassName,m=r.style,h=r.data,v=r.rowKey,g=r.scroll,b=r.tableLayout,y=r.direction,x=r.title,S=r.footer,O=r.summary,I=r.caption,P=r.id,M=r.showHeader,T=r.components,L=r.emptyText,B=r.onRow,q=r.onHeaderRow,V=r.measureRowRender,X=r.onScroll,G=r.internalHooks,Y=r.transformColumns,$=r.internalRefs,J=r.tailor,Q=r.getContainerWidth,ee=r.sticky,eo=r.rowHoverable,er=void 0===eo||eo,ec=h||eN,ei=!!ec.length,es=G===a,ef=o.useCallback(function(e,t){return(0,K.Z)(T,e)||t},[T]),ep=o.useMemo(function(){return"function"==typeof v?v:function(e){return e&&e[v]}},[v]),em=ef(["body"]),eh=(tU=o.useState(-1),tY=(tG=(0,l.Z)(tU,2))[0],t$=tG[1],tJ=o.useState(-1),t0=(tQ=(0,l.Z)(tJ,2))[0],t1=tQ[1],[tY,t0,o.useCallback(function(e,t){t$(e),t1(t)},[])]),ev=(0,l.Z)(eh,3),eg=ev[0],ew=ev[1],ek=ev[2],eE=(t8=(t3=r.expandable,t4=(0,j.Z)(r,en),!1===(t2="expandable"in r?(0,C.Z)((0,C.Z)({},t4),t3):t4).showExpandColumn&&(t2.expandIconColumnIndex=-1),t2).expandIcon,t6=t2.expandedRowKeys,t5=t2.defaultExpandedRowKeys,t7=t2.defaultExpandAllRows,t9=t2.expandedRowRender,ne=t2.onExpand,nt=t2.onExpandedRowsChange,nn=t2.childrenColumnName||"children",no=o.useMemo(function(){return t9?"row":!!(r.expandable&&r.internalHooks===a&&r.expandable.__PARENT_RENDER_ICON__||ec.some(function(e){return e&&"object"===(0,k.Z)(e)&&e[nn]}))&&"nest"},[!!t9,ec]),nr=o.useState(function(){if(t5)return t5;if(t7){var e;return e=[],function t(n){(n||[]).forEach(function(n,o){e.push(ep(n,o)),t(n[nn])})}(ec),e}return[]}),nl=(na=(0,l.Z)(nr,2))[0],nc=na[1],ni=o.useMemo(function(){return new Set(t6||nl||[])},[t6,nl]),nd=o.useCallback(function(e){var t,n=ep(e,ec.indexOf(e)),o=ni.has(n);o?(ni.delete(n),t=(0,el.Z)(ni)):t=[].concat((0,el.Z)(ni),[n]),nc(t),ne&&ne(!o,e),nt&&nt(t)},[ep,ni,ec,ne,nt]),[t2,no,ni,t8||U,nn,nd]),eI=(0,l.Z)(eE,6),eR=eI[0],eP=eI[1],eM=eI[2],eT=eI[3],eD=eI[4],eL=eI[5],ej=null==g?void 0:g.x,eB=o.useState(0),eH=(0,l.Z)(eB,2),ez=eH[0],eA=eH[1],eW=eb((0,C.Z)((0,C.Z)((0,C.Z)({},r),eR),{},{expandable:!!eR.expandedRowRender,columnTitle:eR.columnTitle,expandedKeys:eM,getRowKey:ep,onTriggerExpand:eL,expandIcon:eT,expandIconColumnIndex:eR.expandIconColumnIndex,direction:y,scrollWidth:es&&J&&"number"==typeof ej?ej:null,clientWidth:ez}),es?Y:null),e_=(0,l.Z)(eW,4),eF=e_[0],eq=e_[1],eV=e_[2],eX=e_[3],eU=null!=eV?eV:ej,eG=o.useMemo(function(){return{columns:eF,flattenColumns:eq}},[eF,eq]),eY=o.useRef(),e$=o.useRef(),eJ=o.useRef(),eQ=o.useRef();o.useImperativeHandle(t,function(){return{nativeElement:eY.current,scrollTo:function(e){var t;if(eJ.current instanceof HTMLElement){var n=e.index,o=e.top,r=e.key;if("number"!=typeof o||Number.isNaN(o)){var a,l,c=null!=r?r:ep(ec[n]);null===(l=eJ.current.querySelector('[data-row-key="'.concat(c,'"]')))||void 0===l||l.scrollIntoView()}else null===(a=eJ.current)||void 0===a||a.scrollTo({top:o})}else null!==(t=eJ.current)&&void 0!==t&&t.scrollTo&&eJ.current.scrollTo(e)}}});var e0=o.useRef(),e1=o.useState(!1),e2=(0,l.Z)(e1,2),e3=e2[0],e4=e2[1],e8=o.useState(!1),e6=(0,l.Z)(e8,2),e5=e6[0],e7=e6[1],e9=o.useState(new Map),te=(0,l.Z)(e9,2),tt=te[0],tn=te[1],to=R(eq).map(function(e){return tt.get(e)}),tr=o.useMemo(function(){return to},[to.join("_")]),ta=(0,o.useMemo)(function(){var e=eq.length,t=function(e,t,n){for(var o=[],r=0,a=e;a!==t;a+=n)o.push(r),eq[a].fixed&&(r+=tr[a]||0);return o},n=t(0,e,1),o=t(e-1,-1,-1).reverse();return"rtl"===y?{left:o,right:n}:{left:n,right:o}},[tr,eq,y]),tl=g&&null!=g.y,tc=g&&null!=eU||!!eR.fixed,ti=tc&&eq.some(function(e){return e.fixed}),td=o.useRef(),ts=(nf=void 0===(nu=(ns="object"===(0,k.Z)(ee)?ee:{}).offsetHeader)?0:nu,nm=void 0===(np=ns.offsetSummary)?0:np,nv=void 0===(nh=ns.offsetScroll)?0:nh,nb=(void 0===(ng=ns.getContainer)?function(){return ey}:ng)()||ey,ny=!!ee,o.useMemo(function(){return{isSticky:ny,stickyClassName:ny?"".concat(s,"-sticky-holder"):"",offsetHeader:nf,offsetSummary:nm,offsetScroll:nv,container:nb}},[ny,nv,nf,nm,s,nb])),tu=ts.isSticky,tf=ts.offsetHeader,tp=ts.offsetSummary,tm=ts.offsetScroll,th=ts.stickyClassName,tv=ts.container,tg=o.useMemo(function(){return null==O?void 0:O(ec)},[O,ec]),tb=(tl||tu)&&o.isValidElement(tg)&&tg.type===H&&tg.props.fixed;tl&&(nw={overflowY:ei?"scroll":"auto",maxHeight:g.y}),tc&&(nx={overflowX:"auto"},tl||(nw={overflowY:"hidden"}),nk={width:!0===eU?"auto":eU,minWidth:"100%"});var ty=o.useCallback(function(e,t){tn(function(n){if(n.get(e)!==t){var o=new Map(n);return o.set(e,t),o}return n})},[]),tx=function(e){var t=(0,o.useRef)(null),n=(0,o.useRef)();function r(){window.clearTimeout(n.current)}return(0,o.useEffect)(function(){return r},[]),[function(e){t.current=e,r(),n.current=window.setTimeout(function(){t.current=null,n.current=void 0},100)},function(){return t.current}]}(0),tw=(0,l.Z)(tx,2),tk=tw[0],tC=tw[1];function tE(e,t){t&&("function"==typeof t?t(e):t.scrollLeft!==e&&(t.scrollLeft=e,t.scrollLeft!==e&&setTimeout(function(){t.scrollLeft=e},0)))}var tS=(0,c.Z)(function(e){var t,n=e.currentTarget,o=e.scrollLeft,r="rtl"===y,a="number"==typeof o?o:n.scrollLeft,l=n||eK;tC()&&tC()!==l||(tk(l),tE(a,e$.current),tE(a,eJ.current),tE(a,e0.current),tE(a,null===(t=td.current)||void 0===t?void 0:t.setScrollLeft));var c=n||e$.current;if(c){var i=es&&J&&"number"==typeof eU?eU:c.scrollWidth,d=c.clientWidth;if(i===d){e4(!1),e7(!1);return}r?(e4(-a0)):(e4(a>0),e7(a1?x-D:0,pointerEvents:"auto"}),j=o.useMemo(function(){return h?M<=1:0===R||0===M||M>1},[M,R,h]);j?L.visibility="hidden":h&&(L.height=null==v?void 0:v(M));var B={};return(0===M||0===R)&&(B.rowSpan=1,B.colSpan=1),o.createElement(T,(0,p.Z)({className:Z()(y,m),ellipsis:r.ellipsis,align:r.align,scope:r.rowScope,component:i,prefixCls:n.prefixCls,key:E,record:s,index:c,renderIndex:d,dataIndex:b,render:j?function(){return null}:g,shouldCellUpdate:r.shouldCellUpdate},S,{appendNode:N,additionalProps:(0,C.Z)((0,C.Z)({},K),{},{style:L},B)}))},eL=["data","index","className","rowKey","style","extra","getHeight"],ej=y(o.forwardRef(function(e,t){var n,r=e.data,a=e.index,l=e.className,c=e.rowKey,i=e.style,d=e.extra,s=e.getHeight,u=(0,j.Z)(e,eL),m=r.record,h=r.indent,v=r.index,g=f(w,["prefixCls","flattenColumns","fixColumn","componentWidth","scrollX"]),b=g.scrollX,y=g.flattenColumns,x=g.prefixCls,k=g.fixColumn,S=g.componentWidth,N=f(eM,["getComponent"]).getComponent,K=V(m,c,a,h),O=N(["body","row"],"div"),I=N(["body","cell"],"div"),R=K.rowSupportExpand,P=K.expanded,M=K.rowProps,D=K.expandedRowRender,L=K.expandedRowClassName;if(R&&P){var B=D(m,a,h+1,P),H=G(L,m,a,h),z={};k&&(z={style:(0,E.Z)({},"--virtual-width","".concat(S,"px"))});var A="".concat(x,"-expanded-row-cell");n=o.createElement(O,{className:Z()("".concat(x,"-expanded-row"),"".concat(x,"-expanded-row-level-").concat(h+1),H)},o.createElement(T,{component:I,prefixCls:x,className:Z()(A,(0,E.Z)({},"".concat(A,"-fixed"),k)),additionalProps:z},B))}var W=(0,C.Z)((0,C.Z)({},i),{},{width:b});d&&(W.position="absolute",W.pointerEvents="none");var _=o.createElement(O,(0,p.Z)({},M,u,{"data-row-key":c,ref:R?null:t,className:Z()(l,"".concat(x,"-row"),null==M?void 0:M.className,(0,E.Z)({},"".concat(x,"-row-extra"),d)),style:(0,C.Z)((0,C.Z)({},W),null==M?void 0:M.style)}),y.map(function(e,t){return o.createElement(eD,{key:t,component:I,rowInfo:K,column:e,colIndex:t,indent:h,index:a,renderIndex:v,record:m,inverse:d,getHeight:s})}));return R?o.createElement("div",{ref:t},_,n):_})),eB=y(o.forwardRef(function(e,t){var n=e.data,r=e.onScroll,a=f(w,["flattenColumns","onColumnResize","getRowKey","prefixCls","expandedKeys","childrenColumnName","scrollX","direction"]),c=a.flattenColumns,i=a.onColumnResize,d=a.getRowKey,s=a.expandedKeys,u=a.prefixCls,p=a.childrenColumnName,m=a.scrollX,h=a.direction,v=f(eM),g=v.sticky,b=v.scrollY,y=v.listItemHeight,x=v.getComponent,C=v.onScroll,E=o.useRef(),S=q(n,p,s,d),Z=o.useMemo(function(){var e=0;return c.map(function(t){var n=t.width,o=t.minWidth,r=t.key,a=Math.max(n||0,o||0);return e+=a,[r,a,e]})},[c]),N=o.useMemo(function(){return Z.map(function(e){return e[2]})},[Z]);o.useEffect(function(){Z.forEach(function(e){var t=(0,l.Z)(e,2);i(t[0],t[1])})},[Z]),o.useImperativeHandle(t,function(){var e,t={scrollTo:function(e){var t;null===(t=E.current)||void 0===t||t.scrollTo(e)},nativeElement:null===(e=E.current)||void 0===e?void 0:e.nativeElement};return Object.defineProperty(t,"scrollLeft",{get:function(){var e;return(null===(e=E.current)||void 0===e?void 0:e.getScrollInfo().x)||0},set:function(e){var t;null===(t=E.current)||void 0===t||t.scrollTo({left:e})}}),Object.defineProperty(t,"scrollTop",{get:function(){var e;return(null===(e=E.current)||void 0===e?void 0:e.getScrollInfo().y)||0},set:function(e){var t;null===(t=E.current)||void 0===t||t.scrollTo({top:e})}}),t});var K=function(e,t){var n=null===(r=S[t])||void 0===r?void 0:r.record,o=e.onCell;if(o){var r,a,l=o(n,t);return null!==(a=null==l?void 0:l.rowSpan)&&void 0!==a?a:1}return 1},O=o.useMemo(function(){return{columnsOffset:N}},[N]),I="".concat(u,"-tbody"),R=x(["body","wrapper"]),P={};return g&&(P.position="sticky",P.bottom=0,"object"===(0,k.Z)(g)&&g.offsetScroll&&(P.bottom=g.offsetScroll)),o.createElement(eT.Provider,{value:O},o.createElement(eP.Z,{fullHeight:!1,ref:E,prefixCls:"".concat(I,"-virtual"),styles:{horizontalScrollBar:P},className:I,height:b,itemHeight:y||24,data:S,itemKey:function(e){return d(e.record)},component:R,scrollWidth:m,direction:h,onVirtualScroll:function(e){var t,n=e.x;r({currentTarget:null===(t=E.current)||void 0===t?void 0:t.nativeElement,scrollLeft:n})},onScroll:C,extraRender:function(e){var t=e.start,n=e.end,r=e.getSize,a=e.offsetY;if(n<0)return null;for(var l=c.filter(function(e){return 0===K(e,t)}),i=t,s=function(e){if(!(l=l.filter(function(t){return 0===K(t,e)})).length)return i=e,1},u=t;u>=0&&!s(u);u-=1);for(var f=c.filter(function(e){return 1!==K(e,n)}),p=n,m=function(e){if(!(f=f.filter(function(t){return 1!==K(t,e)})).length)return p=Math.max(e-1,n),1},h=n;h1})&&v.push(e)},b=i;b<=p;b+=1)if(g(b))continue;return v.map(function(e){var t=S[e],n=d(t.record,e),l=r(n);return o.createElement(ej,{key:e,data:t,rowKey:n,index:e,style:{top:-a+l.top},extra:!0,getHeight:function(t){var o=e+t-1,a=r(n,d(S[o].record,o));return a.bottom-a.top}})})}},function(e,t,n){var r=d(e.record,t);return o.createElement(ej,{data:e,rowKey:r,index:t,style:n.style})}))})),eH=function(e,t){var n=t.ref,r=t.onScroll;return o.createElement(eB,{ref:n,data:e,onScroll:r})},ez=o.forwardRef(function(e,t){var n=e.data,r=e.columns,l=e.scroll,c=e.sticky,i=e.prefixCls,d=void 0===i?eZ:i,s=e.className,u=e.listItemHeight,f=e.components,m=e.onScroll,h=l||{},v=h.x,g=h.y;"number"!=typeof v&&(v=1),"number"!=typeof g&&(g=500);var b=(0,P.zX)(function(e,t){return(0,K.Z)(f,e)||t}),y=(0,P.zX)(m),x=o.useMemo(function(){return{sticky:c,scrollY:g,listItemHeight:u,getComponent:b,onScroll:y}},[c,g,u,b,y]);return o.createElement(eM.Provider,{value:x},o.createElement(eR,(0,p.Z)({},e,{className:Z()(s,"".concat(d,"-virtual")),scroll:(0,C.Z)((0,C.Z)({},l),{},{x:v}),components:(0,C.Z)((0,C.Z)({},f),{},{body:null!=n&&n.length?eH:void 0}),columns:r,internalHooks:a,tailor:!0,ref:t})))});b(ez,void 0);var eA=n(70464),eW=o.createContext(null),e_=o.createContext({}),eF=o.memo(function(e){for(var t=e.prefixCls,n=e.level,r=e.isStart,a=e.isEnd,l="".concat(t,"-indent-unit"),c=[],i=0;i1&&void 0!==arguments[1]?arguments[1]:null;return n.map(function(d,s){for(var u,f=eX(o?o.pos:"0",s),p=eU(d[a],f),m=0;m1&&void 0!==arguments[1]?arguments[1]:{},f=u.initWrapper,p=u.processEntity,m=u.onProcessFinished,h=u.externalGetKey,v=u.childrenPropName,g=u.fieldNames,b=arguments.length>2?arguments[2]:void 0,y={},x={},w={posEntities:y,keyEntities:x};return f&&(w=f(w)||w),t=function(e){var t=e.node,n=e.index,o=e.pos,r=e.key,a=e.parentPos,l=e.level,c={node:t,nodes:e.nodes,index:n,key:r,pos:o,level:l},i=eU(r,o);y[o]=c,x[i]=c,c.parent=y[a],c.parent&&(c.parent.children=c.parent.children||[],c.parent.children.push(c)),p&&p(c,w)},n={externalGetKey:h||b,childrenPropName:v,fieldNames:g},a=(r=("object"===(0,k.Z)(n)?n:{externalGetKey:n})||{}).childrenPropName,l=r.externalGetKey,i=(c=eG(r.fieldNames)).key,d=c.children,s=a||d,l?"string"==typeof l?o=function(e){return e[l]}:"function"==typeof l&&(o=function(e){return l(e)}):o=function(e,t){return eU(e[i],t)},function n(r,a,l,c){var i=r?r[s]:e,d=r?eX(l.pos,a):"0",u=r?[].concat((0,el.Z)(c),[r]):[];if(r){var f=o(r,d);t({node:r,index:a,pos:d,key:f,parentPos:l.node?l.pos:null,level:l.level+1,nodes:u})}i&&i.forEach(function(e,t){n(e,t,{node:r,pos:d,level:l?l.level+1:-1},u)})}(null),m&&m(w),w}function eQ(e,t){var n=t.expandedKeys,o=t.selectedKeys,r=t.loadedKeys,a=t.loadingKeys,l=t.checkedKeys,c=t.halfCheckedKeys,i=t.dragOverNodeKey,d=t.dropPosition,s=t.keyEntities[e];return{eventKey:e,expanded:-1!==n.indexOf(e),selected:-1!==o.indexOf(e),loaded:-1!==r.indexOf(e),loading:-1!==a.indexOf(e),checked:-1!==l.indexOf(e),halfChecked:-1!==c.indexOf(e),pos:String(s?s.pos:""),dragOver:i===e&&0===d,dragOverGapTop:i===e&&-1===d,dragOverGapBottom:i===e&&1===d}}function e0(e){var t=e.data,n=e.expanded,o=e.selected,r=e.checked,a=e.loaded,l=e.loading,c=e.halfChecked,i=e.dragOver,d=e.dragOverGapTop,s=e.dragOverGapBottom,u=e.pos,f=e.active,p=e.eventKey,m=(0,C.Z)((0,C.Z)({},t),{},{expanded:n,selected:o,checked:r,loaded:a,loading:l,halfChecked:c,dragOver:i,dragOverGapTop:d,dragOverGapBottom:s,pos:u,active:f,key:p});return"props"in m||Object.defineProperty(m,"props",{get:function(){return(0,O.ZP)(!1,"Second param return from event is node data instead of TreeNode instance. Please read value directly instead of reading from `props`."),e}}),m}var e1=["eventKey","className","style","dragOver","dragOverGapTop","dragOverGapBottom","isLeaf","isStart","isEnd","expanded","selected","checked","halfChecked","loading","domRef","active","data","onMouseMove","selectable"],e2="open",e3="close",e4=function(e){var t,n,r,a=e.eventKey,c=e.className,i=e.style,d=e.dragOver,s=e.dragOverGapTop,u=e.dragOverGapBottom,f=e.isLeaf,m=e.isStart,h=e.isEnd,v=e.expanded,g=e.selected,b=e.checked,y=e.halfChecked,x=e.loading,w=e.domRef,k=e.active,S=e.data,N=e.onMouseMove,K=e.selectable,O=(0,j.Z)(e,e1),I=o.useContext(eW),R=o.useContext(e_),P=o.useRef(null),M=o.useState(!1),T=(0,l.Z)(M,2),D=T[0],L=T[1],B=!!(I.disabled||e.disabled||null!==(t=R.nodeDisabled)&&void 0!==t&&t.call(R,S)),H=o.useMemo(function(){return!!I.checkable&&!1!==e.checkable&&I.checkable},[I.checkable,e.checkable]),z=function(t){B||I.onNodeSelect(t,e0(e))},A=function(t){B||!H||e.disableCheckbox||I.onNodeCheck(t,e0(e),!b)},W=o.useMemo(function(){return"boolean"==typeof K?K:I.selectable},[K,I.selectable]),_=function(t){I.onNodeClick(t,e0(e)),W?z(t):A(t)},q=function(t){I.onNodeDoubleClick(t,e0(e))},V=function(t){I.onNodeMouseEnter(t,e0(e))},X=function(t){I.onNodeMouseLeave(t,e0(e))},U=function(t){I.onNodeContextMenu(t,e0(e))},G=o.useMemo(function(){return!!(I.draggable&&(!I.draggable.nodeDraggable||I.draggable.nodeDraggable(S)))},[I.draggable,S]),Y=function(t){x||I.onNodeExpand(t,e0(e))},$=o.useMemo(function(){return!!((I.keyEntities[a]||{}).children||[]).length},[I.keyEntities,a]),J=o.useMemo(function(){return!1!==f&&(f||!I.loadData&&!$||I.loadData&&e.loaded&&!$)},[f,I.loadData,$,e.loaded]);o.useEffect(function(){!x&&("function"!=typeof I.loadData||!v||J||e.loaded||I.onNodeLoad(e0(e)))},[x,I.loadData,I.onNodeLoad,v,J,e]);var Q=o.useMemo(function(){var e;return null!==(e=I.draggable)&&void 0!==e&&e.icon?o.createElement("span",{className:"".concat(I.prefixCls,"-draggable-icon")},I.draggable.icon):null},[I.draggable]),ee=function(t){var n=e.switcherIcon||I.switcherIcon;return"function"==typeof n?n((0,C.Z)((0,C.Z)({},e),{},{isLeaf:t})):n},et=o.useMemo(function(){if(!H)return null;var t="boolean"!=typeof H?H:null;return o.createElement("span",{className:Z()("".concat(I.prefixCls,"-checkbox"),(0,E.Z)((0,E.Z)((0,E.Z)({},"".concat(I.prefixCls,"-checkbox-checked"),b),"".concat(I.prefixCls,"-checkbox-indeterminate"),!b&&y),"".concat(I.prefixCls,"-checkbox-disabled"),B||e.disableCheckbox)),onClick:A,role:"checkbox","aria-checked":y?"mixed":b,"aria-disabled":B||e.disableCheckbox,"aria-label":"Select ".concat("string"==typeof e.title?e.title:"tree node")},t)},[H,b,y,B,e.disableCheckbox,e.title]),en=o.useMemo(function(){return J?null:v?e2:e3},[J,v]),eo=o.useMemo(function(){return o.createElement("span",{className:Z()("".concat(I.prefixCls,"-iconEle"),"".concat(I.prefixCls,"-icon__").concat(en||"docu"),(0,E.Z)({},"".concat(I.prefixCls,"-icon_loading"),x))})},[I.prefixCls,en,x]),er=o.useMemo(function(){var t=!!I.draggable;return!e.disabled&&t&&I.dragOverNodeKey===a?I.dropIndicatorRender({dropPosition:I.dropPosition,dropLevelOffset:I.dropLevelOffset,indent:I.indent,prefixCls:I.prefixCls,direction:I.direction}):null},[I.dropPosition,I.dropLevelOffset,I.indent,I.prefixCls,I.direction,I.draggable,I.dragOverNodeKey,I.dropIndicatorRender]),ea=o.useMemo(function(){var t,n,r=e.title,a=void 0===r?"---":r,l="".concat(I.prefixCls,"-node-content-wrapper");if(I.showIcon){var c=e.icon||I.icon;t=c?o.createElement("span",{className:Z()("".concat(I.prefixCls,"-iconEle"),"".concat(I.prefixCls,"-icon__customize"))},"function"==typeof c?c(e):c):eo}else I.loadData&&x&&(t=eo);return n="function"==typeof a?a(S):I.titleRender?I.titleRender(S):a,o.createElement("span",{ref:P,title:"string"==typeof a?a:"",className:Z()(l,"".concat(l,"-").concat(en||"normal"),(0,E.Z)({},"".concat(I.prefixCls,"-node-selected"),!B&&(g||D))),onMouseEnter:V,onMouseLeave:X,onContextMenu:U,onClick:_,onDoubleClick:q},t,o.createElement("span",{className:"".concat(I.prefixCls,"-title")},n),er)},[I.prefixCls,I.showIcon,e,I.icon,eo,I.titleRender,S,en,V,X,U,_,q]),el=(0,F.Z)(O,{aria:!0,data:!0}),ec=(I.keyEntities[a]||{}).level,ei=h[h.length-1],ed=!B&&G,es=I.draggingNodeKey===a;return o.createElement("div",(0,p.Z)({ref:w,role:"treeitem","aria-expanded":f?void 0:v,className:Z()(c,"".concat(I.prefixCls,"-treenode"),(r={},(0,E.Z)((0,E.Z)((0,E.Z)((0,E.Z)((0,E.Z)((0,E.Z)((0,E.Z)((0,E.Z)((0,E.Z)((0,E.Z)(r,"".concat(I.prefixCls,"-treenode-disabled"),B),"".concat(I.prefixCls,"-treenode-switcher-").concat(v?"open":"close"),!f),"".concat(I.prefixCls,"-treenode-checkbox-checked"),b),"".concat(I.prefixCls,"-treenode-checkbox-indeterminate"),y),"".concat(I.prefixCls,"-treenode-selected"),g),"".concat(I.prefixCls,"-treenode-loading"),x),"".concat(I.prefixCls,"-treenode-active"),k),"".concat(I.prefixCls,"-treenode-leaf-last"),ei),"".concat(I.prefixCls,"-treenode-draggable"),G),"dragging",es),(0,E.Z)((0,E.Z)((0,E.Z)((0,E.Z)((0,E.Z)((0,E.Z)((0,E.Z)(r,"drop-target",I.dropTargetKey===a),"drop-container",I.dropContainerKey===a),"drag-over",!B&&d),"drag-over-gap-top",!B&&s),"drag-over-gap-bottom",!B&&u),"filter-node",null===(n=I.filterTreeNode)||void 0===n?void 0:n.call(I,e0(e))),"".concat(I.prefixCls,"-treenode-leaf"),J))),style:i,draggable:ed,onDragStart:ed?function(t){t.stopPropagation(),L(!0),I.onNodeDragStart(t,e);try{t.dataTransfer.setData("text/plain","")}catch(e){}}:void 0,onDragEnter:G?function(t){t.preventDefault(),t.stopPropagation(),I.onNodeDragEnter(t,e)}:void 0,onDragOver:G?function(t){t.preventDefault(),t.stopPropagation(),I.onNodeDragOver(t,e)}:void 0,onDragLeave:G?function(t){t.stopPropagation(),I.onNodeDragLeave(t,e)}:void 0,onDrop:G?function(t){t.preventDefault(),t.stopPropagation(),L(!1),I.onNodeDrop(t,e)}:void 0,onDragEnd:G?function(t){t.stopPropagation(),L(!1),I.onNodeDragEnd(t,e)}:void 0,onMouseMove:N},void 0!==K?{"aria-selected":!!K}:void 0,el),o.createElement(eF,{prefixCls:I.prefixCls,level:ec,isStart:m,isEnd:h}),Q,function(){if(J){var e=ee(!0);return!1!==e?o.createElement("span",{className:Z()("".concat(I.prefixCls,"-switcher"),"".concat(I.prefixCls,"-switcher-noop"))},e):null}var t=ee(!1);return!1!==t?o.createElement("span",{onClick:Y,className:Z()("".concat(I.prefixCls,"-switcher"),"".concat(I.prefixCls,"-switcher_").concat(v?e2:e3))},t):null}(),et,ea)};function e8(e,t){if(!e)return[];var n=e.slice(),o=n.indexOf(t);return o>=0&&n.splice(o,1),n}function e6(e,t){var n=(e||[]).slice();return -1===n.indexOf(t)&&n.push(t),n}function e5(e){return e.split("-")}function e7(e,t,n,o,r,a,l,c,i,d){var s,u,f=e.clientX,p=e.clientY,m=e.target.getBoundingClientRect(),h=m.top,v=m.height,g=(("rtl"===d?-1:1)*(((null==r?void 0:r.x)||0)-f)-12)/o,b=i.filter(function(e){var t;return null===(t=c[e])||void 0===t||null===(t=t.children)||void 0===t?void 0:t.length}),y=c[n.eventKey];if(p-1.5?a({dragNode:N,dropNode:K,dropPosition:1})?E=1:O=!1:a({dragNode:N,dropNode:K,dropPosition:0})?E=0:a({dragNode:N,dropNode:K,dropPosition:1})?E=1:O=!1:a({dragNode:N,dropNode:K,dropPosition:1})?E=1:O=!1,{dropPosition:E,dropLevelOffset:S,dropTargetKey:y.key,dropTargetPos:y.pos,dragOverNodeKey:C,dropContainerKey:0===E?null:(null===(u=y.parent)||void 0===u?void 0:u.key)||null,dropAllowed:O}}function e9(e,t){if(e)return t.multiple?e.slice():e.length?[e[0]]:e}function te(e){var t;if(!e)return null;if(Array.isArray(e))t={checkedKeys:e,halfCheckedKeys:void 0};else{if("object"!==(0,k.Z)(e))return(0,O.ZP)(!1,"`checkedKeys` is not an array or an object"),null;t={checkedKeys:e.checked||void 0,halfCheckedKeys:e.halfChecked||void 0}}return t}function tt(e,t){var n=new Set;return(e||[]).forEach(function(e){!function e(o){if(!n.has(o)){var r=t[o];if(r){n.add(o);var a=r.parent;!r.node.disabled&&a&&e(a.key)}}}(e)}),(0,el.Z)(n)}function tn(e,t){var n=new Set;return e.forEach(function(e){t.has(e)||n.add(e)}),n}function to(e){var t=e||{},n=t.disabled,o=t.disableCheckbox,r=t.checkable;return!!(n||o)||!1===r}function tr(e,t,n,o){var r,a=[];r=o||to;var l=new Set(e.filter(function(e){var t=!!n[e];return t||a.push(e),t})),c=new Map,i=0;return Object.keys(n).forEach(function(e){var t=n[e],o=t.level,r=c.get(o);r||(r=new Set,c.set(o,r)),r.add(t),i=Math.max(i,o)}),(0,O.ZP)(!a.length,"Tree missing follow keys: ".concat(a.slice(0,100).map(function(e){return"'".concat(e,"'")}).join(", "))),!0===t?function(e,t,n,o){for(var r=new Set(e),a=new Set,l=0;l<=n;l+=1)(t.get(l)||new Set).forEach(function(e){var t=e.key,n=e.node,a=e.children,l=void 0===a?[]:a;r.has(t)&&!o(n)&&l.filter(function(e){return!o(e.node)}).forEach(function(e){r.add(e.key)})});for(var c=new Set,i=n;i>=0;i-=1)(t.get(i)||new Set).forEach(function(e){var t=e.parent;if(!(o(e.node)||!e.parent||c.has(e.parent.key))){if(o(e.parent.node)){c.add(t.key);return}var n=!0,l=!1;(t.children||[]).filter(function(e){return!o(e.node)}).forEach(function(e){var t=e.key,o=r.has(t);n&&!o&&(n=!1),!l&&(o||a.has(t))&&(l=!0)}),n&&r.add(t.key),l&&a.add(t.key),c.add(t.key)}});return{checkedKeys:Array.from(r),halfCheckedKeys:Array.from(tn(a,r))}}(l,c,i,r):function(e,t,n,o,r){for(var a=new Set(e),l=new Set(t),c=0;c<=o;c+=1)(n.get(c)||new Set).forEach(function(e){var t=e.key,n=e.node,o=e.children,c=void 0===o?[]:o;a.has(t)||l.has(t)||r(n)||c.filter(function(e){return!r(e.node)}).forEach(function(e){a.delete(e.key)})});l=new Set;for(var i=new Set,d=o;d>=0;d-=1)(n.get(d)||new Set).forEach(function(e){var t=e.parent;if(!(r(e.node)||!e.parent||i.has(e.parent.key))){if(r(e.parent.node)){i.add(t.key);return}var n=!0,o=!1;(t.children||[]).filter(function(e){return!r(e.node)}).forEach(function(e){var t=e.key,r=a.has(t);n&&!r&&(n=!1),!o&&(r||l.has(t))&&(o=!0)}),n||a.delete(t.key),o&&l.add(t.key),i.add(t.key)}});return{checkedKeys:Array.from(a),halfCheckedKeys:Array.from(tn(l,a))}}(l,t.halfCheckedKeys,c,i,r)}e4.isTreeNode=1;var ta=n(50506);let tl=e=>{let[t,n]=(0,o.useState)(null);return[(0,o.useCallback)((o,r,a)=>{let l=null!=t?t:o,c=Math.max(l||0,o),i=r.slice(Math.min(l||0,o),c+1).map(e),d=i.some(e=>!a.has(e)),s=[];return i.forEach(e=>{d?(a.has(e)||s.push(e),a.add(e)):(a.delete(e),s.push(e))}),n(d?c:null),s},[t]),n]};var tc=n(13613),ti=n(61994),td=n(73705),ts=n(29967);let tu={},tf="SELECT_ALL",tp="SELECT_INVERT",tm="SELECT_NONE",th=[],tv=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return(t||[]).forEach(t=>{n.push(t),t&&"object"==typeof t&&e in t&&tv(e,t[e],n)}),n};var tg=(e,t)=>{let{preserveSelectedRowKeys:n,selectedRowKeys:r,defaultSelectedRowKeys:a,getCheckboxProps:l,getTitleCheckboxProps:c,onChange:i,onSelect:d,onSelectAll:s,onSelectInvert:u,onSelectNone:f,onSelectMultiple:p,columnWidth:m,type:h,selections:v,fixed:g,renderCell:b,hideSelectAll:y,checkStrictly:x=!0}=t||{},{prefixCls:w,data:k,pageData:C,getRecordByKey:E,getRowKey:S,expandType:N,childrenColumnName:K,locale:O,getPopupContainer:I}=e,R=(0,tc.ln)("Table"),[P,M]=tl(e=>e),[T,D]=(0,ta.Z)(r||a||th,{value:r}),L=o.useRef(new Map),j=(0,o.useCallback)(e=>{if(n){let t=new Map;e.forEach(e=>{let n=E(e);!n&&L.current.has(e)&&(n=L.current.get(e)),t.set(e,n)}),L.current=t}},[E,n]);o.useEffect(()=>{j(T)},[T]);let B=(0,o.useMemo)(()=>tv(K,C),[K,C]),{keyEntities:H}=(0,o.useMemo)(()=>{if(x)return{keyEntities:null};let e=k;if(n){let t=new Set(B.map((e,t)=>S(e,t))),n=Array.from(L.current).reduce((e,n)=>{let[o,r]=n;return t.has(o)?e:e.concat(r)},[]);e=[].concat((0,el.Z)(e),(0,el.Z)(n))}return eJ(e,{externalGetKey:S,childrenPropName:K})},[k,S,x,K,n,B]),z=(0,o.useMemo)(()=>{let e=new Map;return B.forEach((t,n)=>{let o=S(t,n),r=(l?l(t):null)||{};e.set(o,r)}),e},[B,S,l]),A=(0,o.useCallback)(e=>{let t;let n=S(e);return!!(null==(t=z.has(n)?z.get(S(e)):l?l(e):void 0)?void 0:t.disabled)},[z,S]),[W,_]=(0,o.useMemo)(()=>{if(x)return[T||[],[]];let{checkedKeys:e,halfCheckedKeys:t}=tr(T,!0,H,A);return[e||[],t]},[T,x,H,A]),F=(0,o.useMemo)(()=>new Set("radio"===h?W.slice(0,1):W),[W,h]),q=(0,o.useMemo)(()=>"radio"===h?new Set:new Set(_),[_,h]);o.useEffect(()=>{t||D(th)},[!!t]);let V=(0,o.useCallback)((e,t)=>{let o,r;j(e),n?(o=e,r=e.map(e=>L.current.get(e))):(o=[],r=[],e.forEach(e=>{let t=E(e);void 0!==t&&(o.push(e),r.push(t))})),D(o),null==i||i(o,r,{type:t})},[D,E,i,n]),X=(0,o.useCallback)((e,t,n,o)=>{if(d){let r=n.map(e=>E(e));d(E(e),t,r,o)}V(n,"single")},[d,E,V]),U=(0,o.useMemo)(()=>!v||y?null:(!0===v?[tf,tp,tm]:v).map(e=>e===tf?{key:"all",text:O.selectionAll,onSelect(){V(k.map((e,t)=>S(e,t)).filter(e=>{let t=z.get(e);return!(null==t?void 0:t.disabled)||F.has(e)}),"all")}}:e===tp?{key:"invert",text:O.selectInvert,onSelect(){let e=new Set(F);C.forEach((t,n)=>{let o=S(t,n),r=z.get(o);(null==r?void 0:r.disabled)||(e.has(o)?e.delete(o):e.add(o))});let t=Array.from(e);u&&(R.deprecated(!1,"onSelectInvert","onChange"),u(t)),V(t,"invert")}}:e===tm?{key:"none",text:O.selectNone,onSelect(){null==f||f(),V(Array.from(F).filter(e=>{let t=z.get(e);return null==t?void 0:t.disabled}),"none")}}:e).map(e=>Object.assign(Object.assign({},e),{onSelect:function(){for(var t,n=arguments.length,o=Array(n),r=0;r{var n;let r,a,l;if(!t)return e.filter(e=>e!==tu);let i=(0,el.Z)(e),d=new Set(F),u=B.map(S).filter(e=>!z.get(e).disabled),f=u.every(e=>d.has(e)),k=u.some(e=>d.has(e)),C=()=>{let e=[];f?u.forEach(t=>{d.delete(t),e.push(t)}):u.forEach(t=>{d.has(t)||(d.add(t),e.push(t))});let t=Array.from(d);null==s||s(!f,t.map(e=>E(e)),e.map(e=>E(e))),V(t,"all"),M(null)};if("radio"!==h){let e;if(U){let t={getPopupContainer:I,items:U.map((e,t)=>{let{key:n,text:o,onSelect:r}=e;return{key:null!=n?n:t,onClick:()=>{null==r||r(u)},label:o}})};e=o.createElement("div",{className:"".concat(w,"-selection-extra")},o.createElement(td.Z,{menu:t,getPopupContainer:I},o.createElement("span",null,o.createElement(eA.Z,null))))}let t=B.map((e,t)=>{let n=S(e,t),o=z.get(n)||{};return Object.assign({checked:d.has(n)},o)}).filter(e=>{let{disabled:t}=e;return t}),n=!!t.length&&t.length===B.length,l=n&&t.every(e=>{let{checked:t}=e;return t}),i=n&&t.some(e=>{let{checked:t}=e;return t}),s=(null==c?void 0:c())||{},{onChange:p,disabled:m}=s;a=o.createElement(ti.Z,Object.assign({"aria-label":e?"Custom selection":"Select all"},s,{checked:n?l:!!B.length&&f,indeterminate:n?!l&&i:!f&&k,onChange:e=>{C(),null==p||p(e)},disabled:null!=m?m:0===B.length||n,skipGroup:!0})),r=!y&&o.createElement("div",{className:"".concat(w,"-selection")},a,e)}if(l="radio"===h?(e,t,n)=>{let r=S(t,n),a=d.has(r),l=z.get(r);return{node:o.createElement(ts.ZP,Object.assign({},l,{checked:a,onClick:e=>{var t;e.stopPropagation(),null===(t=null==l?void 0:l.onClick)||void 0===t||t.call(l,e)},onChange:e=>{var t;d.has(r)||X(r,!0,[r],e.nativeEvent),null===(t=null==l?void 0:l.onChange)||void 0===t||t.call(l,e)}})),checked:a}}:(e,t,n)=>{var r;let a;let l=S(t,n),c=d.has(l),i=q.has(l),s=z.get(l);return a="nest"===N?i:null!==(r=null==s?void 0:s.indeterminate)&&void 0!==r?r:i,{node:o.createElement(ti.Z,Object.assign({},s,{indeterminate:a,checked:c,skipGroup:!0,onClick:e=>{var t;e.stopPropagation(),null===(t=null==s?void 0:s.onClick)||void 0===t||t.call(s,e)},onChange:e=>{var t;let{nativeEvent:n}=e,{shiftKey:o}=n,r=u.indexOf(l),a=W.some(e=>u.includes(e));if(o&&x&&a){let e=P(r,u,d),t=Array.from(d);null==p||p(!c,t.map(e=>E(e)),e.map(e=>E(e))),V(t,"multiple")}else if(x){let e=c?e8(W,l):e6(W,l);X(l,!c,e,n)}else{let{checkedKeys:e,halfCheckedKeys:t}=tr([].concat((0,el.Z)(W),[l]),!0,H,A),o=e;if(c){let n=new Set(e);n.delete(l),o=tr(Array.from(n),{checked:!1,halfCheckedKeys:t},H,A).checkedKeys}X(l,!c,o,n)}c?M(null):M(r),null===(t=null==s?void 0:s.onChange)||void 0===t||t.call(s,e)}})),checked:c}},!i.includes(tu)){if(0===i.findIndex(e=>{var t;return(null===(t=e[eo])||void 0===t?void 0:t.columnType)==="EXPAND_COLUMN"})){let[e,...t]=i;i=[e,tu].concat((0,el.Z)(t))}else i=[tu].concat((0,el.Z)(i))}let K=i.indexOf(tu),O=(i=i.filter((e,t)=>e!==tu||t===K))[K-1],R=i[K+1],T=g;void 0===T&&((null==R?void 0:R.fixed)!==void 0?T=R.fixed:(null==O?void 0:O.fixed)!==void 0&&(T=O.fixed)),T&&O&&(null===(n=O[eo])||void 0===n?void 0:n.columnType)==="EXPAND_COLUMN"&&void 0===O.fixed&&(O.fixed=T);let D=Z()("".concat(w,"-selection-col"),{["".concat(w,"-selection-col-with-dropdown")]:v&&"checkbox"===h}),L={fixed:T,width:m,className:"".concat(w,"-selection-column"),title:(null==t?void 0:t.columnTitle)?"function"==typeof t.columnTitle?t.columnTitle(a):t.columnTitle:r,render:(e,t,n)=>{let{node:o,checked:r}=l(e,t,n);return b?b(r,t,n,o):o},onCell:t.onCell,align:t.align,[eo]:{className:D}};return i.map(e=>e===tu?L:e)},[S,B,t,W,F,q,m,U,N,z,p,X,A]),F]};let tb=(e,t)=>(0,o.useImperativeHandle)(e,()=>{let e=t(),{nativeElement:n}=e;return"undefined"!=typeof Proxy?new Proxy(n,{get:(t,n)=>e[n]?e[n]:Reflect.get(t,n)}):(n._antProxy=n._antProxy||{},Object.keys(e).forEach(t=>{if(!(t in n._antProxy)){let o=n[t];n._antProxy[t]=o,n[t]=e[t]}}),n)});function ty(e){return null!=e&&e===e.window}var tx=e=>{var t,n;if("undefined"==typeof window)return 0;let o=0;return ty(e)?o=e.pageYOffset:e instanceof Document?o=e.documentElement.scrollTop:e instanceof HTMLElement?o=e.scrollTop:e&&(o=e.scrollTop),e&&!ty(e)&&"number"!=typeof o&&(o=null===(n=(null!==(t=e.ownerDocument)&&void 0!==t?t:e).documentElement)||void 0===n?void 0:n.scrollTop),o},tw=n(18310),tk=n(71744),tC=n(91086),tE=n(64024),tS=n(33759),tZ=n(28617),tN=n(37381),tK=n(40049),tO=n(10353),tI=n(84951);let tR=(e,t)=>"key"in e&&void 0!==e.key&&null!==e.key?e.key:e.dataIndex?Array.isArray(e.dataIndex)?e.dataIndex.join("."):e.dataIndex:t;function tP(e,t){return t?"".concat(t,"-").concat(e):"".concat(e)}let tM=(e,t)=>"function"==typeof e?e(t):e,tT=(e,t)=>{let n=tM(e,t);return"[object Object]"===Object.prototype.toString.call(n)?"":n};var tD={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M349 838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V642H349v196zm531.1-684H143.9c-24.5 0-39.8 26.7-27.5 48l221.3 376h348.8l221.3-376c12.1-21.3-3.2-48-27.7-48z"}}]},name:"filter",theme:"filled"},tL=n(55015),tj=o.forwardRef(function(e,t){return o.createElement(tL.Z,(0,p.Z)({},e,{ref:t,icon:tD}))}),tB=n(53253),tH=n(51646);let tz=e=>{let t=o.useRef(e),[,n]=(0,tH.N)();return[()=>t.current,e=>{t.current=e,n()}]};var tA=n(5545),tW=n(85180),t_=n(60985),tF=n(88208),tq=n(76405),tV=n(25049),tX=n(63496),tU=n(41690),tG=n(15900),tY=n(95814);function t$(e){if(null==e)throw TypeError("Cannot destructure "+e)}var tJ=n(66632),tQ=function(e,t){var n=o.useState(!1),r=(0,l.Z)(n,2),a=r[0],c=r[1];(0,i.Z)(function(){if(a)return e(),function(){t()}},[a]),(0,i.Z)(function(){return c(!0),function(){c(!1)}},[])},t0=["className","style","motion","motionNodes","motionType","onMotionStart","onMotionEnd","active","treeNodeRequiredProps"],t1=o.forwardRef(function(e,t){var n=e.className,r=e.style,a=e.motion,c=e.motionNodes,d=e.motionType,s=e.onMotionStart,u=e.onMotionEnd,f=e.active,m=e.treeNodeRequiredProps,h=(0,j.Z)(e,t0),v=o.useState(!0),g=(0,l.Z)(v,2),b=g[0],y=g[1],x=o.useContext(eW).prefixCls,w=c&&"hide"!==d;(0,i.Z)(function(){c&&w!==b&&y(w)},[c]);var k=o.useRef(!1),C=function(){c&&!k.current&&(k.current=!0,u())};return(tQ(function(){c&&s()},C),c)?o.createElement(tJ.ZP,(0,p.Z)({ref:t,visible:b},a,{motionAppear:"show"===d,onVisibleChanged:function(e){w===e&&C()}}),function(e,t){var n=e.className,r=e.style;return o.createElement("div",{ref:t,className:Z()("".concat(x,"-treenode-motion"),n),style:r},c.map(function(e){var t=Object.assign({},(t$(e.data),e.data)),n=e.title,r=e.key,a=e.isStart,l=e.isEnd;delete t.children;var c=eQ(r,m);return o.createElement(e4,(0,p.Z)({},t,c,{title:n,active:f,data:e.data,key:r,isStart:a,isEnd:l}))}))}):o.createElement(e4,(0,p.Z)({domRef:t,className:n,style:r},h,{active:f}))});function t2(e,t,n){var o=e.findIndex(function(e){return e.key===n}),r=e[o+1],a=t.findIndex(function(e){return e.key===n});if(r){var l=t.findIndex(function(e){return e.key===r.key});return t.slice(a+1,l)}return t.slice(a+1)}var t3=["prefixCls","data","selectable","checkable","expandedKeys","selectedKeys","checkedKeys","loadedKeys","loadingKeys","halfCheckedKeys","keyEntities","disabled","dragging","dragOverNodeKey","dropPosition","motion","height","itemHeight","virtual","scrollWidth","focusable","activeItem","focused","tabIndex","onKeyDown","onFocus","onBlur","onActiveChange","onListChangeStart","onListChangeEnd"],t4={width:0,height:0,display:"flex",overflow:"hidden",opacity:0,border:0,padding:0,margin:0},t8=function(){},t6="RC_TREE_MOTION_".concat(Math.random()),t5={key:t6},t7={key:t6,level:0,index:0,pos:"0",node:t5,nodes:[t5]},t9={parent:null,children:[],pos:t7.pos,data:t5,title:null,key:t6,isStart:[],isEnd:[]};function ne(e,t,n,o){return!1!==t&&n?e.slice(0,Math.ceil(n/o)+1):e}function nt(e){return eU(e.key,e.pos)}var nn=o.forwardRef(function(e,t){var n=e.prefixCls,r=e.data,a=(e.selectable,e.checkable,e.expandedKeys),c=e.selectedKeys,d=e.checkedKeys,s=e.loadedKeys,u=e.loadingKeys,f=e.halfCheckedKeys,m=e.keyEntities,h=e.disabled,v=e.dragging,g=e.dragOverNodeKey,b=e.dropPosition,y=e.motion,x=e.height,w=e.itemHeight,k=e.virtual,C=e.scrollWidth,E=e.focusable,S=e.activeItem,Z=e.focused,N=e.tabIndex,K=e.onKeyDown,O=e.onFocus,I=e.onBlur,R=e.onActiveChange,P=e.onListChangeStart,M=e.onListChangeEnd,T=(0,j.Z)(e,t3),D=o.useRef(null),L=o.useRef(null);o.useImperativeHandle(t,function(){return{scrollTo:function(e){D.current.scrollTo(e)},getIndentWidth:function(){return L.current.offsetWidth}}});var B=o.useState(a),H=(0,l.Z)(B,2),z=H[0],A=H[1],W=o.useState(r),_=(0,l.Z)(W,2),F=_[0],q=_[1],V=o.useState(r),X=(0,l.Z)(V,2),U=X[0],G=X[1],Y=o.useState([]),$=(0,l.Z)(Y,2),J=$[0],Q=$[1],ee=o.useState(null),et=(0,l.Z)(ee,2),en=et[0],eo=et[1],er=o.useRef(r);function ea(){var e=er.current;q(e),G(e),Q([]),eo(null),M()}er.current=r,(0,i.Z)(function(){A(a);var e=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=e.length,o=t.length;if(1!==Math.abs(n-o))return{add:!1,key:null};function r(e,t){var n=new Map;e.forEach(function(e){n.set(e,!0)});var o=t.filter(function(e){return!n.has(e)});return 1===o.length?o[0]:null}return n ").concat(t);return t}(S)),o.createElement("div",null,o.createElement("input",{style:t4,disabled:!1===E||h,tabIndex:!1!==E?N:null,onKeyDown:K,onFocus:O,onBlur:I,value:"",onChange:t8,"aria-label":"for screen reader"})),o.createElement("div",{className:"".concat(n,"-treenode"),"aria-hidden":!0,style:{position:"absolute",pointerEvents:"none",visibility:"hidden",height:0,overflow:"hidden",border:0,padding:0}},o.createElement("div",{className:"".concat(n,"-indent")},o.createElement("div",{ref:L,className:"".concat(n,"-indent-unit")}))),o.createElement(eP.Z,(0,p.Z)({},T,{data:el,itemKey:nt,height:x,fullHeight:!1,virtual:k,itemHeight:w,scrollWidth:C,prefixCls:"".concat(n,"-list"),ref:D,role:"tree",onVisibleChange:function(e){e.every(function(e){return nt(e)!==t6})&&ea()}}),function(e){var t=e.pos,n=Object.assign({},(t$(e.data),e.data)),r=e.title,a=e.key,l=e.isStart,c=e.isEnd,i=eU(a,t);delete n.key,delete n.children;var d=eQ(i,ec);return o.createElement(t1,(0,p.Z)({},n,d,{title:r,active:!!S&&a===S.key,pos:t,data:e.data,isStart:l,isEnd:c,motion:y,motionNodes:a===t6?J:null,motionType:en,onMotionStart:P,onMotionEnd:ea,treeNodeRequiredProps:ec,onMouseMove:function(){R(null)}}))}))}),no=function(e){(0,tU.Z)(n,e);var t=(0,tG.Z)(n);function n(){var e;(0,tq.Z)(this,n);for(var r=arguments.length,a=Array(r),l=0;l0&&void 0!==arguments[0]?arguments[0]:[];t.forEach(function(t){var n=t.key,r=t.children;o.push(n),e(r)})}(l[i].children),o),indent:e.listRef.current.getIndentWidth()}),e.setExpandedKeys(d),window.addEventListener("dragend",e.onWindowDragEnd),null==c||c({event:t,node:e0(n)})}),(0,E.Z)((0,tX.Z)(e),"onNodeDragEnter",function(t,n){var o=e.state,r=o.expandedKeys,a=o.keyEntities,l=o.dragChildrenKeys,c=o.flattenNodes,i=o.indent,d=e.props,s=d.onDragEnter,u=d.onExpand,f=d.allowDrop,p=d.direction,m=n.pos,h=n.eventKey;if(e.currentMouseOverDroppableNodeKey!==h&&(e.currentMouseOverDroppableNodeKey=h),!e.dragNodeProps){e.resetDragState();return}var v=e7(t,e.dragNodeProps,n,i,e.dragStartMousePosition,f,c,a,r,p),g=v.dropPosition,b=v.dropLevelOffset,y=v.dropTargetKey,x=v.dropContainerKey,w=v.dropTargetPos,k=v.dropAllowed,C=v.dragOverNodeKey;if(l.includes(y)||!k||(e.delayedDragEnterLogic||(e.delayedDragEnterLogic={}),Object.keys(e.delayedDragEnterLogic).forEach(function(t){clearTimeout(e.delayedDragEnterLogic[t])}),e.dragNodeProps.eventKey!==n.eventKey&&(t.persist(),e.delayedDragEnterLogic[m]=window.setTimeout(function(){if(null!==e.state.draggingNodeKey){var o=(0,el.Z)(r),l=a[n.eventKey];l&&(l.children||[]).length&&(o=e6(r,n.eventKey)),e.props.hasOwnProperty("expandedKeys")||e.setExpandedKeys(o),null==u||u(o,{node:e0(n),expanded:!0,nativeEvent:t.nativeEvent})}},800)),e.dragNodeProps.eventKey===y&&0===b)){e.resetDragState();return}e.setState({dragOverNodeKey:C,dropPosition:g,dropLevelOffset:b,dropTargetKey:y,dropContainerKey:x,dropTargetPos:w,dropAllowed:k}),null==s||s({event:t,node:e0(n),expandedKeys:r})}),(0,E.Z)((0,tX.Z)(e),"onNodeDragOver",function(t,n){var o=e.state,r=o.dragChildrenKeys,a=o.flattenNodes,l=o.keyEntities,c=o.expandedKeys,i=o.indent,d=e.props,s=d.onDragOver,u=d.allowDrop,f=d.direction;if(e.dragNodeProps){var p=e7(t,e.dragNodeProps,n,i,e.dragStartMousePosition,u,a,l,c,f),m=p.dropPosition,h=p.dropLevelOffset,v=p.dropTargetKey,g=p.dropContainerKey,b=p.dropTargetPos,y=p.dropAllowed,x=p.dragOverNodeKey;!r.includes(v)&&y&&(e.dragNodeProps.eventKey===v&&0===h?null===e.state.dropPosition&&null===e.state.dropLevelOffset&&null===e.state.dropTargetKey&&null===e.state.dropContainerKey&&null===e.state.dropTargetPos&&!1===e.state.dropAllowed&&null===e.state.dragOverNodeKey||e.resetDragState():m===e.state.dropPosition&&h===e.state.dropLevelOffset&&v===e.state.dropTargetKey&&g===e.state.dropContainerKey&&b===e.state.dropTargetPos&&y===e.state.dropAllowed&&x===e.state.dragOverNodeKey||e.setState({dropPosition:m,dropLevelOffset:h,dropTargetKey:v,dropContainerKey:g,dropTargetPos:b,dropAllowed:y,dragOverNodeKey:x}),null==s||s({event:t,node:e0(n)}))}}),(0,E.Z)((0,tX.Z)(e),"onNodeDragLeave",function(t,n){e.currentMouseOverDroppableNodeKey!==n.eventKey||t.currentTarget.contains(t.relatedTarget)||(e.resetDragState(),e.currentMouseOverDroppableNodeKey=null);var o=e.props.onDragLeave;null==o||o({event:t,node:e0(n)})}),(0,E.Z)((0,tX.Z)(e),"onWindowDragEnd",function(t){e.onNodeDragEnd(t,null,!0),window.removeEventListener("dragend",e.onWindowDragEnd)}),(0,E.Z)((0,tX.Z)(e),"onNodeDragEnd",function(t,n){var o=e.props.onDragEnd;e.setState({dragOverNodeKey:null}),e.cleanDragState(),null==o||o({event:t,node:e0(n)}),e.dragNodeProps=null,window.removeEventListener("dragend",e.onWindowDragEnd)}),(0,E.Z)((0,tX.Z)(e),"onNodeDrop",function(t,n){var o,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=e.state,l=a.dragChildrenKeys,c=a.dropPosition,i=a.dropTargetKey,d=a.dropTargetPos;if(a.dropAllowed){var s=e.props.onDrop;if(e.setState({dragOverNodeKey:null}),e.cleanDragState(),null!==i){var u=(0,C.Z)((0,C.Z)({},eQ(i,e.getTreeNodeRequiredProps())),{},{active:(null===(o=e.getActiveItem())||void 0===o?void 0:o.key)===i,data:e.state.keyEntities[i].node}),f=l.includes(i);(0,O.ZP)(!f,"Can not drop to dragNode's children node. This is a bug of rc-tree. Please report an issue.");var p=e5(d),m={event:t,node:e0(u),dragNode:e.dragNodeProps?e0(e.dragNodeProps):null,dragNodesKeys:[e.dragNodeProps.eventKey].concat(l),dropToGap:0!==c,dropPosition:c+Number(p[p.length-1])};r||null==s||s(m),e.dragNodeProps=null}}}),(0,E.Z)((0,tX.Z)(e),"cleanDragState",function(){null!==e.state.draggingNodeKey&&e.setState({draggingNodeKey:null,dropPosition:null,dropContainerKey:null,dropTargetKey:null,dropLevelOffset:null,dropAllowed:!0,dragOverNodeKey:null}),e.dragStartMousePosition=null,e.currentMouseOverDroppableNodeKey=null}),(0,E.Z)((0,tX.Z)(e),"triggerExpandActionExpand",function(t,n){var o=e.state,r=o.expandedKeys,a=o.flattenNodes,l=n.expanded,c=n.key;if(!n.isLeaf&&!t.shiftKey&&!t.metaKey&&!t.ctrlKey){var i=a.filter(function(e){return e.key===c})[0],d=e0((0,C.Z)((0,C.Z)({},eQ(c,e.getTreeNodeRequiredProps())),{},{data:i.data}));e.setExpandedKeys(l?e8(r,c):e6(r,c)),e.onNodeExpand(t,d)}}),(0,E.Z)((0,tX.Z)(e),"onNodeClick",function(t,n){var o=e.props,r=o.onClick;"click"===o.expandAction&&e.triggerExpandActionExpand(t,n),null==r||r(t,n)}),(0,E.Z)((0,tX.Z)(e),"onNodeDoubleClick",function(t,n){var o=e.props,r=o.onDoubleClick;"doubleClick"===o.expandAction&&e.triggerExpandActionExpand(t,n),null==r||r(t,n)}),(0,E.Z)((0,tX.Z)(e),"onNodeSelect",function(t,n){var o=e.state.selectedKeys,r=e.state,a=r.keyEntities,l=r.fieldNames,c=e.props,i=c.onSelect,d=c.multiple,s=n.selected,u=n[l.key],f=!s,p=(o=f?d?e6(o,u):[u]:e8(o,u)).map(function(e){var t=a[e];return t?t.node:null}).filter(Boolean);e.setUncontrolledState({selectedKeys:o}),null==i||i(o,{event:"select",selected:f,node:n,selectedNodes:p,nativeEvent:t.nativeEvent})}),(0,E.Z)((0,tX.Z)(e),"onNodeCheck",function(t,n,o){var r,a=e.state,l=a.keyEntities,c=a.checkedKeys,i=a.halfCheckedKeys,d=e.props,s=d.checkStrictly,u=d.onCheck,f=n.key,p={event:"check",node:n,checked:o,nativeEvent:t.nativeEvent};if(s){var m=o?e6(c,f):e8(c,f);r={checked:m,halfChecked:e8(i,f)},p.checkedNodes=m.map(function(e){return l[e]}).filter(Boolean).map(function(e){return e.node}),e.setUncontrolledState({checkedKeys:m})}else{var h=tr([].concat((0,el.Z)(c),[f]),!0,l),v=h.checkedKeys,g=h.halfCheckedKeys;if(!o){var b=new Set(v);b.delete(f);var y=tr(Array.from(b),{checked:!1,halfCheckedKeys:g},l);v=y.checkedKeys,g=y.halfCheckedKeys}r=v,p.checkedNodes=[],p.checkedNodesPositions=[],p.halfCheckedKeys=g,v.forEach(function(e){var t=l[e];if(t){var n=t.node,o=t.pos;p.checkedNodes.push(n),p.checkedNodesPositions.push({node:n,pos:o})}}),e.setUncontrolledState({checkedKeys:v},!1,{halfCheckedKeys:g})}null==u||u(r,p)}),(0,E.Z)((0,tX.Z)(e),"onNodeLoad",function(t){var n,o=t.key,r=e.state.keyEntities[o];if(null==r||null===(n=r.children)||void 0===n||!n.length){var a=new Promise(function(n,r){e.setState(function(a){var l=a.loadedKeys,c=a.loadingKeys,i=void 0===c?[]:c,d=e.props,s=d.loadData,u=d.onLoad;return!s||(void 0===l?[]:l).includes(o)||i.includes(o)?null:(s(t).then(function(){var r=e6(e.state.loadedKeys,o);null==u||u(r,{event:"load",node:t}),e.setUncontrolledState({loadedKeys:r}),e.setState(function(e){return{loadingKeys:e8(e.loadingKeys,o)}}),n()}).catch(function(t){if(e.setState(function(e){return{loadingKeys:e8(e.loadingKeys,o)}}),e.loadingRetryTimes[o]=(e.loadingRetryTimes[o]||0)+1,e.loadingRetryTimes[o]>=10){var a=e.state.loadedKeys;(0,O.ZP)(!1,"Retry for `loadData` many times but still failed. No more retry."),e.setUncontrolledState({loadedKeys:e6(a,o)}),n()}r(t)}),{loadingKeys:e6(i,o)})})});return a.catch(function(){}),a}}),(0,E.Z)((0,tX.Z)(e),"onNodeMouseEnter",function(t,n){var o=e.props.onMouseEnter;null==o||o({event:t,node:n})}),(0,E.Z)((0,tX.Z)(e),"onNodeMouseLeave",function(t,n){var o=e.props.onMouseLeave;null==o||o({event:t,node:n})}),(0,E.Z)((0,tX.Z)(e),"onNodeContextMenu",function(t,n){var o=e.props.onRightClick;o&&(t.preventDefault(),o({event:t,node:n}))}),(0,E.Z)((0,tX.Z)(e),"onFocus",function(){var t=e.props.onFocus;e.setState({focused:!0});for(var n=arguments.length,o=Array(n),r=0;r1&&void 0!==arguments[1]&&arguments[1],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!e.destroyed){var r=!1,a=!0,l={};Object.keys(t).forEach(function(n){if(e.props.hasOwnProperty(n)){a=!1;return}r=!0,l[n]=t[n]}),r&&(!n||a)&&e.setState((0,C.Z)((0,C.Z)({},l),o))}}),(0,E.Z)((0,tX.Z)(e),"scrollTo",function(t){e.listRef.current.scrollTo(t)}),e}return(0,tV.Z)(n,[{key:"componentDidMount",value:function(){this.destroyed=!1,this.onUpdated()}},{key:"componentDidUpdate",value:function(){this.onUpdated()}},{key:"onUpdated",value:function(){var e=this.props,t=e.activeKey,n=e.itemScrollOffset;void 0!==t&&t!==this.state.activeKey&&(this.setState({activeKey:t}),null!==t&&this.scrollTo({key:t,offset:void 0===n?0:n}))}},{key:"componentWillUnmount",value:function(){window.removeEventListener("dragend",this.onWindowDragEnd),this.destroyed=!0}},{key:"resetDragState",value:function(){this.setState({dragOverNodeKey:null,dropPosition:null,dropLevelOffset:null,dropTargetKey:null,dropContainerKey:null,dropTargetPos:null,dropAllowed:!1})}},{key:"render",value:function(){var e,t=this.state,n=t.focused,r=t.flattenNodes,a=t.keyEntities,l=t.draggingNodeKey,c=t.activeKey,i=t.dropLevelOffset,d=t.dropContainerKey,s=t.dropTargetKey,u=t.dropPosition,f=t.dragOverNodeKey,m=t.indent,h=this.props,v=h.prefixCls,g=h.className,b=h.style,y=h.showLine,x=h.focusable,w=h.tabIndex,C=h.selectable,S=h.showIcon,N=h.icon,K=h.switcherIcon,O=h.draggable,I=h.checkable,R=h.checkStrictly,P=h.disabled,M=h.motion,T=h.loadData,D=h.filterTreeNode,L=h.height,j=h.itemHeight,B=h.scrollWidth,H=h.virtual,z=h.titleRender,A=h.dropIndicatorRender,W=h.onContextMenu,_=h.onScroll,q=h.direction,V=h.rootClassName,X=h.rootStyle,U=(0,F.Z)(this.props,{aria:!0,data:!0});O&&(e="object"===(0,k.Z)(O)?O:"function"==typeof O?{nodeDraggable:O}:{});var G={prefixCls:v,selectable:C,showIcon:S,icon:N,switcherIcon:K,draggable:e,draggingNodeKey:l,checkable:I,checkStrictly:R,disabled:P,keyEntities:a,dropLevelOffset:i,dropContainerKey:d,dropTargetKey:s,dropPosition:u,dragOverNodeKey:f,indent:m,direction:q,dropIndicatorRender:A,loadData:T,filterTreeNode:D,titleRender:z,onNodeClick:this.onNodeClick,onNodeDoubleClick:this.onNodeDoubleClick,onNodeExpand:this.onNodeExpand,onNodeSelect:this.onNodeSelect,onNodeCheck:this.onNodeCheck,onNodeLoad:this.onNodeLoad,onNodeMouseEnter:this.onNodeMouseEnter,onNodeMouseLeave:this.onNodeMouseLeave,onNodeContextMenu:this.onNodeContextMenu,onNodeDragStart:this.onNodeDragStart,onNodeDragEnter:this.onNodeDragEnter,onNodeDragOver:this.onNodeDragOver,onNodeDragLeave:this.onNodeDragLeave,onNodeDragEnd:this.onNodeDragEnd,onNodeDrop:this.onNodeDrop};return o.createElement(eW.Provider,{value:G},o.createElement("div",{className:Z()(v,g,V,(0,E.Z)((0,E.Z)((0,E.Z)({},"".concat(v,"-show-line"),y),"".concat(v,"-focused"),n),"".concat(v,"-active-focused"),null!==c)),style:X},o.createElement(nn,(0,p.Z)({ref:this.listRef,prefixCls:v,style:b,data:r,disabled:P,selectable:C,checkable:!!I,motion:M,dragging:null!==l,height:L,itemHeight:j,virtual:H,focusable:x,focused:n,tabIndex:void 0===w?0:w,activeItem:this.getActiveItem(),onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onActiveChange:this.onActiveChange,onListChangeStart:this.onListChangeStart,onListChangeEnd:this.onListChangeEnd,onContextMenu:W,onScroll:_,scrollWidth:B},this.getTreeNodeRequiredProps(),U))))}}],[{key:"getDerivedStateFromProps",value:function(e,t){var n,o,r=t.prevProps,a={prevProps:e};function l(t){return!r&&e.hasOwnProperty(t)||r&&r[t]!==e[t]}var c=t.fieldNames;if(l("fieldNames")&&(c=eG(e.fieldNames),a.fieldNames=c),l("treeData")?n=e.treeData:l("children")&&((0,O.ZP)(!1,"`children` of Tree is deprecated. Please use `treeData` instead."),n=eY(e.children)),n){a.treeData=n;var i=eJ(n,{fieldNames:c});a.keyEntities=(0,C.Z)((0,E.Z)({},t6,t7),i.keyEntities)}var d=a.keyEntities||t.keyEntities;if(l("expandedKeys")||r&&l("autoExpandParent"))a.expandedKeys=e.autoExpandParent||!r&&e.defaultExpandParent?tt(e.expandedKeys,d):e.expandedKeys;else if(!r&&e.defaultExpandAll){var s=(0,C.Z)({},d);delete s[t6];var u=[];Object.keys(s).forEach(function(e){var t=s[e];t.children&&t.children.length&&u.push(t.key)}),a.expandedKeys=u}else!r&&e.defaultExpandedKeys&&(a.expandedKeys=e.autoExpandParent||e.defaultExpandParent?tt(e.defaultExpandedKeys,d):e.defaultExpandedKeys);if(a.expandedKeys||delete a.expandedKeys,n||a.expandedKeys){var f=e$(n||t.treeData,a.expandedKeys||t.expandedKeys,c);a.flattenNodes=f}if(e.selectable&&(l("selectedKeys")?a.selectedKeys=e9(e.selectedKeys,e):!r&&e.defaultSelectedKeys&&(a.selectedKeys=e9(e.defaultSelectedKeys,e))),e.checkable&&(l("checkedKeys")?o=te(e.checkedKeys)||{}:!r&&e.defaultCheckedKeys?o=te(e.defaultCheckedKeys)||{}:n&&(o=te(e.checkedKeys)||{checkedKeys:t.checkedKeys,halfCheckedKeys:t.halfCheckedKeys}),o)){var p=o,m=p.checkedKeys,h=void 0===m?[]:m,v=p.halfCheckedKeys,g=void 0===v?[]:v;if(!e.checkStrictly){var b=tr(h,!0,d);h=b.checkedKeys,g=b.halfCheckedKeys}a.checkedKeys=h,a.halfCheckedKeys=g}return l("loadedKeys")&&(a.loadedKeys=e.loadedKeys),a}}]),n}(o.Component);(0,E.Z)(no,"defaultProps",{prefixCls:"rc-tree",showLine:!1,showIcon:!0,selectable:!0,multiple:!1,checkable:!1,disabled:!1,checkStrictly:!1,draggable:!1,defaultExpandParent:!0,autoExpandParent:!1,defaultExpandAll:!1,defaultExpandedKeys:[],defaultCheckedKeys:[],defaultSelectedKeys:[],dropIndicatorRender:function(e){var t=e.dropPosition,n=e.dropLevelOffset,r=e.indent,a={pointerEvents:"none",position:"absolute",right:0,backgroundColor:"red",height:2};switch(t){case -1:a.top=0,a.left=-n*r;break;case 1:a.bottom=0,a.left=-n*r;break;case 0:a.bottom=0,a.left=r}return o.createElement("div",{style:a})},allowDrop:function(){return!0},expandAction:!1}),(0,E.Z)(no,"TreeNode",e4);var nr={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494z"}}]},name:"file",theme:"outlined"},na=o.forwardRef(function(e,t){return o.createElement(tL.Z,(0,p.Z)({},e,{ref:t,icon:nr}))}),nl={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M928 444H820V330.4c0-17.7-14.3-32-32-32H473L355.7 186.2a8.15 8.15 0 00-5.5-2.2H96c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h698c13 0 24.8-7.9 29.7-20l134-332c1.5-3.8 2.3-7.9 2.3-12 0-17.7-14.3-32-32-32zM136 256h188.5l119.6 114.4H748V444H238c-13 0-24.8 7.9-29.7 20L136 643.2V256zm635.3 512H159l103.3-256h612.4L771.3 768z"}}]},name:"folder-open",theme:"outlined"},nc=o.forwardRef(function(e,t){return o.createElement(tL.Z,(0,p.Z)({},e,{ref:t,icon:nl}))}),ni={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 298.4H521L403.7 186.2a8.15 8.15 0 00-5.5-2.2H144c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V330.4c0-17.7-14.3-32-32-32zM840 768H184V256h188.5l119.6 114.4H840V768z"}}]},name:"folder",theme:"outlined"},nd=o.forwardRef(function(e,t){return o.createElement(tL.Z,(0,p.Z)({},e,{ref:t,icon:ni}))}),ns={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M300 276.5a56 56 0 1056-97 56 56 0 00-56 97zm0 284a56 56 0 1056-97 56 56 0 00-56 97zM640 228a56 56 0 10112 0 56 56 0 00-112 0zm0 284a56 56 0 10112 0 56 56 0 00-112 0zM300 844.5a56 56 0 1056-97 56 56 0 00-56 97zM640 796a56 56 0 10112 0 56 56 0 00-112 0z"}}]},name:"holder",theme:"outlined"},nu=o.forwardRef(function(e,t){return o.createElement(tL.Z,(0,p.Z)({},e,{ref:t,icon:ns}))}),nf=n(68710),np=n(86586),nm=n(93463),nh=n(23159),nv=n(12918),ng=n(63074),nb=n(71140),ny=n(99320);let nx=e=>{let{treeCls:t,treeNodeCls:n,directoryNodeSelectedBg:o,directoryNodeSelectedColor:r,motionDurationMid:a,borderRadius:l,controlItemBgHover:c}=e;return{["".concat(t).concat(t,"-directory ").concat(n)]:{["".concat(t,"-node-content-wrapper")]:{position:"static",["&:has(".concat(t,"-drop-indicator)")]:{position:"relative"},["> *:not(".concat(t,"-drop-indicator)")]:{position:"relative"},"&:hover":{background:"transparent"},"&:before":{position:"absolute",inset:0,transition:"background-color ".concat(a),content:'""',borderRadius:l},"&:hover:before":{background:c}},["".concat(t,"-switcher, ").concat(t,"-checkbox, ").concat(t,"-draggable-icon")]:{zIndex:1},"&-selected":{background:o,borderRadius:l,["".concat(t,"-switcher, ").concat(t,"-draggable-icon")]:{color:r},["".concat(t,"-node-content-wrapper")]:{color:r,background:"transparent","&, &:hover":{color:r},"&:before, &:hover:before":{background:o}}}}}},nw=new nm.E4("ant-tree-node-fx-do-not-use",{"0%":{opacity:0},"100%":{opacity:1}}),nk=(e,t)=>({[".".concat(e,"-switcher-icon")]:{display:"inline-block",fontSize:10,verticalAlign:"baseline",svg:{transition:"transform ".concat(t.motionDurationSlow)}}}),nC=(e,t)=>({[".".concat(e,"-drop-indicator")]:{position:"absolute",zIndex:1,height:2,backgroundColor:t.colorPrimary,borderRadius:1,pointerEvents:"none","&:after":{position:"absolute",top:-3,insetInlineStart:-6,width:8,height:8,backgroundColor:"transparent",border:"".concat((0,nm.bf)(t.lineWidthBold)," solid ").concat(t.colorPrimary),borderRadius:"50%",content:'""'}}}),nE=(e,t)=>{let{treeCls:n,treeNodeCls:o,treeNodePadding:r,titleHeight:a,indentSize:l,nodeSelectedBg:c,nodeHoverBg:i,colorTextQuaternary:d,controlItemBgActiveDisabled:s}=t;return{[n]:Object.assign(Object.assign({},(0,nv.Wf)(t)),{"--rc-virtual-list-scrollbar-bg":t.colorSplit,background:t.colorBgContainer,borderRadius:t.borderRadius,transition:"background-color ".concat(t.motionDurationSlow),"&-rtl":{direction:"rtl"},["&".concat(n,"-rtl ").concat(n,"-switcher_close ").concat(n,"-switcher-icon svg")]:{transform:"rotate(90deg)"},["&-focused:not(:hover):not(".concat(n,"-active-focused)")]:(0,nv.oN)(t),["".concat(n,"-list-holder-inner")]:{alignItems:"flex-start"},["&".concat(n,"-block-node")]:{["".concat(n,"-list-holder-inner")]:{alignItems:"stretch",["".concat(n,"-node-content-wrapper")]:{flex:"auto"},["".concat(o,".dragging:after")]:{position:"absolute",inset:0,border:"1px solid ".concat(t.colorPrimary),opacity:0,animationName:nw,animationDuration:t.motionDurationSlow,animationPlayState:"running",animationFillMode:"forwards",content:'""',pointerEvents:"none",borderRadius:t.borderRadius}}},[o]:{display:"flex",alignItems:"flex-start",marginBottom:r,lineHeight:(0,nm.bf)(a),position:"relative","&:before":{content:'""',position:"absolute",zIndex:1,insetInlineStart:0,width:"100%",top:"100%",height:r},["&-disabled ".concat(n,"-node-content-wrapper")]:{color:t.colorTextDisabled,cursor:"not-allowed","&:hover":{background:"transparent"}},["".concat(n,"-checkbox-disabled + ").concat(n,"-node-selected,&").concat(o,"-disabled").concat(o,"-selected ").concat(n,"-node-content-wrapper")]:{backgroundColor:s},["".concat(n,"-checkbox-disabled")]:{pointerEvents:"unset"},["&:not(".concat(o,"-disabled)")]:{["".concat(n,"-node-content-wrapper")]:{"&:hover":{color:t.nodeHoverColor}}},["&-active ".concat(n,"-node-content-wrapper")]:{background:t.controlItemBgHover},["&:not(".concat(o,"-disabled).filter-node ").concat(n,"-title")]:{color:t.colorPrimary,fontWeight:t.fontWeightStrong},"&-draggable":{cursor:"grab",["".concat(n,"-draggable-icon")]:{flexShrink:0,width:a,textAlign:"center",visibility:"visible",color:d},["&".concat(o,"-disabled ").concat(n,"-draggable-icon")]:{visibility:"hidden"}}},["".concat(n,"-indent")]:{alignSelf:"stretch",whiteSpace:"nowrap",userSelect:"none","&-unit":{display:"inline-block",width:l}},["".concat(n,"-draggable-icon")]:{visibility:"hidden"},["".concat(n,"-switcher, ").concat(n,"-checkbox")]:{marginInlineEnd:t.calc(t.calc(a).sub(t.controlInteractiveSize)).div(2).equal()},["".concat(n,"-switcher")]:Object.assign(Object.assign({},nk(e,t)),{position:"relative",flex:"none",alignSelf:"stretch",width:a,textAlign:"center",cursor:"pointer",userSelect:"none",transition:"all ".concat(t.motionDurationSlow),"&-noop":{cursor:"unset"},"&:before":{pointerEvents:"none",content:'""',width:a,height:a,position:"absolute",left:{_skip_check_:!0,value:0},top:0,borderRadius:t.borderRadius,transition:"all ".concat(t.motionDurationSlow)},["&:not(".concat(n,"-switcher-noop):hover:before")]:{backgroundColor:t.colorBgTextHover},["&_close ".concat(n,"-switcher-icon svg")]:{transform:"rotate(-90deg)"},"&-loading-icon":{color:t.colorPrimary},"&-leaf-line":{position:"relative",zIndex:1,display:"inline-block",width:"100%",height:"100%","&:before":{position:"absolute",top:0,insetInlineEnd:t.calc(a).div(2).equal(),bottom:t.calc(r).mul(-1).equal(),marginInlineStart:-1,borderInlineEnd:"1px solid ".concat(t.colorBorder),content:'""'},"&:after":{position:"absolute",width:t.calc(t.calc(a).div(2).equal()).mul(.8).equal(),height:t.calc(a).div(2).equal(),borderBottom:"1px solid ".concat(t.colorBorder),content:'""'}}}),["".concat(n,"-node-content-wrapper")]:Object.assign(Object.assign({position:"relative",minHeight:a,paddingBlock:0,paddingInline:t.paddingXS,background:"transparent",borderRadius:t.borderRadius,cursor:"pointer",transition:"all ".concat(t.motionDurationMid,", border 0s, line-height 0s, box-shadow 0s")},nC(e,t)),{"&:hover":{backgroundColor:i},["&".concat(n,"-node-selected")]:{color:t.nodeSelectedColor,backgroundColor:c},["".concat(n,"-iconEle")]:{display:"inline-block",width:a,height:a,textAlign:"center",verticalAlign:"top","&:empty":{display:"none"}}}),["".concat(n,"-unselectable ").concat(n,"-node-content-wrapper:hover")]:{backgroundColor:"transparent"},["".concat(o,".drop-container > [draggable]")]:{boxShadow:"0 0 0 2px ".concat(t.colorPrimary)},"&-show-line":{["".concat(n,"-indent-unit")]:{position:"relative",height:"100%","&:before":{position:"absolute",top:0,insetInlineEnd:t.calc(a).div(2).equal(),bottom:t.calc(r).mul(-1).equal(),borderInlineEnd:"1px solid ".concat(t.colorBorder),content:'""'},"&-end:before":{display:"none"}},["".concat(n,"-switcher")]:{background:"transparent","&-line-icon":{verticalAlign:"-0.15em"}}},["".concat(o,"-leaf-last ").concat(n,"-switcher-leaf-line:before")]:{top:"auto !important",bottom:"auto !important",height:"".concat((0,nm.bf)(t.calc(a).div(2).equal())," !important")}})}},nS=function(e,t){let n=!(arguments.length>2)||void 0===arguments[2]||arguments[2],o=".".concat(e),r=t.calc(t.paddingXS).div(2).equal(),a=(0,nb.IX)(t,{treeCls:o,treeNodeCls:"".concat(o,"-treenode"),treeNodePadding:r});return[nE(e,a),n&&nx(a)].filter(Boolean)},nZ=e=>{let{controlHeightSM:t,controlItemBgHover:n,controlItemBgActive:o}=e;return{titleHeight:t,indentSize:t,nodeHoverBg:n,nodeHoverColor:e.colorText,nodeSelectedBg:o,nodeSelectedColor:e.colorText}};var nN=(0,ny.I$)("Tree",(e,t)=>{let{prefixCls:n}=t;return[{[e.componentCls]:(0,nh.C2)("".concat(n,"-checkbox"),e)},nS(n,e),(0,ng.Z)(e)]},e=>{let{colorTextLightSolid:t,colorPrimary:n}=e;return Object.assign(Object.assign({},nZ(e)),{directoryNodeSelectedColor:t,directoryNodeSelectedBg:n})}),nK=function(e){let{dropPosition:t,dropLevelOffset:n,prefixCls:r,indent:a,direction:l="ltr"}=e,c="ltr"===l?"left":"right",i={[c]:-n*a+4,["ltr"===l?"right":"left"]:0};switch(t){case -1:i.top=-3;break;case 1:i.bottom=-3;break;default:i.bottom=-3,i[c]=a+4}return o.createElement("div",{style:i,className:"".concat(r,"-drop-indicator")})},nO={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z"}}]},name:"caret-down",theme:"filled"},nI=o.forwardRef(function(e,t){return o.createElement(tL.Z,(0,p.Z)({},e,{ref:t,icon:nO}))}),nR=n(61935),nP={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M328 544h368c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z"}},{tag:"path",attrs:{d:"M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z"}}]},name:"minus-square",theme:"outlined"},nM=o.forwardRef(function(e,t){return o.createElement(tL.Z,(0,p.Z)({},e,{ref:t,icon:nP}))}),nT={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M328 544h152v152c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V544h152c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H544V328c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v152H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z"}},{tag:"path",attrs:{d:"M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z"}}]},name:"plus-square",theme:"outlined"},nD=o.forwardRef(function(e,t){return o.createElement(tL.Z,(0,p.Z)({},e,{ref:t,icon:nT}))}),nL=n(19722),nj=e=>{var t,n;let r;let{prefixCls:a,switcherIcon:l,treeNodeProps:c,showLine:i,switcherLoadingIcon:d}=e,{isLeaf:s,expanded:u,loading:f}=c;if(f)return o.isValidElement(d)?d:o.createElement(nR.Z,{className:"".concat(a,"-switcher-loading-icon")});if(i&&"object"==typeof i&&(r=i.showLeafIcon),s){if(!i)return null;if("boolean"!=typeof r&&r){let e="function"==typeof r?r(c):r;return o.isValidElement(e)?(0,nL.Tm)(e,{className:Z()(null===(t=e.props)||void 0===t?void 0:t.className,"".concat(a,"-switcher-line-custom-icon"))}):e}return r?o.createElement(na,{className:"".concat(a,"-switcher-line-icon")}):o.createElement("span",{className:"".concat(a,"-switcher-leaf-line")})}let p="".concat(a,"-switcher-icon"),m="function"==typeof l?l(c):l;return o.isValidElement(m)?(0,nL.Tm)(m,{className:Z()(null===(n=m.props)||void 0===n?void 0:n.className,p)}):void 0!==m?m:i?u?o.createElement(nM,{className:"".concat(a,"-switcher-line-icon")}):o.createElement(nD,{className:"".concat(a,"-switcher-line-icon")}):o.createElement(nI,{className:p})};let nB=o.forwardRef((e,t)=>{var n;let{getPrefixCls:r,direction:a,virtual:l,tree:c}=o.useContext(tk.E_),{prefixCls:i,className:d,showIcon:s=!1,showLine:u,switcherIcon:f,switcherLoadingIcon:p,blockNode:m=!1,children:h,checkable:v=!1,selectable:g=!0,draggable:b,disabled:y,motion:x,style:w}=e,k=r("tree",i),C=r(),E=o.useContext(np.Z),S=null!=y?y:E,N=null!=x?x:Object.assign(Object.assign({},(0,nf.Z)(C)),{motionAppear:!1}),K=Object.assign(Object.assign({},e),{checkable:v,selectable:g,showIcon:s,motion:N,blockNode:m,disabled:S,showLine:!!u,dropIndicatorRender:nK}),[O,I,R]=nN(k),[,P]=(0,tI.ZP)(),M=P.paddingXS/2+((null===(n=P.Tree)||void 0===n?void 0:n.titleHeight)||P.controlHeightSM),T=o.useMemo(()=>{if(!b)return!1;let e={};switch(typeof b){case"function":e.nodeDraggable=b;break;case"object":e=Object.assign({},b)}return!1!==e.icon&&(e.icon=e.icon||o.createElement(nu,null)),e},[b]);return O(o.createElement(no,Object.assign({itemHeight:M,ref:t,virtual:l},K,{style:Object.assign(Object.assign({},null==c?void 0:c.style),w),prefixCls:k,className:Z()({["".concat(k,"-icon-hide")]:!s,["".concat(k,"-block-node")]:m,["".concat(k,"-unselectable")]:!g,["".concat(k,"-rtl")]:"rtl"===a,["".concat(k,"-disabled")]:S},null==c?void 0:c.className,d,I,R),direction:a,checkable:v?o.createElement("span",{className:"".concat(k,"-checkbox-inner")}):v,selectable:g,switcherIcon:e=>o.createElement(nj,{prefixCls:k,switcherIcon:f,switcherLoadingIcon:p,treeNodeProps:e,showLine:u}),draggable:T}),h))});function nH(e,t,n){let{key:o,children:r}=n;e.forEach(function(e){let a=e[o],l=e[r];!1!==t(a,e)&&nH(l||[],t,n)})}var nz=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,o=Object.getOwnPropertySymbols(e);rt.indexOf(o[r])&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]]);return n};function nA(e){let{isLeaf:t,expanded:n}=e;return t?o.createElement(na,null):n?o.createElement(nc,null):o.createElement(nd,null)}function nW(e){let{treeData:t,children:n}=e;return t||eY(n)}let n_=o.forwardRef((e,t)=>{var{defaultExpandAll:n,defaultExpandParent:r,defaultExpandedKeys:a}=e,l=nz(e,["defaultExpandAll","defaultExpandParent","defaultExpandedKeys"]);let c=o.useRef(null),i=o.useRef(null),d=()=>{let{keyEntities:e}=eJ(nW(l),{fieldNames:l.fieldNames});return n?Object.keys(e):r?tt(l.expandedKeys||a||[],e):l.expandedKeys||a||[]},[s,u]=o.useState(l.selectedKeys||l.defaultSelectedKeys||[]),[f,p]=o.useState(()=>d());o.useEffect(()=>{"selectedKeys"in l&&u(l.selectedKeys)},[l.selectedKeys]),o.useEffect(()=>{"expandedKeys"in l&&p(l.expandedKeys)},[l.expandedKeys]);let{getPrefixCls:m,direction:h}=o.useContext(tk.E_),{prefixCls:v,className:g,showIcon:b=!0,expandAction:y="click"}=l,x=nz(l,["prefixCls","className","showIcon","expandAction"]),w=m("tree",v),k=Z()("".concat(w,"-directory"),{["".concat(w,"-directory-rtl")]:"rtl"===h},g);return o.createElement(nB,Object.assign({icon:nA,ref:t,blockNode:!0},x,{showIcon:b,expandAction:y,prefixCls:w,className:k,expandedKeys:f,selectedKeys:s,onSelect:(e,t)=>{var n;let o;let{multiple:r,fieldNames:a}=l,{node:d,nativeEvent:s}=t,{key:p=""}=d,m=nW(l),h=Object.assign(Object.assign({},t),{selected:!0}),v=(null==s?void 0:s.ctrlKey)||(null==s?void 0:s.metaKey),g=null==s?void 0:s.shiftKey;r&&v?(o=e,c.current=p,i.current=o):r&&g?o=Array.from(new Set([].concat((0,el.Z)(i.current||[]),(0,el.Z)(function(e){let{treeData:t,expandedKeys:n,startKey:o,endKey:r,fieldNames:a}=e,l=[],c=0;return o&&o===r?[o]:o&&r?(nH(t,e=>{if(2===c)return!1;if(e===o||e===r){if(l.push(e),0===c)c=1;else if(1===c)return c=2,!1}else 1===c&&l.push(e);return n.includes(e)},eG(a)),l):[]}({treeData:m,expandedKeys:f,startKey:p,endKey:c.current,fieldNames:a}))))):(o=[p],c.current=p,i.current=o),h.selectedNodes=function(e,t,n){let o=(0,el.Z)(t),r=[];return nH(e,(e,t)=>{let n=o.indexOf(e);return -1!==n&&(r.push(t),o.splice(n,1)),!!o.length},eG(n)),r}(m,o,a),null===(n=l.onSelect)||void 0===n||n.call(l,o,h),"selectedKeys"in l||u(o)},onExpand:(e,t)=>{var n;return"expandedKeys"in l||p(e),null===(n=l.onExpand)||void 0===n?void 0:n.call(l,e,t)}}))});nB.DirectoryTree=n_,nB.TreeNode=e4;var nF=n(29436),nq=n(39454),nV=e=>{let{value:t,filterSearch:n,tablePrefixCls:r,locale:a,onChange:l}=e;return n?o.createElement("div",{className:"".concat(r,"-filter-dropdown-search")},o.createElement(nq.Z,{prefix:o.createElement(nF.Z,null),placeholder:a.filterSearchPlaceholder,onChange:l,value:t,htmlSize:1,className:"".concat(r,"-filter-dropdown-search-input")})):null};let nX=e=>{let{keyCode:t}=e;t===tY.Z.ENTER&&e.stopPropagation()},nU=o.forwardRef((e,t)=>o.createElement("div",{className:e.className,onClick:e=>e.stopPropagation(),onKeyDown:nX,ref:t},e.children));function nG(e){let t=[];return(e||[]).forEach(e=>{let{value:n,children:o}=e;t.push(n),o&&(t=[].concat((0,el.Z)(t),(0,el.Z)(nG(o))))}),t}function nY(e,t){return("string"==typeof t||"number"==typeof t)&&(null==t?void 0:t.toString().toLowerCase().includes(e.trim().toLowerCase()))}var n$=e=>{var t,n,r,a;let l,c;let{tablePrefixCls:i,prefixCls:s,column:u,dropdownPrefixCls:f,columnKey:p,filterOnClose:m,filterMultiple:h,filterMode:v="menu",filterSearch:g=!1,filterState:b,triggerFilter:y,locale:x,children:w,getPopupContainer:k,rootClassName:C}=e,{filterResetToDefaultFilteredValue:E,defaultFilteredValue:S,filterDropdownProps:N={},filterDropdownOpen:K,filterDropdownVisible:O,onFilterDropdownVisibleChange:I,onFilterDropdownOpenChange:R}=u,[P,M]=o.useState(!1),T=!!(b&&((null===(t=b.filteredKeys)||void 0===t?void 0:t.length)||b.forceFiltered)),D=e=>{var t;M(e),null===(t=N.onOpenChange)||void 0===t||t.call(N,e),null==R||R(e),null==I||I(e)},L=null!==(a=null!==(r=null!==(n=N.open)&&void 0!==n?n:K)&&void 0!==r?r:O)&&void 0!==a?a:P,j=null==b?void 0:b.filteredKeys,[B,H]=tz(j||[]),z=e=>{let{selectedKeys:t}=e;H(t)},A=(e,t)=>{let{node:n,checked:o}=t;h?z({selectedKeys:e}):z({selectedKeys:o&&n.key?[n.key]:[]})};o.useEffect(()=>{P&&z({selectedKeys:j||[]})},[j]);let[W,_]=o.useState([]),F=e=>{_(e)},[q,V]=o.useState(""),X=e=>{let{value:t}=e.target;V(t)};o.useEffect(()=>{P||V("")},[P]);let U=e=>{let t=(null==e?void 0:e.length)?e:null;if(null===t&&(!b||!b.filteredKeys)||(0,d.Z)(t,null==b?void 0:b.filteredKeys,!0))return null;y({column:u,key:p,filteredKeys:t})},G=()=>{D(!1),U(B())},Y=function(){let{confirm:e,closeDropdown:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{confirm:!1,closeDropdown:!1};e&&U([]),t&&D(!1),V(""),E?H((S||[]).map(e=>String(e))):H([])},$=Z()({["".concat(f,"-menu-without-submenu")]:!(u.filters||[]).some(e=>{let{children:t}=e;return t})}),J=e=>{e.target.checked?H(nG(null==u?void 0:u.filters).map(e=>String(e))):H([])},Q=e=>{let{filters:t}=e;return(t||[]).map((e,t)=>{let n=String(e.value),o={title:e.text,key:void 0!==e.value?n:String(t)};return e.children&&(o.children=Q({filters:e.children})),o})},ee=e=>{var t;return Object.assign(Object.assign({},e),{text:e.title,value:e.key,children:(null===(t=e.children)||void 0===t?void 0:t.map(e=>ee(e)))||[]})},{direction:et,renderEmpty:en}=o.useContext(tk.E_);if("function"==typeof u.filterDropdown)l=u.filterDropdown({prefixCls:"".concat(f,"-custom"),setSelectedKeys:e=>z({selectedKeys:e}),selectedKeys:B(),confirm:function(){let{closeDropdown:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{closeDropdown:!0};e&&D(!1),U(B())},clearFilters:Y,filters:u.filters,visible:L,close:()=>{D(!1)}});else if(u.filterDropdown)l=u.filterDropdown;else{let e=B()||[];l=o.createElement(o.Fragment,null,(()=>{var t,n;let r=null!==(t=null==en?void 0:en("Table.filter"))&&void 0!==t?t:o.createElement(tW.Z,{image:tW.Z.PRESENTED_IMAGE_SIMPLE,description:x.filterEmptyText,styles:{image:{height:24}},style:{margin:0,padding:"16px 0"}});if(0===(u.filters||[]).length)return r;if("tree"===v)return o.createElement(o.Fragment,null,o.createElement(nV,{filterSearch:g,value:q,onChange:X,tablePrefixCls:i,locale:x}),o.createElement("div",{className:"".concat(i,"-filter-dropdown-tree")},h?o.createElement(ti.Z,{checked:e.length===nG(u.filters).length,indeterminate:e.length>0&&e.length"function"==typeof g?g(q,ee(e)):nY(q,e.title):void 0})));let a=function e(t){let{filters:n,prefixCls:r,filteredKeys:a,filterMultiple:l,searchValue:c,filterSearch:i}=t;return n.map((t,n)=>{let d=String(t.value);if(t.children)return{key:d||n,label:t.text,popupClassName:"".concat(r,"-dropdown-submenu"),children:e({filters:t.children,prefixCls:r,filteredKeys:a,filterMultiple:l,searchValue:c,filterSearch:i})};let s=l?ti.Z:ts.ZP,u={key:void 0!==t.value?d:n,label:o.createElement(o.Fragment,null,o.createElement(s,{checked:a.includes(d)}),o.createElement("span",null,t.text))};return c.trim()?"function"==typeof i?i(c,t)?u:null:nY(c,t.text)?u:null:u})}({filters:u.filters||[],filterSearch:g,prefixCls:s,filteredKeys:B(),filterMultiple:h,searchValue:q}),l=a.every(e=>null===e);return o.createElement(o.Fragment,null,o.createElement(nV,{filterSearch:g,value:q,onChange:X,tablePrefixCls:i,locale:x}),l?r:o.createElement(t_.Z,{selectable:!0,multiple:h,prefixCls:"".concat(f,"-menu"),className:$,onSelect:z,onDeselect:z,selectedKeys:e,getPopupContainer:k,openKeys:W,onOpenChange:F,items:a}))})(),o.createElement("div",{className:"".concat(s,"-dropdown-btns")},o.createElement(tA.ZP,{type:"link",size:"small",disabled:E?(0,d.Z)((S||[]).map(e=>String(e)),e,!0):0===e.length,onClick:()=>Y()},x.filterReset),o.createElement(tA.ZP,{type:"primary",size:"small",onClick:G},x.filterConfirm)))}u.filterDropdown&&(l=o.createElement(tF.J,{selectable:void 0},l)),l=o.createElement(nU,{className:"".concat(s,"-dropdown")},l);let eo=(0,tB.Z)({trigger:["click"],placement:"rtl"===et?"bottomLeft":"bottomRight",children:(c="function"==typeof u.filterIcon?u.filterIcon(T):u.filterIcon?u.filterIcon:o.createElement(tj,null),o.createElement("span",{role:"button",tabIndex:-1,className:Z()("".concat(s,"-trigger"),{active:T}),onClick:e=>{e.stopPropagation()}},c)),getPopupContainer:k},Object.assign(Object.assign({},N),{rootClassName:Z()(C,N.rootClassName),open:L,onOpenChange:(e,t)=>{"trigger"===t.source&&(e&&void 0!==j&&H(j||[]),D(e),e||u.filterDropdown||!m||G())},popupRender:()=>"function"==typeof(null==N?void 0:N.dropdownRender)?N.dropdownRender(l):l}));return o.createElement("div",{className:"".concat(s,"-column")},o.createElement("span",{className:"".concat(i,"-column-title")},w),o.createElement(td.Z,Object.assign({},eo)))};let nJ=(e,t,n)=>{let o=[];return(e||[]).forEach((e,r)=>{var a;let l=tP(r,n),c=void 0!==e.filterDropdown;if(e.filters||c||"onFilter"in e){if("filteredValue"in e){let t=e.filteredValue;c||(t=null!==(a=null==t?void 0:t.map(String))&&void 0!==a?a:t),o.push({column:e,key:tR(e,l),filteredKeys:t,forceFiltered:e.filtered})}else o.push({column:e,key:tR(e,l),filteredKeys:t&&e.defaultFilteredValue?e.defaultFilteredValue:void 0,forceFiltered:e.filtered})}"children"in e&&(o=[].concat((0,el.Z)(o),(0,el.Z)(nJ(e.children,t,l))))}),o},nQ=e=>{let t={};return e.forEach(e=>{let{key:n,filteredKeys:o,column:r}=e,{filters:a,filterDropdown:l}=r;if(l)t[n]=o||null;else if(Array.isArray(o)){let e=nG(a);t[n]=e.filter(e=>o.includes(String(e)))}else t[n]=null}),t},n0=(e,t,n)=>t.reduce((e,o)=>{let{column:{onFilter:r,filters:a},filteredKeys:l}=o;return r&&l&&l.length?e.map(e=>Object.assign({},e)).filter(e=>l.some(o=>{let l=nG(a),c=l.findIndex(e=>String(e)===String(o)),i=-1!==c?l[c]:o;return e[n]&&(e[n]=n0(e[n],t,n)),r(i,e)})):e},e),n1=e=>e.flatMap(e=>"children"in e?[e].concat((0,el.Z)(n1(e.children||[]))):[e]);var n2=e=>{let{prefixCls:t,dropdownPrefixCls:n,mergedColumns:r,onFilterChange:a,getPopupContainer:l,locale:c,rootClassName:i}=e;(0,tc.ln)("Table");let d=o.useMemo(()=>n1(r||[]),[r]),[s,u]=o.useState(()=>nJ(d,!0)),f=o.useMemo(()=>{let e=nJ(d,!1);if(0===e.length)return e;let t=!0;if(e.forEach(e=>{let{filteredKeys:n}=e;void 0!==n&&(t=!1)}),t){let e=(d||[]).map((e,t)=>tR(e,tP(t)));return s.filter(t=>{let{key:n}=t;return e.includes(n)}).map(t=>{let n=d[e.indexOf(t.key)];return Object.assign(Object.assign({},t),{column:Object.assign(Object.assign({},t.column),n),forceFiltered:n.filtered})})}return e},[d,s]),p=o.useMemo(()=>nQ(f),[f]),m=e=>{let t=f.filter(t=>{let{key:n}=t;return n!==e.key});t.push(e),u(t),a(nQ(t),t)};return[e=>(function e(t,n,r,a,l,c,i,d,s){return r.map((r,u)=>{let f=tP(u,d),{filterOnClose:p=!0,filterMultiple:m=!0,filterMode:h,filterSearch:v}=r,g=r;if(g.filters||g.filterDropdown){let e=tR(g,f),d=a.find(t=>{let{key:n}=t;return e===n});g=Object.assign(Object.assign({},g),{title:a=>o.createElement(n$,{tablePrefixCls:t,prefixCls:"".concat(t,"-filter"),dropdownPrefixCls:n,column:g,columnKey:e,filterState:d,filterOnClose:p,filterMultiple:m,filterMode:h,filterSearch:v,triggerFilter:c,locale:l,getPopupContainer:i,rootClassName:s},tM(r.title,a))})}return"children"in g&&(g=Object.assign(Object.assign({},g),{children:e(t,n,g.children,a,l,c,i,f,s)})),g})})(t,n,e,f,c,m,l,void 0,i),f,p]},n3=(e,t,n)=>{let r=o.useRef({});return[function(o){var a;if(!r.current||r.current.data!==e||r.current.childrenColumnName!==t||r.current.getRowKey!==n){let o=new Map;!function e(r){r.forEach((r,a)=>{let l=n(r,a);o.set(l,r),r&&"object"==typeof r&&t in r&&e(r[t]||[])})}(e),r.current={data:e,childrenColumnName:t,kvMap:o,getRowKey:n}}return null===(a=r.current.kvMap)||void 0===a?void 0:a.get(o)}]},n4=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,o=Object.getOwnPropertySymbols(e);rt.indexOf(o[r])&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]]);return n},n8=function(e,t,n){let r=n&&"object"==typeof n?n:{},{total:a=0}=r,l=n4(r,["total"]),[c,i]=(0,o.useState)(()=>({current:"defaultCurrent"in l?l.defaultCurrent:1,pageSize:"defaultPageSize"in l?l.defaultPageSize:10})),d=(0,tB.Z)(c,l,{total:a>0?a:e}),s=Math.ceil((a||e)/d.pageSize);d.current>s&&(d.current=s||1);let u=(e,t)=>{i({current:null!=e?e:1,pageSize:t||d.pageSize})};return!1===n?[{},()=>{}]:[Object.assign(Object.assign({},d),{onChange:(e,o)=>{var r;n&&(null===(r=n.onChange)||void 0===r||r.call(n,e,o)),u(e,o),t(e,o||(null==d?void 0:d.pageSize))}}),u]},n6={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z"}}]},name:"caret-down",theme:"outlined"},n5=o.forwardRef(function(e,t){return o.createElement(tL.Z,(0,p.Z)({},e,{ref:t,icon:n6}))}),n7={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M858.9 689L530.5 308.2c-9.4-10.9-27.5-10.9-37 0L165.1 689c-12.2 14.2-1.2 35 18.5 35h656.8c19.7 0 30.7-20.8 18.5-35z"}}]},name:"caret-up",theme:"outlined"},n9=o.forwardRef(function(e,t){return o.createElement(tL.Z,(0,p.Z)({},e,{ref:t,icon:n7}))}),oe=n(99981);let ot="ascend",on="descend",oo=e=>"object"==typeof e.sorter&&"number"==typeof e.sorter.multiple&&e.sorter.multiple,or=e=>"function"==typeof e?e:!!e&&"object"==typeof e&&!!e.compare&&e.compare,oa=(e,t)=>t?e[e.indexOf(t)+1]:e[0],ol=(e,t,n)=>{let o=[],r=(e,t)=>{o.push({column:e,key:tR(e,t),multiplePriority:oo(e),sortOrder:e.sortOrder})};return(e||[]).forEach((e,a)=>{let l=tP(a,n);e.children?("sortOrder"in e&&r(e,l),o=[].concat((0,el.Z)(o),(0,el.Z)(ol(e.children,t,l)))):e.sorter&&("sortOrder"in e?r(e,l):t&&e.defaultSortOrder&&o.push({column:e,key:tR(e,l),multiplePriority:oo(e),sortOrder:e.defaultSortOrder}))}),o},oc=(e,t,n,r,a,l,c,i)=>(t||[]).map((t,d)=>{let s=tP(d,i),u=t;if(u.sorter){let i;let d=u.sortDirections||a,f=void 0===u.showSorterTooltip?c:u.showSorterTooltip,p=tR(u,s),m=n.find(e=>{let{key:t}=e;return t===p}),h=m?m.sortOrder:null,v=oa(d,h);if(t.sortIcon)i=t.sortIcon({sortOrder:h});else{let t=d.includes(ot)&&o.createElement(n9,{className:Z()("".concat(e,"-column-sorter-up"),{active:h===ot})}),n=d.includes(on)&&o.createElement(n5,{className:Z()("".concat(e,"-column-sorter-down"),{active:h===on})});i=o.createElement("span",{className:Z()("".concat(e,"-column-sorter"),{["".concat(e,"-column-sorter-full")]:!!(t&&n)})},o.createElement("span",{className:"".concat(e,"-column-sorter-inner"),"aria-hidden":"true"},t,n))}let{cancelSort:g,triggerAsc:b,triggerDesc:y}=l||{},x=g;v===on?x=y:v===ot&&(x=b);let w="object"==typeof f?Object.assign({title:x},f):{title:x};u=Object.assign(Object.assign({},u),{className:Z()(u.className,{["".concat(e,"-column-sort")]:h}),title:n=>{let r="".concat(e,"-column-sorters"),a=o.createElement("span",{className:"".concat(e,"-column-title")},tM(t.title,n)),l=o.createElement("div",{className:r},a,i);return f?"boolean"!=typeof f&&(null==f?void 0:f.target)==="sorter-icon"?o.createElement("div",{className:Z()(r,"".concat(r,"-tooltip-target-sorter"))},a,o.createElement(oe.Z,Object.assign({},w),i)):o.createElement(oe.Z,Object.assign({},w),l):l},onHeaderCell:n=>{var o;let a=(null===(o=t.onHeaderCell)||void 0===o?void 0:o.call(t,n))||{},l=a.onClick,c=a.onKeyDown;a.onClick=e=>{r({column:t,key:p,sortOrder:v,multiplePriority:oo(t)}),null==l||l(e)},a.onKeyDown=e=>{e.keyCode===tY.Z.ENTER&&(r({column:t,key:p,sortOrder:v,multiplePriority:oo(t)}),null==c||c(e))};let i=tT(t.title,{}),d=null==i?void 0:i.toString();return h&&(a["aria-sort"]="ascend"===h?"ascending":"descending"),a["aria-label"]=d||"",a.className=Z()(a.className,"".concat(e,"-column-has-sorters")),a.tabIndex=0,t.ellipsis&&(a.title=(null!=i?i:"").toString()),a}})}return"children"in u&&(u=Object.assign(Object.assign({},u),{children:oc(e,u.children,n,r,a,l,c,s)})),u}),oi=e=>{let{column:t,sortOrder:n}=e;return{column:t,order:n,field:t.dataIndex,columnKey:t.key}},od=e=>{let t=e.filter(e=>{let{sortOrder:t}=e;return t}).map(oi);if(0===t.length&&e.length){let t=e.length-1;return Object.assign(Object.assign({},oi(e[t])),{column:void 0,order:void 0,field:void 0,columnKey:void 0})}return t.length<=1?t[0]||{}:t},os=(e,t,n)=>{let o=t.slice().sort((e,t)=>t.multiplePriority-e.multiplePriority),r=e.slice(),a=o.filter(e=>{let{column:{sorter:t},sortOrder:n}=e;return or(t)&&n});return a.length?r.sort((e,t)=>{for(let n=0;n{let o=e[n];return o?Object.assign(Object.assign({},e),{[n]:os(o,t,n)}):e}):r};var ou=e=>{let{prefixCls:t,mergedColumns:n,sortDirections:r,tableLocale:a,showSorterTooltip:l,onSorterChange:c}=e,[i,d]=o.useState(()=>ol(n,!0)),s=(e,t)=>{let n=[];return e.forEach((e,o)=>{let r=tP(o,t);if(n.push(tR(e,r)),Array.isArray(e.children)){let t=s(e.children,r);n.push.apply(n,(0,el.Z)(t))}}),n},u=o.useMemo(()=>{let e=!0,t=ol(n,!1);if(!t.length){let e=s(n);return i.filter(t=>{let{key:n}=t;return e.includes(n)})}let o=[];function r(t){e?o.push(t):o.push(Object.assign(Object.assign({},t),{sortOrder:null}))}let a=null;return t.forEach(t=>{null===a?(r(t),t.sortOrder&&(!1===t.multiplePriority?e=!1:a=!0)):(a&&!1!==t.multiplePriority||(e=!1),r(t))}),o},[n,i]),f=o.useMemo(()=>{var e,t;let n=u.map(e=>{let{column:t,sortOrder:n}=e;return{column:t,order:n}});return{sortColumns:n,sortColumn:null===(e=n[0])||void 0===e?void 0:e.column,sortOrder:null===(t=n[0])||void 0===t?void 0:t.order}},[u]),p=e=>{let t;d(t=!1!==e.multiplePriority&&u.length&&!1!==u[0].multiplePriority?[].concat((0,el.Z)(u.filter(t=>{let{key:n}=t;return n!==e.key})),[e]):[e]),c(od(t),t)};return[e=>oc(t,e,u,p,r,a,l),u,f,()=>od(u)]};let of=(e,t)=>e.map(e=>{let n=Object.assign({},e);return n.title=tM(e.title,t),"children"in n&&(n.children=of(n.children,t)),n});var op=e=>[o.useCallback(t=>of(t,e),[e])];let om=b(eI,(e,t)=>{let{_renderTimes:n}=e,{_renderTimes:o}=t;return n!==o}),oh=b(ez,(e,t)=>{let{_renderTimes:n}=e,{_renderTimes:o}=t;return n!==o});var ov=n(54558),og=e=>{let{componentCls:t,lineWidth:n,lineType:o,tableBorderColor:r,tableHeaderBg:a,tablePaddingVertical:l,tablePaddingHorizontal:c,calc:i}=e,d="".concat((0,nm.bf)(n)," ").concat(o," ").concat(r),s=(e,o,r)=>({["&".concat(t,"-").concat(e)]:{["> ".concat(t,"-container")]:{["> ".concat(t,"-content, > ").concat(t,"-body")]:{"\n > table > tbody > tr > th,\n > table > tbody > tr > td\n ":{["> ".concat(t,"-expanded-row-fixed")]:{margin:"".concat((0,nm.bf)(i(o).mul(-1).equal()),"\n ").concat((0,nm.bf)(i(i(r).add(n)).mul(-1).equal()))}}}}}});return{["".concat(t,"-wrapper")]:{["".concat(t).concat(t,"-bordered")]:Object.assign(Object.assign(Object.assign({["> ".concat(t,"-title")]:{border:d,borderBottom:0},["> ".concat(t,"-container")]:{borderInlineStart:d,borderTop:d,["\n > ".concat(t,"-content,\n > ").concat(t,"-header,\n > ").concat(t,"-body,\n > ").concat(t,"-summary\n ")]:{"> table":{"\n > thead > tr > th,\n > thead > tr > td,\n > tbody > tr > th,\n > tbody > tr > td,\n > tfoot > tr > th,\n > tfoot > tr > td\n ":{borderInlineEnd:d},"> thead":{"> tr:not(:last-child) > th":{borderBottom:d},"> tr > th::before":{backgroundColor:"transparent !important"}},"\n > thead > tr,\n > tbody > tr,\n > tfoot > tr\n ":{["> ".concat(t,"-cell-fix-right-first::after")]:{borderInlineEnd:d}},"\n > tbody > tr > th,\n > tbody > tr > td\n ":{["> ".concat(t,"-expanded-row-fixed")]:{margin:"".concat((0,nm.bf)(i(l).mul(-1).equal())," ").concat((0,nm.bf)(i(i(c).add(n)).mul(-1).equal())),"&::after":{position:"absolute",top:0,insetInlineEnd:n,bottom:0,borderInlineEnd:d,content:'""'}}}}}},["&".concat(t,"-scroll-horizontal")]:{["> ".concat(t,"-container > ").concat(t,"-body")]:{"> table > tbody":{["\n > tr".concat(t,"-expanded-row,\n > tr").concat(t,"-placeholder\n ")]:{"> th, > td":{borderInlineEnd:0}}}}}},s("middle",e.tablePaddingVerticalMiddle,e.tablePaddingHorizontalMiddle)),s("small",e.tablePaddingVerticalSmall,e.tablePaddingHorizontalSmall)),{["> ".concat(t,"-footer")]:{border:d,borderTop:0}}),["".concat(t,"-cell")]:{["".concat(t,"-container:first-child")]:{borderTop:0},"&-scrollbar:not([rowspan])":{boxShadow:"0 ".concat((0,nm.bf)(n)," 0 ").concat((0,nm.bf)(n)," ").concat(a)}},["".concat(t,"-bordered ").concat(t,"-cell-scrollbar")]:{borderInlineEnd:d}}}},ob=e=>{let{componentCls:t}=e;return{["".concat(t,"-wrapper")]:{["".concat(t,"-cell-ellipsis")]:Object.assign(Object.assign({},nv.vS),{wordBreak:"keep-all",["\n &".concat(t,"-cell-fix-left-last,\n &").concat(t,"-cell-fix-right-first\n ")]:{overflow:"visible",["".concat(t,"-cell-content")]:{display:"block",overflow:"hidden",textOverflow:"ellipsis"}},["".concat(t,"-column-title")]:{overflow:"hidden",textOverflow:"ellipsis",wordBreak:"keep-all"}})}}},oy=e=>{let{componentCls:t}=e;return{["".concat(t,"-wrapper")]:{["".concat(t,"-tbody > tr").concat(t,"-placeholder")]:{textAlign:"center",color:e.colorTextDisabled,"\n &:hover > th,\n &:hover > td,\n ":{background:e.colorBgContainer}}}}},ox=e=>{let{componentCls:t,antCls:n,motionDurationSlow:o,lineWidth:r,paddingXS:a,lineType:l,tableBorderColor:c,tableExpandIconBg:i,tableExpandColumnWidth:d,borderRadius:s,tablePaddingVertical:u,tablePaddingHorizontal:f,tableExpandedRowBg:p,paddingXXS:m,expandIconMarginTop:h,expandIconSize:v,expandIconHalfInner:g,expandIconScale:b,calc:y}=e,x="".concat((0,nm.bf)(r)," ").concat(l," ").concat(c),w=y(m).sub(r).equal();return{["".concat(t,"-wrapper")]:{["".concat(t,"-expand-icon-col")]:{width:d},["".concat(t,"-row-expand-icon-cell")]:{textAlign:"center",["".concat(t,"-row-expand-icon")]:{display:"inline-flex",float:"none",verticalAlign:"sub"}},["".concat(t,"-row-indent")]:{height:1,float:"left"},["".concat(t,"-row-expand-icon")]:Object.assign(Object.assign({},(0,nv.Nd)(e)),{position:"relative",float:"left",width:v,height:v,color:"inherit",lineHeight:(0,nm.bf)(v),background:i,border:x,borderRadius:s,transform:"scale(".concat(b,")"),"&:focus, &:hover, &:active":{borderColor:"currentcolor"},"&::before, &::after":{position:"absolute",background:"currentcolor",transition:"transform ".concat(o," ease-out"),content:'""'},"&::before":{top:g,insetInlineEnd:w,insetInlineStart:w,height:r},"&::after":{top:w,bottom:w,insetInlineStart:g,width:r,transform:"rotate(90deg)"},"&-collapsed::before":{transform:"rotate(-180deg)"},"&-collapsed::after":{transform:"rotate(0deg)"},"&-spaced":{"&::before, &::after":{display:"none",content:"none"},background:"transparent",border:0,visibility:"hidden"}}),["".concat(t,"-row-indent + ").concat(t,"-row-expand-icon")]:{marginTop:h,marginInlineEnd:a},["tr".concat(t,"-expanded-row")]:{"&, &:hover":{"> th, > td":{background:p}},["".concat(n,"-descriptions-view")]:{display:"flex",table:{flex:"auto",width:"100%"}}},["".concat(t,"-expanded-row-fixed")]:{position:"relative",margin:"".concat((0,nm.bf)(y(u).mul(-1).equal())," ").concat((0,nm.bf)(y(f).mul(-1).equal())),padding:"".concat((0,nm.bf)(u)," ").concat((0,nm.bf)(f))}}}},ow=e=>{let{componentCls:t,antCls:n,iconCls:o,tableFilterDropdownWidth:r,tableFilterDropdownSearchWidth:a,paddingXXS:l,paddingXS:c,colorText:i,lineWidth:d,lineType:s,tableBorderColor:u,headerIconColor:f,fontSizeSM:p,tablePaddingHorizontal:m,borderRadius:h,motionDurationSlow:v,colorIcon:g,colorPrimary:b,tableHeaderFilterActiveBg:y,colorTextDisabled:x,tableFilterDropdownBg:w,tableFilterDropdownHeight:k,controlItemBgHover:C,controlItemBgActive:E,boxShadowSecondary:S,filterDropdownMenuBg:Z,calc:N}=e,K="".concat(n,"-dropdown"),O="".concat(t,"-filter-dropdown"),I="".concat(n,"-tree"),R="".concat((0,nm.bf)(d)," ").concat(s," ").concat(u);return[{["".concat(t,"-wrapper")]:{["".concat(t,"-filter-column")]:{display:"flex",justifyContent:"space-between"},["".concat(t,"-filter-trigger")]:{position:"relative",display:"flex",alignItems:"center",marginBlock:N(l).mul(-1).equal(),marginInline:"".concat((0,nm.bf)(l)," ").concat((0,nm.bf)(N(m).div(2).mul(-1).equal())),padding:"0 ".concat((0,nm.bf)(l)),color:f,fontSize:p,borderRadius:h,cursor:"pointer",transition:"all ".concat(v),"&:hover":{color:g,background:y},"&.active":{color:b}}}},{["".concat(n,"-dropdown")]:{[O]:Object.assign(Object.assign({},(0,nv.Wf)(e)),{minWidth:r,backgroundColor:w,borderRadius:h,boxShadow:S,overflow:"hidden",["".concat(K,"-menu")]:{maxHeight:k,overflowX:"hidden",border:0,boxShadow:"none",borderRadius:"unset",backgroundColor:Z,"&:empty::after":{display:"block",padding:"".concat((0,nm.bf)(c)," 0"),color:x,fontSize:p,textAlign:"center",content:'"Not Found"'}},["".concat(O,"-tree")]:{paddingBlock:"".concat((0,nm.bf)(c)," 0"),paddingInline:c,[I]:{padding:0},["".concat(I,"-treenode ").concat(I,"-node-content-wrapper:hover")]:{backgroundColor:C},["".concat(I,"-treenode-checkbox-checked ").concat(I,"-node-content-wrapper")]:{"&, &:hover":{backgroundColor:E}}},["".concat(O,"-search")]:{padding:c,borderBottom:R,"&-input":{input:{minWidth:a},[o]:{color:x}}},["".concat(O,"-checkall")]:{width:"100%",marginBottom:l,marginInlineStart:l},["".concat(O,"-btns")]:{display:"flex",justifyContent:"space-between",padding:"".concat((0,nm.bf)(N(c).sub(d).equal())," ").concat((0,nm.bf)(c)),overflow:"hidden",borderTop:R}})}},{["".concat(n,"-dropdown ").concat(O,", ").concat(O,"-submenu")]:{["".concat(n,"-checkbox-wrapper + span")]:{paddingInlineStart:c,color:i},"> ul":{maxHeight:"calc(100vh - 130px)",overflowX:"hidden",overflowY:"auto"}}}]},ok=e=>{let{componentCls:t,lineWidth:n,colorSplit:o,motionDurationSlow:r,zIndexTableFixed:a,tableBg:l,zIndexTableSticky:c,calc:i}=e;return{["".concat(t,"-wrapper")]:{["\n ".concat(t,"-cell-fix-left,\n ").concat(t,"-cell-fix-right\n ")]:{position:"sticky !important",zIndex:a,background:l},["\n ".concat(t,"-cell-fix-left-first::after,\n ").concat(t,"-cell-fix-left-last::after\n ")]:{position:"absolute",top:0,right:{_skip_check_:!0,value:0},bottom:i(n).mul(-1).equal(),width:30,transform:"translateX(100%)",transition:"box-shadow ".concat(r),content:'""',pointerEvents:"none",willChange:"transform"},["".concat(t,"-cell-fix-left-all::after")]:{display:"none"},["\n ".concat(t,"-cell-fix-right-first::after,\n ").concat(t,"-cell-fix-right-last::after\n ")]:{position:"absolute",top:0,bottom:i(n).mul(-1).equal(),left:{_skip_check_:!0,value:0},width:30,transform:"translateX(-100%)",transition:"box-shadow ".concat(r),content:'""',pointerEvents:"none"},["".concat(t,"-container")]:{position:"relative","&::before, &::after":{position:"absolute",top:0,bottom:0,zIndex:i(c).add(1).equal({unit:!1}),width:30,transition:"box-shadow ".concat(r),content:'""',pointerEvents:"none"},"&::before":{insetInlineStart:0},"&::after":{insetInlineEnd:0}},["".concat(t,"-ping-left")]:{["&:not(".concat(t,"-has-fix-left) ").concat(t,"-container::before")]:{boxShadow:"inset 10px 0 8px -8px ".concat(o)},["\n ".concat(t,"-cell-fix-left-first::after,\n ").concat(t,"-cell-fix-left-last::after\n ")]:{boxShadow:"inset 10px 0 8px -8px ".concat(o)},["".concat(t,"-cell-fix-left-last::before")]:{backgroundColor:"transparent !important"}},["".concat(t,"-ping-right")]:{["&:not(".concat(t,"-has-fix-right) ").concat(t,"-container::after")]:{boxShadow:"inset -10px 0 8px -8px ".concat(o)},["\n ".concat(t,"-cell-fix-right-first::after,\n ").concat(t,"-cell-fix-right-last::after\n ")]:{boxShadow:"inset -10px 0 8px -8px ".concat(o)}},["".concat(t,"-fixed-column-gapped")]:{["\n ".concat(t,"-cell-fix-left-first::after,\n ").concat(t,"-cell-fix-left-last::after,\n ").concat(t,"-cell-fix-right-first::after,\n ").concat(t,"-cell-fix-right-last::after\n ")]:{boxShadow:"none"}}}}},oC=e=>{let{componentCls:t,antCls:n,margin:o}=e;return{["".concat(t,"-wrapper ").concat(t,"-pagination").concat(n,"-pagination")]:{margin:"".concat((0,nm.bf)(o)," 0")}}},oE=e=>{let{componentCls:t,tableRadius:n}=e;return{["".concat(t,"-wrapper")]:{[t]:{["".concat(t,"-title, ").concat(t,"-header")]:{borderRadius:"".concat((0,nm.bf)(n)," ").concat((0,nm.bf)(n)," 0 0")},["".concat(t,"-title + ").concat(t,"-container")]:{borderStartStartRadius:0,borderStartEndRadius:0,["".concat(t,"-header, table")]:{borderRadius:0},"table > thead > tr:first-child":{"th:first-child, th:last-child, td:first-child, td:last-child":{borderRadius:0}}},"&-container":{borderStartStartRadius:n,borderStartEndRadius:n,"table > thead > tr:first-child":{"> *:first-child":{borderStartStartRadius:n},"> *:last-child":{borderStartEndRadius:n}}},"&-footer":{borderRadius:"0 0 ".concat((0,nm.bf)(n)," ").concat((0,nm.bf)(n))}}}}},oS=e=>{let{componentCls:t}=e;return{["".concat(t,"-wrapper-rtl")]:{direction:"rtl",table:{direction:"rtl"},["".concat(t,"-pagination-left")]:{justifyContent:"flex-end"},["".concat(t,"-pagination-right")]:{justifyContent:"flex-start"},["".concat(t,"-row-expand-icon")]:{float:"right","&::after":{transform:"rotate(-90deg)"},"&-collapsed::before":{transform:"rotate(180deg)"},"&-collapsed::after":{transform:"rotate(0deg)"}},["".concat(t,"-container")]:{"&::before":{insetInlineStart:"unset",insetInlineEnd:0},"&::after":{insetInlineStart:0,insetInlineEnd:"unset"},["".concat(t,"-row-indent")]:{float:"right"}}}}},oZ=e=>{let{componentCls:t,antCls:n,iconCls:o,fontSizeIcon:r,padding:a,paddingXS:l,headerIconColor:c,headerIconHoverColor:i,tableSelectionColumnWidth:d,tableSelectedRowBg:s,tableSelectedRowHoverBg:u,tableRowHoverBg:f,tablePaddingHorizontal:p,calc:m}=e;return{["".concat(t,"-wrapper")]:{["".concat(t,"-selection-col")]:{width:d,["&".concat(t,"-selection-col-with-dropdown")]:{width:m(d).add(r).add(m(a).div(4)).equal()}},["".concat(t,"-bordered ").concat(t,"-selection-col")]:{width:m(d).add(m(l).mul(2)).equal(),["&".concat(t,"-selection-col-with-dropdown")]:{width:m(d).add(r).add(m(a).div(4)).add(m(l).mul(2)).equal()}},["\n table tr th".concat(t,"-selection-column,\n table tr td").concat(t,"-selection-column,\n ").concat(t,"-selection-column\n ")]:{paddingInlineEnd:e.paddingXS,paddingInlineStart:e.paddingXS,textAlign:"center",["".concat(n,"-radio-wrapper")]:{marginInlineEnd:0}},["table tr th".concat(t,"-selection-column").concat(t,"-cell-fix-left")]:{zIndex:m(e.zIndexTableFixed).add(1).equal({unit:!1})},["table tr th".concat(t,"-selection-column::after")]:{backgroundColor:"transparent !important"},["".concat(t,"-selection")]:{position:"relative",display:"inline-flex",flexDirection:"column"},["".concat(t,"-selection-extra")]:{position:"absolute",top:0,zIndex:1,cursor:"pointer",transition:"all ".concat(e.motionDurationSlow),marginInlineStart:"100%",paddingInlineStart:(0,nm.bf)(m(p).div(4).equal()),[o]:{color:c,fontSize:r,verticalAlign:"baseline","&:hover":{color:i}}},["".concat(t,"-tbody")]:{["".concat(t,"-row")]:{["&".concat(t,"-row-selected")]:{["> ".concat(t,"-cell")]:{background:s,"&-row-hover":{background:u}}},["> ".concat(t,"-cell-row-hover")]:{background:f}}}}}},oN=e=>{let{componentCls:t,tableExpandColumnWidth:n,calc:o}=e,r=(e,r,a,l)=>({["".concat(t).concat(t,"-").concat(e)]:{fontSize:l,["\n ".concat(t,"-title,\n ").concat(t,"-footer,\n ").concat(t,"-cell,\n ").concat(t,"-thead > tr > th,\n ").concat(t,"-tbody > tr > th,\n ").concat(t,"-tbody > tr > td,\n tfoot > tr > th,\n tfoot > tr > td\n ")]:{padding:"".concat((0,nm.bf)(r)," ").concat((0,nm.bf)(a))},["".concat(t,"-filter-trigger")]:{marginInlineEnd:(0,nm.bf)(o(a).div(2).mul(-1).equal())},["".concat(t,"-expanded-row-fixed")]:{margin:"".concat((0,nm.bf)(o(r).mul(-1).equal())," ").concat((0,nm.bf)(o(a).mul(-1).equal()))},["".concat(t,"-tbody")]:{["".concat(t,"-wrapper:only-child ").concat(t)]:{marginBlock:(0,nm.bf)(o(r).mul(-1).equal()),marginInline:"".concat((0,nm.bf)(o(n).sub(a).equal())," ").concat((0,nm.bf)(o(a).mul(-1).equal()))}},["".concat(t,"-selection-extra")]:{paddingInlineStart:(0,nm.bf)(o(a).div(4).equal())}}});return{["".concat(t,"-wrapper")]:Object.assign(Object.assign({},r("middle",e.tablePaddingVerticalMiddle,e.tablePaddingHorizontalMiddle,e.tableFontSizeMiddle)),r("small",e.tablePaddingVerticalSmall,e.tablePaddingHorizontalSmall,e.tableFontSizeSmall))}},oK=e=>{let{componentCls:t,marginXXS:n,fontSizeIcon:o,headerIconColor:r,headerIconHoverColor:a}=e;return{["".concat(t,"-wrapper")]:{["".concat(t,"-thead th").concat(t,"-column-has-sorters")]:{outline:"none",cursor:"pointer",transition:"all ".concat(e.motionDurationSlow,", left 0s"),"&:hover":{background:e.tableHeaderSortHoverBg,"&::before":{backgroundColor:"transparent !important"}},"&:focus-visible":{color:e.colorPrimary},["\n &".concat(t,"-cell-fix-left:hover,\n &").concat(t,"-cell-fix-right:hover\n ")]:{background:e.tableFixedHeaderSortActiveBg}},["".concat(t,"-thead th").concat(t,"-column-sort")]:{background:e.tableHeaderSortBg,"&::before":{backgroundColor:"transparent !important"}},["td".concat(t,"-column-sort")]:{background:e.tableBodySortBg},["".concat(t,"-column-title")]:{position:"relative",zIndex:1,flex:1,minWidth:0},["".concat(t,"-column-sorters")]:{display:"flex",flex:"auto",alignItems:"center",justifyContent:"space-between","&::after":{position:"absolute",inset:0,width:"100%",height:"100%",content:'""'}},["".concat(t,"-column-sorters-tooltip-target-sorter")]:{"&::after":{content:"none"}},["".concat(t,"-column-sorter")]:{marginInlineStart:n,color:r,fontSize:0,transition:"color ".concat(e.motionDurationSlow),"&-inner":{display:"inline-flex",flexDirection:"column",alignItems:"center"},"&-up, &-down":{fontSize:o,"&.active":{color:e.colorPrimary}},["".concat(t,"-column-sorter-up + ").concat(t,"-column-sorter-down")]:{marginTop:"-0.3em"}},["".concat(t,"-column-sorters:hover ").concat(t,"-column-sorter")]:{color:a}}}},oO=e=>{let{componentCls:t,opacityLoading:n,tableScrollThumbBg:o,tableScrollThumbBgHover:r,tableScrollThumbSize:a,tableScrollBg:l,zIndexTableSticky:c,stickyScrollBarBorderRadius:i,lineWidth:d,lineType:s,tableBorderColor:u}=e,f="".concat((0,nm.bf)(d)," ").concat(s," ").concat(u);return{["".concat(t,"-wrapper")]:{["".concat(t,"-sticky")]:{"&-holder":{position:"sticky",zIndex:c,background:e.colorBgContainer},"&-scroll":{position:"sticky",bottom:0,height:"".concat((0,nm.bf)(a)," !important"),zIndex:c,display:"flex",alignItems:"center",background:l,borderTop:f,opacity:n,"&:hover":{transformOrigin:"center bottom"},"&-bar":{height:a,backgroundColor:o,borderRadius:i,transition:"all ".concat(e.motionDurationSlow,", transform 0s"),position:"absolute",bottom:0,"&:hover, &-active":{backgroundColor:r}}}}}}},oI=e=>{let{componentCls:t,lineWidth:n,tableBorderColor:o,calc:r}=e,a="".concat((0,nm.bf)(n)," ").concat(e.lineType," ").concat(o);return{["".concat(t,"-wrapper")]:{["".concat(t,"-summary")]:{position:"relative",zIndex:e.zIndexTableFixed,background:e.tableBg,"> tr":{"> th, > td":{borderBottom:a}}},["div".concat(t,"-summary")]:{boxShadow:"0 ".concat((0,nm.bf)(r(n).mul(-1).equal())," 0 ").concat(o)}}}},oR=e=>{let{componentCls:t,motionDurationMid:n,lineWidth:o,lineType:r,tableBorderColor:a,calc:l}=e,c="".concat((0,nm.bf)(o)," ").concat(r," ").concat(a),i="".concat(t,"-expanded-row-cell");return{["".concat(t,"-wrapper")]:{["".concat(t,"-tbody-virtual")]:{["".concat(t,"-tbody-virtual-holder-inner")]:{["\n & > ".concat(t,"-row, \n & > div:not(").concat(t,"-row) > ").concat(t,"-row\n ")]:{display:"flex",boxSizing:"border-box",width:"100%"}},["".concat(t,"-cell")]:{borderBottom:c,transition:"background ".concat(n)},["".concat(t,"-expanded-row")]:{["".concat(i).concat(i,"-fixed")]:{position:"sticky",insetInlineStart:0,overflow:"hidden",width:"calc(var(--virtual-width) - ".concat((0,nm.bf)(o),")"),borderInlineEnd:"none"}}},["".concat(t,"-bordered")]:{["".concat(t,"-tbody-virtual")]:{"&:after":{content:'""',insetInline:0,bottom:0,borderBottom:c,position:"absolute"},["".concat(t,"-cell")]:{borderInlineEnd:c,["&".concat(t,"-cell-fix-right-first:before")]:{content:'""',position:"absolute",insetBlock:0,insetInlineStart:l(o).mul(-1).equal(),borderInlineStart:c}}},["&".concat(t,"-virtual")]:{["".concat(t,"-placeholder ").concat(t,"-cell")]:{borderInlineEnd:c,borderBottom:c}}}}}};let oP=e=>{let{componentCls:t,fontWeightStrong:n,tablePaddingVertical:o,tablePaddingHorizontal:r,tableExpandColumnWidth:a,lineWidth:l,lineType:c,tableBorderColor:i,tableFontSize:d,tableBg:s,tableRadius:u,tableHeaderTextColor:f,motionDurationMid:p,tableHeaderBg:m,tableHeaderCellSplitColor:h,tableFooterTextColor:v,tableFooterBg:g,calc:b}=e,y="".concat((0,nm.bf)(l)," ").concat(c," ").concat(i);return{["".concat(t,"-wrapper")]:Object.assign(Object.assign({clear:"both",maxWidth:"100%","--rc-virtual-list-scrollbar-bg":e.tableScrollBg},(0,nv.dF)()),{[t]:Object.assign(Object.assign({},(0,nv.Wf)(e)),{fontSize:d,background:s,borderRadius:"".concat((0,nm.bf)(u)," ").concat((0,nm.bf)(u)," 0 0"),scrollbarColor:"".concat(e.tableScrollThumbBg," ").concat(e.tableScrollBg)}),table:{width:"100%",textAlign:"start",borderRadius:"".concat((0,nm.bf)(u)," ").concat((0,nm.bf)(u)," 0 0"),borderCollapse:"separate",borderSpacing:0},["\n ".concat(t,"-cell,\n ").concat(t,"-thead > tr > th,\n ").concat(t,"-tbody > tr > th,\n ").concat(t,"-tbody > tr > td,\n tfoot > tr > th,\n tfoot > tr > td\n ")]:{position:"relative",padding:"".concat((0,nm.bf)(o)," ").concat((0,nm.bf)(r)),overflowWrap:"break-word"},["".concat(t,"-title")]:{padding:"".concat((0,nm.bf)(o)," ").concat((0,nm.bf)(r))},["".concat(t,"-thead")]:{"\n > tr > th,\n > tr > td\n ":{position:"relative",color:f,fontWeight:n,textAlign:"start",background:m,borderBottom:y,transition:"background ".concat(p," ease"),"&[colspan]:not([colspan='1'])":{textAlign:"center"},["&:not(:last-child):not(".concat(t,"-selection-column):not(").concat(t,"-row-expand-icon-cell):not([colspan])::before")]:{position:"absolute",top:"50%",insetInlineEnd:0,width:1,height:"1.6em",backgroundColor:h,transform:"translateY(-50%)",transition:"background-color ".concat(p),content:'""'}},"> tr:not(:last-child) > th[colspan]":{borderBottom:0}},["".concat(t,"-tbody")]:{"> tr":{"> th, > td":{transition:"background ".concat(p,", border-color ").concat(p),borderBottom:y,["\n > ".concat(t,"-wrapper:only-child,\n > ").concat(t,"-expanded-row-fixed > ").concat(t,"-wrapper:only-child\n ")]:{[t]:{marginBlock:(0,nm.bf)(b(o).mul(-1).equal()),marginInline:"".concat((0,nm.bf)(b(a).sub(r).equal()),"\n ").concat((0,nm.bf)(b(r).mul(-1).equal())),["".concat(t,"-tbody > tr:last-child > td")]:{borderBottomWidth:0,"&:first-child, &:last-child":{borderRadius:0}}}}},"> th":{position:"relative",color:f,fontWeight:n,textAlign:"start",background:m,borderBottom:y,transition:"background ".concat(p," ease")},["& > ".concat(t,"-measure-cell")]:{paddingBlock:"0 !important",borderBlock:"0 !important",["".concat(t,"-measure-cell-content")]:{height:0,overflow:"hidden",pointerEvents:"none"}}}},["".concat(t,"-footer")]:{padding:"".concat((0,nm.bf)(o)," ").concat((0,nm.bf)(r)),color:v,background:g}})}};var oM=(0,ny.I$)("Table",e=>{let{colorTextHeading:t,colorSplit:n,colorBgContainer:o,controlInteractiveSize:r,headerBg:a,headerColor:l,headerSortActiveBg:c,headerSortHoverBg:i,bodySortBg:d,rowHoverBg:s,rowSelectedBg:u,rowSelectedHoverBg:f,rowExpandedBg:p,cellPaddingBlock:m,cellPaddingInline:h,cellPaddingBlockMD:v,cellPaddingInlineMD:g,cellPaddingBlockSM:b,cellPaddingInlineSM:y,borderColor:x,footerBg:w,footerColor:k,headerBorderRadius:C,cellFontSize:E,cellFontSizeMD:S,cellFontSizeSM:Z,headerSplitColor:N,fixedHeaderSortActiveBg:K,headerFilterHoverBg:O,filterDropdownBg:I,expandIconBg:R,selectionColumnWidth:P,stickyScrollBarBg:M,calc:T}=e,D=(0,nb.IX)(e,{tableFontSize:E,tableBg:o,tableRadius:C,tablePaddingVertical:m,tablePaddingHorizontal:h,tablePaddingVerticalMiddle:v,tablePaddingHorizontalMiddle:g,tablePaddingVerticalSmall:b,tablePaddingHorizontalSmall:y,tableBorderColor:x,tableHeaderTextColor:l,tableHeaderBg:a,tableFooterTextColor:k,tableFooterBg:w,tableHeaderCellSplitColor:N,tableHeaderSortBg:c,tableHeaderSortHoverBg:i,tableBodySortBg:d,tableFixedHeaderSortActiveBg:K,tableHeaderFilterActiveBg:O,tableFilterDropdownBg:I,tableRowHoverBg:s,tableSelectedRowBg:u,tableSelectedRowHoverBg:f,zIndexTableFixed:2,zIndexTableSticky:T(2).add(1).equal({unit:!1}),tableFontSizeMiddle:S,tableFontSizeSmall:Z,tableSelectionColumnWidth:P,tableExpandIconBg:R,tableExpandColumnWidth:T(r).add(T(e.padding).mul(2)).equal(),tableExpandedRowBg:p,tableFilterDropdownWidth:120,tableFilterDropdownHeight:264,tableFilterDropdownSearchWidth:140,tableScrollThumbSize:8,tableScrollThumbBg:M,tableScrollThumbBgHover:t,tableScrollBg:n});return[oP(D),oC(D),oI(D),oK(D),ow(D),og(D),oE(D),ox(D),oI(D),oy(D),oZ(D),ok(D),oO(D),ob(D),oN(D),oS(D),oR(D)]},e=>{let{colorFillAlter:t,colorBgContainer:n,colorTextHeading:o,colorFillSecondary:r,colorFillContent:a,controlItemBgActive:l,controlItemBgActiveHover:c,padding:i,paddingSM:d,paddingXS:s,colorBorderSecondary:u,borderRadiusLG:f,controlHeight:p,colorTextPlaceholder:m,fontSize:h,fontSizeSM:v,lineHeight:g,lineWidth:b,colorIcon:y,colorIconHover:x,opacityLoading:w,controlInteractiveSize:k}=e,C=new ov.t(r).onBackground(n).toHexString(),E=new ov.t(a).onBackground(n).toHexString(),S=new ov.t(t).onBackground(n).toHexString(),Z=new ov.t(y),N=new ov.t(x),K=k/2-b,O=2*K+3*b;return{headerBg:S,headerColor:o,headerSortActiveBg:C,headerSortHoverBg:E,bodySortBg:S,rowHoverBg:S,rowSelectedBg:l,rowSelectedHoverBg:c,rowExpandedBg:t,cellPaddingBlock:i,cellPaddingInline:i,cellPaddingBlockMD:d,cellPaddingInlineMD:s,cellPaddingBlockSM:s,cellPaddingInlineSM:s,borderColor:u,headerBorderRadius:f,footerBg:S,footerColor:o,cellFontSize:h,cellFontSizeMD:h,cellFontSizeSM:h,headerSplitColor:u,fixedHeaderSortActiveBg:C,headerFilterHoverBg:a,filterDropdownMenuBg:n,filterDropdownBg:n,expandIconBg:n,selectionColumnWidth:p,stickyScrollBarBg:m,stickyScrollBarBorderRadius:100,expandIconMarginTop:(h*g-3*b)/2-Math.ceil((1.4*v-3*b)/2),headerIconColor:Z.clone().setA(Z.a*w).toRgbString(),headerIconHoverColor:N.clone().setA(N.a*w).toRgbString(),expandIconHalfInner:K,expandIconSize:O,expandIconScale:k/O}},{unitless:{expandIconScale:!0}});let oT=[];var oD=o.forwardRef((e,t)=>{var n,r;let{prefixCls:l,className:c,rootClassName:i,style:d,size:s,bordered:u,dropdownPrefixCls:f,dataSource:p,pagination:m,rowSelection:h,rowKey:v="key",rowClassName:g,columns:b,children:y,childrenColumnName:x,onChange:w,getPopupContainer:k,loading:C,expandIcon:E,expandable:S,expandedRowRender:N,expandIconColumnIndex:K,indentSize:O,scroll:I,sortDirections:R,locale:P,showSorterTooltip:M={target:"full-header"},virtual:T}=e;(0,tc.ln)("Table");let D=o.useMemo(()=>b||ev(y),[b,y]),L=o.useMemo(()=>D.some(e=>e.responsive),[D]),j=(0,tZ.Z)(L),B=o.useMemo(()=>{let e=new Set(Object.keys(j).filter(e=>j[e]));return D.filter(t=>!t.responsive||t.responsive.some(t=>e.has(t)))},[D,j]),H=(0,eq.Z)(e,["className","style","columns"]),{locale:z=tN.Z,direction:A,table:W,renderEmpty:_,getPrefixCls:F,getPopupContainer:q}=o.useContext(tk.E_),V=(0,tS.Z)(s),X=Object.assign(Object.assign({},z.Table),P),U=p||oT,G=F("table",l),Y=F("dropdown",f),[,$]=(0,tI.ZP)(),J=(0,tE.Z)(G),[Q,ee,et]=oM(G,J),en=Object.assign(Object.assign({childrenColumnName:x,expandIconColumnIndex:K},S),{expandIcon:null!==(n=null==S?void 0:S.expandIcon)&&void 0!==n?n:null===(r=null==W?void 0:W.expandable)||void 0===r?void 0:r.expandIcon}),{childrenColumnName:eo="children"}=en,er=o.useMemo(()=>U.some(e=>null==e?void 0:e[eo])?"nest":N||(null==S?void 0:S.expandedRowRender)?"row":null,[U]),ea={body:o.useRef(null)},el=o.useRef(null),ec=o.useRef(null);tb(t,()=>Object.assign(Object.assign({},ec.current),{nativeElement:el.current}));let ei=o.useMemo(()=>"function"==typeof v?v:e=>null==e?void 0:e[v],[v]),[ed]=n3(U,eo,ei),es={},eu=function(e,t){var n,o,r,a;let l=arguments.length>2&&void 0!==arguments[2]&&arguments[2],c=Object.assign(Object.assign({},es),e);l&&(null===(n=es.resetPagination)||void 0===n||n.call(es),(null===(o=c.pagination)||void 0===o?void 0:o.current)&&(c.pagination.current=1),m&&(null===(r=m.onChange)||void 0===r||r.call(m,1,null===(a=c.pagination)||void 0===a?void 0:a.pageSize))),I&&!1!==I.scrollToFirstRowOnChange&&ea.body.current&&function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{getContainer:n=()=>window,callback:o,duration:r=450}=t,a=n(),l=tx(a),c=Date.now(),i=()=>{let t=Date.now()-c,n=function(e,t,n,o){let r=n-t;return(e/=o/2)<1?r/2*e*e*e+t:r/2*((e-=2)*e*e+2)+t}(t>r?r:t,l,e,r);ty(a)?a.scrollTo(window.pageXOffset,n):a instanceof Document||"HTMLDocument"===a.constructor.name?a.documentElement.scrollTop=n:a.scrollTop=n,tea.body.current}),null==w||w(c.pagination,c.filters,c.sorter,{currentDataSource:n0(os(U,c.sorterStates,eo),c.filterStates,eo),action:t})},[ef,ep,em,eh]=ou({prefixCls:G,mergedColumns:B,onSorterChange:(e,t)=>{eu({sorter:e,sorterStates:t},"sort",!1)},sortDirections:R||["ascend","descend"],tableLocale:X,showSorterTooltip:M}),eg=o.useMemo(()=>os(U,ep,eo),[U,ep]);es.sorter=eh(),es.sorterStates=ep;let[eb,ey,ex]=n2({prefixCls:G,locale:X,dropdownPrefixCls:Y,mergedColumns:B,onFilterChange:(e,t)=>{eu({filters:e,filterStates:t},"filter",!0)},getPopupContainer:k||q,rootClassName:Z()(i,J)}),ew=n0(eg,ey,eo);es.filters=ex,es.filterStates=ey;let[eC]=op(o.useMemo(()=>{let e={};return Object.keys(ex).forEach(t=>{null!==ex[t]&&(e[t]=ex[t])}),Object.assign(Object.assign({},em),{filters:e})},[em,ex])),[eE,eS]=n8(ew.length,(e,t)=>{eu({pagination:Object.assign(Object.assign({},es.pagination),{current:e,pageSize:t})},"paginate")},m);es.pagination=!1===m?{}:function(e,t){let n={current:e.current,pageSize:e.pageSize};return Object.keys(t&&"object"==typeof t?t:{}).forEach(t=>{let o=e[t];"function"!=typeof o&&(n[t]=o)}),n}(eE,m),es.resetPagination=eS;let eZ=o.useMemo(()=>{if(!1===m||!eE.pageSize)return ew;let{current:e=1,total:t,pageSize:n=10}=eE;return ew.lengthn?ew.slice((e-1)*n,e*n):ew:ew.slice((e-1)*n,e*n)},[!!m,ew,null==eE?void 0:eE.current,null==eE?void 0:eE.pageSize,null==eE?void 0:eE.total]),[eN,eK]=tg({prefixCls:G,data:ew,pageData:eZ,getRowKey:ei,getRecordByKey:ed,expandType:er,childrenColumnName:eo,locale:X,getPopupContainer:k||q},h);en.__PARENT_RENDER_ICON__=en.expandIcon,en.expandIcon=en.expandIcon||E||(e=>{let{prefixCls:t,onExpand:n,record:r,expanded:a,expandable:l}=e,c="".concat(t,"-row-expand-icon");return o.createElement("button",{type:"button",onClick:e=>{n(r,e),e.stopPropagation()},className:Z()(c,{["".concat(c,"-spaced")]:!l,["".concat(c,"-expanded")]:l&&a,["".concat(c,"-collapsed")]:l&&!a}),"aria-label":a?X.collapse:X.expand,"aria-expanded":a})}),"nest"===er&&void 0===en.expandIconColumnIndex?en.expandIconColumnIndex=h?1:0:en.expandIconColumnIndex>0&&h&&(en.expandIconColumnIndex-=1),"number"!=typeof en.indentSize&&(en.indentSize="number"==typeof O?O:15);let eO=o.useCallback(e=>eC(eN(eb(ef(e)))),[ef,eb,eN]),eI=o.useMemo(()=>"boolean"==typeof C?{spinning:C}:"object"==typeof C&&null!==C?Object.assign({spinning:!0},C):void 0,[C]),eR=Z()(et,J,"".concat(G,"-wrapper"),null==W?void 0:W.className,{["".concat(G,"-wrapper-rtl")]:"rtl"===A},c,i,ee),eP=Object.assign(Object.assign({},null==W?void 0:W.style),d),eM=o.useMemo(()=>(null==eI?void 0:eI.spinning)&&U===oT?null:void 0!==(null==P?void 0:P.emptyText)?P.emptyText:(null==_?void 0:_("Table"))||o.createElement(tC.Z,{componentName:"Table"}),[null==eI?void 0:eI.spinning,U,null==P?void 0:P.emptyText,_]),eT={},eD=o.useMemo(()=>{let{fontSize:e,lineHeight:t,lineWidth:n,padding:o,paddingXS:r,paddingSM:a}=$,l=Math.floor(e*t);switch(V){case"middle":return 2*a+l+n;case"small":return 2*r+l+n;default:return 2*o+l+n}},[$,V]);T&&(eT.listItemHeight=eD);let{top:eL,bottom:ej}=(()=>{if(!1===m||!(null==eE?void 0:eE.total))return{};let e=()=>eE.size||("small"===V||"middle"===V?"small":void 0),t=t=>o.createElement(tK.Z,Object.assign({},eE,{align:eE.align||("left"===t?"start":"right"===t?"end":t),className:Z()("".concat(G,"-pagination"),eE.className),size:e()})),n="rtl"===A?"left":"right",r=eE.position;if(null===r||!Array.isArray(r))return{bottom:t(n)};let a=r.find(e=>"string"==typeof e&&e.toLowerCase().includes("top")),l=r.find(e=>"string"==typeof e&&e.toLowerCase().includes("bottom")),c=r.every(e=>"none"==="".concat(e)),i=a?a.toLowerCase().replace("top",""):"",d=l?l.toLowerCase().replace("bottom",""):"";return{top:i?t(i):void 0,bottom:d?t(d):a||l||c?void 0:t(n)}})();return Q(o.createElement("div",{ref:el,className:eR,style:eP},o.createElement(tO.Z,Object.assign({spinning:!1},eI),eL,o.createElement(T?oh:om,Object.assign({},eT,H,{ref:ec,columns:B,direction:A,expandable:en,prefixCls:G,className:Z()({["".concat(G,"-middle")]:"middle"===V,["".concat(G,"-small")]:"small"===V,["".concat(G,"-bordered")]:u,["".concat(G,"-empty")]:0===U.length},et,J,ee),data:eZ,rowKey:ei,rowClassName:(e,t,n)=>{let o;return o="function"==typeof g?Z()(g(e,t,n)):Z()(g),Z()({["".concat(G,"-row-selected")]:eK.has(ei(e,t))},o)},emptyText:eM,internalHooks:a,internalRefs:ea,transformColumns:eO,getContainerWidth:(e,t)=>{let n=e.querySelector(".".concat(G,"-container")),o=t;if(n){let e=getComputedStyle(n);o=t-Number.parseInt(e.borderLeftWidth,10)-Number.parseInt(e.borderRightWidth,10)}return o},measureRowRender:e=>o.createElement(tw.ZP,{getPopupContainer:e=>e},e)})),ej)))});let oL=o.forwardRef((e,t)=>{let n=o.useRef(0);return n.current+=1,o.createElement(oD,Object.assign({},e,{ref:t,_renderTimes:n.current}))});oL.SELECTION_COLUMN=tu,oL.EXPAND_COLUMN=r,oL.SELECTION_ALL=tf,oL.SELECTION_INVERT=tp,oL.SELECTION_NONE=tm,oL.Column=e=>null,oL.ColumnGroup=e=>null,oL.Summary=H;var oj=oL}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/7155-036c6fcc23f65f77.js b/litellm/proxy/_experimental/out/_next/static/chunks/7155-036c6fcc23f65f77.js new file mode 100644 index 0000000000..3192fe34a1 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/7155-036c6fcc23f65f77.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7155],{88913:function(e,s,l){l.d(s,{Dx:function(){return d.Z},Zb:function(){return a.Z},iz:function(){return r.Z},oi:function(){return n.Z},xv:function(){return i.Z},zx:function(){return t.Z}});var t=l(78489),a=l(12514),r=l(67982),i=l(84264),n=l(49566),d=l(96761)},58643:function(e,s,l){l.d(s,{OK:function(){return t.Z},nP:function(){return n.Z},td:function(){return r.Z},v0:function(){return a.Z},x4:function(){return i.Z}});var t=l(12485),a=l(18135),r=l(35242),i=l(29706),n=l(77991)},77155:function(e,s,l){l.d(s,{Z:function(){return ew}});var t=l(57437),a=l(58643),r=l(2265),i=l(16312),n=l(57840),d=l(42264),o=l(22116),c=l(61994),u=l(56609),m=l(23496),x=l(5945),h=l(58760),g=l(37592),v=l(19015),j=l(19250),p=l(10032),f=l(99981),y=l(24199),b=l(57365),_=l(49566),N=l(16853),w=l(46468),S=l(20347),Z=l(15424),k=l(65925);function C(e){let{userData:s,onCancel:l,onSubmit:a,teams:n,accessToken:d,userID:o,userRole:c,userModels:u,possibleUIRoles:m,isBulkEdit:x=!1}=e,[h]=p.Z.useForm();return r.useEffect(()=>{var e,l,t,a,r,i,n;h.setFieldsValue({user_id:s.user_id,user_email:null===(e=s.user_info)||void 0===e?void 0:e.user_email,user_alias:null===(l=s.user_info)||void 0===l?void 0:l.user_alias,user_role:null===(t=s.user_info)||void 0===t?void 0:t.user_role,models:(null===(a=s.user_info)||void 0===a?void 0:a.models)||[],max_budget:null===(r=s.user_info)||void 0===r?void 0:r.max_budget,budget_duration:null===(i=s.user_info)||void 0===i?void 0:i.budget_duration,metadata:(null===(n=s.user_info)||void 0===n?void 0:n.metadata)?JSON.stringify(s.user_info.metadata,null,2):void 0})},[s,h]),(0,t.jsxs)(p.Z,{form:h,onFinish:e=>{if(e.metadata&&"string"==typeof e.metadata)try{e.metadata=JSON.parse(e.metadata)}catch(e){console.error("Error parsing metadata JSON:",e);return}a(e)},layout:"vertical",children:[!x&&(0,t.jsx)(p.Z.Item,{label:"User ID",name:"user_id",children:(0,t.jsx)(_.Z,{disabled:!0})}),!x&&(0,t.jsx)(p.Z.Item,{label:"Email",name:"user_email",children:(0,t.jsx)(_.Z,{})}),(0,t.jsx)(p.Z.Item,{label:"User Alias",name:"user_alias",children:(0,t.jsx)(_.Z,{})}),(0,t.jsx)(p.Z.Item,{label:(0,t.jsxs)("span",{children:["Global Proxy Role"," ",(0,t.jsx)(f.Z,{title:"This is the role that the user will globally on the proxy. This role is independent of any team/org specific roles.",children:(0,t.jsx)(Z.Z,{})})]}),name:"user_role",children:(0,t.jsx)(g.default,{children:m&&Object.entries(m).map(e=>{let[s,{ui_label:l,description:a}]=e;return(0,t.jsx)(b.Z,{value:s,title:l,children:(0,t.jsxs)("div",{className:"flex",children:[l," ",(0,t.jsx)("p",{className:"ml-2",style:{color:"gray",fontSize:"12px"},children:a})]})},s)})})}),(0,t.jsx)(p.Z.Item,{label:(0,t.jsxs)("span",{children:["Personal Models"," ",(0,t.jsx)(f.Z,{title:"Select which models this user can access outside of team-scope. Choose 'All Proxy Models' to grant access to all models available on the proxy.",children:(0,t.jsx)(Z.Z,{style:{marginLeft:"4px"}})})]}),name:"models",children:(0,t.jsxs)(g.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},disabled:!S.ZL.includes(c||""),children:[(0,t.jsx)(g.default.Option,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"),(0,t.jsx)(g.default.Option,{value:"no-default-models",children:"No Default Models"},"no-default-models"),u.map(e=>(0,t.jsx)(g.default.Option,{value:e,children:(0,w.W0)(e)},e))]})}),(0,t.jsx)(p.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,t.jsx)(y.Z,{step:.01,precision:2,style:{width:"100%"}})}),(0,t.jsx)(p.Z.Item,{label:"Reset Budget",name:"budget_duration",children:(0,t.jsx)(k.Z,{})}),(0,t.jsx)(p.Z.Item,{label:"Metadata",name:"metadata",children:(0,t.jsx)(N.Z,{rows:4,placeholder:"Enter metadata as JSON"})}),(0,t.jsxs)("div",{className:"flex justify-end space-x-2",children:[(0,t.jsx)(i.z,{variant:"secondary",type:"button",onClick:l,children:"Cancel"}),(0,t.jsx)(i.z,{type:"submit",children:"Save Changes"})]})]})}var U=l(9114);let{Text:I,Title:D}=n.default;var z=e=>{let{visible:s,onCancel:l,selectedUsers:a,possibleUIRoles:i,accessToken:n,onSuccess:p,teams:f,userRole:y,userModels:b,allowAllUsers:_=!1}=e,[N,w]=(0,r.useState)(!1),[S,Z]=(0,r.useState)([]),[k,z]=(0,r.useState)(null),[A,B]=(0,r.useState)(!1),[L,E]=(0,r.useState)(!1),T=()=>{Z([]),z(null),B(!1),E(!1),l()},O=r.useMemo(()=>({user_id:"bulk_edit",user_info:{user_email:"",user_role:"",teams:[],models:[],max_budget:null,spend:0,metadata:{},created_at:null,updated_at:null},keys:[],teams:f||[]}),[f,s]),F=async e=>{if(console.log("formValues",e),!n){U.Z.fromBackend("Access token not found");return}w(!0);try{let s=a.map(e=>e.user_id),t={};e.user_role&&""!==e.user_role&&(t.user_role=e.user_role),null!==e.max_budget&&void 0!==e.max_budget&&(t.max_budget=e.max_budget),e.models&&e.models.length>0&&(t.models=e.models),e.budget_duration&&""!==e.budget_duration&&(t.budget_duration=e.budget_duration),e.metadata&&Object.keys(e.metadata).length>0&&(t.metadata=e.metadata);let r=Object.keys(t).length>0,i=A&&S.length>0;if(!r&&!i){U.Z.fromBackend("Please modify at least one field or select teams to add users to");return}let o=[];if(r){if(L){let e=await (0,j.userBulkUpdateUserCall)(n,t,void 0,!0);o.push("Updated all users (".concat(e.total_requested," total)"))}else await (0,j.userBulkUpdateUserCall)(n,t,s),o.push("Updated ".concat(s.length," user(s)"))}if(i){let e=[];for(let s of S)try{let l=null;L?l=null:a.map(e=>({user_id:e.user_id,role:"user",user_email:e.user_email||null}));let t=await (0,j.teamBulkMemberAddCall)(n,s,l||null,k||void 0,L);console.log("result",t),e.push({teamId:s,success:!0,successfulAdditions:t.successful_additions,failedAdditions:t.failed_additions})}catch(l){console.error("Failed to add users to team ".concat(s,":"),l),e.push({teamId:s,success:!1,error:l})}let s=e.filter(e=>e.success),l=e.filter(e=>!e.success);if(s.length>0){let e=s.reduce((e,s)=>e+s.successfulAdditions,0);o.push("Added users to ".concat(s.length," team(s) (").concat(e," total additions)"))}l.length>0&&d.ZP.warning("Failed to add users to ".concat(l.length," team(s)"))}o.length>0&&U.Z.success(o.join(". ")),Z([]),z(null),B(!1),E(!1),p(),l()}catch(e){console.error("Bulk operation failed:",e),U.Z.fromBackend("Failed to perform bulk operations")}finally{w(!1)}};return(0,t.jsxs)(o.Z,{visible:s,onCancel:T,footer:null,title:L?"Bulk Edit All Users":"Bulk Edit ".concat(a.length," User(s)"),width:800,children:[_&&(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)(c.Z,{checked:L,onChange:e=>E(e.target.checked),children:(0,t.jsx)(I,{strong:!0,children:"Update ALL users in the system"})}),L&&(0,t.jsx)("div",{style:{marginTop:8},children:(0,t.jsx)(I,{type:"warning",style:{fontSize:"12px"},children:"⚠️ This will apply changes to ALL users in the system, not just the selected ones."})})]}),!L&&(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsxs)(D,{level:5,children:["Selected Users (",a.length,"):"]}),(0,t.jsx)(u.Z,{size:"small",bordered:!0,dataSource:a,pagination:!1,scroll:{y:200},rowKey:"user_id",columns:[{title:"User ID",dataIndex:"user_id",key:"user_id",width:"30%",render:e=>(0,t.jsx)(I,{strong:!0,style:{fontSize:"12px"},children:e.length>20?"".concat(e.slice(0,20),"..."):e})},{title:"Email",dataIndex:"user_email",key:"user_email",width:"25%",render:e=>(0,t.jsx)(I,{type:"secondary",style:{fontSize:"12px"},children:e||"No email"})},{title:"Current Role",dataIndex:"user_role",key:"user_role",width:"25%",render:e=>{var s;return(0,t.jsx)(I,{style:{fontSize:"12px"},children:(null==i?void 0:null===(s=i[e])||void 0===s?void 0:s.ui_label)||e})}},{title:"Budget",dataIndex:"max_budget",key:"max_budget",width:"20%",render:e=>(0,t.jsx)(I,{style:{fontSize:"12px"},children:null!==e?"$".concat(e):"Unlimited"})}]})]}),(0,t.jsx)(m.Z,{}),(0,t.jsx)("div",{className:"mb-4",children:(0,t.jsxs)(I,{children:[(0,t.jsx)("strong",{children:"Instructions:"})," Fill in the fields below with the values you want to apply to all selected users. You can bulk edit: role, budget, models, and metadata. You can also add users to teams."]})}),(0,t.jsx)(x.Z,{title:"Team Management",size:"small",className:"mb-4",style:{backgroundColor:"#fafafa"},children:(0,t.jsxs)(h.Z,{direction:"vertical",style:{width:"100%"},children:[(0,t.jsx)(c.Z,{checked:A,onChange:e=>B(e.target.checked),children:"Add selected users to teams"}),A&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(I,{strong:!0,children:"Select Teams:"}),(0,t.jsx)(g.default,{mode:"multiple",placeholder:"Select teams to add users to",value:S,onChange:Z,style:{width:"100%",marginTop:8},options:(null==f?void 0:f.map(e=>({label:e.team_alias||e.team_id,value:e.team_id})))||[]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(I,{strong:!0,children:"Team Budget (Optional):"}),(0,t.jsx)(v.Z,{placeholder:"Max budget per user in team",value:k,onChange:e=>z(e),style:{width:"100%",marginTop:8},min:0,step:.01,precision:2}),(0,t.jsx)(I,{type:"secondary",style:{fontSize:"12px"},children:"Leave empty for unlimited budget within team limits"})]}),(0,t.jsx)(I,{type:"secondary",style:{fontSize:"12px"},children:'Users will be added with "user" role by default. All users will be added to each selected team.'})]})]})}),(0,t.jsx)(C,{userData:O,onCancel:T,onSubmit:F,teams:f,accessToken:n,userID:"bulk_edit",userRole:y,userModels:b,possibleUIRoles:i,isBulkEdit:!0}),N&&(0,t.jsx)("div",{style:{textAlign:"center",marginTop:"10px"},children:(0,t.jsxs)(I,{children:["Updating ",L?"all users":a.length," user(s)..."]})})]})},A=l(7765),B=l(5545),L=e=>{let{visible:s,possibleUIRoles:l,onCancel:a,user:i,onSubmit:n}=e,[d,c]=(0,r.useState)(i),[u]=p.Z.useForm();(0,r.useEffect)(()=>{u.resetFields()},[i]);let m=async()=>{u.resetFields(),a()},x=async e=>{n(e),u.resetFields(),a()};return i?(0,t.jsx)(o.Z,{visible:s,onCancel:m,footer:null,title:"Edit User "+i.user_id,width:1e3,children:(0,t.jsx)(p.Z,{form:u,onFinish:x,initialValues:i,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(p.Z.Item,{className:"mt-8",label:"User Email",tooltip:"Email of the User",name:"user_email",children:(0,t.jsx)(_.Z,{})}),(0,t.jsx)(p.Z.Item,{label:"user_id",name:"user_id",hidden:!0,children:(0,t.jsx)(_.Z,{})}),(0,t.jsx)(p.Z.Item,{label:"User Role",name:"user_role",children:(0,t.jsx)(g.default,{children:l&&Object.entries(l).map(e=>{let[s,{ui_label:l,description:a}]=e;return(0,t.jsx)(b.Z,{value:s,title:l,children:(0,t.jsxs)("div",{className:"flex",children:[l," ",(0,t.jsx)("p",{className:"ml-2",style:{color:"gray",fontSize:"12px"},children:a})]})},s)})})}),(0,t.jsx)(p.Z.Item,{label:"Spend (USD)",name:"spend",tooltip:"(float) - Spend of all LLM calls completed by this user",help:"Across all keys (including keys with team_id).",children:(0,t.jsx)(v.Z,{min:0,step:.01})}),(0,t.jsx)(p.Z.Item,{label:"User Budget (USD)",name:"max_budget",tooltip:"(float) - Maximum budget of this user",help:"Maximum budget of this user.",children:(0,t.jsx)(y.Z,{min:0,step:.01})}),(0,t.jsx)(p.Z.Item,{label:"Reset Budget",name:"budget_duration",children:(0,t.jsx)(k.Z,{})}),(0,t.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,t.jsx)(B.ZP,{htmlType:"submit",children:"Save"})}),(0,t.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,t.jsx)(B.ZP,{htmlType:"submit",children:"Save"})})]})})}):null},E=l(98187),T=l(59872),O=l(19616),F=l(29827),M=l(11713),R=l(21609),P=l(88913),K=l(63709),V=l(10353),q=l(26349),G=l(96473),J=e=>{var s;let{accessToken:l,possibleUIRoles:a,userID:i,userRole:d}=e,[o,c]=(0,r.useState)(!0),[u,m]=(0,r.useState)(null),[x,h]=(0,r.useState)(!1),[p,f]=(0,r.useState)({}),[y,b]=(0,r.useState)(!1),[_,N]=(0,r.useState)([]),{Paragraph:S}=n.default,{Option:Z}=g.default;(0,r.useEffect)(()=>{(async()=>{if(!l){c(!1);return}try{let e=await (0,j.getInternalUserSettings)(l);if(m(e),f(e.values||{}),l)try{let e=await (0,j.modelAvailableCall)(l,i,d);if(e&&e.data){let s=e.data.map(e=>e.id);N(s)}}catch(e){console.error("Error fetching available models:",e)}}catch(e){console.error("Error fetching SSO settings:",e),U.Z.fromBackend("Failed to fetch SSO settings")}finally{c(!1)}})()},[l]);let C=async()=>{if(l){b(!0);try{let e=Object.entries(p).reduce((e,s)=>{let[l,t]=s;return e[l]=""===t?null:t,e},{}),s=await (0,j.updateInternalUserSettings)(l,e);m({...u,values:s.settings}),h(!1)}catch(e){console.error("Error updating SSO settings:",e),U.Z.fromBackend("Failed to update settings: "+e)}finally{b(!1)}}},I=(e,s)=>{f(l=>({...l,[e]:s}))},D=e=>e&&Array.isArray(e)?e.map(e=>"string"==typeof e?{team_id:e,user_role:"user"}:"object"==typeof e&&e.team_id?{team_id:e.team_id,max_budget_in_team:e.max_budget_in_team,user_role:e.user_role||"user"}:{team_id:"",user_role:"user"}):[],z=e=>{let s=D(e),l=(e,l,t)=>{let a=[...s];a[e]={...a[e],[l]:t},I("teams",a)},a=e=>{I("teams",s.filter((s,l)=>l!==e))};return(0,t.jsxs)("div",{className:"space-y-3",children:[s.map((e,s)=>(0,t.jsxs)("div",{className:"border rounded-lg p-4 bg-gray-50",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,t.jsxs)(P.xv,{className:"font-medium",children:["Team ",s+1]}),(0,t.jsx)(P.zx,{size:"sm",variant:"secondary",icon:q.Z,onClick:()=>a(s),className:"text-red-500 hover:text-red-700",children:"Remove"})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(P.xv,{className:"text-sm font-medium mb-1",children:"Team ID"}),(0,t.jsx)(P.oi,{value:e.team_id,onChange:e=>l(s,"team_id",e.target.value),placeholder:"Enter team ID"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(P.xv,{className:"text-sm font-medium mb-1",children:"Max Budget in Team"}),(0,t.jsx)(v.Z,{style:{width:"100%"},value:e.max_budget_in_team,onChange:e=>l(s,"max_budget_in_team",e),placeholder:"Optional",min:0,step:.01,precision:2})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(P.xv,{className:"text-sm font-medium mb-1",children:"User Role"}),(0,t.jsxs)(g.default,{style:{width:"100%"},value:e.user_role,onChange:e=>l(s,"user_role",e),children:[(0,t.jsx)(Z,{value:"user",children:"User"}),(0,t.jsx)(Z,{value:"admin",children:"Admin"})]})]})]})]},s)),(0,t.jsx)(P.zx,{variant:"secondary",icon:G.Z,onClick:()=>{I("teams",[...s,{team_id:"",user_role:"user"}])},className:"w-full",children:"Add Team"})]})},A=(e,s,l)=>{var r;let i=s.type;if("teams"===e)return(0,t.jsx)("div",{className:"mt-2",children:z(p[e]||[])});if("user_role"===e&&a)return(0,t.jsx)(g.default,{style:{width:"100%"},value:p[e]||"",onChange:s=>I(e,s),className:"mt-2",children:Object.entries(a).filter(e=>{let[s]=e;return s.includes("internal_user")}).map(e=>{let[s,{ui_label:l,description:a}]=e;return(0,t.jsx)(Z,{value:s,children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("span",{children:l}),(0,t.jsx)("span",{className:"ml-2 text-xs text-gray-500",children:a})]})},s)})});if("budget_duration"===e)return(0,t.jsx)(k.Z,{value:p[e]||null,onChange:s=>I(e,s),className:"mt-2"});if("boolean"===i)return(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)(K.Z,{checked:!!p[e],onChange:s=>I(e,s)})});if("array"===i&&(null===(r=s.items)||void 0===r?void 0:r.enum))return(0,t.jsx)(g.default,{mode:"multiple",style:{width:"100%"},value:p[e]||[],onChange:s=>I(e,s),className:"mt-2",children:s.items.enum.map(e=>(0,t.jsx)(Z,{value:e,children:e},e))});if("models"===e)return(0,t.jsxs)(g.default,{mode:"multiple",style:{width:"100%"},value:p[e]||[],onChange:s=>I(e,s),className:"mt-2",children:[(0,t.jsx)(Z,{value:"no-default-models",children:"No Default Models"},"no-default-models"),_.map(e=>(0,t.jsx)(Z,{value:e,children:(0,w.W0)(e)},e))]});if("string"===i&&s.enum)return(0,t.jsx)(g.default,{style:{width:"100%"},value:p[e]||"",onChange:s=>I(e,s),className:"mt-2",children:s.enum.map(e=>(0,t.jsx)(Z,{value:e,children:e},e))});else return(0,t.jsx)(P.oi,{value:void 0!==p[e]?String(p[e]):"",onChange:s=>I(e,s.target.value),placeholder:s.description||"",className:"mt-2"})},B=(e,s)=>{if(null==s)return(0,t.jsx)("span",{className:"text-gray-400",children:"Not set"});if("teams"===e&&Array.isArray(s)){if(0===s.length)return(0,t.jsx)("span",{className:"text-gray-400",children:"No teams assigned"});let e=D(s);return(0,t.jsx)("div",{className:"space-y-2 mt-1",children:e.map((e,s)=>(0,t.jsx)("div",{className:"border rounded-lg p-3 bg-white",children:(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-2 text-sm",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-medium text-gray-600",children:"Team ID:"}),(0,t.jsx)("p",{className:"text-gray-900",children:e.team_id||"Not specified"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-medium text-gray-600",children:"Max Budget:"}),(0,t.jsx)("p",{className:"text-gray-900",children:void 0!==e.max_budget_in_team?"$".concat((0,T.pw)(e.max_budget_in_team,4)):"No limit"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-medium text-gray-600",children:"Role:"}),(0,t.jsx)("p",{className:"text-gray-900 capitalize",children:e.user_role})]})]})},s))})}if("user_role"===e&&a&&a[s]){let{ui_label:e,description:l}=a[s];return(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-medium",children:e}),l&&(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:l})]})}return"budget_duration"===e?(0,t.jsx)("span",{children:(0,k.m)(s)}):"boolean"==typeof s?(0,t.jsx)("span",{children:s?"Enabled":"Disabled"}):"models"===e&&Array.isArray(s)?0===s.length?(0,t.jsx)("span",{className:"text-gray-400",children:"None"}):(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:s.map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",children:(0,w.W0)(e)},s))}):"object"==typeof s?Array.isArray(s)?0===s.length?(0,t.jsx)("span",{className:"text-gray-400",children:"None"}):(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:s.map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",children:"object"==typeof e?JSON.stringify(e):String(e)},s))}):(0,t.jsx)("pre",{className:"bg-gray-100 p-2 rounded text-xs overflow-auto mt-1",children:JSON.stringify(s,null,2)}):(0,t.jsx)("span",{children:String(s)})};return o?(0,t.jsx)("div",{className:"flex justify-center items-center h-64",children:(0,t.jsx)(V.Z,{size:"large"})}):u?(0,t.jsxs)(P.Zb,{children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsx)(P.Dx,{children:"Default User Settings"}),!o&&u&&(x?(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(P.zx,{variant:"secondary",onClick:()=>{h(!1),f(u.values||{})},disabled:y,children:"Cancel"}),(0,t.jsx)(P.zx,{onClick:C,loading:y,children:"Save Changes"})]}):(0,t.jsx)(P.zx,{onClick:()=>h(!0),children:"Edit Settings"}))]}),(null==u?void 0:null===(s=u.field_schema)||void 0===s?void 0:s.description)&&(0,t.jsx)(S,{className:"mb-4",children:u.field_schema.description}),(0,t.jsx)(P.iz,{}),(0,t.jsx)("div",{className:"mt-4 space-y-4",children:(()=>{let{values:e,field_schema:s}=u;return s&&s.properties?Object.entries(s.properties).map(s=>{let[l,a]=s,r=e[l],i=l.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase());return(0,t.jsxs)("div",{className:"mb-6 pb-6 border-b border-gray-200 last:border-0",children:[(0,t.jsx)(P.xv,{className:"font-medium text-lg",children:i}),(0,t.jsx)(S,{className:"text-sm text-gray-500 mt-1",children:a.description||"No description available"}),x?(0,t.jsx)("div",{className:"mt-2",children:A(l,a,r)}):(0,t.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:B(l,r)})]},l)}):(0,t.jsx)(P.xv,{children:"No schema information available"})})()})]}):(0,t.jsx)(P.Zb,{children:(0,t.jsx)(P.xv,{children:"No settings available or you do not have permission to view them."})})},W=l(41649),Q=l(67101),$=l(47323),H=l(15731),Y=l(53410),X=l(74998),ee=l(23628);let es=(e,s,l,a,r,i)=>{let n=[{header:"User ID",accessorKey:"user_id",enableSorting:!0,cell:e=>{let{row:s}=e;return(0,t.jsx)(f.Z,{title:s.original.user_id,children:(0,t.jsx)("span",{className:"text-xs",children:s.original.user_id?"".concat(s.original.user_id.slice(0,7),"..."):"-"})})}},{header:"Email",accessorKey:"user_email",enableSorting:!0,cell:e=>{let{row:s}=e;return(0,t.jsx)("span",{className:"text-xs",children:s.original.user_email||"-"})}},{header:"Global Proxy Role",accessorKey:"user_role",enableSorting:!0,cell:s=>{var l;let{row:a}=s;return(0,t.jsx)("span",{className:"text-xs",children:(null==e?void 0:null===(l=e[a.original.user_role])||void 0===l?void 0:l.ui_label)||"-"})}},{header:"User Alias",accessorKey:"user_alias",enableSorting:!1,cell:e=>{let{row:s}=e;return(0,t.jsx)("span",{className:"text-xs",children:s.original.user_alias||"-"})}},{header:"Spend (USD)",accessorKey:"spend",enableSorting:!0,cell:e=>{let{row:s}=e;return(0,t.jsx)("span",{className:"text-xs",children:s.original.spend?(0,T.pw)(s.original.spend,4):"-"})}},{header:"Budget (USD)",accessorKey:"max_budget",enableSorting:!1,cell:e=>{let{row:s}=e;return(0,t.jsx)("span",{className:"text-xs",children:null!==s.original.max_budget?s.original.max_budget:"Unlimited"})}},{header:()=>(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{children:"SSO ID"}),(0,t.jsx)(f.Z,{title:"SSO ID is the ID of the user in the SSO provider. If the user is not using SSO, this will be null.",children:(0,t.jsx)(H.Z,{className:"w-4 h-4"})})]}),accessorKey:"sso_user_id",enableSorting:!1,cell:e=>{let{row:s}=e;return(0,t.jsx)("span",{className:"text-xs",children:null!==s.original.sso_user_id?s.original.sso_user_id:"-"})}},{header:"Virtual Keys",accessorKey:"key_count",enableSorting:!1,cell:e=>{let{row:s}=e;return(0,t.jsx)(Q.Z,{numItems:2,children:s.original.key_count>0?(0,t.jsxs)(W.Z,{size:"xs",color:"indigo",children:[s.original.key_count," ",1===s.original.key_count?"Key":"Keys"]}):(0,t.jsx)(W.Z,{size:"xs",color:"gray",children:"No Keys"})})}},{header:"Created At",accessorKey:"created_at",enableSorting:!0,cell:e=>{let{row:s}=e;return(0,t.jsx)("span",{className:"text-xs",children:s.original.created_at?new Date(s.original.created_at).toLocaleDateString():"-"})}},{header:"Updated At",accessorKey:"updated_at",enableSorting:!1,cell:e=>{let{row:s}=e;return(0,t.jsx)("span",{className:"text-xs",children:s.original.updated_at?new Date(s.original.updated_at).toLocaleDateString():"-"})}},{id:"actions",header:"Actions",enableSorting:!1,cell:e=>{let{row:s}=e;return(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(f.Z,{title:"Edit user details",children:(0,t.jsx)($.Z,{icon:Y.Z,size:"sm",onClick:()=>r(s.original.user_id,!0),className:"cursor-pointer hover:text-blue-600"})}),(0,t.jsx)(f.Z,{title:"Delete user",children:(0,t.jsx)($.Z,{icon:X.Z,size:"sm",onClick:()=>l(s.original),className:"cursor-pointer hover:text-red-600"})}),(0,t.jsx)(f.Z,{title:"Reset Password",children:(0,t.jsx)($.Z,{icon:ee.Z,size:"sm",onClick:()=>a(s.original.user_id),className:"cursor-pointer hover:text-green-600"})})]})}}];if(i){let{onSelectUser:e,onSelectAll:s,isUserSelected:l,isAllSelected:a,isIndeterminate:r}=i;return[{id:"select",enableSorting:!1,header:()=>(0,t.jsx)(c.Z,{indeterminate:r,checked:a,onChange:e=>s(e.target.checked),onClick:e=>e.stopPropagation()}),cell:s=>{let{row:a}=s;return(0,t.jsx)(c.Z,{checked:l(a.original),onChange:s=>e(a.original,s.target.checked),onClick:e=>e.stopPropagation()})}},...n]}return n};var el=l(71594),et=l(24525),ea=l(27281),er=l(21626),ei=l(97214),en=l(28241),ed=l(58834),eo=l(69552),ec=l(71876),eu=l(44633),em=l(86462),ex=l(49084),eh=l(50337),eg=l(84717),ev=l(10900),ej=l(30401),ep=l(78867);function ef(e){var s,l,a,i,n,d,o,c,u,m,x,h,g,v,p,f,y,b,_,N,w,Z,I,D,z,A,L,O,F,M,R,P,K,V,q,G,J,W,Q;let{userId:$,onClose:H,accessToken:Y,userRole:es,onDelete:el,possibleUIRoles:et,initialTab:ea=0,startInEditMode:er=!1}=e,[ei,en]=(0,r.useState)(null),[ed,eo]=(0,r.useState)(!1),[ec,eu]=(0,r.useState)(!0),[em,ex]=(0,r.useState)(er),[eh,ef]=(0,r.useState)([]),[ey,eb]=(0,r.useState)(!1),[e_,eN]=(0,r.useState)(null),[ew,eS]=(0,r.useState)(null),[eZ,ek]=(0,r.useState)(ea),[eC,eU]=(0,r.useState)({}),[eI,eD]=(0,r.useState)(!1);r.useEffect(()=>{eS((0,j.getProxyBaseUrl)())},[]),r.useEffect(()=>{console.log("userId: ".concat($,", userRole: ").concat(es,", accessToken: ").concat(Y)),(async()=>{try{if(!Y)return;let e=await (0,j.userInfoCall)(Y,$,es||"",!1,null,null,!0);en(e);let s=(await (0,j.modelAvailableCall)(Y,$,es||"")).data.map(e=>e.id);ef(s)}catch(e){console.error("Error fetching user data:",e),U.Z.fromBackend("Failed to fetch user data")}finally{eu(!1)}})()},[Y,$,es]);let ez=async()=>{if(!Y){U.Z.fromBackend("Access token not found");return}try{U.Z.success("Generating password reset link...");let e=await (0,j.invitationCreateCall)(Y,$);eN(e),eb(!0)}catch(e){U.Z.fromBackend("Failed to generate password reset link")}},eA=async()=>{try{if(!Y)return;await (0,j.userDeleteCall)(Y,[$]),U.Z.success("User deleted successfully"),el&&el(),H()}catch(e){console.error("Error deleting user:",e),U.Z.fromBackend("Failed to delete user")}},eB=async e=>{try{if(!Y||!ei)return;await (0,j.userUpdateUserCall)(Y,e,null),en({...ei,user_info:{...ei.user_info,user_email:e.user_email,user_alias:e.user_alias,models:e.models,max_budget:e.max_budget,budget_duration:e.budget_duration,metadata:e.metadata}}),U.Z.success("User updated successfully"),ex(!1)}catch(e){console.error("Error updating user:",e),U.Z.fromBackend("Failed to update user")}};if(ec)return(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsx)(eg.zx,{icon:ev.Z,variant:"light",onClick:H,className:"mb-4",children:"Back to Users"}),(0,t.jsx)(eg.xv,{children:"Loading user data..."})]});if(!ei)return(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsx)(eg.zx,{icon:ev.Z,variant:"light",onClick:H,className:"mb-4",children:"Back to Users"}),(0,t.jsx)(eg.xv,{children:"User not found"})]});let eL=async(e,s)=>{await (0,T.vQ)(e)&&(eU(e=>({...e,[s]:!0})),setTimeout(()=>{eU(e=>({...e,[s]:!1}))},2e3))};return(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.zx,{icon:ev.Z,variant:"light",onClick:H,className:"mb-4",children:"Back to Users"}),(0,t.jsx)(eg.Dx,{children:(null===(s=ei.user_info)||void 0===s?void 0:s.user_email)||"User"}),(0,t.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)(eg.xv,{className:"text-gray-500 font-mono",children:ei.user_id}),(0,t.jsx)(B.ZP,{type:"text",size:"small",icon:eC["user-id"]?(0,t.jsx)(ej.Z,{size:12}):(0,t.jsx)(ep.Z,{size:12}),onClick:()=>eL(ei.user_id,"user-id"),className:"left-2 z-10 transition-all duration-200 ".concat(eC["user-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]}),es&&S.LQ.includes(es)&&(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(eg.zx,{icon:ee.Z,variant:"secondary",onClick:ez,className:"flex items-center",children:"Reset Password"}),(0,t.jsx)(eg.zx,{icon:X.Z,variant:"secondary",onClick:()=>eo(!0),className:"flex items-center",children:"Delete User"})]})]}),ed&&(0,t.jsx)("div",{className:"fixed z-10 inset-0 overflow-y-auto",children:(0,t.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,t.jsx)("div",{className:"fixed inset-0 transition-opacity","aria-hidden":"true",children:(0,t.jsx)("div",{className:"absolute inset-0 bg-gray-500 opacity-75"})}),(0,t.jsx)("span",{className:"hidden sm:inline-block sm:align-middle sm:h-screen","aria-hidden":"true",children:"​"}),(0,t.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,t.jsx)("div",{className:"bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4",children:(0,t.jsx)("div",{className:"sm:flex sm:items-start",children:(0,t.jsxs)("div",{className:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left",children:[(0,t.jsx)("h3",{className:"text-lg leading-6 font-medium text-gray-900",children:"Delete User"}),(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)("p",{className:"text-sm text-gray-500",children:"Are you sure you want to delete this user?"})})]})})}),(0,t.jsxs)("div",{className:"bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse",children:[(0,t.jsx)(eg.zx,{onClick:eA,color:"red",className:"ml-2",children:"Delete"}),(0,t.jsx)(eg.zx,{onClick:()=>eo(!1),children:"Cancel"})]})]})]})}),(0,t.jsxs)(eg.v0,{defaultIndex:eZ,onIndexChange:ek,children:[(0,t.jsxs)(eg.td,{className:"mb-4",children:[(0,t.jsx)(eg.OK,{children:"Overview"}),(0,t.jsx)(eg.OK,{children:"Details"})]}),(0,t.jsxs)(eg.nP,{children:[(0,t.jsx)(eg.x4,{children:(0,t.jsxs)(eg.rj,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,t.jsxs)(eg.Zb,{children:[(0,t.jsx)(eg.xv,{children:"Spend"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(eg.Dx,{children:["$",(0,T.pw)((null===(l=ei.user_info)||void 0===l?void 0:l.spend)||0,4)]}),(0,t.jsxs)(eg.xv,{children:["of"," ",(null===(a=ei.user_info)||void 0===a?void 0:a.max_budget)!==null?"$".concat((0,T.pw)(ei.user_info.max_budget,4)):"Unlimited"]})]})]}),(0,t.jsxs)(eg.Zb,{children:[(0,t.jsx)(eg.xv,{children:"Teams"}),(0,t.jsx)("div",{className:"mt-2",children:(null===(i=ei.teams)||void 0===i?void 0:i.length)&&(null===(n=ei.teams)||void 0===n?void 0:n.length)>0?(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[null===(d=ei.teams)||void 0===d?void 0:d.slice(0,eI?ei.teams.length:20).map((e,s)=>(0,t.jsx)(eg.Ct,{color:"blue",title:e.team_alias,children:e.team_alias},s)),!eI&&(null===(o=ei.teams)||void 0===o?void 0:o.length)>20&&(0,t.jsxs)(eg.Ct,{color:"gray",className:"cursor-pointer hover:bg-gray-200 transition-colors",onClick:()=>eD(!0),children:["+",ei.teams.length-20," more"]}),eI&&(null===(c=ei.teams)||void 0===c?void 0:c.length)>20&&(0,t.jsx)(eg.Ct,{color:"gray",className:"cursor-pointer hover:bg-gray-200 transition-colors",onClick:()=>eD(!1),children:"Show Less"})]}):(0,t.jsx)(eg.xv,{children:"No teams"})})]}),(0,t.jsxs)(eg.Zb,{children:[(0,t.jsx)(eg.xv,{children:"Virtual Keys"}),(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsxs)(eg.xv,{children:[(null===(u=ei.keys)||void 0===u?void 0:u.length)||0," ",(null===(m=ei.keys)||void 0===m?void 0:m.length)===1?"Key":"Keys"]})})]}),(0,t.jsxs)(eg.Zb,{children:[(0,t.jsx)(eg.xv,{children:"Personal Models"}),(0,t.jsx)("div",{className:"mt-2",children:(null===(h=ei.user_info)||void 0===h?void 0:null===(x=h.models)||void 0===x?void 0:x.length)&&(null===(v=ei.user_info)||void 0===v?void 0:null===(g=v.models)||void 0===g?void 0:g.length)>0?null===(f=ei.user_info)||void 0===f?void 0:null===(p=f.models)||void 0===p?void 0:p.map((e,s)=>(0,t.jsx)(eg.xv,{children:e},s)):(0,t.jsx)(eg.xv,{children:"All proxy models"})})]})]})}),(0,t.jsx)(eg.x4,{children:(0,t.jsxs)(eg.Zb,{children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsx)(eg.Dx,{children:"User Settings"}),!em&&es&&S.LQ.includes(es)&&(0,t.jsx)(eg.zx,{onClick:()=>ex(!0),children:"Edit Settings"})]}),em&&ei?(0,t.jsx)(C,{userData:ei,onCancel:()=>ex(!1),onSubmit:eB,teams:ei.teams,accessToken:Y,userID:$,userRole:es,userModels:eh,possibleUIRoles:et}):(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"User ID"}),(0,t.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)(eg.xv,{className:"font-mono",children:ei.user_id}),(0,t.jsx)(B.ZP,{type:"text",size:"small",icon:eC["user-id"]?(0,t.jsx)(ej.Z,{size:12}):(0,t.jsx)(ep.Z,{size:12}),onClick:()=>eL(ei.user_id,"user-id"),className:"left-2 z-10 transition-all duration-200 ".concat(eC["user-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"Email"}),(0,t.jsx)(eg.xv,{children:(null===(y=ei.user_info)||void 0===y?void 0:y.user_email)||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"User Alias"}),(0,t.jsx)(eg.xv,{children:(null===(b=ei.user_info)||void 0===b?void 0:b.user_alias)||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"Global Proxy Role"}),(0,t.jsx)(eg.xv,{children:(null===(_=ei.user_info)||void 0===_?void 0:_.user_role)||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"Created"}),(0,t.jsx)(eg.xv,{children:(null===(N=ei.user_info)||void 0===N?void 0:N.created_at)?new Date(ei.user_info.created_at).toLocaleString():"Unknown"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"Last Updated"}),(0,t.jsx)(eg.xv,{children:(null===(w=ei.user_info)||void 0===w?void 0:w.updated_at)?new Date(ei.user_info.updated_at).toLocaleString():"Unknown"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"Teams"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:(null===(Z=ei.teams)||void 0===Z?void 0:Z.length)&&(null===(I=ei.teams)||void 0===I?void 0:I.length)>0?(0,t.jsxs)(t.Fragment,{children:[null===(D=ei.teams)||void 0===D?void 0:D.slice(0,eI?ei.teams.length:20).map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",title:e.team_alias||e.team_id,children:e.team_alias||e.team_id},s)),!eI&&(null===(z=ei.teams)||void 0===z?void 0:z.length)>20&&(0,t.jsxs)("span",{className:"px-2 py-1 bg-gray-100 rounded text-xs cursor-pointer hover:bg-gray-200 transition-colors",onClick:()=>eD(!0),children:["+",ei.teams.length-20," more"]}),eI&&(null===(A=ei.teams)||void 0===A?void 0:A.length)>20&&(0,t.jsx)("span",{className:"px-2 py-1 bg-gray-100 rounded text-xs cursor-pointer hover:bg-gray-200 transition-colors",onClick:()=>eD(!1),children:"Show Less"})]}):(0,t.jsx)(eg.xv,{children:"No teams"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"Personal Models"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:(null===(O=ei.user_info)||void 0===O?void 0:null===(L=O.models)||void 0===L?void 0:L.length)&&(null===(M=ei.user_info)||void 0===M?void 0:null===(F=M.models)||void 0===F?void 0:F.length)>0?null===(P=ei.user_info)||void 0===P?void 0:null===(R=P.models)||void 0===R?void 0:R.map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",children:e},s)):(0,t.jsx)(eg.xv,{children:"All proxy models"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"Virtual Keys"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:(null===(K=ei.keys)||void 0===K?void 0:K.length)&&(null===(V=ei.keys)||void 0===V?void 0:V.length)>0?ei.keys.map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-green-100 rounded text-xs",children:e.key_alias||e.token},s)):(0,t.jsx)(eg.xv,{children:"No Virtual Keys"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"Max Budget"}),(0,t.jsx)(eg.xv,{children:(null===(q=ei.user_info)||void 0===q?void 0:q.max_budget)!==null&&(null===(G=ei.user_info)||void 0===G?void 0:G.max_budget)!==void 0?"$".concat((0,T.pw)(ei.user_info.max_budget,4)):"Unlimited"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"Budget Reset"}),(0,t.jsx)(eg.xv,{children:(0,k.m)(null!==(Q=null===(J=ei.user_info)||void 0===J?void 0:J.budget_duration)&&void 0!==Q?Q:null)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"Metadata"}),(0,t.jsx)("pre",{className:"bg-gray-100 p-2 rounded text-xs overflow-auto mt-1",children:JSON.stringify((null===(W=ei.user_info)||void 0===W?void 0:W.metadata)||{},null,2)})]})]})]})})]})]}),(0,t.jsx)(E.Z,{isInvitationLinkModalVisible:ey,setIsInvitationLinkModalVisible:eb,baseUrl:ew||"",invitationLinkData:e_,modalType:"resetPassword"})]})}function ey(e){let{data:s=[],columns:l,isLoading:a=!1,onSortChange:i,currentSort:n,accessToken:d,userRole:o,possibleUIRoles:c,handleEdit:u,handleDelete:m,handleResetPassword:x,selectedUsers:h=[],onSelectionChange:g,enableSelection:v=!1,filters:j,updateFilters:p,initialFilters:f,teams:y,userListResponse:_,currentPage:N,handlePageChange:w}=e,[S,Z]=r.useState([{id:(null==n?void 0:n.sortBy)||"created_at",desc:(null==n?void 0:n.sortOrder)==="desc"}]),[k,C]=r.useState(null),[U,I]=r.useState(!1),[D,z]=r.useState(!1),A=function(e){let s=arguments.length>1&&void 0!==arguments[1]&&arguments[1];C(e),I(s)},B=(e,s)=>{g&&(s?g([...h,e]):g(h.filter(s=>s.user_id!==e.user_id)))},L=e=>{g&&(e?g(s):g([]))},E=e=>h.some(s=>s.user_id===e.user_id),T=s.length>0&&h.length===s.length,O=h.length>0&&h.lengthc?es(c,u,m,x,A,v?{selectedUsers:h,onSelectUser:B,onSelectAll:L,isUserSelected:E,isAllSelected:T,isIndeterminate:O}:void 0):l,[c,u,m,x,A,l,v,h,T,O]),M=(0,el.b7)({data:s,columns:F,state:{sorting:S},onSortingChange:e=>{let s="function"==typeof e?e(S):e;if(Z(s),s&&Array.isArray(s)&&s.length>0&&s[0]){let e=s[0];if(e.id){let s=e.id,l=e.desc?"desc":"asc";null==i||i(s,l)}}else null==i||i("created_at","desc")},getCoreRowModel:(0,et.sC)(),manualSorting:!0,enableSorting:!0});return(r.useEffect(()=>{n&&Z([{id:n.sortBy,desc:"desc"===n.sortOrder}])},[n]),k)?(0,t.jsx)(ef,{userId:k,onClose:()=>{C(null),I(!1)},accessToken:d,userRole:o,possibleUIRoles:c,initialTab:U?1:0,startInEditMode:U}):(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,t.jsx)("div",{className:"border-b px-6 py-4",children:(0,t.jsxs)("div",{className:"flex flex-col space-y-4",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,t.jsxs)("div",{className:"relative w-64",children:[(0,t.jsx)("input",{type:"text",placeholder:"Search by email...",className:"w-full px-3 py-2 pl-8 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",value:j.email,onChange:e=>p({email:e.target.value})}),(0,t.jsx)("svg",{className:"absolute left-2.5 top-2.5 h-4 w-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})]}),(0,t.jsxs)("button",{className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2 ".concat(D?"bg-gray-100":""),onClick:()=>z(!D),children:[(0,t.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z"})}),"Filters",(j.user_id||j.user_role||j.team)&&(0,t.jsx)("span",{className:"w-2 h-2 rounded-full bg-blue-500"})]}),(0,t.jsxs)("button",{className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2",onClick:()=>{p(f)},children:[(0,t.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"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"})}),"Reset Filters"]})]}),D&&(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3 mt-3",children:[(0,t.jsxs)("div",{className:"relative w-64",children:[(0,t.jsx)("input",{type:"text",placeholder:"Filter by User ID",className:"w-full px-3 py-2 pl-8 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",value:j.user_id,onChange:e=>p({user_id:e.target.value})}),(0,t.jsx)("svg",{className:"absolute left-2.5 top-2.5 h-4 w-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5.121 17.804A13.937 13.937 0 0112 16c2.5 0 4.847.655 6.879 1.804M15 10a3 3 0 11-6 0 3 3 0 016 0zm6 2a9 9 0 11-18 0 9 9 0 0118 0z"})})]}),(0,t.jsx)("div",{className:"w-64",children:(0,t.jsx)(ea.Z,{value:j.user_role,onValueChange:e=>p({user_role:e}),placeholder:"Select Role",children:c&&Object.entries(c).map(e=>{let[s,l]=e;return(0,t.jsx)(b.Z,{value:s,children:l.ui_label},s)})})}),(0,t.jsx)("div",{className:"w-64",children:(0,t.jsx)(ea.Z,{value:j.team,onValueChange:e=>p({team:e}),placeholder:"Select Team",children:null==y?void 0:y.map(e=>(0,t.jsx)(b.Z,{value:e.team_id,children:e.team_alias||e.team_id},e.team_id))})}),(0,t.jsx)("div",{className:"relative w-64",children:(0,t.jsx)("input",{type:"text",placeholder:"Filter by SSO ID",className:"w-full px-3 py-2 pl-8 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",value:j.sso_user_id,onChange:e=>p({sso_user_id:e.target.value})})})]}),(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[a?(0,t.jsx)(eh.Z.Input,{active:!0,style:{width:192,height:20}}):(0,t.jsxs)("span",{className:"text-sm text-gray-700",children:["Showing"," ",_&&_.users&&_.users.length>0?(_.page-1)*_.page_size+1:0," ","-"," ",_&&_.users?Math.min(_.page*_.page_size,_.total):0," ","of ",_?_.total:0," results"]}),(0,t.jsx)("div",{className:"flex space-x-2",children:a?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eh.Z.Button,{active:!0,size:"small",style:{width:80,height:30}}),(0,t.jsx)(eh.Z.Button,{active:!0,size:"small",style:{width:60,height:30}})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{onClick:()=>w(N-1),disabled:1===N,className:"px-3 py-1 text-sm border rounded-md ".concat(1===N?"bg-gray-100 text-gray-400 cursor-not-allowed":"hover:bg-gray-50"),children:"Previous"}),(0,t.jsx)("button",{onClick:()=>w(N+1),disabled:!_||N>=_.total_pages,className:"px-3 py-1 text-sm border rounded-md ".concat(!_||N>=_.total_pages?"bg-gray-100 text-gray-400 cursor-not-allowed":"hover:bg-gray-50"),children:"Next"})]})})]})]})}),(0,t.jsx)("div",{className:"overflow-auto",children:(0,t.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(er.Z,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,t.jsx)(ed.Z,{children:M.getHeaderGroups().map(e=>(0,t.jsx)(ec.Z,{children:e.headers.map(e=>(0,t.jsx)(eo.Z,{className:"py-1 h-8 ".concat("actions"===e.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""," ").concat(e.column.getCanSort()?"cursor-pointer hover:bg-gray-50":""),onClick:e.column.getToggleSortingHandler(),children:(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,el.ie)(e.column.columnDef.header,e.getContext())}),"actions"!==e.id&&e.column.getCanSort()&&(0,t.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,t.jsx)(eu.Z,{className:"h-4 w-4 text-blue-500"}),desc:(0,t.jsx)(em.Z,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,t.jsx)(ex.Z,{className:"h-4 w-4 text-gray-400"})})]})},e.id))},e.id))}),(0,t.jsx)(ei.Z,{children:a?(0,t.jsx)(ec.Z,{children:(0,t.jsx)(en.Z,{colSpan:F.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"\uD83D\uDE85 Loading users..."})})})}):s.length>0?M.getRowModel().rows.map(e=>(0,t.jsx)(ec.Z,{className:"h-8",children:e.getVisibleCells().map(e=>(0,t.jsx)(en.Z,{className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap ".concat("actions"===e.column.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""),onClick:()=>{"user_id"===e.column.id&&A(e.getValue(),!1)},style:{cursor:"user_id"===e.column.id?"pointer":"default",color:"user_id"===e.column.id?"#3b82f6":"inherit"},children:(0,el.ie)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,t.jsx)(ec.Z,{children:(0,t.jsx)(en.Z,{colSpan:F.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"No users found"})})})})})]})})})})]})}let{Text:eb,Title:e_}=n.default,eN={email:"",user_id:"",user_role:"",sso_user_id:"",team:"",model:"",min_spend:null,max_spend:null,sort_by:"created_at",sort_order:"desc"};var ew=e=>{var s,l,n;let{accessToken:d,token:o,userRole:c,userID:u,teams:m}=e,x=(0,F.NL)(),[h,g]=(0,r.useState)(1),[v,p]=(0,r.useState)(!1),[f,y]=(0,r.useState)(null),[b,_]=(0,r.useState)(!1),[N,w]=(0,r.useState)(!1),[Z,k]=(0,r.useState)(null),[C,I]=(0,r.useState)("users"),[D,B]=(0,r.useState)(eN),[P,K,V]=(0,O.G)(D,{wait:300}),[q,G]=(0,r.useState)(!1),[W,Q]=(0,r.useState)(null),[$,H]=(0,r.useState)(null),[Y,X]=(0,r.useState)([]),[ee,el]=(0,r.useState)(!1),[et,ea]=(0,r.useState)(!1),[er,ei]=(0,r.useState)([]),en=e=>{k(e),_(!0)};(0,r.useEffect)(()=>()=>{V.cancel()},[V]),(0,r.useEffect)(()=>{H((0,j.getProxyBaseUrl)())},[]),(0,r.useEffect)(()=>{(async()=>{try{if(!u||!c||!d)return;let e=(await (0,j.modelAvailableCall)(d,u,c)).data.map(e=>e.id);console.log("available_model_names:",e),ei(e)}catch(e){console.error("Error fetching user models:",e)}})()},[d,u,c]);let ed=e=>{B(s=>{let l={...s,...e};return K(l),l})},eo=async e=>{if(!d){U.Z.fromBackend("Access token not found");return}try{U.Z.success("Generating password reset link...");let s=await (0,j.invitationCreateCall)(d,e);Q(s),G(!0)}catch(e){U.Z.fromBackend("Failed to generate password reset link")}},ec=async()=>{if(Z&&d)try{w(!0),await (0,j.userDeleteCall)(d,[Z.user_id]),x.setQueriesData({queryKey:["userList"]},e=>{if(void 0===e)return e;let s=e.users.filter(e=>e.user_id!==Z.user_id);return{...e,users:s}}),U.Z.success("User deleted successfully")}catch(e){console.error("Error deleting user:",e),U.Z.fromBackend("Failed to delete user")}finally{_(!1),k(null),w(!1)}},eu=async()=>{y(null),p(!1)},em=async e=>{if(console.log("inside handleEditSubmit:",e),d&&o&&c&&u){try{let s=await (0,j.userUpdateUserCall)(d,e,null);x.setQueriesData({queryKey:["userList"]},e=>{if(void 0===e)return e;let l=e.users.map(e=>e.user_id===s.data.user_id?(0,T.nl)(e,s.data):e);return{...e,users:l}}),U.Z.success("User ".concat(e.user_id," updated successfully"))}catch(e){console.error("There was an error updating the user",e)}y(null),p(!1)}},ex=async e=>{g(e)},eg=(0,M.a)({queryKey:["userList",{debouncedFilter:P,currentPage:h}],queryFn:async()=>{if(!d)throw Error("Access token required");return await (0,j.userListCall)(d,P.user_id?[P.user_id]:null,h,25,P.email||null,P.user_role||null,P.team||null,P.sso_user_id||null,P.sort_by,P.sort_order)},enabled:!!(d&&o&&c&&u),placeholderData:e=>e}),ev=eg.data,ej=(0,M.a)({queryKey:["userRoles"],initialData:()=>({}),queryFn:async()=>{if(!d)throw Error("Access token required");return await (0,j.getPossibleUserRoles)(d)},enabled:!!(d&&o&&c&&u)}).data,ep=es(ej,e=>{y(e),p(!0)},en,eo,()=>{});return(0,t.jsxs)("div",{className:"w-full p-8 overflow-hidden",children:[(0,t.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,t.jsx)("div",{className:"flex space-x-3",children:eg.isLoading?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eh.Z.Button,{active:!0,size:"default",shape:"default",style:{width:110,height:36}}),(0,t.jsx)(eh.Z.Button,{active:!0,size:"default",shape:"default",style:{width:145,height:36}}),(0,t.jsx)(eh.Z.Button,{active:!0,size:"default",shape:"default",style:{width:110,height:36}})]}):u&&d?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(A.Z,{userID:u,accessToken:d,teams:m,possibleUIRoles:ej}),(0,t.jsx)(i.z,{onClick:()=>{ea(!et),X([])},variant:et?"primary":"secondary",className:"flex items-center",children:et?"Cancel Selection":"Select Users"}),et&&(0,t.jsxs)(i.z,{onClick:()=>{if(0===Y.length){U.Z.fromBackend("Please select users to edit");return}el(!0)},disabled:0===Y.length,className:"flex items-center",children:["Bulk Edit (",Y.length," selected)"]})]}):null})}),(0,t.jsxs)(a.v0,{defaultIndex:0,onIndexChange:e=>I(0===e?"users":"settings"),children:[(0,t.jsxs)(a.td,{className:"mb-4",children:[(0,t.jsx)(a.OK,{children:"Users"}),(0,t.jsx)(a.OK,{children:"Default User Settings"})]}),(0,t.jsxs)(a.nP,{children:[(0,t.jsx)(a.x4,{children:(0,t.jsx)(ey,{data:(null===(s=eg.data)||void 0===s?void 0:s.users)||[],columns:ep,isLoading:eg.isLoading,accessToken:d,userRole:c,onSortChange:(e,s)=>{ed({sort_by:e,sort_order:s})},currentSort:{sortBy:D.sort_by,sortOrder:D.sort_order},possibleUIRoles:ej,handleEdit:e=>{y(e),p(!0)},handleDelete:en,handleResetPassword:eo,enableSelection:et,selectedUsers:Y,onSelectionChange:e=>{X(e)},filters:D,updateFilters:ed,initialFilters:eN,teams:m,userListResponse:ev,currentPage:h,handlePageChange:ex})}),(0,t.jsx)(a.x4,{children:u&&c&&d?(0,t.jsx)(J,{accessToken:d,possibleUIRoles:ej,userID:u,userRole:c}):(0,t.jsx)("div",{className:"flex justify-center items-center h-64",children:(0,t.jsx)(eh.Z,{active:!0,paragraph:{rows:4}})})})]})]}),(0,t.jsx)(L,{visible:v,possibleUIRoles:ej,onCancel:eu,user:f,onSubmit:em}),(0,t.jsx)(R.Z,{isOpen:b,title:"Delete User?",message:"Are you sure you want to delete this user? This action cannot be undone.",resourceInformationTitle:"User Information",resourceInformation:[{label:"Email",value:null==Z?void 0:Z.user_email},{label:"User ID",value:null==Z?void 0:Z.user_id,code:!0},{label:"Global Proxy Role",value:Z&&(null==ej?void 0:null===(l=ej[Z.user_role])||void 0===l?void 0:l.ui_label)||(null==Z?void 0:Z.user_role)||"-"},{label:"Total Spend (USD)",value:null==Z?void 0:null===(n=Z.spend)||void 0===n?void 0:n.toFixed(2)}],onCancel:()=>{_(!1),k(null)},onOk:ec,confirmLoading:N}),(0,t.jsx)(E.Z,{isInvitationLinkModalVisible:q,setIsInvitationLinkModalVisible:G,baseUrl:$||"",invitationLinkData:W,modalType:"resetPassword"}),(0,t.jsx)(z,{visible:ee,onCancel:()=>el(!1),selectedUsers:Y,possibleUIRoles:ej,accessToken:d,onSuccess:()=>{x.invalidateQueries({queryKey:["userList"]}),X([]),ea(!1)},teams:m,userRole:c,userModels:er,allowAllUsers:!!c&&(0,S.tY)(c)})]})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/7155-3a7ec4591ed81bab.js b/litellm/proxy/_experimental/out/_next/static/chunks/7155-3a7ec4591ed81bab.js deleted file mode 100644 index bf247b9a90..0000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/7155-3a7ec4591ed81bab.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7155],{88913:function(e,s,l){l.d(s,{Dx:function(){return d.Z},Zb:function(){return a.Z},iz:function(){return r.Z},oi:function(){return n.Z},xv:function(){return i.Z},zx:function(){return t.Z}});var t=l(78489),a=l(12514),r=l(67982),i=l(84264),n=l(49566),d=l(96761)},58643:function(e,s,l){l.d(s,{OK:function(){return t.Z},nP:function(){return n.Z},td:function(){return r.Z},v0:function(){return a.Z},x4:function(){return i.Z}});var t=l(12485),a=l(18135),r=l(35242),i=l(29706),n=l(77991)},77155:function(e,s,l){l.d(s,{Z:function(){return ew}});var t=l(57437),a=l(58643),r=l(2265),i=l(16312),n=l(57840),d=l(42264),o=l(22116),c=l(4156),u=l(56609),m=l(23496),x=l(5945),h=l(58760),g=l(37592),v=l(19015),j=l(19250),p=l(10032),f=l(99981),y=l(24199),b=l(57365),_=l(49566),N=l(16853),w=l(46468),S=l(20347),Z=l(15424),k=l(65925);function C(e){let{userData:s,onCancel:l,onSubmit:a,teams:n,accessToken:d,userID:o,userRole:c,userModels:u,possibleUIRoles:m,isBulkEdit:x=!1}=e,[h]=p.Z.useForm();return r.useEffect(()=>{var e,l,t,a,r,i,n;h.setFieldsValue({user_id:s.user_id,user_email:null===(e=s.user_info)||void 0===e?void 0:e.user_email,user_alias:null===(l=s.user_info)||void 0===l?void 0:l.user_alias,user_role:null===(t=s.user_info)||void 0===t?void 0:t.user_role,models:(null===(a=s.user_info)||void 0===a?void 0:a.models)||[],max_budget:null===(r=s.user_info)||void 0===r?void 0:r.max_budget,budget_duration:null===(i=s.user_info)||void 0===i?void 0:i.budget_duration,metadata:(null===(n=s.user_info)||void 0===n?void 0:n.metadata)?JSON.stringify(s.user_info.metadata,null,2):void 0})},[s,h]),(0,t.jsxs)(p.Z,{form:h,onFinish:e=>{if(e.metadata&&"string"==typeof e.metadata)try{e.metadata=JSON.parse(e.metadata)}catch(e){console.error("Error parsing metadata JSON:",e);return}a(e)},layout:"vertical",children:[!x&&(0,t.jsx)(p.Z.Item,{label:"User ID",name:"user_id",children:(0,t.jsx)(_.Z,{disabled:!0})}),!x&&(0,t.jsx)(p.Z.Item,{label:"Email",name:"user_email",children:(0,t.jsx)(_.Z,{})}),(0,t.jsx)(p.Z.Item,{label:"User Alias",name:"user_alias",children:(0,t.jsx)(_.Z,{})}),(0,t.jsx)(p.Z.Item,{label:(0,t.jsxs)("span",{children:["Global Proxy Role"," ",(0,t.jsx)(f.Z,{title:"This is the role that the user will globally on the proxy. This role is independent of any team/org specific roles.",children:(0,t.jsx)(Z.Z,{})})]}),name:"user_role",children:(0,t.jsx)(g.default,{children:m&&Object.entries(m).map(e=>{let[s,{ui_label:l,description:a}]=e;return(0,t.jsx)(b.Z,{value:s,title:l,children:(0,t.jsxs)("div",{className:"flex",children:[l," ",(0,t.jsx)("p",{className:"ml-2",style:{color:"gray",fontSize:"12px"},children:a})]})},s)})})}),(0,t.jsx)(p.Z.Item,{label:(0,t.jsxs)("span",{children:["Personal Models"," ",(0,t.jsx)(f.Z,{title:"Select which models this user can access outside of team-scope. Choose 'All Proxy Models' to grant access to all models available on the proxy.",children:(0,t.jsx)(Z.Z,{style:{marginLeft:"4px"}})})]}),name:"models",children:(0,t.jsxs)(g.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},disabled:!S.ZL.includes(c||""),children:[(0,t.jsx)(g.default.Option,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"),(0,t.jsx)(g.default.Option,{value:"no-default-models",children:"No Default Models"},"no-default-models"),u.map(e=>(0,t.jsx)(g.default.Option,{value:e,children:(0,w.W0)(e)},e))]})}),(0,t.jsx)(p.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,t.jsx)(y.Z,{step:.01,precision:2,style:{width:"100%"}})}),(0,t.jsx)(p.Z.Item,{label:"Reset Budget",name:"budget_duration",children:(0,t.jsx)(k.Z,{})}),(0,t.jsx)(p.Z.Item,{label:"Metadata",name:"metadata",children:(0,t.jsx)(N.Z,{rows:4,placeholder:"Enter metadata as JSON"})}),(0,t.jsxs)("div",{className:"flex justify-end space-x-2",children:[(0,t.jsx)(i.z,{variant:"secondary",type:"button",onClick:l,children:"Cancel"}),(0,t.jsx)(i.z,{type:"submit",children:"Save Changes"})]})]})}var U=l(9114);let{Text:I,Title:D}=n.default;var z=e=>{let{visible:s,onCancel:l,selectedUsers:a,possibleUIRoles:i,accessToken:n,onSuccess:p,teams:f,userRole:y,userModels:b,allowAllUsers:_=!1}=e,[N,w]=(0,r.useState)(!1),[S,Z]=(0,r.useState)([]),[k,z]=(0,r.useState)(null),[A,B]=(0,r.useState)(!1),[L,E]=(0,r.useState)(!1),T=()=>{Z([]),z(null),B(!1),E(!1),l()},O=r.useMemo(()=>({user_id:"bulk_edit",user_info:{user_email:"",user_role:"",teams:[],models:[],max_budget:null,spend:0,metadata:{},created_at:null,updated_at:null},keys:[],teams:f||[]}),[f,s]),F=async e=>{if(console.log("formValues",e),!n){U.Z.fromBackend("Access token not found");return}w(!0);try{let s=a.map(e=>e.user_id),t={};e.user_role&&""!==e.user_role&&(t.user_role=e.user_role),null!==e.max_budget&&void 0!==e.max_budget&&(t.max_budget=e.max_budget),e.models&&e.models.length>0&&(t.models=e.models),e.budget_duration&&""!==e.budget_duration&&(t.budget_duration=e.budget_duration),e.metadata&&Object.keys(e.metadata).length>0&&(t.metadata=e.metadata);let r=Object.keys(t).length>0,i=A&&S.length>0;if(!r&&!i){U.Z.fromBackend("Please modify at least one field or select teams to add users to");return}let o=[];if(r){if(L){let e=await (0,j.userBulkUpdateUserCall)(n,t,void 0,!0);o.push("Updated all users (".concat(e.total_requested," total)"))}else await (0,j.userBulkUpdateUserCall)(n,t,s),o.push("Updated ".concat(s.length," user(s)"))}if(i){let e=[];for(let s of S)try{let l=null;L?l=null:a.map(e=>({user_id:e.user_id,role:"user",user_email:e.user_email||null}));let t=await (0,j.teamBulkMemberAddCall)(n,s,l||null,k||void 0,L);console.log("result",t),e.push({teamId:s,success:!0,successfulAdditions:t.successful_additions,failedAdditions:t.failed_additions})}catch(l){console.error("Failed to add users to team ".concat(s,":"),l),e.push({teamId:s,success:!1,error:l})}let s=e.filter(e=>e.success),l=e.filter(e=>!e.success);if(s.length>0){let e=s.reduce((e,s)=>e+s.successfulAdditions,0);o.push("Added users to ".concat(s.length," team(s) (").concat(e," total additions)"))}l.length>0&&d.ZP.warning("Failed to add users to ".concat(l.length," team(s)"))}o.length>0&&U.Z.success(o.join(". ")),Z([]),z(null),B(!1),E(!1),p(),l()}catch(e){console.error("Bulk operation failed:",e),U.Z.fromBackend("Failed to perform bulk operations")}finally{w(!1)}};return(0,t.jsxs)(o.Z,{visible:s,onCancel:T,footer:null,title:L?"Bulk Edit All Users":"Bulk Edit ".concat(a.length," User(s)"),width:800,children:[_&&(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)(c.Z,{checked:L,onChange:e=>E(e.target.checked),children:(0,t.jsx)(I,{strong:!0,children:"Update ALL users in the system"})}),L&&(0,t.jsx)("div",{style:{marginTop:8},children:(0,t.jsx)(I,{type:"warning",style:{fontSize:"12px"},children:"⚠️ This will apply changes to ALL users in the system, not just the selected ones."})})]}),!L&&(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsxs)(D,{level:5,children:["Selected Users (",a.length,"):"]}),(0,t.jsx)(u.Z,{size:"small",bordered:!0,dataSource:a,pagination:!1,scroll:{y:200},rowKey:"user_id",columns:[{title:"User ID",dataIndex:"user_id",key:"user_id",width:"30%",render:e=>(0,t.jsx)(I,{strong:!0,style:{fontSize:"12px"},children:e.length>20?"".concat(e.slice(0,20),"..."):e})},{title:"Email",dataIndex:"user_email",key:"user_email",width:"25%",render:e=>(0,t.jsx)(I,{type:"secondary",style:{fontSize:"12px"},children:e||"No email"})},{title:"Current Role",dataIndex:"user_role",key:"user_role",width:"25%",render:e=>{var s;return(0,t.jsx)(I,{style:{fontSize:"12px"},children:(null==i?void 0:null===(s=i[e])||void 0===s?void 0:s.ui_label)||e})}},{title:"Budget",dataIndex:"max_budget",key:"max_budget",width:"20%",render:e=>(0,t.jsx)(I,{style:{fontSize:"12px"},children:null!==e?"$".concat(e):"Unlimited"})}]})]}),(0,t.jsx)(m.Z,{}),(0,t.jsx)("div",{className:"mb-4",children:(0,t.jsxs)(I,{children:[(0,t.jsx)("strong",{children:"Instructions:"})," Fill in the fields below with the values you want to apply to all selected users. You can bulk edit: role, budget, models, and metadata. You can also add users to teams."]})}),(0,t.jsx)(x.Z,{title:"Team Management",size:"small",className:"mb-4",style:{backgroundColor:"#fafafa"},children:(0,t.jsxs)(h.Z,{direction:"vertical",style:{width:"100%"},children:[(0,t.jsx)(c.Z,{checked:A,onChange:e=>B(e.target.checked),children:"Add selected users to teams"}),A&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(I,{strong:!0,children:"Select Teams:"}),(0,t.jsx)(g.default,{mode:"multiple",placeholder:"Select teams to add users to",value:S,onChange:Z,style:{width:"100%",marginTop:8},options:(null==f?void 0:f.map(e=>({label:e.team_alias||e.team_id,value:e.team_id})))||[]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(I,{strong:!0,children:"Team Budget (Optional):"}),(0,t.jsx)(v.Z,{placeholder:"Max budget per user in team",value:k,onChange:e=>z(e),style:{width:"100%",marginTop:8},min:0,step:.01,precision:2}),(0,t.jsx)(I,{type:"secondary",style:{fontSize:"12px"},children:"Leave empty for unlimited budget within team limits"})]}),(0,t.jsx)(I,{type:"secondary",style:{fontSize:"12px"},children:'Users will be added with "user" role by default. All users will be added to each selected team.'})]})]})}),(0,t.jsx)(C,{userData:O,onCancel:T,onSubmit:F,teams:f,accessToken:n,userID:"bulk_edit",userRole:y,userModels:b,possibleUIRoles:i,isBulkEdit:!0}),N&&(0,t.jsx)("div",{style:{textAlign:"center",marginTop:"10px"},children:(0,t.jsxs)(I,{children:["Updating ",L?"all users":a.length," user(s)..."]})})]})},A=l(7765),B=l(5545),L=e=>{let{visible:s,possibleUIRoles:l,onCancel:a,user:i,onSubmit:n}=e,[d,c]=(0,r.useState)(i),[u]=p.Z.useForm();(0,r.useEffect)(()=>{u.resetFields()},[i]);let m=async()=>{u.resetFields(),a()},x=async e=>{n(e),u.resetFields(),a()};return i?(0,t.jsx)(o.Z,{visible:s,onCancel:m,footer:null,title:"Edit User "+i.user_id,width:1e3,children:(0,t.jsx)(p.Z,{form:u,onFinish:x,initialValues:i,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(p.Z.Item,{className:"mt-8",label:"User Email",tooltip:"Email of the User",name:"user_email",children:(0,t.jsx)(_.Z,{})}),(0,t.jsx)(p.Z.Item,{label:"user_id",name:"user_id",hidden:!0,children:(0,t.jsx)(_.Z,{})}),(0,t.jsx)(p.Z.Item,{label:"User Role",name:"user_role",children:(0,t.jsx)(g.default,{children:l&&Object.entries(l).map(e=>{let[s,{ui_label:l,description:a}]=e;return(0,t.jsx)(b.Z,{value:s,title:l,children:(0,t.jsxs)("div",{className:"flex",children:[l," ",(0,t.jsx)("p",{className:"ml-2",style:{color:"gray",fontSize:"12px"},children:a})]})},s)})})}),(0,t.jsx)(p.Z.Item,{label:"Spend (USD)",name:"spend",tooltip:"(float) - Spend of all LLM calls completed by this user",help:"Across all keys (including keys with team_id).",children:(0,t.jsx)(v.Z,{min:0,step:.01})}),(0,t.jsx)(p.Z.Item,{label:"User Budget (USD)",name:"max_budget",tooltip:"(float) - Maximum budget of this user",help:"Maximum budget of this user.",children:(0,t.jsx)(y.Z,{min:0,step:.01})}),(0,t.jsx)(p.Z.Item,{label:"Reset Budget",name:"budget_duration",children:(0,t.jsx)(k.Z,{})}),(0,t.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,t.jsx)(B.ZP,{htmlType:"submit",children:"Save"})}),(0,t.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,t.jsx)(B.ZP,{htmlType:"submit",children:"Save"})})]})})}):null},E=l(98187),T=l(59872),O=l(19616),F=l(29827),M=l(11713),R=l(21609),P=l(88913),K=l(63709),V=l(10353),q=l(26349),G=l(96473),J=e=>{var s;let{accessToken:l,possibleUIRoles:a,userID:i,userRole:d}=e,[o,c]=(0,r.useState)(!0),[u,m]=(0,r.useState)(null),[x,h]=(0,r.useState)(!1),[p,f]=(0,r.useState)({}),[y,b]=(0,r.useState)(!1),[_,N]=(0,r.useState)([]),{Paragraph:S}=n.default,{Option:Z}=g.default;(0,r.useEffect)(()=>{(async()=>{if(!l){c(!1);return}try{let e=await (0,j.getInternalUserSettings)(l);if(m(e),f(e.values||{}),l)try{let e=await (0,j.modelAvailableCall)(l,i,d);if(e&&e.data){let s=e.data.map(e=>e.id);N(s)}}catch(e){console.error("Error fetching available models:",e)}}catch(e){console.error("Error fetching SSO settings:",e),U.Z.fromBackend("Failed to fetch SSO settings")}finally{c(!1)}})()},[l]);let C=async()=>{if(l){b(!0);try{let e=Object.entries(p).reduce((e,s)=>{let[l,t]=s;return e[l]=""===t?null:t,e},{}),s=await (0,j.updateInternalUserSettings)(l,e);m({...u,values:s.settings}),h(!1)}catch(e){console.error("Error updating SSO settings:",e),U.Z.fromBackend("Failed to update settings: "+e)}finally{b(!1)}}},I=(e,s)=>{f(l=>({...l,[e]:s}))},D=e=>e&&Array.isArray(e)?e.map(e=>"string"==typeof e?{team_id:e,user_role:"user"}:"object"==typeof e&&e.team_id?{team_id:e.team_id,max_budget_in_team:e.max_budget_in_team,user_role:e.user_role||"user"}:{team_id:"",user_role:"user"}):[],z=e=>{let s=D(e),l=(e,l,t)=>{let a=[...s];a[e]={...a[e],[l]:t},I("teams",a)},a=e=>{I("teams",s.filter((s,l)=>l!==e))};return(0,t.jsxs)("div",{className:"space-y-3",children:[s.map((e,s)=>(0,t.jsxs)("div",{className:"border rounded-lg p-4 bg-gray-50",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,t.jsxs)(P.xv,{className:"font-medium",children:["Team ",s+1]}),(0,t.jsx)(P.zx,{size:"sm",variant:"secondary",icon:q.Z,onClick:()=>a(s),className:"text-red-500 hover:text-red-700",children:"Remove"})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(P.xv,{className:"text-sm font-medium mb-1",children:"Team ID"}),(0,t.jsx)(P.oi,{value:e.team_id,onChange:e=>l(s,"team_id",e.target.value),placeholder:"Enter team ID"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(P.xv,{className:"text-sm font-medium mb-1",children:"Max Budget in Team"}),(0,t.jsx)(v.Z,{style:{width:"100%"},value:e.max_budget_in_team,onChange:e=>l(s,"max_budget_in_team",e),placeholder:"Optional",min:0,step:.01,precision:2})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(P.xv,{className:"text-sm font-medium mb-1",children:"User Role"}),(0,t.jsxs)(g.default,{style:{width:"100%"},value:e.user_role,onChange:e=>l(s,"user_role",e),children:[(0,t.jsx)(Z,{value:"user",children:"User"}),(0,t.jsx)(Z,{value:"admin",children:"Admin"})]})]})]})]},s)),(0,t.jsx)(P.zx,{variant:"secondary",icon:G.Z,onClick:()=>{I("teams",[...s,{team_id:"",user_role:"user"}])},className:"w-full",children:"Add Team"})]})},A=(e,s,l)=>{var r;let i=s.type;if("teams"===e)return(0,t.jsx)("div",{className:"mt-2",children:z(p[e]||[])});if("user_role"===e&&a)return(0,t.jsx)(g.default,{style:{width:"100%"},value:p[e]||"",onChange:s=>I(e,s),className:"mt-2",children:Object.entries(a).filter(e=>{let[s]=e;return s.includes("internal_user")}).map(e=>{let[s,{ui_label:l,description:a}]=e;return(0,t.jsx)(Z,{value:s,children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("span",{children:l}),(0,t.jsx)("span",{className:"ml-2 text-xs text-gray-500",children:a})]})},s)})});if("budget_duration"===e)return(0,t.jsx)(k.Z,{value:p[e]||null,onChange:s=>I(e,s),className:"mt-2"});if("boolean"===i)return(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)(K.Z,{checked:!!p[e],onChange:s=>I(e,s)})});if("array"===i&&(null===(r=s.items)||void 0===r?void 0:r.enum))return(0,t.jsx)(g.default,{mode:"multiple",style:{width:"100%"},value:p[e]||[],onChange:s=>I(e,s),className:"mt-2",children:s.items.enum.map(e=>(0,t.jsx)(Z,{value:e,children:e},e))});if("models"===e)return(0,t.jsxs)(g.default,{mode:"multiple",style:{width:"100%"},value:p[e]||[],onChange:s=>I(e,s),className:"mt-2",children:[(0,t.jsx)(Z,{value:"no-default-models",children:"No Default Models"},"no-default-models"),_.map(e=>(0,t.jsx)(Z,{value:e,children:(0,w.W0)(e)},e))]});if("string"===i&&s.enum)return(0,t.jsx)(g.default,{style:{width:"100%"},value:p[e]||"",onChange:s=>I(e,s),className:"mt-2",children:s.enum.map(e=>(0,t.jsx)(Z,{value:e,children:e},e))});else return(0,t.jsx)(P.oi,{value:void 0!==p[e]?String(p[e]):"",onChange:s=>I(e,s.target.value),placeholder:s.description||"",className:"mt-2"})},B=(e,s)=>{if(null==s)return(0,t.jsx)("span",{className:"text-gray-400",children:"Not set"});if("teams"===e&&Array.isArray(s)){if(0===s.length)return(0,t.jsx)("span",{className:"text-gray-400",children:"No teams assigned"});let e=D(s);return(0,t.jsx)("div",{className:"space-y-2 mt-1",children:e.map((e,s)=>(0,t.jsx)("div",{className:"border rounded-lg p-3 bg-white",children:(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-2 text-sm",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-medium text-gray-600",children:"Team ID:"}),(0,t.jsx)("p",{className:"text-gray-900",children:e.team_id||"Not specified"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-medium text-gray-600",children:"Max Budget:"}),(0,t.jsx)("p",{className:"text-gray-900",children:void 0!==e.max_budget_in_team?"$".concat((0,T.pw)(e.max_budget_in_team,4)):"No limit"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-medium text-gray-600",children:"Role:"}),(0,t.jsx)("p",{className:"text-gray-900 capitalize",children:e.user_role})]})]})},s))})}if("user_role"===e&&a&&a[s]){let{ui_label:e,description:l}=a[s];return(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-medium",children:e}),l&&(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:l})]})}return"budget_duration"===e?(0,t.jsx)("span",{children:(0,k.m)(s)}):"boolean"==typeof s?(0,t.jsx)("span",{children:s?"Enabled":"Disabled"}):"models"===e&&Array.isArray(s)?0===s.length?(0,t.jsx)("span",{className:"text-gray-400",children:"None"}):(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:s.map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",children:(0,w.W0)(e)},s))}):"object"==typeof s?Array.isArray(s)?0===s.length?(0,t.jsx)("span",{className:"text-gray-400",children:"None"}):(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:s.map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",children:"object"==typeof e?JSON.stringify(e):String(e)},s))}):(0,t.jsx)("pre",{className:"bg-gray-100 p-2 rounded text-xs overflow-auto mt-1",children:JSON.stringify(s,null,2)}):(0,t.jsx)("span",{children:String(s)})};return o?(0,t.jsx)("div",{className:"flex justify-center items-center h-64",children:(0,t.jsx)(V.Z,{size:"large"})}):u?(0,t.jsxs)(P.Zb,{children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsx)(P.Dx,{children:"Default User Settings"}),!o&&u&&(x?(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(P.zx,{variant:"secondary",onClick:()=>{h(!1),f(u.values||{})},disabled:y,children:"Cancel"}),(0,t.jsx)(P.zx,{onClick:C,loading:y,children:"Save Changes"})]}):(0,t.jsx)(P.zx,{onClick:()=>h(!0),children:"Edit Settings"}))]}),(null==u?void 0:null===(s=u.field_schema)||void 0===s?void 0:s.description)&&(0,t.jsx)(S,{className:"mb-4",children:u.field_schema.description}),(0,t.jsx)(P.iz,{}),(0,t.jsx)("div",{className:"mt-4 space-y-4",children:(()=>{let{values:e,field_schema:s}=u;return s&&s.properties?Object.entries(s.properties).map(s=>{let[l,a]=s,r=e[l],i=l.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase());return(0,t.jsxs)("div",{className:"mb-6 pb-6 border-b border-gray-200 last:border-0",children:[(0,t.jsx)(P.xv,{className:"font-medium text-lg",children:i}),(0,t.jsx)(S,{className:"text-sm text-gray-500 mt-1",children:a.description||"No description available"}),x?(0,t.jsx)("div",{className:"mt-2",children:A(l,a,r)}):(0,t.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:B(l,r)})]},l)}):(0,t.jsx)(P.xv,{children:"No schema information available"})})()})]}):(0,t.jsx)(P.Zb,{children:(0,t.jsx)(P.xv,{children:"No settings available or you do not have permission to view them."})})},W=l(41649),Q=l(67101),$=l(47323),H=l(15731),Y=l(53410),X=l(74998),ee=l(23628);let es=(e,s,l,a,r,i)=>{let n=[{header:"User ID",accessorKey:"user_id",enableSorting:!0,cell:e=>{let{row:s}=e;return(0,t.jsx)(f.Z,{title:s.original.user_id,children:(0,t.jsx)("span",{className:"text-xs",children:s.original.user_id?"".concat(s.original.user_id.slice(0,7),"..."):"-"})})}},{header:"Email",accessorKey:"user_email",enableSorting:!0,cell:e=>{let{row:s}=e;return(0,t.jsx)("span",{className:"text-xs",children:s.original.user_email||"-"})}},{header:"Global Proxy Role",accessorKey:"user_role",enableSorting:!0,cell:s=>{var l;let{row:a}=s;return(0,t.jsx)("span",{className:"text-xs",children:(null==e?void 0:null===(l=e[a.original.user_role])||void 0===l?void 0:l.ui_label)||"-"})}},{header:"User Alias",accessorKey:"user_alias",enableSorting:!1,cell:e=>{let{row:s}=e;return(0,t.jsx)("span",{className:"text-xs",children:s.original.user_alias||"-"})}},{header:"Spend (USD)",accessorKey:"spend",enableSorting:!0,cell:e=>{let{row:s}=e;return(0,t.jsx)("span",{className:"text-xs",children:s.original.spend?(0,T.pw)(s.original.spend,4):"-"})}},{header:"Budget (USD)",accessorKey:"max_budget",enableSorting:!1,cell:e=>{let{row:s}=e;return(0,t.jsx)("span",{className:"text-xs",children:null!==s.original.max_budget?s.original.max_budget:"Unlimited"})}},{header:()=>(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{children:"SSO ID"}),(0,t.jsx)(f.Z,{title:"SSO ID is the ID of the user in the SSO provider. If the user is not using SSO, this will be null.",children:(0,t.jsx)(H.Z,{className:"w-4 h-4"})})]}),accessorKey:"sso_user_id",enableSorting:!1,cell:e=>{let{row:s}=e;return(0,t.jsx)("span",{className:"text-xs",children:null!==s.original.sso_user_id?s.original.sso_user_id:"-"})}},{header:"Virtual Keys",accessorKey:"key_count",enableSorting:!1,cell:e=>{let{row:s}=e;return(0,t.jsx)(Q.Z,{numItems:2,children:s.original.key_count>0?(0,t.jsxs)(W.Z,{size:"xs",color:"indigo",children:[s.original.key_count," ",1===s.original.key_count?"Key":"Keys"]}):(0,t.jsx)(W.Z,{size:"xs",color:"gray",children:"No Keys"})})}},{header:"Created At",accessorKey:"created_at",enableSorting:!0,cell:e=>{let{row:s}=e;return(0,t.jsx)("span",{className:"text-xs",children:s.original.created_at?new Date(s.original.created_at).toLocaleDateString():"-"})}},{header:"Updated At",accessorKey:"updated_at",enableSorting:!1,cell:e=>{let{row:s}=e;return(0,t.jsx)("span",{className:"text-xs",children:s.original.updated_at?new Date(s.original.updated_at).toLocaleDateString():"-"})}},{id:"actions",header:"Actions",enableSorting:!1,cell:e=>{let{row:s}=e;return(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(f.Z,{title:"Edit user details",children:(0,t.jsx)($.Z,{icon:Y.Z,size:"sm",onClick:()=>r(s.original.user_id,!0),className:"cursor-pointer hover:text-blue-600"})}),(0,t.jsx)(f.Z,{title:"Delete user",children:(0,t.jsx)($.Z,{icon:X.Z,size:"sm",onClick:()=>l(s.original),className:"cursor-pointer hover:text-red-600"})}),(0,t.jsx)(f.Z,{title:"Reset Password",children:(0,t.jsx)($.Z,{icon:ee.Z,size:"sm",onClick:()=>a(s.original.user_id),className:"cursor-pointer hover:text-green-600"})})]})}}];if(i){let{onSelectUser:e,onSelectAll:s,isUserSelected:l,isAllSelected:a,isIndeterminate:r}=i;return[{id:"select",enableSorting:!1,header:()=>(0,t.jsx)(c.Z,{indeterminate:r,checked:a,onChange:e=>s(e.target.checked),onClick:e=>e.stopPropagation()}),cell:s=>{let{row:a}=s;return(0,t.jsx)(c.Z,{checked:l(a.original),onChange:s=>e(a.original,s.target.checked),onClick:e=>e.stopPropagation()})}},...n]}return n};var el=l(71594),et=l(24525),ea=l(27281),er=l(21626),ei=l(97214),en=l(28241),ed=l(58834),eo=l(69552),ec=l(71876),eu=l(44633),em=l(86462),ex=l(49084),eh=l(50337),eg=l(84717),ev=l(10900),ej=l(30401),ep=l(78867);function ef(e){var s,l,a,i,n,d,o,c,u,m,x,h,g,v,p,f,y,b,_,N,w,Z,I,D,z,A,L,O,F,M,R,P,K,V,q,G,J,W,Q;let{userId:$,onClose:H,accessToken:Y,userRole:es,onDelete:el,possibleUIRoles:et,initialTab:ea=0,startInEditMode:er=!1}=e,[ei,en]=(0,r.useState)(null),[ed,eo]=(0,r.useState)(!1),[ec,eu]=(0,r.useState)(!0),[em,ex]=(0,r.useState)(er),[eh,ef]=(0,r.useState)([]),[ey,eb]=(0,r.useState)(!1),[e_,eN]=(0,r.useState)(null),[ew,eS]=(0,r.useState)(null),[eZ,ek]=(0,r.useState)(ea),[eC,eU]=(0,r.useState)({}),[eI,eD]=(0,r.useState)(!1);r.useEffect(()=>{eS((0,j.getProxyBaseUrl)())},[]),r.useEffect(()=>{console.log("userId: ".concat($,", userRole: ").concat(es,", accessToken: ").concat(Y)),(async()=>{try{if(!Y)return;let e=await (0,j.userInfoCall)(Y,$,es||"",!1,null,null,!0);en(e);let s=(await (0,j.modelAvailableCall)(Y,$,es||"")).data.map(e=>e.id);ef(s)}catch(e){console.error("Error fetching user data:",e),U.Z.fromBackend("Failed to fetch user data")}finally{eu(!1)}})()},[Y,$,es]);let ez=async()=>{if(!Y){U.Z.fromBackend("Access token not found");return}try{U.Z.success("Generating password reset link...");let e=await (0,j.invitationCreateCall)(Y,$);eN(e),eb(!0)}catch(e){U.Z.fromBackend("Failed to generate password reset link")}},eA=async()=>{try{if(!Y)return;await (0,j.userDeleteCall)(Y,[$]),U.Z.success("User deleted successfully"),el&&el(),H()}catch(e){console.error("Error deleting user:",e),U.Z.fromBackend("Failed to delete user")}},eB=async e=>{try{if(!Y||!ei)return;await (0,j.userUpdateUserCall)(Y,e,null),en({...ei,user_info:{...ei.user_info,user_email:e.user_email,user_alias:e.user_alias,models:e.models,max_budget:e.max_budget,budget_duration:e.budget_duration,metadata:e.metadata}}),U.Z.success("User updated successfully"),ex(!1)}catch(e){console.error("Error updating user:",e),U.Z.fromBackend("Failed to update user")}};if(ec)return(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsx)(eg.zx,{icon:ev.Z,variant:"light",onClick:H,className:"mb-4",children:"Back to Users"}),(0,t.jsx)(eg.xv,{children:"Loading user data..."})]});if(!ei)return(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsx)(eg.zx,{icon:ev.Z,variant:"light",onClick:H,className:"mb-4",children:"Back to Users"}),(0,t.jsx)(eg.xv,{children:"User not found"})]});let eL=async(e,s)=>{await (0,T.vQ)(e)&&(eU(e=>({...e,[s]:!0})),setTimeout(()=>{eU(e=>({...e,[s]:!1}))},2e3))};return(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.zx,{icon:ev.Z,variant:"light",onClick:H,className:"mb-4",children:"Back to Users"}),(0,t.jsx)(eg.Dx,{children:(null===(s=ei.user_info)||void 0===s?void 0:s.user_email)||"User"}),(0,t.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)(eg.xv,{className:"text-gray-500 font-mono",children:ei.user_id}),(0,t.jsx)(B.ZP,{type:"text",size:"small",icon:eC["user-id"]?(0,t.jsx)(ej.Z,{size:12}):(0,t.jsx)(ep.Z,{size:12}),onClick:()=>eL(ei.user_id,"user-id"),className:"left-2 z-10 transition-all duration-200 ".concat(eC["user-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]}),es&&S.LQ.includes(es)&&(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(eg.zx,{icon:ee.Z,variant:"secondary",onClick:ez,className:"flex items-center",children:"Reset Password"}),(0,t.jsx)(eg.zx,{icon:X.Z,variant:"secondary",onClick:()=>eo(!0),className:"flex items-center",children:"Delete User"})]})]}),ed&&(0,t.jsx)("div",{className:"fixed z-10 inset-0 overflow-y-auto",children:(0,t.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,t.jsx)("div",{className:"fixed inset-0 transition-opacity","aria-hidden":"true",children:(0,t.jsx)("div",{className:"absolute inset-0 bg-gray-500 opacity-75"})}),(0,t.jsx)("span",{className:"hidden sm:inline-block sm:align-middle sm:h-screen","aria-hidden":"true",children:"​"}),(0,t.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,t.jsx)("div",{className:"bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4",children:(0,t.jsx)("div",{className:"sm:flex sm:items-start",children:(0,t.jsxs)("div",{className:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left",children:[(0,t.jsx)("h3",{className:"text-lg leading-6 font-medium text-gray-900",children:"Delete User"}),(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)("p",{className:"text-sm text-gray-500",children:"Are you sure you want to delete this user?"})})]})})}),(0,t.jsxs)("div",{className:"bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse",children:[(0,t.jsx)(eg.zx,{onClick:eA,color:"red",className:"ml-2",children:"Delete"}),(0,t.jsx)(eg.zx,{onClick:()=>eo(!1),children:"Cancel"})]})]})]})}),(0,t.jsxs)(eg.v0,{defaultIndex:eZ,onIndexChange:ek,children:[(0,t.jsxs)(eg.td,{className:"mb-4",children:[(0,t.jsx)(eg.OK,{children:"Overview"}),(0,t.jsx)(eg.OK,{children:"Details"})]}),(0,t.jsxs)(eg.nP,{children:[(0,t.jsx)(eg.x4,{children:(0,t.jsxs)(eg.rj,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,t.jsxs)(eg.Zb,{children:[(0,t.jsx)(eg.xv,{children:"Spend"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(eg.Dx,{children:["$",(0,T.pw)((null===(l=ei.user_info)||void 0===l?void 0:l.spend)||0,4)]}),(0,t.jsxs)(eg.xv,{children:["of"," ",(null===(a=ei.user_info)||void 0===a?void 0:a.max_budget)!==null?"$".concat((0,T.pw)(ei.user_info.max_budget,4)):"Unlimited"]})]})]}),(0,t.jsxs)(eg.Zb,{children:[(0,t.jsx)(eg.xv,{children:"Teams"}),(0,t.jsx)("div",{className:"mt-2",children:(null===(i=ei.teams)||void 0===i?void 0:i.length)&&(null===(n=ei.teams)||void 0===n?void 0:n.length)>0?(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[null===(d=ei.teams)||void 0===d?void 0:d.slice(0,eI?ei.teams.length:20).map((e,s)=>(0,t.jsx)(eg.Ct,{color:"blue",title:e.team_alias,children:e.team_alias},s)),!eI&&(null===(o=ei.teams)||void 0===o?void 0:o.length)>20&&(0,t.jsxs)(eg.Ct,{color:"gray",className:"cursor-pointer hover:bg-gray-200 transition-colors",onClick:()=>eD(!0),children:["+",ei.teams.length-20," more"]}),eI&&(null===(c=ei.teams)||void 0===c?void 0:c.length)>20&&(0,t.jsx)(eg.Ct,{color:"gray",className:"cursor-pointer hover:bg-gray-200 transition-colors",onClick:()=>eD(!1),children:"Show Less"})]}):(0,t.jsx)(eg.xv,{children:"No teams"})})]}),(0,t.jsxs)(eg.Zb,{children:[(0,t.jsx)(eg.xv,{children:"Virtual Keys"}),(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsxs)(eg.xv,{children:[(null===(u=ei.keys)||void 0===u?void 0:u.length)||0," ",(null===(m=ei.keys)||void 0===m?void 0:m.length)===1?"Key":"Keys"]})})]}),(0,t.jsxs)(eg.Zb,{children:[(0,t.jsx)(eg.xv,{children:"Personal Models"}),(0,t.jsx)("div",{className:"mt-2",children:(null===(h=ei.user_info)||void 0===h?void 0:null===(x=h.models)||void 0===x?void 0:x.length)&&(null===(v=ei.user_info)||void 0===v?void 0:null===(g=v.models)||void 0===g?void 0:g.length)>0?null===(f=ei.user_info)||void 0===f?void 0:null===(p=f.models)||void 0===p?void 0:p.map((e,s)=>(0,t.jsx)(eg.xv,{children:e},s)):(0,t.jsx)(eg.xv,{children:"All proxy models"})})]})]})}),(0,t.jsx)(eg.x4,{children:(0,t.jsxs)(eg.Zb,{children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsx)(eg.Dx,{children:"User Settings"}),!em&&es&&S.LQ.includes(es)&&(0,t.jsx)(eg.zx,{onClick:()=>ex(!0),children:"Edit Settings"})]}),em&&ei?(0,t.jsx)(C,{userData:ei,onCancel:()=>ex(!1),onSubmit:eB,teams:ei.teams,accessToken:Y,userID:$,userRole:es,userModels:eh,possibleUIRoles:et}):(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"User ID"}),(0,t.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)(eg.xv,{className:"font-mono",children:ei.user_id}),(0,t.jsx)(B.ZP,{type:"text",size:"small",icon:eC["user-id"]?(0,t.jsx)(ej.Z,{size:12}):(0,t.jsx)(ep.Z,{size:12}),onClick:()=>eL(ei.user_id,"user-id"),className:"left-2 z-10 transition-all duration-200 ".concat(eC["user-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"Email"}),(0,t.jsx)(eg.xv,{children:(null===(y=ei.user_info)||void 0===y?void 0:y.user_email)||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"User Alias"}),(0,t.jsx)(eg.xv,{children:(null===(b=ei.user_info)||void 0===b?void 0:b.user_alias)||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"Global Proxy Role"}),(0,t.jsx)(eg.xv,{children:(null===(_=ei.user_info)||void 0===_?void 0:_.user_role)||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"Created"}),(0,t.jsx)(eg.xv,{children:(null===(N=ei.user_info)||void 0===N?void 0:N.created_at)?new Date(ei.user_info.created_at).toLocaleString():"Unknown"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"Last Updated"}),(0,t.jsx)(eg.xv,{children:(null===(w=ei.user_info)||void 0===w?void 0:w.updated_at)?new Date(ei.user_info.updated_at).toLocaleString():"Unknown"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"Teams"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:(null===(Z=ei.teams)||void 0===Z?void 0:Z.length)&&(null===(I=ei.teams)||void 0===I?void 0:I.length)>0?(0,t.jsxs)(t.Fragment,{children:[null===(D=ei.teams)||void 0===D?void 0:D.slice(0,eI?ei.teams.length:20).map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",title:e.team_alias||e.team_id,children:e.team_alias||e.team_id},s)),!eI&&(null===(z=ei.teams)||void 0===z?void 0:z.length)>20&&(0,t.jsxs)("span",{className:"px-2 py-1 bg-gray-100 rounded text-xs cursor-pointer hover:bg-gray-200 transition-colors",onClick:()=>eD(!0),children:["+",ei.teams.length-20," more"]}),eI&&(null===(A=ei.teams)||void 0===A?void 0:A.length)>20&&(0,t.jsx)("span",{className:"px-2 py-1 bg-gray-100 rounded text-xs cursor-pointer hover:bg-gray-200 transition-colors",onClick:()=>eD(!1),children:"Show Less"})]}):(0,t.jsx)(eg.xv,{children:"No teams"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"Personal Models"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:(null===(O=ei.user_info)||void 0===O?void 0:null===(L=O.models)||void 0===L?void 0:L.length)&&(null===(M=ei.user_info)||void 0===M?void 0:null===(F=M.models)||void 0===F?void 0:F.length)>0?null===(P=ei.user_info)||void 0===P?void 0:null===(R=P.models)||void 0===R?void 0:R.map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",children:e},s)):(0,t.jsx)(eg.xv,{children:"All proxy models"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"Virtual Keys"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:(null===(K=ei.keys)||void 0===K?void 0:K.length)&&(null===(V=ei.keys)||void 0===V?void 0:V.length)>0?ei.keys.map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-green-100 rounded text-xs",children:e.key_alias||e.token},s)):(0,t.jsx)(eg.xv,{children:"No Virtual Keys"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"Max Budget"}),(0,t.jsx)(eg.xv,{children:(null===(q=ei.user_info)||void 0===q?void 0:q.max_budget)!==null&&(null===(G=ei.user_info)||void 0===G?void 0:G.max_budget)!==void 0?"$".concat((0,T.pw)(ei.user_info.max_budget,4)):"Unlimited"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"Budget Reset"}),(0,t.jsx)(eg.xv,{children:(0,k.m)(null!==(Q=null===(J=ei.user_info)||void 0===J?void 0:J.budget_duration)&&void 0!==Q?Q:null)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"Metadata"}),(0,t.jsx)("pre",{className:"bg-gray-100 p-2 rounded text-xs overflow-auto mt-1",children:JSON.stringify((null===(W=ei.user_info)||void 0===W?void 0:W.metadata)||{},null,2)})]})]})]})})]})]}),(0,t.jsx)(E.Z,{isInvitationLinkModalVisible:ey,setIsInvitationLinkModalVisible:eb,baseUrl:ew||"",invitationLinkData:e_,modalType:"resetPassword"})]})}function ey(e){let{data:s=[],columns:l,isLoading:a=!1,onSortChange:i,currentSort:n,accessToken:d,userRole:o,possibleUIRoles:c,handleEdit:u,handleDelete:m,handleResetPassword:x,selectedUsers:h=[],onSelectionChange:g,enableSelection:v=!1,filters:j,updateFilters:p,initialFilters:f,teams:y,userListResponse:_,currentPage:N,handlePageChange:w}=e,[S,Z]=r.useState([{id:(null==n?void 0:n.sortBy)||"created_at",desc:(null==n?void 0:n.sortOrder)==="desc"}]),[k,C]=r.useState(null),[U,I]=r.useState(!1),[D,z]=r.useState(!1),A=function(e){let s=arguments.length>1&&void 0!==arguments[1]&&arguments[1];C(e),I(s)},B=(e,s)=>{g&&(s?g([...h,e]):g(h.filter(s=>s.user_id!==e.user_id)))},L=e=>{g&&(e?g(s):g([]))},E=e=>h.some(s=>s.user_id===e.user_id),T=s.length>0&&h.length===s.length,O=h.length>0&&h.lengthc?es(c,u,m,x,A,v?{selectedUsers:h,onSelectUser:B,onSelectAll:L,isUserSelected:E,isAllSelected:T,isIndeterminate:O}:void 0):l,[c,u,m,x,A,l,v,h,T,O]),M=(0,el.b7)({data:s,columns:F,state:{sorting:S},onSortingChange:e=>{let s="function"==typeof e?e(S):e;if(Z(s),s&&Array.isArray(s)&&s.length>0&&s[0]){let e=s[0];if(e.id){let s=e.id,l=e.desc?"desc":"asc";null==i||i(s,l)}}else null==i||i("created_at","desc")},getCoreRowModel:(0,et.sC)(),manualSorting:!0,enableSorting:!0});return(r.useEffect(()=>{n&&Z([{id:n.sortBy,desc:"desc"===n.sortOrder}])},[n]),k)?(0,t.jsx)(ef,{userId:k,onClose:()=>{C(null),I(!1)},accessToken:d,userRole:o,possibleUIRoles:c,initialTab:U?1:0,startInEditMode:U}):(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,t.jsx)("div",{className:"border-b px-6 py-4",children:(0,t.jsxs)("div",{className:"flex flex-col space-y-4",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,t.jsxs)("div",{className:"relative w-64",children:[(0,t.jsx)("input",{type:"text",placeholder:"Search by email...",className:"w-full px-3 py-2 pl-8 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",value:j.email,onChange:e=>p({email:e.target.value})}),(0,t.jsx)("svg",{className:"absolute left-2.5 top-2.5 h-4 w-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})]}),(0,t.jsxs)("button",{className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2 ".concat(D?"bg-gray-100":""),onClick:()=>z(!D),children:[(0,t.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z"})}),"Filters",(j.user_id||j.user_role||j.team)&&(0,t.jsx)("span",{className:"w-2 h-2 rounded-full bg-blue-500"})]}),(0,t.jsxs)("button",{className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2",onClick:()=>{p(f)},children:[(0,t.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"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"})}),"Reset Filters"]})]}),D&&(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3 mt-3",children:[(0,t.jsxs)("div",{className:"relative w-64",children:[(0,t.jsx)("input",{type:"text",placeholder:"Filter by User ID",className:"w-full px-3 py-2 pl-8 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",value:j.user_id,onChange:e=>p({user_id:e.target.value})}),(0,t.jsx)("svg",{className:"absolute left-2.5 top-2.5 h-4 w-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5.121 17.804A13.937 13.937 0 0112 16c2.5 0 4.847.655 6.879 1.804M15 10a3 3 0 11-6 0 3 3 0 016 0zm6 2a9 9 0 11-18 0 9 9 0 0118 0z"})})]}),(0,t.jsx)("div",{className:"w-64",children:(0,t.jsx)(ea.Z,{value:j.user_role,onValueChange:e=>p({user_role:e}),placeholder:"Select Role",children:c&&Object.entries(c).map(e=>{let[s,l]=e;return(0,t.jsx)(b.Z,{value:s,children:l.ui_label},s)})})}),(0,t.jsx)("div",{className:"w-64",children:(0,t.jsx)(ea.Z,{value:j.team,onValueChange:e=>p({team:e}),placeholder:"Select Team",children:null==y?void 0:y.map(e=>(0,t.jsx)(b.Z,{value:e.team_id,children:e.team_alias||e.team_id},e.team_id))})}),(0,t.jsx)("div",{className:"relative w-64",children:(0,t.jsx)("input",{type:"text",placeholder:"Filter by SSO ID",className:"w-full px-3 py-2 pl-8 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",value:j.sso_user_id,onChange:e=>p({sso_user_id:e.target.value})})})]}),(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[a?(0,t.jsx)(eh.Z.Input,{active:!0,style:{width:192,height:20}}):(0,t.jsxs)("span",{className:"text-sm text-gray-700",children:["Showing"," ",_&&_.users&&_.users.length>0?(_.page-1)*_.page_size+1:0," ","-"," ",_&&_.users?Math.min(_.page*_.page_size,_.total):0," ","of ",_?_.total:0," results"]}),(0,t.jsx)("div",{className:"flex space-x-2",children:a?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eh.Z.Button,{active:!0,size:"small",style:{width:80,height:30}}),(0,t.jsx)(eh.Z.Button,{active:!0,size:"small",style:{width:60,height:30}})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{onClick:()=>w(N-1),disabled:1===N,className:"px-3 py-1 text-sm border rounded-md ".concat(1===N?"bg-gray-100 text-gray-400 cursor-not-allowed":"hover:bg-gray-50"),children:"Previous"}),(0,t.jsx)("button",{onClick:()=>w(N+1),disabled:!_||N>=_.total_pages,className:"px-3 py-1 text-sm border rounded-md ".concat(!_||N>=_.total_pages?"bg-gray-100 text-gray-400 cursor-not-allowed":"hover:bg-gray-50"),children:"Next"})]})})]})]})}),(0,t.jsx)("div",{className:"overflow-auto",children:(0,t.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(er.Z,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,t.jsx)(ed.Z,{children:M.getHeaderGroups().map(e=>(0,t.jsx)(ec.Z,{children:e.headers.map(e=>(0,t.jsx)(eo.Z,{className:"py-1 h-8 ".concat("actions"===e.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""," ").concat(e.column.getCanSort()?"cursor-pointer hover:bg-gray-50":""),onClick:e.column.getToggleSortingHandler(),children:(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,el.ie)(e.column.columnDef.header,e.getContext())}),"actions"!==e.id&&e.column.getCanSort()&&(0,t.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,t.jsx)(eu.Z,{className:"h-4 w-4 text-blue-500"}),desc:(0,t.jsx)(em.Z,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,t.jsx)(ex.Z,{className:"h-4 w-4 text-gray-400"})})]})},e.id))},e.id))}),(0,t.jsx)(ei.Z,{children:a?(0,t.jsx)(ec.Z,{children:(0,t.jsx)(en.Z,{colSpan:F.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"\uD83D\uDE85 Loading users..."})})})}):s.length>0?M.getRowModel().rows.map(e=>(0,t.jsx)(ec.Z,{className:"h-8",children:e.getVisibleCells().map(e=>(0,t.jsx)(en.Z,{className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap ".concat("actions"===e.column.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""),onClick:()=>{"user_id"===e.column.id&&A(e.getValue(),!1)},style:{cursor:"user_id"===e.column.id?"pointer":"default",color:"user_id"===e.column.id?"#3b82f6":"inherit"},children:(0,el.ie)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,t.jsx)(ec.Z,{children:(0,t.jsx)(en.Z,{colSpan:F.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"No users found"})})})})})]})})})})]})}let{Text:eb,Title:e_}=n.default,eN={email:"",user_id:"",user_role:"",sso_user_id:"",team:"",model:"",min_spend:null,max_spend:null,sort_by:"created_at",sort_order:"desc"};var ew=e=>{var s,l,n;let{accessToken:d,token:o,userRole:c,userID:u,teams:m}=e,x=(0,F.NL)(),[h,g]=(0,r.useState)(1),[v,p]=(0,r.useState)(!1),[f,y]=(0,r.useState)(null),[b,_]=(0,r.useState)(!1),[N,w]=(0,r.useState)(!1),[Z,k]=(0,r.useState)(null),[C,I]=(0,r.useState)("users"),[D,B]=(0,r.useState)(eN),[P,K,V]=(0,O.G)(D,{wait:300}),[q,G]=(0,r.useState)(!1),[W,Q]=(0,r.useState)(null),[$,H]=(0,r.useState)(null),[Y,X]=(0,r.useState)([]),[ee,el]=(0,r.useState)(!1),[et,ea]=(0,r.useState)(!1),[er,ei]=(0,r.useState)([]),en=e=>{k(e),_(!0)};(0,r.useEffect)(()=>()=>{V.cancel()},[V]),(0,r.useEffect)(()=>{H((0,j.getProxyBaseUrl)())},[]),(0,r.useEffect)(()=>{(async()=>{try{if(!u||!c||!d)return;let e=(await (0,j.modelAvailableCall)(d,u,c)).data.map(e=>e.id);console.log("available_model_names:",e),ei(e)}catch(e){console.error("Error fetching user models:",e)}})()},[d,u,c]);let ed=e=>{B(s=>{let l={...s,...e};return K(l),l})},eo=async e=>{if(!d){U.Z.fromBackend("Access token not found");return}try{U.Z.success("Generating password reset link...");let s=await (0,j.invitationCreateCall)(d,e);Q(s),G(!0)}catch(e){U.Z.fromBackend("Failed to generate password reset link")}},ec=async()=>{if(Z&&d)try{w(!0),await (0,j.userDeleteCall)(d,[Z.user_id]),x.setQueriesData({queryKey:["userList"]},e=>{if(void 0===e)return e;let s=e.users.filter(e=>e.user_id!==Z.user_id);return{...e,users:s}}),U.Z.success("User deleted successfully")}catch(e){console.error("Error deleting user:",e),U.Z.fromBackend("Failed to delete user")}finally{_(!1),k(null),w(!1)}},eu=async()=>{y(null),p(!1)},em=async e=>{if(console.log("inside handleEditSubmit:",e),d&&o&&c&&u){try{let s=await (0,j.userUpdateUserCall)(d,e,null);x.setQueriesData({queryKey:["userList"]},e=>{if(void 0===e)return e;let l=e.users.map(e=>e.user_id===s.data.user_id?(0,T.nl)(e,s.data):e);return{...e,users:l}}),U.Z.success("User ".concat(e.user_id," updated successfully"))}catch(e){console.error("There was an error updating the user",e)}y(null),p(!1)}},ex=async e=>{g(e)},eg=(0,M.a)({queryKey:["userList",{debouncedFilter:P,currentPage:h}],queryFn:async()=>{if(!d)throw Error("Access token required");return await (0,j.userListCall)(d,P.user_id?[P.user_id]:null,h,25,P.email||null,P.user_role||null,P.team||null,P.sso_user_id||null,P.sort_by,P.sort_order)},enabled:!!(d&&o&&c&&u),placeholderData:e=>e}),ev=eg.data,ej=(0,M.a)({queryKey:["userRoles"],initialData:()=>({}),queryFn:async()=>{if(!d)throw Error("Access token required");return await (0,j.getPossibleUserRoles)(d)},enabled:!!(d&&o&&c&&u)}).data,ep=es(ej,e=>{y(e),p(!0)},en,eo,()=>{});return(0,t.jsxs)("div",{className:"w-full p-8 overflow-hidden",children:[(0,t.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,t.jsx)("div",{className:"flex space-x-3",children:eg.isLoading?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eh.Z.Button,{active:!0,size:"default",shape:"default",style:{width:110,height:36}}),(0,t.jsx)(eh.Z.Button,{active:!0,size:"default",shape:"default",style:{width:145,height:36}}),(0,t.jsx)(eh.Z.Button,{active:!0,size:"default",shape:"default",style:{width:110,height:36}})]}):u&&d?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(A.Z,{userID:u,accessToken:d,teams:m,possibleUIRoles:ej}),(0,t.jsx)(i.z,{onClick:()=>{ea(!et),X([])},variant:et?"primary":"secondary",className:"flex items-center",children:et?"Cancel Selection":"Select Users"}),et&&(0,t.jsxs)(i.z,{onClick:()=>{if(0===Y.length){U.Z.fromBackend("Please select users to edit");return}el(!0)},disabled:0===Y.length,className:"flex items-center",children:["Bulk Edit (",Y.length," selected)"]})]}):null})}),(0,t.jsxs)(a.v0,{defaultIndex:0,onIndexChange:e=>I(0===e?"users":"settings"),children:[(0,t.jsxs)(a.td,{className:"mb-4",children:[(0,t.jsx)(a.OK,{children:"Users"}),(0,t.jsx)(a.OK,{children:"Default User Settings"})]}),(0,t.jsxs)(a.nP,{children:[(0,t.jsx)(a.x4,{children:(0,t.jsx)(ey,{data:(null===(s=eg.data)||void 0===s?void 0:s.users)||[],columns:ep,isLoading:eg.isLoading,accessToken:d,userRole:c,onSortChange:(e,s)=>{ed({sort_by:e,sort_order:s})},currentSort:{sortBy:D.sort_by,sortOrder:D.sort_order},possibleUIRoles:ej,handleEdit:e=>{y(e),p(!0)},handleDelete:en,handleResetPassword:eo,enableSelection:et,selectedUsers:Y,onSelectionChange:e=>{X(e)},filters:D,updateFilters:ed,initialFilters:eN,teams:m,userListResponse:ev,currentPage:h,handlePageChange:ex})}),(0,t.jsx)(a.x4,{children:u&&c&&d?(0,t.jsx)(J,{accessToken:d,possibleUIRoles:ej,userID:u,userRole:c}):(0,t.jsx)("div",{className:"flex justify-center items-center h-64",children:(0,t.jsx)(eh.Z,{active:!0,paragraph:{rows:4}})})})]})]}),(0,t.jsx)(L,{visible:v,possibleUIRoles:ej,onCancel:eu,user:f,onSubmit:em}),(0,t.jsx)(R.Z,{isOpen:b,title:"Delete User?",message:"Are you sure you want to delete this user? This action cannot be undone.",resourceInformationTitle:"User Information",resourceInformation:[{label:"Email",value:null==Z?void 0:Z.user_email},{label:"User ID",value:null==Z?void 0:Z.user_id,code:!0},{label:"Global Proxy Role",value:Z&&(null==ej?void 0:null===(l=ej[Z.user_role])||void 0===l?void 0:l.ui_label)||(null==Z?void 0:Z.user_role)||"-"},{label:"Total Spend (USD)",value:null==Z?void 0:null===(n=Z.spend)||void 0===n?void 0:n.toFixed(2)}],onCancel:()=>{_(!1),k(null)},onOk:ec,confirmLoading:N}),(0,t.jsx)(E.Z,{isInvitationLinkModalVisible:q,setIsInvitationLinkModalVisible:G,baseUrl:$||"",invitationLinkData:W,modalType:"resetPassword"}),(0,t.jsx)(z,{visible:ee,onCancel:()=>el(!1),selectedUsers:Y,possibleUIRoles:ej,accessToken:d,onSuccess:()=>{x.invalidateQueries({queryKey:["userList"]}),X([]),ea(!1)},teams:m,userRole:c,userModels:er,allowAllUsers:!!c&&(0,S.tY)(c)})]})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/7641-90e15c72e10330f1.js b/litellm/proxy/_experimental/out/_next/static/chunks/7641-90e15c72e10330f1.js new file mode 100644 index 0000000000..b43a64fc04 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/7641-90e15c72e10330f1.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7641],{71668:function(e,s,r){r.d(s,{Dx:function(){return d.Z},OK:function(){return l.Z},nP:function(){return o.Z},td:function(){return n.Z},v0:function(){return a.Z},x4:function(){return i.Z},xv:function(){return c.Z},zx:function(){return t.Z}});var t=r(78489),l=r(12485),a=r(18135),n=r(35242),i=r(29706),o=r(77991),c=r(84264),d=r(96761)},58927:function(e,s,r){r.d(s,{J:function(){return t.Z}});var t=r(47323)},87641:function(e,s,r){r.d(s,{d:function(){return eX},o:function(){return e4}});var t=r(57437),l=r(20347),a=r(67187),n=r(11713),i=r(71668),o=r(57840),c=r(37592),d=r(99981),m=r(22116),u=r(76188),x=r(2265),h=r(9114),p=r(19250),g=r(12322),j=r(10032),v=r(4260),f=r(15424),b=r(64504);let y={NONE:"none",API_KEY:"api_key",BEARER_TOKEN:"bearer_token",BASIC:"basic",OAUTH2:"oauth2"},N={SSE:"sse"},_=e=>(console.log(e),null==e)?N.SSE:e,w=e=>null==e?y.NONE:e;var Z=r(19015),C=r(44851),S=r(33866),k=r(62670),P=r(58630),A=r(12514),T=r(84264),M=r(96761),I=e=>{let{value:s={},onChange:r,tools:l=[],disabled:a=!1}=e,n=(e,t)=>{let l={...s,tool_name_to_cost_per_query:{...s.tool_name_to_cost_per_query,[e]:t}};null==r||r(l)};return(0,t.jsx)(A.Z,{children:(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,t.jsx)(k.Z,{className:"text-green-600"}),(0,t.jsx)(M.Z,{children:"Cost Configuration"}),(0,t.jsx)(d.Z,{title:"Configure costs for this MCP server's tool calls. Set a default rate and per-tool overrides.",children:(0,t.jsx)(f.Z,{className:"text-gray-400"})})]}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:["Default Cost per Query ($)",(0,t.jsx)(d.Z,{title:"Default cost charged for each tool call to this server.",children:(0,t.jsx)(f.Z,{className:"ml-1 text-gray-400"})})]}),(0,t.jsx)(Z.Z,{min:0,step:1e-4,precision:4,placeholder:"0.0000",value:s.default_cost_per_query,onChange:e=>{let t={...s,default_cost_per_query:e};null==r||r(t)},disabled:a,style:{width:"200px"},addonBefore:"$"}),(0,t.jsx)(T.Z,{className:"block mt-1 text-gray-500 text-sm",children:"Set a default cost for all tool calls to this server"})]}),l.length>0&&(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("label",{className:"block text-sm font-medium text-gray-700",children:["Tool-Specific Costs ($)",(0,t.jsx)(d.Z,{title:"Override the default cost for specific tools. Leave blank to use the default rate.",children:(0,t.jsx)(f.Z,{className:"ml-1 text-gray-400"})})]}),(0,t.jsx)(C.default,{items:[{key:"1",label:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(P.Z,{className:"mr-2 text-blue-500"}),(0,t.jsx)("span",{className:"font-medium",children:"Available Tools"}),(0,t.jsx)(S.Z,{count:l.length,style:{backgroundColor:"#52c41a",marginLeft:"8px"}})]}),children:(0,t.jsx)("div",{className:"space-y-3 max-h-64 overflow-y-auto",children:l.map((e,r)=>{var l;return(0,t.jsxs)("div",{className:"flex items-center justify-between p-3 bg-gray-50 rounded-lg",children:[(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)(T.Z,{className:"font-medium text-gray-900",children:e.name}),e.description&&(0,t.jsx)(T.Z,{className:"text-gray-500 text-sm block mt-1",children:e.description})]}),(0,t.jsx)("div",{className:"ml-4",children:(0,t.jsx)(Z.Z,{min:0,step:1e-4,precision:4,placeholder:"Use default",value:null===(l=s.tool_name_to_cost_per_query)||void 0===l?void 0:l[e.name],onChange:s=>n(e.name,s),disabled:a,style:{width:"120px"},addonBefore:"$"})})]},r)})})}]})]})]}),(s.default_cost_per_query||s.tool_name_to_cost_per_query&&Object.keys(s.tool_name_to_cost_per_query).length>0)&&(0,t.jsxs)("div",{className:"mt-6 p-4 bg-blue-50 border border-blue-200 rounded-lg",children:[(0,t.jsx)(T.Z,{className:"text-blue-800 font-medium",children:"Cost Summary:"}),(0,t.jsxs)("div",{className:"mt-2 space-y-1",children:[s.default_cost_per_query&&(0,t.jsxs)(T.Z,{className:"text-blue-700",children:["• Default cost: $",s.default_cost_per_query.toFixed(4)," per query"]}),s.tool_name_to_cost_per_query&&Object.entries(s.tool_name_to_cost_per_query).map(e=>{let[s,r]=e;return null!=r&&(0,t.jsxs)(T.Z,{className:"text-blue-700",children:["• ",s,": $",r.toFixed(4)," per query"]},s)})]})]})]})})},O=r(10353),L=r(51653),E=r(5545),z=r(83669),q=r(29271),U=r(89245);let R=e=>{var s,r;let{accessToken:t,oauthAccessToken:l,formValues:a,enabled:n=!0}=e,[i,o]=(0,x.useState)([]),[c,d]=(0,x.useState)(!1),[m,u]=(0,x.useState)(null),[h,g]=(0,x.useState)(null),[j,v]=(0,x.useState)(!1),f=a.auth_type===y.OAUTH2,b=!!(a.url&&a.transport&&a.auth_type&&t&&(!f||l)),N=JSON.stringify(null!==(s=a.static_headers)&&void 0!==s?s:{}),_=JSON.stringify(null!==(r=a.credentials)&&void 0!==r?r:{}),w=async()=>{if(t&&a.url&&(!f||l)){d(!0),u(null);try{let e=Array.isArray(a.static_headers)?a.static_headers.reduce((e,s)=>{var r;let t=null==s?void 0:null===(r=s.header)||void 0===r?void 0:r.trim();return t&&(e[t]=(null==s?void 0:s.value)!=null?String(s.value):""),e},{}):!Array.isArray(a.static_headers)&&a.static_headers&&"object"==typeof a.static_headers?Object.entries(a.static_headers).reduce((e,s)=>{let[r,t]=s;return r&&(e[r]=null!=t?String(t):""),e},{}):{},s=a.credentials&&"object"==typeof a.credentials?Object.entries(a.credentials).reduce((e,s)=>{let[r,t]=s;if(null==t||""===t)return e;if("scopes"===r){if(Array.isArray(t)){let s=t.filter(e=>null!=e&&""!==e);s.length>0&&(e[r]=s)}}else e[r]=t;return e},{}):void 0,r={server_id:a.server_id||"",server_name:a.server_name||"",url:a.url,transport:a.transport,auth_type:a.auth_type,mcp_info:a.mcp_info,static_headers:e};s&&Object.keys(s).length>0&&(r.credentials=s);let n=await (0,p.testMCPToolsListRequest)(t,r,l);if(n.tools&&!n.error)o(n.tools),u(null),g(null),n.tools.length>0&&!j&&v(!0);else{let e=n.message||"Failed to retrieve tools list";u(e),g(n.stack_trace||null),o([]),v(!1)}}catch(e){console.error("Tools fetch error:",e),u(e instanceof Error?e.message:String(e)),g(null),o([]),v(!1)}finally{d(!1)}}},Z=()=>{o([]),u(null),g(null),v(!1)};return(0,x.useEffect)(()=>{n&&(b?w():Z())},[a.url,a.transport,a.auth_type,t,n,l,b,N,_]),{tools:i,isLoadingTools:c,toolsError:m,toolsErrorStackTrace:h,hasShownSuccessMessage:j,canFetchTools:b,fetchTools:w,clearTools:Z}};var F=e=>{let{accessToken:s,oauthAccessToken:r,formValues:l,onToolsLoaded:a}=e,{tools:n,isLoadingTools:i,toolsError:o,toolsErrorStackTrace:c,canFetchTools:d,fetchTools:m}=R({accessToken:s,oauthAccessToken:r,formValues:l,enabled:!0});return((0,x.useEffect)(()=>{null==a||a(n)},[n,a]),d||l.url)?(0,t.jsx)(A.Z,{children:(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(z.Z,{className:"text-blue-600"}),(0,t.jsx)(M.Z,{children:"Connection Status"})]}),!d&&l.url&&(0,t.jsxs)("div",{className:"text-center py-6 text-gray-400 border rounded-lg border-dashed",children:[(0,t.jsx)(P.Z,{className:"text-2xl mb-2"}),(0,t.jsx)(T.Z,{children:"Complete required fields to test connection"}),(0,t.jsx)("br",{}),(0,t.jsx)(T.Z,{className:"text-sm",children:"Fill in URL, Transport, and Authentication to test MCP server connection"})]}),d&&(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(T.Z,{className:"text-gray-700 font-medium",children:i?"Testing connection to MCP server...":n.length>0?"Connection successful":o?"Connection failed":"Ready to test connection"}),(0,t.jsx)("br",{}),(0,t.jsxs)(T.Z,{className:"text-gray-500 text-sm",children:["Server: ",l.url]})]}),i&&(0,t.jsxs)("div",{className:"flex items-center text-blue-600",children:[(0,t.jsx)(O.Z,{size:"small",className:"mr-2"}),(0,t.jsx)(T.Z,{className:"text-blue-600",children:"Connecting..."})]}),!i&&!o&&n.length>0&&(0,t.jsxs)("div",{className:"flex items-center text-green-600",children:[(0,t.jsx)(z.Z,{className:"mr-1"}),(0,t.jsx)(T.Z,{className:"text-green-600 font-medium",children:"Connected"})]}),o&&(0,t.jsxs)("div",{className:"flex items-center text-red-600",children:[(0,t.jsx)(q.Z,{className:"mr-1"}),(0,t.jsx)(T.Z,{className:"text-red-600 font-medium",children:"Failed"})]})]}),i&&(0,t.jsxs)("div",{className:"flex items-center justify-center py-6",children:[(0,t.jsx)(O.Z,{size:"large"}),(0,t.jsx)(T.Z,{className:"ml-3",children:"Testing connection and loading tools..."})]}),o&&(0,t.jsx)(L.Z,{message:"Connection Failed",description:(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{children:o}),c&&(0,t.jsx)(C.default,{items:[{key:"stack-trace",label:"Stack Trace",children:(0,t.jsx)("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word",fontSize:"12px",fontFamily:"monospace",margin:0,padding:"8px",backgroundColor:"#f5f5f5",borderRadius:"4px",maxHeight:"400px",overflow:"auto"},children:c})}],style:{marginTop:"12px"}})]}),type:"error",showIcon:!0,action:(0,t.jsx)(E.ZP,{icon:(0,t.jsx)(U.Z,{}),onClick:m,size:"small",children:"Retry"})}),!i&&0===n.length&&!o&&(0,t.jsxs)("div",{className:"text-center py-6 text-gray-500 border rounded-lg border-dashed",children:[(0,t.jsx)(z.Z,{className:"text-2xl mb-2 text-green-500"}),(0,t.jsx)(T.Z,{className:"text-green-600 font-medium",children:"Connection successful!"}),(0,t.jsx)("br",{}),(0,t.jsx)(T.Z,{className:"text-gray-500",children:"No tools found for this MCP server"})]})]})]})}):null},V=r(61994),B=e=>{let{accessToken:s,oauthAccessToken:r,formValues:l,allowedTools:a,existingAllowedTools:n,onAllowedToolsChange:i}=e,o=(0,x.useRef)(0),{tools:c,isLoadingTools:d,toolsError:m,canFetchTools:u}=R({accessToken:s,oauthAccessToken:r,formValues:l,enabled:!0});(0,x.useEffect)(()=>{if(c.length>0&&c.length!==o.current&&0===a.length){if(n&&n.length>0){let e=c.map(e=>e.name);i(n.filter(s=>e.includes(s)))}else i(c.map(e=>e.name))}o.current=c.length},[c,a.length,n,i]);let h=e=>{a.includes(e)?i(a.filter(s=>s!==e)):i([...a,e])};return u||l.url?(0,t.jsx)(A.Z,{children:(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("div",{className:"flex items-center justify-between",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(P.Z,{className:"text-blue-600"}),(0,t.jsx)(M.Z,{children:"Tool Configuration"}),c.length>0&&(0,t.jsx)(S.Z,{count:c.length,style:{backgroundColor:"#52c41a"}})]})}),(0,t.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,t.jsxs)(T.Z,{className:"text-blue-800 text-sm",children:[(0,t.jsx)("strong",{children:"Select which tools users can call:"})," Only checked tools will be available for users to invoke. Unchecked tools will be blocked from execution."]})}),d&&(0,t.jsxs)("div",{className:"flex items-center justify-center py-6",children:[(0,t.jsx)(O.Z,{size:"large"}),(0,t.jsx)(T.Z,{className:"ml-3",children:"Loading tools..."})]}),m&&!d&&(0,t.jsxs)("div",{className:"text-center py-6 text-red-500 border rounded-lg border-dashed border-red-300 bg-red-50",children:[(0,t.jsx)(P.Z,{className:"text-2xl mb-2"}),(0,t.jsx)(T.Z,{className:"text-red-600 font-medium",children:"Unable to load tools"}),(0,t.jsx)("br",{}),(0,t.jsx)(T.Z,{className:"text-sm text-red-500",children:m})]}),!d&&!m&&0===c.length&&u&&(0,t.jsxs)("div",{className:"text-center py-6 text-gray-400 border rounded-lg border-dashed",children:[(0,t.jsx)(P.Z,{className:"text-2xl mb-2"}),(0,t.jsx)(T.Z,{children:"No tools available for configuration"}),(0,t.jsx)("br",{}),(0,t.jsx)(T.Z,{className:"text-sm",children:"Connect to an MCP server with tools to configure them"})]}),!u&&l.url&&(0,t.jsxs)("div",{className:"text-center py-6 text-gray-400 border rounded-lg border-dashed",children:[(0,t.jsx)(P.Z,{className:"text-2xl mb-2"}),(0,t.jsx)(T.Z,{children:"Complete required fields to configure tools"}),(0,t.jsx)("br",{}),(0,t.jsx)(T.Z,{className:"text-sm",children:"Fill in URL, Transport, and Authentication to load available tools"})]}),!d&&!m&&c.length>0&&(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-green-50 rounded-lg border border-green-200 flex-1",children:[(0,t.jsx)(z.Z,{className:"text-green-600"}),(0,t.jsxs)(T.Z,{className:"text-green-700 font-medium",children:[a.length," of ",c.length," ",1===c.length?"tool":"tools"," enabled for user access"]})]}),(0,t.jsxs)("div",{className:"flex gap-2 ml-3",children:[(0,t.jsx)("button",{type:"button",onClick:()=>{i(c.map(e=>e.name))},className:"px-3 py-1.5 text-sm text-blue-600 hover:text-blue-700 hover:bg-blue-50 rounded-md transition-colors",children:"Enable All"}),(0,t.jsx)("button",{type:"button",onClick:()=>{i([])},className:"px-3 py-1.5 text-sm text-gray-600 hover:text-gray-700 hover:bg-gray-100 rounded-md transition-colors",children:"Disable All"})]})]}),(0,t.jsx)("div",{className:"space-y-2",children:c.map((e,s)=>(0,t.jsx)("div",{className:"p-4 rounded-lg border transition-colors cursor-pointer ".concat(a.includes(e.name)?"bg-blue-50 border-blue-300 hover:border-blue-400":"bg-gray-50 border-gray-200 hover:border-gray-300"),onClick:()=>h(e.name),children:(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)(V.Z,{checked:a.includes(e.name),onChange:()=>h(e.name)}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(T.Z,{className:"font-medium text-gray-900",children:e.name}),(0,t.jsx)("span",{className:"px-2 py-0.5 text-xs rounded-full font-medium ".concat(a.includes(e.name)?"bg-green-100 text-green-800":"bg-red-100 text-red-800"),children:a.includes(e.name)?"Enabled":"Disabled"})]}),e.description&&(0,t.jsx)(T.Z,{className:"text-gray-500 text-sm block mt-1",children:e.description}),(0,t.jsx)(T.Z,{className:"text-gray-400 text-xs block mt-1",children:a.includes(e.name)?"✓ Users can call this tool":"✗ Users cannot call this tool"})]})]})},s))})]})]})}):null},K=e=>{let{isVisible:s}=e;return s?(0,t.jsx)(j.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Stdio Configuration (JSON)",(0,t.jsx)(d.Z,{title:"Paste your stdio MCP server configuration in JSON format. You can use the full mcpServers structure from config.yaml or just the inner server configuration.",children:(0,t.jsx)(f.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"stdio_config",rules:[{required:!0,message:"Please enter stdio configuration"},{validator:(e,s)=>{if(!s)return Promise.resolve();try{return JSON.parse(s),Promise.resolve()}catch(e){return Promise.reject("Please enter valid JSON")}}}],children:(0,t.jsx)(v.default.TextArea,{placeholder:'{\n "mcpServers": {\n "circleci-mcp-server": {\n "command": "npx",\n "args": ["-y", "@circleci/mcp-server-circleci"],\n "env": {\n "CIRCLECI_TOKEN": "your-circleci-token",\n "CIRCLECI_BASE_URL": "https://circleci.com"\n }\n }\n }\n}',rows:12,className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500 font-mono text-sm"})}):null},H=r(58760),D=r(45246),J=r(96473);let{Panel:G}=C.default;var Y=e=>{let{availableAccessGroups:s,mcpServer:r,searchValue:l,setSearchValue:a,getAccessGroupOptions:n}=e,i=j.Z.useFormInstance();return(0,x.useEffect)(()=>{if(r&&(r.extra_headers&&i.setFieldValue("extra_headers",r.extra_headers),r.static_headers)){let e=Object.entries(r.static_headers).map(e=>{let[s,r]=e;return{header:s,value:null!=r?String(r):""}});i.setFieldValue("static_headers",e)}},[r,i]),(0,t.jsx)(C.default,{className:"bg-gray-50 border border-gray-200 rounded-lg",expandIconPosition:"end",ghost:!1,children:(0,t.jsx)(G,{header:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,t.jsx)("h3",{className:"text-lg font-semibold text-gray-900",children:"Permission Management / Access Control"})]}),(0,t.jsx)("p",{className:"text-sm text-gray-600 ml-4",children:"Configure access permissions and security settings (Optional)"})]}),className:"border-0",children:(0,t.jsxs)("div",{className:"space-y-6 pt-4",children:[(0,t.jsx)(j.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["MCP Access Groups",(0,t.jsx)(d.Z,{title:"Specify access groups for this MCP server. Users must be in at least one of these groups to access the server.",children:(0,t.jsx)(f.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"mcp_access_groups",className:"mb-4",children:(0,t.jsx)(c.default,{mode:"tags",showSearch:!0,placeholder:"Select existing groups or type to create new ones",optionFilterProp:"value",filterOption:(e,s)=>{var r;return(null!==(r=null==s?void 0:s.value)&&void 0!==r?r:"").toLowerCase().includes(e.toLowerCase())},onSearch:e=>a(e),tokenSeparators:[","],options:n(),maxTagCount:"responsive",allowClear:!0})}),(0,t.jsx)(j.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Extra Headers",(0,t.jsx)(d.Z,{title:"Forward custom headers from incoming requests to this MCP server (e.g., Authorization, X-Custom-Header, User-Agent)",children:(0,t.jsx)(f.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})}),(null==r?void 0:r.extra_headers)&&r.extra_headers.length>0&&(0,t.jsxs)("span",{className:"ml-2 text-xs bg-blue-100 text-blue-700 px-2 py-1 rounded-full",children:[r.extra_headers.length," configured"]})]}),name:"extra_headers",children:(0,t.jsx)(c.default,{mode:"tags",placeholder:(null==r?void 0:r.extra_headers)&&r.extra_headers.length>0?"Currently: ".concat(r.extra_headers.join(", ")):"Enter header names (e.g., Authorization, X-Custom-Header)",className:"rounded-lg",size:"large",tokenSeparators:[","],allowClear:!0})}),(0,t.jsx)(j.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Static Headers",(0,t.jsx)(d.Z,{title:"Send these key-value headers with every request to this MCP server.",children:(0,t.jsx)(f.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),required:!1,children:(0,t.jsx)(j.Z.List,{name:"static_headers",children:(e,s)=>{let{add:r,remove:l}=s;return(0,t.jsxs)("div",{className:"space-y-3",children:[e.map(e=>{let{key:s,name:r,...a}=e;return(0,t.jsxs)(H.Z,{className:"flex w-full",align:"baseline",size:"middle",children:[(0,t.jsx)(j.Z.Item,{...a,name:[r,"header"],className:"flex-1",rules:[{required:!0,message:"Header name is required"}],children:(0,t.jsx)(v.default,{size:"large",allowClear:!0,className:"rounded-lg",placeholder:"Header name (e.g., X-API-Key)"})}),(0,t.jsx)(j.Z.Item,{...a,name:[r,"value"],className:"flex-1",rules:[{required:!0,message:"Header value is required"}],children:(0,t.jsx)(v.default,{size:"large",allowClear:!0,className:"rounded-lg",placeholder:"Header value"})}),(0,t.jsx)(D.Z,{onClick:()=>l(r),className:"text-gray-500 hover:text-red-500 cursor-pointer"})]},s)}),(0,t.jsx)(E.ZP,{type:"dashed",onClick:()=>r(),icon:(0,t.jsx)(J.Z,{}),block:!0,children:"Add Static Header"})]})}})})]})},"permissions")})};let $=e=>{try{let s=e.indexOf("/mcp/");if(-1===s)return{token:null,baseUrl:e};let r=e.split("/mcp/");if(2!==r.length)return{token:null,baseUrl:e};let t=r[0]+"/mcp/",l=r[1];if(!l)return{token:null,baseUrl:e};return{token:l,baseUrl:t}}catch(s){return console.error("Error parsing MCP URL:",s),{token:null,baseUrl:e}}},W=e=>{let{token:s,baseUrl:r}=$(e);return s?r+"...":e},Q=e=>{let{token:s}=$(e);return{maskedUrl:W(e),hasToken:!!s}},X=e=>e?/^https?:\/\/[^\s/$.?#].[^\s]*$/i.test(e)?Promise.resolve():Promise.reject("Please enter a valid URL (e.g., http://service-name.domain:1234/path or https://example.com)"):Promise.resolve(),ee=e=>e&&e.includes("-")?Promise.reject("Server name cannot contain '-' (hyphen). Please use '_' (underscore) instead."):Promise.resolve(),es=e=>{let s=new Uint8Array(e),r="";return s.forEach(e=>r+=String.fromCharCode(e)),btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")},er=()=>{let e=new Uint8Array(32);return window.crypto.getRandomValues(e),es(e.buffer)},et=async e=>{let s=new TextEncoder().encode(e);return es(await window.crypto.subtle.digest("SHA-256",s))},el=e=>{let{accessToken:s,getCredentials:r,getTemporaryPayload:t,onTokenReceived:l,onBeforeRedirect:a}=e,[n,i]=(0,x.useState)("idle"),[o,c]=(0,x.useState)(null),[d,m]=(0,x.useState)(null),u="litellm-mcp-oauth-flow-state",g="litellm-mcp-oauth-result",j="litellm-mcp-oauth-return-url",v=()=>{try{window.sessionStorage.removeItem(u),window.sessionStorage.removeItem(g),window.sessionStorage.removeItem(j)}catch(e){console.warn("Failed to clear OAuth storage",e)}},f=()=>"".concat(window.location.origin,"/mcp/oauth/callback"),b=(0,x.useCallback)(async()=>{let e=r()||{};if(!s){c("Missing admin token"),h.Z.error("Access token missing. Please re-authenticate and try again.");return}let l=t();if(!l||!l.url||!l.transport){let e="Please complete server URL and transport before starting OAuth.";c(e),h.Z.error(e);return}try{var n,o,d;i("authorizing"),c(null);let r=await (0,p.cacheTemporaryMcpServer)(s,l),t=null==r?void 0:null===(n=r.server_id)||void 0===n?void 0:n.trim();if(!t)throw Error("Temporary MCP server identifier missing. Please retry.");let m={};if(!((null===(o=l.credentials)||void 0===o?void 0:o.client_id)&&(null===(d=l.credentials)||void 0===d?void 0:d.client_secret))){let e=await (0,p.registerMcpOAuthClient)(s,t,{client_name:l.alias||l.server_name||t,grant_types:["authorization_code"],response_types:["code"],token_endpoint_auth_method:l.credentials&&l.credentials.client_secret?"client_secret_post":"none"});m={clientId:null==e?void 0:e.client_id,clientSecret:null==e?void 0:e.client_secret}}let x=er(),h=await et(x),g=crypto.randomUUID(),v=m.clientId||e.client_id,b=Array.isArray(e.scopes)?e.scopes.filter(e=>e&&e.trim().length>0).join(" "):void 0,y=(0,p.buildMcpOAuthAuthorizeUrl)({serverId:t,clientId:v,redirectUri:f(),state:g,codeChallenge:h,scope:b}),N={state:g,codeVerifier:x,clientId:v,clientSecret:m.clientSecret||e.client_secret,serverId:t,redirectUri:f()};if(a)try{a()}catch(e){console.error("Failed to prepare for OAuth redirect",e)}try{window.sessionStorage.setItem(u,JSON.stringify(N)),window.sessionStorage.setItem(j,window.location.href)}catch(e){throw console.error("Unable to persist OAuth state",e),Error("Unable to access browser storage for OAuth. Please enable storage and retry.")}window.location.href=y}catch(s){console.error("Failed to start OAuth flow",s),i("error");let e=s instanceof Error?s.message:String(s);c(e),h.Z.error(e)}},[s,r,t,a]),y=(0,x.useCallback)(async()=>{let e=null,s=null;try{let r=window.sessionStorage.getItem(g);if(!r)return;e=JSON.parse(r),s=JSON.parse(window.sessionStorage.getItem(u)||"null")}catch(e){console.error("Failed to read OAuth session state",e),v(),c("Failed to resume OAuth flow. Please retry."),i("error"),h.Z.error("Failed to resume OAuth flow. Please retry.");return}if(e){window.sessionStorage.removeItem(g);try{if(!s||!s.state||!s.codeVerifier||!s.serverId)throw Error("Missing OAuth session state. Please retry.");if(!e.state||e.state!==s.state)throw Error("OAuth state mismatch. Please retry.");if(e.error)throw Error(e.error_description||e.error);if(!e.code)throw Error("Authorization code missing in callback.");i("exchanging");let r=await (0,p.exchangeMcpOAuthToken)({serverId:s.serverId,code:e.code,clientId:s.clientId,clientSecret:s.clientSecret,codeVerifier:s.codeVerifier,redirectUri:s.redirectUri});l(r),m(r),i("success"),c(null),h.Z.success("OAuth token retrieved successfully")}catch(s){console.error("OAuth flow failed",s);let e=s instanceof Error?s.message:String(s);c(e),i("error"),h.Z.error(e)}finally{v()}}},[l]);return(0,x.useEffect)(()=>{let e=!1;return(async()=>{e||await y()})(),()=>{e=!0}},[y]),{startOAuthFlow:b,status:n,error:o,tokenResponse:d}},ea="".concat("../ui/assets/logos/","mcp_logo.png"),en=[y.API_KEY,y.BEARER_TOKEN,y.BASIC],ei=[...en,y.OAUTH2],eo="litellm-mcp-oauth-create-state";var ec=e=>{var s;let{userRole:r,accessToken:a,onCreateSuccess:n,isModalVisible:i,setModalVisible:o,availableAccessGroups:u}=e,[g]=j.Z.useForm(),[N,_]=(0,x.useState)(!1),[w,Z]=(0,x.useState)({}),[C,S]=(0,x.useState)({}),[k,P]=(0,x.useState)(null),[A,T]=(0,x.useState)(!1),[M,O]=(0,x.useState)([]),[L,E]=(0,x.useState)([]),[z,q]=(0,x.useState)(""),[U,R]=(0,x.useState)(""),[V,H]=(0,x.useState)(null),D=C.auth_type,J=!!D&&en.includes(D),G=D===y.OAUTH2,{startOAuthFlow:$,status:W,error:Q,tokenResponse:es}=el({accessToken:a,getCredentials:()=>g.getFieldValue("credentials"),getTemporaryPayload:()=>{let e=g.getFieldsValue(!0),s=e.url,r=e.transport||z;if(!s||!r)return null;let t=Array.isArray(e.static_headers)?e.static_headers.reduce((e,s)=>{var r,t;let l=null==s?void 0:null===(r=s.header)||void 0===r?void 0:r.trim();return l&&(e[l]=null!==(t=null==s?void 0:s.value)&&void 0!==t?t:""),e},{}):{};return{server_id:void 0,server_name:e.server_name,alias:e.alias,description:e.description,url:s,transport:r,auth_type:y.OAUTH2,credentials:e.credentials,mcp_access_groups:e.mcp_access_groups,static_headers:t,command:e.command,args:e.args,env:e.env}},onTokenReceived:e=>{var s;H(null!==(s=null==e?void 0:e.access_token)&&void 0!==s?s:null)},onBeforeRedirect:()=>{try{let e=g.getFieldsValue(!0);window.sessionStorage.setItem(eo,JSON.stringify({modalVisible:i,formValues:e,transportType:z,costConfig:w,allowedTools:L,searchValue:U,aliasManuallyEdited:A}))}catch(e){console.warn("Failed to persist MCP create state",e)}}});x.useEffect(()=>{let e=window.sessionStorage.getItem(eo);if(e)try{var s;let r=JSON.parse(e);r.modalVisible&&o(!0);let t=(null===(s=r.formValues)||void 0===s?void 0:s.transport)||r.transportType||"";t&&q(t),r.formValues&&P({values:r.formValues,transport:t}),r.costConfig&&Z(r.costConfig),r.allowedTools&&E(r.allowedTools),r.searchValue&&R(r.searchValue),"boolean"==typeof r.aliasManuallyEdited&&T(r.aliasManuallyEdited)}catch(e){console.error("Failed to restore MCP create state",e)}finally{window.sessionStorage.removeItem(eo)}},[g,o]),x.useEffect(()=>{k&&(z||k.transport,(!k.transport||z)&&(g.setFieldsValue(k.values),S(k.values),P(null)))},[k,g,z]);let er=async e=>{_(!0);try{let{static_headers:s,stdio_config:r,credentials:t,...l}=e,i=l.mcp_access_groups,c=Array.isArray(s)?s.reduce((e,s)=>{var r,t;let l=null==s?void 0:null===(r=s.header)||void 0===r?void 0:r.trim();return l&&(e[l]=null!==(t=null==s?void 0:s.value)&&void 0!==t?t:""),e},{}):{},d=t&&"object"==typeof t?Object.entries(t).reduce((e,s)=>{let[r,t]=s;if(null==t||""===t)return e;if("scopes"===r){if(Array.isArray(t)){let s=t.filter(e=>null!=e&&""!==e);s.length>0&&(e[r]=s)}}else e[r]=t;return e},{}):void 0,m={};if(r&&"stdio"===z)try{let e=JSON.parse(r),s=e;if(e.mcpServers&&"object"==typeof e.mcpServers){let r=Object.keys(e.mcpServers);if(r.length>0){let t=r[0];s=e.mcpServers[t],l.server_name||(l.server_name=t.replace(/-/g,"_"))}}m={command:s.command,args:s.args,env:s.env},console.log("Parsed stdio config:",m)}catch(e){h.Z.fromBackend("Invalid JSON in stdio configuration");return}let u={...l,...m,stdio_config:void 0,mcp_info:{server_name:l.server_name||l.url,description:l.description,mcp_server_cost_info:Object.keys(w).length>0?w:null},mcp_access_groups:i,alias:l.alias,allowed_tools:L.length>0?L:null,static_headers:c};if(u.static_headers=c,l.auth_type&&ei.includes(l.auth_type)&&d&&Object.keys(d).length>0&&(u.credentials=d),console.log("Payload: ".concat(JSON.stringify(u))),null!=a){let e=await (0,p.createMCPServer)(a,u);h.Z.success("MCP Server created successfully"),g.resetFields(),Z({}),O([]),E([]),T(!1),o(!1),n(e)}}catch(e){h.Z.fromBackend("Error creating MCP Server: "+e)}finally{_(!1)}},et=()=>{g.resetFields(),Z({}),O([]),E([]),T(!1),o(!1)};return(x.useEffect(()=>{if(!A&&C.server_name){let e=C.server_name.replace(/\s+/g,"_");g.setFieldsValue({alias:e}),S(s=>({...s,alias:e}))}},[C.server_name]),x.useEffect(()=>{i||S({})},[i]),(0,l.tY)(r))?(0,t.jsx)(m.Z,{title:(0,t.jsxs)("div",{className:"flex items-center space-x-3 pb-4 border-b border-gray-100",children:[(0,t.jsx)("img",{src:ea,alt:"MCP Logo",className:"w-8 h-8 object-contain",style:{height:"20px",width:"20px",marginRight:"8px",objectFit:"contain"}}),(0,t.jsx)("h2",{className:"text-xl font-semibold text-gray-900",children:"Add New MCP Server"})]}),open:i,width:1e3,onCancel:et,footer:null,className:"top-8",styles:{body:{padding:"24px"},header:{padding:"24px 24px 0 24px",border:"none"}},children:(0,t.jsx)("div",{className:"mt-6",children:(0,t.jsxs)(j.Z,{form:g,onFinish:er,onValuesChange:(e,s)=>S(s),layout:"vertical",className:"space-y-6",children:[(0,t.jsxs)("div",{className:"grid grid-cols-1 gap-6",children:[(0,t.jsx)(j.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["MCP Server Name",(0,t.jsx)(d.Z,{title:"Best practice: Use a descriptive name that indicates the server's purpose (e.g., 'GitHub_MCP', 'Email_Service'). Hyphens '-' are not allowed; use underscores '_' instead.",children:(0,t.jsx)(f.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"server_name",rules:[{required:!1,message:"Please enter a server name"},{validator:(e,s)=>ee(s)}],children:(0,t.jsx)(b.o,{placeholder:"e.g., GitHub_MCP, Zapier_MCP, etc.",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsx)(j.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Alias",(0,t.jsx)(d.Z,{title:"A short, unique identifier for this server. Defaults to the server name with spaces replaced by underscores.",children:(0,t.jsx)(f.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"alias",rules:[{required:!1},{validator:(e,s)=>s&&s.includes("-")?Promise.reject("Alias cannot contain '-' (hyphen). Please use '_' (underscore) instead."):Promise.resolve()}],children:(0,t.jsx)(b.o,{placeholder:"e.g., GitHub_MCP, Zapier_MCP, etc.",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500",onChange:()=>T(!0)})}),(0,t.jsx)(j.Z.Item,{label:(0,t.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Description"}),name:"description",rules:[{required:!1,message:"Please enter a server description!!!!!!!!!"}],children:(0,t.jsx)(b.o,{placeholder:"Brief description of what this server does",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsx)(j.Z.Item,{label:(0,t.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Transport Type"}),name:"transport",rules:[{required:!0,message:"Please select a transport type"}],children:(0,t.jsxs)(c.default,{placeholder:"Select transport",className:"rounded-lg",size:"large",onChange:e=>{q(e),"stdio"===e?g.setFieldsValue({url:void 0,auth_type:void 0,credentials:void 0}):g.setFieldsValue({command:void 0,args:void 0,env:void 0})},value:z,children:[(0,t.jsx)(c.default.Option,{value:"http",children:"HTTP"}),(0,t.jsx)(c.default.Option,{value:"sse",children:"Server-Sent Events (SSE)"}),(0,t.jsx)(c.default.Option,{value:"stdio",children:"Standard Input/Output (stdio)"})]})}),"stdio"!==z&&(0,t.jsx)(j.Z.Item,{label:(0,t.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"MCP Server URL"}),name:"url",rules:[{required:!0,message:"Please enter a server URL"},{validator:(e,s)=>X(s)}],children:(0,t.jsx)(v.default,{placeholder:"https://your-mcp-server.com",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),"stdio"!==z&&(0,t.jsx)(j.Z.Item,{label:(0,t.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Authentication"}),name:"auth_type",rules:[{required:!0,message:"Please select an auth type"}],children:(0,t.jsxs)(c.default,{placeholder:"Select auth type",className:"rounded-lg",size:"large",children:[(0,t.jsx)(c.default.Option,{value:"none",children:"None"}),(0,t.jsx)(c.default.Option,{value:"api_key",children:"API Key"}),(0,t.jsx)(c.default.Option,{value:"bearer_token",children:"Bearer Token"}),(0,t.jsx)(c.default.Option,{value:"basic",children:"Basic Auth"}),(0,t.jsx)(c.default.Option,{value:"oauth2",children:"OAuth"})]})}),"stdio"!==z&&J&&(0,t.jsx)(j.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Authentication Value",(0,t.jsx)(d.Z,{title:"Token, password, or header value to send with each request for the selected auth type.",children:(0,t.jsx)(f.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","auth_value"],rules:[{required:!0,message:"Please enter the authentication value"}],children:(0,t.jsx)(b.o,{type:"password",placeholder:"Enter token or secret",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),"stdio"!==z&&G&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(j.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["OAuth Client ID (optional)",(0,t.jsx)(d.Z,{title:"Provide only if your MCP server cannot handle dynamic client registration.",children:(0,t.jsx)(f.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","client_id"],children:(0,t.jsx)(b.o,{type:"password",placeholder:"Enter OAuth client ID",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsx)(j.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["OAuth Client Secret (optional)",(0,t.jsx)(d.Z,{title:"Provide only if your MCP server cannot handle dynamic client registration.",children:(0,t.jsx)(f.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","client_secret"],children:(0,t.jsx)(b.o,{type:"password",placeholder:"Enter OAuth client secret",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsx)(j.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["OAuth Scopes (optional)",(0,t.jsx)(d.Z,{title:"Optional scopes requested during token exchange. Separate multiple scopes with enter or commas.",children:(0,t.jsx)(f.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","scopes"],children:(0,t.jsx)(c.default,{mode:"tags",tokenSeparators:[","],placeholder:"Add scopes",className:"rounded-lg",size:"large"})}),(0,t.jsxs)("div",{className:"rounded-lg border border-dashed border-gray-300 p-4 space-y-2",children:[(0,t.jsx)("p",{className:"text-sm text-gray-600",children:"Complete the OAuth authorization flow to fetch an access token and store it as the authentication value."}),(0,t.jsx)(b.z,{variant:"secondary",onClick:$,disabled:"authorizing"===W||"exchanging"===W,children:"authorizing"===W?"Waiting for authorization...":"exchanging"===W?"Exchanging authorization code...":"Authorize & Fetch Token"}),Q&&(0,t.jsx)("p",{className:"text-sm text-red-500",children:Q}),"success"===W&&(null==es?void 0:es.access_token)&&(0,t.jsxs)("p",{className:"text-sm text-green-600",children:["Token fetched. Expires in ",null!==(s=es.expires_in)&&void 0!==s?s:"?"," seconds."]})]})]}),(0,t.jsx)(K,{isVisible:"stdio"===z})]}),(0,t.jsx)("div",{className:"mt-8",children:(0,t.jsx)(Y,{availableAccessGroups:u,mcpServer:null,searchValue:U,setSearchValue:R,getAccessGroupOptions:()=>{let e=u.map(e=>({value:e,label:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:e})]})}));return U&&!u.some(e=>e.toLowerCase().includes(U.toLowerCase()))&&e.push({value:U,label:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:U}),(0,t.jsx)("span",{className:"text-gray-400 text-xs ml-1",children:"create new group"})]})}),e}})}),(0,t.jsx)("div",{className:"mt-8 pt-6 border-t border-gray-200",children:(0,t.jsx)(F,{accessToken:a,oauthAccessToken:V,formValues:C,onToolsLoaded:O})}),(0,t.jsx)("div",{className:"mt-6",children:(0,t.jsx)(B,{accessToken:a,oauthAccessToken:V,formValues:C,allowedTools:L,existingAllowedTools:null,onAllowedToolsChange:E})}),(0,t.jsx)("div",{className:"mt-6",children:(0,t.jsx)(I,{value:w,onChange:Z,tools:M.filter(e=>L.includes(e.name)),disabled:!1})}),(0,t.jsxs)("div",{className:"flex items-center justify-end space-x-3 pt-6 border-t border-gray-100",children:[(0,t.jsx)(b.z,{variant:"secondary",onClick:et,children:"Cancel"}),(0,t.jsx)(b.z,{variant:"primary",loading:N,children:N?"Creating...":"Add MCP Server"})]})]})})}):null},ed=r(5945),em=r(63709),eu=r(12485),ex=r(18135),eh=r(35242),ep=r(29706),eg=r(77991),ej=r(64935),ev=r(30401),ef=r(78867),eb=r(11239),ey=r(54001),eN=r(96137),e_=r(96362),ew=r(80221),eZ=r(29202),eC=r(59872);let{Title:eS,Text:ek}=o.default,{Panel:eP}=C.default,eA=e=>{let{icon:s,title:r,description:l,children:a,serverName:n,accessGroups:i=["dev"]}=e,[o,c]=(0,x.useState)(!1),d=()=>{let e={"x-litellm-api-key":"Bearer YOUR_LITELLM_API_KEY"};if(o&&n){let s=[n.replace(/\s+/g,"_"),...i].join(",");e["x-mcp-servers"]=[s]}return e};return(0,t.jsxs)(ed.Z,{className:"border border-gray-200",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,t.jsx)("span",{className:"p-2 rounded-lg bg-gray-50",children:s}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eS,{level:5,className:"mb-0",children:r}),(0,t.jsx)(ek,{className:"text-gray-600",children:l})]})]}),n&&("Implementation Example"===r||"Configuration"===r)&&(0,t.jsxs)(j.Z.Item,{className:"mb-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,t.jsx)(em.Z,{size:"small",checked:o,onChange:c}),(0,t.jsxs)(ek,{className:"text-sm",children:["Limit tools to specific MCP servers or MCP groups by passing the ",(0,t.jsx)("code",{children:"x-mcp-servers"})," header"]})]}),o&&(0,t.jsx)(L.Z,{className:"mt-2",type:"info",showIcon:!0,message:"Two Options",description:(0,t.jsxs)("div",{children:[(0,t.jsxs)("p",{children:[(0,t.jsx)("strong",{children:"Option 1:"})," Get a specific server: ",(0,t.jsxs)("code",{children:['["',n.replace(/\s+/g,"_"),'"]']})]}),(0,t.jsxs)("p",{children:[(0,t.jsx)("strong",{children:"Option 2:"})," Get a group of MCPs: ",(0,t.jsx)("code",{children:'["dev-group"]'})]}),(0,t.jsxs)("p",{className:"mt-2 text-sm text-gray-600",children:["You can also mix both: ",(0,t.jsx)("code",{children:'["Server1,dev-group"]'})]})]})})]}),x.Children.map(a,e=>{if(x.isValidElement(e)&&e.props.hasOwnProperty("code")&&e.props.hasOwnProperty("copyKey")){let s=e.props.code;if(s&&s.includes('"headers":'))return x.cloneElement(e,{code:s.replace(/"headers":\s*{[^}]*}/,'"headers": '.concat(JSON.stringify(d(),null,8)))})}return e})]})};var eT=e=>{let{currentServerAccessGroups:s=[]}=e,r=(0,p.getProxyBaseUrl)(),[l,a]=(0,x.useState)({}),[n,i]=(0,x.useState)({openai:[],litellm:[],cursor:[],http:[]}),[o]=(0,x.useState)("Zapier_MCP"),c=async(e,s)=>{await (0,eC.vQ)(e)&&(a(e=>({...e,[s]:!0})),setTimeout(()=>{a(e=>({...e,[s]:!1}))},2e3))},d=e=>{let{code:s,copyKey:r,title:a,className:n=""}=e;return(0,t.jsxs)("div",{className:"relative group",children:[a&&(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,t.jsx)(ej.Z,{size:16,className:"text-blue-600"}),(0,t.jsx)(ek,{strong:!0,className:"text-gray-700",children:a})]}),(0,t.jsxs)(ed.Z,{className:"bg-gray-50 border border-gray-200 relative ".concat(n),children:[(0,t.jsx)(E.ZP,{type:"text",size:"small",icon:l[r]?(0,t.jsx)(ev.Z,{size:12}):(0,t.jsx)(ef.Z,{size:12}),onClick:()=>c(s,r),className:"absolute top-2 right-2 z-10 transition-all duration-200 ".concat(l[r]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")}),(0,t.jsx)("pre",{className:"text-sm overflow-x-auto pr-10 text-gray-800 font-mono leading-relaxed",children:s})]})]})},m=e=>{let{step:s,title:r,children:l}=e;return(0,t.jsxs)("div",{className:"flex gap-4",children:[(0,t.jsx)("div",{className:"flex-shrink-0",children:(0,t.jsx)("div",{className:"w-8 h-8 bg-blue-600 text-white rounded-full flex items-center justify-center text-sm font-semibold",children:s})}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)(ek,{strong:!0,className:"text-gray-800 block mb-2",children:r}),l]})]})};return(0,t.jsx)("div",{children:(0,t.jsxs)(H.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(M.Z,{className:"text-3xl font-bold text-gray-900 mb-3",children:"Connect to your MCP client"}),(0,t.jsx)(T.Z,{className:"text-lg text-gray-600",children:"Use tools directly from any MCP client with LiteLLM MCP. Enable your AI assistant to perform real-world tasks through a simple, secure connection."})]}),(0,t.jsxs)(ex.Z,{className:"w-full",children:[(0,t.jsx)(eh.Z,{className:"flex justify-start mt-8 mb-6",children:(0,t.jsxs)("div",{className:"flex bg-gray-100 p-1 rounded-lg",children:[(0,t.jsx)(eu.Z,{className:"px-6 py-3 rounded-md transition-all duration-200",children:(0,t.jsxs)("span",{className:"flex items-center gap-2 font-medium",children:[(0,t.jsx)(ej.Z,{size:18}),"OpenAI API"]})}),(0,t.jsx)(eu.Z,{className:"px-6 py-3 rounded-md transition-all duration-200",children:(0,t.jsxs)("span",{className:"flex items-center gap-2 font-medium",children:[(0,t.jsx)(eb.Z,{size:18}),"LiteLLM Proxy"]})}),(0,t.jsx)(eu.Z,{className:"px-6 py-3 rounded-md transition-all duration-200",children:(0,t.jsxs)("span",{className:"flex items-center gap-2 font-medium",children:[(0,t.jsx)(ew.Z,{size:18}),"Cursor"]})}),(0,t.jsx)(eu.Z,{className:"px-6 py-3 rounded-md transition-all duration-200",children:(0,t.jsxs)("span",{className:"flex items-center gap-2 font-medium",children:[(0,t.jsx)(eZ.Z,{size:18}),"Streamable HTTP"]})})]})}),(0,t.jsxs)(eg.Z,{children:[(0,t.jsx)(ep.Z,{className:"mt-6",children:(0,t.jsx)(()=>(0,t.jsxs)(H.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsxs)("div",{className:"bg-gradient-to-r from-blue-50 to-indigo-50 p-6 rounded-lg border border-blue-100",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,t.jsx)(ej.Z,{className:"text-blue-600",size:24}),(0,t.jsx)(eS,{level:4,className:"mb-0 text-blue-900",children:"OpenAI Responses API Integration"})]}),(0,t.jsx)(ek,{className:"text-blue-700",children:"Connect OpenAI Responses API to your LiteLLM MCP server for seamless tool integration"})]}),(0,t.jsxs)(H.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsx)(eA,{icon:(0,t.jsx)(ey.Z,{className:"text-blue-600",size:16}),title:"API Key Setup",description:"Configure your OpenAI API key for authentication",children:(0,t.jsxs)(H.Z,{direction:"vertical",size:"middle",className:"w-full",children:[(0,t.jsx)("div",{children:(0,t.jsxs)(ek,{children:["Get your API key from the"," ",(0,t.jsxs)("a",{href:"https://platform.openai.com/api-keys",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-700 inline-flex items-center gap-1",children:["OpenAI platform ",(0,t.jsx)(e_.Z,{size:12})]})]})}),(0,t.jsx)(d,{title:"Environment Variable",code:'export OPENAI_API_KEY="sk-..."',copyKey:"openai-env"})]})}),(0,t.jsx)(eA,{icon:(0,t.jsx)(eN.Z,{className:"text-blue-600",size:16}),title:"MCP Server Information",description:"Connection details for your LiteLLM MCP server",children:(0,t.jsx)(d,{title:"Server URL",code:"".concat(r,"/mcp"),copyKey:"openai-server-url"})}),(0,t.jsx)(eA,{icon:(0,t.jsx)(ej.Z,{className:"text-blue-600",size:16}),title:"Implementation Example",description:"Complete cURL example for using the Responses API",serverName:"Zapier Gmail",accessGroups:["dev"],children:(0,t.jsx)(d,{code:'curl --location \'https://api.openai.com/v1/responses\' \\\n--header \'Content-Type: application/json\' \\\n--header "Authorization: Bearer $OPENAI_API_KEY" \\\n--data \'{\n "model": "gpt-4.1",\n "tools": [\n {\n "type": "mcp",\n "server_label": "litellm",\n "server_url": "'.concat(r,'/mcp",\n "require_approval": "never",\n "headers": {\n "x-litellm-api-key": "Bearer YOUR_LITELLM_API_KEY",\n "x-mcp-servers": ["Zapier_MCP,dev"]\n }\n }\n ],\n "input": "Run available tools",\n "tool_choice": "required"\n}\''),copyKey:"openai-curl",className:"text-xs"})})]})]}),{})}),(0,t.jsx)(ep.Z,{className:"mt-6",children:(0,t.jsx)(()=>(0,t.jsxs)(H.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsxs)("div",{className:"bg-gradient-to-r from-emerald-50 to-green-50 p-6 rounded-lg border border-emerald-100",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,t.jsx)(eb.Z,{className:"text-emerald-600",size:24}),(0,t.jsx)(eS,{level:4,className:"mb-0 text-emerald-900",children:"LiteLLM Proxy API Integration"})]}),(0,t.jsx)(ek,{className:"text-emerald-700",children:"Connect to LiteLLM Proxy Responses API for seamless tool integration with multiple model providers"})]}),(0,t.jsxs)(H.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsx)(eA,{icon:(0,t.jsx)(ey.Z,{className:"text-emerald-600",size:16}),title:"Virtual Key Setup",description:"Configure your LiteLLM Proxy Virtual Key for authentication",children:(0,t.jsxs)(H.Z,{direction:"vertical",size:"middle",className:"w-full",children:[(0,t.jsx)("div",{children:(0,t.jsx)(ek,{children:"Get your Virtual Key from your LiteLLM Proxy dashboard or contact your administrator"})}),(0,t.jsx)(d,{title:"Environment Variable",code:'export LITELLM_API_KEY="sk-..."',copyKey:"litellm-env"})]})}),(0,t.jsx)(eA,{icon:(0,t.jsx)(eN.Z,{className:"text-emerald-600",size:16}),title:"MCP Server Information",description:"Connection details for your LiteLLM MCP server",children:(0,t.jsx)(d,{title:"Server URL",code:"".concat(r,"/mcp"),copyKey:"litellm-server-url"})}),(0,t.jsx)(eA,{icon:(0,t.jsx)(ej.Z,{className:"text-emerald-600",size:16}),title:"Implementation Example",description:"Complete cURL example for using the LiteLLM Proxy Responses API",serverName:o,accessGroups:["dev"],children:(0,t.jsx)(d,{code:"curl --location '".concat(r,'/v1/responses\' \\\n--header \'Content-Type: application/json\' \\\n--header "Authorization: Bearer $LITELLM_VIRTUAL_KEY" \\\n--data \'{\n "model": "gpt-4",\n "tools": [\n {\n "type": "mcp",\n "server_label": "litellm",\n "server_url": "').concat(r,'/mcp",\n "require_approval": "never",\n "headers": {\n "x-litellm-api-key": "Bearer YOUR_LITELLM_VIRTUAL_KEY",\n "x-mcp-servers": ["Zapier_MCP,dev"]\n }\n }\n ],\n "input": "Run available tools",\n "tool_choice": "required"\n}\''),copyKey:"litellm-curl",className:"text-xs"})})]})]}),{})}),(0,t.jsx)(ep.Z,{className:"mt-6",children:(0,t.jsx)(()=>(0,t.jsxs)(H.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsxs)("div",{className:"bg-gradient-to-r from-purple-50 to-blue-50 p-6 rounded-lg border border-purple-100",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,t.jsx)(ew.Z,{className:"text-purple-600",size:24}),(0,t.jsx)(eS,{level:4,className:"mb-0 text-purple-900",children:"Cursor IDE Integration"})]}),(0,t.jsx)(ek,{className:"text-purple-700",children:"Use tools directly from Cursor IDE with LiteLLM MCP. Enable your AI assistant to perform real-world tasks without leaving your coding environment."})]}),(0,t.jsxs)(ed.Z,{className:"border border-gray-200",children:[(0,t.jsx)(eS,{level:5,className:"mb-4 text-gray-800",children:"Setup Instructions"}),(0,t.jsxs)(H.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsx)(m,{step:1,title:"Open Cursor Settings",children:(0,t.jsxs)(ek,{className:"text-gray-600",children:["Use the keyboard shortcut ",(0,t.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded",children:"⇧+⌘+J"})," (Mac) or"," ",(0,t.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded",children:"Ctrl+Shift+J"})," (Windows/Linux)"]})}),(0,t.jsx)(m,{step:2,title:"Navigate to MCP Tools",children:(0,t.jsx)(ek,{className:"text-gray-600",children:'Go to the "MCP Tools" tab and click "New MCP Server"'})}),(0,t.jsxs)(m,{step:3,title:"Add Configuration",children:[(0,t.jsxs)(ek,{className:"text-gray-600 mb-3",children:["Copy the JSON configuration below and paste it into Cursor, then save with"," ",(0,t.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded",children:"Cmd+S"})," or"," ",(0,t.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded",children:"Ctrl+S"})]}),(0,t.jsx)(eA,{icon:(0,t.jsx)(ej.Z,{className:"text-purple-600",size:16}),title:"Configuration",description:"Cursor MCP configuration",serverName:"Zapier Gmail",accessGroups:["dev"],children:(0,t.jsx)(d,{code:'{\n "mcpServers": {\n "Zapier_MCP": {\n "url": "'.concat(r,'/mcp",\n "headers": {\n "x-litellm-api-key": "Bearer YOUR_LITELLM_API_KEY",\n "x-mcp-servers": ["Zapier_MCP,dev"]\n }\n }\n }\n}'),copyKey:"cursor-config",className:"text-xs"})})]})]})]})]}),{})}),(0,t.jsx)(ep.Z,{className:"mt-6",children:(0,t.jsx)(()=>(0,t.jsxs)(H.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsxs)("div",{className:"bg-gradient-to-r from-green-50 to-teal-50 p-6 rounded-lg border border-green-100",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,t.jsx)(eZ.Z,{className:"text-green-600",size:24}),(0,t.jsx)(eS,{level:4,className:"mb-0 text-green-900",children:"Streamable HTTP Transport"})]}),(0,t.jsx)(ek,{className:"text-green-700",children:"Connect to LiteLLM MCP using HTTP transport. Compatible with any MCP client that supports HTTP streaming."})]}),(0,t.jsx)(eA,{icon:(0,t.jsx)(eZ.Z,{className:"text-green-600",size:16}),title:"Universal MCP Connection",description:"Use this URL with any MCP client that supports HTTP transport",children:(0,t.jsxs)(H.Z,{direction:"vertical",size:"middle",className:"w-full",children:[(0,t.jsx)("div",{children:(0,t.jsx)(ek,{children:"Each MCP client supports different transports. Refer to your client documentation to determine the appropriate transport method."})}),(0,t.jsx)(d,{title:"Server URL",code:"".concat(r,"/mcp"),copyKey:"http-server-url"}),(0,t.jsx)(d,{title:"Headers Configuration",code:JSON.stringify({"x-litellm-api-key":"Bearer YOUR_LITELLM_API_KEY"},null,2),copyKey:"http-headers"}),(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(E.ZP,{type:"link",className:"p-0 h-auto text-blue-600 hover:text-blue-700",href:"https://modelcontextprotocol.io/docs/concepts/transports",icon:(0,t.jsx)(e_.Z,{size:14}),children:"Learn more about MCP transports"})})]})})]}),{})})]})]})]})})},eM=r(58927),eI=r(53410),eO=r(74998);let eL=(e,s,r,l)=>[{accessorKey:"server_id",header:"Server ID",cell:e=>{let{row:r}=e;return(0,t.jsxs)("button",{onClick:()=>s(r.original.server_id),className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[15ch]",children:[r.original.server_id.slice(0,7),"..."]})}},{accessorKey:"server_name",header:"Name"},{accessorKey:"alias",header:"Alias"},{id:"url",header:"URL",cell:e=>{let{row:s}=e,{maskedUrl:r}=Q(s.original.url);return(0,t.jsx)("span",{className:"font-mono text-sm",children:r})}},{accessorKey:"transport",header:"Transport",cell:e=>{let{getValue:s}=e;return(0,t.jsx)("span",{children:(s()||"http").toUpperCase()})}},{accessorKey:"auth_type",header:"Auth Type",cell:e=>{let{getValue:s}=e;return(0,t.jsx)("span",{children:s()||"none"})}},{id:"health_status",header:"Health Status",cell:e=>{let{row:s}=e,r=s.original,l=r.status||"unknown",a=r.last_health_check,n=r.health_check_error,i=(0,t.jsxs)("div",{className:"max-w-xs",children:[(0,t.jsxs)("div",{className:"font-semibold mb-1",children:["Health Status: ",l]}),a&&(0,t.jsxs)("div",{className:"text-xs mb-1",children:["Last Check: ",new Date(a).toLocaleString()]}),n&&(0,t.jsxs)("div",{className:"text-xs",children:[(0,t.jsx)("div",{className:"font-medium text-red-400 mb-1",children:"Error:"}),(0,t.jsx)("div",{className:"break-words",children:n})]}),!a&&!n&&(0,t.jsx)("div",{className:"text-xs text-gray-400",children:"No health check data available"})]});return(0,t.jsx)(d.Z,{title:i,placement:"top",children:(0,t.jsxs)("button",{className:"font-mono text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[10ch] ".concat((e=>{switch(e){case"healthy":return"text-green-500 bg-green-50 hover:bg-green-100";case"unhealthy":return"text-red-500 bg-red-50 hover:bg-red-100";default:return"text-gray-500 bg-gray-50 hover:bg-gray-100"}})(l)),children:[(0,t.jsx)("span",{className:"mr-1",children:"●"}),l.charAt(0).toUpperCase()+l.slice(1)]})})}},{id:"mcp_access_groups",header:"Access Groups",cell:e=>{let{row:s}=e,r=s.original.mcp_access_groups;if(Array.isArray(r)&&r.length>0&&"string"==typeof r[0]){let e=r.join(", ");return(0,t.jsx)(d.Z,{title:e,children:(0,t.jsx)("span",{className:"max-w-[200px] truncate block",children:e.length>30?"".concat(e.slice(0,30),"..."):e})})}return(0,t.jsx)("span",{className:"text-gray-400 italic",children:"None"})}},{header:"Created At",accessorKey:"created_at",sortingFn:"datetime",cell:e=>{let{row:s}=e,r=s.original;return(0,t.jsx)("span",{className:"text-xs",children:r.created_at?new Date(r.created_at).toLocaleDateString():"-"})}},{header:"Updated At",accessorKey:"updated_at",sortingFn:"datetime",cell:e=>{let{row:s}=e,r=s.original;return(0,t.jsx)("span",{className:"text-xs",children:r.updated_at?new Date(r.updated_at).toLocaleDateString():"-"})}},{id:"actions",header:"Actions",cell:e=>{let{row:s}=e;return(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(d.Z,{title:"Edit MCP Server",children:(0,t.jsx)(eM.J,{icon:eI.Z,size:"sm",onClick:()=>r(s.original.server_id),className:"cursor-pointer hover:text-blue-600"})}),(0,t.jsx)(d.Z,{title:"Delete MCP Server",children:(0,t.jsx)(eM.J,{icon:eO.Z,size:"sm",onClick:()=>l(s.original.server_id),className:"cursor-pointer hover:text-red-600"})})]})}}];var eE=r(10900),ez=r(82376),eq=r(71437),eU=r(78489),eR=r(67101),eF=r(47323),eV=r(49566);let eB=[y.API_KEY,y.BEARER_TOKEN,y.BASIC],eK=[...eB,y.OAUTH2],eH="litellm-mcp-oauth-edit-state";var eD=e=>{var s;let{mcpServer:r,accessToken:l,onCancel:a,onSuccess:n,availableAccessGroups:i}=e,[o]=j.Z.useForm(),[m,u]=(0,x.useState)({}),[g,v]=(0,x.useState)([]),[b,N]=(0,x.useState)(!1),[_,w]=(0,x.useState)(""),[Z,C]=(0,x.useState)(!1),[S,k]=(0,x.useState)([]),[P,A]=(0,x.useState)(null),T=j.Z.useWatch("auth_type",o),M=!!T&&eB.includes(T),O=T===y.OAUTH2,[L,z]=(0,x.useState)(null),{startOAuthFlow:q,status:U,error:R,tokenResponse:F}=el({accessToken:l,getCredentials:()=>o.getFieldValue("credentials"),getTemporaryPayload:()=>{let e=o.getFieldsValue(!0),s=e.url||r.url,t=e.transport||r.transport;if(!s||!t)return null;let l=Array.isArray(e.static_headers)?e.static_headers.reduce((e,s)=>{var r,t;let l=null==s?void 0:null===(r=s.header)||void 0===r?void 0:r.trim();return l&&(e[l]=null!==(t=null==s?void 0:s.value)&&void 0!==t?t:""),e},{}):{};return{server_id:r.server_id,server_name:e.server_name||r.server_name||r.alias,alias:e.alias||r.alias,description:e.description||r.description,url:s,transport:t,auth_type:y.OAUTH2,credentials:e.credentials,mcp_access_groups:e.mcp_access_groups||r.mcp_access_groups,static_headers:l,command:e.command,args:e.args,env:e.env}},onTokenReceived:e=>{var s;z(null!==(s=null==e?void 0:e.access_token)&&void 0!==s?s:null)},onBeforeRedirect:()=>{try{let e=o.getFieldsValue(!0);window.sessionStorage.setItem(eH,JSON.stringify({serverId:r.server_id,formValues:e,costConfig:m,allowedTools:S,searchValue:_,aliasManuallyEdited:Z}))}catch(e){console.warn("Failed to persist MCP edit state",e)}}}),V=x.useMemo(()=>r.static_headers?Object.entries(r.static_headers).map(e=>{let[s,r]=e;return{header:s,value:null!=r?String(r):""}}):[],[r.static_headers]),K=x.useMemo(()=>({...r,static_headers:V}),[r,V]);(0,x.useEffect)(()=>{var e;(null===(e=r.mcp_info)||void 0===e?void 0:e.mcp_server_cost_info)&&u(r.mcp_info.mcp_server_cost_info)},[r]),(0,x.useEffect)(()=>{r.allowed_tools&&k(r.allowed_tools)},[r]),(0,x.useEffect)(()=>{let e=window.sessionStorage.getItem(eH);if(e)try{let s=JSON.parse(e);if(!s||s.serverId!==r.server_id)return;s.formValues&&A({...r,...s.formValues}),s.costConfig&&u(s.costConfig),s.allowedTools&&k(s.allowedTools),s.searchValue&&w(s.searchValue),"boolean"==typeof s.aliasManuallyEdited&&C(s.aliasManuallyEdited)}catch(e){console.error("Failed to restore MCP edit state",e)}finally{window.sessionStorage.removeItem(eH)}},[o,r]),(0,x.useEffect)(()=>{if(!P)return;let e=P.transport||r.transport;if(e&&e!==o.getFieldValue("transport")){o.setFieldsValue({transport:e});return}o.setFieldsValue(P),A(null)},[P,o,r.transport]),(0,x.useEffect)(()=>{if(r.mcp_access_groups){let e=r.mcp_access_groups.map(e=>"string"==typeof e?e:e.name||String(e));o.setFieldValue("mcp_access_groups",e)}},[r]),(0,x.useEffect)(()=>{H()},[r,l,L]);let H=async()=>{if(l&&r.url&&(r.auth_type!==y.OAUTH2||L)){N(!0);try{let e={server_id:r.server_id,server_name:r.server_name,url:r.url,transport:r.transport,auth_type:r.auth_type,mcp_info:r.mcp_info},s=await (0,p.testMCPToolsListRequest)(l,e,L);s.tools&&!s.error?v(s.tools):(console.error("Failed to fetch tools:",s.message),v([]))}catch(e){console.error("Tools fetch error:",e),v([])}finally{N(!1)}}},D=async e=>{if(l)try{let{static_headers:s,credentials:t,...a}=e,i=(a.mcp_access_groups||[]).map(e=>"string"==typeof e?e:e.name||String(e)),o=Array.isArray(s)?s.reduce((e,s)=>{var r,t;let l=null==s?void 0:null===(r=s.header)||void 0===r?void 0:r.trim();return l&&(e[l]=null!==(t=null==s?void 0:s.value)&&void 0!==t?t:""),e},{}):{},c=t&&"object"==typeof t?Object.entries(t).reduce((e,s)=>{let[r,t]=s;if(null==t||""===t)return e;if("scopes"===r){if(Array.isArray(t)){let s=t.filter(e=>null!=e&&""!==e);s.length>0&&(e[r]=s)}}else e[r]=t;return e},{}):void 0,d={...a,server_id:r.server_id,mcp_info:{server_name:a.server_name||a.url,description:a.description,mcp_server_cost_info:Object.keys(m).length>0?m:null},mcp_access_groups:i,alias:a.alias,extra_headers:a.extra_headers||[],allowed_tools:S.length>0?S:null,disallowed_tools:a.disallowed_tools||[],static_headers:o};a.auth_type&&eK.includes(a.auth_type)&&c&&Object.keys(c).length>0&&(d.credentials=c);let u=await (0,p.updateMCPServer)(l,d);h.Z.success("MCP Server updated successfully"),n(u)}catch(e){h.Z.fromBackend("Failed to update MCP Server"+((null==e?void 0:e.message)?": ".concat(e.message):""))}};return(0,t.jsxs)(ex.Z,{children:[(0,t.jsxs)(eh.Z,{className:"grid w-full grid-cols-2",children:[(0,t.jsx)(eu.Z,{children:"Server Configuration"}),(0,t.jsx)(eu.Z,{children:"Cost Configuration"})]}),(0,t.jsxs)(eg.Z,{className:"mt-6",children:[(0,t.jsx)(ep.Z,{children:(0,t.jsxs)(j.Z,{form:o,onFinish:D,initialValues:K,layout:"vertical",children:[(0,t.jsx)(j.Z.Item,{label:"MCP Server Name",name:"server_name",rules:[{validator:(e,s)=>ee(s)}],children:(0,t.jsx)(eV.Z,{})}),(0,t.jsx)(j.Z.Item,{label:"Alias",name:"alias",rules:[{validator:(e,s)=>ee(s)}],children:(0,t.jsx)(eV.Z,{onChange:()=>C(!0)})}),(0,t.jsx)(j.Z.Item,{label:"Description",name:"description",children:(0,t.jsx)(eV.Z,{})}),(0,t.jsx)(j.Z.Item,{label:"MCP Server URL",name:"url",rules:[{required:!0,message:"Please enter a server URL"},{validator:(e,s)=>X(s)}],children:(0,t.jsx)(eV.Z,{})}),(0,t.jsx)(j.Z.Item,{label:"Transport Type",name:"transport",rules:[{required:!0}],children:(0,t.jsxs)(c.default,{children:[(0,t.jsx)(c.default.Option,{value:"sse",children:"Server-Sent Events (SSE)"}),(0,t.jsx)(c.default.Option,{value:"http",children:"HTTP"})]})}),(0,t.jsx)(j.Z.Item,{label:"Authentication",name:"auth_type",rules:[{required:!0}],children:(0,t.jsxs)(c.default,{children:[(0,t.jsx)(c.default.Option,{value:"none",children:"None"}),(0,t.jsx)(c.default.Option,{value:"api_key",children:"API Key"}),(0,t.jsx)(c.default.Option,{value:"bearer_token",children:"Bearer Token"}),(0,t.jsx)(c.default.Option,{value:"basic",children:"Basic Auth"}),(0,t.jsx)(c.default.Option,{value:"oauth2",children:"OAuth"})]})}),M&&(0,t.jsx)(j.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Authentication Value",(0,t.jsx)(d.Z,{title:"Token, password, or header value to send with each request for the selected auth type.",children:(0,t.jsx)(f.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","auth_value"],rules:[{validator:(e,s)=>s&&"string"==typeof s&&""===s.trim()?Promise.reject(Error("Authentication value cannot be empty")):Promise.resolve()}],children:(0,t.jsx)(eV.Z,{type:"password",placeholder:"Enter token or secret (leave blank to keep existing)",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),O&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(j.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["OAuth Client ID (optional)",(0,t.jsx)(d.Z,{title:"Provide only if your MCP server cannot handle dynamic client registration.",children:(0,t.jsx)(f.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","client_id"],children:(0,t.jsx)(eV.Z,{type:"password",placeholder:"Enter OAuth client ID (leave blank to keep existing)",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsx)(j.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["OAuth Client Secret (optional)",(0,t.jsx)(d.Z,{title:"Provide only if your MCP server cannot handle dynamic client registration.",children:(0,t.jsx)(f.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","client_secret"],children:(0,t.jsx)(eV.Z,{type:"password",placeholder:"Enter OAuth client secret (leave blank to keep existing)",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsx)(j.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["OAuth Scopes (optional)",(0,t.jsx)(d.Z,{title:"Add scopes to override the default scope list used for this MCP server.",children:(0,t.jsx)(f.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","scopes"],children:(0,t.jsx)(c.default,{mode:"tags",tokenSeparators:[","],placeholder:"Add scopes",className:"rounded-lg",size:"large"})}),(0,t.jsxs)("div",{className:"rounded-lg border border-dashed border-gray-300 p-4 space-y-2",children:[(0,t.jsx)("p",{className:"text-sm text-gray-600",children:"Use OAuth to fetch a fresh access token and save it as the authentication value."}),(0,t.jsx)(eU.Z,{variant:"secondary",onClick:q,disabled:"authorizing"===U||"exchanging"===U,children:"authorizing"===U?"Waiting for authorization...":"exchanging"===U?"Exchanging authorization code...":"Authorize & Fetch Token"}),R&&(0,t.jsx)("p",{className:"text-sm text-red-500",children:R}),"success"===U&&(null==F?void 0:F.access_token)&&(0,t.jsxs)("p",{className:"text-sm text-green-600",children:["Token fetched. Expires in ",null!==(s=F.expires_in)&&void 0!==s?s:"?"," seconds."]})]})]}),(0,t.jsx)("div",{className:"mt-6",children:(0,t.jsx)(Y,{availableAccessGroups:i,mcpServer:r,searchValue:_,setSearchValue:w,getAccessGroupOptions:()=>{let e=i.map(e=>({value:e,label:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:e})]})}));return _&&!i.some(e=>e.toLowerCase().includes(_.toLowerCase()))&&e.push({value:_,label:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:_}),(0,t.jsx)("span",{className:"text-gray-400 text-xs ml-1",children:"create new group"})]})}),e}})}),(0,t.jsx)("div",{className:"mt-6",children:(0,t.jsx)(B,{accessToken:l,oauthAccessToken:L,formValues:{server_id:r.server_id,server_name:r.server_name,url:r.url,transport:r.transport,auth_type:r.auth_type,mcp_info:r.mcp_info},allowedTools:S,existingAllowedTools:r.allowed_tools||null,onAllowedToolsChange:k})}),(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)(E.ZP,{onClick:a,children:"Cancel"}),(0,t.jsx)(eU.Z,{type:"submit",children:"Save Changes"})]})]})}),(0,t.jsx)(ep.Z,{children:(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsx)(I,{value:m,onChange:u,tools:g,disabled:b}),(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)(E.ZP,{onClick:a,children:"Cancel"}),(0,t.jsx)(eU.Z,{onClick:()=>o.submit(),children:"Save Changes"})]})]})})]})]})},eJ=r(92280),eG=e=>{let{costConfig:s}=e,r=(null==s?void 0:s.default_cost_per_query)!==void 0&&(null==s?void 0:s.default_cost_per_query)!==null,l=(null==s?void 0:s.tool_name_to_cost_per_query)&&Object.keys(s.tool_name_to_cost_per_query).length>0;return r||l?(0,t.jsx)("div",{className:"mt-6 pt-6 border-t border-gray-200",children:(0,t.jsxs)("div",{className:"space-y-4",children:[r&&(null==s?void 0:s.default_cost_per_query)!==void 0&&(null==s?void 0:s.default_cost_per_query)!==null&&(0,t.jsxs)("div",{children:[(0,t.jsx)(eJ.x,{className:"font-medium",children:"Default Cost per Query"}),(0,t.jsxs)("div",{className:"text-green-600 font-mono",children:["$",s.default_cost_per_query.toFixed(4)]})]}),l&&(null==s?void 0:s.tool_name_to_cost_per_query)&&(0,t.jsxs)("div",{children:[(0,t.jsx)(eJ.x,{className:"font-medium",children:"Tool-Specific Costs"}),(0,t.jsx)("div",{className:"mt-2 space-y-2",children:Object.entries(s.tool_name_to_cost_per_query).map(e=>{let[s,r]=e;return null!=r&&(0,t.jsxs)("div",{className:"flex justify-between items-center p-3 bg-gray-50 rounded-lg",children:[(0,t.jsx)(eJ.x,{className:"font-medium",children:s}),(0,t.jsxs)(eJ.x,{className:"text-green-600 font-mono",children:["$",r.toFixed(4)," per query"]})]},s)})})]}),(0,t.jsxs)("div",{className:"mt-4 p-4 bg-blue-50 border border-blue-200 rounded-lg",children:[(0,t.jsx)(eJ.x,{className:"text-blue-800 font-medium",children:"Cost Summary:"}),(0,t.jsxs)("div",{className:"mt-2 space-y-1",children:[r&&(null==s?void 0:s.default_cost_per_query)!==void 0&&(null==s?void 0:s.default_cost_per_query)!==null&&(0,t.jsxs)(eJ.x,{className:"text-blue-700",children:["• Default cost: $",s.default_cost_per_query.toFixed(4)," per query"]}),l&&(null==s?void 0:s.tool_name_to_cost_per_query)&&(0,t.jsxs)(eJ.x,{className:"text-blue-700",children:["• ",Object.keys(s.tool_name_to_cost_per_query).length," tool(s) with custom pricing"]})]})]})]})}):(0,t.jsx)("div",{className:"mt-6 pt-6 border-t border-gray-200",children:(0,t.jsx)("div",{className:"space-y-4",children:(0,t.jsx)("div",{className:"p-4 bg-gray-50 border border-gray-200 rounded-lg",children:(0,t.jsx)(eJ.x,{className:"text-gray-600",children:"No cost configuration set for this server. Tool calls will be charged at $0.00 per tool call."})})})})};let eY=e=>{var s,r,l,a,n;let{mcpServer:i,onBack:o,isEditing:c,isProxyAdmin:d,accessToken:m,userRole:u,userID:h,availableAccessGroups:p}=e,[g,j]=(0,x.useState)(c),[v,f]=(0,x.useState)(!1),[b,y]=(0,x.useState)({}),{maskedUrl:N,hasToken:Z}=Q(i.url),C=(e,s)=>Z?s?e:N:e,S=async(e,s)=>{await (0,eC.vQ)(e)&&(y(e=>({...e,[s]:!0})),setTimeout(()=>{y(e=>({...e,[s]:!1}))},2e3))};return(0,t.jsxs)("div",{className:"p-4 max-w-full",children:[(0,t.jsx)("div",{className:"flex justify-between items-center mb-6",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(eU.Z,{icon:eE.Z,variant:"light",className:"mb-4",onClick:o,children:"Back to All Servers"}),(0,t.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)(M.Z,{children:i.server_name}),(0,t.jsx)(E.ZP,{type:"text",size:"small",icon:b["mcp-server_name"]?(0,t.jsx)(ev.Z,{size:12}):(0,t.jsx)(ef.Z,{size:12}),onClick:()=>S(i.server_name,"mcp-server_name"),className:"left-2 z-10 transition-all duration-200 ".concat(b["mcp-server_name"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")}),i.alias&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"ml-4 text-gray-500",children:"Alias:"}),(0,t.jsx)("span",{className:"ml-1 font-mono text-blue-600",children:i.alias}),(0,t.jsx)(E.ZP,{type:"text",size:"small",icon:b["mcp-alias"]?(0,t.jsx)(ev.Z,{size:12}):(0,t.jsx)(ef.Z,{size:12}),onClick:()=>S(i.alias,"mcp-alias"),className:"left-2 z-10 transition-all duration-200 ".concat(b["mcp-alias"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]}),(0,t.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)(T.Z,{className:"text-gray-500 font-mono",children:i.server_id}),(0,t.jsx)(E.ZP,{type:"text",size:"small",icon:b["mcp-server-id"]?(0,t.jsx)(ev.Z,{size:12}):(0,t.jsx)(ef.Z,{size:12}),onClick:()=>S(i.server_id,"mcp-server-id"),className:"left-2 z-10 transition-all duration-200 ".concat(b["mcp-server-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]})}),(0,t.jsxs)(ex.Z,{defaultIndex:g?2:0,children:[(0,t.jsx)(eh.Z,{className:"mb-4",children:[(0,t.jsx)(eu.Z,{children:"Overview"},"overview"),(0,t.jsx)(eu.Z,{children:"MCP Tools"},"tools"),...d?[(0,t.jsx)(eu.Z,{children:"Settings"},"settings")]:[]]}),(0,t.jsxs)(eg.Z,{children:[(0,t.jsxs)(ep.Z,{children:[(0,t.jsxs)(eR.Z,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,t.jsxs)(A.Z,{children:[(0,t.jsx)(T.Z,{children:"Transport"}),(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)(M.Z,{children:_(null!==(a=i.transport)&&void 0!==a?a:void 0)})})]}),(0,t.jsxs)(A.Z,{children:[(0,t.jsx)(T.Z,{children:"Auth Type"}),(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)(T.Z,{children:w(null!==(n=i.auth_type)&&void 0!==n?n:void 0)})})]}),(0,t.jsxs)(A.Z,{children:[(0,t.jsx)(T.Z,{children:"Host Url"}),(0,t.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,t.jsx)(T.Z,{className:"break-all overflow-wrap-anywhere",children:C(i.url,v)}),Z&&(0,t.jsx)("button",{onClick:()=>f(!v),className:"p-1 hover:bg-gray-100 rounded",children:(0,t.jsx)(eF.Z,{icon:v?ez.Z:eq.Z,size:"sm",className:"text-gray-500"})})]})]})]}),(0,t.jsxs)(A.Z,{className:"mt-2",children:[(0,t.jsx)(M.Z,{children:"Cost Configuration"}),(0,t.jsx)(eG,{costConfig:null===(s=i.mcp_info)||void 0===s?void 0:s.mcp_server_cost_info})]})]}),(0,t.jsx)(ep.Z,{children:(0,t.jsx)(e4,{serverId:i.server_id,accessToken:m,auth_type:i.auth_type,userRole:u,userID:h,serverAlias:i.alias})}),(0,t.jsx)(ep.Z,{children:(0,t.jsxs)(A.Z,{children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsx)(M.Z,{children:"MCP Server Settings"}),g?null:(0,t.jsx)(eU.Z,{variant:"light",onClick:()=>j(!0),children:"Edit Settings"})]}),g?(0,t.jsx)(eD,{mcpServer:i,accessToken:m,onCancel:()=>j(!1),onSuccess:e=>{j(!1),o()},availableAccessGroups:p}):(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(T.Z,{className:"font-medium",children:"Server Name"}),(0,t.jsx)("div",{children:i.server_name})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(T.Z,{className:"font-medium",children:"Alias"}),(0,t.jsx)("div",{children:i.alias})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(T.Z,{className:"font-medium",children:"Description"}),(0,t.jsx)("div",{children:i.description})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(T.Z,{className:"font-medium",children:"URL"}),(0,t.jsxs)("div",{className:"font-mono break-all overflow-wrap-anywhere max-w-full flex items-center gap-2",children:[C(i.url,v),Z&&(0,t.jsx)("button",{onClick:()=>f(!v),className:"p-1 hover:bg-gray-100 rounded",children:(0,t.jsx)(eF.Z,{icon:v?ez.Z:eq.Z,size:"sm",className:"text-gray-500"})})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(T.Z,{className:"font-medium",children:"Transport"}),(0,t.jsx)("div",{children:_(i.transport)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(T.Z,{className:"font-medium",children:"Extra Headers"}),(0,t.jsx)("div",{children:null===(r=i.extra_headers)||void 0===r?void 0:r.join(", ")})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(T.Z,{className:"font-medium",children:"Auth Type"}),(0,t.jsx)("div",{children:w(i.auth_type)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(T.Z,{className:"font-medium",children:"Access Groups"}),(0,t.jsx)("div",{children:i.mcp_access_groups&&i.mcp_access_groups.length>0?(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:i.mcp_access_groups.map((e,s)=>{var r;return(0,t.jsx)("span",{className:"px-2 py-1 bg-gray-100 rounded-md text-sm",children:"string"==typeof e?e:null!==(r=null==e?void 0:e.name)&&void 0!==r?r:""},s)})}):(0,t.jsx)(T.Z,{className:"text-gray-500",children:"No access groups defined"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(T.Z,{className:"font-medium",children:"Allowed Tools"}),(0,t.jsx)("div",{children:i.allowed_tools&&i.allowed_tools.length>0?(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:i.allowed_tools.map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-blue-50 border border-blue-200 rounded-md text-sm",children:e},s))}):(0,t.jsx)(T.Z,{className:"text-gray-500",children:"All tools enabled"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(T.Z,{className:"font-medium",children:"Cost Configuration"}),(0,t.jsx)(eG,{costConfig:null===(l=i.mcp_info)||void 0===l?void 0:l.mcp_server_cost_info})]})]})]})})]})]})]})},{Text:e$,Title:eW}=o.default,{Option:eQ}=c.default;var eX=e=>{let{accessToken:s,userRole:r,userID:o}=e,{data:j,isLoading:v,refetch:f,dataUpdatedAt:b}=(0,n.a)({queryKey:["mcpServers"],queryFn:()=>{if(!s)throw Error("Access Token required");return(0,p.fetchMCPServers)(s)},enabled:!!s});x.useEffect(()=>{j&&(console.log("MCP Servers fetched:",j),j.forEach(e=>{console.log("Server: ".concat(e.server_name||e.server_id)),console.log(" allowed_tools:",e.allowed_tools)}))},[j]);let[y,N]=(0,x.useState)(null),[_,w]=(0,x.useState)(!1),[Z,C]=(0,x.useState)(null),[S,k]=(0,x.useState)(!1),[P,A]=(0,x.useState)("all"),[T,M]=(0,x.useState)("all"),[I,O]=(0,x.useState)([]),[L,E]=(0,x.useState)(!1),[z,q]=(0,x.useState)(!1),U="Internal User"===r;(0,x.useEffect)(()=>{try{let e=window.sessionStorage.getItem("litellm-mcp-oauth-edit-state");if(!e)return;let s=JSON.parse(e);(null==s?void 0:s.serverId)&&(C(s.serverId),k(!0))}catch(e){console.error("Failed to restore MCP edit view state",e)}},[]);let R=x.useMemo(()=>{if(!j)return[];let e=new Set,s=[];return j.forEach(r=>{r.teams&&r.teams.forEach(r=>{let t=r.team_id;e.has(t)||(e.add(t),s.push(r))})}),s},[j]),F=x.useMemo(()=>j?Array.from(new Set(j.flatMap(e=>e.mcp_access_groups).filter(e=>null!=e))):[],[j]),V=e=>{A(e),K(e,T)},B=e=>{M(e),K(P,e)},K=(e,s)=>{if(!j)return O([]);let r=j;if("personal"===e){O([]);return}"all"!==e&&(r=r.filter(s=>{var r;return null===(r=s.teams)||void 0===r?void 0:r.some(s=>s.team_id===e)})),"all"!==s&&(r=r.filter(e=>{var r;return null===(r=e.mcp_access_groups)||void 0===r?void 0:r.some(e=>"string"==typeof e?e===s:e&&e.name===s)})),O(r)};(0,x.useEffect)(()=>{K(P,T)},[b]);let H=x.useMemo(()=>eL(null!=r?r:"",e=>{C(e),k(!1)},e=>{C(e),k(!0)},D),[r]);function D(e){N(e),w(!0)}let J=async()=>{if(null!=y&&null!=s)try{q(!0),await (0,p.deleteMCPServer)(s,y),h.Z.success("Deleted MCP Server successfully"),f()}catch(e){console.error("Error deleting the mcp server:",e)}finally{q(!1),w(!1),N(null)}},G=y?(j||[]).find(e=>e.server_id===y):null;return s&&r&&o?(0,t.jsxs)("div",{className:"w-full h-full p-6",children:[(0,t.jsx)(m.Z,{open:_,title:"Delete MCP Server?",onOk:J,okText:z?"Deleting...":"Delete",onCancel:()=>{w(!1),N(null)},cancelText:"Cancel",cancelButtonProps:{disabled:z},okButtonProps:{danger:!0},confirmLoading:z,children:(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(e$,{children:"Are you sure you want to delete this MCP Server? This action cannot be undone."}),G&&(0,t.jsxs)("div",{className:"mt-4 p-4 bg-red-50 rounded-lg border border-red-200",children:[(0,t.jsx)(eW,{level:5,className:"mb-3 text-gray-900",children:"Server Information"}),(0,t.jsxs)(u.Z,{column:1,size:"small",children:[G.server_name&&(0,t.jsx)(u.Z.Item,{label:(0,t.jsx)("span",{className:"font-semibold text-gray-700",children:"Server Name"}),children:(0,t.jsx)(e$,{className:"text-sm",children:G.server_name})}),G.alias&&(0,t.jsx)(u.Z.Item,{label:(0,t.jsx)("span",{className:"font-semibold text-gray-700",children:"Alias"}),children:(0,t.jsx)(e$,{className:"text-sm",children:G.alias})}),(0,t.jsx)(u.Z.Item,{label:(0,t.jsx)("span",{className:"font-semibold text-gray-700",children:"Server ID"}),children:(0,t.jsx)(e$,{code:!0,className:"text-sm",children:G.server_id})}),(0,t.jsx)(u.Z.Item,{label:(0,t.jsx)("span",{className:"font-semibold text-gray-700",children:"URL"}),children:(0,t.jsx)(e$,{code:!0,className:"text-sm",children:G.url})})]})]})]})}),(0,t.jsx)(ec,{userRole:r,accessToken:s,onCreateSuccess:e=>{O(s=>[...s,e]),E(!1)},isModalVisible:L,setModalVisible:E,availableAccessGroups:F}),(0,t.jsx)(i.Dx,{children:"MCP Servers"}),(0,t.jsx)(i.xv,{className:"text-tremor-content mt-2",children:"Configure and manage your MCP servers"}),(0,l.tY)(r)&&(0,t.jsx)(i.zx,{className:"mt-4 mb-4",onClick:()=>E(!0),children:"+ Add New MCP Server"}),(0,t.jsxs)(i.v0,{className:"w-full h-full",children:[(0,t.jsx)(i.td,{className:"flex justify-between mt-2 w-full items-center",children:(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)(i.OK,{children:"All Servers"}),(0,t.jsx)(i.OK,{children:"Connect"})]})}),(0,t.jsxs)(i.nP,{children:[(0,t.jsx)(i.x4,{children:(0,t.jsx)(()=>Z?(0,t.jsx)(eY,{mcpServer:I.find(e=>e.server_id===Z)||{server_id:"",server_name:"",alias:"",url:"",transport:"",auth_type:"",created_at:"",created_by:"",updated_at:"",updated_by:""},onBack:()=>{k(!1),C(null),f()},isProxyAdmin:(0,l.tY)(r),isEditing:S,accessToken:s,userID:o,userRole:r,availableAccessGroups:F}):(0,t.jsxs)("div",{className:"w-full h-full",children:[(0,t.jsx)("div",{className:"w-full px-6",children:(0,t.jsx)("div",{className:"flex flex-col space-y-4",children:(0,t.jsx)("div",{className:"flex items-center justify-between bg-gray-50 rounded-lg p-4 border-2 border-gray-200",children:(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsx)(i.xv,{className:"text-lg font-semibold text-gray-900",children:"Current Team:"}),(0,t.jsxs)(c.default,{value:P,onChange:V,style:{width:300},children:[(0,t.jsx)(eQ,{value:"all",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:U?"All Available Servers":"All Servers"})]})}),(0,t.jsx)(eQ,{value:"personal",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:"Personal"})]})}),R.map(e=>(0,t.jsx)(eQ,{value:e.team_id,children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:e.team_alias||e.team_id})]})},e.team_id))]}),(0,t.jsxs)(i.xv,{className:"text-lg font-semibold text-gray-900 ml-6",children:["Access Group:",(0,t.jsx)(d.Z,{title:"An MCP Access Group is a set of users or teams that have permission to access specific MCP servers. Use access groups to control and organize who can connect to which servers.",children:(0,t.jsx)(a.Z,{style:{marginLeft:4,color:"#888"}})})]}),(0,t.jsxs)(c.default,{value:T,onChange:B,style:{width:300},children:[(0,t.jsx)(eQ,{value:"all",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:"All Access Groups"})]})}),F.map(e=>(0,t.jsx)(eQ,{value:e,children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:e})]})},e))]})]})})})}),(0,t.jsx)("div",{className:"w-full px-6 mt-6",children:(0,t.jsx)(g.w,{data:I,columns:H,renderSubComponent:()=>(0,t.jsx)("div",{}),getRowCanExpand:()=>!1,isLoading:v,noDataMessage:"No MCP servers configured",loadingMessage:"\uD83D\uDE85 Loading MCP servers..."})})]}),{})}),(0,t.jsx)(i.x4,{children:(0,t.jsx)(eT,{})})]})]})]}):(console.log("Missing required authentication parameters",{accessToken:s,userRole:r,userID:o}),(0,t.jsx)("div",{className:"p-6 text-center text-gray-500",children:"Missing required authentication parameters."}))},e0=r(21770);function e2(e){let{tool:s,onSubmit:r,isLoading:l,result:a,error:n,onClose:i}=e,[o]=j.Z.useForm(),[c,m]=x.useState("formatted"),[u,p]=x.useState(null),[g,v]=x.useState(null),y=x.useMemo(()=>"string"==typeof s.inputSchema?{type:"object",properties:{input:{type:"string",description:"Input for this tool"}},required:["input"]}:s.inputSchema,[s.inputSchema]),N=x.useMemo(()=>y.properties&&y.properties.params&&"object"===y.properties.params.type&&y.properties.params.properties?{type:"object",properties:y.properties.params.properties,required:y.properties.params.required||[]}:y,[y]);x.useEffect(()=>{u&&(a||n)&&v(Date.now()-u)},[a,n,u]);let _=async e=>{try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0;{let s=document.createElement("textarea");s.value=e,s.style.position="fixed",s.style.opacity="0",document.body.appendChild(s),s.focus(),s.select();let r=document.execCommand("copy");if(document.body.removeChild(s),!r)throw Error("execCommand failed");return!0}}catch(e){return console.error("Copy failed:",e),!1}},w=async()=>{await _(JSON.stringify(a,null,2))?h.Z.success("Result copied to clipboard"):h.Z.fromBackend("Failed to copy result")},Z=async()=>{await _(s.name)?h.Z.success("Tool name copied to clipboard"):h.Z.fromBackend("Failed to copy tool name")};return(0,t.jsxs)("div",{className:"space-y-4 h-full",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between pb-3 border-b border-gray-200",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-3",children:[s.mcp_info.logo_url&&(0,t.jsx)("img",{src:s.mcp_info.logo_url,alt:"".concat(s.mcp_info.server_name," logo"),className:"w-6 h-6 object-contain"}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2 mb-1",children:[(0,t.jsx)("h2",{className:"text-lg font-semibold text-gray-900",children:"Test Tool:"}),(0,t.jsxs)("div",{className:"group inline-flex items-center space-x-1 bg-slate-50 hover:bg-slate-100 px-3 py-1 rounded-md cursor-pointer transition-colors border border-slate-200",onClick:Z,title:"Click to copy tool name",children:[(0,t.jsx)("span",{className:"font-mono text-slate-700 font-medium text-sm",children:s.name}),(0,t.jsx)("svg",{className:"w-3 h-3 text-slate-400 group-hover:text-slate-600 transition-colors",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})]})]}),(0,t.jsx)("p",{className:"text-xs text-gray-600",children:s.description}),(0,t.jsxs)("p",{className:"text-xs text-gray-500",children:["Provider: ",s.mcp_info.server_name]})]})]}),(0,t.jsx)(b.z,{onClick:i,variant:"light",size:"sm",className:"text-gray-500 hover:text-gray-700",children:(0,t.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 h-full",children:[(0,t.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg",children:[(0,t.jsx)("div",{className:"border-b border-gray-100 px-4 py-2",children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-gray-900",children:"Input Parameters"}),(0,t.jsx)(d.Z,{title:"Configure the input parameters for this tool call",children:(0,t.jsx)(f.Z,{className:"text-gray-400 hover:text-gray-600"})})]})}),(0,t.jsx)("div",{className:"p-4",children:(0,t.jsxs)(j.Z,{form:o,onFinish:e=>{p(Date.now()),v(null);let s={};Object.entries(e).forEach(e=>{var r;let[t,l]=e,a=null===(r=N.properties)||void 0===r?void 0:r[t];if(a&&null!=l&&""!==l)switch(a.type){case"boolean":s[t]="true"===l||!0===l;break;case"number":s[t]=Number(l);break;case"string":s[t]=String(l);break;default:s[t]=l}else null!=l&&""!==l&&(s[t]=l)}),r(y.properties&&y.properties.params&&"object"===y.properties.params.type&&y.properties.params.properties?{params:s}:s)},layout:"vertical",className:"space-y-3",children:["string"==typeof s.inputSchema?(0,t.jsx)("div",{className:"space-y-3",children:(0,t.jsx)(j.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700",children:["Input ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]}),name:"input",rules:[{required:!0,message:"Please enter input for this tool"}],className:"mb-3",children:(0,t.jsx)(b.o,{placeholder:"Enter input for this tool",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})})}):void 0===N.properties?(0,t.jsx)("div",{className:"text-center py-6 bg-gray-50 rounded-lg border border-gray-200",children:(0,t.jsxs)("div",{className:"max-w-sm mx-auto",children:[(0,t.jsx)("h4",{className:"text-sm font-medium text-gray-900 mb-1",children:"No Parameters Required"}),(0,t.jsx)("p",{className:"text-xs text-gray-500",children:"This tool can be called without any input parameters."})]})}):(0,t.jsx)("div",{className:"space-y-3",children:Object.entries(N.properties).map(e=>{var s,r,l,a,n;let[i,o]=e;return(0,t.jsxs)(j.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:[i," ",(null===(s=N.required)||void 0===s?void 0:s.includes(i))&&(0,t.jsx)("span",{className:"text-red-500",children:"*"}),o.description&&(0,t.jsx)(d.Z,{title:o.description,children:(0,t.jsx)(f.Z,{className:"ml-2 text-gray-400 hover:text-gray-600"})})]}),name:i,rules:[{required:null===(r=N.required)||void 0===r?void 0:r.includes(i),message:"Please enter ".concat(i)}],className:"mb-3",children:["string"===o.type&&o.enum&&(0,t.jsxs)("select",{className:"w-full px-3 py-2 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm transition-colors",defaultValue:o.default,children:[!(null===(l=N.required)||void 0===l?void 0:l.includes(i))&&(0,t.jsxs)("option",{value:"",children:["Select ",i]}),o.enum.map(e=>(0,t.jsx)("option",{value:e,children:e},e))]}),"string"===o.type&&!o.enum&&(0,t.jsx)(b.o,{placeholder:o.description||"Enter ".concat(i),className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"}),"number"===o.type&&(0,t.jsx)("input",{type:"number",placeholder:o.description||"Enter ".concat(i),className:"w-full px-3 py-2 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm transition-colors"}),"boolean"===o.type&&(0,t.jsxs)("select",{className:"w-full px-3 py-2 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm transition-colors",defaultValue:(null===(a=o.default)||void 0===a?void 0:a.toString())||"",children:[!(null===(n=N.required)||void 0===n?void 0:n.includes(i))&&(0,t.jsxs)("option",{value:"",children:["Select ",i]}),(0,t.jsx)("option",{value:"true",children:"True"}),(0,t.jsx)("option",{value:"false",children:"False"})]})]},i)})}),(0,t.jsx)("div",{className:"pt-3 border-t border-gray-100",children:(0,t.jsx)(b.z,{onClick:()=>o.submit(),disabled:l,variant:"primary",className:"w-full",loading:l,children:l?"Calling Tool...":a||n?"Call Again":"Call Tool"})})]})})]}),(0,t.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg",children:[(0,t.jsx)("div",{className:"border-b border-gray-100 px-4 py-2",children:(0,t.jsx)("h3",{className:"text-sm font-semibold text-gray-900",children:"Tool Result"})}),(0,t.jsx)("div",{className:"p-4",children:a||n||l?(0,t.jsxs)("div",{className:"space-y-3",children:[a&&!l&&!n&&(0,t.jsx)("div",{className:"p-2 bg-green-50 border border-green-200 rounded-lg",children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)("svg",{className:"h-4 w-4 text-green-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,t.jsx)("h4",{className:"text-xs font-medium text-green-900",children:"Tool executed successfully"}),null!==g&&(0,t.jsxs)("span",{className:"text-xs text-green-600 ml-1",children:["• ",(g/1e3).toFixed(2),"s"]})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,t.jsxs)("div",{className:"flex bg-white rounded border border-green-300 p-0.5",children:[(0,t.jsx)("button",{onClick:()=>m("formatted"),className:"px-2 py-1 text-xs font-medium rounded transition-colors ".concat("formatted"===c?"bg-green-100 text-green-800":"text-green-600 hover:text-green-800"),children:"Formatted"}),(0,t.jsx)("button",{onClick:()=>m("json"),className:"px-2 py-1 text-xs font-medium rounded transition-colors ".concat("json"===c?"bg-green-100 text-green-800":"text-green-600 hover:text-green-800"),children:"JSON"})]}),(0,t.jsx)("button",{onClick:w,className:"p-1 hover:bg-green-100 rounded text-green-700",title:"Copy response",children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,t.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]})]})}),(0,t.jsxs)("div",{className:"max-h-96 overflow-y-auto",children:[l&&(0,t.jsxs)("div",{className:"flex flex-col justify-center items-center h-48 text-gray-500",children:[(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-gray-200"}),(0,t.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-blue-600 border-t-transparent absolute top-0"})]}),(0,t.jsx)("p",{className:"text-sm font-medium mt-3",children:"Calling tool..."}),(0,t.jsx)("p",{className:"text-xs text-gray-400 mt-1",children:"Please wait while we process your request"})]}),n&&(0,t.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-lg p-3",children:(0,t.jsxs)("div",{className:"flex items-start space-x-2",children:[(0,t.jsx)("div",{className:"flex-shrink-0",children:(0,t.jsx)("svg",{className:"h-4 w-4 text-red-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2 mb-1",children:[(0,t.jsx)("h4",{className:"text-xs font-medium text-red-900",children:"Tool Call Failed"}),null!==g&&(0,t.jsxs)("span",{className:"text-xs text-red-600",children:["• ",(g/1e3).toFixed(2),"s"]})]}),(0,t.jsx)("div",{className:"bg-white border border-red-200 rounded p-2 max-h-48 overflow-y-auto",children:(0,t.jsx)("pre",{className:"text-xs whitespace-pre-wrap text-red-700 font-mono",children:n.message})})]})]})}),a&&!l&&!n&&(0,t.jsx)("div",{className:"space-y-3",children:"formatted"===c?a.map((e,s)=>(0,t.jsxs)("div",{className:"border border-gray-200 rounded-lg overflow-hidden",children:["text"===e.type&&(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"bg-gray-50 px-3 py-1 border-b border-gray-200",children:(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:"Text Response"})}),(0,t.jsx)("div",{className:"p-3",children:(0,t.jsx)("div",{className:"bg-white rounded border border-gray-200 max-h-64 overflow-y-auto",children:(0,t.jsx)("div",{className:"p-3 space-y-2",children:e.text.split("\n\n").map((e,s)=>{if(""===e.trim())return null;if(e.startsWith("##")){let r=e.replace(/^#+\s/,"");return(0,t.jsx)("div",{className:"border-b border-gray-200 pb-1 mb-2",children:(0,t.jsx)("h3",{className:"text-sm font-semibold text-gray-900",children:r})},s)}let r=/(https?:\/\/[^\s\)]+)/g;if(r.test(e)){let l=e.split(r);return(0,t.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded p-2",children:(0,t.jsx)("div",{className:"text-xs text-gray-700 leading-relaxed whitespace-pre-wrap",children:l.map((e,s)=>r.test(e)?(0,t.jsx)("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline break-all",children:e},s):e)})},s)}return e.includes("Score:")?(0,t.jsx)("div",{className:"bg-green-50 border-l-4 border-green-400 p-2 rounded-r",children:(0,t.jsx)("p",{className:"text-xs text-green-800 font-medium whitespace-pre-wrap",children:e})},s):(0,t.jsx)("div",{className:"bg-gray-50 rounded p-2 border border-gray-200",children:(0,t.jsx)("div",{className:"text-xs text-gray-700 leading-relaxed whitespace-pre-wrap font-mono",children:e})},s)}).filter(Boolean)})})})]}),"image"===e.type&&e.url&&(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"bg-gray-50 px-3 py-1 border-b border-gray-200",children:(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:"Image Response"})}),(0,t.jsx)("div",{className:"p-3",children:(0,t.jsx)("div",{className:"bg-gray-50 rounded p-3 border border-gray-200",children:(0,t.jsx)("img",{src:e.url,alt:"Tool result",className:"max-w-full h-auto rounded shadow-sm"})})})]}),"embedded_resource"===e.type&&(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"bg-gray-50 px-3 py-1 border-b border-gray-200",children:(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:"Embedded Resource"})}),(0,t.jsx)("div",{className:"p-3",children:(0,t.jsxs)("div",{className:"flex items-center space-x-2 p-3 bg-blue-50 border border-blue-200 rounded",children:[(0,t.jsx)("div",{className:"flex-shrink-0",children:(0,t.jsx)("svg",{className:"h-5 w-5 text-blue-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsxs)("p",{className:"text-xs font-medium text-blue-900",children:["Resource Type: ",e.resource_type]}),e.url&&(0,t.jsxs)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center text-xs text-blue-600 hover:text-blue-800 hover:underline mt-1 transition-colors",children:["View Resource",(0,t.jsxs)("svg",{className:"ml-1 h-3 w-3",fill:"currentColor",viewBox:"0 0 20 20",children:[(0,t.jsx)("path",{d:"M11 3a1 1 0 100 2h2.586l-6.293 6.293a1 1 0 101.414 1.414L15 6.414V9a1 1 0 102 0V4a1 1 0 00-1-1h-5z"}),(0,t.jsx)("path",{d:"M5 5a2 2 0 00-2 2v8a2 2 0 002 2h8a2 2 0 002-2v-3a1 1 0 10-2 0v3H5V7h3a1 1 0 000-2H5z"})]})]})]})]})})]})]},s)):(0,t.jsx)("div",{className:"bg-white rounded border border-gray-200",children:(0,t.jsx)("div",{className:"p-3 overflow-auto max-h-80 bg-gray-50",children:(0,t.jsx)("pre",{className:"text-xs font-mono whitespace-pre-wrap break-all text-gray-800",children:JSON.stringify(a,null,2)})})})})]})]}):(0,t.jsx)("div",{className:"flex flex-col justify-center items-center h-48 text-gray-500",children:(0,t.jsxs)("div",{className:"text-center max-w-sm",children:[(0,t.jsx)("div",{className:"mb-3",children:(0,t.jsx)("svg",{className:"mx-auto h-12 w-12 text-gray-300",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1,d:"M13 10V3L4 14h7v7l9-11h-7z"})})}),(0,t.jsx)("h4",{className:"text-sm font-medium text-gray-900 mb-1",children:"Ready to Call Tool"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 leading-relaxed",children:'Configure the input parameters and click "Call Tool" to see the results here.'})]})})})]})]})]})}var e1=r(69993),e4=e=>{let{serverId:s,accessToken:r,auth_type:l,userRole:a,userID:i,serverAlias:o}=e,[c,d]=(0,x.useState)(null),[m,u]=(0,x.useState)(null),[h,g]=(0,x.useState)(null),{data:j,isLoading:v,error:f}=(0,n.a)({queryKey:["mcpTools",s],queryFn:()=>{if(!r)throw Error("Access Token required");return(0,p.listMCPTools)(r,s)},enabled:!!r,staleTime:3e4}),{mutate:b,isPending:y}=(0,e0.D)({mutationFn:async e=>{if(!r)throw Error("Access Token required");try{return await (0,p.callMCPTool)(r,e.tool.name,e.arguments)}catch(e){throw e}},onSuccess:e=>{u(e.content),g(null)},onError:e=>{g(e),u(null)}}),N=(null==j?void 0:j.tools)||[];return(0,t.jsx)("div",{className:"w-full h-screen p-4 bg-white",children:(0,t.jsx)(A.Z,{className:"w-full rounded-xl shadow-md overflow-hidden",children:(0,t.jsxs)("div",{className:"flex h-auto w-full gap-4",children:[(0,t.jsxs)("div",{className:"w-1/4 p-4 bg-gray-50 flex flex-col",children:[(0,t.jsx)(M.Z,{className:"text-xl font-semibold mb-6 mt-2",children:"MCP Tools"}),(0,t.jsx)("div",{className:"flex flex-col flex-1",children:(0,t.jsxs)("div",{className:"flex flex-col flex-1 min-h-0",children:[(0,t.jsxs)(T.Z,{className:"font-medium block mb-3 text-gray-700 flex items-center",children:[(0,t.jsx)(P.Z,{className:"mr-2"})," Available Tools",N.length>0&&(0,t.jsx)("span",{className:"ml-2 bg-blue-100 text-blue-800 text-xs font-medium px-2 py-0.5 rounded-full",children:N.length})]}),v&&(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center py-8 bg-white border border-gray-200 rounded-lg",children:[(0,t.jsxs)("div",{className:"relative mb-3",children:[(0,t.jsx)("div",{className:"animate-spin rounded-full h-6 w-6 border-2 border-gray-200"}),(0,t.jsx)("div",{className:"animate-spin rounded-full h-6 w-6 border-2 border-blue-600 border-t-transparent absolute top-0"})]}),(0,t.jsx)("p",{className:"text-xs font-medium text-gray-700",children:"Loading tools..."})]}),(null==j?void 0:j.error)&&!v&&!N.length&&(0,t.jsx)("div",{className:"p-3 text-xs text-red-800 rounded-lg bg-red-50 border border-red-200",children:(0,t.jsxs)("p",{className:"font-medium",children:["Error: ",j.message]})}),!v&&!(null==j?void 0:j.error)&&(!N||0===N.length)&&(0,t.jsxs)("div",{className:"p-4 text-center bg-white border border-gray-200 rounded-lg",children:[(0,t.jsx)("div",{className:"mx-auto w-8 h-8 bg-gray-200 rounded-full flex items-center justify-center mb-2",children:(0,t.jsx)("svg",{className:"w-4 h-4 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19.428 15.428a2 2 0 00-1.022-.547l-2.387-.477a6 6 0 00-3.86.517l-.318.158a6 6 0 01-3.86.517L6.05 15.21a2 2 0 00-1.806.547M8 4h8l-1 1v5.172a2 2 0 00.586 1.414l5 5c1.26 1.26.367 3.414-1.415 3.414H4.828c-1.782 0-2.674-2.154-1.414-3.414l5-5A2 2 0 009 8.172V5L8 4z"})})}),(0,t.jsx)("p",{className:"text-xs font-medium text-gray-700 mb-1",children:"No tools available"}),(0,t.jsx)("p",{className:"text-xs text-gray-500",children:"No tools found for this server"})]}),!v&&!(null==j?void 0:j.error)&&N.length>0&&(0,t.jsx)("div",{className:"space-y-2 flex-1 overflow-y-auto min-h-0 mcp-tools-scrollable",style:{maxHeight:"400px",scrollbarWidth:"auto",scrollbarColor:"#cbd5e0 #f7fafc"},children:N.map(e=>(0,t.jsxs)("div",{className:"border rounded-lg p-3 cursor-pointer transition-all hover:shadow-sm ".concat((null==c?void 0:c.name)===e.name?"border-blue-500 bg-blue-50 ring-1 ring-blue-200":"border-gray-200 bg-white hover:border-gray-300"),onClick:()=>{d(e),u(null),g(null)},children:[(0,t.jsxs)("div",{className:"flex items-start space-x-2",children:[e.mcp_info.logo_url&&(0,t.jsx)("img",{src:e.mcp_info.logo_url,alt:"".concat(e.mcp_info.server_name," logo"),className:"w-4 h-4 object-contain flex-shrink-0 mt-0.5"}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("h4",{className:"font-mono text-xs font-medium text-gray-900 truncate",children:e.name}),(0,t.jsx)("p",{className:"text-xs text-gray-500 truncate",children:e.mcp_info.server_name}),(0,t.jsx)("p",{className:"text-xs text-gray-600 mt-1 line-clamp-2 leading-relaxed",children:e.description})]})]}),(null==c?void 0:c.name)===e.name&&(0,t.jsx)("div",{className:"mt-2 pt-2 border-t border-blue-200",children:(0,t.jsxs)("div",{className:"flex items-center text-xs font-medium text-blue-700",children:[(0,t.jsx)("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),"Selected"]})})]},e.name))})]})})]}),(0,t.jsxs)("div",{className:"w-3/4 flex flex-col bg-white",children:[(0,t.jsx)("div",{className:"p-4 border-b border-gray-200 flex justify-between items-center",children:(0,t.jsx)(M.Z,{className:"text-xl font-semibold mb-0",children:"Tool Testing Playground"})}),(0,t.jsx)("div",{className:"flex-1 overflow-auto p-4",children:c?(0,t.jsx)("div",{className:"h-full",children:(0,t.jsx)(e2,{tool:c,onSubmit:e=>{b({tool:c,arguments:e})},result:m,error:h,isLoading:y,onClose:()=>d(null)})}):(0,t.jsxs)("div",{className:"h-full flex flex-col items-center justify-center text-gray-400",children:[(0,t.jsx)(e1.Z,{style:{fontSize:"48px",marginBottom:"16px"}}),(0,t.jsx)(T.Z,{className:"text-lg font-medium text-gray-600 mb-2",children:"Select a Tool to Test"}),(0,t.jsx)(T.Z,{className:"text-center text-gray-500 max-w-md",children:"Choose a tool from the left sidebar to start testing its functionality with custom inputs."})]})})]})]})})})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/7641-c38624d78f1b4e66.js b/litellm/proxy/_experimental/out/_next/static/chunks/7641-c38624d78f1b4e66.js deleted file mode 100644 index 9c20674f2b..0000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/7641-c38624d78f1b4e66.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7641],{71668:function(e,s,r){r.d(s,{Dx:function(){return d.Z},OK:function(){return l.Z},nP:function(){return o.Z},td:function(){return n.Z},v0:function(){return a.Z},x4:function(){return i.Z},xv:function(){return c.Z},zx:function(){return t.Z}});var t=r(78489),l=r(12485),a=r(18135),n=r(35242),i=r(29706),o=r(77991),c=r(84264),d=r(96761)},58927:function(e,s,r){r.d(s,{J:function(){return t.Z}});var t=r(47323)},87641:function(e,s,r){r.d(s,{d:function(){return eX},o:function(){return e4}});var t=r(57437),l=r(20347),a=r(67187),n=r(11713),i=r(71668),o=r(57840),c=r(37592),d=r(99981),m=r(22116),u=r(76188),x=r(2265),h=r(9114),p=r(19250),g=r(12322),j=r(10032),v=r(4260),f=r(15424),b=r(64504);let y={NONE:"none",API_KEY:"api_key",BEARER_TOKEN:"bearer_token",BASIC:"basic",OAUTH2:"oauth2"},N={SSE:"sse"},_=e=>(console.log(e),null==e)?N.SSE:e,w=e=>null==e?y.NONE:e;var Z=r(19015),C=r(44851),S=r(33866),k=r(62670),P=r(58630),A=r(12514),T=r(84264),M=r(96761),I=e=>{let{value:s={},onChange:r,tools:l=[],disabled:a=!1}=e,n=(e,t)=>{let l={...s,tool_name_to_cost_per_query:{...s.tool_name_to_cost_per_query,[e]:t}};null==r||r(l)};return(0,t.jsx)(A.Z,{children:(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,t.jsx)(k.Z,{className:"text-green-600"}),(0,t.jsx)(M.Z,{children:"Cost Configuration"}),(0,t.jsx)(d.Z,{title:"Configure costs for this MCP server's tool calls. Set a default rate and per-tool overrides.",children:(0,t.jsx)(f.Z,{className:"text-gray-400"})})]}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:["Default Cost per Query ($)",(0,t.jsx)(d.Z,{title:"Default cost charged for each tool call to this server.",children:(0,t.jsx)(f.Z,{className:"ml-1 text-gray-400"})})]}),(0,t.jsx)(Z.Z,{min:0,step:1e-4,precision:4,placeholder:"0.0000",value:s.default_cost_per_query,onChange:e=>{let t={...s,default_cost_per_query:e};null==r||r(t)},disabled:a,style:{width:"200px"},addonBefore:"$"}),(0,t.jsx)(T.Z,{className:"block mt-1 text-gray-500 text-sm",children:"Set a default cost for all tool calls to this server"})]}),l.length>0&&(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("label",{className:"block text-sm font-medium text-gray-700",children:["Tool-Specific Costs ($)",(0,t.jsx)(d.Z,{title:"Override the default cost for specific tools. Leave blank to use the default rate.",children:(0,t.jsx)(f.Z,{className:"ml-1 text-gray-400"})})]}),(0,t.jsx)(C.default,{items:[{key:"1",label:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(P.Z,{className:"mr-2 text-blue-500"}),(0,t.jsx)("span",{className:"font-medium",children:"Available Tools"}),(0,t.jsx)(S.Z,{count:l.length,style:{backgroundColor:"#52c41a",marginLeft:"8px"}})]}),children:(0,t.jsx)("div",{className:"space-y-3 max-h-64 overflow-y-auto",children:l.map((e,r)=>{var l;return(0,t.jsxs)("div",{className:"flex items-center justify-between p-3 bg-gray-50 rounded-lg",children:[(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)(T.Z,{className:"font-medium text-gray-900",children:e.name}),e.description&&(0,t.jsx)(T.Z,{className:"text-gray-500 text-sm block mt-1",children:e.description})]}),(0,t.jsx)("div",{className:"ml-4",children:(0,t.jsx)(Z.Z,{min:0,step:1e-4,precision:4,placeholder:"Use default",value:null===(l=s.tool_name_to_cost_per_query)||void 0===l?void 0:l[e.name],onChange:s=>n(e.name,s),disabled:a,style:{width:"120px"},addonBefore:"$"})})]},r)})})}]})]})]}),(s.default_cost_per_query||s.tool_name_to_cost_per_query&&Object.keys(s.tool_name_to_cost_per_query).length>0)&&(0,t.jsxs)("div",{className:"mt-6 p-4 bg-blue-50 border border-blue-200 rounded-lg",children:[(0,t.jsx)(T.Z,{className:"text-blue-800 font-medium",children:"Cost Summary:"}),(0,t.jsxs)("div",{className:"mt-2 space-y-1",children:[s.default_cost_per_query&&(0,t.jsxs)(T.Z,{className:"text-blue-700",children:["• Default cost: $",s.default_cost_per_query.toFixed(4)," per query"]}),s.tool_name_to_cost_per_query&&Object.entries(s.tool_name_to_cost_per_query).map(e=>{let[s,r]=e;return null!=r&&(0,t.jsxs)(T.Z,{className:"text-blue-700",children:["• ",s,": $",r.toFixed(4)," per query"]},s)})]})]})]})})},O=r(10353),L=r(51653),E=r(5545),z=r(83669),q=r(29271),U=r(89245);let R=e=>{var s,r;let{accessToken:t,oauthAccessToken:l,formValues:a,enabled:n=!0}=e,[i,o]=(0,x.useState)([]),[c,d]=(0,x.useState)(!1),[m,u]=(0,x.useState)(null),[h,g]=(0,x.useState)(null),[j,v]=(0,x.useState)(!1),f=a.auth_type===y.OAUTH2,b=!!(a.url&&a.transport&&a.auth_type&&t&&(!f||l)),N=JSON.stringify(null!==(s=a.static_headers)&&void 0!==s?s:{}),_=JSON.stringify(null!==(r=a.credentials)&&void 0!==r?r:{}),w=async()=>{if(t&&a.url&&(!f||l)){d(!0),u(null);try{let e=Array.isArray(a.static_headers)?a.static_headers.reduce((e,s)=>{var r;let t=null==s?void 0:null===(r=s.header)||void 0===r?void 0:r.trim();return t&&(e[t]=(null==s?void 0:s.value)!=null?String(s.value):""),e},{}):!Array.isArray(a.static_headers)&&a.static_headers&&"object"==typeof a.static_headers?Object.entries(a.static_headers).reduce((e,s)=>{let[r,t]=s;return r&&(e[r]=null!=t?String(t):""),e},{}):{},s=a.credentials&&"object"==typeof a.credentials?Object.entries(a.credentials).reduce((e,s)=>{let[r,t]=s;if(null==t||""===t)return e;if("scopes"===r){if(Array.isArray(t)){let s=t.filter(e=>null!=e&&""!==e);s.length>0&&(e[r]=s)}}else e[r]=t;return e},{}):void 0,r={server_id:a.server_id||"",server_name:a.server_name||"",url:a.url,transport:a.transport,auth_type:a.auth_type,mcp_info:a.mcp_info,static_headers:e};s&&Object.keys(s).length>0&&(r.credentials=s);let n=await (0,p.testMCPToolsListRequest)(t,r,l);if(n.tools&&!n.error)o(n.tools),u(null),g(null),n.tools.length>0&&!j&&v(!0);else{let e=n.message||"Failed to retrieve tools list";u(e),g(n.stack_trace||null),o([]),v(!1)}}catch(e){console.error("Tools fetch error:",e),u(e instanceof Error?e.message:String(e)),g(null),o([]),v(!1)}finally{d(!1)}}},Z=()=>{o([]),u(null),g(null),v(!1)};return(0,x.useEffect)(()=>{n&&(b?w():Z())},[a.url,a.transport,a.auth_type,t,n,l,b,N,_]),{tools:i,isLoadingTools:c,toolsError:m,toolsErrorStackTrace:h,hasShownSuccessMessage:j,canFetchTools:b,fetchTools:w,clearTools:Z}};var F=e=>{let{accessToken:s,oauthAccessToken:r,formValues:l,onToolsLoaded:a}=e,{tools:n,isLoadingTools:i,toolsError:o,toolsErrorStackTrace:c,canFetchTools:d,fetchTools:m}=R({accessToken:s,oauthAccessToken:r,formValues:l,enabled:!0});return((0,x.useEffect)(()=>{null==a||a(n)},[n,a]),d||l.url)?(0,t.jsx)(A.Z,{children:(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(z.Z,{className:"text-blue-600"}),(0,t.jsx)(M.Z,{children:"Connection Status"})]}),!d&&l.url&&(0,t.jsxs)("div",{className:"text-center py-6 text-gray-400 border rounded-lg border-dashed",children:[(0,t.jsx)(P.Z,{className:"text-2xl mb-2"}),(0,t.jsx)(T.Z,{children:"Complete required fields to test connection"}),(0,t.jsx)("br",{}),(0,t.jsx)(T.Z,{className:"text-sm",children:"Fill in URL, Transport, and Authentication to test MCP server connection"})]}),d&&(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(T.Z,{className:"text-gray-700 font-medium",children:i?"Testing connection to MCP server...":n.length>0?"Connection successful":o?"Connection failed":"Ready to test connection"}),(0,t.jsx)("br",{}),(0,t.jsxs)(T.Z,{className:"text-gray-500 text-sm",children:["Server: ",l.url]})]}),i&&(0,t.jsxs)("div",{className:"flex items-center text-blue-600",children:[(0,t.jsx)(O.Z,{size:"small",className:"mr-2"}),(0,t.jsx)(T.Z,{className:"text-blue-600",children:"Connecting..."})]}),!i&&!o&&n.length>0&&(0,t.jsxs)("div",{className:"flex items-center text-green-600",children:[(0,t.jsx)(z.Z,{className:"mr-1"}),(0,t.jsx)(T.Z,{className:"text-green-600 font-medium",children:"Connected"})]}),o&&(0,t.jsxs)("div",{className:"flex items-center text-red-600",children:[(0,t.jsx)(q.Z,{className:"mr-1"}),(0,t.jsx)(T.Z,{className:"text-red-600 font-medium",children:"Failed"})]})]}),i&&(0,t.jsxs)("div",{className:"flex items-center justify-center py-6",children:[(0,t.jsx)(O.Z,{size:"large"}),(0,t.jsx)(T.Z,{className:"ml-3",children:"Testing connection and loading tools..."})]}),o&&(0,t.jsx)(L.Z,{message:"Connection Failed",description:(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{children:o}),c&&(0,t.jsx)(C.default,{items:[{key:"stack-trace",label:"Stack Trace",children:(0,t.jsx)("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word",fontSize:"12px",fontFamily:"monospace",margin:0,padding:"8px",backgroundColor:"#f5f5f5",borderRadius:"4px",maxHeight:"400px",overflow:"auto"},children:c})}],style:{marginTop:"12px"}})]}),type:"error",showIcon:!0,action:(0,t.jsx)(E.ZP,{icon:(0,t.jsx)(U.Z,{}),onClick:m,size:"small",children:"Retry"})}),!i&&0===n.length&&!o&&(0,t.jsxs)("div",{className:"text-center py-6 text-gray-500 border rounded-lg border-dashed",children:[(0,t.jsx)(z.Z,{className:"text-2xl mb-2 text-green-500"}),(0,t.jsx)(T.Z,{className:"text-green-600 font-medium",children:"Connection successful!"}),(0,t.jsx)("br",{}),(0,t.jsx)(T.Z,{className:"text-gray-500",children:"No tools found for this MCP server"})]})]})]})}):null},V=r(4156),B=e=>{let{accessToken:s,oauthAccessToken:r,formValues:l,allowedTools:a,existingAllowedTools:n,onAllowedToolsChange:i}=e,o=(0,x.useRef)(0),{tools:c,isLoadingTools:d,toolsError:m,canFetchTools:u}=R({accessToken:s,oauthAccessToken:r,formValues:l,enabled:!0});(0,x.useEffect)(()=>{if(c.length>0&&c.length!==o.current&&0===a.length){if(n&&n.length>0){let e=c.map(e=>e.name);i(n.filter(s=>e.includes(s)))}else i(c.map(e=>e.name))}o.current=c.length},[c,a.length,n,i]);let h=e=>{a.includes(e)?i(a.filter(s=>s!==e)):i([...a,e])};return u||l.url?(0,t.jsx)(A.Z,{children:(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("div",{className:"flex items-center justify-between",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(P.Z,{className:"text-blue-600"}),(0,t.jsx)(M.Z,{children:"Tool Configuration"}),c.length>0&&(0,t.jsx)(S.Z,{count:c.length,style:{backgroundColor:"#52c41a"}})]})}),(0,t.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,t.jsxs)(T.Z,{className:"text-blue-800 text-sm",children:[(0,t.jsx)("strong",{children:"Select which tools users can call:"})," Only checked tools will be available for users to invoke. Unchecked tools will be blocked from execution."]})}),d&&(0,t.jsxs)("div",{className:"flex items-center justify-center py-6",children:[(0,t.jsx)(O.Z,{size:"large"}),(0,t.jsx)(T.Z,{className:"ml-3",children:"Loading tools..."})]}),m&&!d&&(0,t.jsxs)("div",{className:"text-center py-6 text-red-500 border rounded-lg border-dashed border-red-300 bg-red-50",children:[(0,t.jsx)(P.Z,{className:"text-2xl mb-2"}),(0,t.jsx)(T.Z,{className:"text-red-600 font-medium",children:"Unable to load tools"}),(0,t.jsx)("br",{}),(0,t.jsx)(T.Z,{className:"text-sm text-red-500",children:m})]}),!d&&!m&&0===c.length&&u&&(0,t.jsxs)("div",{className:"text-center py-6 text-gray-400 border rounded-lg border-dashed",children:[(0,t.jsx)(P.Z,{className:"text-2xl mb-2"}),(0,t.jsx)(T.Z,{children:"No tools available for configuration"}),(0,t.jsx)("br",{}),(0,t.jsx)(T.Z,{className:"text-sm",children:"Connect to an MCP server with tools to configure them"})]}),!u&&l.url&&(0,t.jsxs)("div",{className:"text-center py-6 text-gray-400 border rounded-lg border-dashed",children:[(0,t.jsx)(P.Z,{className:"text-2xl mb-2"}),(0,t.jsx)(T.Z,{children:"Complete required fields to configure tools"}),(0,t.jsx)("br",{}),(0,t.jsx)(T.Z,{className:"text-sm",children:"Fill in URL, Transport, and Authentication to load available tools"})]}),!d&&!m&&c.length>0&&(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-green-50 rounded-lg border border-green-200 flex-1",children:[(0,t.jsx)(z.Z,{className:"text-green-600"}),(0,t.jsxs)(T.Z,{className:"text-green-700 font-medium",children:[a.length," of ",c.length," ",1===c.length?"tool":"tools"," enabled for user access"]})]}),(0,t.jsxs)("div",{className:"flex gap-2 ml-3",children:[(0,t.jsx)("button",{type:"button",onClick:()=>{i(c.map(e=>e.name))},className:"px-3 py-1.5 text-sm text-blue-600 hover:text-blue-700 hover:bg-blue-50 rounded-md transition-colors",children:"Enable All"}),(0,t.jsx)("button",{type:"button",onClick:()=>{i([])},className:"px-3 py-1.5 text-sm text-gray-600 hover:text-gray-700 hover:bg-gray-100 rounded-md transition-colors",children:"Disable All"})]})]}),(0,t.jsx)("div",{className:"space-y-2",children:c.map((e,s)=>(0,t.jsx)("div",{className:"p-4 rounded-lg border transition-colors cursor-pointer ".concat(a.includes(e.name)?"bg-blue-50 border-blue-300 hover:border-blue-400":"bg-gray-50 border-gray-200 hover:border-gray-300"),onClick:()=>h(e.name),children:(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)(V.Z,{checked:a.includes(e.name),onChange:()=>h(e.name)}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(T.Z,{className:"font-medium text-gray-900",children:e.name}),(0,t.jsx)("span",{className:"px-2 py-0.5 text-xs rounded-full font-medium ".concat(a.includes(e.name)?"bg-green-100 text-green-800":"bg-red-100 text-red-800"),children:a.includes(e.name)?"Enabled":"Disabled"})]}),e.description&&(0,t.jsx)(T.Z,{className:"text-gray-500 text-sm block mt-1",children:e.description}),(0,t.jsx)(T.Z,{className:"text-gray-400 text-xs block mt-1",children:a.includes(e.name)?"✓ Users can call this tool":"✗ Users cannot call this tool"})]})]})},s))})]})]})}):null},K=e=>{let{isVisible:s}=e;return s?(0,t.jsx)(j.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Stdio Configuration (JSON)",(0,t.jsx)(d.Z,{title:"Paste your stdio MCP server configuration in JSON format. You can use the full mcpServers structure from config.yaml or just the inner server configuration.",children:(0,t.jsx)(f.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"stdio_config",rules:[{required:!0,message:"Please enter stdio configuration"},{validator:(e,s)=>{if(!s)return Promise.resolve();try{return JSON.parse(s),Promise.resolve()}catch(e){return Promise.reject("Please enter valid JSON")}}}],children:(0,t.jsx)(v.default.TextArea,{placeholder:'{\n "mcpServers": {\n "circleci-mcp-server": {\n "command": "npx",\n "args": ["-y", "@circleci/mcp-server-circleci"],\n "env": {\n "CIRCLECI_TOKEN": "your-circleci-token",\n "CIRCLECI_BASE_URL": "https://circleci.com"\n }\n }\n }\n}',rows:12,className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500 font-mono text-sm"})}):null},H=r(58760),D=r(45246),J=r(96473);let{Panel:G}=C.default;var Y=e=>{let{availableAccessGroups:s,mcpServer:r,searchValue:l,setSearchValue:a,getAccessGroupOptions:n}=e,i=j.Z.useFormInstance();return(0,x.useEffect)(()=>{if(r&&(r.extra_headers&&i.setFieldValue("extra_headers",r.extra_headers),r.static_headers)){let e=Object.entries(r.static_headers).map(e=>{let[s,r]=e;return{header:s,value:null!=r?String(r):""}});i.setFieldValue("static_headers",e)}},[r,i]),(0,t.jsx)(C.default,{className:"bg-gray-50 border border-gray-200 rounded-lg",expandIconPosition:"end",ghost:!1,children:(0,t.jsx)(G,{header:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,t.jsx)("h3",{className:"text-lg font-semibold text-gray-900",children:"Permission Management / Access Control"})]}),(0,t.jsx)("p",{className:"text-sm text-gray-600 ml-4",children:"Configure access permissions and security settings (Optional)"})]}),className:"border-0",children:(0,t.jsxs)("div",{className:"space-y-6 pt-4",children:[(0,t.jsx)(j.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["MCP Access Groups",(0,t.jsx)(d.Z,{title:"Specify access groups for this MCP server. Users must be in at least one of these groups to access the server.",children:(0,t.jsx)(f.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"mcp_access_groups",className:"mb-4",children:(0,t.jsx)(c.default,{mode:"tags",showSearch:!0,placeholder:"Select existing groups or type to create new ones",optionFilterProp:"value",filterOption:(e,s)=>{var r;return(null!==(r=null==s?void 0:s.value)&&void 0!==r?r:"").toLowerCase().includes(e.toLowerCase())},onSearch:e=>a(e),tokenSeparators:[","],options:n(),maxTagCount:"responsive",allowClear:!0})}),(0,t.jsx)(j.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Extra Headers",(0,t.jsx)(d.Z,{title:"Forward custom headers from incoming requests to this MCP server (e.g., Authorization, X-Custom-Header, User-Agent)",children:(0,t.jsx)(f.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})}),(null==r?void 0:r.extra_headers)&&r.extra_headers.length>0&&(0,t.jsxs)("span",{className:"ml-2 text-xs bg-blue-100 text-blue-700 px-2 py-1 rounded-full",children:[r.extra_headers.length," configured"]})]}),name:"extra_headers",children:(0,t.jsx)(c.default,{mode:"tags",placeholder:(null==r?void 0:r.extra_headers)&&r.extra_headers.length>0?"Currently: ".concat(r.extra_headers.join(", ")):"Enter header names (e.g., Authorization, X-Custom-Header)",className:"rounded-lg",size:"large",tokenSeparators:[","],allowClear:!0})}),(0,t.jsx)(j.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Static Headers",(0,t.jsx)(d.Z,{title:"Send these key-value headers with every request to this MCP server.",children:(0,t.jsx)(f.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),required:!1,children:(0,t.jsx)(j.Z.List,{name:"static_headers",children:(e,s)=>{let{add:r,remove:l}=s;return(0,t.jsxs)("div",{className:"space-y-3",children:[e.map(e=>{let{key:s,name:r,...a}=e;return(0,t.jsxs)(H.Z,{className:"flex w-full",align:"baseline",size:"middle",children:[(0,t.jsx)(j.Z.Item,{...a,name:[r,"header"],className:"flex-1",rules:[{required:!0,message:"Header name is required"}],children:(0,t.jsx)(v.default,{size:"large",allowClear:!0,className:"rounded-lg",placeholder:"Header name (e.g., X-API-Key)"})}),(0,t.jsx)(j.Z.Item,{...a,name:[r,"value"],className:"flex-1",rules:[{required:!0,message:"Header value is required"}],children:(0,t.jsx)(v.default,{size:"large",allowClear:!0,className:"rounded-lg",placeholder:"Header value"})}),(0,t.jsx)(D.Z,{onClick:()=>l(r),className:"text-gray-500 hover:text-red-500 cursor-pointer"})]},s)}),(0,t.jsx)(E.ZP,{type:"dashed",onClick:()=>r(),icon:(0,t.jsx)(J.Z,{}),block:!0,children:"Add Static Header"})]})}})})]})},"permissions")})};let $=e=>{try{let s=e.indexOf("/mcp/");if(-1===s)return{token:null,baseUrl:e};let r=e.split("/mcp/");if(2!==r.length)return{token:null,baseUrl:e};let t=r[0]+"/mcp/",l=r[1];if(!l)return{token:null,baseUrl:e};return{token:l,baseUrl:t}}catch(s){return console.error("Error parsing MCP URL:",s),{token:null,baseUrl:e}}},W=e=>{let{token:s,baseUrl:r}=$(e);return s?r+"...":e},Q=e=>{let{token:s}=$(e);return{maskedUrl:W(e),hasToken:!!s}},X=e=>e?/^https?:\/\/[^\s/$.?#].[^\s]*$/i.test(e)?Promise.resolve():Promise.reject("Please enter a valid URL (e.g., http://service-name.domain:1234/path or https://example.com)"):Promise.resolve(),ee=e=>e&&e.includes("-")?Promise.reject("Server name cannot contain '-' (hyphen). Please use '_' (underscore) instead."):Promise.resolve(),es=e=>{let s=new Uint8Array(e),r="";return s.forEach(e=>r+=String.fromCharCode(e)),btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")},er=()=>{let e=new Uint8Array(32);return window.crypto.getRandomValues(e),es(e.buffer)},et=async e=>{let s=new TextEncoder().encode(e);return es(await window.crypto.subtle.digest("SHA-256",s))},el=e=>{let{accessToken:s,getCredentials:r,getTemporaryPayload:t,onTokenReceived:l,onBeforeRedirect:a}=e,[n,i]=(0,x.useState)("idle"),[o,c]=(0,x.useState)(null),[d,m]=(0,x.useState)(null),u="litellm-mcp-oauth-flow-state",g="litellm-mcp-oauth-result",j="litellm-mcp-oauth-return-url",v=()=>{try{window.sessionStorage.removeItem(u),window.sessionStorage.removeItem(g),window.sessionStorage.removeItem(j)}catch(e){console.warn("Failed to clear OAuth storage",e)}},f=()=>"".concat(window.location.origin,"/mcp/oauth/callback"),b=(0,x.useCallback)(async()=>{let e=r()||{};if(!s){c("Missing admin token"),h.Z.error("Access token missing. Please re-authenticate and try again.");return}let l=t();if(!l||!l.url||!l.transport){let e="Please complete server URL and transport before starting OAuth.";c(e),h.Z.error(e);return}try{var n,o,d;i("authorizing"),c(null);let r=await (0,p.cacheTemporaryMcpServer)(s,l),t=null==r?void 0:null===(n=r.server_id)||void 0===n?void 0:n.trim();if(!t)throw Error("Temporary MCP server identifier missing. Please retry.");let m={};if(!((null===(o=l.credentials)||void 0===o?void 0:o.client_id)&&(null===(d=l.credentials)||void 0===d?void 0:d.client_secret))){let e=await (0,p.registerMcpOAuthClient)(s,t,{client_name:l.alias||l.server_name||t,grant_types:["authorization_code"],response_types:["code"],token_endpoint_auth_method:l.credentials&&l.credentials.client_secret?"client_secret_post":"none"});m={clientId:null==e?void 0:e.client_id,clientSecret:null==e?void 0:e.client_secret}}let x=er(),h=await et(x),g=crypto.randomUUID(),v=m.clientId||e.client_id,b=Array.isArray(e.scopes)?e.scopes.filter(e=>e&&e.trim().length>0).join(" "):void 0,y=(0,p.buildMcpOAuthAuthorizeUrl)({serverId:t,clientId:v,redirectUri:f(),state:g,codeChallenge:h,scope:b}),N={state:g,codeVerifier:x,clientId:v,clientSecret:m.clientSecret||e.client_secret,serverId:t,redirectUri:f()};if(a)try{a()}catch(e){console.error("Failed to prepare for OAuth redirect",e)}try{window.sessionStorage.setItem(u,JSON.stringify(N)),window.sessionStorage.setItem(j,window.location.href)}catch(e){throw console.error("Unable to persist OAuth state",e),Error("Unable to access browser storage for OAuth. Please enable storage and retry.")}window.location.href=y}catch(s){console.error("Failed to start OAuth flow",s),i("error");let e=s instanceof Error?s.message:String(s);c(e),h.Z.error(e)}},[s,r,t,a]),y=(0,x.useCallback)(async()=>{let e=null,s=null;try{let r=window.sessionStorage.getItem(g);if(!r)return;e=JSON.parse(r),s=JSON.parse(window.sessionStorage.getItem(u)||"null")}catch(e){console.error("Failed to read OAuth session state",e),v(),c("Failed to resume OAuth flow. Please retry."),i("error"),h.Z.error("Failed to resume OAuth flow. Please retry.");return}if(e){window.sessionStorage.removeItem(g);try{if(!s||!s.state||!s.codeVerifier||!s.serverId)throw Error("Missing OAuth session state. Please retry.");if(!e.state||e.state!==s.state)throw Error("OAuth state mismatch. Please retry.");if(e.error)throw Error(e.error_description||e.error);if(!e.code)throw Error("Authorization code missing in callback.");i("exchanging");let r=await (0,p.exchangeMcpOAuthToken)({serverId:s.serverId,code:e.code,clientId:s.clientId,clientSecret:s.clientSecret,codeVerifier:s.codeVerifier,redirectUri:s.redirectUri});l(r),m(r),i("success"),c(null),h.Z.success("OAuth token retrieved successfully")}catch(s){console.error("OAuth flow failed",s);let e=s instanceof Error?s.message:String(s);c(e),i("error"),h.Z.error(e)}finally{v()}}},[l]);return(0,x.useEffect)(()=>{let e=!1;return(async()=>{e||await y()})(),()=>{e=!0}},[y]),{startOAuthFlow:b,status:n,error:o,tokenResponse:d}},ea="".concat("../ui/assets/logos/","mcp_logo.png"),en=[y.API_KEY,y.BEARER_TOKEN,y.BASIC],ei=[...en,y.OAUTH2],eo="litellm-mcp-oauth-create-state";var ec=e=>{var s;let{userRole:r,accessToken:a,onCreateSuccess:n,isModalVisible:i,setModalVisible:o,availableAccessGroups:u}=e,[g]=j.Z.useForm(),[N,_]=(0,x.useState)(!1),[w,Z]=(0,x.useState)({}),[C,S]=(0,x.useState)({}),[k,P]=(0,x.useState)(null),[A,T]=(0,x.useState)(!1),[M,O]=(0,x.useState)([]),[L,E]=(0,x.useState)([]),[z,q]=(0,x.useState)(""),[U,R]=(0,x.useState)(""),[V,H]=(0,x.useState)(null),D=C.auth_type,J=!!D&&en.includes(D),G=D===y.OAUTH2,{startOAuthFlow:$,status:W,error:Q,tokenResponse:es}=el({accessToken:a,getCredentials:()=>g.getFieldValue("credentials"),getTemporaryPayload:()=>{let e=g.getFieldsValue(!0),s=e.url,r=e.transport||z;if(!s||!r)return null;let t=Array.isArray(e.static_headers)?e.static_headers.reduce((e,s)=>{var r,t;let l=null==s?void 0:null===(r=s.header)||void 0===r?void 0:r.trim();return l&&(e[l]=null!==(t=null==s?void 0:s.value)&&void 0!==t?t:""),e},{}):{};return{server_id:void 0,server_name:e.server_name,alias:e.alias,description:e.description,url:s,transport:r,auth_type:y.OAUTH2,credentials:e.credentials,mcp_access_groups:e.mcp_access_groups,static_headers:t,command:e.command,args:e.args,env:e.env}},onTokenReceived:e=>{var s;H(null!==(s=null==e?void 0:e.access_token)&&void 0!==s?s:null)},onBeforeRedirect:()=>{try{let e=g.getFieldsValue(!0);window.sessionStorage.setItem(eo,JSON.stringify({modalVisible:i,formValues:e,transportType:z,costConfig:w,allowedTools:L,searchValue:U,aliasManuallyEdited:A}))}catch(e){console.warn("Failed to persist MCP create state",e)}}});x.useEffect(()=>{let e=window.sessionStorage.getItem(eo);if(e)try{var s;let r=JSON.parse(e);r.modalVisible&&o(!0);let t=(null===(s=r.formValues)||void 0===s?void 0:s.transport)||r.transportType||"";t&&q(t),r.formValues&&P({values:r.formValues,transport:t}),r.costConfig&&Z(r.costConfig),r.allowedTools&&E(r.allowedTools),r.searchValue&&R(r.searchValue),"boolean"==typeof r.aliasManuallyEdited&&T(r.aliasManuallyEdited)}catch(e){console.error("Failed to restore MCP create state",e)}finally{window.sessionStorage.removeItem(eo)}},[g,o]),x.useEffect(()=>{k&&(z||k.transport,(!k.transport||z)&&(g.setFieldsValue(k.values),S(k.values),P(null)))},[k,g,z]);let er=async e=>{_(!0);try{let{static_headers:s,stdio_config:r,credentials:t,...l}=e,i=l.mcp_access_groups,c=Array.isArray(s)?s.reduce((e,s)=>{var r,t;let l=null==s?void 0:null===(r=s.header)||void 0===r?void 0:r.trim();return l&&(e[l]=null!==(t=null==s?void 0:s.value)&&void 0!==t?t:""),e},{}):{},d=t&&"object"==typeof t?Object.entries(t).reduce((e,s)=>{let[r,t]=s;if(null==t||""===t)return e;if("scopes"===r){if(Array.isArray(t)){let s=t.filter(e=>null!=e&&""!==e);s.length>0&&(e[r]=s)}}else e[r]=t;return e},{}):void 0,m={};if(r&&"stdio"===z)try{let e=JSON.parse(r),s=e;if(e.mcpServers&&"object"==typeof e.mcpServers){let r=Object.keys(e.mcpServers);if(r.length>0){let t=r[0];s=e.mcpServers[t],l.server_name||(l.server_name=t.replace(/-/g,"_"))}}m={command:s.command,args:s.args,env:s.env},console.log("Parsed stdio config:",m)}catch(e){h.Z.fromBackend("Invalid JSON in stdio configuration");return}let u={...l,...m,stdio_config:void 0,mcp_info:{server_name:l.server_name||l.url,description:l.description,mcp_server_cost_info:Object.keys(w).length>0?w:null},mcp_access_groups:i,alias:l.alias,allowed_tools:L.length>0?L:null,static_headers:c};if(u.static_headers=c,l.auth_type&&ei.includes(l.auth_type)&&d&&Object.keys(d).length>0&&(u.credentials=d),console.log("Payload: ".concat(JSON.stringify(u))),null!=a){let e=await (0,p.createMCPServer)(a,u);h.Z.success("MCP Server created successfully"),g.resetFields(),Z({}),O([]),E([]),T(!1),o(!1),n(e)}}catch(e){h.Z.fromBackend("Error creating MCP Server: "+e)}finally{_(!1)}},et=()=>{g.resetFields(),Z({}),O([]),E([]),T(!1),o(!1)};return(x.useEffect(()=>{if(!A&&C.server_name){let e=C.server_name.replace(/\s+/g,"_");g.setFieldsValue({alias:e}),S(s=>({...s,alias:e}))}},[C.server_name]),x.useEffect(()=>{i||S({})},[i]),(0,l.tY)(r))?(0,t.jsx)(m.Z,{title:(0,t.jsxs)("div",{className:"flex items-center space-x-3 pb-4 border-b border-gray-100",children:[(0,t.jsx)("img",{src:ea,alt:"MCP Logo",className:"w-8 h-8 object-contain",style:{height:"20px",width:"20px",marginRight:"8px",objectFit:"contain"}}),(0,t.jsx)("h2",{className:"text-xl font-semibold text-gray-900",children:"Add New MCP Server"})]}),open:i,width:1e3,onCancel:et,footer:null,className:"top-8",styles:{body:{padding:"24px"},header:{padding:"24px 24px 0 24px",border:"none"}},children:(0,t.jsx)("div",{className:"mt-6",children:(0,t.jsxs)(j.Z,{form:g,onFinish:er,onValuesChange:(e,s)=>S(s),layout:"vertical",className:"space-y-6",children:[(0,t.jsxs)("div",{className:"grid grid-cols-1 gap-6",children:[(0,t.jsx)(j.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["MCP Server Name",(0,t.jsx)(d.Z,{title:"Best practice: Use a descriptive name that indicates the server's purpose (e.g., 'GitHub_MCP', 'Email_Service'). Hyphens '-' are not allowed; use underscores '_' instead.",children:(0,t.jsx)(f.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"server_name",rules:[{required:!1,message:"Please enter a server name"},{validator:(e,s)=>ee(s)}],children:(0,t.jsx)(b.o,{placeholder:"e.g., GitHub_MCP, Zapier_MCP, etc.",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsx)(j.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Alias",(0,t.jsx)(d.Z,{title:"A short, unique identifier for this server. Defaults to the server name with spaces replaced by underscores.",children:(0,t.jsx)(f.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"alias",rules:[{required:!1},{validator:(e,s)=>s&&s.includes("-")?Promise.reject("Alias cannot contain '-' (hyphen). Please use '_' (underscore) instead."):Promise.resolve()}],children:(0,t.jsx)(b.o,{placeholder:"e.g., GitHub_MCP, Zapier_MCP, etc.",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500",onChange:()=>T(!0)})}),(0,t.jsx)(j.Z.Item,{label:(0,t.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Description"}),name:"description",rules:[{required:!1,message:"Please enter a server description!!!!!!!!!"}],children:(0,t.jsx)(b.o,{placeholder:"Brief description of what this server does",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsx)(j.Z.Item,{label:(0,t.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Transport Type"}),name:"transport",rules:[{required:!0,message:"Please select a transport type"}],children:(0,t.jsxs)(c.default,{placeholder:"Select transport",className:"rounded-lg",size:"large",onChange:e=>{q(e),"stdio"===e?g.setFieldsValue({url:void 0,auth_type:void 0,credentials:void 0}):g.setFieldsValue({command:void 0,args:void 0,env:void 0})},value:z,children:[(0,t.jsx)(c.default.Option,{value:"http",children:"HTTP"}),(0,t.jsx)(c.default.Option,{value:"sse",children:"Server-Sent Events (SSE)"}),(0,t.jsx)(c.default.Option,{value:"stdio",children:"Standard Input/Output (stdio)"})]})}),"stdio"!==z&&(0,t.jsx)(j.Z.Item,{label:(0,t.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"MCP Server URL"}),name:"url",rules:[{required:!0,message:"Please enter a server URL"},{validator:(e,s)=>X(s)}],children:(0,t.jsx)(v.default,{placeholder:"https://your-mcp-server.com",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),"stdio"!==z&&(0,t.jsx)(j.Z.Item,{label:(0,t.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Authentication"}),name:"auth_type",rules:[{required:!0,message:"Please select an auth type"}],children:(0,t.jsxs)(c.default,{placeholder:"Select auth type",className:"rounded-lg",size:"large",children:[(0,t.jsx)(c.default.Option,{value:"none",children:"None"}),(0,t.jsx)(c.default.Option,{value:"api_key",children:"API Key"}),(0,t.jsx)(c.default.Option,{value:"bearer_token",children:"Bearer Token"}),(0,t.jsx)(c.default.Option,{value:"basic",children:"Basic Auth"}),(0,t.jsx)(c.default.Option,{value:"oauth2",children:"OAuth"})]})}),"stdio"!==z&&J&&(0,t.jsx)(j.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Authentication Value",(0,t.jsx)(d.Z,{title:"Token, password, or header value to send with each request for the selected auth type.",children:(0,t.jsx)(f.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","auth_value"],rules:[{required:!0,message:"Please enter the authentication value"}],children:(0,t.jsx)(b.o,{type:"password",placeholder:"Enter token or secret",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),"stdio"!==z&&G&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(j.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["OAuth Client ID (optional)",(0,t.jsx)(d.Z,{title:"Provide only if your MCP server cannot handle dynamic client registration.",children:(0,t.jsx)(f.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","client_id"],children:(0,t.jsx)(b.o,{type:"password",placeholder:"Enter OAuth client ID",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsx)(j.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["OAuth Client Secret (optional)",(0,t.jsx)(d.Z,{title:"Provide only if your MCP server cannot handle dynamic client registration.",children:(0,t.jsx)(f.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","client_secret"],children:(0,t.jsx)(b.o,{type:"password",placeholder:"Enter OAuth client secret",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsx)(j.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["OAuth Scopes (optional)",(0,t.jsx)(d.Z,{title:"Optional scopes requested during token exchange. Separate multiple scopes with enter or commas.",children:(0,t.jsx)(f.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","scopes"],children:(0,t.jsx)(c.default,{mode:"tags",tokenSeparators:[","],placeholder:"Add scopes",className:"rounded-lg",size:"large"})}),(0,t.jsxs)("div",{className:"rounded-lg border border-dashed border-gray-300 p-4 space-y-2",children:[(0,t.jsx)("p",{className:"text-sm text-gray-600",children:"Complete the OAuth authorization flow to fetch an access token and store it as the authentication value."}),(0,t.jsx)(b.z,{variant:"secondary",onClick:$,disabled:"authorizing"===W||"exchanging"===W,children:"authorizing"===W?"Waiting for authorization...":"exchanging"===W?"Exchanging authorization code...":"Authorize & Fetch Token"}),Q&&(0,t.jsx)("p",{className:"text-sm text-red-500",children:Q}),"success"===W&&(null==es?void 0:es.access_token)&&(0,t.jsxs)("p",{className:"text-sm text-green-600",children:["Token fetched. Expires in ",null!==(s=es.expires_in)&&void 0!==s?s:"?"," seconds."]})]})]}),(0,t.jsx)(K,{isVisible:"stdio"===z})]}),(0,t.jsx)("div",{className:"mt-8",children:(0,t.jsx)(Y,{availableAccessGroups:u,mcpServer:null,searchValue:U,setSearchValue:R,getAccessGroupOptions:()=>{let e=u.map(e=>({value:e,label:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:e})]})}));return U&&!u.some(e=>e.toLowerCase().includes(U.toLowerCase()))&&e.push({value:U,label:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:U}),(0,t.jsx)("span",{className:"text-gray-400 text-xs ml-1",children:"create new group"})]})}),e}})}),(0,t.jsx)("div",{className:"mt-8 pt-6 border-t border-gray-200",children:(0,t.jsx)(F,{accessToken:a,oauthAccessToken:V,formValues:C,onToolsLoaded:O})}),(0,t.jsx)("div",{className:"mt-6",children:(0,t.jsx)(B,{accessToken:a,oauthAccessToken:V,formValues:C,allowedTools:L,existingAllowedTools:null,onAllowedToolsChange:E})}),(0,t.jsx)("div",{className:"mt-6",children:(0,t.jsx)(I,{value:w,onChange:Z,tools:M.filter(e=>L.includes(e.name)),disabled:!1})}),(0,t.jsxs)("div",{className:"flex items-center justify-end space-x-3 pt-6 border-t border-gray-100",children:[(0,t.jsx)(b.z,{variant:"secondary",onClick:et,children:"Cancel"}),(0,t.jsx)(b.z,{variant:"primary",loading:N,children:N?"Creating...":"Add MCP Server"})]})]})})}):null},ed=r(5945),em=r(63709),eu=r(12485),ex=r(18135),eh=r(35242),ep=r(29706),eg=r(77991),ej=r(64935),ev=r(30401),ef=r(78867),eb=r(11239),ey=r(54001),eN=r(96137),e_=r(96362),ew=r(80221),eZ=r(29202),eC=r(59872);let{Title:eS,Text:ek}=o.default,{Panel:eP}=C.default,eA=e=>{let{icon:s,title:r,description:l,children:a,serverName:n,accessGroups:i=["dev"]}=e,[o,c]=(0,x.useState)(!1),d=()=>{let e={"x-litellm-api-key":"Bearer YOUR_LITELLM_API_KEY"};if(o&&n){let s=[n.replace(/\s+/g,"_"),...i].join(",");e["x-mcp-servers"]=[s]}return e};return(0,t.jsxs)(ed.Z,{className:"border border-gray-200",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,t.jsx)("span",{className:"p-2 rounded-lg bg-gray-50",children:s}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eS,{level:5,className:"mb-0",children:r}),(0,t.jsx)(ek,{className:"text-gray-600",children:l})]})]}),n&&("Implementation Example"===r||"Configuration"===r)&&(0,t.jsxs)(j.Z.Item,{className:"mb-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,t.jsx)(em.Z,{size:"small",checked:o,onChange:c}),(0,t.jsxs)(ek,{className:"text-sm",children:["Limit tools to specific MCP servers or MCP groups by passing the ",(0,t.jsx)("code",{children:"x-mcp-servers"})," header"]})]}),o&&(0,t.jsx)(L.Z,{className:"mt-2",type:"info",showIcon:!0,message:"Two Options",description:(0,t.jsxs)("div",{children:[(0,t.jsxs)("p",{children:[(0,t.jsx)("strong",{children:"Option 1:"})," Get a specific server: ",(0,t.jsxs)("code",{children:['["',n.replace(/\s+/g,"_"),'"]']})]}),(0,t.jsxs)("p",{children:[(0,t.jsx)("strong",{children:"Option 2:"})," Get a group of MCPs: ",(0,t.jsx)("code",{children:'["dev-group"]'})]}),(0,t.jsxs)("p",{className:"mt-2 text-sm text-gray-600",children:["You can also mix both: ",(0,t.jsx)("code",{children:'["Server1,dev-group"]'})]})]})})]}),x.Children.map(a,e=>{if(x.isValidElement(e)&&e.props.hasOwnProperty("code")&&e.props.hasOwnProperty("copyKey")){let s=e.props.code;if(s&&s.includes('"headers":'))return x.cloneElement(e,{code:s.replace(/"headers":\s*{[^}]*}/,'"headers": '.concat(JSON.stringify(d(),null,8)))})}return e})]})};var eT=e=>{let{currentServerAccessGroups:s=[]}=e,r=(0,p.getProxyBaseUrl)(),[l,a]=(0,x.useState)({}),[n,i]=(0,x.useState)({openai:[],litellm:[],cursor:[],http:[]}),[o]=(0,x.useState)("Zapier_MCP"),c=async(e,s)=>{await (0,eC.vQ)(e)&&(a(e=>({...e,[s]:!0})),setTimeout(()=>{a(e=>({...e,[s]:!1}))},2e3))},d=e=>{let{code:s,copyKey:r,title:a,className:n=""}=e;return(0,t.jsxs)("div",{className:"relative group",children:[a&&(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,t.jsx)(ej.Z,{size:16,className:"text-blue-600"}),(0,t.jsx)(ek,{strong:!0,className:"text-gray-700",children:a})]}),(0,t.jsxs)(ed.Z,{className:"bg-gray-50 border border-gray-200 relative ".concat(n),children:[(0,t.jsx)(E.ZP,{type:"text",size:"small",icon:l[r]?(0,t.jsx)(ev.Z,{size:12}):(0,t.jsx)(ef.Z,{size:12}),onClick:()=>c(s,r),className:"absolute top-2 right-2 z-10 transition-all duration-200 ".concat(l[r]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")}),(0,t.jsx)("pre",{className:"text-sm overflow-x-auto pr-10 text-gray-800 font-mono leading-relaxed",children:s})]})]})},m=e=>{let{step:s,title:r,children:l}=e;return(0,t.jsxs)("div",{className:"flex gap-4",children:[(0,t.jsx)("div",{className:"flex-shrink-0",children:(0,t.jsx)("div",{className:"w-8 h-8 bg-blue-600 text-white rounded-full flex items-center justify-center text-sm font-semibold",children:s})}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)(ek,{strong:!0,className:"text-gray-800 block mb-2",children:r}),l]})]})};return(0,t.jsx)("div",{children:(0,t.jsxs)(H.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(M.Z,{className:"text-3xl font-bold text-gray-900 mb-3",children:"Connect to your MCP client"}),(0,t.jsx)(T.Z,{className:"text-lg text-gray-600",children:"Use tools directly from any MCP client with LiteLLM MCP. Enable your AI assistant to perform real-world tasks through a simple, secure connection."})]}),(0,t.jsxs)(ex.Z,{className:"w-full",children:[(0,t.jsx)(eh.Z,{className:"flex justify-start mt-8 mb-6",children:(0,t.jsxs)("div",{className:"flex bg-gray-100 p-1 rounded-lg",children:[(0,t.jsx)(eu.Z,{className:"px-6 py-3 rounded-md transition-all duration-200",children:(0,t.jsxs)("span",{className:"flex items-center gap-2 font-medium",children:[(0,t.jsx)(ej.Z,{size:18}),"OpenAI API"]})}),(0,t.jsx)(eu.Z,{className:"px-6 py-3 rounded-md transition-all duration-200",children:(0,t.jsxs)("span",{className:"flex items-center gap-2 font-medium",children:[(0,t.jsx)(eb.Z,{size:18}),"LiteLLM Proxy"]})}),(0,t.jsx)(eu.Z,{className:"px-6 py-3 rounded-md transition-all duration-200",children:(0,t.jsxs)("span",{className:"flex items-center gap-2 font-medium",children:[(0,t.jsx)(ew.Z,{size:18}),"Cursor"]})}),(0,t.jsx)(eu.Z,{className:"px-6 py-3 rounded-md transition-all duration-200",children:(0,t.jsxs)("span",{className:"flex items-center gap-2 font-medium",children:[(0,t.jsx)(eZ.Z,{size:18}),"Streamable HTTP"]})})]})}),(0,t.jsxs)(eg.Z,{children:[(0,t.jsx)(ep.Z,{className:"mt-6",children:(0,t.jsx)(()=>(0,t.jsxs)(H.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsxs)("div",{className:"bg-gradient-to-r from-blue-50 to-indigo-50 p-6 rounded-lg border border-blue-100",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,t.jsx)(ej.Z,{className:"text-blue-600",size:24}),(0,t.jsx)(eS,{level:4,className:"mb-0 text-blue-900",children:"OpenAI Responses API Integration"})]}),(0,t.jsx)(ek,{className:"text-blue-700",children:"Connect OpenAI Responses API to your LiteLLM MCP server for seamless tool integration"})]}),(0,t.jsxs)(H.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsx)(eA,{icon:(0,t.jsx)(ey.Z,{className:"text-blue-600",size:16}),title:"API Key Setup",description:"Configure your OpenAI API key for authentication",children:(0,t.jsxs)(H.Z,{direction:"vertical",size:"middle",className:"w-full",children:[(0,t.jsx)("div",{children:(0,t.jsxs)(ek,{children:["Get your API key from the"," ",(0,t.jsxs)("a",{href:"https://platform.openai.com/api-keys",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-700 inline-flex items-center gap-1",children:["OpenAI platform ",(0,t.jsx)(e_.Z,{size:12})]})]})}),(0,t.jsx)(d,{title:"Environment Variable",code:'export OPENAI_API_KEY="sk-..."',copyKey:"openai-env"})]})}),(0,t.jsx)(eA,{icon:(0,t.jsx)(eN.Z,{className:"text-blue-600",size:16}),title:"MCP Server Information",description:"Connection details for your LiteLLM MCP server",children:(0,t.jsx)(d,{title:"Server URL",code:"".concat(r,"/mcp"),copyKey:"openai-server-url"})}),(0,t.jsx)(eA,{icon:(0,t.jsx)(ej.Z,{className:"text-blue-600",size:16}),title:"Implementation Example",description:"Complete cURL example for using the Responses API",serverName:"Zapier Gmail",accessGroups:["dev"],children:(0,t.jsx)(d,{code:'curl --location \'https://api.openai.com/v1/responses\' \\\n--header \'Content-Type: application/json\' \\\n--header "Authorization: Bearer $OPENAI_API_KEY" \\\n--data \'{\n "model": "gpt-4.1",\n "tools": [\n {\n "type": "mcp",\n "server_label": "litellm",\n "server_url": "'.concat(r,'/mcp",\n "require_approval": "never",\n "headers": {\n "x-litellm-api-key": "Bearer YOUR_LITELLM_API_KEY",\n "x-mcp-servers": ["Zapier_MCP,dev"]\n }\n }\n ],\n "input": "Run available tools",\n "tool_choice": "required"\n}\''),copyKey:"openai-curl",className:"text-xs"})})]})]}),{})}),(0,t.jsx)(ep.Z,{className:"mt-6",children:(0,t.jsx)(()=>(0,t.jsxs)(H.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsxs)("div",{className:"bg-gradient-to-r from-emerald-50 to-green-50 p-6 rounded-lg border border-emerald-100",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,t.jsx)(eb.Z,{className:"text-emerald-600",size:24}),(0,t.jsx)(eS,{level:4,className:"mb-0 text-emerald-900",children:"LiteLLM Proxy API Integration"})]}),(0,t.jsx)(ek,{className:"text-emerald-700",children:"Connect to LiteLLM Proxy Responses API for seamless tool integration with multiple model providers"})]}),(0,t.jsxs)(H.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsx)(eA,{icon:(0,t.jsx)(ey.Z,{className:"text-emerald-600",size:16}),title:"Virtual Key Setup",description:"Configure your LiteLLM Proxy Virtual Key for authentication",children:(0,t.jsxs)(H.Z,{direction:"vertical",size:"middle",className:"w-full",children:[(0,t.jsx)("div",{children:(0,t.jsx)(ek,{children:"Get your Virtual Key from your LiteLLM Proxy dashboard or contact your administrator"})}),(0,t.jsx)(d,{title:"Environment Variable",code:'export LITELLM_API_KEY="sk-..."',copyKey:"litellm-env"})]})}),(0,t.jsx)(eA,{icon:(0,t.jsx)(eN.Z,{className:"text-emerald-600",size:16}),title:"MCP Server Information",description:"Connection details for your LiteLLM MCP server",children:(0,t.jsx)(d,{title:"Server URL",code:"".concat(r,"/mcp"),copyKey:"litellm-server-url"})}),(0,t.jsx)(eA,{icon:(0,t.jsx)(ej.Z,{className:"text-emerald-600",size:16}),title:"Implementation Example",description:"Complete cURL example for using the LiteLLM Proxy Responses API",serverName:o,accessGroups:["dev"],children:(0,t.jsx)(d,{code:"curl --location '".concat(r,'/v1/responses\' \\\n--header \'Content-Type: application/json\' \\\n--header "Authorization: Bearer $LITELLM_VIRTUAL_KEY" \\\n--data \'{\n "model": "gpt-4",\n "tools": [\n {\n "type": "mcp",\n "server_label": "litellm",\n "server_url": "').concat(r,'/mcp",\n "require_approval": "never",\n "headers": {\n "x-litellm-api-key": "Bearer YOUR_LITELLM_VIRTUAL_KEY",\n "x-mcp-servers": ["Zapier_MCP,dev"]\n }\n }\n ],\n "input": "Run available tools",\n "tool_choice": "required"\n}\''),copyKey:"litellm-curl",className:"text-xs"})})]})]}),{})}),(0,t.jsx)(ep.Z,{className:"mt-6",children:(0,t.jsx)(()=>(0,t.jsxs)(H.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsxs)("div",{className:"bg-gradient-to-r from-purple-50 to-blue-50 p-6 rounded-lg border border-purple-100",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,t.jsx)(ew.Z,{className:"text-purple-600",size:24}),(0,t.jsx)(eS,{level:4,className:"mb-0 text-purple-900",children:"Cursor IDE Integration"})]}),(0,t.jsx)(ek,{className:"text-purple-700",children:"Use tools directly from Cursor IDE with LiteLLM MCP. Enable your AI assistant to perform real-world tasks without leaving your coding environment."})]}),(0,t.jsxs)(ed.Z,{className:"border border-gray-200",children:[(0,t.jsx)(eS,{level:5,className:"mb-4 text-gray-800",children:"Setup Instructions"}),(0,t.jsxs)(H.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsx)(m,{step:1,title:"Open Cursor Settings",children:(0,t.jsxs)(ek,{className:"text-gray-600",children:["Use the keyboard shortcut ",(0,t.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded",children:"⇧+⌘+J"})," (Mac) or"," ",(0,t.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded",children:"Ctrl+Shift+J"})," (Windows/Linux)"]})}),(0,t.jsx)(m,{step:2,title:"Navigate to MCP Tools",children:(0,t.jsx)(ek,{className:"text-gray-600",children:'Go to the "MCP Tools" tab and click "New MCP Server"'})}),(0,t.jsxs)(m,{step:3,title:"Add Configuration",children:[(0,t.jsxs)(ek,{className:"text-gray-600 mb-3",children:["Copy the JSON configuration below and paste it into Cursor, then save with"," ",(0,t.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded",children:"Cmd+S"})," or"," ",(0,t.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded",children:"Ctrl+S"})]}),(0,t.jsx)(eA,{icon:(0,t.jsx)(ej.Z,{className:"text-purple-600",size:16}),title:"Configuration",description:"Cursor MCP configuration",serverName:"Zapier Gmail",accessGroups:["dev"],children:(0,t.jsx)(d,{code:'{\n "mcpServers": {\n "Zapier_MCP": {\n "url": "'.concat(r,'/mcp",\n "headers": {\n "x-litellm-api-key": "Bearer YOUR_LITELLM_API_KEY",\n "x-mcp-servers": ["Zapier_MCP,dev"]\n }\n }\n }\n}'),copyKey:"cursor-config",className:"text-xs"})})]})]})]})]}),{})}),(0,t.jsx)(ep.Z,{className:"mt-6",children:(0,t.jsx)(()=>(0,t.jsxs)(H.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsxs)("div",{className:"bg-gradient-to-r from-green-50 to-teal-50 p-6 rounded-lg border border-green-100",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,t.jsx)(eZ.Z,{className:"text-green-600",size:24}),(0,t.jsx)(eS,{level:4,className:"mb-0 text-green-900",children:"Streamable HTTP Transport"})]}),(0,t.jsx)(ek,{className:"text-green-700",children:"Connect to LiteLLM MCP using HTTP transport. Compatible with any MCP client that supports HTTP streaming."})]}),(0,t.jsx)(eA,{icon:(0,t.jsx)(eZ.Z,{className:"text-green-600",size:16}),title:"Universal MCP Connection",description:"Use this URL with any MCP client that supports HTTP transport",children:(0,t.jsxs)(H.Z,{direction:"vertical",size:"middle",className:"w-full",children:[(0,t.jsx)("div",{children:(0,t.jsx)(ek,{children:"Each MCP client supports different transports. Refer to your client documentation to determine the appropriate transport method."})}),(0,t.jsx)(d,{title:"Server URL",code:"".concat(r,"/mcp"),copyKey:"http-server-url"}),(0,t.jsx)(d,{title:"Headers Configuration",code:JSON.stringify({"x-litellm-api-key":"Bearer YOUR_LITELLM_API_KEY"},null,2),copyKey:"http-headers"}),(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(E.ZP,{type:"link",className:"p-0 h-auto text-blue-600 hover:text-blue-700",href:"https://modelcontextprotocol.io/docs/concepts/transports",icon:(0,t.jsx)(e_.Z,{size:14}),children:"Learn more about MCP transports"})})]})})]}),{})})]})]})]})})},eM=r(58927),eI=r(53410),eO=r(74998);let eL=(e,s,r,l)=>[{accessorKey:"server_id",header:"Server ID",cell:e=>{let{row:r}=e;return(0,t.jsxs)("button",{onClick:()=>s(r.original.server_id),className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[15ch]",children:[r.original.server_id.slice(0,7),"..."]})}},{accessorKey:"server_name",header:"Name"},{accessorKey:"alias",header:"Alias"},{id:"url",header:"URL",cell:e=>{let{row:s}=e,{maskedUrl:r}=Q(s.original.url);return(0,t.jsx)("span",{className:"font-mono text-sm",children:r})}},{accessorKey:"transport",header:"Transport",cell:e=>{let{getValue:s}=e;return(0,t.jsx)("span",{children:(s()||"http").toUpperCase()})}},{accessorKey:"auth_type",header:"Auth Type",cell:e=>{let{getValue:s}=e;return(0,t.jsx)("span",{children:s()||"none"})}},{id:"health_status",header:"Health Status",cell:e=>{let{row:s}=e,r=s.original,l=r.status||"unknown",a=r.last_health_check,n=r.health_check_error,i=(0,t.jsxs)("div",{className:"max-w-xs",children:[(0,t.jsxs)("div",{className:"font-semibold mb-1",children:["Health Status: ",l]}),a&&(0,t.jsxs)("div",{className:"text-xs mb-1",children:["Last Check: ",new Date(a).toLocaleString()]}),n&&(0,t.jsxs)("div",{className:"text-xs",children:[(0,t.jsx)("div",{className:"font-medium text-red-400 mb-1",children:"Error:"}),(0,t.jsx)("div",{className:"break-words",children:n})]}),!a&&!n&&(0,t.jsx)("div",{className:"text-xs text-gray-400",children:"No health check data available"})]});return(0,t.jsx)(d.Z,{title:i,placement:"top",children:(0,t.jsxs)("button",{className:"font-mono text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[10ch] ".concat((e=>{switch(e){case"healthy":return"text-green-500 bg-green-50 hover:bg-green-100";case"unhealthy":return"text-red-500 bg-red-50 hover:bg-red-100";default:return"text-gray-500 bg-gray-50 hover:bg-gray-100"}})(l)),children:[(0,t.jsx)("span",{className:"mr-1",children:"●"}),l.charAt(0).toUpperCase()+l.slice(1)]})})}},{id:"mcp_access_groups",header:"Access Groups",cell:e=>{let{row:s}=e,r=s.original.mcp_access_groups;if(Array.isArray(r)&&r.length>0&&"string"==typeof r[0]){let e=r.join(", ");return(0,t.jsx)(d.Z,{title:e,children:(0,t.jsx)("span",{className:"max-w-[200px] truncate block",children:e.length>30?"".concat(e.slice(0,30),"..."):e})})}return(0,t.jsx)("span",{className:"text-gray-400 italic",children:"None"})}},{header:"Created At",accessorKey:"created_at",sortingFn:"datetime",cell:e=>{let{row:s}=e,r=s.original;return(0,t.jsx)("span",{className:"text-xs",children:r.created_at?new Date(r.created_at).toLocaleDateString():"-"})}},{header:"Updated At",accessorKey:"updated_at",sortingFn:"datetime",cell:e=>{let{row:s}=e,r=s.original;return(0,t.jsx)("span",{className:"text-xs",children:r.updated_at?new Date(r.updated_at).toLocaleDateString():"-"})}},{id:"actions",header:"Actions",cell:e=>{let{row:s}=e;return(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(d.Z,{title:"Edit MCP Server",children:(0,t.jsx)(eM.J,{icon:eI.Z,size:"sm",onClick:()=>r(s.original.server_id),className:"cursor-pointer hover:text-blue-600"})}),(0,t.jsx)(d.Z,{title:"Delete MCP Server",children:(0,t.jsx)(eM.J,{icon:eO.Z,size:"sm",onClick:()=>l(s.original.server_id),className:"cursor-pointer hover:text-red-600"})})]})}}];var eE=r(10900),ez=r(82376),eq=r(71437),eU=r(78489),eR=r(67101),eF=r(47323),eV=r(49566);let eB=[y.API_KEY,y.BEARER_TOKEN,y.BASIC],eK=[...eB,y.OAUTH2],eH="litellm-mcp-oauth-edit-state";var eD=e=>{var s;let{mcpServer:r,accessToken:l,onCancel:a,onSuccess:n,availableAccessGroups:i}=e,[o]=j.Z.useForm(),[m,u]=(0,x.useState)({}),[g,v]=(0,x.useState)([]),[b,N]=(0,x.useState)(!1),[_,w]=(0,x.useState)(""),[Z,C]=(0,x.useState)(!1),[S,k]=(0,x.useState)([]),[P,A]=(0,x.useState)(null),T=j.Z.useWatch("auth_type",o),M=!!T&&eB.includes(T),O=T===y.OAUTH2,[L,z]=(0,x.useState)(null),{startOAuthFlow:q,status:U,error:R,tokenResponse:F}=el({accessToken:l,getCredentials:()=>o.getFieldValue("credentials"),getTemporaryPayload:()=>{let e=o.getFieldsValue(!0),s=e.url||r.url,t=e.transport||r.transport;if(!s||!t)return null;let l=Array.isArray(e.static_headers)?e.static_headers.reduce((e,s)=>{var r,t;let l=null==s?void 0:null===(r=s.header)||void 0===r?void 0:r.trim();return l&&(e[l]=null!==(t=null==s?void 0:s.value)&&void 0!==t?t:""),e},{}):{};return{server_id:r.server_id,server_name:e.server_name||r.server_name||r.alias,alias:e.alias||r.alias,description:e.description||r.description,url:s,transport:t,auth_type:y.OAUTH2,credentials:e.credentials,mcp_access_groups:e.mcp_access_groups||r.mcp_access_groups,static_headers:l,command:e.command,args:e.args,env:e.env}},onTokenReceived:e=>{var s;z(null!==(s=null==e?void 0:e.access_token)&&void 0!==s?s:null)},onBeforeRedirect:()=>{try{let e=o.getFieldsValue(!0);window.sessionStorage.setItem(eH,JSON.stringify({serverId:r.server_id,formValues:e,costConfig:m,allowedTools:S,searchValue:_,aliasManuallyEdited:Z}))}catch(e){console.warn("Failed to persist MCP edit state",e)}}}),V=x.useMemo(()=>r.static_headers?Object.entries(r.static_headers).map(e=>{let[s,r]=e;return{header:s,value:null!=r?String(r):""}}):[],[r.static_headers]),K=x.useMemo(()=>({...r,static_headers:V}),[r,V]);(0,x.useEffect)(()=>{var e;(null===(e=r.mcp_info)||void 0===e?void 0:e.mcp_server_cost_info)&&u(r.mcp_info.mcp_server_cost_info)},[r]),(0,x.useEffect)(()=>{r.allowed_tools&&k(r.allowed_tools)},[r]),(0,x.useEffect)(()=>{let e=window.sessionStorage.getItem(eH);if(e)try{let s=JSON.parse(e);if(!s||s.serverId!==r.server_id)return;s.formValues&&A({...r,...s.formValues}),s.costConfig&&u(s.costConfig),s.allowedTools&&k(s.allowedTools),s.searchValue&&w(s.searchValue),"boolean"==typeof s.aliasManuallyEdited&&C(s.aliasManuallyEdited)}catch(e){console.error("Failed to restore MCP edit state",e)}finally{window.sessionStorage.removeItem(eH)}},[o,r]),(0,x.useEffect)(()=>{if(!P)return;let e=P.transport||r.transport;if(e&&e!==o.getFieldValue("transport")){o.setFieldsValue({transport:e});return}o.setFieldsValue(P),A(null)},[P,o,r.transport]),(0,x.useEffect)(()=>{if(r.mcp_access_groups){let e=r.mcp_access_groups.map(e=>"string"==typeof e?e:e.name||String(e));o.setFieldValue("mcp_access_groups",e)}},[r]),(0,x.useEffect)(()=>{H()},[r,l,L]);let H=async()=>{if(l&&r.url&&(r.auth_type!==y.OAUTH2||L)){N(!0);try{let e={server_id:r.server_id,server_name:r.server_name,url:r.url,transport:r.transport,auth_type:r.auth_type,mcp_info:r.mcp_info},s=await (0,p.testMCPToolsListRequest)(l,e,L);s.tools&&!s.error?v(s.tools):(console.error("Failed to fetch tools:",s.message),v([]))}catch(e){console.error("Tools fetch error:",e),v([])}finally{N(!1)}}},D=async e=>{if(l)try{let{static_headers:s,credentials:t,...a}=e,i=(a.mcp_access_groups||[]).map(e=>"string"==typeof e?e:e.name||String(e)),o=Array.isArray(s)?s.reduce((e,s)=>{var r,t;let l=null==s?void 0:null===(r=s.header)||void 0===r?void 0:r.trim();return l&&(e[l]=null!==(t=null==s?void 0:s.value)&&void 0!==t?t:""),e},{}):{},c=t&&"object"==typeof t?Object.entries(t).reduce((e,s)=>{let[r,t]=s;if(null==t||""===t)return e;if("scopes"===r){if(Array.isArray(t)){let s=t.filter(e=>null!=e&&""!==e);s.length>0&&(e[r]=s)}}else e[r]=t;return e},{}):void 0,d={...a,server_id:r.server_id,mcp_info:{server_name:a.server_name||a.url,description:a.description,mcp_server_cost_info:Object.keys(m).length>0?m:null},mcp_access_groups:i,alias:a.alias,extra_headers:a.extra_headers||[],allowed_tools:S.length>0?S:null,disallowed_tools:a.disallowed_tools||[],static_headers:o};a.auth_type&&eK.includes(a.auth_type)&&c&&Object.keys(c).length>0&&(d.credentials=c);let u=await (0,p.updateMCPServer)(l,d);h.Z.success("MCP Server updated successfully"),n(u)}catch(e){h.Z.fromBackend("Failed to update MCP Server"+((null==e?void 0:e.message)?": ".concat(e.message):""))}};return(0,t.jsxs)(ex.Z,{children:[(0,t.jsxs)(eh.Z,{className:"grid w-full grid-cols-2",children:[(0,t.jsx)(eu.Z,{children:"Server Configuration"}),(0,t.jsx)(eu.Z,{children:"Cost Configuration"})]}),(0,t.jsxs)(eg.Z,{className:"mt-6",children:[(0,t.jsx)(ep.Z,{children:(0,t.jsxs)(j.Z,{form:o,onFinish:D,initialValues:K,layout:"vertical",children:[(0,t.jsx)(j.Z.Item,{label:"MCP Server Name",name:"server_name",rules:[{validator:(e,s)=>ee(s)}],children:(0,t.jsx)(eV.Z,{})}),(0,t.jsx)(j.Z.Item,{label:"Alias",name:"alias",rules:[{validator:(e,s)=>ee(s)}],children:(0,t.jsx)(eV.Z,{onChange:()=>C(!0)})}),(0,t.jsx)(j.Z.Item,{label:"Description",name:"description",children:(0,t.jsx)(eV.Z,{})}),(0,t.jsx)(j.Z.Item,{label:"MCP Server URL",name:"url",rules:[{required:!0,message:"Please enter a server URL"},{validator:(e,s)=>X(s)}],children:(0,t.jsx)(eV.Z,{})}),(0,t.jsx)(j.Z.Item,{label:"Transport Type",name:"transport",rules:[{required:!0}],children:(0,t.jsxs)(c.default,{children:[(0,t.jsx)(c.default.Option,{value:"sse",children:"Server-Sent Events (SSE)"}),(0,t.jsx)(c.default.Option,{value:"http",children:"HTTP"})]})}),(0,t.jsx)(j.Z.Item,{label:"Authentication",name:"auth_type",rules:[{required:!0}],children:(0,t.jsxs)(c.default,{children:[(0,t.jsx)(c.default.Option,{value:"none",children:"None"}),(0,t.jsx)(c.default.Option,{value:"api_key",children:"API Key"}),(0,t.jsx)(c.default.Option,{value:"bearer_token",children:"Bearer Token"}),(0,t.jsx)(c.default.Option,{value:"basic",children:"Basic Auth"}),(0,t.jsx)(c.default.Option,{value:"oauth2",children:"OAuth"})]})}),M&&(0,t.jsx)(j.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Authentication Value",(0,t.jsx)(d.Z,{title:"Token, password, or header value to send with each request for the selected auth type.",children:(0,t.jsx)(f.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","auth_value"],rules:[{validator:(e,s)=>s&&"string"==typeof s&&""===s.trim()?Promise.reject(Error("Authentication value cannot be empty")):Promise.resolve()}],children:(0,t.jsx)(eV.Z,{type:"password",placeholder:"Enter token or secret (leave blank to keep existing)",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),O&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(j.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["OAuth Client ID (optional)",(0,t.jsx)(d.Z,{title:"Provide only if your MCP server cannot handle dynamic client registration.",children:(0,t.jsx)(f.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","client_id"],children:(0,t.jsx)(eV.Z,{type:"password",placeholder:"Enter OAuth client ID (leave blank to keep existing)",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsx)(j.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["OAuth Client Secret (optional)",(0,t.jsx)(d.Z,{title:"Provide only if your MCP server cannot handle dynamic client registration.",children:(0,t.jsx)(f.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","client_secret"],children:(0,t.jsx)(eV.Z,{type:"password",placeholder:"Enter OAuth client secret (leave blank to keep existing)",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsx)(j.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["OAuth Scopes (optional)",(0,t.jsx)(d.Z,{title:"Add scopes to override the default scope list used for this MCP server.",children:(0,t.jsx)(f.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","scopes"],children:(0,t.jsx)(c.default,{mode:"tags",tokenSeparators:[","],placeholder:"Add scopes",className:"rounded-lg",size:"large"})}),(0,t.jsxs)("div",{className:"rounded-lg border border-dashed border-gray-300 p-4 space-y-2",children:[(0,t.jsx)("p",{className:"text-sm text-gray-600",children:"Use OAuth to fetch a fresh access token and save it as the authentication value."}),(0,t.jsx)(eU.Z,{variant:"secondary",onClick:q,disabled:"authorizing"===U||"exchanging"===U,children:"authorizing"===U?"Waiting for authorization...":"exchanging"===U?"Exchanging authorization code...":"Authorize & Fetch Token"}),R&&(0,t.jsx)("p",{className:"text-sm text-red-500",children:R}),"success"===U&&(null==F?void 0:F.access_token)&&(0,t.jsxs)("p",{className:"text-sm text-green-600",children:["Token fetched. Expires in ",null!==(s=F.expires_in)&&void 0!==s?s:"?"," seconds."]})]})]}),(0,t.jsx)("div",{className:"mt-6",children:(0,t.jsx)(Y,{availableAccessGroups:i,mcpServer:r,searchValue:_,setSearchValue:w,getAccessGroupOptions:()=>{let e=i.map(e=>({value:e,label:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:e})]})}));return _&&!i.some(e=>e.toLowerCase().includes(_.toLowerCase()))&&e.push({value:_,label:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:_}),(0,t.jsx)("span",{className:"text-gray-400 text-xs ml-1",children:"create new group"})]})}),e}})}),(0,t.jsx)("div",{className:"mt-6",children:(0,t.jsx)(B,{accessToken:l,oauthAccessToken:L,formValues:{server_id:r.server_id,server_name:r.server_name,url:r.url,transport:r.transport,auth_type:r.auth_type,mcp_info:r.mcp_info},allowedTools:S,existingAllowedTools:r.allowed_tools||null,onAllowedToolsChange:k})}),(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)(E.ZP,{onClick:a,children:"Cancel"}),(0,t.jsx)(eU.Z,{type:"submit",children:"Save Changes"})]})]})}),(0,t.jsx)(ep.Z,{children:(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsx)(I,{value:m,onChange:u,tools:g,disabled:b}),(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)(E.ZP,{onClick:a,children:"Cancel"}),(0,t.jsx)(eU.Z,{onClick:()=>o.submit(),children:"Save Changes"})]})]})})]})]})},eJ=r(92280),eG=e=>{let{costConfig:s}=e,r=(null==s?void 0:s.default_cost_per_query)!==void 0&&(null==s?void 0:s.default_cost_per_query)!==null,l=(null==s?void 0:s.tool_name_to_cost_per_query)&&Object.keys(s.tool_name_to_cost_per_query).length>0;return r||l?(0,t.jsx)("div",{className:"mt-6 pt-6 border-t border-gray-200",children:(0,t.jsxs)("div",{className:"space-y-4",children:[r&&(null==s?void 0:s.default_cost_per_query)!==void 0&&(null==s?void 0:s.default_cost_per_query)!==null&&(0,t.jsxs)("div",{children:[(0,t.jsx)(eJ.x,{className:"font-medium",children:"Default Cost per Query"}),(0,t.jsxs)("div",{className:"text-green-600 font-mono",children:["$",s.default_cost_per_query.toFixed(4)]})]}),l&&(null==s?void 0:s.tool_name_to_cost_per_query)&&(0,t.jsxs)("div",{children:[(0,t.jsx)(eJ.x,{className:"font-medium",children:"Tool-Specific Costs"}),(0,t.jsx)("div",{className:"mt-2 space-y-2",children:Object.entries(s.tool_name_to_cost_per_query).map(e=>{let[s,r]=e;return null!=r&&(0,t.jsxs)("div",{className:"flex justify-between items-center p-3 bg-gray-50 rounded-lg",children:[(0,t.jsx)(eJ.x,{className:"font-medium",children:s}),(0,t.jsxs)(eJ.x,{className:"text-green-600 font-mono",children:["$",r.toFixed(4)," per query"]})]},s)})})]}),(0,t.jsxs)("div",{className:"mt-4 p-4 bg-blue-50 border border-blue-200 rounded-lg",children:[(0,t.jsx)(eJ.x,{className:"text-blue-800 font-medium",children:"Cost Summary:"}),(0,t.jsxs)("div",{className:"mt-2 space-y-1",children:[r&&(null==s?void 0:s.default_cost_per_query)!==void 0&&(null==s?void 0:s.default_cost_per_query)!==null&&(0,t.jsxs)(eJ.x,{className:"text-blue-700",children:["• Default cost: $",s.default_cost_per_query.toFixed(4)," per query"]}),l&&(null==s?void 0:s.tool_name_to_cost_per_query)&&(0,t.jsxs)(eJ.x,{className:"text-blue-700",children:["• ",Object.keys(s.tool_name_to_cost_per_query).length," tool(s) with custom pricing"]})]})]})]})}):(0,t.jsx)("div",{className:"mt-6 pt-6 border-t border-gray-200",children:(0,t.jsx)("div",{className:"space-y-4",children:(0,t.jsx)("div",{className:"p-4 bg-gray-50 border border-gray-200 rounded-lg",children:(0,t.jsx)(eJ.x,{className:"text-gray-600",children:"No cost configuration set for this server. Tool calls will be charged at $0.00 per tool call."})})})})};let eY=e=>{var s,r,l,a,n;let{mcpServer:i,onBack:o,isEditing:c,isProxyAdmin:d,accessToken:m,userRole:u,userID:h,availableAccessGroups:p}=e,[g,j]=(0,x.useState)(c),[v,f]=(0,x.useState)(!1),[b,y]=(0,x.useState)({}),{maskedUrl:N,hasToken:Z}=Q(i.url),C=(e,s)=>Z?s?e:N:e,S=async(e,s)=>{await (0,eC.vQ)(e)&&(y(e=>({...e,[s]:!0})),setTimeout(()=>{y(e=>({...e,[s]:!1}))},2e3))};return(0,t.jsxs)("div",{className:"p-4 max-w-full",children:[(0,t.jsx)("div",{className:"flex justify-between items-center mb-6",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(eU.Z,{icon:eE.Z,variant:"light",className:"mb-4",onClick:o,children:"Back to All Servers"}),(0,t.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)(M.Z,{children:i.server_name}),(0,t.jsx)(E.ZP,{type:"text",size:"small",icon:b["mcp-server_name"]?(0,t.jsx)(ev.Z,{size:12}):(0,t.jsx)(ef.Z,{size:12}),onClick:()=>S(i.server_name,"mcp-server_name"),className:"left-2 z-10 transition-all duration-200 ".concat(b["mcp-server_name"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")}),i.alias&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"ml-4 text-gray-500",children:"Alias:"}),(0,t.jsx)("span",{className:"ml-1 font-mono text-blue-600",children:i.alias}),(0,t.jsx)(E.ZP,{type:"text",size:"small",icon:b["mcp-alias"]?(0,t.jsx)(ev.Z,{size:12}):(0,t.jsx)(ef.Z,{size:12}),onClick:()=>S(i.alias,"mcp-alias"),className:"left-2 z-10 transition-all duration-200 ".concat(b["mcp-alias"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]}),(0,t.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)(T.Z,{className:"text-gray-500 font-mono",children:i.server_id}),(0,t.jsx)(E.ZP,{type:"text",size:"small",icon:b["mcp-server-id"]?(0,t.jsx)(ev.Z,{size:12}):(0,t.jsx)(ef.Z,{size:12}),onClick:()=>S(i.server_id,"mcp-server-id"),className:"left-2 z-10 transition-all duration-200 ".concat(b["mcp-server-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]})}),(0,t.jsxs)(ex.Z,{defaultIndex:g?2:0,children:[(0,t.jsx)(eh.Z,{className:"mb-4",children:[(0,t.jsx)(eu.Z,{children:"Overview"},"overview"),(0,t.jsx)(eu.Z,{children:"MCP Tools"},"tools"),...d?[(0,t.jsx)(eu.Z,{children:"Settings"},"settings")]:[]]}),(0,t.jsxs)(eg.Z,{children:[(0,t.jsxs)(ep.Z,{children:[(0,t.jsxs)(eR.Z,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,t.jsxs)(A.Z,{children:[(0,t.jsx)(T.Z,{children:"Transport"}),(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)(M.Z,{children:_(null!==(a=i.transport)&&void 0!==a?a:void 0)})})]}),(0,t.jsxs)(A.Z,{children:[(0,t.jsx)(T.Z,{children:"Auth Type"}),(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)(T.Z,{children:w(null!==(n=i.auth_type)&&void 0!==n?n:void 0)})})]}),(0,t.jsxs)(A.Z,{children:[(0,t.jsx)(T.Z,{children:"Host Url"}),(0,t.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,t.jsx)(T.Z,{className:"break-all overflow-wrap-anywhere",children:C(i.url,v)}),Z&&(0,t.jsx)("button",{onClick:()=>f(!v),className:"p-1 hover:bg-gray-100 rounded",children:(0,t.jsx)(eF.Z,{icon:v?ez.Z:eq.Z,size:"sm",className:"text-gray-500"})})]})]})]}),(0,t.jsxs)(A.Z,{className:"mt-2",children:[(0,t.jsx)(M.Z,{children:"Cost Configuration"}),(0,t.jsx)(eG,{costConfig:null===(s=i.mcp_info)||void 0===s?void 0:s.mcp_server_cost_info})]})]}),(0,t.jsx)(ep.Z,{children:(0,t.jsx)(e4,{serverId:i.server_id,accessToken:m,auth_type:i.auth_type,userRole:u,userID:h,serverAlias:i.alias})}),(0,t.jsx)(ep.Z,{children:(0,t.jsxs)(A.Z,{children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsx)(M.Z,{children:"MCP Server Settings"}),g?null:(0,t.jsx)(eU.Z,{variant:"light",onClick:()=>j(!0),children:"Edit Settings"})]}),g?(0,t.jsx)(eD,{mcpServer:i,accessToken:m,onCancel:()=>j(!1),onSuccess:e=>{j(!1),o()},availableAccessGroups:p}):(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(T.Z,{className:"font-medium",children:"Server Name"}),(0,t.jsx)("div",{children:i.server_name})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(T.Z,{className:"font-medium",children:"Alias"}),(0,t.jsx)("div",{children:i.alias})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(T.Z,{className:"font-medium",children:"Description"}),(0,t.jsx)("div",{children:i.description})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(T.Z,{className:"font-medium",children:"URL"}),(0,t.jsxs)("div",{className:"font-mono break-all overflow-wrap-anywhere max-w-full flex items-center gap-2",children:[C(i.url,v),Z&&(0,t.jsx)("button",{onClick:()=>f(!v),className:"p-1 hover:bg-gray-100 rounded",children:(0,t.jsx)(eF.Z,{icon:v?ez.Z:eq.Z,size:"sm",className:"text-gray-500"})})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(T.Z,{className:"font-medium",children:"Transport"}),(0,t.jsx)("div",{children:_(i.transport)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(T.Z,{className:"font-medium",children:"Extra Headers"}),(0,t.jsx)("div",{children:null===(r=i.extra_headers)||void 0===r?void 0:r.join(", ")})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(T.Z,{className:"font-medium",children:"Auth Type"}),(0,t.jsx)("div",{children:w(i.auth_type)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(T.Z,{className:"font-medium",children:"Access Groups"}),(0,t.jsx)("div",{children:i.mcp_access_groups&&i.mcp_access_groups.length>0?(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:i.mcp_access_groups.map((e,s)=>{var r;return(0,t.jsx)("span",{className:"px-2 py-1 bg-gray-100 rounded-md text-sm",children:"string"==typeof e?e:null!==(r=null==e?void 0:e.name)&&void 0!==r?r:""},s)})}):(0,t.jsx)(T.Z,{className:"text-gray-500",children:"No access groups defined"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(T.Z,{className:"font-medium",children:"Allowed Tools"}),(0,t.jsx)("div",{children:i.allowed_tools&&i.allowed_tools.length>0?(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:i.allowed_tools.map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-blue-50 border border-blue-200 rounded-md text-sm",children:e},s))}):(0,t.jsx)(T.Z,{className:"text-gray-500",children:"All tools enabled"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(T.Z,{className:"font-medium",children:"Cost Configuration"}),(0,t.jsx)(eG,{costConfig:null===(l=i.mcp_info)||void 0===l?void 0:l.mcp_server_cost_info})]})]})]})})]})]})]})},{Text:e$,Title:eW}=o.default,{Option:eQ}=c.default;var eX=e=>{let{accessToken:s,userRole:r,userID:o}=e,{data:j,isLoading:v,refetch:f,dataUpdatedAt:b}=(0,n.a)({queryKey:["mcpServers"],queryFn:()=>{if(!s)throw Error("Access Token required");return(0,p.fetchMCPServers)(s)},enabled:!!s});x.useEffect(()=>{j&&(console.log("MCP Servers fetched:",j),j.forEach(e=>{console.log("Server: ".concat(e.server_name||e.server_id)),console.log(" allowed_tools:",e.allowed_tools)}))},[j]);let[y,N]=(0,x.useState)(null),[_,w]=(0,x.useState)(!1),[Z,C]=(0,x.useState)(null),[S,k]=(0,x.useState)(!1),[P,A]=(0,x.useState)("all"),[T,M]=(0,x.useState)("all"),[I,O]=(0,x.useState)([]),[L,E]=(0,x.useState)(!1),[z,q]=(0,x.useState)(!1),U="Internal User"===r;(0,x.useEffect)(()=>{try{let e=window.sessionStorage.getItem("litellm-mcp-oauth-edit-state");if(!e)return;let s=JSON.parse(e);(null==s?void 0:s.serverId)&&(C(s.serverId),k(!0))}catch(e){console.error("Failed to restore MCP edit view state",e)}},[]);let R=x.useMemo(()=>{if(!j)return[];let e=new Set,s=[];return j.forEach(r=>{r.teams&&r.teams.forEach(r=>{let t=r.team_id;e.has(t)||(e.add(t),s.push(r))})}),s},[j]),F=x.useMemo(()=>j?Array.from(new Set(j.flatMap(e=>e.mcp_access_groups).filter(e=>null!=e))):[],[j]),V=e=>{A(e),K(e,T)},B=e=>{M(e),K(P,e)},K=(e,s)=>{if(!j)return O([]);let r=j;if("personal"===e){O([]);return}"all"!==e&&(r=r.filter(s=>{var r;return null===(r=s.teams)||void 0===r?void 0:r.some(s=>s.team_id===e)})),"all"!==s&&(r=r.filter(e=>{var r;return null===(r=e.mcp_access_groups)||void 0===r?void 0:r.some(e=>"string"==typeof e?e===s:e&&e.name===s)})),O(r)};(0,x.useEffect)(()=>{K(P,T)},[b]);let H=x.useMemo(()=>eL(null!=r?r:"",e=>{C(e),k(!1)},e=>{C(e),k(!0)},D),[r]);function D(e){N(e),w(!0)}let J=async()=>{if(null!=y&&null!=s)try{q(!0),await (0,p.deleteMCPServer)(s,y),h.Z.success("Deleted MCP Server successfully"),f()}catch(e){console.error("Error deleting the mcp server:",e)}finally{q(!1),w(!1),N(null)}},G=y?(j||[]).find(e=>e.server_id===y):null;return s&&r&&o?(0,t.jsxs)("div",{className:"w-full h-full p-6",children:[(0,t.jsx)(m.Z,{open:_,title:"Delete MCP Server?",onOk:J,okText:z?"Deleting...":"Delete",onCancel:()=>{w(!1),N(null)},cancelText:"Cancel",cancelButtonProps:{disabled:z},okButtonProps:{danger:!0},confirmLoading:z,children:(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(e$,{children:"Are you sure you want to delete this MCP Server? This action cannot be undone."}),G&&(0,t.jsxs)("div",{className:"mt-4 p-4 bg-red-50 rounded-lg border border-red-200",children:[(0,t.jsx)(eW,{level:5,className:"mb-3 text-gray-900",children:"Server Information"}),(0,t.jsxs)(u.Z,{column:1,size:"small",children:[G.server_name&&(0,t.jsx)(u.Z.Item,{label:(0,t.jsx)("span",{className:"font-semibold text-gray-700",children:"Server Name"}),children:(0,t.jsx)(e$,{className:"text-sm",children:G.server_name})}),G.alias&&(0,t.jsx)(u.Z.Item,{label:(0,t.jsx)("span",{className:"font-semibold text-gray-700",children:"Alias"}),children:(0,t.jsx)(e$,{className:"text-sm",children:G.alias})}),(0,t.jsx)(u.Z.Item,{label:(0,t.jsx)("span",{className:"font-semibold text-gray-700",children:"Server ID"}),children:(0,t.jsx)(e$,{code:!0,className:"text-sm",children:G.server_id})}),(0,t.jsx)(u.Z.Item,{label:(0,t.jsx)("span",{className:"font-semibold text-gray-700",children:"URL"}),children:(0,t.jsx)(e$,{code:!0,className:"text-sm",children:G.url})})]})]})]})}),(0,t.jsx)(ec,{userRole:r,accessToken:s,onCreateSuccess:e=>{O(s=>[...s,e]),E(!1)},isModalVisible:L,setModalVisible:E,availableAccessGroups:F}),(0,t.jsx)(i.Dx,{children:"MCP Servers"}),(0,t.jsx)(i.xv,{className:"text-tremor-content mt-2",children:"Configure and manage your MCP servers"}),(0,l.tY)(r)&&(0,t.jsx)(i.zx,{className:"mt-4 mb-4",onClick:()=>E(!0),children:"+ Add New MCP Server"}),(0,t.jsxs)(i.v0,{className:"w-full h-full",children:[(0,t.jsx)(i.td,{className:"flex justify-between mt-2 w-full items-center",children:(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)(i.OK,{children:"All Servers"}),(0,t.jsx)(i.OK,{children:"Connect"})]})}),(0,t.jsxs)(i.nP,{children:[(0,t.jsx)(i.x4,{children:(0,t.jsx)(()=>Z?(0,t.jsx)(eY,{mcpServer:I.find(e=>e.server_id===Z)||{server_id:"",server_name:"",alias:"",url:"",transport:"",auth_type:"",created_at:"",created_by:"",updated_at:"",updated_by:""},onBack:()=>{k(!1),C(null),f()},isProxyAdmin:(0,l.tY)(r),isEditing:S,accessToken:s,userID:o,userRole:r,availableAccessGroups:F}):(0,t.jsxs)("div",{className:"w-full h-full",children:[(0,t.jsx)("div",{className:"w-full px-6",children:(0,t.jsx)("div",{className:"flex flex-col space-y-4",children:(0,t.jsx)("div",{className:"flex items-center justify-between bg-gray-50 rounded-lg p-4 border-2 border-gray-200",children:(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsx)(i.xv,{className:"text-lg font-semibold text-gray-900",children:"Current Team:"}),(0,t.jsxs)(c.default,{value:P,onChange:V,style:{width:300},children:[(0,t.jsx)(eQ,{value:"all",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:U?"All Available Servers":"All Servers"})]})}),(0,t.jsx)(eQ,{value:"personal",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:"Personal"})]})}),R.map(e=>(0,t.jsx)(eQ,{value:e.team_id,children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:e.team_alias||e.team_id})]})},e.team_id))]}),(0,t.jsxs)(i.xv,{className:"text-lg font-semibold text-gray-900 ml-6",children:["Access Group:",(0,t.jsx)(d.Z,{title:"An MCP Access Group is a set of users or teams that have permission to access specific MCP servers. Use access groups to control and organize who can connect to which servers.",children:(0,t.jsx)(a.Z,{style:{marginLeft:4,color:"#888"}})})]}),(0,t.jsxs)(c.default,{value:T,onChange:B,style:{width:300},children:[(0,t.jsx)(eQ,{value:"all",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:"All Access Groups"})]})}),F.map(e=>(0,t.jsx)(eQ,{value:e,children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:e})]})},e))]})]})})})}),(0,t.jsx)("div",{className:"w-full px-6 mt-6",children:(0,t.jsx)(g.w,{data:I,columns:H,renderSubComponent:()=>(0,t.jsx)("div",{}),getRowCanExpand:()=>!1,isLoading:v,noDataMessage:"No MCP servers configured",loadingMessage:"\uD83D\uDE85 Loading MCP servers..."})})]}),{})}),(0,t.jsx)(i.x4,{children:(0,t.jsx)(eT,{})})]})]})]}):(console.log("Missing required authentication parameters",{accessToken:s,userRole:r,userID:o}),(0,t.jsx)("div",{className:"p-6 text-center text-gray-500",children:"Missing required authentication parameters."}))},e0=r(21770);function e2(e){let{tool:s,onSubmit:r,isLoading:l,result:a,error:n,onClose:i}=e,[o]=j.Z.useForm(),[c,m]=x.useState("formatted"),[u,p]=x.useState(null),[g,v]=x.useState(null),y=x.useMemo(()=>"string"==typeof s.inputSchema?{type:"object",properties:{input:{type:"string",description:"Input for this tool"}},required:["input"]}:s.inputSchema,[s.inputSchema]),N=x.useMemo(()=>y.properties&&y.properties.params&&"object"===y.properties.params.type&&y.properties.params.properties?{type:"object",properties:y.properties.params.properties,required:y.properties.params.required||[]}:y,[y]);x.useEffect(()=>{u&&(a||n)&&v(Date.now()-u)},[a,n,u]);let _=async e=>{try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0;{let s=document.createElement("textarea");s.value=e,s.style.position="fixed",s.style.opacity="0",document.body.appendChild(s),s.focus(),s.select();let r=document.execCommand("copy");if(document.body.removeChild(s),!r)throw Error("execCommand failed");return!0}}catch(e){return console.error("Copy failed:",e),!1}},w=async()=>{await _(JSON.stringify(a,null,2))?h.Z.success("Result copied to clipboard"):h.Z.fromBackend("Failed to copy result")},Z=async()=>{await _(s.name)?h.Z.success("Tool name copied to clipboard"):h.Z.fromBackend("Failed to copy tool name")};return(0,t.jsxs)("div",{className:"space-y-4 h-full",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between pb-3 border-b border-gray-200",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-3",children:[s.mcp_info.logo_url&&(0,t.jsx)("img",{src:s.mcp_info.logo_url,alt:"".concat(s.mcp_info.server_name," logo"),className:"w-6 h-6 object-contain"}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2 mb-1",children:[(0,t.jsx)("h2",{className:"text-lg font-semibold text-gray-900",children:"Test Tool:"}),(0,t.jsxs)("div",{className:"group inline-flex items-center space-x-1 bg-slate-50 hover:bg-slate-100 px-3 py-1 rounded-md cursor-pointer transition-colors border border-slate-200",onClick:Z,title:"Click to copy tool name",children:[(0,t.jsx)("span",{className:"font-mono text-slate-700 font-medium text-sm",children:s.name}),(0,t.jsx)("svg",{className:"w-3 h-3 text-slate-400 group-hover:text-slate-600 transition-colors",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})]})]}),(0,t.jsx)("p",{className:"text-xs text-gray-600",children:s.description}),(0,t.jsxs)("p",{className:"text-xs text-gray-500",children:["Provider: ",s.mcp_info.server_name]})]})]}),(0,t.jsx)(b.z,{onClick:i,variant:"light",size:"sm",className:"text-gray-500 hover:text-gray-700",children:(0,t.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 h-full",children:[(0,t.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg",children:[(0,t.jsx)("div",{className:"border-b border-gray-100 px-4 py-2",children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-gray-900",children:"Input Parameters"}),(0,t.jsx)(d.Z,{title:"Configure the input parameters for this tool call",children:(0,t.jsx)(f.Z,{className:"text-gray-400 hover:text-gray-600"})})]})}),(0,t.jsx)("div",{className:"p-4",children:(0,t.jsxs)(j.Z,{form:o,onFinish:e=>{p(Date.now()),v(null);let s={};Object.entries(e).forEach(e=>{var r;let[t,l]=e,a=null===(r=N.properties)||void 0===r?void 0:r[t];if(a&&null!=l&&""!==l)switch(a.type){case"boolean":s[t]="true"===l||!0===l;break;case"number":s[t]=Number(l);break;case"string":s[t]=String(l);break;default:s[t]=l}else null!=l&&""!==l&&(s[t]=l)}),r(y.properties&&y.properties.params&&"object"===y.properties.params.type&&y.properties.params.properties?{params:s}:s)},layout:"vertical",className:"space-y-3",children:["string"==typeof s.inputSchema?(0,t.jsx)("div",{className:"space-y-3",children:(0,t.jsx)(j.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700",children:["Input ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]}),name:"input",rules:[{required:!0,message:"Please enter input for this tool"}],className:"mb-3",children:(0,t.jsx)(b.o,{placeholder:"Enter input for this tool",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})})}):void 0===N.properties?(0,t.jsx)("div",{className:"text-center py-6 bg-gray-50 rounded-lg border border-gray-200",children:(0,t.jsxs)("div",{className:"max-w-sm mx-auto",children:[(0,t.jsx)("h4",{className:"text-sm font-medium text-gray-900 mb-1",children:"No Parameters Required"}),(0,t.jsx)("p",{className:"text-xs text-gray-500",children:"This tool can be called without any input parameters."})]})}):(0,t.jsx)("div",{className:"space-y-3",children:Object.entries(N.properties).map(e=>{var s,r,l,a,n;let[i,o]=e;return(0,t.jsxs)(j.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:[i," ",(null===(s=N.required)||void 0===s?void 0:s.includes(i))&&(0,t.jsx)("span",{className:"text-red-500",children:"*"}),o.description&&(0,t.jsx)(d.Z,{title:o.description,children:(0,t.jsx)(f.Z,{className:"ml-2 text-gray-400 hover:text-gray-600"})})]}),name:i,rules:[{required:null===(r=N.required)||void 0===r?void 0:r.includes(i),message:"Please enter ".concat(i)}],className:"mb-3",children:["string"===o.type&&o.enum&&(0,t.jsxs)("select",{className:"w-full px-3 py-2 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm transition-colors",defaultValue:o.default,children:[!(null===(l=N.required)||void 0===l?void 0:l.includes(i))&&(0,t.jsxs)("option",{value:"",children:["Select ",i]}),o.enum.map(e=>(0,t.jsx)("option",{value:e,children:e},e))]}),"string"===o.type&&!o.enum&&(0,t.jsx)(b.o,{placeholder:o.description||"Enter ".concat(i),className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"}),"number"===o.type&&(0,t.jsx)("input",{type:"number",placeholder:o.description||"Enter ".concat(i),className:"w-full px-3 py-2 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm transition-colors"}),"boolean"===o.type&&(0,t.jsxs)("select",{className:"w-full px-3 py-2 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm transition-colors",defaultValue:(null===(a=o.default)||void 0===a?void 0:a.toString())||"",children:[!(null===(n=N.required)||void 0===n?void 0:n.includes(i))&&(0,t.jsxs)("option",{value:"",children:["Select ",i]}),(0,t.jsx)("option",{value:"true",children:"True"}),(0,t.jsx)("option",{value:"false",children:"False"})]})]},i)})}),(0,t.jsx)("div",{className:"pt-3 border-t border-gray-100",children:(0,t.jsx)(b.z,{onClick:()=>o.submit(),disabled:l,variant:"primary",className:"w-full",loading:l,children:l?"Calling Tool...":a||n?"Call Again":"Call Tool"})})]})})]}),(0,t.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg",children:[(0,t.jsx)("div",{className:"border-b border-gray-100 px-4 py-2",children:(0,t.jsx)("h3",{className:"text-sm font-semibold text-gray-900",children:"Tool Result"})}),(0,t.jsx)("div",{className:"p-4",children:a||n||l?(0,t.jsxs)("div",{className:"space-y-3",children:[a&&!l&&!n&&(0,t.jsx)("div",{className:"p-2 bg-green-50 border border-green-200 rounded-lg",children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)("svg",{className:"h-4 w-4 text-green-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,t.jsx)("h4",{className:"text-xs font-medium text-green-900",children:"Tool executed successfully"}),null!==g&&(0,t.jsxs)("span",{className:"text-xs text-green-600 ml-1",children:["• ",(g/1e3).toFixed(2),"s"]})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,t.jsxs)("div",{className:"flex bg-white rounded border border-green-300 p-0.5",children:[(0,t.jsx)("button",{onClick:()=>m("formatted"),className:"px-2 py-1 text-xs font-medium rounded transition-colors ".concat("formatted"===c?"bg-green-100 text-green-800":"text-green-600 hover:text-green-800"),children:"Formatted"}),(0,t.jsx)("button",{onClick:()=>m("json"),className:"px-2 py-1 text-xs font-medium rounded transition-colors ".concat("json"===c?"bg-green-100 text-green-800":"text-green-600 hover:text-green-800"),children:"JSON"})]}),(0,t.jsx)("button",{onClick:w,className:"p-1 hover:bg-green-100 rounded text-green-700",title:"Copy response",children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,t.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]})]})}),(0,t.jsxs)("div",{className:"max-h-96 overflow-y-auto",children:[l&&(0,t.jsxs)("div",{className:"flex flex-col justify-center items-center h-48 text-gray-500",children:[(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-gray-200"}),(0,t.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-blue-600 border-t-transparent absolute top-0"})]}),(0,t.jsx)("p",{className:"text-sm font-medium mt-3",children:"Calling tool..."}),(0,t.jsx)("p",{className:"text-xs text-gray-400 mt-1",children:"Please wait while we process your request"})]}),n&&(0,t.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-lg p-3",children:(0,t.jsxs)("div",{className:"flex items-start space-x-2",children:[(0,t.jsx)("div",{className:"flex-shrink-0",children:(0,t.jsx)("svg",{className:"h-4 w-4 text-red-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2 mb-1",children:[(0,t.jsx)("h4",{className:"text-xs font-medium text-red-900",children:"Tool Call Failed"}),null!==g&&(0,t.jsxs)("span",{className:"text-xs text-red-600",children:["• ",(g/1e3).toFixed(2),"s"]})]}),(0,t.jsx)("div",{className:"bg-white border border-red-200 rounded p-2 max-h-48 overflow-y-auto",children:(0,t.jsx)("pre",{className:"text-xs whitespace-pre-wrap text-red-700 font-mono",children:n.message})})]})]})}),a&&!l&&!n&&(0,t.jsx)("div",{className:"space-y-3",children:"formatted"===c?a.map((e,s)=>(0,t.jsxs)("div",{className:"border border-gray-200 rounded-lg overflow-hidden",children:["text"===e.type&&(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"bg-gray-50 px-3 py-1 border-b border-gray-200",children:(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:"Text Response"})}),(0,t.jsx)("div",{className:"p-3",children:(0,t.jsx)("div",{className:"bg-white rounded border border-gray-200 max-h-64 overflow-y-auto",children:(0,t.jsx)("div",{className:"p-3 space-y-2",children:e.text.split("\n\n").map((e,s)=>{if(""===e.trim())return null;if(e.startsWith("##")){let r=e.replace(/^#+\s/,"");return(0,t.jsx)("div",{className:"border-b border-gray-200 pb-1 mb-2",children:(0,t.jsx)("h3",{className:"text-sm font-semibold text-gray-900",children:r})},s)}let r=/(https?:\/\/[^\s\)]+)/g;if(r.test(e)){let l=e.split(r);return(0,t.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded p-2",children:(0,t.jsx)("div",{className:"text-xs text-gray-700 leading-relaxed whitespace-pre-wrap",children:l.map((e,s)=>r.test(e)?(0,t.jsx)("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline break-all",children:e},s):e)})},s)}return e.includes("Score:")?(0,t.jsx)("div",{className:"bg-green-50 border-l-4 border-green-400 p-2 rounded-r",children:(0,t.jsx)("p",{className:"text-xs text-green-800 font-medium whitespace-pre-wrap",children:e})},s):(0,t.jsx)("div",{className:"bg-gray-50 rounded p-2 border border-gray-200",children:(0,t.jsx)("div",{className:"text-xs text-gray-700 leading-relaxed whitespace-pre-wrap font-mono",children:e})},s)}).filter(Boolean)})})})]}),"image"===e.type&&e.url&&(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"bg-gray-50 px-3 py-1 border-b border-gray-200",children:(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:"Image Response"})}),(0,t.jsx)("div",{className:"p-3",children:(0,t.jsx)("div",{className:"bg-gray-50 rounded p-3 border border-gray-200",children:(0,t.jsx)("img",{src:e.url,alt:"Tool result",className:"max-w-full h-auto rounded shadow-sm"})})})]}),"embedded_resource"===e.type&&(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"bg-gray-50 px-3 py-1 border-b border-gray-200",children:(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:"Embedded Resource"})}),(0,t.jsx)("div",{className:"p-3",children:(0,t.jsxs)("div",{className:"flex items-center space-x-2 p-3 bg-blue-50 border border-blue-200 rounded",children:[(0,t.jsx)("div",{className:"flex-shrink-0",children:(0,t.jsx)("svg",{className:"h-5 w-5 text-blue-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsxs)("p",{className:"text-xs font-medium text-blue-900",children:["Resource Type: ",e.resource_type]}),e.url&&(0,t.jsxs)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center text-xs text-blue-600 hover:text-blue-800 hover:underline mt-1 transition-colors",children:["View Resource",(0,t.jsxs)("svg",{className:"ml-1 h-3 w-3",fill:"currentColor",viewBox:"0 0 20 20",children:[(0,t.jsx)("path",{d:"M11 3a1 1 0 100 2h2.586l-6.293 6.293a1 1 0 101.414 1.414L15 6.414V9a1 1 0 102 0V4a1 1 0 00-1-1h-5z"}),(0,t.jsx)("path",{d:"M5 5a2 2 0 00-2 2v8a2 2 0 002 2h8a2 2 0 002-2v-3a1 1 0 10-2 0v3H5V7h3a1 1 0 000-2H5z"})]})]})]})]})})]})]},s)):(0,t.jsx)("div",{className:"bg-white rounded border border-gray-200",children:(0,t.jsx)("div",{className:"p-3 overflow-auto max-h-80 bg-gray-50",children:(0,t.jsx)("pre",{className:"text-xs font-mono whitespace-pre-wrap break-all text-gray-800",children:JSON.stringify(a,null,2)})})})})]})]}):(0,t.jsx)("div",{className:"flex flex-col justify-center items-center h-48 text-gray-500",children:(0,t.jsxs)("div",{className:"text-center max-w-sm",children:[(0,t.jsx)("div",{className:"mb-3",children:(0,t.jsx)("svg",{className:"mx-auto h-12 w-12 text-gray-300",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1,d:"M13 10V3L4 14h7v7l9-11h-7z"})})}),(0,t.jsx)("h4",{className:"text-sm font-medium text-gray-900 mb-1",children:"Ready to Call Tool"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 leading-relaxed",children:'Configure the input parameters and click "Call Tool" to see the results here.'})]})})})]})]})]})}var e1=r(69993),e4=e=>{let{serverId:s,accessToken:r,auth_type:l,userRole:a,userID:i,serverAlias:o}=e,[c,d]=(0,x.useState)(null),[m,u]=(0,x.useState)(null),[h,g]=(0,x.useState)(null),{data:j,isLoading:v,error:f}=(0,n.a)({queryKey:["mcpTools",s],queryFn:()=>{if(!r)throw Error("Access Token required");return(0,p.listMCPTools)(r,s)},enabled:!!r,staleTime:3e4}),{mutate:b,isPending:y}=(0,e0.D)({mutationFn:async e=>{if(!r)throw Error("Access Token required");try{return await (0,p.callMCPTool)(r,e.tool.name,e.arguments)}catch(e){throw e}},onSuccess:e=>{u(e),g(null)},onError:e=>{g(e),u(null)}}),N=(null==j?void 0:j.tools)||[];return(0,t.jsx)("div",{className:"w-full h-screen p-4 bg-white",children:(0,t.jsx)(A.Z,{className:"w-full rounded-xl shadow-md overflow-hidden",children:(0,t.jsxs)("div",{className:"flex h-auto w-full gap-4",children:[(0,t.jsxs)("div",{className:"w-1/4 p-4 bg-gray-50 flex flex-col",children:[(0,t.jsx)(M.Z,{className:"text-xl font-semibold mb-6 mt-2",children:"MCP Tools"}),(0,t.jsx)("div",{className:"flex flex-col flex-1",children:(0,t.jsxs)("div",{className:"flex flex-col flex-1 min-h-0",children:[(0,t.jsxs)(T.Z,{className:"font-medium block mb-3 text-gray-700 flex items-center",children:[(0,t.jsx)(P.Z,{className:"mr-2"})," Available Tools",N.length>0&&(0,t.jsx)("span",{className:"ml-2 bg-blue-100 text-blue-800 text-xs font-medium px-2 py-0.5 rounded-full",children:N.length})]}),v&&(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center py-8 bg-white border border-gray-200 rounded-lg",children:[(0,t.jsxs)("div",{className:"relative mb-3",children:[(0,t.jsx)("div",{className:"animate-spin rounded-full h-6 w-6 border-2 border-gray-200"}),(0,t.jsx)("div",{className:"animate-spin rounded-full h-6 w-6 border-2 border-blue-600 border-t-transparent absolute top-0"})]}),(0,t.jsx)("p",{className:"text-xs font-medium text-gray-700",children:"Loading tools..."})]}),(null==j?void 0:j.error)&&!v&&!N.length&&(0,t.jsx)("div",{className:"p-3 text-xs text-red-800 rounded-lg bg-red-50 border border-red-200",children:(0,t.jsxs)("p",{className:"font-medium",children:["Error: ",j.message]})}),!v&&!(null==j?void 0:j.error)&&(!N||0===N.length)&&(0,t.jsxs)("div",{className:"p-4 text-center bg-white border border-gray-200 rounded-lg",children:[(0,t.jsx)("div",{className:"mx-auto w-8 h-8 bg-gray-200 rounded-full flex items-center justify-center mb-2",children:(0,t.jsx)("svg",{className:"w-4 h-4 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19.428 15.428a2 2 0 00-1.022-.547l-2.387-.477a6 6 0 00-3.86.517l-.318.158a6 6 0 01-3.86.517L6.05 15.21a2 2 0 00-1.806.547M8 4h8l-1 1v5.172a2 2 0 00.586 1.414l5 5c1.26 1.26.367 3.414-1.415 3.414H4.828c-1.782 0-2.674-2.154-1.414-3.414l5-5A2 2 0 009 8.172V5L8 4z"})})}),(0,t.jsx)("p",{className:"text-xs font-medium text-gray-700 mb-1",children:"No tools available"}),(0,t.jsx)("p",{className:"text-xs text-gray-500",children:"No tools found for this server"})]}),!v&&!(null==j?void 0:j.error)&&N.length>0&&(0,t.jsx)("div",{className:"space-y-2 flex-1 overflow-y-auto min-h-0 mcp-tools-scrollable",style:{maxHeight:"400px",scrollbarWidth:"auto",scrollbarColor:"#cbd5e0 #f7fafc"},children:N.map(e=>(0,t.jsxs)("div",{className:"border rounded-lg p-3 cursor-pointer transition-all hover:shadow-sm ".concat((null==c?void 0:c.name)===e.name?"border-blue-500 bg-blue-50 ring-1 ring-blue-200":"border-gray-200 bg-white hover:border-gray-300"),onClick:()=>{d(e),u(null),g(null)},children:[(0,t.jsxs)("div",{className:"flex items-start space-x-2",children:[e.mcp_info.logo_url&&(0,t.jsx)("img",{src:e.mcp_info.logo_url,alt:"".concat(e.mcp_info.server_name," logo"),className:"w-4 h-4 object-contain flex-shrink-0 mt-0.5"}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("h4",{className:"font-mono text-xs font-medium text-gray-900 truncate",children:e.name}),(0,t.jsx)("p",{className:"text-xs text-gray-500 truncate",children:e.mcp_info.server_name}),(0,t.jsx)("p",{className:"text-xs text-gray-600 mt-1 line-clamp-2 leading-relaxed",children:e.description})]})]}),(null==c?void 0:c.name)===e.name&&(0,t.jsx)("div",{className:"mt-2 pt-2 border-t border-blue-200",children:(0,t.jsxs)("div",{className:"flex items-center text-xs font-medium text-blue-700",children:[(0,t.jsx)("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),"Selected"]})})]},e.name))})]})})]}),(0,t.jsxs)("div",{className:"w-3/4 flex flex-col bg-white",children:[(0,t.jsx)("div",{className:"p-4 border-b border-gray-200 flex justify-between items-center",children:(0,t.jsx)(M.Z,{className:"text-xl font-semibold mb-0",children:"Tool Testing Playground"})}),(0,t.jsx)("div",{className:"flex-1 overflow-auto p-4",children:c?(0,t.jsx)("div",{className:"h-full",children:(0,t.jsx)(e2,{tool:c,onSubmit:e=>{b({tool:c,arguments:e})},result:m,error:h,isLoading:y,onClose:()=>d(null)})}):(0,t.jsxs)("div",{className:"h-full flex flex-col items-center justify-center text-gray-400",children:[(0,t.jsx)(e1.Z,{style:{fontSize:"48px",marginBottom:"16px"}}),(0,t.jsx)(T.Z,{className:"text-lg font-medium text-gray-600 mb-2",children:"Select a Tool to Test"}),(0,t.jsx)(T.Z,{className:"text-center text-gray-500 max-w-md",children:"Choose a tool from the left sidebar to start testing its functionality with custom inputs."})]})})]})]})})})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/7996-0d49a395a24908e2.js b/litellm/proxy/_experimental/out/_next/static/chunks/7996-dc0963f1c599e551.js similarity index 98% rename from litellm/proxy/_experimental/out/_next/static/chunks/7996-0d49a395a24908e2.js rename to litellm/proxy/_experimental/out/_next/static/chunks/7996-dc0963f1c599e551.js index c71cf724cd..c5ee883a22 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/7996-0d49a395a24908e2.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/7996-dc0963f1c599e551.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7996],{30150:function(e,t,n){"use strict";n.d(t,{Z:function(){return p}});var r=n(5853),o=n(2265);let l=e=>{var t=(0,r._T)(e,[]);return o.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),o.createElement("path",{d:"M12 4v16m8-8H4"}))},a=e=>{var t=(0,r._T)(e,[]);return o.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),o.createElement("path",{d:"M20 12H4"}))};var u=n(13241),s=n(1153),c=n(69262);let i="flex mx-auto text-tremor-content-subtle dark:text-dark-tremor-content-subtle",d="cursor-pointer hover:text-tremor-content dark:hover:text-dark-tremor-content",p=o.forwardRef((e,t)=>{let{onSubmit:n,enableStepper:p=!0,disabled:f,onValueChange:m,onChange:v}=e,b=(0,r._T)(e,["onSubmit","enableStepper","disabled","onValueChange","onChange"]),g=(0,o.useRef)(null),[y,E]=o.useState(!1),h=o.useCallback(()=>{E(!0)},[]),x=o.useCallback(()=>{E(!1)},[]),[w,S]=o.useState(!1),k=o.useCallback(()=>{S(!0)},[]),C=o.useCallback(()=>{S(!1)},[]);return o.createElement(c.Z,Object.assign({type:"number",ref:(0,s.lq)([g,t]),disabled:f,makeInputClassName:(0,s.fn)("NumberInput"),onKeyDown:e=>{var t;if("Enter"===e.key&&!e.ctrlKey&&!e.altKey&&!e.shiftKey){let e=null===(t=g.current)||void 0===t?void 0:t.value;null==n||n(parseFloat(null!=e?e:""))}"ArrowDown"===e.key&&h(),"ArrowUp"===e.key&&k()},onKeyUp:e=>{"ArrowDown"===e.key&&x(),"ArrowUp"===e.key&&C()},onChange:e=>{f||(null==m||m(parseFloat(e.target.value)),null==v||v(e))},stepper:p?o.createElement("div",{className:(0,u.q)("flex justify-center align-middle")},o.createElement("div",{tabIndex:-1,onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault(),onTouchStart:e=>{e.cancelable&&e.preventDefault()},onMouseUp:()=>{var e,t;f||(null===(e=g.current)||void 0===e||e.stepDown(),null===(t=g.current)||void 0===t||t.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,u.q)(!f&&d,i,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},o.createElement(a,{"data-testid":"step-down",className:(y?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"})),o.createElement("div",{tabIndex:-1,onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault(),onTouchStart:e=>{e.cancelable&&e.preventDefault()},onMouseUp:()=>{var e,t;f||(null===(e=g.current)||void 0===e||e.stepUp(),null===(t=g.current)||void 0===t||t.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,u.q)(!f&&d,i,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},o.createElement(l,{"data-testid":"step-up",className:(w?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"}))):null},b))});p.displayName="NumberInput"},87452:function(e,t,n){"use strict";n.d(t,{Z:function(){return d},r:function(){return i}});var r=n(5853),o=n(91054);n(42698),n(64016);var l=n(8710);n(33232);var a=n(13241),u=n(1153),s=n(2265);let c=(0,u.fn)("Accordion"),i=(0,s.createContext)({isOpen:!1}),d=s.forwardRef((e,t)=>{var n;let{defaultOpen:u=!1,children:d,className:p}=e,f=(0,r._T)(e,["defaultOpen","children","className"]),m=null!==(n=(0,s.useContext)(l.Z))&&void 0!==n?n:(0,a.q)("rounded-tremor-default border");return s.createElement(o.pJ,Object.assign({as:"div",ref:t,className:(0,a.q)(c("root"),"overflow-hidden","bg-tremor-background border-tremor-border","dark:bg-dark-tremor-background dark:border-dark-tremor-border",m,p),defaultOpen:u},f),e=>{let{open:t}=e;return s.createElement(i.Provider,{value:{isOpen:t}},d)})});d.displayName="Accordion"},88829:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var r=n(5853),o=n(2265),l=n(91054),a=n(13241);let u=(0,n(1153).fn)("AccordionBody"),s=o.forwardRef((e,t)=>{let{children:n,className:s}=e,c=(0,r._T)(e,["children","className"]);return o.createElement(l.pJ.Panel,Object.assign({ref:t,className:(0,a.q)(u("root"),"w-full text-tremor-default px-4 pb-3","text-tremor-content","dark:text-dark-tremor-content",s)},c),n)});s.displayName="AccordionBody"},72208:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(5853),o=n(2265),l=n(91054);let a=e=>{var t=(0,r._T)(e,[]);return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),o.createElement("path",{d:"M11.9999 10.8284L7.0502 15.7782L5.63599 14.364L11.9999 8L18.3639 14.364L16.9497 15.7782L11.9999 10.8284Z"}))};var u=n(87452),s=n(13241);let c=(0,n(1153).fn)("AccordionHeader"),i=o.forwardRef((e,t)=>{let{children:n,className:i}=e,d=(0,r._T)(e,["children","className"]),{isOpen:p}=(0,o.useContext)(u.r);return o.createElement(l.pJ.Button,Object.assign({ref:t,className:(0,s.q)(c("root"),"w-full flex items-center justify-between px-4 py-3","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis",i)},d),o.createElement("div",{className:(0,s.q)(c("children"),"flex flex-1 text-inherit mr-4")},n),o.createElement("div",null,o.createElement(a,{className:(0,s.q)(c("arrowIcon"),"h-5 w-5 -mr-1","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle",p?"transition-all":"transition-all -rotate-180")})))});i.displayName="AccordionHeader"},49804:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(5853),o=n(13241),l=n(1153),a=n(2265),u=n(9496);let s=(0,l.fn)("Col"),c=a.forwardRef((e,t)=>{let{numColSpan:n=1,numColSpanSm:l,numColSpanMd:c,numColSpanLg:i,children:d,className:p}=e,f=(0,r._T)(e,["numColSpan","numColSpanSm","numColSpanMd","numColSpanLg","children","className"]),m=(e,t)=>e&&Object.keys(t).includes(String(e))?t[e]:"";return a.createElement("div",Object.assign({ref:t,className:(0,o.q)(s("root"),(()=>{let e=m(n,u.PT),t=m(l,u.SP),r=m(c,u.VS),a=m(i,u._w);return(0,o.q)(e,t,r,a)})(),p)},f),d)});c.displayName="Col"},23910:function(e,t,n){var r=n(74288).Symbol;e.exports=r},54506:function(e,t,n){var r=n(23910),o=n(4479),l=n(80910),a=r?r.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":a&&a in Object(e)?o(e):l(e)}},55041:function(e,t,n){var r=n(5035),o=/^\s+/;e.exports=function(e){return e?e.slice(0,r(e)+1).replace(o,""):e}},17071:function(e,t,n){var r="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g;e.exports=r},4479:function(e,t,n){var r=n(23910),o=Object.prototype,l=o.hasOwnProperty,a=o.toString,u=r?r.toStringTag:void 0;e.exports=function(e){var t=l.call(e,u),n=e[u];try{e[u]=void 0;var r=!0}catch(e){}var o=a.call(e);return r&&(t?e[u]=n:delete e[u]),o}},80910:function(e){var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},74288:function(e,t,n){var r=n(17071),o="object"==typeof self&&self&&self.Object===Object&&self,l=r||o||Function("return this")();e.exports=l},5035:function(e){var t=/\s/;e.exports=function(e){for(var n=e.length;n--&&t.test(e.charAt(n)););return n}},7310:function(e,t,n){var r=n(28302),o=n(11121),l=n(6660),a=Math.max,u=Math.min;e.exports=function(e,t,n){var s,c,i,d,p,f,m=0,v=!1,b=!1,g=!0;if("function"!=typeof e)throw TypeError("Expected a function");function y(t){var n=s,r=c;return s=c=void 0,m=t,d=e.apply(r,n)}function E(e){var n=e-f,r=e-m;return void 0===f||n>=t||n<0||b&&r>=i}function h(){var e,n,r,l=o();if(E(l))return x(l);p=setTimeout(h,(e=l-f,n=l-m,r=t-e,b?u(r,i-n):r))}function x(e){return(p=void 0,g&&s)?y(e):(s=c=void 0,d)}function w(){var e,n=o(),r=E(n);if(s=arguments,c=this,f=n,r){if(void 0===p)return m=e=f,p=setTimeout(h,t),v?y(e):d;if(b)return clearTimeout(p),p=setTimeout(h,t),y(f)}return void 0===p&&(p=setTimeout(h,t)),d}return t=l(t)||0,r(n)&&(v=!!n.leading,i=(b="maxWait"in n)?a(l(n.maxWait)||0,t):i,g="trailing"in n?!!n.trailing:g),w.cancel=function(){void 0!==p&&clearTimeout(p),m=0,s=f=c=p=void 0},w.flush=function(){return void 0===p?d:x(o())},w}},28302:function(e){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},10303:function(e){e.exports=function(e){return null!=e&&"object"==typeof e}},78371:function(e,t,n){var r=n(54506),o=n(10303);e.exports=function(e){return"symbol"==typeof e||o(e)&&"[object Symbol]"==r(e)}},11121:function(e,t,n){var r=n(74288);e.exports=function(){return r.Date.now()}},6660:function(e,t,n){var r=n(55041),o=n(28302),l=n(78371),a=0/0,u=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,c=/^0o[0-7]+$/i,i=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(l(e))return a;if(o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=r(e);var n=s.test(e);return n||c.test(e)?i(e.slice(2),n?2:8):u.test(e)?a:+e}},23628:function(e,t,n){"use strict";var r=n(2265);let o=r.forwardRef(function(e,t){return r.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),r.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"}))});t.Z=o},91054:function(e,t,n){"use strict";let r,o;n.d(t,{pJ:function(){return j}});var l,a=n(71049),u=n(11323),s=n(2265),c=n(66797),i=n(93980),d=n(65573),p=n(67561),f=n(98218),m=n(33443),v=n(28294),b=n(31370),g=n(72468),y=n(5664),E=n(38929);let h=null!=(l=s.startTransition)?l:function(e){e()};var x=n(52724),w=((r=w||{})[r.Open=0]="Open",r[r.Closed=1]="Closed",r),S=((o=S||{})[o.ToggleDisclosure=0]="ToggleDisclosure",o[o.CloseDisclosure=1]="CloseDisclosure",o[o.SetButtonId=2]="SetButtonId",o[o.SetPanelId=3]="SetPanelId",o[o.SetButtonElement=4]="SetButtonElement",o[o.SetPanelElement=5]="SetPanelElement",o);let k={0:e=>({...e,disclosureState:(0,g.E)(e.disclosureState,{0:1,1:0})}),1:e=>1===e.disclosureState?e:{...e,disclosureState:1},2:(e,t)=>e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId},3:(e,t)=>e.panelId===t.panelId?e:{...e,panelId:t.panelId},4:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},5:(e,t)=>e.panelElement===t.element?e:{...e,panelElement:t.element}},C=(0,s.createContext)(null);function T(e){let t=(0,s.useContext)(C);if(null===t){let t=Error("<".concat(e," /> is missing a parent component."));throw Error.captureStackTrace&&Error.captureStackTrace(t,T),t}return t}C.displayName="DisclosureContext";let N=(0,s.createContext)(null);N.displayName="DisclosureAPIContext";let D=(0,s.createContext)(null);function I(e,t){return(0,g.E)(t.type,k,e,t)}D.displayName="DisclosurePanelContext";let O=s.Fragment,P=E.VN.RenderStrategy|E.VN.Static,j=Object.assign((0,E.yV)(function(e,t){let{defaultOpen:n=!1,...r}=e,o=(0,s.useRef)(null),l=(0,p.T)(t,(0,p.h)(e=>{o.current=e},void 0===e.as||e.as===s.Fragment)),a=(0,s.useReducer)(I,{disclosureState:n?0:1,buttonElement:null,panelElement:null,buttonId:null,panelId:null}),[{disclosureState:u,buttonId:c},d]=a,f=(0,i.z)(e=>{d({type:1});let t=(0,y.r)(o);if(!t||!c)return;let n=e?e instanceof HTMLElement?e:e.current instanceof HTMLElement?e.current:t.getElementById(c):t.getElementById(c);null==n||n.focus()}),b=(0,s.useMemo)(()=>({close:f}),[f]),h=(0,s.useMemo)(()=>({open:0===u,close:f}),[u,f]),x=(0,E.L6)();return s.createElement(C.Provider,{value:a},s.createElement(N.Provider,{value:b},s.createElement(m.Z,{value:f},s.createElement(v.up,{value:(0,g.E)(u,{0:v.ZM.Open,1:v.ZM.Closed})},x({ourProps:{ref:l},theirProps:r,slot:h,defaultTag:O,name:"Disclosure"})))))}),{Button:(0,E.yV)(function(e,t){let n=(0,s.useId)(),{id:r="headlessui-disclosure-button-".concat(n),disabled:o=!1,autoFocus:l=!1,...f}=e,[m,v]=T("Disclosure.Button"),g=(0,s.useContext)(D),y=null!==g&&g===m.panelId,h=(0,s.useRef)(null),w=(0,p.T)(h,t,(0,i.z)(e=>{if(!y)return v({type:4,element:e})}));(0,s.useEffect)(()=>{if(!y)return v({type:2,buttonId:r}),()=>{v({type:2,buttonId:null})}},[r,v,y]);let S=(0,i.z)(e=>{var t;if(y){if(1===m.disclosureState)return;switch(e.key){case x.R.Space:case x.R.Enter:e.preventDefault(),e.stopPropagation(),v({type:0}),null==(t=m.buttonElement)||t.focus()}}else switch(e.key){case x.R.Space:case x.R.Enter:e.preventDefault(),e.stopPropagation(),v({type:0})}}),k=(0,i.z)(e=>{e.key===x.R.Space&&e.preventDefault()}),C=(0,i.z)(e=>{var t;(0,b.P)(e.currentTarget)||o||(y?(v({type:0}),null==(t=m.buttonElement)||t.focus()):v({type:0}))}),{isFocusVisible:N,focusProps:I}=(0,a.F)({autoFocus:l}),{isHovered:O,hoverProps:P}=(0,u.X)({isDisabled:o}),{pressed:j,pressProps:M}=(0,c.x)({disabled:o}),B=(0,s.useMemo)(()=>({open:0===m.disclosureState,hover:O,active:j,disabled:o,focus:N,autofocus:l}),[m,O,j,N,o,l]),R=(0,d.f)(e,m.buttonElement),L=y?(0,E.dG)({ref:w,type:R,disabled:o||void 0,autoFocus:l,onKeyDown:S,onClick:C},I,P,M):(0,E.dG)({ref:w,id:r,type:R,"aria-expanded":0===m.disclosureState,"aria-controls":m.panelElement?m.panelId:void 0,disabled:o||void 0,autoFocus:l,onKeyDown:S,onKeyUp:k,onClick:C},I,P,M);return(0,E.L6)()({ourProps:L,theirProps:f,slot:B,defaultTag:"button",name:"Disclosure.Button"})}),Panel:(0,E.yV)(function(e,t){let n=(0,s.useId)(),{id:r="headlessui-disclosure-panel-".concat(n),transition:o=!1,...l}=e,[a,u]=T("Disclosure.Panel"),{close:c}=function e(t){let n=(0,s.useContext)(N);if(null===n){let n=Error("<".concat(t," /> is missing a parent component."));throw Error.captureStackTrace&&Error.captureStackTrace(n,e),n}return n}("Disclosure.Panel"),[d,m]=(0,s.useState)(null),b=(0,p.T)(t,(0,i.z)(e=>{h(()=>u({type:5,element:e}))}),m);(0,s.useEffect)(()=>(u({type:3,panelId:r}),()=>{u({type:3,panelId:null})}),[r,u]);let g=(0,v.oJ)(),[y,x]=(0,f.Y)(o,d,null!==g?(g&v.ZM.Open)===v.ZM.Open:0===a.disclosureState),w=(0,s.useMemo)(()=>({open:0===a.disclosureState,close:c}),[a.disclosureState,c]),S={ref:b,id:r,...(0,f.X)(x)},k=(0,E.L6)();return s.createElement(v.uu,null,s.createElement(D.Provider,{value:a.panelId},k({ourProps:S,theirProps:l,slot:w,defaultTag:"div",features:P,visible:y,name:"Disclosure.Panel"})))})})},33443:function(e,t,n){"use strict";n.d(t,{Z:function(){return l}});var r=n(2265);let o=(0,r.createContext)(()=>{});function l(e){let{value:t,children:n}=e;return r.createElement(o.Provider,{value:t},n)}}}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7996],{30150:function(e,t,n){"use strict";n.d(t,{Z:function(){return p}});var r=n(5853),o=n(2265);let l=e=>{var t=(0,r._T)(e,[]);return o.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),o.createElement("path",{d:"M12 4v16m8-8H4"}))},a=e=>{var t=(0,r._T)(e,[]);return o.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),o.createElement("path",{d:"M20 12H4"}))};var u=n(13241),s=n(1153),c=n(69262);let i="flex mx-auto text-tremor-content-subtle dark:text-dark-tremor-content-subtle",d="cursor-pointer hover:text-tremor-content dark:hover:text-dark-tremor-content",p=o.forwardRef((e,t)=>{let{onSubmit:n,enableStepper:p=!0,disabled:f,onValueChange:m,onChange:v}=e,b=(0,r._T)(e,["onSubmit","enableStepper","disabled","onValueChange","onChange"]),g=(0,o.useRef)(null),[y,E]=o.useState(!1),h=o.useCallback(()=>{E(!0)},[]),x=o.useCallback(()=>{E(!1)},[]),[w,S]=o.useState(!1),k=o.useCallback(()=>{S(!0)},[]),C=o.useCallback(()=>{S(!1)},[]);return o.createElement(c.Z,Object.assign({type:"number",ref:(0,s.lq)([g,t]),disabled:f,makeInputClassName:(0,s.fn)("NumberInput"),onKeyDown:e=>{var t;if("Enter"===e.key&&!e.ctrlKey&&!e.altKey&&!e.shiftKey){let e=null===(t=g.current)||void 0===t?void 0:t.value;null==n||n(parseFloat(null!=e?e:""))}"ArrowDown"===e.key&&h(),"ArrowUp"===e.key&&k()},onKeyUp:e=>{"ArrowDown"===e.key&&x(),"ArrowUp"===e.key&&C()},onChange:e=>{f||(null==m||m(parseFloat(e.target.value)),null==v||v(e))},stepper:p?o.createElement("div",{className:(0,u.q)("flex justify-center align-middle")},o.createElement("div",{tabIndex:-1,onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault(),onTouchStart:e=>{e.cancelable&&e.preventDefault()},onMouseUp:()=>{var e,t;f||(null===(e=g.current)||void 0===e||e.stepDown(),null===(t=g.current)||void 0===t||t.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,u.q)(!f&&d,i,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},o.createElement(a,{"data-testid":"step-down",className:(y?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"})),o.createElement("div",{tabIndex:-1,onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault(),onTouchStart:e=>{e.cancelable&&e.preventDefault()},onMouseUp:()=>{var e,t;f||(null===(e=g.current)||void 0===e||e.stepUp(),null===(t=g.current)||void 0===t||t.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,u.q)(!f&&d,i,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},o.createElement(l,{"data-testid":"step-up",className:(w?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"}))):null},b))});p.displayName="NumberInput"},87452:function(e,t,n){"use strict";n.d(t,{Z:function(){return d},r:function(){return i}});var r=n(5853),o=n(91054);n(42698),n(64016);var l=n(8710);n(33232);var a=n(13241),u=n(1153),s=n(2265);let c=(0,u.fn)("Accordion"),i=(0,s.createContext)({isOpen:!1}),d=s.forwardRef((e,t)=>{var n;let{defaultOpen:u=!1,children:d,className:p}=e,f=(0,r._T)(e,["defaultOpen","children","className"]),m=null!==(n=(0,s.useContext)(l.Z))&&void 0!==n?n:(0,a.q)("rounded-tremor-default border");return s.createElement(o.pJ,Object.assign({as:"div",ref:t,className:(0,a.q)(c("root"),"overflow-hidden","bg-tremor-background border-tremor-border","dark:bg-dark-tremor-background dark:border-dark-tremor-border",m,p),defaultOpen:u},f),e=>{let{open:t}=e;return s.createElement(i.Provider,{value:{isOpen:t}},d)})});d.displayName="Accordion"},88829:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var r=n(5853),o=n(2265),l=n(91054),a=n(13241);let u=(0,n(1153).fn)("AccordionBody"),s=o.forwardRef((e,t)=>{let{children:n,className:s}=e,c=(0,r._T)(e,["children","className"]);return o.createElement(l.pJ.Panel,Object.assign({ref:t,className:(0,a.q)(u("root"),"w-full text-tremor-default px-4 pb-3","text-tremor-content","dark:text-dark-tremor-content",s)},c),n)});s.displayName="AccordionBody"},72208:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(5853),o=n(2265),l=n(91054);let a=e=>{var t=(0,r._T)(e,[]);return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),o.createElement("path",{d:"M11.9999 10.8284L7.0502 15.7782L5.63599 14.364L11.9999 8L18.3639 14.364L16.9497 15.7782L11.9999 10.8284Z"}))};var u=n(87452),s=n(13241);let c=(0,n(1153).fn)("AccordionHeader"),i=o.forwardRef((e,t)=>{let{children:n,className:i}=e,d=(0,r._T)(e,["children","className"]),{isOpen:p}=(0,o.useContext)(u.r);return o.createElement(l.pJ.Button,Object.assign({ref:t,className:(0,s.q)(c("root"),"w-full flex items-center justify-between px-4 py-3","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis",i)},d),o.createElement("div",{className:(0,s.q)(c("children"),"flex flex-1 text-inherit mr-4")},n),o.createElement("div",null,o.createElement(a,{className:(0,s.q)(c("arrowIcon"),"h-5 w-5 -mr-1","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle",p?"transition-all":"transition-all -rotate-180")})))});i.displayName="AccordionHeader"},49804:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(5853),o=n(13241),l=n(1153),a=n(2265),u=n(9496);let s=(0,l.fn)("Col"),c=a.forwardRef((e,t)=>{let{numColSpan:n=1,numColSpanSm:l,numColSpanMd:c,numColSpanLg:i,children:d,className:p}=e,f=(0,r._T)(e,["numColSpan","numColSpanSm","numColSpanMd","numColSpanLg","children","className"]),m=(e,t)=>e&&Object.keys(t).includes(String(e))?t[e]:"";return a.createElement("div",Object.assign({ref:t,className:(0,o.q)(s("root"),(()=>{let e=m(n,u.PT),t=m(l,u.SP),r=m(c,u.VS),a=m(i,u._w);return(0,o.q)(e,t,r,a)})(),p)},f),d)});c.displayName="Col"},23910:function(e,t,n){var r=n(74288).Symbol;e.exports=r},54506:function(e,t,n){var r=n(23910),o=n(4479),l=n(80910),a=r?r.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":a&&a in Object(e)?o(e):l(e)}},41087:function(e,t,n){var r=n(5035),o=/^\s+/;e.exports=function(e){return e?e.slice(0,r(e)+1).replace(o,""):e}},17071:function(e,t,n){var r="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g;e.exports=r},4479:function(e,t,n){var r=n(23910),o=Object.prototype,l=o.hasOwnProperty,a=o.toString,u=r?r.toStringTag:void 0;e.exports=function(e){var t=l.call(e,u),n=e[u];try{e[u]=void 0;var r=!0}catch(e){}var o=a.call(e);return r&&(t?e[u]=n:delete e[u]),o}},80910:function(e){var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},74288:function(e,t,n){var r=n(17071),o="object"==typeof self&&self&&self.Object===Object&&self,l=r||o||Function("return this")();e.exports=l},5035:function(e){var t=/\s/;e.exports=function(e){for(var n=e.length;n--&&t.test(e.charAt(n)););return n}},7310:function(e,t,n){var r=n(28302),o=n(11121),l=n(6660),a=Math.max,u=Math.min;e.exports=function(e,t,n){var s,c,i,d,p,f,m=0,v=!1,b=!1,g=!0;if("function"!=typeof e)throw TypeError("Expected a function");function y(t){var n=s,r=c;return s=c=void 0,m=t,d=e.apply(r,n)}function E(e){var n=e-f,r=e-m;return void 0===f||n>=t||n<0||b&&r>=i}function h(){var e,n,r,l=o();if(E(l))return x(l);p=setTimeout(h,(e=l-f,n=l-m,r=t-e,b?u(r,i-n):r))}function x(e){return(p=void 0,g&&s)?y(e):(s=c=void 0,d)}function w(){var e,n=o(),r=E(n);if(s=arguments,c=this,f=n,r){if(void 0===p)return m=e=f,p=setTimeout(h,t),v?y(e):d;if(b)return clearTimeout(p),p=setTimeout(h,t),y(f)}return void 0===p&&(p=setTimeout(h,t)),d}return t=l(t)||0,r(n)&&(v=!!n.leading,i=(b="maxWait"in n)?a(l(n.maxWait)||0,t):i,g="trailing"in n?!!n.trailing:g),w.cancel=function(){void 0!==p&&clearTimeout(p),m=0,s=f=c=p=void 0},w.flush=function(){return void 0===p?d:x(o())},w}},28302:function(e){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},10303:function(e){e.exports=function(e){return null!=e&&"object"==typeof e}},78371:function(e,t,n){var r=n(54506),o=n(10303);e.exports=function(e){return"symbol"==typeof e||o(e)&&"[object Symbol]"==r(e)}},11121:function(e,t,n){var r=n(74288);e.exports=function(){return r.Date.now()}},6660:function(e,t,n){var r=n(41087),o=n(28302),l=n(78371),a=0/0,u=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,c=/^0o[0-7]+$/i,i=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(l(e))return a;if(o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=r(e);var n=s.test(e);return n||c.test(e)?i(e.slice(2),n?2:8):u.test(e)?a:+e}},23628:function(e,t,n){"use strict";var r=n(2265);let o=r.forwardRef(function(e,t){return r.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),r.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"}))});t.Z=o},91054:function(e,t,n){"use strict";let r,o;n.d(t,{pJ:function(){return j}});var l,a=n(71049),u=n(11323),s=n(2265),c=n(66797),i=n(93980),d=n(65573),p=n(67561),f=n(98218),m=n(33443),v=n(28294),b=n(31370),g=n(72468),y=n(5664),E=n(38929);let h=null!=(l=s.startTransition)?l:function(e){e()};var x=n(52724),w=((r=w||{})[r.Open=0]="Open",r[r.Closed=1]="Closed",r),S=((o=S||{})[o.ToggleDisclosure=0]="ToggleDisclosure",o[o.CloseDisclosure=1]="CloseDisclosure",o[o.SetButtonId=2]="SetButtonId",o[o.SetPanelId=3]="SetPanelId",o[o.SetButtonElement=4]="SetButtonElement",o[o.SetPanelElement=5]="SetPanelElement",o);let k={0:e=>({...e,disclosureState:(0,g.E)(e.disclosureState,{0:1,1:0})}),1:e=>1===e.disclosureState?e:{...e,disclosureState:1},2:(e,t)=>e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId},3:(e,t)=>e.panelId===t.panelId?e:{...e,panelId:t.panelId},4:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},5:(e,t)=>e.panelElement===t.element?e:{...e,panelElement:t.element}},C=(0,s.createContext)(null);function T(e){let t=(0,s.useContext)(C);if(null===t){let t=Error("<".concat(e," /> is missing a parent component."));throw Error.captureStackTrace&&Error.captureStackTrace(t,T),t}return t}C.displayName="DisclosureContext";let N=(0,s.createContext)(null);N.displayName="DisclosureAPIContext";let D=(0,s.createContext)(null);function I(e,t){return(0,g.E)(t.type,k,e,t)}D.displayName="DisclosurePanelContext";let O=s.Fragment,P=E.VN.RenderStrategy|E.VN.Static,j=Object.assign((0,E.yV)(function(e,t){let{defaultOpen:n=!1,...r}=e,o=(0,s.useRef)(null),l=(0,p.T)(t,(0,p.h)(e=>{o.current=e},void 0===e.as||e.as===s.Fragment)),a=(0,s.useReducer)(I,{disclosureState:n?0:1,buttonElement:null,panelElement:null,buttonId:null,panelId:null}),[{disclosureState:u,buttonId:c},d]=a,f=(0,i.z)(e=>{d({type:1});let t=(0,y.r)(o);if(!t||!c)return;let n=e?e instanceof HTMLElement?e:e.current instanceof HTMLElement?e.current:t.getElementById(c):t.getElementById(c);null==n||n.focus()}),b=(0,s.useMemo)(()=>({close:f}),[f]),h=(0,s.useMemo)(()=>({open:0===u,close:f}),[u,f]),x=(0,E.L6)();return s.createElement(C.Provider,{value:a},s.createElement(N.Provider,{value:b},s.createElement(m.Z,{value:f},s.createElement(v.up,{value:(0,g.E)(u,{0:v.ZM.Open,1:v.ZM.Closed})},x({ourProps:{ref:l},theirProps:r,slot:h,defaultTag:O,name:"Disclosure"})))))}),{Button:(0,E.yV)(function(e,t){let n=(0,s.useId)(),{id:r="headlessui-disclosure-button-".concat(n),disabled:o=!1,autoFocus:l=!1,...f}=e,[m,v]=T("Disclosure.Button"),g=(0,s.useContext)(D),y=null!==g&&g===m.panelId,h=(0,s.useRef)(null),w=(0,p.T)(h,t,(0,i.z)(e=>{if(!y)return v({type:4,element:e})}));(0,s.useEffect)(()=>{if(!y)return v({type:2,buttonId:r}),()=>{v({type:2,buttonId:null})}},[r,v,y]);let S=(0,i.z)(e=>{var t;if(y){if(1===m.disclosureState)return;switch(e.key){case x.R.Space:case x.R.Enter:e.preventDefault(),e.stopPropagation(),v({type:0}),null==(t=m.buttonElement)||t.focus()}}else switch(e.key){case x.R.Space:case x.R.Enter:e.preventDefault(),e.stopPropagation(),v({type:0})}}),k=(0,i.z)(e=>{e.key===x.R.Space&&e.preventDefault()}),C=(0,i.z)(e=>{var t;(0,b.P)(e.currentTarget)||o||(y?(v({type:0}),null==(t=m.buttonElement)||t.focus()):v({type:0}))}),{isFocusVisible:N,focusProps:I}=(0,a.F)({autoFocus:l}),{isHovered:O,hoverProps:P}=(0,u.X)({isDisabled:o}),{pressed:j,pressProps:M}=(0,c.x)({disabled:o}),B=(0,s.useMemo)(()=>({open:0===m.disclosureState,hover:O,active:j,disabled:o,focus:N,autofocus:l}),[m,O,j,N,o,l]),R=(0,d.f)(e,m.buttonElement),L=y?(0,E.dG)({ref:w,type:R,disabled:o||void 0,autoFocus:l,onKeyDown:S,onClick:C},I,P,M):(0,E.dG)({ref:w,id:r,type:R,"aria-expanded":0===m.disclosureState,"aria-controls":m.panelElement?m.panelId:void 0,disabled:o||void 0,autoFocus:l,onKeyDown:S,onKeyUp:k,onClick:C},I,P,M);return(0,E.L6)()({ourProps:L,theirProps:f,slot:B,defaultTag:"button",name:"Disclosure.Button"})}),Panel:(0,E.yV)(function(e,t){let n=(0,s.useId)(),{id:r="headlessui-disclosure-panel-".concat(n),transition:o=!1,...l}=e,[a,u]=T("Disclosure.Panel"),{close:c}=function e(t){let n=(0,s.useContext)(N);if(null===n){let n=Error("<".concat(t," /> is missing a parent component."));throw Error.captureStackTrace&&Error.captureStackTrace(n,e),n}return n}("Disclosure.Panel"),[d,m]=(0,s.useState)(null),b=(0,p.T)(t,(0,i.z)(e=>{h(()=>u({type:5,element:e}))}),m);(0,s.useEffect)(()=>(u({type:3,panelId:r}),()=>{u({type:3,panelId:null})}),[r,u]);let g=(0,v.oJ)(),[y,x]=(0,f.Y)(o,d,null!==g?(g&v.ZM.Open)===v.ZM.Open:0===a.disclosureState),w=(0,s.useMemo)(()=>({open:0===a.disclosureState,close:c}),[a.disclosureState,c]),S={ref:b,id:r,...(0,f.X)(x)},k=(0,E.L6)();return s.createElement(v.uu,null,s.createElement(D.Provider,{value:a.panelId},k({ourProps:S,theirProps:l,slot:w,defaultTag:"div",features:P,visible:y,name:"Disclosure.Panel"})))})})},33443:function(e,t,n){"use strict";n.d(t,{Z:function(){return l}});var r=n(2265);let o=(0,r.createContext)(()=>{});function l(e){let{value:t,children:n}=e;return r.createElement(o.Provider,{value:t},n)}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/849-21e5bc782ade4577.js b/litellm/proxy/_experimental/out/_next/static/chunks/849-d1cabf66d71a8808.js similarity index 99% rename from litellm/proxy/_experimental/out/_next/static/chunks/849-21e5bc782ade4577.js rename to litellm/proxy/_experimental/out/_next/static/chunks/849-d1cabf66d71a8808.js index e2a2666f41..cf75876f70 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/849-21e5bc782ade4577.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/849-d1cabf66d71a8808.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[849],{14042:function(e,t,n){"use strict";n.d(t,{Z:function(){return eM}});var r=n(5853),o=n(7084),i=n(26898),a=n(13241),c=n(1153),l=n(2265),s=n(60474),u=n(47625),p=n(93765),f=n(86757),d=n.n(f),y=n(61994),m=n(9841),v=n(81889),h=n(82944),b=["points","className","baseLinePoints","connectNulls"];function g(){return(g=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n0&&void 0!==arguments[0]?arguments[0]:[],t=[[]];return e.forEach(function(e){x(e)?t[t.length-1].push(e):t[t.length-1].length>0&&t.push([])}),x(e[0])&&t[t.length-1].push(e[0]),t[t.length-1].length<=0&&(t=t.slice(0,-1)),t},j=function(e,t){var n=k(e);t&&(n=[n.reduce(function(e,t){return[].concat(A(e),A(t))},[])]);var r=n.map(function(e){return e.reduce(function(e,t,n){return"".concat(e).concat(0===n?"M":"L").concat(t.x,",").concat(t.y)},"")}).join("");return 1===n.length?"".concat(r,"Z"):r},P=function(e,t,n){var r=j(e,n);return"".concat("Z"===r.slice(-1)?r.slice(0,-1):r,"L").concat(j(t.reverse(),n).slice(1))},w=function(e){var t=e.points,n=e.className,r=e.baseLinePoints,o=e.connectNulls,i=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,b);if(!t||!t.length)return null;var a=(0,y.Z)("recharts-polygon",n);if(r&&r.length){var c=i.stroke&&"none"!==i.stroke,s=P(t,r,o);return l.createElement("g",{className:a},l.createElement("path",g({},(0,h.L6)(i,!0),{fill:"Z"===s.slice(-1)?i.fill:"none",stroke:"none",d:s})),c?l.createElement("path",g({},(0,h.L6)(i,!0),{fill:"none",d:j(t,o)})):null,c?l.createElement("path",g({},(0,h.L6)(i,!0),{fill:"none",d:j(r,o)})):null)}var u=j(t,o);return l.createElement("path",g({},(0,h.L6)(i,!0),{fill:"Z"===u.slice(-1)?i.fill:"none",className:a,d:u}))},E=n(58811),S=n(41637),T=n(39206);function L(e){return(L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function R(){return(R=Object.assign?Object.assign.bind():function(e){for(var t=1;t1e-5?"outer"===t?"start":"end":n<-.00001?"outer"===t?"end":"start":"middle"}},{key:"renderAxisLine",value:function(){var e=this.props,t=e.cx,n=e.cy,r=e.radius,o=e.axisLine,i=e.axisLineType,a=I(I({},(0,h.L6)(this.props,!1)),{},{fill:"none"},(0,h.L6)(o,!1));if("circle"===i)return l.createElement(v.o,R({className:"recharts-polar-angle-axis-line"},a,{cx:t,cy:n,r:r}));var c=this.props.ticks.map(function(e){return(0,T.op)(t,n,r,e.coordinate)});return l.createElement(w,R({className:"recharts-polar-angle-axis-line"},a,{points:c}))}},{key:"renderTicks",value:function(){var e=this,t=this.props,n=t.ticks,o=t.tick,i=t.tickLine,a=t.tickFormatter,c=t.stroke,s=(0,h.L6)(this.props,!1),u=(0,h.L6)(o,!1),p=I(I({},s),{},{fill:"none"},(0,h.L6)(i,!1)),f=n.map(function(t,n){var f=e.getTickLineCoord(t),d=I(I(I({textAnchor:e.getTickTextAnchor(t)},s),{},{stroke:"none",fill:c},u),{},{index:n,payload:t,x:f.x2,y:f.y2});return l.createElement(m.m,R({className:(0,y.Z)("recharts-polar-angle-axis-tick",(0,T.$S)(o)),key:"tick-".concat(t.coordinate)},(0,S.bw)(e.props,t,n)),i&&l.createElement("line",R({className:"recharts-polar-angle-axis-tick-line"},p,f)),o&&r.renderTickItem(o,d,a?a(t.value,n):t.value))});return l.createElement(m.m,{className:"recharts-polar-angle-axis-ticks"},f)}},{key:"render",value:function(){var e=this.props,t=e.ticks,n=e.radius,r=e.axisLine;return!(n<=0)&&t&&t.length?l.createElement(m.m,{className:(0,y.Z)("recharts-polar-angle-axis",this.props.className)},r&&this.renderAxisLine(),this.renderTicks()):null}}],n=[{key:"renderTickItem",value:function(e,t,n){return l.isValidElement(e)?l.cloneElement(e,t):d()(e)?e(t):l.createElement(E.x,R({},t,{className:"recharts-polar-angle-axis-tick-value"}),n)}}],t&&C(r.prototype,t),n&&C(r,n),Object.defineProperty(r,"prototype",{writable:!1}),r}(l.PureComponent);Z(M,"displayName","PolarAngleAxis"),Z(M,"axisType","angleAxis"),Z(M,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var V=n(35802),$=n.n(V),q=n(37891),z=n.n(q),G=n(26680),Y=["cx","cy","angle","ticks","axisLine"],H=["ticks","tick","angle","tickFormatter","stroke"];function U(e){return(U="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function W(){return(W=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function ee(e,t){for(var n=0;n0?es()(e,"paddingAngle",0):0;if(n){var c=(0,eb.k4)(n.endAngle-n.startAngle,e.endAngle-e.startAngle),l=eP(eP({},e),{},{startAngle:i+a,endAngle:i+c(r)+a});o.push(l),i=l.endAngle}else{var s=e.endAngle,p=e.startAngle,f=(0,eb.k4)(0,s-p)(r),d=eP(eP({},e),{},{startAngle:i+a,endAngle:i+f+a});o.push(d),i=d.endAngle}}),l.createElement(m.m,null,e.renderSectorsStatically(o))})}},{key:"attachKeyboardHandlers",value:function(e){var t=this;e.onkeydown=function(e){if(!e.altKey)switch(e.key){case"ArrowLeft":var n=++t.state.sectorToFocus%t.sectorRefs.length;t.sectorRefs[n].focus(),t.setState({sectorToFocus:n});break;case"ArrowRight":var r=--t.state.sectorToFocus<0?t.sectorRefs.length-1:t.state.sectorToFocus%t.sectorRefs.length;t.sectorRefs[r].focus(),t.setState({sectorToFocus:r});break;case"Escape":t.sectorRefs[t.state.sectorToFocus].blur(),t.setState({sectorToFocus:0})}}}},{key:"renderSectors",value:function(){var e=this.props,t=e.sectors,n=e.isAnimationActive,r=this.state.prevSectors;return n&&t&&t.length&&(!r||!ep()(r,t))?this.renderSectorsWithAnimation():this.renderSectorsStatically(t)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var e=this,t=this.props,n=t.hide,r=t.sectors,o=t.className,i=t.label,a=t.cx,c=t.cy,s=t.innerRadius,u=t.outerRadius,p=t.isAnimationActive,f=this.state.isAnimationFinished;if(n||!r||!r.length||!(0,eb.hj)(a)||!(0,eb.hj)(c)||!(0,eb.hj)(s)||!(0,eb.hj)(u))return null;var d=(0,y.Z)("recharts-pie",o);return l.createElement(m.m,{tabIndex:this.props.rootTabIndex,className:d,ref:function(t){e.pieRef=t}},this.renderSectors(),i&&this.renderLabels(r),G._.renderCallByParent(this.props,null,!1),(!p||f)&&em.e.renderCallByParent(this.props,r,!1))}}],n=[{key:"getDerivedStateFromProps",value:function(e,t){return t.prevIsAnimationActive!==e.isAnimationActive?{prevIsAnimationActive:e.isAnimationActive,prevAnimationId:e.animationId,curSectors:e.sectors,prevSectors:[],isAnimationFinished:!0}:e.isAnimationActive&&e.animationId!==t.prevAnimationId?{prevAnimationId:e.animationId,curSectors:e.sectors,prevSectors:t.curSectors,isAnimationFinished:!0}:e.sectors!==t.curSectors?{curSectors:e.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(e,t){return e>t?"start":e=360?A:A-1)*u,x=a.reduce(function(e,t){var n=(0,eg.F$)(t,g,0);return e+((0,eb.hj)(n)?n:0)},0);return x>0&&(t=a.map(function(e,t){var r,o=(0,eg.F$)(e,g,0),i=(0,eg.F$)(e,f,t),a=((0,eb.hj)(o)?o:0)/x,s=(r=t?n.endAngle+(0,eb.uY)(h)*u*(0!==o?1:0):l)+(0,eb.uY)(h)*((0!==o?m:0)+a*O),p=(r+s)/2,d=(v.innerRadius+v.outerRadius)/2,b=[{name:i,value:o,payload:e,dataKey:g,type:y}],A=(0,T.op)(v.cx,v.cy,d,p);return n=eP(eP(eP({percent:a,cornerRadius:c,name:i,tooltipPayload:b,midAngle:p,middleRadius:d,tooltipPosition:A},e),v),{},{value:(0,eg.F$)(e,g),startAngle:r,endAngle:s,payload:e,paddingAngle:(0,eb.uY)(h)*u})})),eP(eP({},v),{},{sectors:t,data:a})});var eI=(0,p.z)({chartName:"PieChart",GraphicalChild:eN,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:M},{axisType:"radiusAxis",AxisComp:ea}],formatAxisMap:T.t9,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}}),eC=n(8147),eD=n(92666),eF=n(98593);let e_=e=>{let{active:t,payload:n,valueFormatter:r}=e;if(t&&(null==n?void 0:n[0])){let e=null==n?void 0:n[0];return l.createElement(eF.$B,null,l.createElement("div",{className:(0,a.q)("px-4 py-2")},l.createElement(eF.zX,{value:r(e.value),name:e.name,color:e.payload.color})))}return null},eZ=(e,t)=>e.map((e,n)=>{let r=ne||t((0,c.vP)(n.map(e=>e[r]))),eK=e=>{let{cx:t,cy:n,innerRadius:r,outerRadius:o,startAngle:i,endAngle:a,className:c}=e;return l.createElement("g",null,l.createElement(s.L,{cx:t,cy:n,innerRadius:r,outerRadius:o,startAngle:i,endAngle:a,className:c,fill:"",opacity:.3,style:{outline:"none"}}))},eM=l.forwardRef((e,t)=>{let{data:n=[],category:s="value",index:p="name",colors:f=i.s,variant:d="donut",valueFormatter:y=c.Cj,label:m,showLabel:v=!0,animationDuration:h=900,showAnimation:b=!1,showTooltip:g=!0,noDataText:A,onValueChange:O,customTooltip:x,className:k}=e,j=(0,r._T)(e,["data","category","index","colors","variant","valueFormatter","label","showLabel","animationDuration","showAnimation","showTooltip","noDataText","onValueChange","customTooltip","className"]),P="donut"==d,w=eB(m,y,n,s),[E,S]=l.useState(void 0),T=!!O;return(0,l.useEffect)(()=>{let e=document.querySelectorAll(".recharts-pie-sector");e&&e.forEach(e=>{e.setAttribute("style","outline: none")})},[E]),l.createElement("div",Object.assign({ref:t,className:(0,a.q)("w-full h-40",k)},j),l.createElement(u.h,{className:"h-full w-full"},(null==n?void 0:n.length)?l.createElement(eI,{onClick:T&&E?()=>{S(void 0),null==O||O(null)}:void 0,margin:{top:0,left:0,right:0,bottom:0}},v&&P?l.createElement("text",{className:(0,a.q)("fill-tremor-content-emphasis","dark:fill-dark-tremor-content-emphasis"),x:"50%",y:"50%",textAnchor:"middle",dominantBaseline:"middle"},w):null,l.createElement(eN,{className:(0,a.q)("stroke-tremor-background dark:stroke-dark-tremor-background",O?"cursor-pointer":"cursor-default"),data:eZ(n,f),cx:"50%",cy:"50%",startAngle:90,endAngle:-270,innerRadius:P?"75%":"0%",outerRadius:"100%",stroke:"",strokeLinejoin:"round",dataKey:s,nameKey:p,isAnimationActive:b,animationDuration:h,onClick:function(e,t,n){n.stopPropagation(),T&&(E===t?(S(void 0),null==O||O(null)):(S(t),null==O||O(Object.assign({eventType:"slice"},e.payload.payload))))},activeIndex:E,inactiveShape:eK,style:{outline:"none"}}),l.createElement(eC.u,{wrapperStyle:{outline:"none"},isAnimationActive:!1,content:g?e=>{var t;let{active:n,payload:r}=e;return x?l.createElement(x,{payload:null==r?void 0:r.map(e=>{var t,n,i;return Object.assign(Object.assign({},e),{color:null!==(i=null===(n=null===(t=null==r?void 0:r[0])||void 0===t?void 0:t.payload)||void 0===n?void 0:n.color)&&void 0!==i?i:o.fr.Gray})}),active:n,label:null===(t=null==r?void 0:r[0])||void 0===t?void 0:t.name}):l.createElement(e_,{active:n,payload:r,valueFormatter:y})}:l.createElement(l.Fragment,null)})):l.createElement(eD.Z,{noDataText:A})))});eM.displayName="DonutChart"},35802:function(e,t,n){var r=n(67646),o=n(58905),i=n(88157);e.exports=function(e,t){return e&&e.length?r(e,i(t,2),o):void 0}},37891:function(e,t,n){var r=n(67646),o=n(88157),i=n(20121);e.exports=function(e,t){return e&&e.length?r(e,o(t,2),i):void 0}},58710:function(e,t,n){"use strict";var r=n(2265);let o=r.forwardRef(function(e,t){return r.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),r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"}))});t.Z=o},92668:function(e,t,n){"use strict";n.d(t,{I:function(){return c}});var r=n(59121),o=n(31091),i=n(63497),a=n(99649);function c(e,t){let{years:n=0,months:c=0,weeks:l=0,days:s=0,hours:u=0,minutes:p=0,seconds:f=0}=t,d=(0,a.Q)(e),y=c||n?(0,o.z)(d,c+12*n):d,m=s||l?(0,r.E)(y,s+7*l):y;return(0,i.L)(e,m.getTime()+1e3*(f+60*(p+60*u)))}}}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[849],{14042:function(e,t,n){"use strict";n.d(t,{Z:function(){return eM}});var r=n(5853),o=n(7084),i=n(26898),a=n(13241),c=n(1153),l=n(2265),s=n(60474),u=n(47625),p=n(93765),f=n(86757),d=n.n(f),y=n(87602),m=n(9841),v=n(81889),h=n(82944),b=["points","className","baseLinePoints","connectNulls"];function g(){return(g=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n0&&void 0!==arguments[0]?arguments[0]:[],t=[[]];return e.forEach(function(e){x(e)?t[t.length-1].push(e):t[t.length-1].length>0&&t.push([])}),x(e[0])&&t[t.length-1].push(e[0]),t[t.length-1].length<=0&&(t=t.slice(0,-1)),t},j=function(e,t){var n=k(e);t&&(n=[n.reduce(function(e,t){return[].concat(A(e),A(t))},[])]);var r=n.map(function(e){return e.reduce(function(e,t,n){return"".concat(e).concat(0===n?"M":"L").concat(t.x,",").concat(t.y)},"")}).join("");return 1===n.length?"".concat(r,"Z"):r},P=function(e,t,n){var r=j(e,n);return"".concat("Z"===r.slice(-1)?r.slice(0,-1):r,"L").concat(j(t.reverse(),n).slice(1))},w=function(e){var t=e.points,n=e.className,r=e.baseLinePoints,o=e.connectNulls,i=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,b);if(!t||!t.length)return null;var a=(0,y.Z)("recharts-polygon",n);if(r&&r.length){var c=i.stroke&&"none"!==i.stroke,s=P(t,r,o);return l.createElement("g",{className:a},l.createElement("path",g({},(0,h.L6)(i,!0),{fill:"Z"===s.slice(-1)?i.fill:"none",stroke:"none",d:s})),c?l.createElement("path",g({},(0,h.L6)(i,!0),{fill:"none",d:j(t,o)})):null,c?l.createElement("path",g({},(0,h.L6)(i,!0),{fill:"none",d:j(r,o)})):null)}var u=j(t,o);return l.createElement("path",g({},(0,h.L6)(i,!0),{fill:"Z"===u.slice(-1)?i.fill:"none",className:a,d:u}))},E=n(58811),S=n(41637),T=n(39206);function L(e){return(L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function R(){return(R=Object.assign?Object.assign.bind():function(e){for(var t=1;t1e-5?"outer"===t?"start":"end":n<-.00001?"outer"===t?"end":"start":"middle"}},{key:"renderAxisLine",value:function(){var e=this.props,t=e.cx,n=e.cy,r=e.radius,o=e.axisLine,i=e.axisLineType,a=I(I({},(0,h.L6)(this.props,!1)),{},{fill:"none"},(0,h.L6)(o,!1));if("circle"===i)return l.createElement(v.o,R({className:"recharts-polar-angle-axis-line"},a,{cx:t,cy:n,r:r}));var c=this.props.ticks.map(function(e){return(0,T.op)(t,n,r,e.coordinate)});return l.createElement(w,R({className:"recharts-polar-angle-axis-line"},a,{points:c}))}},{key:"renderTicks",value:function(){var e=this,t=this.props,n=t.ticks,o=t.tick,i=t.tickLine,a=t.tickFormatter,c=t.stroke,s=(0,h.L6)(this.props,!1),u=(0,h.L6)(o,!1),p=I(I({},s),{},{fill:"none"},(0,h.L6)(i,!1)),f=n.map(function(t,n){var f=e.getTickLineCoord(t),d=I(I(I({textAnchor:e.getTickTextAnchor(t)},s),{},{stroke:"none",fill:c},u),{},{index:n,payload:t,x:f.x2,y:f.y2});return l.createElement(m.m,R({className:(0,y.Z)("recharts-polar-angle-axis-tick",(0,T.$S)(o)),key:"tick-".concat(t.coordinate)},(0,S.bw)(e.props,t,n)),i&&l.createElement("line",R({className:"recharts-polar-angle-axis-tick-line"},p,f)),o&&r.renderTickItem(o,d,a?a(t.value,n):t.value))});return l.createElement(m.m,{className:"recharts-polar-angle-axis-ticks"},f)}},{key:"render",value:function(){var e=this.props,t=e.ticks,n=e.radius,r=e.axisLine;return!(n<=0)&&t&&t.length?l.createElement(m.m,{className:(0,y.Z)("recharts-polar-angle-axis",this.props.className)},r&&this.renderAxisLine(),this.renderTicks()):null}}],n=[{key:"renderTickItem",value:function(e,t,n){return l.isValidElement(e)?l.cloneElement(e,t):d()(e)?e(t):l.createElement(E.x,R({},t,{className:"recharts-polar-angle-axis-tick-value"}),n)}}],t&&C(r.prototype,t),n&&C(r,n),Object.defineProperty(r,"prototype",{writable:!1}),r}(l.PureComponent);Z(M,"displayName","PolarAngleAxis"),Z(M,"axisType","angleAxis"),Z(M,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var V=n(35802),$=n.n(V),q=n(37891),z=n.n(q),G=n(26680),Y=["cx","cy","angle","ticks","axisLine"],H=["ticks","tick","angle","tickFormatter","stroke"];function U(e){return(U="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function W(){return(W=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function ee(e,t){for(var n=0;n0?es()(e,"paddingAngle",0):0;if(n){var c=(0,eb.k4)(n.endAngle-n.startAngle,e.endAngle-e.startAngle),l=eP(eP({},e),{},{startAngle:i+a,endAngle:i+c(r)+a});o.push(l),i=l.endAngle}else{var s=e.endAngle,p=e.startAngle,f=(0,eb.k4)(0,s-p)(r),d=eP(eP({},e),{},{startAngle:i+a,endAngle:i+f+a});o.push(d),i=d.endAngle}}),l.createElement(m.m,null,e.renderSectorsStatically(o))})}},{key:"attachKeyboardHandlers",value:function(e){var t=this;e.onkeydown=function(e){if(!e.altKey)switch(e.key){case"ArrowLeft":var n=++t.state.sectorToFocus%t.sectorRefs.length;t.sectorRefs[n].focus(),t.setState({sectorToFocus:n});break;case"ArrowRight":var r=--t.state.sectorToFocus<0?t.sectorRefs.length-1:t.state.sectorToFocus%t.sectorRefs.length;t.sectorRefs[r].focus(),t.setState({sectorToFocus:r});break;case"Escape":t.sectorRefs[t.state.sectorToFocus].blur(),t.setState({sectorToFocus:0})}}}},{key:"renderSectors",value:function(){var e=this.props,t=e.sectors,n=e.isAnimationActive,r=this.state.prevSectors;return n&&t&&t.length&&(!r||!ep()(r,t))?this.renderSectorsWithAnimation():this.renderSectorsStatically(t)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var e=this,t=this.props,n=t.hide,r=t.sectors,o=t.className,i=t.label,a=t.cx,c=t.cy,s=t.innerRadius,u=t.outerRadius,p=t.isAnimationActive,f=this.state.isAnimationFinished;if(n||!r||!r.length||!(0,eb.hj)(a)||!(0,eb.hj)(c)||!(0,eb.hj)(s)||!(0,eb.hj)(u))return null;var d=(0,y.Z)("recharts-pie",o);return l.createElement(m.m,{tabIndex:this.props.rootTabIndex,className:d,ref:function(t){e.pieRef=t}},this.renderSectors(),i&&this.renderLabels(r),G._.renderCallByParent(this.props,null,!1),(!p||f)&&em.e.renderCallByParent(this.props,r,!1))}}],n=[{key:"getDerivedStateFromProps",value:function(e,t){return t.prevIsAnimationActive!==e.isAnimationActive?{prevIsAnimationActive:e.isAnimationActive,prevAnimationId:e.animationId,curSectors:e.sectors,prevSectors:[],isAnimationFinished:!0}:e.isAnimationActive&&e.animationId!==t.prevAnimationId?{prevAnimationId:e.animationId,curSectors:e.sectors,prevSectors:t.curSectors,isAnimationFinished:!0}:e.sectors!==t.curSectors?{curSectors:e.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(e,t){return e>t?"start":e=360?A:A-1)*u,x=a.reduce(function(e,t){var n=(0,eg.F$)(t,g,0);return e+((0,eb.hj)(n)?n:0)},0);return x>0&&(t=a.map(function(e,t){var r,o=(0,eg.F$)(e,g,0),i=(0,eg.F$)(e,f,t),a=((0,eb.hj)(o)?o:0)/x,s=(r=t?n.endAngle+(0,eb.uY)(h)*u*(0!==o?1:0):l)+(0,eb.uY)(h)*((0!==o?m:0)+a*O),p=(r+s)/2,d=(v.innerRadius+v.outerRadius)/2,b=[{name:i,value:o,payload:e,dataKey:g,type:y}],A=(0,T.op)(v.cx,v.cy,d,p);return n=eP(eP(eP({percent:a,cornerRadius:c,name:i,tooltipPayload:b,midAngle:p,middleRadius:d,tooltipPosition:A},e),v),{},{value:(0,eg.F$)(e,g),startAngle:r,endAngle:s,payload:e,paddingAngle:(0,eb.uY)(h)*u})})),eP(eP({},v),{},{sectors:t,data:a})});var eI=(0,p.z)({chartName:"PieChart",GraphicalChild:eN,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:M},{axisType:"radiusAxis",AxisComp:ea}],formatAxisMap:T.t9,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}}),eC=n(8147),eD=n(92666),eF=n(98593);let e_=e=>{let{active:t,payload:n,valueFormatter:r}=e;if(t&&(null==n?void 0:n[0])){let e=null==n?void 0:n[0];return l.createElement(eF.$B,null,l.createElement("div",{className:(0,a.q)("px-4 py-2")},l.createElement(eF.zX,{value:r(e.value),name:e.name,color:e.payload.color})))}return null},eZ=(e,t)=>e.map((e,n)=>{let r=ne||t((0,c.vP)(n.map(e=>e[r]))),eK=e=>{let{cx:t,cy:n,innerRadius:r,outerRadius:o,startAngle:i,endAngle:a,className:c}=e;return l.createElement("g",null,l.createElement(s.L,{cx:t,cy:n,innerRadius:r,outerRadius:o,startAngle:i,endAngle:a,className:c,fill:"",opacity:.3,style:{outline:"none"}}))},eM=l.forwardRef((e,t)=>{let{data:n=[],category:s="value",index:p="name",colors:f=i.s,variant:d="donut",valueFormatter:y=c.Cj,label:m,showLabel:v=!0,animationDuration:h=900,showAnimation:b=!1,showTooltip:g=!0,noDataText:A,onValueChange:O,customTooltip:x,className:k}=e,j=(0,r._T)(e,["data","category","index","colors","variant","valueFormatter","label","showLabel","animationDuration","showAnimation","showTooltip","noDataText","onValueChange","customTooltip","className"]),P="donut"==d,w=eB(m,y,n,s),[E,S]=l.useState(void 0),T=!!O;return(0,l.useEffect)(()=>{let e=document.querySelectorAll(".recharts-pie-sector");e&&e.forEach(e=>{e.setAttribute("style","outline: none")})},[E]),l.createElement("div",Object.assign({ref:t,className:(0,a.q)("w-full h-40",k)},j),l.createElement(u.h,{className:"h-full w-full"},(null==n?void 0:n.length)?l.createElement(eI,{onClick:T&&E?()=>{S(void 0),null==O||O(null)}:void 0,margin:{top:0,left:0,right:0,bottom:0}},v&&P?l.createElement("text",{className:(0,a.q)("fill-tremor-content-emphasis","dark:fill-dark-tremor-content-emphasis"),x:"50%",y:"50%",textAnchor:"middle",dominantBaseline:"middle"},w):null,l.createElement(eN,{className:(0,a.q)("stroke-tremor-background dark:stroke-dark-tremor-background",O?"cursor-pointer":"cursor-default"),data:eZ(n,f),cx:"50%",cy:"50%",startAngle:90,endAngle:-270,innerRadius:P?"75%":"0%",outerRadius:"100%",stroke:"",strokeLinejoin:"round",dataKey:s,nameKey:p,isAnimationActive:b,animationDuration:h,onClick:function(e,t,n){n.stopPropagation(),T&&(E===t?(S(void 0),null==O||O(null)):(S(t),null==O||O(Object.assign({eventType:"slice"},e.payload.payload))))},activeIndex:E,inactiveShape:eK,style:{outline:"none"}}),l.createElement(eC.u,{wrapperStyle:{outline:"none"},isAnimationActive:!1,content:g?e=>{var t;let{active:n,payload:r}=e;return x?l.createElement(x,{payload:null==r?void 0:r.map(e=>{var t,n,i;return Object.assign(Object.assign({},e),{color:null!==(i=null===(n=null===(t=null==r?void 0:r[0])||void 0===t?void 0:t.payload)||void 0===n?void 0:n.color)&&void 0!==i?i:o.fr.Gray})}),active:n,label:null===(t=null==r?void 0:r[0])||void 0===t?void 0:t.name}):l.createElement(e_,{active:n,payload:r,valueFormatter:y})}:l.createElement(l.Fragment,null)})):l.createElement(eD.Z,{noDataText:A})))});eM.displayName="DonutChart"},35802:function(e,t,n){var r=n(67646),o=n(58905),i=n(88157);e.exports=function(e,t){return e&&e.length?r(e,i(t,2),o):void 0}},37891:function(e,t,n){var r=n(67646),o=n(88157),i=n(20121);e.exports=function(e,t){return e&&e.length?r(e,o(t,2),i):void 0}},58710:function(e,t,n){"use strict";var r=n(2265);let o=r.forwardRef(function(e,t){return r.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),r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"}))});t.Z=o},92668:function(e,t,n){"use strict";n.d(t,{I:function(){return c}});var r=n(59121),o=n(31091),i=n(63497),a=n(99649);function c(e,t){let{years:n=0,months:c=0,weeks:l=0,days:s=0,hours:u=0,minutes:p=0,seconds:f=0}=t,d=(0,a.Q)(e),y=c||n?(0,o.z)(d,c+12*n):d,m=s||l?(0,r.E)(y,s+7*l):y;return(0,i.L)(e,m.getTime()+1e3*(f+60*(p+60*u)))}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/9111-54de5662a0888480.js b/litellm/proxy/_experimental/out/_next/static/chunks/9111-54de5662a0888480.js new file mode 100644 index 0000000000..e703cb7fb1 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/9111-54de5662a0888480.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9111],{89111:function(e,l,s){s.d(l,{Z:function(){return er}});var a=s(57437),t=s(78489),n=s(12514),i=s(67101),r=s(57365),c=s(59341),d=s(12485),o=s(18135),u=s(35242),m=s(29706),h=s(77991),g=s(21626),x=s(97214),f=s(28241),j=s(58834),b=s(69552),p=s(71876),y=s(84264),v=s(49566),k=s(2265),Z=s(57840),C=s(4260),_=s(37592),S=s(10032),w=s(22116),N=s(5545),E=s(9114),A=s(19250),O=s(23496),L=s(10353),T=s(61994);let{Title:F}=Z.default;var R=e=>{let{accessToken:l}=e,[s,i]=(0,k.useState)(!0),[r,c]=(0,k.useState)([]);(0,k.useEffect)(()=>{d()},[l]);let d=async()=>{if(l){i(!0);try{let e=await (0,A.getEmailEventSettings)(l);c(e.settings)}catch(e){console.error("Failed to fetch email event settings:",e),E.Z.fromBackend(e)}finally{i(!1)}}},o=(e,l)=>{c(r.map(s=>s.event===e?{...s,enabled:l}:s))},u=async()=>{if(l)try{await (0,A.updateEmailEventSettings)(l,{settings:r}),E.Z.success("Email event settings updated successfully")}catch(e){console.error("Failed to update email event settings:",e),E.Z.fromBackend(e)}},m=async()=>{if(l)try{await (0,A.resetEmailEventSettings)(l),E.Z.success("Email event settings reset to defaults"),d()}catch(e){console.error("Failed to reset email event settings:",e),E.Z.fromBackend(e)}},h=e=>{if(e.includes("Virtual Key Created"))return"An email will be sent to the user when a new virtual key is created with their user ID";if(e.includes("New User Invitation"))return"An email will be sent to the email address of the user when a new user is created";{let l=e.split(/(?=[A-Z])/).join(" ").toLowerCase();return"Receive an email notification when ".concat(l)}};return(0,a.jsxs)(n.Z,{children:[(0,a.jsx)(F,{level:4,children:"Email Notifications"}),(0,a.jsx)(y.Z,{children:"Select which events should trigger email notifications."}),(0,a.jsx)(O.Z,{}),s?(0,a.jsx)("div",{style:{textAlign:"center",padding:"20px"},children:(0,a.jsx)(L.Z,{size:"large"})}):(0,a.jsx)("div",{className:"space-y-4",children:r.map(e=>(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(T.Z,{checked:e.enabled,onChange:l=>o(e.event,l.target.checked)}),(0,a.jsxs)("div",{className:"ml-3",children:[(0,a.jsx)(y.Z,{children:e.event}),(0,a.jsx)("div",{className:"text-sm text-gray-500 block",children:h(e.event)})]})]},e.event))}),(0,a.jsxs)("div",{className:"mt-6 flex space-x-4",children:[(0,a.jsx)(t.Z,{onClick:u,disabled:s,children:"Save Changes"}),(0,a.jsx)(t.Z,{onClick:m,variant:"secondary",disabled:s,children:"Reset to Defaults"})]})]})};let{Title:P}=Z.default;var I=e=>{let{accessToken:l,premiumUser:s,alerts:r}=e,c=async()=>{if(!l)return;let e={};r.filter(e=>"email"===e.name).forEach(l=>{var s;Object.entries(null!==(s=l.variables)&&void 0!==s?s:{}).forEach(l=>{let[s,a]=l,t=document.querySelector('input[name="'.concat(s,'"]'));t&&t.value&&(e[s]=null==t?void 0:t.value)})}),console.log("updatedVariables",e);try{await (0,A.setCallbacksCall)(l,{general_settings:{alerting:["email"]},environment_variables:e}),E.Z.success("Email settings updated successfully")}catch(e){E.Z.fromBackend(e)}};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"mt-6 mb-6",children:(0,a.jsx)(R,{accessToken:l})}),(0,a.jsxs)(n.Z,{children:[(0,a.jsx)(P,{level:4,children:"Email Server Settings"}),(0,a.jsxs)(y.Z,{children:[(0,a.jsxs)("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:r.filter(e=>"email"===e.name).map((e,l)=>{var t;return(0,a.jsx)(f.Z,{children:(0,a.jsx)("ul",{children:(0,a.jsx)(i.Z,{numItems:2,children:Object.entries(null!==(t=e.variables)&&void 0!==t?t:{}).map(e=>{let[l,t]=e;return(0,a.jsxs)("li",{className:"mx-2 my-2",children:[!0!=s&&("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)(y.Z,{className:"mt-2",children:[" ✨ ",l]})}),(0,a.jsx)(v.Z,{name:l,defaultValue:t,type:"password",disabled:!0,style:{width:"400px"}})]}):(0,a.jsxs)("div",{children:[(0,a.jsx)(y.Z,{className:"mt-2",children:l}),(0,a.jsx)(v.Z,{name:l,defaultValue:t,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)(t.Z,{className:"mt-2",onClick:()=>c(),children:"Save Changes"}),(0,a.jsx)(t.Z,{onClick:async()=>{if(l)try{await (0,A.serviceHealthCheck)(l,"email"),E.Z.success("Email test triggered. Check your configured email inbox/logs.")}catch(e){E.Z.fromBackend(e)}},className:"mx-2",children:"Test Email Alerts"})]})]})},M=s(2740),U=s(19015),B=s(44643),D=s(74998),W=s(41649),q=s(47323),H=e=>{let{alertingSettings:l,handleInputChange:s,handleResetField:n,handleSubmit:i,premiumUser:r}=e,[d]=S.Z.useForm();return(0,a.jsxs)(S.Z,{form:d,onFinish:()=>{console.log("INSIDE ONFINISH");let e=d.getFieldsValue(),l=Object.entries(e).every(e=>{let[l,s]=e;return"boolean"!=typeof s&&(""===s||null==s)});console.log("formData: ".concat(JSON.stringify(e),", isEmpty: ").concat(l)),l?console.log("Some form fields are empty."):i(e)},labelAlign:"left",children:[l.map((e,l)=>(0,a.jsxs)(p.Z,{children:[(0,a.jsxs)(f.Z,{align:"center",children:[(0,a.jsx)(y.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)(f.Z,{children:"Integer"===e.field_type?(0,a.jsx)(U.Z,{step:1,value:e.field_value,onChange:l=>s(e.field_name,l)}):"Boolean"===e.field_type?(0,a.jsx)(c.Z,{checked:e.field_value,onChange:l=>s(e.field_name,l)}):(0,a.jsx)(C.default,{value:e.field_value,onChange:l=>s(e.field_name,l)})})}):(0,a.jsx)(f.Z,{children:(0,a.jsx)(t.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",valuePropName:"Boolean"===e.field_type?"checked":"value",children:(0,a.jsx)(f.Z,{children:"Integer"===e.field_type?(0,a.jsx)(U.Z,{step:1,value:e.field_value,onChange:l=>s(e.field_name,l),className:"p-0"}):"Boolean"===e.field_type?(0,a.jsx)(c.Z,{checked:e.field_value,onChange:l=>{s(e.field_name,l),d.setFieldsValue({[e.field_name]:l})}}):(0,a.jsx)(C.default,{value:e.field_value,onChange:l=>s(e.field_name,l)})})}),(0,a.jsx)(f.Z,{children:!0==e.stored_in_db?(0,a.jsx)(W.Z,{icon:B.Z,className:"text-white",children:"In DB"}):!1==e.stored_in_db?(0,a.jsx)(W.Z,{className:"text-gray bg-white outline",children:"In Config"}):(0,a.jsx)(W.Z,{className:"text-gray bg-white outline",children:"Not Set"})}),(0,a.jsx)(f.Z,{children:(0,a.jsx)(q.Z,{icon:D.Z,color:"red",onClick:()=>n(e.field_name,l),children:"Reset"})})]},l)),(0,a.jsx)("div",{children:(0,a.jsx)(N.ZP,{htmlType:"submit",children:"Update Settings"})})]})},z=e=>{let{accessToken:l,premiumUser:s}=e,[t,n]=(0,k.useState)([]);return(0,k.useEffect)(()=>{l&&(0,A.alertingSettingsCall)(l).then(e=>{n(e)})},[l]),(0,a.jsx)(H,{alertingSettings:t,handleInputChange:(e,l)=>{let s=t.map(s=>s.field_name===e?{...s,field_value:l}:s);console.log("updatedSettings: ".concat(JSON.stringify(s))),n(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);n(l)}catch(e){console.log("ERROR OCCURRED!")}},handleSubmit:e=>{if(!l||(console.log("formValues: ".concat(e)),null==e||void 0==e))return;let s={};t.forEach(e=>{s[e.field_name]=e.field_value});let a={...e,...s};console.log("mergedFormValues: ".concat(JSON.stringify(a)));let{slack_alerting:n,...i}=a;console.log("slack_alerting: ".concat(n,", alertingArgs: ").concat(JSON.stringify(i)));try{(0,A.updateConfigFieldSetting)(l,"alerting_args",i),"boolean"==typeof n&&(!0==n?(0,A.updateConfigFieldSetting)(l,"alerting",["slack"]):(0,A.updateConfigFieldSetting)(l,"alerting",[])),E.Z.success("Wait 10s for proxy to update.")}catch(e){}},premiumUser:s})},V=s(91126),J=s(53410),G=s(99981),K=s(56609),Q=s(6833);let X=[{value:"success",label:"Success"},{value:"failure",label:"Failure"},{value:"success_and_failure",label:"Success & Failure"}],Y=e=>{let{callbacks:l,availableCallbacks:s={},onTest:n=()=>{},onEdit:i=()=>{},onDelete:r=()=>{},onAdd:c=()=>{}}=e,d=[{title:(0,a.jsx)("span",{className:"font-medium text-gray-700",children:"Callback Name"}),dataIndex:"name",key:"name",render:(e,l)=>{var t;let n=l.name;console.log("availableCallbacks",s);let i=(null===(t=s[n])||void 0===t?void 0:t.ui_callback_name)||n;return(0,a.jsx)("div",{className:"font-medium text-gray-800",children:i})}},{title:(0,a.jsx)("span",{className:"font-medium text-gray-700",children:"Mode"}),key:"mode",render:(e,l)=>{var s;let t=l.mode||"success",n=(null===(s=X.find(e=>e.value===t))||void 0===s?void 0:s.label)||t,i="success"===t?"bg-green-100 text-green-800":"failure"===t?"bg-red-100 text-red-800":"bg-blue-100 text-blue-800";return(0,a.jsx)("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ".concat(i),children:n})},width:240},{title:(0,a.jsx)("span",{className:"font-medium text-gray-700 text-right w-full block",children:"Actions"}),key:"actions",align:"right",render:(e,l)=>(0,a.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,a.jsx)(G.Z,{title:"Test Callback",children:(0,a.jsx)(q.Z,{icon:V.Z,size:"sm",className:"cursor-pointer text-indigo-600 hover:text-indigo-700",onClick:()=>n(l)})}),(0,a.jsx)(G.Z,{title:"Edit Callback",children:(0,a.jsx)(q.Z,{icon:J.Z,size:"sm",className:"cursor-pointer text-indigo-600 hover:text-indigo-700",onClick:()=>i(l)})}),(0,a.jsx)(G.Z,{title:"Delete Callback",children:(0,a.jsx)(q.Z,{icon:D.Z,size:"sm",className:"cursor-pointer text-indigo-600 hover:text-red-600",onClick:()=>r(l)})})]}),width:240}];return(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)("div",{className:"w-full mt-4",children:[(0,a.jsx)(t.Z,{onClick:c,className:"mx-auto",children:"+ Add Callback"}),(0,a.jsx)("div",{className:"flex justify-between items-center my-2",children:(0,a.jsx)(Q.Z,{level:4,children:"Active Logging Callbacks"})}),0===l.length?(0,a.jsx)("div",{className:"flex flex-col items-center justify-center p-8 bg-gray-50 border border-gray-200 rounded-lg",children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("h3",{className:"text-lg font-medium text-gray-700 mb-2",children:"No callbacks configured"}),(0,a.jsx)("p",{className:"text-gray-500",children:"Add your first callback to start logging data to external services."})]})}):(0,a.jsx)("div",{className:"bg-white border border-gray-200 rounded-lg overflow-hidden",children:(0,a.jsx)(K.Z,{columns:d,dataSource:l,rowKey:e=>e.name,pagination:!1,rowClassName:()=>"hover:bg-gray-50"})})]})})};var $=s(85968),ee=s(21609);let{Title:el,Paragraph:es}=Z.default,ea=e=>{let{params:l,callbackConfigs:s,selectedCallback:t}=e;return l&&0!==l.length?(0,a.jsx)("div",{className:"space-y-4 mt-6 p-4 bg-gray-50 rounded-lg border",children:l.map(e=>{var l;let n=s.find(e=>e.id===t),i=(null==n?void 0:null===(l=n.dynamic_params)||void 0===l?void 0:l[e])||{},r=i.type||"text",c=i.ui_name||e.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()),d=i.required||!1;return(0,a.jsx)(M.Z,{label:(0,a.jsxs)("span",{className:"text-sm font-medium text-gray-700",children:[c," "]}),name:e,className:"mb-4",rules:d?[{required:!0,message:"Please enter the ".concat(c.toLowerCase())}]:void 0,children:"password"===r?(0,a.jsx)(C.default.Password,{size:"large",placeholder:"Enter your ".concat(c.toLowerCase()),className:"w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500"}):"number"===r?(0,a.jsx)(C.default,{type:"number",size:"large",placeholder:"Enter ".concat(c.toLowerCase()),className:"w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500",min:0,max:1,step:.1}):(0,a.jsx)(C.default,{size:"large",placeholder:"Enter your ".concat(c.toLowerCase()),className:"w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500"})},e)})}):null},et=e=>{let{callbackConfigs:l,selectedCallback:s,onCallbackChange:t,disabled:n=!1}=e;return(0,a.jsx)(M.Z,{label:"Callback",name:"callback",rules:n?void 0:[{required:!0,message:"Please select a callback"}],children:(0,a.jsx)(_.default,{placeholder:"Choose a logging callback...",size:"large",className:"w-full",showSearch:!0,disabled:n,value:s,filterOption:(e,l)=>{var s,a;return(null!==(a=null==l?void 0:null===(s=l.value)||void 0===s?void 0:s.toString())&&void 0!==a?a:"").toLowerCase().includes(e.toLowerCase())},onChange:t,children:l.map(e=>{let l=e.logo,s=l&&(l.includes("/")||l.startsWith("data:")||l.startsWith("http"))?l:"".concat("../ui/assets/logos/").concat(l);return(0,a.jsx)(r.Z,{value:e.id,children:(0,a.jsxs)("div",{className:"flex items-center space-x-3 py-1",children:[(0,a.jsx)("div",{className:"w-6 h-6 flex items-center justify-center",children:(0,a.jsx)("img",{src:s,alt:"".concat(e.displayName," logo"),className:"w-6 h-6 rounded object-contain",onError:e=>{e.currentTarget.style.display="none"}})}),(0,a.jsx)("span",{className:"font-medium text-gray-900",children:e.displayName})]})},e.id)})})})},en=(e,l,s)=>{if(!e)return s?Object.keys(s):[];let a=l.find(l=>l.id===e);return(null==a?void 0:a.dynamic_params)?Object.keys(a.dynamic_params):s?Object.keys(s):[]},ei=(e,l)=>({environment_variables:e,litellm_settings:{success_callback:[l]}});var er=e=>{let{accessToken:l,userRole:s,userID:r,premiumUser:Z}=e,[C,_]=(0,k.useState)([]),[O,L]=(0,k.useState)([]),[T,F]=(0,k.useState)(!1),[R]=S.Z.useForm(),[P]=S.Z.useForm(),[M,U]=(0,k.useState)(null),[B,D]=(0,k.useState)(""),[W,q]=(0,k.useState)({}),[H,V]=(0,k.useState)([]),[J,G]=(0,k.useState)(!1),[K,Q]=(0,k.useState)([]),[X,el]=(0,k.useState)({}),[es,er]=(0,k.useState)([]),[ec,ed]=(0,k.useState)(!1),[eo,eu]=(0,k.useState)(null),[em,eh]=(0,k.useState)(!1),[eg,ex]=(0,k.useState)(null),[ef,ej]=(0,k.useState)(!1),[eb,ep]=(0,k.useState)(!1),[ey,ev]=(0,k.useState)(!1);(0,k.useEffect)(()=>{l&&(0,A.getCallbackConfigsCall)(l).then(e=>{Q(e||[])}).catch(e=>{E.Z.fromBackend("Failed to load callback configs: "+(0,$.O)(e))})},[l]),(0,k.useEffect)(()=>{if(ec&&eo){let e=Object.fromEntries(Object.entries(eo.variables||{}).map(e=>{let[l,s]=e;return[l,null!=s?s:""]}));P.setFieldsValue({...e,callback:eo.name})}},[ec,eo,P]);let ek=e=>{H.includes(e)?V(H.filter(l=>l!==e)):V([...H,e])},eZ={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,k.useEffect)(()=>{l&&s&&r&&(0,A.getCallbacksCall)(l,r,s).then(e=>{_(e.callbacks),el(e.available_callbacks);let l=e.alerts;if(l&&l.length>0){let e=l[0],s=e.variables.SLACK_WEBHOOK_URL;V(e.active_alerts),D(s),q(e.alerts_to_webhook)}L(l)})},[l,s,r]);let eC=e=>H&&H.includes(e),e_=async(e,a,t)=>{if(!l)return;t?ej(!0):ep(!0);let n=ei(e,a);try{if(await (0,A.setCallbacksCall)(l,n),E.Z.success(t?"Callback updated successfully":"Callback ".concat(a," added successfully")),t?(ed(!1),P.resetFields(),eu(null)):(G(!1),R.resetFields(),U(null),er([])),r&&s){let e=await (0,A.getCallbacksCall)(l,r,s);_(e.callbacks)}}catch(e){E.Z.fromBackend(e)}finally{t?ej(!1):ep(!1)}},eS=async e=>{eo&&await e_(e,eo.name,!0)},ew=async e=>{let l=null==e?void 0:e.callback;l&&await e_(e,l,!1)},eN=async()=>{if(!l)return;let e={};Object.entries(eZ).forEach(l=>{let[s,a]=l,t=document.querySelector('input[name="'.concat(s,'"]')),n=(null==t?void 0:t.value)||"";e[s]=n});try{await (0,A.setCallbacksCall)(l,{general_settings:{alert_to_webhook_url:e,alert_types:H}})}catch(e){E.Z.fromBackend(e)}E.Z.success("Alerts updated successfully")},eE=e=>{ex(e),eh(!0)},eA=async()=>{if(eg&&l)try{if(ev(!0),await (0,A.deleteCallback)(l,eg.name),E.Z.success("Callback ".concat(eg.name," deleted successfully")),r&&s){let e=await (0,A.getCallbacksCall)(l,r,s);_(e.callbacks)}eh(!1),ex(null)}catch(e){console.error("Failed to delete callback:",e),E.Z.fromBackend(e)}finally{ev(!1)}};return l?(0,a.jsxs)("div",{className:"w-full mx-4",children:[(0,a.jsx)(i.Z,{numItems:1,className:"gap-2 p-8 w-full mt-2",children:(0,a.jsxs)(o.Z,{children:[(0,a.jsxs)(u.Z,{variant:"line",defaultValue:"1",children:[(0,a.jsx)(d.Z,{value:"1",children:"Logging Callbacks"}),(0,a.jsx)(d.Z,{value:"2",children:"Alerting Types"}),(0,a.jsx)(d.Z,{value:"3",children:"Alerting Settings"}),(0,a.jsx)(d.Z,{value:"4",children:"Email Alerts"})]}),(0,a.jsxs)(h.Z,{children:[(0,a.jsx)(m.Z,{children:(0,a.jsx)(Y,{callbacks:C,availableCallbacks:X,onAdd:()=>G(!0),onEdit:e=>{eu(e),ed(!0)},onDelete:e=>eE(e),onTest:async e=>{try{await (0,A.serviceHealthCheck)(l,e.name),E.Z.success("Health check triggered")}catch(e){E.Z.fromBackend((0,$.O)(e))}}})}),(0,a.jsx)(m.Z,{children:(0,a.jsxs)(n.Z,{children:[(0,a.jsxs)(y.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)(g.Z,{children:[(0,a.jsx)(j.Z,{children:(0,a.jsxs)(p.Z,{children:[(0,a.jsx)(b.Z,{}),(0,a.jsx)(b.Z,{}),(0,a.jsx)(b.Z,{children:"Slack Webhook URL"})]})}),(0,a.jsx)(x.Z,{children:Object.entries(eZ).map((e,l)=>{let[s,n]=e;return(0,a.jsxs)(p.Z,{children:[(0,a.jsx)(f.Z,{children:"region_outage_alerts"==s?Z?(0,a.jsx)(c.Z,{id:"switch",name:"switch",checked:eC(s),onChange:()=>ek(s)}):(0,a.jsx)(t.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)(c.Z,{id:"switch",name:"switch",checked:eC(s),onChange:()=>ek(s)})}),(0,a.jsx)(f.Z,{children:(0,a.jsx)(y.Z,{children:n})}),(0,a.jsx)(f.Z,{children:(0,a.jsx)(v.Z,{name:s,type:"password",defaultValue:W&&W[s]?W[s]:B})})]},l)})})]}),(0,a.jsx)(t.Z,{size:"xs",className:"mt-2",onClick:eN,children:"Save Changes"}),(0,a.jsx)(t.Z,{onClick:async()=>{try{await (0,A.serviceHealthCheck)(l,"slack"),E.Z.success("Alert test triggered. Test request to slack made - check logs/alerts on slack to verify")}catch(e){E.Z.fromBackend((0,$.O)(e))}},className:"mx-2",children:"Test Alerts"})]})}),(0,a.jsx)(m.Z,{children:(0,a.jsx)(z,{accessToken:l,premiumUser:Z})}),(0,a.jsx)(m.Z,{children:(0,a.jsx)(I,{accessToken:l,premiumUser:Z,alerts:O})})]})]})}),(0,a.jsxs)(w.Z,{title:"Add Logging Callback",open:J,width:800,onCancel:()=>{G(!1),U(null),er([])},footer:null,children:[(0,a.jsxs)("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.jsxs)(S.Z,{form:R,onFinish:ew,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsx)(et,{callbackConfigs:K,selectedCallback:M,onCallbackChange:e=>{U(e),er(en(e,K))}}),(0,a.jsx)(ea,{params:es,callbackConfigs:K,selectedCallback:M}),(0,a.jsxs)("div",{className:"flex justify-end space-x-3 pt-6 mt-6 border-t border-gray-200",children:[(0,a.jsx)(N.ZP,{onClick:()=>{G(!1),U(null),er([]),R.resetFields()},disabled:eb,children:"Cancel"}),(0,a.jsx)(N.ZP,{htmlType:"submit",loading:eb,disabled:eb,children:eb?"Adding...":"Add Callback"})]})]})]}),(0,a.jsx)(w.Z,{open:ec,width:800,title:"Edit Callback Settings",onCancel:()=>{ed(!1),eu(null),P.resetFields()},footer:null,children:(0,a.jsxs)(S.Z,{form:P,onFinish:eS,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[eo&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(et,{callbackConfigs:K,selectedCallback:eo.name,onCallbackChange:()=>{},disabled:!0}),(0,a.jsx)(ea,{params:en(eo.name,K,eo.variables),callbackConfigs:K,selectedCallback:eo.name})]}),(0,a.jsxs)("div",{className:"flex justify-end space-x-3 pt-6 mt-6 border-t border-gray-200",children:[(0,a.jsx)(N.ZP,{onClick:()=>{ed(!1),eu(null),P.resetFields()},disabled:ef,children:"Cancel"}),(0,a.jsx)(N.ZP,{onClick:()=>{P.submit()},loading:ef,disabled:ef,children:ef?"Saving...":"Save Changes"})]})]})}),(0,a.jsx)(ee.Z,{isOpen:em,title:"Delete Callback",message:"Are you sure you want to delete this callback? This action cannot be undone.",resourceInformationTitle:"Callback Information",resourceInformation:[{label:"Callback Name",value:null==eg?void 0:eg.name},{label:"Mode",value:(null==eg?void 0:eg.mode)||"success"}],onCancel:()=>{eh(!1),ex(null)},onOk:eA,confirmLoading:ey})]}):null}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/9111-e3a6b02449668174.js b/litellm/proxy/_experimental/out/_next/static/chunks/9111-e3a6b02449668174.js deleted file mode 100644 index fd5621d237..0000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/9111-e3a6b02449668174.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9111],{89111:function(e,l,s){s.d(l,{Z:function(){return er}});var a=s(57437),t=s(78489),n=s(12514),i=s(67101),r=s(57365),c=s(59341),d=s(12485),o=s(18135),u=s(35242),m=s(29706),h=s(77991),g=s(21626),x=s(97214),f=s(28241),j=s(58834),b=s(69552),p=s(71876),y=s(84264),v=s(49566),k=s(2265),Z=s(57840),C=s(4260),_=s(37592),S=s(10032),w=s(22116),N=s(5545),E=s(9114),A=s(19250),O=s(23496),L=s(10353),T=s(4156);let{Title:F}=Z.default;var R=e=>{let{accessToken:l}=e,[s,i]=(0,k.useState)(!0),[r,c]=(0,k.useState)([]);(0,k.useEffect)(()=>{d()},[l]);let d=async()=>{if(l){i(!0);try{let e=await (0,A.getEmailEventSettings)(l);c(e.settings)}catch(e){console.error("Failed to fetch email event settings:",e),E.Z.fromBackend(e)}finally{i(!1)}}},o=(e,l)=>{c(r.map(s=>s.event===e?{...s,enabled:l}:s))},u=async()=>{if(l)try{await (0,A.updateEmailEventSettings)(l,{settings:r}),E.Z.success("Email event settings updated successfully")}catch(e){console.error("Failed to update email event settings:",e),E.Z.fromBackend(e)}},m=async()=>{if(l)try{await (0,A.resetEmailEventSettings)(l),E.Z.success("Email event settings reset to defaults"),d()}catch(e){console.error("Failed to reset email event settings:",e),E.Z.fromBackend(e)}},h=e=>{if(e.includes("Virtual Key Created"))return"An email will be sent to the user when a new virtual key is created with their user ID";if(e.includes("New User Invitation"))return"An email will be sent to the email address of the user when a new user is created";{let l=e.split(/(?=[A-Z])/).join(" ").toLowerCase();return"Receive an email notification when ".concat(l)}};return(0,a.jsxs)(n.Z,{children:[(0,a.jsx)(F,{level:4,children:"Email Notifications"}),(0,a.jsx)(y.Z,{children:"Select which events should trigger email notifications."}),(0,a.jsx)(O.Z,{}),s?(0,a.jsx)("div",{style:{textAlign:"center",padding:"20px"},children:(0,a.jsx)(L.Z,{size:"large"})}):(0,a.jsx)("div",{className:"space-y-4",children:r.map(e=>(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(T.Z,{checked:e.enabled,onChange:l=>o(e.event,l.target.checked)}),(0,a.jsxs)("div",{className:"ml-3",children:[(0,a.jsx)(y.Z,{children:e.event}),(0,a.jsx)("div",{className:"text-sm text-gray-500 block",children:h(e.event)})]})]},e.event))}),(0,a.jsxs)("div",{className:"mt-6 flex space-x-4",children:[(0,a.jsx)(t.Z,{onClick:u,disabled:s,children:"Save Changes"}),(0,a.jsx)(t.Z,{onClick:m,variant:"secondary",disabled:s,children:"Reset to Defaults"})]})]})};let{Title:P}=Z.default;var I=e=>{let{accessToken:l,premiumUser:s,alerts:r}=e,c=async()=>{if(!l)return;let e={};r.filter(e=>"email"===e.name).forEach(l=>{var s;Object.entries(null!==(s=l.variables)&&void 0!==s?s:{}).forEach(l=>{let[s,a]=l,t=document.querySelector('input[name="'.concat(s,'"]'));t&&t.value&&(e[s]=null==t?void 0:t.value)})}),console.log("updatedVariables",e);try{await (0,A.setCallbacksCall)(l,{general_settings:{alerting:["email"]},environment_variables:e}),E.Z.success("Email settings updated successfully")}catch(e){E.Z.fromBackend(e)}};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"mt-6 mb-6",children:(0,a.jsx)(R,{accessToken:l})}),(0,a.jsxs)(n.Z,{children:[(0,a.jsx)(P,{level:4,children:"Email Server Settings"}),(0,a.jsxs)(y.Z,{children:[(0,a.jsxs)("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:r.filter(e=>"email"===e.name).map((e,l)=>{var t;return(0,a.jsx)(f.Z,{children:(0,a.jsx)("ul",{children:(0,a.jsx)(i.Z,{numItems:2,children:Object.entries(null!==(t=e.variables)&&void 0!==t?t:{}).map(e=>{let[l,t]=e;return(0,a.jsxs)("li",{className:"mx-2 my-2",children:[!0!=s&&("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)(y.Z,{className:"mt-2",children:[" ✨ ",l]})}),(0,a.jsx)(v.Z,{name:l,defaultValue:t,type:"password",disabled:!0,style:{width:"400px"}})]}):(0,a.jsxs)("div",{children:[(0,a.jsx)(y.Z,{className:"mt-2",children:l}),(0,a.jsx)(v.Z,{name:l,defaultValue:t,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)(t.Z,{className:"mt-2",onClick:()=>c(),children:"Save Changes"}),(0,a.jsx)(t.Z,{onClick:async()=>{if(l)try{await (0,A.serviceHealthCheck)(l,"email"),E.Z.success("Email test triggered. Check your configured email inbox/logs.")}catch(e){E.Z.fromBackend(e)}},className:"mx-2",children:"Test Email Alerts"})]})]})},M=s(2740),U=s(19015),B=s(44643),D=s(74998),W=s(41649),q=s(47323),H=e=>{let{alertingSettings:l,handleInputChange:s,handleResetField:n,handleSubmit:i,premiumUser:r}=e,[d]=S.Z.useForm();return(0,a.jsxs)(S.Z,{form:d,onFinish:()=>{console.log("INSIDE ONFINISH");let e=d.getFieldsValue(),l=Object.entries(e).every(e=>{let[l,s]=e;return"boolean"!=typeof s&&(""===s||null==s)});console.log("formData: ".concat(JSON.stringify(e),", isEmpty: ").concat(l)),l?console.log("Some form fields are empty."):i(e)},labelAlign:"left",children:[l.map((e,l)=>(0,a.jsxs)(p.Z,{children:[(0,a.jsxs)(f.Z,{align:"center",children:[(0,a.jsx)(y.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)(f.Z,{children:"Integer"===e.field_type?(0,a.jsx)(U.Z,{step:1,value:e.field_value,onChange:l=>s(e.field_name,l)}):"Boolean"===e.field_type?(0,a.jsx)(c.Z,{checked:e.field_value,onChange:l=>s(e.field_name,l)}):(0,a.jsx)(C.default,{value:e.field_value,onChange:l=>s(e.field_name,l)})})}):(0,a.jsx)(f.Z,{children:(0,a.jsx)(t.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",valuePropName:"Boolean"===e.field_type?"checked":"value",children:(0,a.jsx)(f.Z,{children:"Integer"===e.field_type?(0,a.jsx)(U.Z,{step:1,value:e.field_value,onChange:l=>s(e.field_name,l),className:"p-0"}):"Boolean"===e.field_type?(0,a.jsx)(c.Z,{checked:e.field_value,onChange:l=>{s(e.field_name,l),d.setFieldsValue({[e.field_name]:l})}}):(0,a.jsx)(C.default,{value:e.field_value,onChange:l=>s(e.field_name,l)})})}),(0,a.jsx)(f.Z,{children:!0==e.stored_in_db?(0,a.jsx)(W.Z,{icon:B.Z,className:"text-white",children:"In DB"}):!1==e.stored_in_db?(0,a.jsx)(W.Z,{className:"text-gray bg-white outline",children:"In Config"}):(0,a.jsx)(W.Z,{className:"text-gray bg-white outline",children:"Not Set"})}),(0,a.jsx)(f.Z,{children:(0,a.jsx)(q.Z,{icon:D.Z,color:"red",onClick:()=>n(e.field_name,l),children:"Reset"})})]},l)),(0,a.jsx)("div",{children:(0,a.jsx)(N.ZP,{htmlType:"submit",children:"Update Settings"})})]})},z=e=>{let{accessToken:l,premiumUser:s}=e,[t,n]=(0,k.useState)([]);return(0,k.useEffect)(()=>{l&&(0,A.alertingSettingsCall)(l).then(e=>{n(e)})},[l]),(0,a.jsx)(H,{alertingSettings:t,handleInputChange:(e,l)=>{let s=t.map(s=>s.field_name===e?{...s,field_value:l}:s);console.log("updatedSettings: ".concat(JSON.stringify(s))),n(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);n(l)}catch(e){console.log("ERROR OCCURRED!")}},handleSubmit:e=>{if(!l||(console.log("formValues: ".concat(e)),null==e||void 0==e))return;let s={};t.forEach(e=>{s[e.field_name]=e.field_value});let a={...e,...s};console.log("mergedFormValues: ".concat(JSON.stringify(a)));let{slack_alerting:n,...i}=a;console.log("slack_alerting: ".concat(n,", alertingArgs: ").concat(JSON.stringify(i)));try{(0,A.updateConfigFieldSetting)(l,"alerting_args",i),"boolean"==typeof n&&(!0==n?(0,A.updateConfigFieldSetting)(l,"alerting",["slack"]):(0,A.updateConfigFieldSetting)(l,"alerting",[])),E.Z.success("Wait 10s for proxy to update.")}catch(e){}},premiumUser:s})},V=s(91126),J=s(53410),G=s(99981),K=s(56609),Q=s(6833);let X=[{value:"success",label:"Success"},{value:"failure",label:"Failure"},{value:"success_and_failure",label:"Success & Failure"}],Y=e=>{let{callbacks:l,availableCallbacks:s={},onTest:n=()=>{},onEdit:i=()=>{},onDelete:r=()=>{},onAdd:c=()=>{}}=e,d=[{title:(0,a.jsx)("span",{className:"font-medium text-gray-700",children:"Callback Name"}),dataIndex:"name",key:"name",render:(e,l)=>{var t;let n=l.name;console.log("availableCallbacks",s);let i=(null===(t=s[n])||void 0===t?void 0:t.ui_callback_name)||n;return(0,a.jsx)("div",{className:"font-medium text-gray-800",children:i})}},{title:(0,a.jsx)("span",{className:"font-medium text-gray-700",children:"Mode"}),key:"mode",render:(e,l)=>{var s;let t=l.mode||"success",n=(null===(s=X.find(e=>e.value===t))||void 0===s?void 0:s.label)||t,i="success"===t?"bg-green-100 text-green-800":"failure"===t?"bg-red-100 text-red-800":"bg-blue-100 text-blue-800";return(0,a.jsx)("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ".concat(i),children:n})},width:240},{title:(0,a.jsx)("span",{className:"font-medium text-gray-700 text-right w-full block",children:"Actions"}),key:"actions",align:"right",render:(e,l)=>(0,a.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,a.jsx)(G.Z,{title:"Test Callback",children:(0,a.jsx)(q.Z,{icon:V.Z,size:"sm",className:"cursor-pointer text-indigo-600 hover:text-indigo-700",onClick:()=>n(l)})}),(0,a.jsx)(G.Z,{title:"Edit Callback",children:(0,a.jsx)(q.Z,{icon:J.Z,size:"sm",className:"cursor-pointer text-indigo-600 hover:text-indigo-700",onClick:()=>i(l)})}),(0,a.jsx)(G.Z,{title:"Delete Callback",children:(0,a.jsx)(q.Z,{icon:D.Z,size:"sm",className:"cursor-pointer text-indigo-600 hover:text-red-600",onClick:()=>r(l)})})]}),width:240}];return(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)("div",{className:"w-full mt-4",children:[(0,a.jsx)(t.Z,{onClick:c,className:"mx-auto",children:"+ Add Callback"}),(0,a.jsx)("div",{className:"flex justify-between items-center my-2",children:(0,a.jsx)(Q.Z,{level:4,children:"Active Logging Callbacks"})}),0===l.length?(0,a.jsx)("div",{className:"flex flex-col items-center justify-center p-8 bg-gray-50 border border-gray-200 rounded-lg",children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("h3",{className:"text-lg font-medium text-gray-700 mb-2",children:"No callbacks configured"}),(0,a.jsx)("p",{className:"text-gray-500",children:"Add your first callback to start logging data to external services."})]})}):(0,a.jsx)("div",{className:"bg-white border border-gray-200 rounded-lg overflow-hidden",children:(0,a.jsx)(K.Z,{columns:d,dataSource:l,rowKey:e=>e.name,pagination:!1,rowClassName:()=>"hover:bg-gray-50"})})]})})};var $=s(85968),ee=s(21609);let{Title:el,Paragraph:es}=Z.default,ea=e=>{let{params:l,callbackConfigs:s,selectedCallback:t}=e;return l&&0!==l.length?(0,a.jsx)("div",{className:"space-y-4 mt-6 p-4 bg-gray-50 rounded-lg border",children:l.map(e=>{var l;let n=s.find(e=>e.id===t),i=(null==n?void 0:null===(l=n.dynamic_params)||void 0===l?void 0:l[e])||{},r=i.type||"text",c=i.ui_name||e.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()),d=i.required||!1;return(0,a.jsx)(M.Z,{label:(0,a.jsxs)("span",{className:"text-sm font-medium text-gray-700",children:[c," "]}),name:e,className:"mb-4",rules:d?[{required:!0,message:"Please enter the ".concat(c.toLowerCase())}]:void 0,children:"password"===r?(0,a.jsx)(C.default.Password,{size:"large",placeholder:"Enter your ".concat(c.toLowerCase()),className:"w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500"}):"number"===r?(0,a.jsx)(C.default,{type:"number",size:"large",placeholder:"Enter ".concat(c.toLowerCase()),className:"w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500",min:0,max:1,step:.1}):(0,a.jsx)(C.default,{size:"large",placeholder:"Enter your ".concat(c.toLowerCase()),className:"w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500"})},e)})}):null},et=e=>{let{callbackConfigs:l,selectedCallback:s,onCallbackChange:t,disabled:n=!1}=e;return(0,a.jsx)(M.Z,{label:"Callback",name:"callback",rules:n?void 0:[{required:!0,message:"Please select a callback"}],children:(0,a.jsx)(_.default,{placeholder:"Choose a logging callback...",size:"large",className:"w-full",showSearch:!0,disabled:n,value:s,filterOption:(e,l)=>{var s,a;return(null!==(a=null==l?void 0:null===(s=l.value)||void 0===s?void 0:s.toString())&&void 0!==a?a:"").toLowerCase().includes(e.toLowerCase())},onChange:t,children:l.map(e=>{let l=e.logo,s=l&&(l.includes("/")||l.startsWith("data:")||l.startsWith("http"))?l:"".concat("../ui/assets/logos/").concat(l);return(0,a.jsx)(r.Z,{value:e.id,children:(0,a.jsxs)("div",{className:"flex items-center space-x-3 py-1",children:[(0,a.jsx)("div",{className:"w-6 h-6 flex items-center justify-center",children:(0,a.jsx)("img",{src:s,alt:"".concat(e.displayName," logo"),className:"w-6 h-6 rounded object-contain",onError:e=>{e.currentTarget.style.display="none"}})}),(0,a.jsx)("span",{className:"font-medium text-gray-900",children:e.displayName})]})},e.id)})})})},en=(e,l,s)=>{if(!e)return s?Object.keys(s):[];let a=l.find(l=>l.id===e);return(null==a?void 0:a.dynamic_params)?Object.keys(a.dynamic_params):s?Object.keys(s):[]},ei=(e,l)=>({environment_variables:e,litellm_settings:{success_callback:[l]}});var er=e=>{let{accessToken:l,userRole:s,userID:r,premiumUser:Z}=e,[C,_]=(0,k.useState)([]),[O,L]=(0,k.useState)([]),[T,F]=(0,k.useState)(!1),[R]=S.Z.useForm(),[P]=S.Z.useForm(),[M,U]=(0,k.useState)(null),[B,D]=(0,k.useState)(""),[W,q]=(0,k.useState)({}),[H,V]=(0,k.useState)([]),[J,G]=(0,k.useState)(!1),[K,Q]=(0,k.useState)([]),[X,el]=(0,k.useState)({}),[es,er]=(0,k.useState)([]),[ec,ed]=(0,k.useState)(!1),[eo,eu]=(0,k.useState)(null),[em,eh]=(0,k.useState)(!1),[eg,ex]=(0,k.useState)(null),[ef,ej]=(0,k.useState)(!1),[eb,ep]=(0,k.useState)(!1),[ey,ev]=(0,k.useState)(!1);(0,k.useEffect)(()=>{l&&(0,A.getCallbackConfigsCall)(l).then(e=>{Q(e||[])}).catch(e=>{E.Z.fromBackend("Failed to load callback configs: "+(0,$.O)(e))})},[l]),(0,k.useEffect)(()=>{if(ec&&eo){let e=Object.fromEntries(Object.entries(eo.variables||{}).map(e=>{let[l,s]=e;return[l,null!=s?s:""]}));P.setFieldsValue({...e,callback:eo.name})}},[ec,eo,P]);let ek=e=>{H.includes(e)?V(H.filter(l=>l!==e)):V([...H,e])},eZ={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,k.useEffect)(()=>{l&&s&&r&&(0,A.getCallbacksCall)(l,r,s).then(e=>{_(e.callbacks),el(e.available_callbacks);let l=e.alerts;if(l&&l.length>0){let e=l[0],s=e.variables.SLACK_WEBHOOK_URL;V(e.active_alerts),D(s),q(e.alerts_to_webhook)}L(l)})},[l,s,r]);let eC=e=>H&&H.includes(e),e_=async(e,a,t)=>{if(!l)return;t?ej(!0):ep(!0);let n=ei(e,a);try{if(await (0,A.setCallbacksCall)(l,n),E.Z.success(t?"Callback updated successfully":"Callback ".concat(a," added successfully")),t?(ed(!1),P.resetFields(),eu(null)):(G(!1),R.resetFields(),U(null),er([])),r&&s){let e=await (0,A.getCallbacksCall)(l,r,s);_(e.callbacks)}}catch(e){E.Z.fromBackend(e)}finally{t?ej(!1):ep(!1)}},eS=async e=>{eo&&await e_(e,eo.name,!0)},ew=async e=>{let l=null==e?void 0:e.callback;l&&await e_(e,l,!1)},eN=async()=>{if(!l)return;let e={};Object.entries(eZ).forEach(l=>{let[s,a]=l,t=document.querySelector('input[name="'.concat(s,'"]')),n=(null==t?void 0:t.value)||"";e[s]=n});try{await (0,A.setCallbacksCall)(l,{general_settings:{alert_to_webhook_url:e,alert_types:H}})}catch(e){E.Z.fromBackend(e)}E.Z.success("Alerts updated successfully")},eE=e=>{ex(e),eh(!0)},eA=async()=>{if(eg&&l)try{if(ev(!0),await (0,A.deleteCallback)(l,eg.name),E.Z.success("Callback ".concat(eg.name," deleted successfully")),r&&s){let e=await (0,A.getCallbacksCall)(l,r,s);_(e.callbacks)}eh(!1),ex(null)}catch(e){console.error("Failed to delete callback:",e),E.Z.fromBackend(e)}finally{ev(!1)}};return l?(0,a.jsxs)("div",{className:"w-full mx-4",children:[(0,a.jsx)(i.Z,{numItems:1,className:"gap-2 p-8 w-full mt-2",children:(0,a.jsxs)(o.Z,{children:[(0,a.jsxs)(u.Z,{variant:"line",defaultValue:"1",children:[(0,a.jsx)(d.Z,{value:"1",children:"Logging Callbacks"}),(0,a.jsx)(d.Z,{value:"2",children:"Alerting Types"}),(0,a.jsx)(d.Z,{value:"3",children:"Alerting Settings"}),(0,a.jsx)(d.Z,{value:"4",children:"Email Alerts"})]}),(0,a.jsxs)(h.Z,{children:[(0,a.jsx)(m.Z,{children:(0,a.jsx)(Y,{callbacks:C,availableCallbacks:X,onAdd:()=>G(!0),onEdit:e=>{eu(e),ed(!0)},onDelete:e=>eE(e),onTest:async e=>{try{await (0,A.serviceHealthCheck)(l,e.name),E.Z.success("Health check triggered")}catch(e){E.Z.fromBackend((0,$.O)(e))}}})}),(0,a.jsx)(m.Z,{children:(0,a.jsxs)(n.Z,{children:[(0,a.jsxs)(y.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)(g.Z,{children:[(0,a.jsx)(j.Z,{children:(0,a.jsxs)(p.Z,{children:[(0,a.jsx)(b.Z,{}),(0,a.jsx)(b.Z,{}),(0,a.jsx)(b.Z,{children:"Slack Webhook URL"})]})}),(0,a.jsx)(x.Z,{children:Object.entries(eZ).map((e,l)=>{let[s,n]=e;return(0,a.jsxs)(p.Z,{children:[(0,a.jsx)(f.Z,{children:"region_outage_alerts"==s?Z?(0,a.jsx)(c.Z,{id:"switch",name:"switch",checked:eC(s),onChange:()=>ek(s)}):(0,a.jsx)(t.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)(c.Z,{id:"switch",name:"switch",checked:eC(s),onChange:()=>ek(s)})}),(0,a.jsx)(f.Z,{children:(0,a.jsx)(y.Z,{children:n})}),(0,a.jsx)(f.Z,{children:(0,a.jsx)(v.Z,{name:s,type:"password",defaultValue:W&&W[s]?W[s]:B})})]},l)})})]}),(0,a.jsx)(t.Z,{size:"xs",className:"mt-2",onClick:eN,children:"Save Changes"}),(0,a.jsx)(t.Z,{onClick:async()=>{try{await (0,A.serviceHealthCheck)(l,"slack"),E.Z.success("Alert test triggered. Test request to slack made - check logs/alerts on slack to verify")}catch(e){E.Z.fromBackend((0,$.O)(e))}},className:"mx-2",children:"Test Alerts"})]})}),(0,a.jsx)(m.Z,{children:(0,a.jsx)(z,{accessToken:l,premiumUser:Z})}),(0,a.jsx)(m.Z,{children:(0,a.jsx)(I,{accessToken:l,premiumUser:Z,alerts:O})})]})]})}),(0,a.jsxs)(w.Z,{title:"Add Logging Callback",open:J,width:800,onCancel:()=>{G(!1),U(null),er([])},footer:null,children:[(0,a.jsxs)("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.jsxs)(S.Z,{form:R,onFinish:ew,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsx)(et,{callbackConfigs:K,selectedCallback:M,onCallbackChange:e=>{U(e),er(en(e,K))}}),(0,a.jsx)(ea,{params:es,callbackConfigs:K,selectedCallback:M}),(0,a.jsxs)("div",{className:"flex justify-end space-x-3 pt-6 mt-6 border-t border-gray-200",children:[(0,a.jsx)(N.ZP,{onClick:()=>{G(!1),U(null),er([]),R.resetFields()},disabled:eb,children:"Cancel"}),(0,a.jsx)(N.ZP,{htmlType:"submit",loading:eb,disabled:eb,children:eb?"Adding...":"Add Callback"})]})]})]}),(0,a.jsx)(w.Z,{open:ec,width:800,title:"Edit Callback Settings",onCancel:()=>{ed(!1),eu(null),P.resetFields()},footer:null,children:(0,a.jsxs)(S.Z,{form:P,onFinish:eS,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[eo&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(et,{callbackConfigs:K,selectedCallback:eo.name,onCallbackChange:()=>{},disabled:!0}),(0,a.jsx)(ea,{params:en(eo.name,K,eo.variables),callbackConfigs:K,selectedCallback:eo.name})]}),(0,a.jsxs)("div",{className:"flex justify-end space-x-3 pt-6 mt-6 border-t border-gray-200",children:[(0,a.jsx)(N.ZP,{onClick:()=>{ed(!1),eu(null),P.resetFields()},disabled:ef,children:"Cancel"}),(0,a.jsx)(N.ZP,{onClick:()=>{P.submit()},loading:ef,disabled:ef,children:ef?"Saving...":"Save Changes"})]})]})}),(0,a.jsx)(ee.Z,{isOpen:em,title:"Delete Callback",message:"Are you sure you want to delete this callback? This action cannot be undone.",resourceInformationTitle:"Callback Information",resourceInformation:[{label:"Callback Name",value:null==eg?void 0:eg.name},{label:"Mode",value:(null==eg?void 0:eg.mode)||"success"}],onCancel:()=>{eh(!1),ex(null)},onOk:eA,confirmLoading:ey})]}):null}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/9349-2a551af80b6b2fbc.js b/litellm/proxy/_experimental/out/_next/static/chunks/9349-61f99afd33bbc9e3.js similarity index 99% rename from litellm/proxy/_experimental/out/_next/static/chunks/9349-2a551af80b6b2fbc.js rename to litellm/proxy/_experimental/out/_next/static/chunks/9349-61f99afd33bbc9e3.js index 0314cdefa9..7b003917ce 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/9349-2a551af80b6b2fbc.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/9349-61f99afd33bbc9e3.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9349],{75105:function(e,t,n){n.d(t,{Z:function(){return ea}});var r=n(5853),a=n(2265),o=n(47625),i=n(93765),l=n(61994),s=n(84735),c=n(86757),u=n.n(c),d=n(95645),p=n.n(d),f=n(77571),m=n.n(f),h=n(82559),y=n.n(h),v=n(21652),b=n.n(v),g=n(57165),k=n(81889),x=n(9841),w=n(58772),A=n(34067),E=n(16630),O=n(85355),j=n(82944),P=["layout","type","stroke","connectNulls","isRange","ref"],L=["key"];function S(e){return(S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function C(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function D(){return(D=Object.assign?Object.assign.bind():function(e){for(var t=1;t0||!b()(l,r)||!b()(s,a))?this.renderAreaWithAnimation(e,t):this.renderAreaStatically(r,a,e,t)}},{key:"render",value:function(){var e,t=this.props,n=t.hide,r=t.dot,o=t.points,i=t.className,s=t.top,c=t.left,u=t.xAxis,d=t.yAxis,p=t.width,f=t.height,h=t.isAnimationActive,y=t.id;if(n||!o||!o.length)return null;var v=this.state.isAnimationFinished,b=1===o.length,g=(0,l.Z)("recharts-area",i),k=u&&u.allowDataOverflow,A=d&&d.allowDataOverflow,E=k||A,O=m()(y)?this.id:y,P=null!==(e=(0,j.L6)(r,!1))&&void 0!==e?e:{r:3,strokeWidth:2},L=P.r,S=P.strokeWidth,C=((0,j.jf)(r)?r:{}).clipDot,D=void 0===C||C,N=2*(void 0===L?3:L)+(void 0===S?2:S);return a.createElement(x.m,{className:g},k||A?a.createElement("defs",null,a.createElement("clipPath",{id:"clipPath-".concat(O)},a.createElement("rect",{x:k?c:c-p/2,y:A?s:s-f/2,width:k?p:2*p,height:A?f:2*f})),!D&&a.createElement("clipPath",{id:"clipPath-dots-".concat(O)},a.createElement("rect",{x:c-N/2,y:s-N/2,width:p+N,height:f+N}))):null,b?null:this.renderArea(E,O),(r||b)&&this.renderDots(E,D,O),(!h||v)&&w.e.renderCallByParent(this.props,o))}}],n=[{key:"getDerivedStateFromProps",value:function(e,t){return e.animationId!==t.prevAnimationId?{prevAnimationId:e.animationId,curPoints:e.points,curBaseLine:e.baseLine,prevPoints:t.curPoints,prevBaseLine:t.curBaseLine}:e.points!==t.curPoints||e.baseLine!==t.curBaseLine?{curPoints:e.points,curBaseLine:e.baseLine}:null}}],t&&T(r.prototype,t),n&&T(r,n),Object.defineProperty(r,"prototype",{writable:!1}),r}(a.PureComponent);R(I,"displayName","Area"),R(I,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!A.x.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"}),R(I,"getBaseValue",function(e,t,n,r){var a=e.layout,o=e.baseValue,i=t.props.baseValue,l=null!=i?i:o;if((0,E.hj)(l)&&"number"==typeof l)return l;var s="horizontal"===a?r:n,c=s.scale.domain();if("number"===s.type){var u=Math.max(c[0],c[1]),d=Math.min(c[0],c[1]);return"dataMin"===l?d:"dataMax"===l?u:u<0?u:Math.max(Math.min(c[0],c[1]),0)}return"dataMin"===l?c[0]:"dataMax"===l?c[1]:c[0]}),R(I,"getComposedData",function(e){var t,n=e.props,r=e.item,a=e.xAxis,o=e.yAxis,i=e.xAxisTicks,l=e.yAxisTicks,s=e.bandSize,c=e.dataKey,u=e.stackedData,d=e.dataStartIndex,p=e.displayedData,f=e.offset,m=n.layout,h=u&&u.length,y=I.getBaseValue(n,r,a,o),v="horizontal"===m,b=!1,g=p.map(function(e,t){h?n=u[d+t]:Array.isArray(n=(0,O.F$)(e,c))?b=!0:n=[y,n];var n,r=null==n[1]||h&&null==(0,O.F$)(e,c);return v?{x:(0,O.Hv)({axis:a,ticks:i,bandSize:s,entry:e,index:t}),y:r?null:o.scale(n[1]),value:n,payload:e}:{x:r?null:a.scale(n[1]),y:(0,O.Hv)({axis:o,ticks:l,bandSize:s,entry:e,index:t}),value:n,payload:e}});return t=h||b?g.map(function(e){var t=Array.isArray(e.value)?e.value[0]:null;return v?{x:e.x,y:null!=t&&null!=e.y?o.scale(t):null}:{x:null!=t?a.scale(t):null,y:e.y}}):v?o.scale(y):a.scale(y),M({points:g,baseLine:t,layout:m,isRange:b},f)}),R(I,"renderDotItem",function(e,t){var n;if(a.isValidElement(e))n=a.cloneElement(e,t);else if(u()(e))n=e(t);else{var r=(0,l.Z)("recharts-area-dot","boolean"!=typeof e?e.className:""),o=t.key,i=C(t,L);n=a.createElement(k.o,D({},i,{key:o,className:r}))}return n});var Z=n(97059),_=n(62994),V=n(25311),z=(0,i.z)({chartName:"AreaChart",GraphicalChild:I,axisComponents:[{axisType:"xAxis",AxisComp:Z.K},{axisType:"yAxis",AxisComp:_.B}],formatAxisMap:V.t9}),G=n(56940),H=n(26680),q=n(8147),$=n(22190),X=n(54061),U=n(65278),Y=n(98593),J=n(92666),Q=n(32644),ee=n(7084),et=n(26898),en=n(13241),er=n(1153);let ea=a.forwardRef((e,t)=>{let{data:n=[],categories:i=[],index:l,stack:s=!1,colors:c=et.s,valueFormatter:u=er.Cj,startEndOnly:d=!1,showXAxis:p=!0,showYAxis:f=!0,yAxisWidth:m=56,intervalType:h="equidistantPreserveStart",showAnimation:y=!1,animationDuration:v=900,showTooltip:b=!0,showLegend:g=!0,showGridLines:x=!0,showGradient:w=!0,autoMinValue:A=!1,curveType:E="linear",minValue:O,maxValue:j,connectNulls:P=!1,allowDecimals:L=!0,noDataText:S,className:C,onValueChange:D,enableLegendSlider:N=!1,customTooltip:M,rotateLabelX:T,padding:B=(p||f)&&(!d||f)?{left:20,right:20}:{left:0,right:0},tickGap:W=5,xAxisLabel:K,yAxisLabel:R}=e,F=(0,r._T)(e,["data","categories","index","stack","colors","valueFormatter","startEndOnly","showXAxis","showYAxis","yAxisWidth","intervalType","showAnimation","animationDuration","showTooltip","showLegend","showGridLines","showGradient","autoMinValue","curveType","minValue","maxValue","connectNulls","allowDecimals","noDataText","className","onValueChange","enableLegendSlider","customTooltip","rotateLabelX","padding","tickGap","xAxisLabel","yAxisLabel"]),[V,ea]=(0,a.useState)(60),[eo,ei]=(0,a.useState)(void 0),[el,es]=(0,a.useState)(void 0),ec=(0,Q.me)(i,c),eu=(0,Q.i4)(A,O,j),ed=!!D;function ep(e){ed&&(e===el&&!eo||(0,Q.FB)(n,e)&&eo&&eo.dataKey===e?(es(void 0),null==D||D(null)):(es(e),null==D||D({eventType:"category",categoryClicked:e})),ei(void 0))}return a.createElement("div",Object.assign({ref:t,className:(0,en.q)("w-full h-80",C)},F),a.createElement(o.h,{className:"h-full w-full"},(null==n?void 0:n.length)?a.createElement(z,{data:n,onClick:ed&&(el||eo)?()=>{ei(void 0),es(void 0),null==D||D(null)}:void 0,margin:{bottom:K?30:void 0,left:R?20:void 0,right:R?5:void 0,top:5}},x?a.createElement(G.q,{className:(0,en.q)("stroke-1","stroke-tremor-border","dark:stroke-dark-tremor-border"),horizontal:!0,vertical:!1}):null,a.createElement(Z.K,{padding:B,hide:!p,dataKey:l,tick:{transform:"translate(0, 6)"},ticks:d?[n[0][l],n[n.length-1][l]]:void 0,fill:"",stroke:"",className:(0,en.q)("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),interval:d?"preserveStartEnd":h,tickLine:!1,axisLine:!1,minTickGap:W,angle:null==T?void 0:T.angle,dy:null==T?void 0:T.verticalShift,height:null==T?void 0:T.xAxisHeight},K&&a.createElement(H._,{position:"insideBottom",offset:-20,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},K)),a.createElement(_.B,{width:m,hide:!f,axisLine:!1,tickLine:!1,type:"number",domain:eu,tick:{transform:"translate(-3, 0)"},fill:"",stroke:"",className:(0,en.q)("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),tickFormatter:u,allowDecimals:L},R&&a.createElement(H._,{position:"insideLeft",style:{textAnchor:"middle"},angle:-90,offset:-15,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},R)),a.createElement(q.u,{wrapperStyle:{outline:"none"},isAnimationActive:!1,cursor:{stroke:"#d1d5db",strokeWidth:1},content:b?e=>{let{active:t,payload:n,label:r}=e;return M?a.createElement(M,{payload:null==n?void 0:n.map(e=>{var t;return Object.assign(Object.assign({},e),{color:null!==(t=ec.get(e.dataKey))&&void 0!==t?t:ee.fr.Gray})}),active:t,label:r}):a.createElement(Y.ZP,{active:t,payload:n,label:r,valueFormatter:u,categoryColors:ec})}:a.createElement(a.Fragment,null),position:{y:0}}),g?a.createElement($.D,{verticalAlign:"top",height:V,content:e=>{let{payload:t}=e;return(0,U.Z)({payload:t},ec,ea,el,ed?e=>ep(e):void 0,N)}}):null,i.map(e=>{var t,n,r;let o=(null!==(t=ec.get(e))&&void 0!==t?t:ee.fr.Gray).replace("#","");return a.createElement("defs",{key:e},w?a.createElement("linearGradient",{className:(0,er.bM)(null!==(n=ec.get(e))&&void 0!==n?n:ee.fr.Gray,et.K.text).textColor,id:o,x1:"0",y1:"0",x2:"0",y2:"1"},a.createElement("stop",{offset:"5%",stopColor:"currentColor",stopOpacity:eo||el&&el!==e?.15:.4}),a.createElement("stop",{offset:"95%",stopColor:"currentColor",stopOpacity:0})):a.createElement("linearGradient",{className:(0,er.bM)(null!==(r=ec.get(e))&&void 0!==r?r:ee.fr.Gray,et.K.text).textColor,id:o,x1:"0",y1:"0",x2:"0",y2:"1"},a.createElement("stop",{stopColor:"currentColor",stopOpacity:eo||el&&el!==e?.1:.3})))}),i.map(e=>{var t,r;let o=(null!==(t=ec.get(e))&&void 0!==t?t:ee.fr.Gray).replace("#","");return a.createElement(I,{className:(0,er.bM)(null!==(r=ec.get(e))&&void 0!==r?r:ee.fr.Gray,et.K.text).strokeColor,strokeOpacity:eo||el&&el!==e?.3:1,activeDot:e=>{var t;let{cx:r,cy:o,stroke:i,strokeLinecap:l,strokeLinejoin:s,strokeWidth:c,dataKey:u}=e;return a.createElement(k.o,{className:(0,en.q)("stroke-tremor-background dark:stroke-dark-tremor-background",D?"cursor-pointer":"",(0,er.bM)(null!==(t=ec.get(u))&&void 0!==t?t:ee.fr.Gray,et.K.text).fillColor),cx:r,cy:o,r:5,fill:"",stroke:i,strokeLinecap:l,strokeLinejoin:s,strokeWidth:c,onClick:(t,r)=>{r.stopPropagation(),ed&&(e.index===(null==eo?void 0:eo.index)&&e.dataKey===(null==eo?void 0:eo.dataKey)||(0,Q.FB)(n,e.dataKey)&&el&&el===e.dataKey?(es(void 0),ei(void 0),null==D||D(null)):(es(e.dataKey),ei({index:e.index,dataKey:e.dataKey}),null==D||D(Object.assign({eventType:"dot",categoryClicked:e.dataKey},e.payload))))}})},dot:t=>{var r;let{stroke:o,strokeLinecap:i,strokeLinejoin:l,strokeWidth:s,cx:c,cy:u,dataKey:d,index:p}=t;return(0,Q.FB)(n,e)&&!(eo||el&&el!==e)||(null==eo?void 0:eo.index)===p&&(null==eo?void 0:eo.dataKey)===e?a.createElement(k.o,{key:p,cx:c,cy:u,r:5,stroke:o,fill:"",strokeLinecap:i,strokeLinejoin:l,strokeWidth:s,className:(0,en.q)("stroke-tremor-background dark:stroke-dark-tremor-background",D?"cursor-pointer":"",(0,er.bM)(null!==(r=ec.get(d))&&void 0!==r?r:ee.fr.Gray,et.K.text).fillColor)}):a.createElement(a.Fragment,{key:p})},key:e,name:e,type:E,dataKey:e,stroke:"",fill:"url(#".concat(o,")"),strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",isAnimationActive:y,animationDuration:v,stackId:s?"a":void 0,connectNulls:P})}),D?i.map(e=>a.createElement(X.x,{className:(0,en.q)("cursor-pointer"),strokeOpacity:0,key:e,name:e,type:E,dataKey:e,stroke:"transparent",fill:"transparent",legendType:"none",tooltipType:"none",strokeWidth:12,connectNulls:P,onClick:(e,t)=>{t.stopPropagation();let{name:n}=e;ep(n)}})):null):a.createElement(J.Z,{noDataText:S})))});ea.displayName="AreaChart"},32489:function(e,t,n){n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},54061:function(e,t,n){n.d(t,{x:function(){return W}});var r=n(2265),a=n(84735),o=n(86757),i=n.n(o),l=n(77571),s=n.n(l),c=n(21652),u=n.n(c),d=n(61994),p=n(57165),f=n(81889),m=n(9841),h=n(58772),y=n(13137),v=n(16630),b=n(82944),g=n(34067),k=n(85355),x=["type","layout","connectNulls","ref"],w=["key"];function A(e){return(A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function E(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function O(){return(O=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);ni){s=[].concat(L(r.slice(0,c)),[i-u]);break}var d=s.length%2==0?[0,l]:[l];return[].concat(L(o.repeat(r,Math.floor(t/a))),L(s),d).map(function(e){return"".concat(e,"px")}).join(", ")}),T(e,"id",(0,v.EL)("recharts-line-")),T(e,"pathRef",function(t){e.mainCurve=t}),T(e,"handleAnimationEnd",function(){e.setState({isAnimationFinished:!0}),e.props.onAnimationEnd&&e.props.onAnimationEnd()}),T(e,"handleAnimationStart",function(){e.setState({isAnimationFinished:!1}),e.props.onAnimationStart&&e.props.onAnimationStart()}),e}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&M(e,t)}(o,e),t=[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var e=this.getTotalLength();this.setState({totalLength:e})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var e=this.getTotalLength();e!==this.state.totalLength&&this.setState({totalLength:e})}}},{key:"getTotalLength",value:function(){var e=this.mainCurve;try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch(e){return 0}}},{key:"renderErrorBar",value:function(e,t){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var n=this.props,a=n.points,o=n.xAxis,i=n.yAxis,l=n.layout,s=n.children,c=(0,b.NN)(s,y.W);if(!c)return null;var u=function(e,t){return{x:e.x,y:e.y,value:e.value,errorVal:(0,k.F$)(e.payload,t)}};return r.createElement(m.m,{clipPath:e?"url(#clipPath-".concat(t,")"):null},c.map(function(e){return r.cloneElement(e,{key:"bar-".concat(e.props.dataKey),data:a,xAxis:o,yAxis:i,layout:l,dataPointFormatter:u})}))}},{key:"renderDots",value:function(e,t,n){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var a=this.props,i=a.dot,l=a.points,s=a.dataKey,c=(0,b.L6)(this.props,!1),u=(0,b.L6)(i,!0),d=l.map(function(e,t){var n=P(P(P({key:"dot-".concat(t),r:3},c),u),{},{index:t,cx:e.x,cy:e.y,value:e.value,dataKey:s,payload:e.payload,points:l});return o.renderDotItem(i,n)}),p={clipPath:e?"url(#clipPath-".concat(t?"":"dots-").concat(n,")"):null};return r.createElement(m.m,O({className:"recharts-line-dots",key:"dots"},p),d)}},{key:"renderCurveStatically",value:function(e,t,n,a){var o=this.props,i=o.type,l=o.layout,s=o.connectNulls,c=(o.ref,E(o,x)),u=P(P(P({},(0,b.L6)(c,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:t?"url(#clipPath-".concat(n,")"):null,points:e},a),{},{type:i,layout:l,connectNulls:s});return r.createElement(p.H,O({},u,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(e,t){var n=this,o=this.props,i=o.points,l=o.strokeDasharray,s=o.isAnimationActive,c=o.animationBegin,u=o.animationDuration,d=o.animationEasing,p=o.animationId,f=o.animateNewValues,m=o.width,h=o.height,y=this.state,b=y.prevPoints,g=y.totalLength;return r.createElement(a.ZP,{begin:c,duration:u,isActive:s,easing:d,from:{t:0},to:{t:1},key:"line-".concat(p),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(r){var a,o=r.t;if(b){var s=b.length/i.length,c=i.map(function(e,t){var n=Math.floor(t*s);if(b[n]){var r=b[n],a=(0,v.k4)(r.x,e.x),i=(0,v.k4)(r.y,e.y);return P(P({},e),{},{x:a(o),y:i(o)})}if(f){var l=(0,v.k4)(2*m,e.x),c=(0,v.k4)(h/2,e.y);return P(P({},e),{},{x:l(o),y:c(o)})}return P(P({},e),{},{x:e.x,y:e.y})});return n.renderCurveStatically(c,e,t)}var u=(0,v.k4)(0,g)(o);if(l){var d="".concat(l).split(/[,\s]+/gim).map(function(e){return parseFloat(e)});a=n.getStrokeDasharray(u,g,d)}else a=n.generateSimpleStrokeDasharray(g,u);return n.renderCurveStatically(i,e,t,{strokeDasharray:a})})}},{key:"renderCurve",value:function(e,t){var n=this.props,r=n.points,a=n.isAnimationActive,o=this.state,i=o.prevPoints,l=o.totalLength;return a&&r&&r.length&&(!i&&l>0||!u()(i,r))?this.renderCurveWithAnimation(e,t):this.renderCurveStatically(r,e,t)}},{key:"render",value:function(){var e,t=this.props,n=t.hide,a=t.dot,o=t.points,i=t.className,l=t.xAxis,c=t.yAxis,u=t.top,p=t.left,f=t.width,y=t.height,v=t.isAnimationActive,g=t.id;if(n||!o||!o.length)return null;var k=this.state.isAnimationFinished,x=1===o.length,w=(0,d.Z)("recharts-line",i),A=l&&l.allowDataOverflow,E=c&&c.allowDataOverflow,O=A||E,j=s()(g)?this.id:g,P=null!==(e=(0,b.L6)(a,!1))&&void 0!==e?e:{r:3,strokeWidth:2},L=P.r,S=P.strokeWidth,C=((0,b.jf)(a)?a:{}).clipDot,D=void 0===C||C,N=2*(void 0===L?3:L)+(void 0===S?2:S);return r.createElement(m.m,{className:w},A||E?r.createElement("defs",null,r.createElement("clipPath",{id:"clipPath-".concat(j)},r.createElement("rect",{x:A?p:p-f/2,y:E?u:u-y/2,width:A?f:2*f,height:E?y:2*y})),!D&&r.createElement("clipPath",{id:"clipPath-dots-".concat(j)},r.createElement("rect",{x:p-N/2,y:u-N/2,width:f+N,height:y+N}))):null,!x&&this.renderCurve(O,j),this.renderErrorBar(O,j),(x||a)&&this.renderDots(O,D,j),(!v||k)&&h.e.renderCallByParent(this.props,o))}}],n=[{key:"getDerivedStateFromProps",value:function(e,t){return e.animationId!==t.prevAnimationId?{prevAnimationId:e.animationId,curPoints:e.points,prevPoints:t.curPoints}:e.points!==t.curPoints?{curPoints:e.points}:null}},{key:"repeat",value:function(e,t){for(var n=e.length%2!=0?[].concat(L(e),[0]):e,r=[],a=0;a=0)continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function D(){return(D=Object.assign?Object.assign.bind():function(e){for(var t=1;t0||!b()(l,r)||!b()(s,a))?this.renderAreaWithAnimation(e,t):this.renderAreaStatically(r,a,e,t)}},{key:"render",value:function(){var e,t=this.props,n=t.hide,r=t.dot,o=t.points,i=t.className,s=t.top,c=t.left,u=t.xAxis,d=t.yAxis,p=t.width,f=t.height,h=t.isAnimationActive,y=t.id;if(n||!o||!o.length)return null;var v=this.state.isAnimationFinished,b=1===o.length,g=(0,l.Z)("recharts-area",i),k=u&&u.allowDataOverflow,A=d&&d.allowDataOverflow,E=k||A,O=m()(y)?this.id:y,P=null!==(e=(0,j.L6)(r,!1))&&void 0!==e?e:{r:3,strokeWidth:2},L=P.r,S=P.strokeWidth,C=((0,j.jf)(r)?r:{}).clipDot,D=void 0===C||C,N=2*(void 0===L?3:L)+(void 0===S?2:S);return a.createElement(x.m,{className:g},k||A?a.createElement("defs",null,a.createElement("clipPath",{id:"clipPath-".concat(O)},a.createElement("rect",{x:k?c:c-p/2,y:A?s:s-f/2,width:k?p:2*p,height:A?f:2*f})),!D&&a.createElement("clipPath",{id:"clipPath-dots-".concat(O)},a.createElement("rect",{x:c-N/2,y:s-N/2,width:p+N,height:f+N}))):null,b?null:this.renderArea(E,O),(r||b)&&this.renderDots(E,D,O),(!h||v)&&w.e.renderCallByParent(this.props,o))}}],n=[{key:"getDerivedStateFromProps",value:function(e,t){return e.animationId!==t.prevAnimationId?{prevAnimationId:e.animationId,curPoints:e.points,curBaseLine:e.baseLine,prevPoints:t.curPoints,prevBaseLine:t.curBaseLine}:e.points!==t.curPoints||e.baseLine!==t.curBaseLine?{curPoints:e.points,curBaseLine:e.baseLine}:null}}],t&&T(r.prototype,t),n&&T(r,n),Object.defineProperty(r,"prototype",{writable:!1}),r}(a.PureComponent);R(I,"displayName","Area"),R(I,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!A.x.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"}),R(I,"getBaseValue",function(e,t,n,r){var a=e.layout,o=e.baseValue,i=t.props.baseValue,l=null!=i?i:o;if((0,E.hj)(l)&&"number"==typeof l)return l;var s="horizontal"===a?r:n,c=s.scale.domain();if("number"===s.type){var u=Math.max(c[0],c[1]),d=Math.min(c[0],c[1]);return"dataMin"===l?d:"dataMax"===l?u:u<0?u:Math.max(Math.min(c[0],c[1]),0)}return"dataMin"===l?c[0]:"dataMax"===l?c[1]:c[0]}),R(I,"getComposedData",function(e){var t,n=e.props,r=e.item,a=e.xAxis,o=e.yAxis,i=e.xAxisTicks,l=e.yAxisTicks,s=e.bandSize,c=e.dataKey,u=e.stackedData,d=e.dataStartIndex,p=e.displayedData,f=e.offset,m=n.layout,h=u&&u.length,y=I.getBaseValue(n,r,a,o),v="horizontal"===m,b=!1,g=p.map(function(e,t){h?n=u[d+t]:Array.isArray(n=(0,O.F$)(e,c))?b=!0:n=[y,n];var n,r=null==n[1]||h&&null==(0,O.F$)(e,c);return v?{x:(0,O.Hv)({axis:a,ticks:i,bandSize:s,entry:e,index:t}),y:r?null:o.scale(n[1]),value:n,payload:e}:{x:r?null:a.scale(n[1]),y:(0,O.Hv)({axis:o,ticks:l,bandSize:s,entry:e,index:t}),value:n,payload:e}});return t=h||b?g.map(function(e){var t=Array.isArray(e.value)?e.value[0]:null;return v?{x:e.x,y:null!=t&&null!=e.y?o.scale(t):null}:{x:null!=t?a.scale(t):null,y:e.y}}):v?o.scale(y):a.scale(y),M({points:g,baseLine:t,layout:m,isRange:b},f)}),R(I,"renderDotItem",function(e,t){var n;if(a.isValidElement(e))n=a.cloneElement(e,t);else if(u()(e))n=e(t);else{var r=(0,l.Z)("recharts-area-dot","boolean"!=typeof e?e.className:""),o=t.key,i=C(t,L);n=a.createElement(k.o,D({},i,{key:o,className:r}))}return n});var Z=n(97059),_=n(62994),V=n(25311),z=(0,i.z)({chartName:"AreaChart",GraphicalChild:I,axisComponents:[{axisType:"xAxis",AxisComp:Z.K},{axisType:"yAxis",AxisComp:_.B}],formatAxisMap:V.t9}),G=n(56940),H=n(26680),q=n(8147),$=n(22190),X=n(54061),U=n(65278),Y=n(98593),J=n(92666),Q=n(32644),ee=n(7084),et=n(26898),en=n(13241),er=n(1153);let ea=a.forwardRef((e,t)=>{let{data:n=[],categories:i=[],index:l,stack:s=!1,colors:c=et.s,valueFormatter:u=er.Cj,startEndOnly:d=!1,showXAxis:p=!0,showYAxis:f=!0,yAxisWidth:m=56,intervalType:h="equidistantPreserveStart",showAnimation:y=!1,animationDuration:v=900,showTooltip:b=!0,showLegend:g=!0,showGridLines:x=!0,showGradient:w=!0,autoMinValue:A=!1,curveType:E="linear",minValue:O,maxValue:j,connectNulls:P=!1,allowDecimals:L=!0,noDataText:S,className:C,onValueChange:D,enableLegendSlider:N=!1,customTooltip:M,rotateLabelX:T,padding:B=(p||f)&&(!d||f)?{left:20,right:20}:{left:0,right:0},tickGap:W=5,xAxisLabel:K,yAxisLabel:R}=e,F=(0,r._T)(e,["data","categories","index","stack","colors","valueFormatter","startEndOnly","showXAxis","showYAxis","yAxisWidth","intervalType","showAnimation","animationDuration","showTooltip","showLegend","showGridLines","showGradient","autoMinValue","curveType","minValue","maxValue","connectNulls","allowDecimals","noDataText","className","onValueChange","enableLegendSlider","customTooltip","rotateLabelX","padding","tickGap","xAxisLabel","yAxisLabel"]),[V,ea]=(0,a.useState)(60),[eo,ei]=(0,a.useState)(void 0),[el,es]=(0,a.useState)(void 0),ec=(0,Q.me)(i,c),eu=(0,Q.i4)(A,O,j),ed=!!D;function ep(e){ed&&(e===el&&!eo||(0,Q.FB)(n,e)&&eo&&eo.dataKey===e?(es(void 0),null==D||D(null)):(es(e),null==D||D({eventType:"category",categoryClicked:e})),ei(void 0))}return a.createElement("div",Object.assign({ref:t,className:(0,en.q)("w-full h-80",C)},F),a.createElement(o.h,{className:"h-full w-full"},(null==n?void 0:n.length)?a.createElement(z,{data:n,onClick:ed&&(el||eo)?()=>{ei(void 0),es(void 0),null==D||D(null)}:void 0,margin:{bottom:K?30:void 0,left:R?20:void 0,right:R?5:void 0,top:5}},x?a.createElement(G.q,{className:(0,en.q)("stroke-1","stroke-tremor-border","dark:stroke-dark-tremor-border"),horizontal:!0,vertical:!1}):null,a.createElement(Z.K,{padding:B,hide:!p,dataKey:l,tick:{transform:"translate(0, 6)"},ticks:d?[n[0][l],n[n.length-1][l]]:void 0,fill:"",stroke:"",className:(0,en.q)("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),interval:d?"preserveStartEnd":h,tickLine:!1,axisLine:!1,minTickGap:W,angle:null==T?void 0:T.angle,dy:null==T?void 0:T.verticalShift,height:null==T?void 0:T.xAxisHeight},K&&a.createElement(H._,{position:"insideBottom",offset:-20,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},K)),a.createElement(_.B,{width:m,hide:!f,axisLine:!1,tickLine:!1,type:"number",domain:eu,tick:{transform:"translate(-3, 0)"},fill:"",stroke:"",className:(0,en.q)("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),tickFormatter:u,allowDecimals:L},R&&a.createElement(H._,{position:"insideLeft",style:{textAnchor:"middle"},angle:-90,offset:-15,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},R)),a.createElement(q.u,{wrapperStyle:{outline:"none"},isAnimationActive:!1,cursor:{stroke:"#d1d5db",strokeWidth:1},content:b?e=>{let{active:t,payload:n,label:r}=e;return M?a.createElement(M,{payload:null==n?void 0:n.map(e=>{var t;return Object.assign(Object.assign({},e),{color:null!==(t=ec.get(e.dataKey))&&void 0!==t?t:ee.fr.Gray})}),active:t,label:r}):a.createElement(Y.ZP,{active:t,payload:n,label:r,valueFormatter:u,categoryColors:ec})}:a.createElement(a.Fragment,null),position:{y:0}}),g?a.createElement($.D,{verticalAlign:"top",height:V,content:e=>{let{payload:t}=e;return(0,U.Z)({payload:t},ec,ea,el,ed?e=>ep(e):void 0,N)}}):null,i.map(e=>{var t,n,r;let o=(null!==(t=ec.get(e))&&void 0!==t?t:ee.fr.Gray).replace("#","");return a.createElement("defs",{key:e},w?a.createElement("linearGradient",{className:(0,er.bM)(null!==(n=ec.get(e))&&void 0!==n?n:ee.fr.Gray,et.K.text).textColor,id:o,x1:"0",y1:"0",x2:"0",y2:"1"},a.createElement("stop",{offset:"5%",stopColor:"currentColor",stopOpacity:eo||el&&el!==e?.15:.4}),a.createElement("stop",{offset:"95%",stopColor:"currentColor",stopOpacity:0})):a.createElement("linearGradient",{className:(0,er.bM)(null!==(r=ec.get(e))&&void 0!==r?r:ee.fr.Gray,et.K.text).textColor,id:o,x1:"0",y1:"0",x2:"0",y2:"1"},a.createElement("stop",{stopColor:"currentColor",stopOpacity:eo||el&&el!==e?.1:.3})))}),i.map(e=>{var t,r;let o=(null!==(t=ec.get(e))&&void 0!==t?t:ee.fr.Gray).replace("#","");return a.createElement(I,{className:(0,er.bM)(null!==(r=ec.get(e))&&void 0!==r?r:ee.fr.Gray,et.K.text).strokeColor,strokeOpacity:eo||el&&el!==e?.3:1,activeDot:e=>{var t;let{cx:r,cy:o,stroke:i,strokeLinecap:l,strokeLinejoin:s,strokeWidth:c,dataKey:u}=e;return a.createElement(k.o,{className:(0,en.q)("stroke-tremor-background dark:stroke-dark-tremor-background",D?"cursor-pointer":"",(0,er.bM)(null!==(t=ec.get(u))&&void 0!==t?t:ee.fr.Gray,et.K.text).fillColor),cx:r,cy:o,r:5,fill:"",stroke:i,strokeLinecap:l,strokeLinejoin:s,strokeWidth:c,onClick:(t,r)=>{r.stopPropagation(),ed&&(e.index===(null==eo?void 0:eo.index)&&e.dataKey===(null==eo?void 0:eo.dataKey)||(0,Q.FB)(n,e.dataKey)&&el&&el===e.dataKey?(es(void 0),ei(void 0),null==D||D(null)):(es(e.dataKey),ei({index:e.index,dataKey:e.dataKey}),null==D||D(Object.assign({eventType:"dot",categoryClicked:e.dataKey},e.payload))))}})},dot:t=>{var r;let{stroke:o,strokeLinecap:i,strokeLinejoin:l,strokeWidth:s,cx:c,cy:u,dataKey:d,index:p}=t;return(0,Q.FB)(n,e)&&!(eo||el&&el!==e)||(null==eo?void 0:eo.index)===p&&(null==eo?void 0:eo.dataKey)===e?a.createElement(k.o,{key:p,cx:c,cy:u,r:5,stroke:o,fill:"",strokeLinecap:i,strokeLinejoin:l,strokeWidth:s,className:(0,en.q)("stroke-tremor-background dark:stroke-dark-tremor-background",D?"cursor-pointer":"",(0,er.bM)(null!==(r=ec.get(d))&&void 0!==r?r:ee.fr.Gray,et.K.text).fillColor)}):a.createElement(a.Fragment,{key:p})},key:e,name:e,type:E,dataKey:e,stroke:"",fill:"url(#".concat(o,")"),strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",isAnimationActive:y,animationDuration:v,stackId:s?"a":void 0,connectNulls:P})}),D?i.map(e=>a.createElement(X.x,{className:(0,en.q)("cursor-pointer"),strokeOpacity:0,key:e,name:e,type:E,dataKey:e,stroke:"transparent",fill:"transparent",legendType:"none",tooltipType:"none",strokeWidth:12,connectNulls:P,onClick:(e,t)=>{t.stopPropagation();let{name:n}=e;ep(n)}})):null):a.createElement(J.Z,{noDataText:S})))});ea.displayName="AreaChart"},32489:function(e,t,n){n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},54061:function(e,t,n){n.d(t,{x:function(){return W}});var r=n(2265),a=n(84735),o=n(86757),i=n.n(o),l=n(77571),s=n.n(l),c=n(21652),u=n.n(c),d=n(87602),p=n(57165),f=n(81889),m=n(9841),h=n(58772),y=n(13137),v=n(16630),b=n(82944),g=n(34067),k=n(85355),x=["type","layout","connectNulls","ref"],w=["key"];function A(e){return(A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function E(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function O(){return(O=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);ni){s=[].concat(L(r.slice(0,c)),[i-u]);break}var d=s.length%2==0?[0,l]:[l];return[].concat(L(o.repeat(r,Math.floor(t/a))),L(s),d).map(function(e){return"".concat(e,"px")}).join(", ")}),T(e,"id",(0,v.EL)("recharts-line-")),T(e,"pathRef",function(t){e.mainCurve=t}),T(e,"handleAnimationEnd",function(){e.setState({isAnimationFinished:!0}),e.props.onAnimationEnd&&e.props.onAnimationEnd()}),T(e,"handleAnimationStart",function(){e.setState({isAnimationFinished:!1}),e.props.onAnimationStart&&e.props.onAnimationStart()}),e}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&M(e,t)}(o,e),t=[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var e=this.getTotalLength();this.setState({totalLength:e})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var e=this.getTotalLength();e!==this.state.totalLength&&this.setState({totalLength:e})}}},{key:"getTotalLength",value:function(){var e=this.mainCurve;try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch(e){return 0}}},{key:"renderErrorBar",value:function(e,t){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var n=this.props,a=n.points,o=n.xAxis,i=n.yAxis,l=n.layout,s=n.children,c=(0,b.NN)(s,y.W);if(!c)return null;var u=function(e,t){return{x:e.x,y:e.y,value:e.value,errorVal:(0,k.F$)(e.payload,t)}};return r.createElement(m.m,{clipPath:e?"url(#clipPath-".concat(t,")"):null},c.map(function(e){return r.cloneElement(e,{key:"bar-".concat(e.props.dataKey),data:a,xAxis:o,yAxis:i,layout:l,dataPointFormatter:u})}))}},{key:"renderDots",value:function(e,t,n){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var a=this.props,i=a.dot,l=a.points,s=a.dataKey,c=(0,b.L6)(this.props,!1),u=(0,b.L6)(i,!0),d=l.map(function(e,t){var n=P(P(P({key:"dot-".concat(t),r:3},c),u),{},{index:t,cx:e.x,cy:e.y,value:e.value,dataKey:s,payload:e.payload,points:l});return o.renderDotItem(i,n)}),p={clipPath:e?"url(#clipPath-".concat(t?"":"dots-").concat(n,")"):null};return r.createElement(m.m,O({className:"recharts-line-dots",key:"dots"},p),d)}},{key:"renderCurveStatically",value:function(e,t,n,a){var o=this.props,i=o.type,l=o.layout,s=o.connectNulls,c=(o.ref,E(o,x)),u=P(P(P({},(0,b.L6)(c,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:t?"url(#clipPath-".concat(n,")"):null,points:e},a),{},{type:i,layout:l,connectNulls:s});return r.createElement(p.H,O({},u,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(e,t){var n=this,o=this.props,i=o.points,l=o.strokeDasharray,s=o.isAnimationActive,c=o.animationBegin,u=o.animationDuration,d=o.animationEasing,p=o.animationId,f=o.animateNewValues,m=o.width,h=o.height,y=this.state,b=y.prevPoints,g=y.totalLength;return r.createElement(a.ZP,{begin:c,duration:u,isActive:s,easing:d,from:{t:0},to:{t:1},key:"line-".concat(p),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(r){var a,o=r.t;if(b){var s=b.length/i.length,c=i.map(function(e,t){var n=Math.floor(t*s);if(b[n]){var r=b[n],a=(0,v.k4)(r.x,e.x),i=(0,v.k4)(r.y,e.y);return P(P({},e),{},{x:a(o),y:i(o)})}if(f){var l=(0,v.k4)(2*m,e.x),c=(0,v.k4)(h/2,e.y);return P(P({},e),{},{x:l(o),y:c(o)})}return P(P({},e),{},{x:e.x,y:e.y})});return n.renderCurveStatically(c,e,t)}var u=(0,v.k4)(0,g)(o);if(l){var d="".concat(l).split(/[,\s]+/gim).map(function(e){return parseFloat(e)});a=n.getStrokeDasharray(u,g,d)}else a=n.generateSimpleStrokeDasharray(g,u);return n.renderCurveStatically(i,e,t,{strokeDasharray:a})})}},{key:"renderCurve",value:function(e,t){var n=this.props,r=n.points,a=n.isAnimationActive,o=this.state,i=o.prevPoints,l=o.totalLength;return a&&r&&r.length&&(!i&&l>0||!u()(i,r))?this.renderCurveWithAnimation(e,t):this.renderCurveStatically(r,e,t)}},{key:"render",value:function(){var e,t=this.props,n=t.hide,a=t.dot,o=t.points,i=t.className,l=t.xAxis,c=t.yAxis,u=t.top,p=t.left,f=t.width,y=t.height,v=t.isAnimationActive,g=t.id;if(n||!o||!o.length)return null;var k=this.state.isAnimationFinished,x=1===o.length,w=(0,d.Z)("recharts-line",i),A=l&&l.allowDataOverflow,E=c&&c.allowDataOverflow,O=A||E,j=s()(g)?this.id:g,P=null!==(e=(0,b.L6)(a,!1))&&void 0!==e?e:{r:3,strokeWidth:2},L=P.r,S=P.strokeWidth,C=((0,b.jf)(a)?a:{}).clipDot,D=void 0===C||C,N=2*(void 0===L?3:L)+(void 0===S?2:S);return r.createElement(m.m,{className:w},A||E?r.createElement("defs",null,r.createElement("clipPath",{id:"clipPath-".concat(j)},r.createElement("rect",{x:A?p:p-f/2,y:E?u:u-y/2,width:A?f:2*f,height:E?y:2*y})),!D&&r.createElement("clipPath",{id:"clipPath-dots-".concat(j)},r.createElement("rect",{x:p-N/2,y:u-N/2,width:f+N,height:y+N}))):null,!x&&this.renderCurve(O,j),this.renderErrorBar(O,j),(x||a)&&this.renderDots(O,D,j),(!v||k)&&h.e.renderCallByParent(this.props,o))}}],n=[{key:"getDerivedStateFromProps",value:function(e,t){return e.animationId!==t.prevAnimationId?{prevAnimationId:e.animationId,curPoints:e.points,prevPoints:t.curPoints}:e.points!==t.curPoints?{curPoints:e.points}:null}},{key:"repeat",value:function(e,t){for(var n=e.length%2!=0?[].concat(L(e),[0]):e,r=[],a=0;a=60&&240>=Math.round(e.h)?n?Math.round(e.h)-2*t:Math.round(e.h)+2*t:n?Math.round(e.h)+2*t:Math.round(e.h)-2*t)<0?r+=360:r>=360&&(r-=360),r}function i(e,t,n){var r;return 0===e.h&&0===e.s?e.s:((r=n?e.s-.16*t:4===t?e.s+.16:e.s+.05*t)>1&&(r=1),n&&5===t&&r>.1&&(r=.1),r<.06&&(r=.06),Math.round(100*r)/100)}function c(e,t,n){return Math.round(100*Math.max(0,Math.min(1,n?e.v+.05*t:e.v-.15*t)))/100}function l(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=[],l=new r.t(e),s=l.toHsv(),u=5;u>0;u-=1){var d=new r.t({h:a(s,u,!0),s:i(s,u,!0),v:c(s,u,!0)});n.push(d)}n.push(l);for(var f=1;f<=4;f+=1){var p=new r.t({h:a(s,f),s:i(s,f),v:c(s,f)});n.push(p)}return"dark"===t.theme?o.map(function(e){var o=e.index,a=e.amount;return new r.t(t.backgroundColor||"#141414").mix(n[o],a).toHexString()}):n.map(function(e){return e.toHexString()})}var s={red:"#F5222D",volcano:"#FA541C",orange:"#FA8C16",gold:"#FAAD14",yellow:"#FADB14",lime:"#A0D911",green:"#52C41A",cyan:"#13C2C2",blue:"#1677FF",geekblue:"#2F54EB",purple:"#722ED1",magenta:"#EB2F96",grey:"#666666"},u=["#fff1f0","#ffccc7","#ffa39e","#ff7875","#ff4d4f","#f5222d","#cf1322","#a8071a","#820014","#5c0011"];u.primary=u[5];var d=["#fff2e8","#ffd8bf","#ffbb96","#ff9c6e","#ff7a45","#fa541c","#d4380d","#ad2102","#871400","#610b00"];d.primary=d[5];var f=["#fff7e6","#ffe7ba","#ffd591","#ffc069","#ffa940","#fa8c16","#d46b08","#ad4e00","#873800","#612500"];f.primary=f[5];var p=["#fffbe6","#fff1b8","#ffe58f","#ffd666","#ffc53d","#faad14","#d48806","#ad6800","#874d00","#613400"];p.primary=p[5];var m=["#feffe6","#ffffb8","#fffb8f","#fff566","#ffec3d","#fadb14","#d4b106","#ad8b00","#876800","#614700"];m.primary=m[5];var g=["#fcffe6","#f4ffb8","#eaff8f","#d3f261","#bae637","#a0d911","#7cb305","#5b8c00","#3f6600","#254000"];g.primary=g[5];var v=["#f6ffed","#d9f7be","#b7eb8f","#95de64","#73d13d","#52c41a","#389e0d","#237804","#135200","#092b00"];v.primary=v[5];var h=["#e6fffb","#b5f5ec","#87e8de","#5cdbd3","#36cfc9","#13c2c2","#08979c","#006d75","#00474f","#002329"];h.primary=h[5];var b=["#e6f4ff","#bae0ff","#91caff","#69b1ff","#4096ff","#1677ff","#0958d9","#003eb3","#002c8c","#001d66"];b.primary=b[5];var y=["#f0f5ff","#d6e4ff","#adc6ff","#85a5ff","#597ef7","#2f54eb","#1d39c4","#10239e","#061178","#030852"];y.primary=y[5];var x=["#f9f0ff","#efdbff","#d3adf7","#b37feb","#9254de","#722ed1","#531dab","#391085","#22075e","#120338"];x.primary=x[5];var w=["#fff0f6","#ffd6e7","#ffadd2","#ff85c0","#f759ab","#eb2f96","#c41d7f","#9e1068","#780650","#520339"];w.primary=w[5];var E=["#a6a6a6","#999999","#8c8c8c","#808080","#737373","#666666","#404040","#1a1a1a","#000000","#000000"];E.primary=E[5];var C={red:u,volcano:d,orange:f,gold:p,yellow:m,lime:g,green:v,cyan:h,blue:b,geekblue:y,purple:x,magenta:w,grey:E},Z=["#2a1215","#431418","#58181c","#791a1f","#a61d24","#d32029","#e84749","#f37370","#f89f9a","#fac8c3"];Z.primary=Z[5];var S=["#2b1611","#441d12","#592716","#7c3118","#aa3e19","#d84a1b","#e87040","#f3956a","#f8b692","#fad4bc"];S.primary=S[5];var O=["#2b1d11","#442a11","#593815","#7c4a15","#aa6215","#d87a16","#e89a3c","#f3b765","#f8cf8d","#fae3b7"];O.primary=O[5];var k=["#2b2111","#443111","#594214","#7c5914","#aa7714","#d89614","#e8b339","#f3cc62","#f8df8b","#faedb5"];k.primary=k[5];var j=["#2b2611","#443b11","#595014","#7c6e14","#aa9514","#d8bd14","#e8d639","#f3ea62","#f8f48b","#fafab5"];j.primary=j[5];var I=["#1f2611","#2e3c10","#3e4f13","#536d13","#6f9412","#8bbb11","#a9d134","#c9e75d","#e4f88b","#f0fab5"];I.primary=I[5];var M=["#162312","#1d3712","#274916","#306317","#3c8618","#49aa19","#6abe39","#8fd460","#b2e58b","#d5f2bb"];M.primary=M[5];var R=["#112123","#113536","#144848","#146262","#138585","#13a8a8","#33bcb7","#58d1c9","#84e2d8","#b2f1e8"];R.primary=R[5];var N=["#111a2c","#112545","#15325b","#15417e","#1554ad","#1668dc","#3c89e8","#65a9f3","#8dc5f8","#b7dcfa"];N.primary=N[5];var P=["#131629","#161d40","#1c2755","#203175","#263ea0","#2b4acb","#5273e0","#7f9ef3","#a8c1f8","#d2e0fa"];P.primary=P[5];var F=["#1a1325","#24163a","#301c4d","#3e2069","#51258f","#642ab5","#854eca","#ab7ae0","#cda8f0","#ebd7fa"];F.primary=F[5];var T=["#291321","#40162f","#551c3b","#75204f","#a02669","#cb2b83","#e0529c","#f37fb7","#f8a8cc","#fad2e3"];T.primary=T[5];var A=["#151515","#1f1f1f","#2d2d2d","#393939","#494949","#5a5a5a","#6a6a6a","#7b7b7b","#888888","#969696"];A.primary=A[5]},71140:function(e,t,n){"use strict";n.d(t,{rb:function(){return N},IX:function(){return S}});var r=n(41154),o=n(26365),a=n(11993),i=n(31686),c=n(2265),l=n(93463),s=n(76405),u=n(25049),d=n(63496),f=n(41690),p=n(15900),m=(0,u.Z)(function e(){(0,s.Z)(this,e)}),g="CALC_UNIT",v=RegExp(g,"g");function h(e){return"number"==typeof e?"".concat(e).concat(g):e}var b=function(e){(0,f.Z)(n,e);var t=(0,p.Z)(n);function n(e,o){(0,s.Z)(this,n),i=t.call(this),(0,a.Z)((0,d.Z)(i),"result",""),(0,a.Z)((0,d.Z)(i),"unitlessCssVar",void 0),(0,a.Z)((0,d.Z)(i),"lowPriority",void 0);var i,c=(0,r.Z)(e);return i.unitlessCssVar=o,e instanceof n?i.result="(".concat(e.result,")"):"number"===c?i.result=h(e):"string"===c&&(i.result=e),i}return(0,u.Z)(n,[{key:"add",value:function(e){return e instanceof n?this.result="".concat(this.result," + ").concat(e.getResult()):("number"==typeof e||"string"==typeof e)&&(this.result="".concat(this.result," + ").concat(h(e))),this.lowPriority=!0,this}},{key:"sub",value:function(e){return e instanceof n?this.result="".concat(this.result," - ").concat(e.getResult()):("number"==typeof e||"string"==typeof e)&&(this.result="".concat(this.result," - ").concat(h(e))),this.lowPriority=!0,this}},{key:"mul",value:function(e){return this.lowPriority&&(this.result="(".concat(this.result,")")),e instanceof n?this.result="".concat(this.result," * ").concat(e.getResult(!0)):("number"==typeof e||"string"==typeof e)&&(this.result="".concat(this.result," * ").concat(e)),this.lowPriority=!1,this}},{key:"div",value:function(e){return this.lowPriority&&(this.result="(".concat(this.result,")")),e instanceof n?this.result="".concat(this.result," / ").concat(e.getResult(!0)):("number"==typeof e||"string"==typeof e)&&(this.result="".concat(this.result," / ").concat(e)),this.lowPriority=!1,this}},{key:"getResult",value:function(e){return this.lowPriority||e?"(".concat(this.result,")"):this.result}},{key:"equal",value:function(e){var t=this,n=(e||{}).unit,r=!0;return("boolean"==typeof n?r=n:Array.from(this.unitlessCssVar).some(function(e){return t.result.includes(e)})&&(r=!1),this.result=this.result.replace(v,r?"px":""),void 0!==this.lowPriority)?"calc(".concat(this.result,")"):this.result}}]),n}(m),y=function(e){(0,f.Z)(n,e);var t=(0,p.Z)(n);function n(e){var r;return(0,s.Z)(this,n),r=t.call(this),(0,a.Z)((0,d.Z)(r),"result",0),e instanceof n?r.result=e.result:"number"==typeof e&&(r.result=e),r}return(0,u.Z)(n,[{key:"add",value:function(e){return e instanceof n?this.result+=e.result:"number"==typeof e&&(this.result+=e),this}},{key:"sub",value:function(e){return e instanceof n?this.result-=e.result:"number"==typeof e&&(this.result-=e),this}},{key:"mul",value:function(e){return e instanceof n?this.result*=e.result:"number"==typeof e&&(this.result*=e),this}},{key:"div",value:function(e){return e instanceof n?this.result/=e.result:"number"==typeof e&&(this.result/=e),this}},{key:"equal",value:function(){return this.result}}]),n}(m),x=function(e,t){var n="css"===e?b:y;return function(e){return new n(e,t)}},w=function(e,t){return"".concat([t,e.replace(/([A-Z]+)([A-Z][a-z]+)/g,"$1-$2").replace(/([a-z])([A-Z])/g,"$1-$2")].filter(Boolean).join("-"))};n(74126);var E=function(e,t,n,r){var a=(0,i.Z)({},t[e]);null!=r&&r.deprecatedTokens&&r.deprecatedTokens.forEach(function(e){var t,n=(0,o.Z)(e,2),r=n[0],i=n[1];(null!=a&&a[r]||null!=a&&a[i])&&(null!==(t=a[i])&&void 0!==t||(a[i]=null==a?void 0:a[r]))});var c=(0,i.Z)((0,i.Z)({},n),a);return Object.keys(c).forEach(function(e){c[e]===t[e]&&delete c[e]}),c},C="undefined"!=typeof CSSINJS_STATISTIC,Z=!0;function S(){for(var e=arguments.length,t=Array(e),n=0;n1e4){var t=Date.now();this.lastAccessBeat.forEach(function(n,r){t-n>6e5&&(e.map.delete(r),e.lastAccessBeat.delete(r))}),this.accessBeat=0}}}]),e}()),R=function(){return{}},N=function(e){var t=e.useCSP,n=void 0===t?R:t,s=e.useToken,u=e.usePrefix,d=e.getResetStyles,f=e.getCommonStyle,p=e.getCompUnitless;function m(t,a,p){var m=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},g=Array.isArray(t)?t:[t,t],v=(0,o.Z)(g,1)[0],h=g.join("-"),b=e.layer||{name:"antd"};return function(e){var t,o,g=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,y=s(),C=y.theme,Z=y.realToken,O=y.hashId,k=y.token,R=y.cssVar,N=u(),P=N.rootPrefixCls,F=N.iconPrefixCls,T=n(),A=R?"css":"js",_=(t=function(){var e=new Set;return R&&Object.keys(m.unitless||{}).forEach(function(t){e.add((0,l.ks)(t,R.prefix)),e.add((0,l.ks)(t,w(v,R.prefix)))}),x(A,e)},o=[A,v,null==R?void 0:R.prefix],c.useMemo(function(){var e=M.get(o);if(e)return e;var n=t();return M.set(o,n),n},o)),B="js"===A?{max:Math.max,min:Math.min}:{max:function(){for(var e=arguments.length,t=Array(e),n=0;n1&&void 0!==arguments[1]?arguments[1]:e,n=S(e,t),r=(0,o.Z)(n,2)[1],a=O(t),i=(0,o.Z)(a,2);return[i[0],r,i[1]]}},genSubStyleComponent:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=m(e,t,n,(0,i.Z)({resetStyle:!1,order:-998},r));return function(e){var t=e.prefixCls,n=e.rootCls,r=void 0===n?t:n;return o(t,r),null}},genComponentStyleHook:m}}},93463:function(e,t,n){"use strict";n.d(t,{E4:function(){return eF},uP:function(){return y},jG:function(){return k},ks:function(){return A},bf:function(){return F},CI:function(){return eP},fp:function(){return G},xy:function(){return eR}});var r,o=n(11993),a=n(26365),i=n(83145),c=n(31686),l=function(e){for(var t,n=0,r=0,o=e.length;o>=4;++r,o-=4)t=(65535&(t=255&e.charCodeAt(r)|(255&e.charCodeAt(++r))<<8|(255&e.charCodeAt(++r))<<16|(255&e.charCodeAt(++r))<<24))*1540483477+((t>>>16)*59797<<16),t^=t>>>24,n=(65535&t)*1540483477+((t>>>16)*59797<<16)^(65535&n)*1540483477+((n>>>16)*59797<<16);switch(o){case 3:n^=(255&e.charCodeAt(r+2))<<16;case 2:n^=(255&e.charCodeAt(r+1))<<8;case 1:n^=255&e.charCodeAt(r),n=(65535&n)*1540483477+((n>>>16)*59797<<16)}return n^=n>>>13,(((n=(65535&n)*1540483477+((n>>>16)*59797<<16))^n>>>15)>>>0).toString(36)},s=n(21717),u=n(2265),d=n.t(u,2);n(6397),n(16671);var f=n(76405),p=n(25049);function m(e){return e.join("%")}var g=function(){function e(t){(0,f.Z)(this,e),(0,o.Z)(this,"instanceId",void 0),(0,o.Z)(this,"cache",new Map),(0,o.Z)(this,"extracted",new Set),this.instanceId=t}return(0,p.Z)(e,[{key:"get",value:function(e){return this.opGet(m(e))}},{key:"opGet",value:function(e){return this.cache.get(e)||null}},{key:"update",value:function(e,t){return this.opUpdate(m(e),t)}},{key:"opUpdate",value:function(e,t){var n=t(this.cache.get(e));null===n?this.cache.delete(e):this.cache.set(e,n)}}]),e}(),v="data-token-hash",h="data-css-hash",b="__cssinjs_instance__",y=u.createContext({hashPriority:"low",cache:function(){var e=Math.random().toString(12).slice(2);if("undefined"!=typeof document&&document.head&&document.body){var t=document.body.querySelectorAll("style[".concat(h,"]"))||[],n=document.head.firstChild;Array.from(t).forEach(function(t){t[b]=t[b]||e,t[b]===e&&document.head.insertBefore(t,n)});var r={};Array.from(document.querySelectorAll("style[".concat(h,"]"))).forEach(function(t){var n,o=t.getAttribute(h);r[o]?t[b]===e&&(null===(n=t.parentNode)||void 0===n||n.removeChild(t)):r[o]=!0})}return new g(e)}(),defaultCache:!0}),x=n(41154),w=n(94981),E=function(){function e(){(0,f.Z)(this,e),(0,o.Z)(this,"cache",void 0),(0,o.Z)(this,"keys",void 0),(0,o.Z)(this,"cacheCallTimes",void 0),this.cache=new Map,this.keys=[],this.cacheCallTimes=0}return(0,p.Z)(e,[{key:"size",value:function(){return this.keys.length}},{key:"internalGet",value:function(e){var t,n,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o={map:this.cache};return e.forEach(function(e){if(o){var t;o=null===(t=o)||void 0===t||null===(t=t.map)||void 0===t?void 0:t.get(e)}else o=void 0}),null!==(t=o)&&void 0!==t&&t.value&&r&&(o.value[1]=this.cacheCallTimes++),null===(n=o)||void 0===n?void 0:n.value}},{key:"get",value:function(e){var t;return null===(t=this.internalGet(e,!0))||void 0===t?void 0:t[0]}},{key:"has",value:function(e){return!!this.internalGet(e)}},{key:"set",value:function(t,n){var r=this;if(!this.has(t)){if(this.size()+1>e.MAX_CACHE_SIZE+e.MAX_CACHE_OFFSET){var o=this.keys.reduce(function(e,t){var n=(0,a.Z)(e,2)[1];return r.internalGet(t)[1]0,"[Ant Design CSS-in-JS] Theme should have at least one derivative function."),Z+=1}return(0,p.Z)(e,[{key:"getDerivativeToken",value:function(e){return this.derivatives.reduce(function(t,n){return n(e,t)},void 0)}}]),e}(),O=new E;function k(e){var t=Array.isArray(e)?e:[e];return O.has(t)||O.set(t,new S(t)),O.get(t)}var j=new WeakMap,I={},M=new WeakMap;function R(e){var t=M.get(e)||"";return t||(Object.keys(e).forEach(function(n){var r=e[n];t+=n,r instanceof S?t+=r.id:r&&"object"===(0,x.Z)(r)?t+=R(r):t+=r}),t=l(t),M.set(e,t)),t}function N(e,t){return l("".concat(t,"_").concat(R(e)))}"random-".concat(Date.now(),"-").concat(Math.random()).replace(/\./g,"");var P=(0,w.Z)();function F(e){return"number"==typeof e?"".concat(e,"px"):e}function T(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(a)return e;var i=(0,c.Z)((0,c.Z)({},r),{},(0,o.Z)((0,o.Z)({},v,t),h,n)),l=Object.keys(i).map(function(e){var t=i[e];return t?"".concat(e,'="').concat(t,'"'):null}).filter(function(e){return e}).join(" ");return"")}var A=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return"--".concat(t?"".concat(t,"-"):"").concat(e).replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z0-9]+)/g,"$1-$2").replace(/([a-z])([A-Z0-9])/g,"$1-$2").toLowerCase()},_=function(e,t,n){var r,o={},i={};return Object.entries(e).forEach(function(e){var t=(0,a.Z)(e,2),r=t[0],c=t[1];if(null!=n&&null!==(l=n.preserve)&&void 0!==l&&l[r])i[r]=c;else if(("string"==typeof c||"number"==typeof c)&&!(null!=n&&null!==(s=n.ignore)&&void 0!==s&&s[r])){var l,s,u,d=A(r,null==n?void 0:n.prefix);o[d]="number"!=typeof c||null!=n&&null!==(u=n.unitless)&&void 0!==u&&u[r]?String(c):"".concat(c,"px"),i[r]="var(".concat(d,")")}}),[i,(r={scope:null==n?void 0:n.scope},Object.keys(o).length?".".concat(t).concat(null!=r&&r.scope?".".concat(r.scope):"","{").concat(Object.entries(o).map(function(e){var t=(0,a.Z)(e,2),n=t[0],r=t[1];return"".concat(n,":").concat(r,";")}).join(""),"}"):"")]},B=n(27380),H=(0,c.Z)({},d).useInsertionEffect,z=H?function(e,t,n){return H(function(){return e(),t()},n)}:function(e,t,n){u.useMemo(e,n),(0,B.Z)(function(){return t(!0)},n)},L=void 0!==(0,c.Z)({},d).useInsertionEffect?function(e){var t=[],n=!1;return u.useEffect(function(){return n=!1,function(){n=!0,t.length&&t.forEach(function(e){return e()})}},e),function(e){n||t.push(e)}}:function(){return function(e){e()}};function D(e,t,n,r,o){var c=u.useContext(y).cache,l=m([e].concat((0,i.Z)(t))),s=L([l]),d=function(e){c.opUpdate(l,function(t){var r=(0,a.Z)(t||[void 0,void 0],2),o=r[0],i=[void 0===o?0:o,r[1]||n()];return e?e(i):i})};u.useMemo(function(){d()},[l]);var f=c.opGet(l)[1];return z(function(){null==o||o(f)},function(e){return d(function(t){var n=(0,a.Z)(t,2),r=n[0],i=n[1];return e&&0===r&&(null==o||o(f)),[r+1,i]}),function(){c.opUpdate(l,function(t){var n=(0,a.Z)(t||[],2),o=n[0],i=void 0===o?0:o,u=n[1];return 0==i-1?(s(function(){(e||!c.opGet(l))&&(null==r||r(u,!1))}),null):[i-1,u]})}},[l]),f}var W={},V=new Map,q=function(e,t,n,r){var o=n.getDerivativeToken(e),a=(0,c.Z)((0,c.Z)({},o),t);return r&&(a=r(a)),a},X="token";function G(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=(0,u.useContext)(y),o=r.cache.instanceId,d=r.container,f=n.salt,p=void 0===f?"":f,m=n.override,g=void 0===m?W:m,x=n.formatToken,w=n.getComputedToken,E=n.cssVar,C=function(e,t){for(var n=j,r=0;r0&&n.forEach(function(e){"undefined"!=typeof document&&document.querySelectorAll("style[".concat(v,'="').concat(e,'"]')).forEach(function(e){if(e[b]===o){var t;null===(t=e.parentNode)||void 0===t||t.removeChild(e)}}),V.delete(e)})},function(e){var t=(0,a.Z)(e,4),n=t[0],r=t[3];if(E&&r){var i=(0,s.hq)(r,l("css-variables-".concat(n._themeKey)),{mark:h,prepend:"queue",attachTo:d,priority:-999});i[b]=o,i.setAttribute(v,n._themeKey)}})}var U=n(1119),$={animationIterationCount:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},K="comm",Y="rule",Q="decl",J=Math.abs,ee=String.fromCharCode;function et(e,t,n){return e.replace(t,n)}function en(e,t){return 0|e.charCodeAt(t)}function er(e,t,n){return e.slice(t,n)}function eo(e){return e.length}function ea(e,t){return t.push(e),e}function ei(e,t){for(var n="",r=0;r0?p[b]+" "+y:et(y,/&\f/g,p[b])).trim())&&(l[h++]=x);return em(e,t,n,0===o?Y:c,l,s,u,d)}function ex(e,t,n,r,o){return em(e,t,n,Q,er(e,0,r),er(e,r+1,-1),r,o)}var ew="data-ant-cssinjs-cache-path",eE="_FILE_STYLE__",eC=!0,eZ="_multi_value_";function eS(e){var t,n,r;return ei((r=function e(t,n,r,o,a,i,c,l,s){for(var u,d,f,p=0,m=0,g=c,v=0,h=0,b=0,y=1,x=1,w=1,E=0,C="",Z=a,S=i,O=o,k=C;x;)switch(b=E,E=eg()){case 40:if(108!=b&&58==en(k,g-1)){-1!=(d=k+=et(eb(E),"&","&\f"),f=J(p?l[p-1]:0),d.indexOf("&\f",f))&&(w=-1);break}case 34:case 39:case 91:k+=eb(E);break;case 9:case 10:case 13:case 32:k+=function(e){for(;ef=ev();)if(ef<33)eg();else break;return eh(e)>2||eh(ef)>3?"":" "}(b);break;case 92:k+=function(e,t){for(var n;--t&&eg()&&!(ef<48)&&!(ef>102)&&(!(ef>57)||!(ef<65))&&(!(ef>70)||!(ef<97)););return n=ed+(t<6&&32==ev()&&32==eg()),er(ep,e,n)}(ed-1,7);continue;case 47:switch(ev()){case 42:case 47:ea(em(u=function(e,t){for(;eg();)if(e+ef===57)break;else if(e+ef===84&&47===ev())break;return"/*"+er(ep,t,ed-1)+"*"+ee(47===e?e:eg())}(eg(),ed),n,r,K,ee(ef),er(u,2,-2),0,s),s),(5==eh(b||1)||5==eh(ev()||1))&&eo(k)&&" "!==er(k,-1,void 0)&&(k+=" ");break;default:k+="/"}break;case 123*y:l[p++]=eo(k)*w;case 125*y:case 59:case 0:switch(E){case 0:case 125:x=0;case 59+m:-1==w&&(k=et(k,/\f/g,"")),h>0&&(eo(k)-g||0===y&&47===b)&&ea(h>32?ex(k+";",o,r,g-1,s):ex(et(k," ","")+";",o,r,g-2,s),s);break;case 59:k+=";";default:if(ea(O=ey(k,n,r,p,m,a,l,C,Z=[],S=[],g,i),i),123===E){if(0===m)e(k,n,O,O,Z,i,g,l,S);else{switch(v){case 99:if(110===en(k,3))break;case 108:if(97===en(k,2))break;default:m=0;case 100:case 109:case 115:}m?e(t,O,O,o&&ea(ey(t,O,O,0,0,a,l,C,a,Z=[],g,S),S),a,S,g,l,o?Z:S):e(k,O,O,O,[""],S,0,l,S)}}}p=m=h=0,y=w=1,C=k="",g=c;break;case 58:g=1+eo(k),h=b;default:if(y<1){if(123==E)--y;else if(125==E&&0==y++&&125==(ef=ed>0?en(ep,--ed):0,es--,10===ef&&(es=1,el--),ef))continue}switch(k+=ee(E),E*y){case 38:w=m>0?1:(k+="\f",-1);break;case 44:l[p++]=(eo(k)-1)*w,w=1;break;case 64:45===ev()&&(k+=eb(eg())),v=ev(),m=g=eo(C=k+=function(e){for(;!eh(ev());)eg();return er(ep,e,ed)}(ed)),E++;break;case 45:45===b&&2==eo(k)&&(y=0)}}return i}("",null,null,null,[""],(n=t=e,el=es=1,eu=eo(ep=n),ed=0,t=[]),0,[0],t),ep="",r),ec).replace(/\{%%%\:[^;];}/g,";")}function eO(e,t,n){if(!t)return e;var r=".".concat(t),o="low"===n?":where(".concat(r,")"):r;return e.split(",").map(function(e){var t,n=e.trim().split(/\s+/),r=n[0]||"",a=(null===(t=r.match(/^\w+/))||void 0===t?void 0:t[0])||"";return[r="".concat(a).concat(o).concat(r.slice(a.length))].concat((0,i.Z)(n.slice(1))).join(" ")}).join(",")}var ek=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{root:!0,parentSelectors:[]},o=r.root,l=r.injectHash,s=r.parentSelectors,u=n.hashId,d=n.layer,f=(n.path,n.hashPriority),p=n.transformers,m=void 0===p?[]:p;n.linters;var g="",v={};function h(t){var r=t.getName(u);if(!v[r]){var o=e(t.style,n,{root:!1,parentSelectors:s}),i=(0,a.Z)(o,1)[0];v[r]="@keyframes ".concat(t.getName(u)).concat(i)}}return(function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return t.forEach(function(t){Array.isArray(t)?e(t,n):t&&n.push(t)}),n})(Array.isArray(t)?t:[t]).forEach(function(t){var r="string"!=typeof t||o?t:{};if("string"==typeof r)g+="".concat(r,"\n");else if(r._keyframe)h(r);else{var d=m.reduce(function(e,t){var n;return(null==t||null===(n=t.visit)||void 0===n?void 0:n.call(t,e))||e},r);Object.keys(d).forEach(function(t){var r=d[t];if("object"!==(0,x.Z)(r)||!r||"animationName"===t&&r._keyframe||"object"===(0,x.Z)(r)&&r&&("_skip_check_"in r||eZ in r)){function p(e,t){var n=e.replace(/[A-Z]/g,function(e){return"-".concat(e.toLowerCase())}),r=t;$[e]||"number"!=typeof r||0===r||(r="".concat(r,"px")),"animationName"===e&&null!=t&&t._keyframe&&(h(t),r=t.getName(u)),g+="".concat(n,":").concat(r,";")}var m,b=null!==(m=null==r?void 0:r.value)&&void 0!==m?m:r;"object"===(0,x.Z)(r)&&null!=r&&r[eZ]&&Array.isArray(b)?b.forEach(function(e){p(t,e)}):p(t,b)}else{var y=!1,w=t.trim(),E=!1;(o||l)&&u?w.startsWith("@")?y=!0:w="&"===w?eO("",u,f):eO(t,u,f):o&&!u&&("&"===w||""===w)&&(w="",E=!0);var C=e(r,n,{root:E,injectHash:y,parentSelectors:[].concat((0,i.Z)(s),[w])}),Z=(0,a.Z)(C,2),S=Z[0],O=Z[1];v=(0,c.Z)((0,c.Z)({},v),O),g+="".concat(w).concat(S)}})}}),o?d&&(g&&(g="@layer ".concat(d.name," {").concat(g,"}")),d.dependencies&&(v["@layer ".concat(d.name)]=d.dependencies.map(function(e){return"@layer ".concat(e,", ").concat(d.name,";")}).join("\n"))):g="{".concat(g,"}"),[g,v]};function ej(e,t){return l("".concat(e.join("%")).concat(t))}function eI(){return null}var eM="style";function eR(e,t){var n=e.token,l=e.path,d=e.hashId,f=e.layer,p=e.nonce,m=e.clientOnly,g=e.order,x=void 0===g?0:g,E=u.useContext(y),C=E.autoClear,Z=(E.mock,E.defaultCache),S=E.hashPriority,O=E.container,k=E.ssrInline,j=E.transformers,I=E.linters,M=E.cache,R=E.layer,N=n._tokenKey,F=[N];R&&F.push("layer"),F.push.apply(F,(0,i.Z)(l));var T=D(eM,F,function(){var e=F.join("|");if(!function(){if(!r&&(r={},(0,w.Z)())){var e,t=document.createElement("div");t.className=ew,t.style.position="fixed",t.style.visibility="hidden",t.style.top="-9999px",document.body.appendChild(t);var n=getComputedStyle(t).content||"";(n=n.replace(/^"/,"").replace(/"$/,"")).split(";").forEach(function(e){var t=e.split(":"),n=(0,a.Z)(t,2),o=n[0],i=n[1];r[o]=i});var o=document.querySelector("style[".concat(ew,"]"));o&&(eC=!1,null===(e=o.parentNode)||void 0===e||e.removeChild(o)),document.body.removeChild(t)}}(),r[e]){var n=function(e){var t=r[e],n=null;if(t&&(0,w.Z)()){if(eC)n=eE;else{var o=document.querySelector("style[".concat(h,'="').concat(r[e],'"]'));o?n=o.innerHTML:delete r[e]}}return[n,t]}(e),o=(0,a.Z)(n,2),i=o[0],c=o[1];if(i)return[i,N,c,{},m,x]}var s=ek(t(),{hashId:d,hashPriority:S,layer:R?f:void 0,path:l.join("-"),transformers:j,linters:I}),u=(0,a.Z)(s,2),p=u[0],g=u[1],v=eS(p),b=ej(F,v);return[v,N,b,g,m,x]},function(e,t){var n=(0,a.Z)(e,3)[2];(t||C)&&P&&(0,s.jL)(n,{mark:h,attachTo:O})},function(e){var t=(0,a.Z)(e,4),n=t[0],r=(t[1],t[2]),o=t[3];if(P&&n!==eE){var i={mark:h,prepend:!R&&"queue",attachTo:O,priority:x},l="function"==typeof p?p():p;l&&(i.csp={nonce:l});var u=[],d=[];Object.keys(o).forEach(function(e){e.startsWith("@layer")?u.push(e):d.push(e)}),u.forEach(function(e){(0,s.hq)(eS(o[e]),"_layer-".concat(e),(0,c.Z)((0,c.Z)({},i),{},{prepend:!0}))});var f=(0,s.hq)(n,r,i);f[b]=M.instanceId,f.setAttribute(v,N),d.forEach(function(e){(0,s.hq)(eS(o[e]),"_effect-".concat(e),i)})}}),A=(0,a.Z)(T,3),_=A[0],B=A[1],H=A[2];return function(e){var t;return t=k&&!P&&Z?u.createElement("style",(0,U.Z)({},(0,o.Z)((0,o.Z)({},v,B),h,H),{dangerouslySetInnerHTML:{__html:_}})):u.createElement(eI,null),u.createElement(u.Fragment,null,t,e)}}var eN="cssVar",eP=function(e,t){var n=e.key,r=e.prefix,o=e.unitless,c=e.ignore,l=e.token,d=e.scope,f=void 0===d?"":d,p=(0,u.useContext)(y),m=p.cache.instanceId,g=p.container,x=l._tokenKey,w=[].concat((0,i.Z)(e.path),[n,f,x]);return D(eN,w,function(){var e=_(t(),n,{prefix:r,unitless:o,ignore:c,scope:f}),i=(0,a.Z)(e,2),l=i[0],s=i[1],u=ej(w,s);return[l,s,u,n]},function(e){var t=(0,a.Z)(e,3)[2];P&&(0,s.jL)(t,{mark:h,attachTo:g})},function(e){var t=(0,a.Z)(e,3),r=t[1],o=t[2];if(r){var i=(0,s.hq)(r,o,{mark:h,prepend:"queue",attachTo:g,priority:-999});i[b]=m,i.setAttribute(v,n)}})};(0,o.Z)((0,o.Z)((0,o.Z)({},eM,function(e,t,n){var r=(0,a.Z)(e,6),o=r[0],i=r[1],c=r[2],l=r[3],s=r[4],u=r[5],d=(n||{}).plain;if(s)return null;var f=o,p={"data-rc-order":"prependQueue","data-rc-priority":"".concat(u)};return f=T(o,i,c,p,d),l&&Object.keys(l).forEach(function(e){if(!t[e]){t[e]=!0;var n=T(eS(l[e]),i,"_effect-".concat(e),p,d);e.startsWith("@layer")?f=n+f:f+=n}}),[u,c,f]}),X,function(e,t,n){var r=(0,a.Z)(e,5),o=r[2],i=r[3],c=r[4],l=(n||{}).plain;if(!i)return null;var s=o._tokenKey,u=T(i,c,s,{"data-rc-order":"prependQueue","data-rc-priority":"".concat(-999)},l);return[-999,s,u]}),eN,function(e,t,n){var r=(0,a.Z)(e,4),o=r[1],i=r[2],c=r[3],l=(n||{}).plain;if(!o)return null;var s=T(o,c,i,{"data-rc-order":"prependQueue","data-rc-priority":"".concat(-999)},l);return[-999,i,s]});var eF=function(){function e(t,n){(0,f.Z)(this,e),(0,o.Z)(this,"name",void 0),(0,o.Z)(this,"style",void 0),(0,o.Z)(this,"_keyframe",!0),this.name=t,this.style=n}return(0,p.Z)(e,[{key:"getName",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return e?"".concat(e,"-").concat(this.name):this.name}}]),e}();function eT(e){return e.notSplit=!0,e}eT(["borderTop","borderBottom"]),eT(["borderTop"]),eT(["borderBottom"]),eT(["borderLeft","borderRight"]),eT(["borderLeft"]),eT(["borderRight"])},54558:function(e,t,n){"use strict";n.d(t,{t:function(){return l}});var r=n(11993);let o=Math.round;function a(e,t){let n=e.replace(/^[^(]*\((.*)/,"$1").replace(/\).*/,"").match(/\d*\.?\d+%?/g)||[],r=n.map(e=>parseFloat(e));for(let e=0;e<3;e+=1)r[e]=t(r[e]||0,n[e]||"",e);return n[3]?r[3]=n[3].includes("%")?r[3]/100:r[3]:r[3]=1,r}let i=(e,t,n)=>0===n?e:e/100;function c(e,t){let n=t||255;return e>n?n:e<0?0:e}class l{constructor(e){function t(t){return t[0]in e&&t[1]in e&&t[2]in e}if((0,r.Z)(this,"isValid",!0),(0,r.Z)(this,"r",0),(0,r.Z)(this,"g",0),(0,r.Z)(this,"b",0),(0,r.Z)(this,"a",1),(0,r.Z)(this,"_h",void 0),(0,r.Z)(this,"_s",void 0),(0,r.Z)(this,"_l",void 0),(0,r.Z)(this,"_v",void 0),(0,r.Z)(this,"_max",void 0),(0,r.Z)(this,"_min",void 0),(0,r.Z)(this,"_brightness",void 0),e){if("string"==typeof e){let t=e.trim();function n(e){return t.startsWith(e)}/^#?[A-F\d]{3,8}$/i.test(t)?this.fromHexString(t):n("rgb")?this.fromRgbString(t):n("hsl")?this.fromHslString(t):(n("hsv")||n("hsb"))&&this.fromHsvString(t)}else if(e instanceof l)this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this._h=e._h,this._s=e._s,this._l=e._l,this._v=e._v;else if(t("rgb"))this.r=c(e.r),this.g=c(e.g),this.b=c(e.b),this.a="number"==typeof e.a?c(e.a,1):1;else if(t("hsl"))this.fromHsl(e);else if(t("hsv"))this.fromHsv(e);else throw Error("@ant-design/fast-color: unsupported input "+JSON.stringify(e))}}setR(e){return this._sc("r",e)}setG(e){return this._sc("g",e)}setB(e){return this._sc("b",e)}setA(e){return this._sc("a",e,1)}setHue(e){let t=this.toHsv();return t.h=e,this._c(t)}getLuminance(){function e(e){let t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}return .2126*e(this.r)+.7152*e(this.g)+.0722*e(this.b)}getHue(){if(void 0===this._h){let e=this.getMax()-this.getMin();0===e?this._h=0:this._h=o(60*(this.r===this.getMax()?(this.g-this.b)/e+(this.g1&&(r=1),this._c({h:t,s:n,l:r,a:this.a})}mix(e,t=50){let n=this._c(e),r=t/100,a=e=>(n[e]-this[e])*r+this[e],i={r:o(a("r")),g:o(a("g")),b:o(a("b")),a:o(100*a("a"))/100};return this._c(i)}tint(e=10){return this.mix({r:255,g:255,b:255,a:1},e)}shade(e=10){return this.mix({r:0,g:0,b:0,a:1},e)}onBackground(e){let t=this._c(e),n=this.a+t.a*(1-this.a),r=e=>o((this[e]*this.a+t[e]*t.a*(1-this.a))/n);return this._c({r:r("r"),g:r("g"),b:r("b"),a:n})}isDark(){return 128>this.getBrightness()}isLight(){return this.getBrightness()>=128}equals(e){return this.r===e.r&&this.g===e.g&&this.b===e.b&&this.a===e.a}clone(){return this._c(this)}toHexString(){let e="#",t=(this.r||0).toString(16);e+=2===t.length?t:"0"+t;let n=(this.g||0).toString(16);e+=2===n.length?n:"0"+n;let r=(this.b||0).toString(16);if(e+=2===r.length?r:"0"+r,"number"==typeof this.a&&this.a>=0&&this.a<1){let t=o(255*this.a).toString(16);e+=2===t.length?t:"0"+t}return e}toHsl(){return{h:this.getHue(),s:this.getSaturation(),l:this.getLightness(),a:this.a}}toHslString(){let e=this.getHue(),t=o(100*this.getSaturation()),n=o(100*this.getLightness());return 1!==this.a?`hsla(${e},${t}%,${n}%,${this.a})`:`hsl(${e},${t}%,${n}%)`}toHsv(){return{h:this.getHue(),s:this.getSaturation(),v:this.getValue(),a:this.a}}toRgb(){return{r:this.r,g:this.g,b:this.b,a:this.a}}toRgbString(){return 1!==this.a?`rgba(${this.r},${this.g},${this.b},${this.a})`:`rgb(${this.r},${this.g},${this.b})`}toString(){return this.toRgbString()}_sc(e,t,n){let r=this.clone();return r[e]=c(t,n),r}_c(e){return new this.constructor(e)}getMax(){return void 0===this._max&&(this._max=Math.max(this.r,this.g,this.b)),this._max}getMin(){return void 0===this._min&&(this._min=Math.min(this.r,this.g,this.b)),this._min}fromHexString(e){let t=e.replace("#","");function n(e,n){return parseInt(t[e]+t[n||e],16)}t.length<6?(this.r=n(0),this.g=n(1),this.b=n(2),this.a=t[3]?n(3)/255:1):(this.r=n(0,1),this.g=n(2,3),this.b=n(4,5),this.a=t[6]?n(6,7)/255:1)}fromHsl({h:e,s:t,l:n,a:r}){if(this._h=e%360,this._s=t,this._l=n,this.a="number"==typeof r?r:1,t<=0){let e=o(255*n);this.r=e,this.g=e,this.b=e}let a=0,i=0,c=0,l=e/60,s=(1-Math.abs(2*n-1))*t,u=s*(1-Math.abs(l%2-1));l>=0&&l<1?(a=s,i=u):l>=1&&l<2?(a=u,i=s):l>=2&&l<3?(i=s,c=u):l>=3&&l<4?(i=u,c=s):l>=4&&l<5?(a=u,c=s):l>=5&&l<6&&(a=s,c=u);let d=n-s/2;this.r=o((a+d)*255),this.g=o((i+d)*255),this.b=o((c+d)*255)}fromHsv({h:e,s:t,v:n,a:r}){this._h=e%360,this._s=t,this._v=n,this.a="number"==typeof r?r:1;let a=o(255*n);if(this.r=a,this.g=a,this.b=a,t<=0)return;let i=e/60,c=Math.floor(i),l=i-c,s=o(n*(1-t)*255),u=o(n*(1-t*l)*255),d=o(n*(1-t*(1-l))*255);switch(c){case 0:this.g=d,this.b=s;break;case 1:this.r=u,this.b=s;break;case 2:this.r=s,this.b=d;break;case 3:this.r=s,this.g=u;break;case 4:this.r=d,this.g=s;break;default:this.g=s,this.b=u}}fromHsvString(e){let t=a(e,i);this.fromHsv({h:t[0],s:t[1],v:t[2],a:t[3]})}fromHslString(e){let t=a(e,i);this.fromHsl({h:t[0],s:t[1],l:t[2],a:t[3]})}fromRgbString(e){let t=a(e,(e,t)=>t.includes("%")?o(e/100*255):e);this.r=t[0],this.g=t[1],this.b=t[2],this.a=t[3]}}},55015:function(e,t,n){"use strict";n.d(t,{Z:function(){return j}});var r=n(1119),o=n(26365),a=n(11993),i=n(6989),c=n(2265),l=n(36760),s=n.n(l),u=n(57943),d=n(20902),f=n(31686),p=n(41154),m=n(21717),g=n(13211),v=n(32559);function h(e){return"object"===(0,p.Z)(e)&&"string"==typeof e.name&&"string"==typeof e.theme&&("object"===(0,p.Z)(e.icon)||"function"==typeof e.icon)}function b(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.keys(e).reduce(function(t,n){var r=e[n];return"class"===n?(t.className=r,delete t.class):(delete t[n],t[n.replace(/-(.)/g,function(e,t){return t.toUpperCase()})]=r),t},{})}function y(e){return(0,u.R_)(e)[0]}function x(e){return e?Array.isArray(e)?e:[e]:[]}var w=function(e){var t=(0,c.useContext)(d.Z),n=t.csp,r=t.prefixCls,o=t.layer,a="\n.anticon {\n display: inline-flex;\n align-items: center;\n color: inherit;\n font-style: normal;\n line-height: 0;\n text-align: center;\n text-transform: none;\n vertical-align: -0.125em;\n text-rendering: optimizeLegibility;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.anticon > * {\n line-height: 1;\n}\n\n.anticon svg {\n display: inline-block;\n}\n\n.anticon::before {\n display: none;\n}\n\n.anticon .anticon-icon {\n display: block;\n}\n\n.anticon[tabindex] {\n cursor: pointer;\n}\n\n.anticon-spin::before,\n.anticon-spin {\n display: inline-block;\n -webkit-animation: loadingCircle 1s infinite linear;\n animation: loadingCircle 1s infinite linear;\n}\n\n@-webkit-keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n\n@keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n";r&&(a=a.replace(/anticon/g,r)),o&&(a="@layer ".concat(o," {\n").concat(a,"\n}")),(0,c.useEffect)(function(){var t=e.current,r=(0,g.A)(t);(0,m.hq)(a,"@ant-design-icons",{prepend:!o,csp:n,attachTo:r})},[])},E=["icon","className","onClick","style","primaryColor","secondaryColor"],C={primaryColor:"#333",secondaryColor:"#E6E6E6",calculated:!1},Z=function(e){var t,n,r=e.icon,o=e.className,a=e.onClick,l=e.style,s=e.primaryColor,u=e.secondaryColor,d=(0,i.Z)(e,E),p=c.useRef(),m=C;if(s&&(m={primaryColor:s,secondaryColor:u||y(s)}),w(p),t=h(r),n="icon should be icon definiton, but got ".concat(r),(0,v.ZP)(t,"[@ant-design/icons] ".concat(n)),!h(r))return null;var g=r;return g&&"function"==typeof g.icon&&(g=(0,f.Z)((0,f.Z)({},g),{},{icon:g.icon(m.primaryColor,m.secondaryColor)})),function e(t,n,r){return r?c.createElement(t.tag,(0,f.Z)((0,f.Z)({key:n},b(t.attrs)),r),(t.children||[]).map(function(r,o){return e(r,"".concat(n,"-").concat(t.tag,"-").concat(o))})):c.createElement(t.tag,(0,f.Z)({key:n},b(t.attrs)),(t.children||[]).map(function(r,o){return e(r,"".concat(n,"-").concat(t.tag,"-").concat(o))}))}(g.icon,"svg-".concat(g.name),(0,f.Z)((0,f.Z)({className:o,onClick:a,style:l,"data-icon":g.name,width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},d),{},{ref:p}))};function S(e){var t=x(e),n=(0,o.Z)(t,2),r=n[0],a=n[1];return Z.setTwoToneColors({primaryColor:r,secondaryColor:a})}Z.displayName="IconReact",Z.getTwoToneColors=function(){return(0,f.Z)({},C)},Z.setTwoToneColors=function(e){var t=e.primaryColor,n=e.secondaryColor;C.primaryColor=t,C.secondaryColor=n||y(t),C.calculated=!!n};var O=["className","icon","spin","rotate","tabIndex","onClick","twoToneColor"];S(u.iN.primary);var k=c.forwardRef(function(e,t){var n=e.className,l=e.icon,u=e.spin,f=e.rotate,p=e.tabIndex,m=e.onClick,g=e.twoToneColor,v=(0,i.Z)(e,O),h=c.useContext(d.Z),b=h.prefixCls,y=void 0===b?"anticon":b,w=h.rootClassName,E=s()(w,y,(0,a.Z)((0,a.Z)({},"".concat(y,"-").concat(l.name),!!l.name),"".concat(y,"-spin"),!!u||"loading"===l.name),n),C=p;void 0===C&&m&&(C=-1);var S=x(g),k=(0,o.Z)(S,2),j=k[0],I=k[1];return c.createElement("span",(0,r.Z)({role:"img","aria-label":l.name},v,{ref:t,tabIndex:C,onClick:m,className:E}),c.createElement(Z,{icon:l,primaryColor:j,secondaryColor:I,style:f?{msTransform:"rotate(".concat(f,"deg)"),transform:"rotate(".concat(f,"deg)")}:void 0}))});k.displayName="AntdIcon",k.getTwoToneColor=function(){var e=Z.getTwoToneColors();return e.calculated?[e.primaryColor,e.secondaryColor]:e.primaryColor},k.setTwoToneColor=S;var j=k},20902:function(e,t,n){"use strict";var r=(0,n(2265).createContext)({});t.Z=r},8900:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(1119),o=n(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 01-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z"}}]},name:"check-circle",theme:"filled"},i=n(55015),c=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,r.Z)({},e,{ref:t,icon:a}))})},9738:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(1119),o=n(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 00-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z"}}]},name:"check",theme:"outlined"},i=n(55015),c=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,r.Z)({},e,{ref:t,icon:a}))})},39725:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(1119),o=n(2265),a={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm127.98 274.82h-.04l-.08.06L512 466.75 384.14 338.88c-.04-.05-.06-.06-.08-.06a.12.12 0 00-.07 0c-.03 0-.05.01-.09.05l-45.02 45.02a.2.2 0 00-.05.09.12.12 0 000 .07v.02a.27.27 0 00.06.06L466.75 512 338.88 639.86c-.05.04-.06.06-.06.08a.12.12 0 000 .07c0 .03.01.05.05.09l45.02 45.02a.2.2 0 00.09.05.12.12 0 00.07 0c.02 0 .04-.01.08-.05L512 557.25l127.86 127.87c.04.04.06.05.08.05a.12.12 0 00.07 0c.03 0 .05-.01.09-.05l45.02-45.02a.2.2 0 00.05-.09.12.12 0 000-.07v-.02a.27.27 0 00-.05-.06L557.25 512l127.87-127.86c.04-.04.05-.06.05-.08a.12.12 0 000-.07c0-.03-.01-.05-.05-.09l-45.02-45.02a.2.2 0 00-.09-.05.12.12 0 00-.07 0z"}}]},name:"close-circle",theme:"filled"},i=n(55015),c=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,r.Z)({},e,{ref:t,icon:a}))})},49638:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(1119),o=n(2265),a={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M799.86 166.31c.02 0 .04.02.08.06l57.69 57.7c.04.03.05.05.06.08a.12.12 0 010 .06c0 .03-.02.05-.06.09L569.93 512l287.7 287.7c.04.04.05.06.06.09a.12.12 0 010 .07c0 .02-.02.04-.06.08l-57.7 57.69c-.03.04-.05.05-.07.06a.12.12 0 01-.07 0c-.03 0-.05-.02-.09-.06L512 569.93l-287.7 287.7c-.04.04-.06.05-.09.06a.12.12 0 01-.07 0c-.02 0-.04-.02-.08-.06l-57.69-57.7c-.04-.03-.05-.05-.06-.07a.12.12 0 010-.07c0-.03.02-.05.06-.09L454.07 512l-287.7-287.7c-.04-.04-.05-.06-.06-.09a.12.12 0 010-.07c0-.02.02-.04.06-.08l57.7-57.69c.03-.04.05-.05.07-.06a.12.12 0 01.07 0c.03 0 .05.02.09.06L512 454.07l287.7-287.7c.04-.04.06-.05.09-.06a.12.12 0 01.07 0z"}}]},name:"close",theme:"outlined"},i=n(55015),c=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,r.Z)({},e,{ref:t,icon:a}))})},70464:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(1119),o=n(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"}}]},name:"down",theme:"outlined"},i=n(55015),c=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,r.Z)({},e,{ref:t,icon:a}))})},54537:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(1119),o=n(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-32 232c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V296zm32 440a48.01 48.01 0 010-96 48.01 48.01 0 010 96z"}}]},name:"exclamation-circle",theme:"filled"},i=n(55015),c=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,r.Z)({},e,{ref:t,icon:a}))})},97416:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(1119),o=n(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M942.2 486.2Q889.47 375.11 816.7 305l-50.88 50.88C807.31 395.53 843.45 447.4 874.7 512 791.5 684.2 673.4 766 512 766q-72.67 0-133.87-22.38L323 798.75Q408 838 512 838q288.3 0 430.2-300.3a60.29 60.29 0 000-51.5zm-63.57-320.64L836 122.88a8 8 0 00-11.32 0L715.31 232.2Q624.86 186 512 186q-288.3 0-430.2 300.3a60.3 60.3 0 000 51.5q56.69 119.4 136.5 191.41L112.48 835a8 8 0 000 11.31L155.17 889a8 8 0 0011.31 0l712.15-712.12a8 8 0 000-11.32zM149.3 512C232.6 339.8 350.7 258 512 258c54.54 0 104.13 9.36 149.12 28.39l-70.3 70.3a176 176 0 00-238.13 238.13l-83.42 83.42C223.1 637.49 183.3 582.28 149.3 512zm246.7 0a112.11 112.11 0 01146.2-106.69L401.31 546.2A112 112 0 01396 512z"}},{tag:"path",attrs:{d:"M508 624c-3.46 0-6.87-.16-10.25-.47l-52.82 52.82a176.09 176.09 0 00227.42-227.42l-52.82 52.82c.31 3.38.47 6.79.47 10.25a111.94 111.94 0 01-112 112z"}}]},name:"eye-invisible",theme:"outlined"},i=n(55015),c=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,r.Z)({},e,{ref:t,icon:a}))})},6520:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(1119),o=n(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 000 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766zm-4-430c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z"}}]},name:"eye",theme:"outlined"},i=n(55015),c=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,r.Z)({},e,{ref:t,icon:a}))})},55726:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(1119),o=n(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm32 664c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V456c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272zm-32-344a48.01 48.01 0 010-96 48.01 48.01 0 010 96z"}}]},name:"info-circle",theme:"filled"},i=n(55015),c=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,r.Z)({},e,{ref:t,icon:a}))})},15424:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(1119),o=n(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M464 336a48 48 0 1096 0 48 48 0 10-96 0zm72 112h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V456c0-4.4-3.6-8-8-8z"}}]},name:"info-circle",theme:"outlined"},i=n(55015),c=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,r.Z)({},e,{ref:t,icon:a}))})},61935:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(1119),o=n(2265),a={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"}}]},name:"loading",theme:"outlined"},i=n(55015),c=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,r.Z)({},e,{ref:t,icon:a}))})},67187:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(1119),o=n(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"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"},i=n(55015),c=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,r.Z)({},e,{ref:t,icon:a}))})},29436:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(1119),o=n(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z"}}]},name:"search",theme:"outlined"},i=n(55015),c=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,r.Z)({},e,{ref:t,icon:a}))})},75669:function(e,t,n){"use strict";n.d(t,{Il:function(){return v}}),n(2265);var r,o=n(76405),a=n(25049),i=n(41690),c=n(15900),l=n(31686),s=n(6989),u=n(41154),d=n(54558),f=["b"],p=["v"],m=function(e){return Math.round(Number(e||0))},g=function(e){if(e instanceof d.t)return e;if(e&&"object"===(0,u.Z)(e)&&"h"in e&&"b"in e){var t=e.b,n=(0,s.Z)(e,f);return(0,l.Z)((0,l.Z)({},n),{},{v:t})}return"string"==typeof e&&/hsb/.test(e)?e.replace(/hsb/,"hsv"):e},v=function(e){(0,i.Z)(n,e);var t=(0,c.Z)(n);function n(e){return(0,o.Z)(this,n),t.call(this,g(e))}return(0,a.Z)(n,[{key:"toHsbString",value:function(){var e=this.toHsb(),t=m(100*e.s),n=m(100*e.b),r=m(e.h),o=e.a,a="hsb(".concat(r,", ").concat(t,"%, ").concat(n,"%)"),i="hsba(".concat(r,", ").concat(t,"%, ").concat(n,"%, ").concat(o.toFixed(0===o?0:2),")");return 1===o?a:i}},{key:"toHsb",value:function(){var e=this.toHsv(),t=e.v,n=(0,s.Z)(e,p);return(0,l.Z)((0,l.Z)({},n),{},{b:t,a:this.a})}}]),n}(d.t);(r="#1677ff")instanceof v||new v(r),n(36760),n(74126)},28036:function(e,t,n){"use strict";n.d(t,{Z:function(){return h}});var r=n(26365),o=n(2265),a=n(54887),i=n(94981);n(32559);var c=n(28791),l=o.createContext(null),s=n(83145),u=n(27380),d=[],f=n(21717),p=n(3208),m="rc-util-locker-".concat(Date.now()),g=0,v=function(e){return!1!==e&&((0,i.Z)()&&e?"string"==typeof e?document.querySelector(e):"function"==typeof e?e():e:null)},h=o.forwardRef(function(e,t){var n,h,b,y=e.open,x=e.autoLock,w=e.getContainer,E=(e.debug,e.autoDestroy),C=void 0===E||E,Z=e.children,S=o.useState(y),O=(0,r.Z)(S,2),k=O[0],j=O[1],I=k||y;o.useEffect(function(){(C||y)&&j(y)},[y,C]);var M=o.useState(function(){return v(w)}),R=(0,r.Z)(M,2),N=R[0],P=R[1];o.useEffect(function(){var e=v(w);P(null!=e?e:null)});var F=function(e,t){var n=o.useState(function(){return(0,i.Z)()?document.createElement("div"):null}),a=(0,r.Z)(n,1)[0],c=o.useRef(!1),f=o.useContext(l),p=o.useState(d),m=(0,r.Z)(p,2),g=m[0],v=m[1],h=f||(c.current?void 0:function(e){v(function(t){return[e].concat((0,s.Z)(t))})});function b(){a.parentElement||document.body.appendChild(a),c.current=!0}function y(){var e;null===(e=a.parentElement)||void 0===e||e.removeChild(a),c.current=!1}return(0,u.Z)(function(){return e?f?f(b):b():y(),y},[e]),(0,u.Z)(function(){g.length&&(g.forEach(function(e){return e()}),v(d))},[g]),[a,h]}(I&&!N,0),T=(0,r.Z)(F,2),A=T[0],_=T[1],B=null!=N?N:A;n=!!(x&&y&&(0,i.Z)()&&(B===A||B===document.body)),h=o.useState(function(){return g+=1,"".concat(m,"_").concat(g)}),b=(0,r.Z)(h,1)[0],(0,u.Z)(function(){if(n){var e=(0,p.o)(document.body).width,t=document.body.scrollHeight>(window.innerHeight||document.documentElement.clientHeight)&&window.innerWidth>document.body.offsetWidth;(0,f.hq)("\nhtml body {\n overflow-y: hidden;\n ".concat(t?"width: calc(100% - ".concat(e,"px);"):"","\n}"),b)}else(0,f.jL)(b);return function(){(0,f.jL)(b)}},[n,b]);var H=null;Z&&(0,c.Yr)(Z)&&t&&(H=Z.ref);var z=(0,c.x1)(H,t);if(!I||!(0,i.Z)()||void 0===N)return null;var L=!1===B,D=Z;return t&&(D=o.cloneElement(Z,{ref:z})),o.createElement(l.Provider,{value:_},L?D:(0,a.createPortal)(D,B))})},97821:function(e,t,n){"use strict";n.d(t,{Z:function(){return L}});var r=n(31686),o=n(26365),a=n(6989),i=n(28036),c=n(36760),l=n.n(c),s=n(31474),u=n(2868),d=n(13211),f=n(58525),p=n(92491),m=n(27380),g=n(79267),v=n(2265),h=n(1119),b=n(66632),y=n(28791);function x(e){var t=e.prefixCls,n=e.align,r=e.arrow,o=e.arrowPos,a=r||{},i=a.className,c=a.content,s=o.x,u=o.y,d=v.useRef();if(!n||!n.points)return null;var f={position:"absolute"};if(!1!==n.autoArrow){var p=n.points[0],m=n.points[1],g=p[0],h=p[1],b=m[0],y=m[1];g!==b&&["t","b"].includes(g)?"t"===g?f.top=0:f.bottom=0:f.top=void 0===u?0:u,h!==y&&["l","r"].includes(h)?"l"===h?f.left=0:f.right=0:f.left=void 0===s?0:s}return v.createElement("div",{ref:d,className:l()("".concat(t,"-arrow"),i),style:f},c)}function w(e){var t=e.prefixCls,n=e.open,r=e.zIndex,o=e.mask,a=e.motion;return o?v.createElement(b.ZP,(0,h.Z)({},a,{motionAppear:!0,visible:n,removeOnLeave:!0}),function(e){var n=e.className;return v.createElement("div",{style:{zIndex:r},className:l()("".concat(t,"-mask"),n)})}):null}var E=v.memo(function(e){return e.children},function(e,t){return t.cache}),C=v.forwardRef(function(e,t){var n=e.popup,a=e.className,i=e.prefixCls,c=e.style,u=e.target,d=e.onVisibleChanged,f=e.open,p=e.keepDom,g=e.fresh,C=e.onClick,Z=e.mask,S=e.arrow,O=e.arrowPos,k=e.align,j=e.motion,I=e.maskMotion,M=e.forceRender,R=e.getPopupContainer,N=e.autoDestroy,P=e.portal,F=e.zIndex,T=e.onMouseEnter,A=e.onMouseLeave,_=e.onPointerEnter,B=e.onPointerDownCapture,H=e.ready,z=e.offsetX,L=e.offsetY,D=e.offsetR,W=e.offsetB,V=e.onAlign,q=e.onPrepare,X=e.stretch,G=e.targetWidth,U=e.targetHeight,$="function"==typeof n?n():n,K=f||p,Y=(null==R?void 0:R.length)>0,Q=v.useState(!R||!Y),J=(0,o.Z)(Q,2),ee=J[0],et=J[1];if((0,m.Z)(function(){!ee&&Y&&u&&et(!0)},[ee,Y,u]),!ee)return null;var en="auto",er={left:"-1000vw",top:"-1000vh",right:en,bottom:en};if(H||!f){var eo,ea=k.points,ei=k.dynamicInset||(null===(eo=k._experimental)||void 0===eo?void 0:eo.dynamicInset),ec=ei&&"r"===ea[0][1],el=ei&&"b"===ea[0][0];ec?(er.right=D,er.left=en):(er.left=z,er.right=en),el?(er.bottom=W,er.top=en):(er.top=L,er.bottom=en)}var es={};return X&&(X.includes("height")&&U?es.height=U:X.includes("minHeight")&&U&&(es.minHeight=U),X.includes("width")&&G?es.width=G:X.includes("minWidth")&&G&&(es.minWidth=G)),f||(es.pointerEvents="none"),v.createElement(P,{open:M||K,getContainer:R&&function(){return R(u)},autoDestroy:N},v.createElement(w,{prefixCls:i,open:f,zIndex:F,mask:Z,motion:I}),v.createElement(s.Z,{onResize:V,disabled:!f},function(e){return v.createElement(b.ZP,(0,h.Z)({motionAppear:!0,motionEnter:!0,motionLeave:!0,removeOnLeave:!1,forceRender:M,leavedClassName:"".concat(i,"-hidden")},j,{onAppearPrepare:q,onEnterPrepare:q,visible:f,onVisibleChanged:function(e){var t;null==j||null===(t=j.onVisibleChanged)||void 0===t||t.call(j,e),d(e)}}),function(n,o){var s=n.className,u=n.style,d=l()(i,s,a);return v.createElement("div",{ref:(0,y.sQ)(e,t,o),className:d,style:(0,r.Z)((0,r.Z)((0,r.Z)((0,r.Z)({"--arrow-x":"".concat(O.x||0,"px"),"--arrow-y":"".concat(O.y||0,"px")},er),es),u),{},{boxSizing:"border-box",zIndex:F},c),onMouseEnter:T,onMouseLeave:A,onPointerEnter:_,onClick:C,onPointerDownCapture:B},S&&v.createElement(x,{prefixCls:i,arrow:S,arrowPos:O,align:k}),v.createElement(E,{cache:!f&&!g},$))})}))}),Z=v.forwardRef(function(e,t){var n=e.children,r=e.getTriggerDOMNode,o=(0,y.Yr)(n),a=v.useCallback(function(e){(0,y.mH)(t,r?r(e):e)},[r]),i=(0,y.x1)(a,(0,y.C4)(n));return o?v.cloneElement(n,{ref:i}):n}),S=v.createContext(null);function O(e){return e?Array.isArray(e)?e:[e]:[]}var k=n(2857);function j(e,t,n,r){return t||(n?{motionName:"".concat(e,"-").concat(n)}:r?{motionName:r}:null)}function I(e){return e.ownerDocument.defaultView}function M(e){for(var t=[],n=null==e?void 0:e.parentElement,r=["hidden","scroll","clip","auto"];n;){var o=I(n).getComputedStyle(n);[o.overflowX,o.overflowY,o.overflow].some(function(e){return r.includes(e)})&&t.push(n),n=n.parentElement}return t}function R(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return Number.isNaN(e)?t:e}function N(e){return R(parseFloat(e),0)}function P(e,t){var n=(0,r.Z)({},e);return(t||[]).forEach(function(e){if(!(e instanceof HTMLBodyElement||e instanceof HTMLHtmlElement)){var t=I(e).getComputedStyle(e),r=t.overflow,o=t.overflowClipMargin,a=t.borderTopWidth,i=t.borderBottomWidth,c=t.borderLeftWidth,l=t.borderRightWidth,s=e.getBoundingClientRect(),u=e.offsetHeight,d=e.clientHeight,f=e.offsetWidth,p=e.clientWidth,m=N(a),g=N(i),v=N(c),h=N(l),b=R(Math.round(s.width/f*1e3)/1e3),y=R(Math.round(s.height/u*1e3)/1e3),x=m*y,w=v*b,E=0,C=0;if("clip"===r){var Z=N(o);E=Z*b,C=Z*y}var S=s.x+w-E,O=s.y+x-C,k=S+s.width+2*E-w-h*b-(f-p-v-h)*b,j=O+s.height+2*C-x-g*y-(u-d-m-g)*y;n.left=Math.max(n.left,S),n.top=Math.max(n.top,O),n.right=Math.min(n.right,k),n.bottom=Math.min(n.bottom,j)}}),n}function F(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n="".concat(t),r=n.match(/^(.*)\%$/);return r?parseFloat(r[1])/100*e:parseFloat(n)}function T(e,t){var n=(0,o.Z)(t||[],2),r=n[0],a=n[1];return[F(e.width,r),F(e.height,a)]}function A(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return[e[0],e[1]]}function _(e,t){var n,r=t[0],o=t[1];return n="t"===r?e.y:"b"===r?e.y+e.height:e.y+e.height/2,{x:"l"===o?e.x:"r"===o?e.x+e.width:e.x+e.width/2,y:n}}function B(e,t){var n={t:"b",b:"t",l:"r",r:"l"};return e.map(function(e,r){return r===t?n[e]||"c":e}).join("")}var H=n(83145);n(32559);var z=["prefixCls","children","action","showAction","hideAction","popupVisible","defaultPopupVisible","onPopupVisibleChange","afterPopupVisibleChange","mouseEnterDelay","mouseLeaveDelay","focusDelay","blurDelay","mask","maskClosable","getPopupContainer","forceRender","autoDestroy","destroyPopupOnHide","popup","popupClassName","popupStyle","popupPlacement","builtinPlacements","popupAlign","zIndex","stretch","getPopupClassNameFromAlign","fresh","alignPoint","onPopupClick","onPopupAlign","arrow","popupMotion","maskMotion","popupTransitionName","popupAnimation","maskTransitionName","maskAnimation","className","getTriggerDOMNode"],L=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i.Z;return v.forwardRef(function(t,n){var i,c,h,b,y,x,w,E,N,F,L,D,W,V,q,X,G,U=t.prefixCls,$=void 0===U?"rc-trigger-popup":U,K=t.children,Y=t.action,Q=t.showAction,J=t.hideAction,ee=t.popupVisible,et=t.defaultPopupVisible,en=t.onPopupVisibleChange,er=t.afterPopupVisibleChange,eo=t.mouseEnterDelay,ea=t.mouseLeaveDelay,ei=void 0===ea?.1:ea,ec=t.focusDelay,el=t.blurDelay,es=t.mask,eu=t.maskClosable,ed=t.getPopupContainer,ef=t.forceRender,ep=t.autoDestroy,em=t.destroyPopupOnHide,eg=t.popup,ev=t.popupClassName,eh=t.popupStyle,eb=t.popupPlacement,ey=t.builtinPlacements,ex=void 0===ey?{}:ey,ew=t.popupAlign,eE=t.zIndex,eC=t.stretch,eZ=t.getPopupClassNameFromAlign,eS=t.fresh,eO=t.alignPoint,ek=t.onPopupClick,ej=t.onPopupAlign,eI=t.arrow,eM=t.popupMotion,eR=t.maskMotion,eN=t.popupTransitionName,eP=t.popupAnimation,eF=t.maskTransitionName,eT=t.maskAnimation,eA=t.className,e_=t.getTriggerDOMNode,eB=(0,a.Z)(t,z),eH=v.useState(!1),ez=(0,o.Z)(eH,2),eL=ez[0],eD=ez[1];(0,m.Z)(function(){eD((0,g.Z)())},[]);var eW=v.useRef({}),eV=v.useContext(S),eq=v.useMemo(function(){return{registerSubPopup:function(e,t){eW.current[e]=t,null==eV||eV.registerSubPopup(e,t)}}},[eV]),eX=(0,p.Z)(),eG=v.useState(null),eU=(0,o.Z)(eG,2),e$=eU[0],eK=eU[1],eY=v.useRef(null),eQ=(0,f.Z)(function(e){eY.current=e,(0,u.Sh)(e)&&e$!==e&&eK(e),null==eV||eV.registerSubPopup(eX,e)}),eJ=v.useState(null),e0=(0,o.Z)(eJ,2),e1=e0[0],e2=e0[1],e6=v.useRef(null),e5=(0,f.Z)(function(e){(0,u.Sh)(e)&&e1!==e&&(e2(e),e6.current=e)}),e4=v.Children.only(K),e3=(null==e4?void 0:e4.props)||{},e7={},e9=(0,f.Z)(function(e){var t,n;return(null==e1?void 0:e1.contains(e))||(null===(t=(0,d.A)(e1))||void 0===t?void 0:t.host)===e||e===e1||(null==e$?void 0:e$.contains(e))||(null===(n=(0,d.A)(e$))||void 0===n?void 0:n.host)===e||e===e$||Object.values(eW.current).some(function(t){return(null==t?void 0:t.contains(e))||e===t})}),e8=j($,eM,eP,eN),te=j($,eR,eT,eF),tt=v.useState(et||!1),tn=(0,o.Z)(tt,2),tr=tn[0],to=tn[1],ta=null!=ee?ee:tr,ti=(0,f.Z)(function(e){void 0===ee&&to(e)});(0,m.Z)(function(){to(ee||!1)},[ee]);var tc=v.useRef(ta);tc.current=ta;var tl=v.useRef([]);tl.current=[];var ts=(0,f.Z)(function(e){var t;ti(e),(null!==(t=tl.current[tl.current.length-1])&&void 0!==t?t:ta)!==e&&(tl.current.push(e),null==en||en(e))}),tu=v.useRef(),td=function(){clearTimeout(tu.current)},tf=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;td(),0===t?ts(e):tu.current=setTimeout(function(){ts(e)},1e3*t)};v.useEffect(function(){return td},[]);var tp=v.useState(!1),tm=(0,o.Z)(tp,2),tg=tm[0],tv=tm[1];(0,m.Z)(function(e){(!e||ta)&&tv(!0)},[ta]);var th=v.useState(null),tb=(0,o.Z)(th,2),ty=tb[0],tx=tb[1],tw=v.useState(null),tE=(0,o.Z)(tw,2),tC=tE[0],tZ=tE[1],tS=function(e){tZ([e.clientX,e.clientY])},tO=(i=eO&&null!==tC?tC:e1,c=v.useState({ready:!1,offsetX:0,offsetY:0,offsetR:0,offsetB:0,arrowX:0,arrowY:0,scaleX:1,scaleY:1,align:ex[eb]||{}}),b=(h=(0,o.Z)(c,2))[0],y=h[1],x=v.useRef(0),w=v.useMemo(function(){return e$?M(e$):[]},[e$]),E=v.useRef({}),ta||(E.current={}),N=(0,f.Z)(function(){if(e$&&i&&ta){var e=e$.ownerDocument,t=I(e$),n=t.getComputedStyle(e$).position,a=e$.style.left,c=e$.style.top,l=e$.style.right,s=e$.style.bottom,d=e$.style.overflow,f=(0,r.Z)((0,r.Z)({},ex[eb]),ew),p=e.createElement("div");if(null===(b=e$.parentElement)||void 0===b||b.appendChild(p),p.style.left="".concat(e$.offsetLeft,"px"),p.style.top="".concat(e$.offsetTop,"px"),p.style.position=n,p.style.height="".concat(e$.offsetHeight,"px"),p.style.width="".concat(e$.offsetWidth,"px"),e$.style.left="0",e$.style.top="0",e$.style.right="auto",e$.style.bottom="auto",e$.style.overflow="hidden",Array.isArray(i))S={x:i[0],y:i[1],width:0,height:0};else{var m,g,v,h,b,x,C,Z,S,O,j,M=i.getBoundingClientRect();M.x=null!==(O=M.x)&&void 0!==O?O:M.left,M.y=null!==(j=M.y)&&void 0!==j?j:M.top,S={x:M.x,y:M.y,width:M.width,height:M.height}}var N=e$.getBoundingClientRect(),F=t.getComputedStyle(e$),H=F.height,z=F.width;N.x=null!==(x=N.x)&&void 0!==x?x:N.left,N.y=null!==(C=N.y)&&void 0!==C?C:N.top;var L=e.documentElement,D=L.clientWidth,W=L.clientHeight,V=L.scrollWidth,q=L.scrollHeight,X=L.scrollTop,G=L.scrollLeft,U=N.height,$=N.width,K=S.height,Y=S.width,Q=f.htmlRegion,J="visible",ee="visibleFirst";"scroll"!==Q&&Q!==ee&&(Q=J);var et=Q===ee,en=P({left:-G,top:-X,right:V-G,bottom:q-X},w),er=P({left:0,top:0,right:D,bottom:W},w),eo=Q===J?er:en,ea=et?er:eo;e$.style.left="auto",e$.style.top="auto",e$.style.right="0",e$.style.bottom="0";var ei=e$.getBoundingClientRect();e$.style.left=a,e$.style.top=c,e$.style.right=l,e$.style.bottom=s,e$.style.overflow=d,null===(Z=e$.parentElement)||void 0===Z||Z.removeChild(p);var ec=R(Math.round($/parseFloat(z)*1e3)/1e3),el=R(Math.round(U/parseFloat(H)*1e3)/1e3);if(!(0===ec||0===el||(0,u.Sh)(i)&&!(0,k.Z)(i))){var es=f.offset,eu=f.targetOffset,ed=T(N,es),ef=(0,o.Z)(ed,2),ep=ef[0],em=ef[1],eg=T(S,eu),ev=(0,o.Z)(eg,2),eh=ev[0],ey=ev[1];S.x-=eh,S.y-=ey;var eE=f.points||[],eC=(0,o.Z)(eE,2),eZ=eC[0],eS=A(eC[1]),eO=A(eZ),ek=_(S,eS),eI=_(N,eO),eM=(0,r.Z)({},f),eR=ek.x-eI.x+ep,eN=ek.y-eI.y+em,eP=tc(eR,eN),eF=tc(eR,eN,er),eT=_(S,["t","l"]),eA=_(N,["t","l"]),e_=_(S,["b","r"]),eB=_(N,["b","r"]),eH=f.overflow||{},ez=eH.adjustX,eL=eH.adjustY,eD=eH.shiftX,eW=eH.shiftY,eV=function(e){return"boolean"==typeof e?e:e>=0};tl();var eq=eV(eL),eX=eO[0]===eS[0];if(eq&&"t"===eO[0]&&(g>ea.bottom||E.current.bt)){var eG=eN;eX?eG-=U-K:eG=eT.y-eB.y-em;var eU=tc(eR,eG),eK=tc(eR,eG,er);eU>eP||eU===eP&&(!et||eK>=eF)?(E.current.bt=!0,eN=eG,em=-em,eM.points=[B(eO,0),B(eS,0)]):E.current.bt=!1}if(eq&&"b"===eO[0]&&(meP||eQ===eP&&(!et||eJ>=eF)?(E.current.tb=!0,eN=eY,em=-em,eM.points=[B(eO,0),B(eS,0)]):E.current.tb=!1}var e0=eV(ez),e1=eO[1]===eS[1];if(e0&&"l"===eO[1]&&(h>ea.right||E.current.rl)){var e2=eR;e1?e2-=$-Y:e2=eT.x-eB.x-ep;var e6=tc(e2,eN),e5=tc(e2,eN,er);e6>eP||e6===eP&&(!et||e5>=eF)?(E.current.rl=!0,eR=e2,ep=-ep,eM.points=[B(eO,1),B(eS,1)]):E.current.rl=!1}if(e0&&"r"===eO[1]&&(veP||e3===eP&&(!et||e7>=eF)?(E.current.lr=!0,eR=e4,ep=-ep,eM.points=[B(eO,1),B(eS,1)]):E.current.lr=!1}tl();var e9=!0===eD?0:eD;"number"==typeof e9&&(ver.right&&(eR-=h-er.right-ep,S.x>er.right-e9&&(eR+=S.x-er.right+e9)));var e8=!0===eW?0:eW;"number"==typeof e8&&(mer.bottom&&(eN-=g-er.bottom-em,S.y>er.bottom-e8&&(eN+=S.y-er.bottom+e8)));var te=N.x+eR,tt=N.y+eN,tn=S.x,tr=S.y;null==ej||ej(e$,eM);var to=ei.right-N.x-(eR+N.width),ti=ei.bottom-N.y-(eN+N.height);1===ec&&(eR=Math.round(eR),to=Math.round(to)),1===el&&(eN=Math.round(eN),ti=Math.round(ti)),y({ready:!0,offsetX:eR/ec,offsetY:eN/el,offsetR:to/ec,offsetB:ti/el,arrowX:((Math.max(te,tn)+Math.min(te+$,tn+Y))/2-te)/ec,arrowY:((Math.max(tt,tr)+Math.min(tt+U,tr+K))/2-tt)/el,scaleX:ec,scaleY:el,align:eM})}function tc(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:eo,r=N.x+e,o=N.y+t,a=Math.max(r,n.left),i=Math.max(o,n.top);return Math.max(0,(Math.min(r+$,n.right)-a)*(Math.min(o+U,n.bottom)-i))}function tl(){g=(m=N.y+eN)+U,h=(v=N.x+eR)+$}}}),F=function(){y(function(e){return(0,r.Z)((0,r.Z)({},e),{},{ready:!1})})},(0,m.Z)(F,[eb]),(0,m.Z)(function(){ta||F()},[ta]),[b.ready,b.offsetX,b.offsetY,b.offsetR,b.offsetB,b.arrowX,b.arrowY,b.scaleX,b.scaleY,b.align,function(){x.current+=1;var e=x.current;Promise.resolve().then(function(){x.current===e&&N()})}]),tk=(0,o.Z)(tO,11),tj=tk[0],tI=tk[1],tM=tk[2],tR=tk[3],tN=tk[4],tP=tk[5],tF=tk[6],tT=tk[7],tA=tk[8],t_=tk[9],tB=tk[10],tH=(L=void 0===Y?"hover":Y,v.useMemo(function(){var e=O(null!=Q?Q:L),t=O(null!=J?J:L),n=new Set(e),r=new Set(t);return eL&&(n.has("hover")&&(n.delete("hover"),n.add("click")),r.has("hover")&&(r.delete("hover"),r.add("click"))),[n,r]},[eL,L,Q,J])),tz=(0,o.Z)(tH,2),tL=tz[0],tD=tz[1],tW=tL.has("click"),tV=tD.has("click")||tD.has("contextMenu"),tq=(0,f.Z)(function(){tg||tB()});D=function(){tc.current&&eO&&tV&&tf(!1)},(0,m.Z)(function(){if(ta&&e1&&e$){var e=M(e1),t=M(e$),n=I(e$),r=new Set([n].concat((0,H.Z)(e),(0,H.Z)(t)));function o(){tq(),D()}return r.forEach(function(e){e.addEventListener("scroll",o,{passive:!0})}),n.addEventListener("resize",o,{passive:!0}),tq(),function(){r.forEach(function(e){e.removeEventListener("scroll",o),n.removeEventListener("resize",o)})}}},[ta,e1,e$]),(0,m.Z)(function(){tq()},[tC,eb]),(0,m.Z)(function(){ta&&!(null!=ex&&ex[eb])&&tq()},[JSON.stringify(ew)]);var tX=v.useMemo(function(){var e=function(e,t,n,r){for(var o=n.points,a=Object.keys(e),i=0;i0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0;return n?e[0]===t[0]:e[0]===t[0]&&e[1]===t[1]}(null===(c=e[l])||void 0===c?void 0:c.points,o,r))return"".concat(t,"-placement-").concat(l)}return""}(ex,$,t_,eO);return l()(e,null==eZ?void 0:eZ(t_))},[t_,eZ,ex,$,eO]);v.useImperativeHandle(n,function(){return{nativeElement:e6.current,popupElement:eY.current,forceAlign:tq}});var tG=v.useState(0),tU=(0,o.Z)(tG,2),t$=tU[0],tK=tU[1],tY=v.useState(0),tQ=(0,o.Z)(tY,2),tJ=tQ[0],t0=tQ[1],t1=function(){if(eC&&e1){var e=e1.getBoundingClientRect();tK(e.width),t0(e.height)}};function t2(e,t,n,r){e7[e]=function(o){var a;null==r||r(o),tf(t,n);for(var i=arguments.length,c=Array(i>1?i-1:0),l=1;l1?n-1:0),o=1;o1?n-1:0),o=1;o{var t=(0,r._T)(e,[]);return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),o.createElement("path",{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM11 15V17H13V15H11ZM11 7V13H13V7H11Z"}))},i=e=>{var t=(0,r._T)(e,[]);return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),o.createElement("path",{d:"M1.18164 12C2.12215 6.87976 6.60812 3 12.0003 3C17.3924 3 21.8784 6.87976 22.8189 12C21.8784 17.1202 17.3924 21 12.0003 21C6.60812 21 2.12215 17.1202 1.18164 12ZM12.0003 17C14.7617 17 17.0003 14.7614 17.0003 12C17.0003 9.23858 14.7617 7 12.0003 7C9.23884 7 7.00026 9.23858 7.00026 12C7.00026 14.7614 9.23884 17 12.0003 17ZM12.0003 15C10.3434 15 9.00026 13.6569 9.00026 12C9.00026 10.3431 10.3434 9 12.0003 9C13.6571 9 15.0003 10.3431 15.0003 12C15.0003 13.6569 13.6571 15 12.0003 15Z"}))},c=e=>{var t=(0,r._T)(e,[]);return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),o.createElement("path",{d:"M4.52047 5.93457L1.39366 2.80777L2.80788 1.39355L22.6069 21.1925L21.1927 22.6068L17.8827 19.2968C16.1814 20.3755 14.1638 21.0002 12.0003 21.0002C6.60812 21.0002 2.12215 17.1204 1.18164 12.0002C1.61832 9.62282 2.81932 7.5129 4.52047 5.93457ZM14.7577 16.1718L13.2937 14.7078C12.902 14.8952 12.4634 15.0002 12.0003 15.0002C10.3434 15.0002 9.00026 13.657 9.00026 12.0002C9.00026 11.537 9.10522 11.0984 9.29263 10.7067L7.82866 9.24277C7.30514 10.0332 7.00026 10.9811 7.00026 12.0002C7.00026 14.7616 9.23884 17.0002 12.0003 17.0002C13.0193 17.0002 13.9672 16.6953 14.7577 16.1718ZM7.97446 3.76015C9.22127 3.26959 10.5793 3.00016 12.0003 3.00016C17.3924 3.00016 21.8784 6.87992 22.8189 12.0002C22.5067 13.6998 21.8038 15.2628 20.8068 16.5925L16.947 12.7327C16.9821 12.4936 17.0003 12.249 17.0003 12.0002C17.0003 9.23873 14.7617 7.00016 12.0003 7.00016C11.7514 7.00016 11.5068 7.01833 11.2677 7.05343L7.97446 3.76015Z"}))};var l=n(96398),s=n(13241),u=n(1153);let d=o.forwardRef((e,t)=>{let{value:n,defaultValue:d,type:f,placeholder:p="Type...",icon:m,error:g=!1,errorMessage:v,disabled:h=!1,stepper:b,makeInputClassName:y,className:x,onChange:w,onValueChange:E,autoFocus:C,pattern:Z}=e,S=(0,r._T)(e,["value","defaultValue","type","placeholder","icon","error","errorMessage","disabled","stepper","makeInputClassName","className","onChange","onValueChange","autoFocus","pattern"]),[O,k]=(0,o.useState)(C||!1),[j,I]=(0,o.useState)(!1),M=(0,o.useCallback)(()=>I(!j),[j,I]),R=(0,o.useRef)(null),N=(0,l.Uh)(n||d);return o.useEffect(()=>{let e=()=>k(!0),t=()=>k(!1),n=R.current;return n&&(n.addEventListener("focus",e),n.addEventListener("blur",t),C&&n.focus()),()=>{n&&(n.removeEventListener("focus",e),n.removeEventListener("blur",t))}},[C]),o.createElement(o.Fragment,null,o.createElement("div",{className:(0,s.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,l.um)(N,h,g),O&&(0,s.q)("ring-2","border-tremor-brand-subtle ring-tremor-brand-muted","dark:border-dark-tremor-brand-subtle dark:ring-dark-tremor-brand-muted"),x)},m?o.createElement(m,{className:(0,s.q)(y("icon"),"shrink-0 h-5 w-5 mx-2.5 absolute left-0 flex items-center","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")}):null,o.createElement("input",Object.assign({ref:(0,u.lq)([R,t]),defaultValue:d,value:n,type:j?"text":f,className:(0,s.q)(y("input"),"w-full bg-transparent focus:outline-none focus:ring-0 border-none 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","password"===f?g?"pr-16":"pr-12":g?"pr-8":"pr-3",m?"pl-10":"pl-3",h?"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:h,"data-testid":"base-input",onChange:e=>{null==w||w(e),null==E||E(e.target.value)},pattern:Z},S)),"password"!==f||h?null:o.createElement("button",{className:(0,s.q)(y("toggleButton"),"absolute inset-y-0 right-0 flex items-center px-2.5 rounded-lg"),type:"button",onClick:()=>M(),"aria-label":j?"Hide password":"Show Password"},j?o.createElement(c,{className:(0,s.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,s.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(a,{className:(0,s.q)(y("errorIcon"),"text-red-500 shrink-0 h-5 w-5 absolute right-0 flex items-center","password"===f?"mr-10":"number"===f?b?"mr-20":"mr-3":"mx-2.5")}):null,null!=b?b:null),g&&v?o.createElement("p",{className:(0,s.q)(y("errorMessage"),"text-sm text-red-500 mt-1")},v):null)});d.displayName="BaseInput"},49566:function(e,t,n){"use strict";n.d(t,{Z:function(){return l}});var r=n(5853),o=n(2265);n(13241);var a=n(1153),i=n(69262);let c=(0,a.fn)("TextInput"),l=o.forwardRef((e,t)=>{let{type:n="text"}=e,a=(0,r._T)(e,["type"]);return o.createElement(i.Z,Object.assign({ref:t,type:n,makeInputClassName:c},a))});l.displayName="TextInput"},96398:function(e,t,n){"use strict";n.d(t,{Uh:function(){return s},n0:function(){return c},qg:function(){return a},sl:function(){return i},um:function(){return l}});var r=n(13241),o=n(2265);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 i(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 l=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 placeholder:text-red-500 dark:text-red-500 dark:placeholder:text-red-500",n?"border-red-500 dark:border-red-500":"border-tremor-border dark:border-dark-tremor-border")};function s(e){return null!=e&&""!==e}},391:function(e,t,n){"use strict";var r=n(2265),o=n(39109),a=n(77685);t.Z=e=>{let{space:t,form:n,children:i}=e;if(null==i)return null;let c=i;return n&&(c=r.createElement(o.Ux,{override:!0,status:!0},c)),t&&(c=r.createElement(a.BR,null,c)),c}},93942:function(e,t,n){"use strict";n.d(t,{i:function(){return c}});var r=n(2265),o=n(50506),a=n(18310),i=n(71744);function c(e){return t=>r.createElement(a.ZP,{theme:{token:{motion:!1,zIndexPopupBase:0}}},r.createElement(e,Object.assign({},t)))}t.Z=(e,t,n,a,l)=>c(c=>{let{prefixCls:s,style:u}=c,d=r.useRef(null),[f,p]=r.useState(0),[m,g]=r.useState(0),[v,h]=(0,o.Z)(!1,{value:c.open}),{getPrefixCls:b}=r.useContext(i.E_),y=b(a||"select",s);r.useEffect(()=>{if(h(!0),"undefined"!=typeof ResizeObserver){let e=new ResizeObserver(e=>{let t=e[0].target;p(t.offsetHeight+8),g(t.offsetWidth)}),t=setInterval(()=>{var n;let r=l?".".concat(l(y)):".".concat(y,"-dropdown"),o=null===(n=d.current)||void 0===n?void 0:n.querySelector(r);o&&(clearInterval(t),e.observe(o))},10);return()=>{clearInterval(t),e.disconnect()}}},[y]);let x=Object.assign(Object.assign({},c),{style:Object.assign(Object.assign({},u),{margin:0}),open:v,visible:v,getPopupContainer:()=>d.current});return n&&(x=n(x)),t&&Object.assign(x,{[t]:{overflow:{adjustX:!1,adjustY:!1}}}),r.createElement("div",{ref:d,style:{paddingBottom:f,position:"relative",minWidth:m}},r.createElement(e,Object.assign({},x)))})},93350:function(e,t,n){"use strict";n.d(t,{o2:function(){return c},yT:function(){return l}});var r=n(83145),o=n(53454);let a=o.i.map(e=>"".concat(e,"-inverse")),i=["success","processing","error","default","warning"];function c(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return t?[].concat((0,r.Z)(a),(0,r.Z)(o.i)).includes(e):o.i.includes(e)}function l(e){return i.includes(e)}},94611:function(e,t,n){"use strict";var r=n(2265),o=n(39725);t.Z=e=>{let t;return"object"==typeof e&&(null==e?void 0:e.clearIcon)?t=e:e&&(t={clearIcon:r.createElement(o.Z,null)}),t}},51646:function(e,t,n){"use strict";n.d(t,{N:function(){return o}});var r=n(2265);let o=()=>r.useReducer(e=>e+1,0)},62236:function(e,t,n){"use strict";n.d(t,{Cn:function(){return s},u6:function(){return i}});var r=n(2265),o=n(84951),a=n(95140);let i=1e3,c={Modal:100,Drawer:100,Popover:100,Popconfirm:100,Tooltip:100,Tour:100,FloatButton:100},l={SelectLike:50,Dropdown:50,DatePicker:50,Menu:50,ImagePreview:1},s=(e,t)=>{let n;let[,i]=(0,o.ZP)(),s=r.useContext(a.Z);if(void 0!==t)n=[t,t];else{let r=null!=s?s:0;e in c?r+=(s?0:i.zIndexPopupBase)+c[e]:r+=l[e],n=[void 0===s?t:r,r]}return n}},16774:function(e,t,n){"use strict";n.d(t,{h:function(){return o},x:function(){return r}});let r=(e,t)=>{void 0!==(null==e?void 0:e.addEventListener)?e.addEventListener("change",t):void 0!==(null==e?void 0:e.addListener)&&e.addListener(t)},o=(e,t)=>{void 0!==(null==e?void 0:e.removeEventListener)?e.removeEventListener("change",t):void 0!==(null==e?void 0:e.removeListener)&&e.removeListener(t)}},68710:function(e,t,n){"use strict";n.d(t,{m:function(){return l}});var r=n(71744);let o=()=>({height:0,opacity:0}),a=e=>{let{scrollHeight:t}=e;return{height:t,opacity:1}},i=e=>({height:e?e.offsetHeight:0}),c=(e,t)=>(null==t?void 0:t.deadline)===!0||"height"===t.propertyName,l=(e,t,n)=>void 0!==n?n:"".concat(e,"-").concat(t);t.Z=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r.Rf;return{motionName:"".concat(e,"-motion-collapse"),onAppearStart:o,onEnterStart:o,onAppearActive:a,onEnterActive:a,onLeaveStart:i,onLeaveActive:o,onAppearEnd:c,onEnterEnd:c,onLeaveEnd:c,motionDeadline:500}}},92736:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(88260);let o={left:{points:["cr","cl"]},right:{points:["cl","cr"]},top:{points:["bc","tc"]},bottom:{points:["tc","bc"]},topLeft:{points:["bl","tl"]},leftTop:{points:["tr","tl"]},topRight:{points:["br","tr"]},rightTop:{points:["tl","tr"]},bottomRight:{points:["tr","br"]},rightBottom:{points:["bl","br"]},bottomLeft:{points:["tl","bl"]},leftBottom:{points:["br","bl"]}},a={topLeft:{points:["bl","tc"]},leftTop:{points:["tr","cl"]},topRight:{points:["br","tc"]},rightTop:{points:["tl","cr"]},bottomRight:{points:["tr","bc"]},rightBottom:{points:["bl","cr"]},bottomLeft:{points:["tl","bc"]},leftBottom:{points:["br","cl"]}},i=new Set(["topLeft","topRight","bottomLeft","bottomRight","leftTop","leftBottom","rightTop","rightBottom"]);function c(e){let{arrowWidth:t,autoAdjustOverflow:n,arrowPointAtCenter:c,offset:l,borderRadius:s,visibleFirst:u}=e,d=t/2,f={},p=(0,r.wZ)({contentRadius:s,limitVerticalRadius:!0});return Object.keys(o).forEach(e=>{let r=Object.assign(Object.assign({},c&&a[e]||o[e]),{offset:[0,0],dynamicInset:!0});switch(f[e]=r,i.has(e)&&(r.autoArrow=!1),e){case"top":case"topLeft":case"topRight":r.offset[1]=-d-l;break;case"bottom":case"bottomLeft":case"bottomRight":r.offset[1]=d+l;break;case"left":case"leftTop":case"leftBottom":r.offset[0]=-d-l;break;case"right":case"rightTop":case"rightBottom":r.offset[0]=d+l}if(c)switch(e){case"topLeft":case"bottomLeft":r.offset[0]=-p.arrowOffsetHorizontal-d;break;case"topRight":case"bottomRight":r.offset[0]=p.arrowOffsetHorizontal+d;break;case"leftTop":case"rightTop":r.offset[1]=-(2*p.arrowOffsetHorizontal)+d;break;case"leftBottom":case"rightBottom":r.offset[1]=2*p.arrowOffsetHorizontal-d}r.overflow=function(e,t,n,r){if(!1===r)return{adjustX:!1,adjustY:!1};let o={};switch(e){case"top":case"bottom":o.shiftX=2*t.arrowOffsetHorizontal+n,o.shiftY=!0,o.adjustY=!0;break;case"left":case"right":o.shiftY=2*t.arrowOffsetVertical+n,o.shiftX=!0,o.adjustX=!0}let a=Object.assign(Object.assign({},o),r&&"object"==typeof r?r:{});return a.shiftX||(a.adjustX=!0),a.shiftY||(a.adjustY=!0),a}(e,p,t,n),u&&(r.htmlRegion="visibleFirst")}),f}},19722:function(e,t,n){"use strict";n.d(t,{M2:function(){return o},Tm:function(){return i},wm:function(){return a}});var r=n(2265);function o(e){return e&&r.isValidElement(e)&&e.type===r.Fragment}let a=(e,t,n)=>r.isValidElement(e)?r.cloneElement(e,"function"==typeof n?n(e.props||{}):n):t;function i(e,t){return a(e,e,t)}},6543:function(e,t,n){"use strict";n.d(t,{c4:function(){return i},m9:function(){return s}});var r=n(2265),o=n(84951),a=n(16774);let i=["xxl","xl","lg","md","sm","xs"],c=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)")}),l=e=>{let t=[].concat(i).reverse();return t.forEach((n,r)=>{let o=n.toUpperCase(),a="screen".concat(o,"Min"),i="screen".concat(o);if(!(e[a]<=e[i]))throw Error("".concat(a,"<=").concat(i," fails : !(").concat(e[a],"<=").concat(e[i],")"));if(r{if(t){for(let n of i)if(e[n]&&(null==t?void 0:t[n])!==void 0)return t[n]}};t.ZP=()=>{let[,e]=(0,o.ZP)(),t=c(l(e));return r.useMemo(()=>{let e=new Map,n=-1,r={};return{responsiveMap:t,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()},register(){Object.entries(t).forEach(e=>{let[t,n]=e,o=e=>{let{matches:n}=e;this.dispatch(Object.assign(Object.assign({},r),{[t]:n}))},i=window.matchMedia(n);(0,a.x)(i,o),this.matchHandlers[n]={mql:i,listener:o},o(i)})},unregister(){Object.values(t).forEach(e=>{let t=this.matchHandlers[e];(0,a.h)(null==t?void 0:t.mql,null==t?void 0:t.listener)}),e.clear()}}},[t])}},12757:function(e,t,n){"use strict";n.d(t,{F:function(){return i},Z:function(){return a}});var r=n(36760),o=n.n(r);function a(e,t,n){return o()({["".concat(e,"-status-success")]:"success"===t,["".concat(e,"-status-warning")]:"warning"===t,["".concat(e,"-status-error")]:"error"===t,["".concat(e,"-status-validating")]:"validating"===t,["".concat(e,"-has-feedback")]:n})}let i=(e,t)=>t||e},13613:function(e,t,n){"use strict";n.d(t,{G8:function(){return a},ln:function(){return i}});var r=n(2265);function o(){}n(32559);let a=r.createContext({}),i=()=>{let e=()=>{};return e.deprecated=o,e}},6694:function(e,t,n){"use strict";n.d(t,{Z:function(){return E}});var r=n(2265),o=n(36760),a=n.n(o),i=n(2857),c=n(28791),l=n(71744),s=n(19722),u=(0,n(99320).A1)("Wave",e=>{let{componentCls:t,colorPrimary:n}=e;return{[t]:{position:"absolute",background:"transparent",pointerEvents:"none",boxSizing:"border-box",color:"var(--wave-color, ".concat(n,")"),boxShadow:"0 0 0 0 currentcolor",opacity:.2,"&.wave-motion-appear":{transition:["box-shadow 0.4s ".concat(e.motionEaseOutCirc),"opacity 2s ".concat(e.motionEaseOutCirc)].join(","),"&-active":{boxShadow:"0 0 0 6px currentcolor",opacity:0},"&.wave-quick":{transition:["box-shadow ".concat(e.motionDurationSlow," ").concat(e.motionEaseInOut),"opacity ".concat(e.motionDurationSlow," ").concat(e.motionEaseInOut)].join(",")}}}}}),d=n(58525),f=n(53346),p=n(84951),m=n(34709),g=n(66632),v=n(66061);function h(e){return e&&"#fff"!==e&&"#ffffff"!==e&&"rgb(255, 255, 255)"!==e&&"rgba(255, 255, 255, 1)"!==e&&!/rgba\((?:\d*, ){3}0\)/.test(e)&&"transparent"!==e&&"canvastext"!==e}function b(e){return Number.isNaN(e)?0:e}let y=e=>{let{className:t,target:n,component:o,registerUnmount:i}=e,l=r.useRef(null),s=r.useRef(null);r.useEffect(()=>{s.current=i()},[]);let[u,d]=r.useState(null),[p,v]=r.useState([]),[y,x]=r.useState(0),[w,E]=r.useState(0),[C,Z]=r.useState(0),[S,O]=r.useState(0),[k,j]=r.useState(!1),I={left:y,top:w,width:C,height:S,borderRadius:p.map(e=>"".concat(e,"px")).join(" ")};function M(){let e=getComputedStyle(n);d(function(e){var t;let{borderTopColor:n,borderColor:r,backgroundColor:o}=getComputedStyle(e);return null!==(t=[n,r,o].find(h))&&void 0!==t?t:null}(n));let t="static"===e.position,{borderLeftWidth:r,borderTopWidth:o}=e;x(t?n.offsetLeft:b(-Number.parseFloat(r))),E(t?n.offsetTop:b(-Number.parseFloat(o))),Z(n.offsetWidth),O(n.offsetHeight);let{borderTopLeftRadius:a,borderTopRightRadius:i,borderBottomLeftRadius:c,borderBottomRightRadius:l}=e;v([a,i,l,c].map(e=>b(Number.parseFloat(e))))}if(u&&(I["--wave-color"]=u),r.useEffect(()=>{if(n){let e;let t=(0,f.Z)(()=>{M(),j(!0)});return"undefined"!=typeof ResizeObserver&&(e=new ResizeObserver(M)).observe(n),()=>{f.Z.cancel(t),null==e||e.disconnect()}}},[n]),!k)return null;let R=("Checkbox"===o||"Radio"===o)&&(null==n?void 0:n.classList.contains(m.A));return r.createElement(g.ZP,{visible:!0,motionAppear:!0,motionName:"wave-motion",motionDeadline:5e3,onAppearEnd:(e,t)=>{var n,r;if(t.deadline||"opacity"===t.propertyName){let e=null===(n=l.current)||void 0===n?void 0:n.parentElement;null===(r=s.current)||void 0===r||r.call(s).then(()=>{null==e||e.remove()})}return!1}},(e,n)=>{let{className:o}=e;return r.createElement("div",{ref:(0,c.sQ)(l,n),className:a()(t,o,{"wave-quick":R}),style:I})})};var x=(e,t)=>{var n;let{component:o}=t;if("Checkbox"===o&&!(null===(n=e.querySelector("input"))||void 0===n?void 0:n.checked))return;let a=document.createElement("div");a.style.position="absolute",a.style.left="0px",a.style.top="0px",null==e||e.insertBefore(a,null==e?void 0:e.firstChild);let i=(0,v.q)(),c=null;c=i(r.createElement(y,Object.assign({},t,{target:e,registerUnmount:function(){return c}})),a)},w=(e,t,n)=>{let{wave:o}=r.useContext(l.E_),[,a,i]=(0,p.ZP)(),c=(0,d.Z)(r=>{let c=e.current;if((null==o?void 0:o.disabled)||!c)return;let l=c.querySelector(".".concat(m.A))||c,{showEffect:s}=o||{};(s||x)(l,{className:t,token:a,component:n,event:r,hashId:i})}),s=r.useRef(null);return e=>{f.Z.cancel(s.current),s.current=(0,f.Z)(()=>{c(e)})}},E=e=>{let{children:t,disabled:n,component:o}=e,{getPrefixCls:d}=(0,r.useContext)(l.E_),f=(0,r.useRef)(null),p=d("wave"),[,m]=u(p),g=w(f,a()(p,m),o);if(r.useEffect(()=>{let e=f.current;if(!e||e.nodeType!==window.Node.ELEMENT_NODE||n)return;let t=t=>{!(0,i.Z)(t.target)||!e.getAttribute||e.getAttribute("disabled")||e.disabled||e.className.includes("disabled")&&!e.className.includes("disabled:")||"true"===e.getAttribute("aria-disabled")||e.className.includes("-leave")||g(t)};return e.addEventListener("click",t,!0),()=>{e.removeEventListener("click",t,!0)}},[n]),!r.isValidElement(t))return null!=t?t:null;let v=(0,c.Yr)(t)?(0,c.sQ)((0,c.C4)(t),f):f;return(0,s.Tm)(t,{ref:v})}},34709:function(e,t,n){"use strict";n.d(t,{A:function(){return o}});var r=n(71744);let o="".concat(r.Rf,"-wave-target")},95140:function(e,t,n){"use strict";let r=n(2265).createContext(void 0);t.Z=r},52402:function(e,t,n){"use strict";n.d(t,{J:function(){return r}});let r=n(2265).createContext({})},51248:function(e,t,n){"use strict";n.d(t,{Dn:function(){return d},aG:function(){return l},hU:function(){return f},nx:function(){return s}});var r=n(83145),o=n(2265),a=n(19722),i=n(53454);let c=/^[\u4E00-\u9FA5]{2}$/,l=c.test.bind(c);function s(e){return"danger"===e?{danger:!0}:{type:e}}function u(e){return"string"==typeof e}function d(e){return"text"===e||"link"===e}function f(e,t){let n=!1,r=[];return o.Children.forEach(e,e=>{let t=typeof e,o="string"===t||"number"===t;if(n&&o){let t=r.length-1,n=r[t];r[t]="".concat(n).concat(e)}else r.push(e);n=o}),o.Children.map(r,e=>(function(e,t){if(null==e)return;let n=t?" ":"";return"string"!=typeof e&&"number"!=typeof e&&u(e.type)&&l(e.props.children)?(0,a.Tm)(e,{children:e.props.children.split("").join(n)}):u(e)?l(e)?o.createElement("span",null,e.split("").join(n)):o.createElement("span",null,e):(0,a.M2)(e)?o.createElement("span",null,e):e})(e,t))}["default","primary","danger"].concat((0,r.Z)(i.i))},5545:function(e,t,n){"use strict";n.d(t,{ZP:function(){return eh}});var r=n(2265),o=n(36760),a=n.n(o),i=n(27380),c=n(18694),l=n(28791),s=n(6694),u=n(71744),d=n(86586),f=n(33759),p=n(77685),m=n(84951),g=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 v=r.createContext(void 0);var h=n(51248),b=n(61935),y=n(66632);let x=(0,r.forwardRef)((e,t)=>{let{className:n,style:o,children:i,prefixCls:c}=e,l=a()("".concat(c,"-icon"),n);return r.createElement("span",{ref:t,className:l,style:o},i)}),w=(0,r.forwardRef)((e,t)=>{let{prefixCls:n,className:o,style:i,iconClassName:c}=e,l=a()("".concat(n,"-loading-icon"),o);return r.createElement(x,{prefixCls:n,className:l,style:i,ref:t},r.createElement(b.Z,{className:c}))}),E=()=>({width:0,opacity:0,transform:"scale(0)"}),C=e=>({width:e.scrollWidth,opacity:1,transform:"scale(1)"});var Z=e=>{let{prefixCls:t,loading:n,existIcon:o,className:i,style:c,mount:l}=e;return o?r.createElement(w,{prefixCls:t,className:i,style:c}):r.createElement(y.ZP,{visible:!!n,motionName:"".concat(t,"-loading-icon-motion"),motionAppear:!l,motionEnter:!l,motionLeave:!l,removeOnLeave:!0,onAppearStart:E,onAppearActive:C,onEnterStart:E,onEnterActive:C,onLeaveStart:C,onLeaveActive:E},(e,n)=>{let{className:o,style:l}=e,s=Object.assign(Object.assign({},c),l);return r.createElement(w,{prefixCls:t,className:a()(i,o),style:s,ref:n})})},S=n(93463),O=n(12918),k=n(53454),j=n(71140),I=n(99320);let M=(e,t)=>({["> span, > ".concat(e)]:{"&:not(:last-child)":{["&, & > ".concat(e)]:{"&:not(:disabled)":{borderInlineEndColor:t}}},"&:not(:first-child)":{["&, & > ".concat(e)]:{"&:not(:disabled)":{borderInlineStartColor:t}}}}});var R=e=>{let{componentCls:t,fontSize:n,lineWidth:r,groupBorderColor:o,colorErrorHover:a}=e;return{["".concat(t,"-group")]:[{position:"relative",display:"inline-flex",["> span, > ".concat(t)]:{"&:not(:last-child)":{["&, & > ".concat(t)]:{borderStartEndRadius:0,borderEndEndRadius:0}},"&:not(:first-child)":{marginInlineStart:e.calc(r).mul(-1).equal(),["&, & > ".concat(t)]:{borderStartStartRadius:0,borderEndStartRadius:0}}},[t]:{position:"relative",zIndex:1,"&:hover, &:focus, &:active":{zIndex:2},"&[disabled]":{zIndex:0}},["".concat(t,"-icon-only")]:{fontSize:n}},M("".concat(t,"-primary"),o),M("".concat(t,"-danger"),a)]}},N=n(11357),P=n(75669);n(50506);let F=(e,t)=>{let{r:n,g:r,b:o,a}=e.toRgb(),i=new P.Il(e.toRgbString()).onBackground(t).toHsv();return a<=.5?i.v>.5:.299*n+.587*r+.114*o>192};var T=n(1319),A=n(17431);let _=e=>{let{paddingInline:t,onlyIconSize:n}=e;return(0,j.IX)(e,{buttonPaddingHorizontal:t,buttonPaddingVertical:0,buttonIconOnlyFontSize:n})},B=e=>{var t,n,r,o,a,i;let c=null!==(t=e.contentFontSize)&&void 0!==t?t:e.fontSize,l=null!==(n=e.contentFontSizeSM)&&void 0!==n?n:e.fontSize,s=null!==(r=e.contentFontSizeLG)&&void 0!==r?r:e.fontSizeLG,u=null!==(o=e.contentLineHeight)&&void 0!==o?o:(0,T.D)(c),d=null!==(a=e.contentLineHeightSM)&&void 0!==a?a:(0,T.D)(l),f=null!==(i=e.contentLineHeightLG)&&void 0!==i?i:(0,T.D)(s),p=F(new N.y9(e.colorBgSolid),"#fff")?"#000":"#fff";return Object.assign(Object.assign({},k.i.reduce((t,n)=>Object.assign(Object.assign({},t),{["".concat(n,"ShadowColor")]:"0 ".concat((0,S.bf)(e.controlOutlineWidth)," 0 ").concat((0,A.Z)(e["".concat(n,"1")],e.colorBgContainer))}),{})),{fontWeight:400,iconGap:e.marginXS,defaultShadow:"0 ".concat(e.controlOutlineWidth,"px 0 ").concat(e.controlTmpOutline),primaryShadow:"0 ".concat(e.controlOutlineWidth,"px 0 ").concat(e.controlOutline),dangerShadow:"0 ".concat(e.controlOutlineWidth,"px 0 ").concat(e.colorErrorOutline),primaryColor:e.colorTextLightSolid,dangerColor:e.colorTextLightSolid,borderColorDisabled:e.colorBorder,defaultGhostColor:e.colorBgContainer,ghostBg:"transparent",defaultGhostBorderColor:e.colorBgContainer,paddingInline:e.paddingContentHorizontal-e.lineWidth,paddingInlineLG:e.paddingContentHorizontal-e.lineWidth,paddingInlineSM:8-e.lineWidth,onlyIconSize:"inherit",onlyIconSizeSM:"inherit",onlyIconSizeLG:"inherit",groupBorderColor:e.colorPrimaryHover,linkHoverBg:"transparent",textTextColor:e.colorText,textTextHoverColor:e.colorText,textTextActiveColor:e.colorText,textHoverBg:e.colorFillTertiary,defaultColor:e.colorText,defaultBg:e.colorBgContainer,defaultBorderColor:e.colorBorder,defaultBorderColorDisabled:e.colorBorder,defaultHoverBg:e.colorBgContainer,defaultHoverColor:e.colorPrimaryHover,defaultHoverBorderColor:e.colorPrimaryHover,defaultActiveBg:e.colorBgContainer,defaultActiveColor:e.colorPrimaryActive,defaultActiveBorderColor:e.colorPrimaryActive,solidTextColor:p,contentFontSize:c,contentFontSizeSM:l,contentFontSizeLG:s,contentLineHeight:u,contentLineHeightSM:d,contentLineHeightLG:f,paddingBlock:Math.max((e.controlHeight-c*u)/2-e.lineWidth,0),paddingBlockSM:Math.max((e.controlHeightSM-l*d)/2-e.lineWidth,0),paddingBlockLG:Math.max((e.controlHeightLG-s*f)/2-e.lineWidth,0)})},H=e=>{let{componentCls:t,iconCls:n,fontWeight:r,opacityLoading:o,motionDurationSlow:a,motionEaseInOut:i,iconGap:c,calc:l}=e;return{[t]:{outline:"none",position:"relative",display:"inline-flex",gap:c,alignItems:"center",justifyContent:"center",fontWeight:r,whiteSpace:"nowrap",textAlign:"center",backgroundImage:"none",background:"transparent",border:"".concat((0,S.bf)(e.lineWidth)," ").concat(e.lineType," transparent"),cursor:"pointer",transition:"all ".concat(e.motionDurationMid," ").concat(e.motionEaseInOut),userSelect:"none",touchAction:"manipulation",color:e.colorText,"&:disabled > *":{pointerEvents:"none"},["".concat(t,"-icon > svg")]:(0,O.Ro)(),"> a":{color:"currentColor"},"&:not(:disabled)":(0,O.Qy)(e),["&".concat(t,"-two-chinese-chars::first-letter")]:{letterSpacing:"0.34em"},["&".concat(t,"-two-chinese-chars > *:not(").concat(n,")")]:{marginInlineEnd:"-0.34em",letterSpacing:"0.34em"},["&".concat(t,"-icon-only")]:{paddingInline:0,["&".concat(t,"-compact-item")]:{flex:"none"}},["&".concat(t,"-loading")]:{opacity:o,cursor:"default"},["".concat(t,"-loading-icon")]:{transition:["width","opacity","margin"].map(e=>"".concat(e," ").concat(a," ").concat(i)).join(",")},["&:not(".concat(t,"-icon-end)")]:{["".concat(t,"-loading-icon-motion")]:{"&-appear-start, &-enter-start":{marginInlineEnd:l(c).mul(-1).equal()},"&-appear-active, &-enter-active":{marginInlineEnd:0},"&-leave-start":{marginInlineEnd:0},"&-leave-active":{marginInlineEnd:l(c).mul(-1).equal()}}},"&-icon-end":{flexDirection:"row-reverse",["".concat(t,"-loading-icon-motion")]:{"&-appear-start, &-enter-start":{marginInlineStart:l(c).mul(-1).equal()},"&-appear-active, &-enter-active":{marginInlineStart:0},"&-leave-start":{marginInlineStart:0},"&-leave-active":{marginInlineStart:l(c).mul(-1).equal()}}}}}},z=(e,t,n)=>({["&:not(:disabled):not(".concat(e,"-disabled)")]:{"&:hover":t,"&:active":n}}),L=e=>({minWidth:e.controlHeight,paddingInline:0,borderRadius:"50%"}),D=e=>({cursor:"not-allowed",borderColor:e.borderColorDisabled,color:e.colorTextDisabled,background:e.colorBgContainerDisabled,boxShadow:"none"}),W=(e,t,n,r,o,a,i,c)=>({["&".concat(e,"-background-ghost")]:Object.assign(Object.assign({color:n||void 0,background:t,borderColor:r||void 0,boxShadow:"none"},z(e,Object.assign({background:t},i),Object.assign({background:t},c))),{"&:disabled":{cursor:"not-allowed",color:o||void 0,borderColor:a||void 0}})}),V=e=>({["&:disabled, &".concat(e.componentCls,"-disabled")]:Object.assign({},D(e))}),q=e=>({["&:disabled, &".concat(e.componentCls,"-disabled")]:{cursor:"not-allowed",color:e.colorTextDisabled}}),X=(e,t,n,r)=>Object.assign(Object.assign({},(r&&["link","text"].includes(r)?q:V)(e)),z(e.componentCls,t,n)),G=(e,t,n,r,o)=>({["&".concat(e.componentCls,"-variant-solid")]:Object.assign({color:t,background:n},X(e,r,o))}),U=(e,t,n,r,o)=>({["&".concat(e.componentCls,"-variant-outlined, &").concat(e.componentCls,"-variant-dashed")]:Object.assign({borderColor:t,background:n},X(e,r,o))}),$=e=>({["&".concat(e.componentCls,"-variant-dashed")]:{borderStyle:"dashed"}}),K=(e,t,n,r)=>({["&".concat(e.componentCls,"-variant-filled")]:Object.assign({boxShadow:"none",background:t},X(e,n,r))}),Y=(e,t,n,r,o)=>({["&".concat(e.componentCls,"-variant-").concat(n)]:Object.assign({color:t,boxShadow:"none"},X(e,r,o,n))}),Q=e=>{let{componentCls:t}=e;return k.i.reduce((n,r)=>{let o=e["".concat(r,"6")],a=e["".concat(r,"1")],i=e["".concat(r,"5")],c=e["".concat(r,"2")],l=e["".concat(r,"3")],s=e["".concat(r,"7")];return Object.assign(Object.assign({},n),{["&".concat(t,"-color-").concat(r)]:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({color:o,boxShadow:e["".concat(r,"ShadowColor")]},G(e,e.colorTextLightSolid,o,{background:i},{background:s})),U(e,o,e.colorBgContainer,{color:i,borderColor:i,background:e.colorBgContainer},{color:s,borderColor:s,background:e.colorBgContainer})),$(e)),K(e,a,{color:o,background:c},{color:o,background:l})),Y(e,o,"link",{color:i},{color:s})),Y(e,o,"text",{color:i,background:a},{color:s,background:l}))})},{})},J=e=>Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({color:e.defaultColor,boxShadow:e.defaultShadow},G(e,e.solidTextColor,e.colorBgSolid,{color:e.solidTextColor,background:e.colorBgSolidHover},{color:e.solidTextColor,background:e.colorBgSolidActive})),$(e)),K(e,e.colorFillTertiary,{color:e.defaultColor,background:e.colorFillSecondary},{color:e.defaultColor,background:e.colorFill})),W(e.componentCls,e.ghostBg,e.defaultGhostColor,e.defaultGhostBorderColor,e.colorTextDisabled,e.colorBorder)),Y(e,e.textTextColor,"link",{color:e.colorLinkHover,background:e.linkHoverBg},{color:e.colorLinkActive})),ee=e=>Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({color:e.colorPrimary,boxShadow:e.primaryShadow},U(e,e.colorPrimary,e.colorBgContainer,{color:e.colorPrimaryTextHover,borderColor:e.colorPrimaryHover,background:e.colorBgContainer},{color:e.colorPrimaryTextActive,borderColor:e.colorPrimaryActive,background:e.colorBgContainer})),$(e)),K(e,e.colorPrimaryBg,{color:e.colorPrimary,background:e.colorPrimaryBgHover},{color:e.colorPrimary,background:e.colorPrimaryBorder})),Y(e,e.colorPrimaryText,"text",{color:e.colorPrimaryTextHover,background:e.colorPrimaryBg},{color:e.colorPrimaryTextActive,background:e.colorPrimaryBorder})),Y(e,e.colorPrimaryText,"link",{color:e.colorPrimaryTextHover,background:e.linkHoverBg},{color:e.colorPrimaryTextActive})),W(e.componentCls,e.ghostBg,e.colorPrimary,e.colorPrimary,e.colorTextDisabled,e.colorBorder,{color:e.colorPrimaryHover,borderColor:e.colorPrimaryHover},{color:e.colorPrimaryActive,borderColor:e.colorPrimaryActive})),et=e=>Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({color:e.colorError,boxShadow:e.dangerShadow},G(e,e.dangerColor,e.colorError,{background:e.colorErrorHover},{background:e.colorErrorActive})),U(e,e.colorError,e.colorBgContainer,{color:e.colorErrorHover,borderColor:e.colorErrorBorderHover},{color:e.colorErrorActive,borderColor:e.colorErrorActive})),$(e)),K(e,e.colorErrorBg,{color:e.colorError,background:e.colorErrorBgFilledHover},{color:e.colorError,background:e.colorErrorBgActive})),Y(e,e.colorError,"text",{color:e.colorErrorHover,background:e.colorErrorBg},{color:e.colorErrorHover,background:e.colorErrorBgActive})),Y(e,e.colorError,"link",{color:e.colorErrorHover},{color:e.colorErrorActive})),W(e.componentCls,e.ghostBg,e.colorError,e.colorError,e.colorTextDisabled,e.colorBorder,{color:e.colorErrorHover,borderColor:e.colorErrorHover},{color:e.colorErrorActive,borderColor:e.colorErrorActive})),en=e=>Object.assign(Object.assign({},Y(e,e.colorLink,"link",{color:e.colorLinkHover},{color:e.colorLinkActive})),W(e.componentCls,e.ghostBg,e.colorInfo,e.colorInfo,e.colorTextDisabled,e.colorBorder,{color:e.colorInfoHover,borderColor:e.colorInfoHover},{color:e.colorInfoActive,borderColor:e.colorInfoActive})),er=e=>{let{componentCls:t}=e;return Object.assign({["".concat(t,"-color-default")]:J(e),["".concat(t,"-color-primary")]:ee(e),["".concat(t,"-color-dangerous")]:et(e),["".concat(t,"-color-link")]:en(e)},Q(e))},eo=e=>Object.assign(Object.assign(Object.assign(Object.assign({},U(e,e.defaultBorderColor,e.defaultBg,{color:e.defaultHoverColor,borderColor:e.defaultHoverBorderColor,background:e.defaultHoverBg},{color:e.defaultActiveColor,borderColor:e.defaultActiveBorderColor,background:e.defaultActiveBg})),Y(e,e.textTextColor,"text",{color:e.textTextHoverColor,background:e.textHoverBg},{color:e.textTextActiveColor,background:e.colorBgTextActive})),G(e,e.primaryColor,e.colorPrimary,{background:e.colorPrimaryHover,color:e.primaryColor},{background:e.colorPrimaryActive,color:e.primaryColor})),Y(e,e.colorLink,"link",{color:e.colorLinkHover,background:e.linkHoverBg},{color:e.colorLinkActive})),ea=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",{componentCls:n,controlHeight:r,fontSize:o,borderRadius:a,buttonPaddingHorizontal:i,iconCls:c,buttonPaddingVertical:l,buttonIconOnlyFontSize:s}=e;return[{[t]:{fontSize:o,height:r,padding:"".concat((0,S.bf)(l)," ").concat((0,S.bf)(i)),borderRadius:a,["&".concat(n,"-icon-only")]:{width:r,[c]:{fontSize:s}}}},{["".concat(n).concat(n,"-circle").concat(t)]:L(e)},{["".concat(n).concat(n,"-round").concat(t)]:{borderRadius:e.controlHeight,["&:not(".concat(n,"-icon-only)")]:{paddingInline:e.buttonPaddingHorizontal}}}]},ei=e=>ea((0,j.IX)(e,{fontSize:e.contentFontSize}),e.componentCls),ec=e=>ea((0,j.IX)(e,{controlHeight:e.controlHeightSM,fontSize:e.contentFontSizeSM,padding:e.paddingXS,buttonPaddingHorizontal:e.paddingInlineSM,buttonPaddingVertical:0,borderRadius:e.borderRadiusSM,buttonIconOnlyFontSize:e.onlyIconSizeSM}),"".concat(e.componentCls,"-sm")),el=e=>ea((0,j.IX)(e,{controlHeight:e.controlHeightLG,fontSize:e.contentFontSizeLG,buttonPaddingHorizontal:e.paddingInlineLG,buttonPaddingVertical:0,borderRadius:e.borderRadiusLG,buttonIconOnlyFontSize:e.onlyIconSizeLG}),"".concat(e.componentCls,"-lg")),es=e=>{let{componentCls:t}=e;return{[t]:{["&".concat(t,"-block")]:{width:"100%"}}}};var eu=(0,I.I$)("Button",e=>{let t=_(e);return[H(t),ei(t),ec(t),el(t),es(t),er(t),eo(t),R(t)]},B,{unitless:{fontWeight:!0,contentLineHeight:!0,contentLineHeightSM:!0,contentLineHeightLG:!0}}),ed=n(17691);let ef=e=>{let{componentCls:t,colorPrimaryHover:n,lineWidth:r,calc:o}=e,a=o(r).mul(-1).equal(),i=e=>{let o="".concat(t,"-compact").concat(e?"-vertical":"","-item").concat(t,"-primary:not([disabled])");return{["".concat(o," + ").concat(o,"::before")]:{position:"absolute",top:e?a:0,insetInlineStart:e?0:a,backgroundColor:n,content:'""',width:e?"100%":r,height:e?r:"100%"}}};return Object.assign(Object.assign({},i()),i(!0))};var ep=(0,I.bk)(["Button","compact"],e=>{let t=_(e);return[(0,ed.c)(t),function(e){var t,n;let r="".concat(e.componentCls,"-compact-vertical");return{[r]:Object.assign(Object.assign({},(t=e.componentCls,{["&-item:not(".concat(r,"-last-item)")]:{marginBottom:e.calc(e.lineWidth).mul(-1).equal()},["&-item:not(".concat(t,"-status-success)")]:{zIndex:2},"&-item":{"&:hover,&:focus,&:active":{zIndex:3},"&[disabled]":{zIndex:0}}})),(n=e.componentCls,{["&-item:not(".concat(r,"-first-item):not(").concat(r,"-last-item)")]:{borderRadius:0},["&-item".concat(r,"-first-item:not(").concat(r,"-last-item)")]:{["&, &".concat(n,"-sm, &").concat(n,"-lg")]:{borderEndEndRadius:0,borderEndStartRadius:0}},["&-item".concat(r,"-last-item:not(").concat(r,"-first-item)")]:{["&, &".concat(n,"-sm, &").concat(n,"-lg")]:{borderStartStartRadius:0,borderStartEndRadius:0}}}))}}(t),ef(t)]},B),em=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 eg={default:["default","outlined"],primary:["primary","solid"],dashed:["default","dashed"],link:["link","link"],text:["default","text"]},ev=r.forwardRef((e,t)=>{var n,o;let{loading:m=!1,prefixCls:g,color:b,variant:y,type:w,danger:E=!1,shape:C,size:S,styles:O,disabled:k,className:j,rootClassName:I,children:M,icon:R,iconPosition:N="start",ghost:P=!1,block:F=!1,htmlType:T="button",classNames:A,style:_={},autoInsertSpace:B,autoFocus:H}=e,z=em(e,["loading","prefixCls","color","variant","type","danger","shape","size","styles","disabled","className","rootClassName","children","icon","iconPosition","ghost","block","htmlType","classNames","style","autoInsertSpace","autoFocus"]),L=w||"default",{button:D}=r.useContext(u.E_),W=C||(null==D?void 0:D.shape)||"default",[V,q]=(0,r.useMemo)(()=>{if(b&&y)return[b,y];if(w||E){let e=eg[L]||[];return E?["danger",e[1]]:e}return(null==D?void 0:D.color)&&(null==D?void 0:D.variant)?[D.color,D.variant]:["default","outlined"]},[b,y,w,E,null==D?void 0:D.color,null==D?void 0:D.variant,L]),X="danger"===V?"dangerous":V,{getPrefixCls:G,direction:U,autoInsertSpace:$,className:K,style:Y,classNames:Q,styles:J}=(0,u.dj)("button"),ee=null===(n=null!=B?B:$)||void 0===n||n,et=G("btn",g),[en,er,eo]=eu(et),ea=(0,r.useContext)(d.Z),ei=null!=k?k:ea,ec=(0,r.useContext)(v),el=(0,r.useMemo)(()=>(function(e){if("object"==typeof e&&e){let t=null==e?void 0:e.delay;return{loading:(t=Number.isNaN(t)||"number"!=typeof t?0:t)<=0,delay:t}}return{loading:!!e,delay:0}})(m),[m]),[es,ed]=(0,r.useState)(el.loading),[ef,ev]=(0,r.useState)(!1),eh=(0,r.useRef)(null),eb=(0,l.x1)(t,eh),ey=1===r.Children.count(M)&&!R&&!(0,h.Dn)(q),ex=(0,r.useRef)(!0);r.useEffect(()=>(ex.current=!1,()=>{ex.current=!0}),[]),(0,i.Z)(()=>{let e=null;return el.delay>0?e=setTimeout(()=>{e=null,ed(!0)},el.delay):ed(el.loading),function(){e&&(clearTimeout(e),e=null)}},[el.delay,el.loading]),(0,r.useEffect)(()=>{if(!eh.current||!ee)return;let e=eh.current.textContent||"";ey&&(0,h.aG)(e)?ef||ev(!0):ef&&ev(!1)}),(0,r.useEffect)(()=>{H&&eh.current&&eh.current.focus()},[]);let ew=r.useCallback(t=>{var n;if(es||ei){t.preventDefault();return}null===(n=e.onClick)||void 0===n||n.call(e,t)},[e.onClick,es,ei]),{compactSize:eE,compactItemClassnames:eC}=(0,p.ri)(et,U),eZ=(0,f.Z)(e=>{var t,n;return null!==(n=null!==(t=null!=S?S:eE)&&void 0!==t?t:ec)&&void 0!==n?n:e}),eS=eZ&&null!==(o=({large:"lg",small:"sm",middle:void 0})[eZ])&&void 0!==o?o:"",eO=es?"loading":R,ek=(0,c.Z)(z,["navigate"]),ej=a()(et,er,eo,{["".concat(et,"-").concat(W)]:"default"!==W&&W,["".concat(et,"-").concat(L)]:L,["".concat(et,"-dangerous")]:E,["".concat(et,"-color-").concat(X)]:X,["".concat(et,"-variant-").concat(q)]:q,["".concat(et,"-").concat(eS)]:eS,["".concat(et,"-icon-only")]:!M&&0!==M&&!!eO,["".concat(et,"-background-ghost")]:P&&!(0,h.Dn)(q),["".concat(et,"-loading")]:es,["".concat(et,"-two-chinese-chars")]:ef&&ee&&!es,["".concat(et,"-block")]:F,["".concat(et,"-rtl")]:"rtl"===U,["".concat(et,"-icon-end")]:"end"===N},eC,j,I,K),eI=Object.assign(Object.assign({},Y),_),eM=a()(null==A?void 0:A.icon,Q.icon),eR=Object.assign(Object.assign({},(null==O?void 0:O.icon)||{}),J.icon||{}),eN=R&&!es?r.createElement(x,{prefixCls:et,className:eM,style:eR},R):m&&"object"==typeof m&&m.icon?r.createElement(x,{prefixCls:et,className:eM,style:eR},m.icon):r.createElement(Z,{existIcon:!!R,prefixCls:et,loading:es,mount:ex.current}),eP=M||0===M?(0,h.hU)(M,ey&&ee):null;if(void 0!==ek.href)return en(r.createElement("a",Object.assign({},ek,{className:a()(ej,{["".concat(et,"-disabled")]:ei}),href:ei?void 0:ek.href,style:eI,onClick:ew,ref:eb,tabIndex:ei?-1:0,"aria-disabled":ei}),eN,eP));let eF=r.createElement("button",Object.assign({},z,{type:T,className:ej,style:eI,onClick:ew,disabled:ei,ref:eb}),eN,eP,eC&&r.createElement(ep,{prefixCls:et}));return(0,h.Dn)(q)||(eF=r.createElement(s.Z,{component:"Button",disabled:es},eF)),en(eF)});ev.Group=e=>{let{getPrefixCls:t,direction:n}=r.useContext(u.E_),{prefixCls:o,size:i,className:c}=e,l=g(e,["prefixCls","size","className"]),s=t("btn-group",o),[,,d]=(0,m.ZP)(),f=r.useMemo(()=>{switch(i){case"large":return"lg";case"small":return"sm";default:return""}},[i]),p=a()(s,{["".concat(s,"-").concat(f)]:f,["".concat(s,"-rtl")]:"rtl"===n},c,d);return r.createElement(v.Provider,{value:i},r.createElement("div",Object.assign({},l,{className:p})))},ev.__ANT_BUTTON=!0;var eh=ev},11357:function(e,t,n){"use strict";n.d(t,{y9:function(){return l}});var r=n(76405),o=n(25049),a=n(75669);let i=(e,t)=>(null==e?void 0:e.replace(/[^\w/]/g,"").slice(0,t?8:6))||"",c=(e,t)=>e?i(e,t):"",l=(0,o.Z)(function e(t){var n;if((0,r.Z)(this,e),this.cleared=!1,t instanceof e){this.metaColor=t.metaColor.clone(),this.colors=null===(n=t.colors)||void 0===n?void 0:n.map(t=>({color:new e(t.color),percent:t.percent})),this.cleared=t.cleared;return}let o=Array.isArray(t);o&&t.length?(this.colors=t.map(t=>{let{color:n,percent:r}=t;return{color:new e(n),percent:r}}),this.metaColor=new a.Il(this.colors[0].color.metaColor)):this.metaColor=new a.Il(o?"":t),t&&(!o||this.colors)||(this.metaColor=this.metaColor.setA(0),this.cleared=!0)},[{key:"toHsb",value:function(){return this.metaColor.toHsb()}},{key:"toHsbString",value:function(){return this.metaColor.toHsbString()}},{key:"toHex",value:function(){return c(this.toHexString(),this.metaColor.a<1)}},{key:"toHexString",value:function(){return this.metaColor.toHexString()}},{key:"toRgb",value:function(){return this.metaColor.toRgb()}},{key:"toRgbString",value:function(){return this.metaColor.toRgbString()}},{key:"isGradient",value:function(){return!!this.colors&&!this.cleared}},{key:"getColors",value:function(){return this.colors||[{color:this,percent:0}]}},{key:"toCssString",value:function(){let{colors:e}=this;if(e){let t=e.map(e=>"".concat(e.color.toRgbString()," ").concat(e.percent,"%")).join(", ");return"linear-gradient(90deg, ".concat(t,")")}return this.metaColor.toRgbString()}},{key:"equals",value:function(e){return!!e&&this.isGradient()===e.isGradient()&&(this.isGradient()?this.colors.length===e.colors.length&&this.colors.every((t,n)=>{let r=e.colors[n];return t.percent===r.percent&&t.color.equals(r.color)}):this.toHexString()===e.toHexString())}}])},86586:function(e,t,n){"use strict";n.d(t,{n:function(){return a}});var r=n(2265);let o=r.createContext(!1),a=e=>{let{children:t,disabled:n}=e,a=r.useContext(o);return r.createElement(o.Provider,{value:null!=n?n:a},t)};t.Z=o},59189:function(e,t,n){"use strict";n.d(t,{q:function(){return a}});var r=n(2265);let o=r.createContext(void 0),a=e=>{let{children:t,size:n}=e,a=r.useContext(o);return r.createElement(o.Provider,{value:n||a},t)};t.Z=o},66061:function(e,t,n){"use strict";n.d(t,{q:function(){return b}}),n(2265);var r,o=n(54887),a=n.t(o,2),i=n(75143),c=n(54580),l=n(41154),s=(0,n(31686).Z)({},a),u=s.version,d=s.render,f=s.unmountComponentAtNode;try{Number((u||"").split(".")[0])>=18&&(r=s.createRoot)}catch(e){}function p(e){var t=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;t&&"object"===(0,l.Z)(t)&&(t.usingClientEntryPoint=e)}var m="__rc_react_root__";function g(){return(g=(0,c.Z)((0,i.Z)().mark(function e(t){return(0,i.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Promise.resolve().then(function(){var e;null===(e=t[m])||void 0===e||e.unmount(),delete t[m]}));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function v(){return(v=(0,c.Z)((0,i.Z)().mark(function e(t){return(0,i.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(void 0!==r)){e.next=2;break}return e.abrupt("return",function(e){return g.apply(this,arguments)}(t));case 2:f(t);case 3:case"end":return e.stop()}},e)}))).apply(this,arguments)}let h=(e,t)=>(!function(e,t){var n;if(r){p(!0),n=t[m]||r(t),p(!1),n.render(e),t[m]=n;return}null==d||d(e,t)}(e,t),()=>(function(e){return v.apply(this,arguments)})(t));function b(e){return e&&(h=e),h}},71744:function(e,t,n){"use strict";n.d(t,{E_:function(){return c},Rf:function(){return o},dj:function(){return u},oR:function(){return a},tr:function(){return i}});var r=n(2265);let o="ant",a="anticon",i=["outlined","borderless","filled","underlined"],c=r.createContext({getPrefixCls:(e,t)=>t||(e?"".concat(o,"-").concat(e):o),iconPrefixCls:a}),{Consumer:l}=c,s={};function u(e){let t=r.useContext(c),{getPrefixCls:n,direction:o,getPopupContainer:a}=t;return Object.assign(Object.assign({classNames:s,styles:s},t[e]),{getPrefixCls:n,direction:o,getPopupContainer:a})}},91086:function(e,t,n){"use strict";var r=n(2265),o=n(71744),a=n(85180);t.Z=e=>{let{componentName:t}=e,{getPrefixCls:n}=(0,r.useContext)(o.E_),i=n("empty");switch(t){case"Table":case"List":return r.createElement(a.Z,{image:a.Z.PRESENTED_IMAGE_SIMPLE});case"Select":case"TreeSelect":case"Cascader":case"Transfer":case"Mentions":return r.createElement(a.Z,{image:a.Z.PRESENTED_IMAGE_SIMPLE,className:"".concat(i,"-small")});case"Table.filter":return null;default:return r.createElement(a.Z,null)}}},64024:function(e,t,n){"use strict";var r=n(84951);t.Z=e=>{let[,,,,t]=(0,r.ZP)();return t?"".concat(e,"-css-var"):""}},33759:function(e,t,n){"use strict";var r=n(2265),o=n(59189);t.Z=e=>{let t=r.useContext(o.Z);return r.useMemo(()=>e?"string"==typeof e?null!=e?e:t:"function"==typeof e?e(t):t:t,[e,t])}},18310:function(e,t,n){"use strict";let r,o,a,i;n.d(t,{ZP:function(){return G},w6:function(){return V}});var c=n(2265),l=n.t(c,2),s=n(93463),u=n(20902),d=n(6397),f=n(23789),p=n(13613),m=n(77360),g=n(92246),v=n(91325),h=e=>{let{locale:t={},children:n,_ANT_MARK__:r}=e;c.useEffect(()=>(0,g.f)(null==t?void 0:t.Modal),[t]);let o=c.useMemo(()=>Object.assign(Object.assign({},t),{exist:!0}),[t]);return c.createElement(v.Z.Provider,{value:o},n)},b=n(37381),y=n(57862),x=n(25119),w=n(70774),E=n(71744),C=n(57943),Z=n(54558),S=n(94981),O=n(21717);let k="-ant-".concat(Date.now(),"-").concat(Math.random());var j=n(86586),I=n(59189),M=n(16671);let{useId:R}=Object.assign({},l);var N=void 0===R?()=>"":R,P=n(66632),F=n(84951);let T=c.createContext(!0);function A(e){let t=c.useContext(T),{children:n}=e,[,r]=(0,F.ZP)(),{motion:o}=r,a=c.useRef(!1);return(a.current||(a.current=t!==o),a.current)?c.createElement(T.Provider,{value:o},c.createElement(P.zt,{motion:o},n)):n}var _=()=>null,B=n(12918),H=(e,t)=>{let[n,r]=(0,F.ZP)();return(0,s.xy)({theme:n,token:r,hashId:"",path:["ant-design-icons",e],nonce:()=>null==t?void 0:t.nonce,layer:{name:"antd"}},()=>(0,B.JT)(e))},z=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 L=["getTargetContainer","getPopupContainer","renderEmpty","input","pagination","form","select","button"];function D(){return r||E.Rf}function W(){return o||E.oR}let V=()=>({getPrefixCls:(e,t)=>t||(e?"".concat(D(),"-").concat(e):D()),getIconPrefixCls:W,getRootPrefixCls:()=>r||D(),getTheme:()=>a,holderRender:i}),q=e=>{let{children:t,csp:n,autoInsertSpaceInButton:r,alert:o,anchor:a,form:i,locale:l,componentSize:g,direction:v,space:C,splitter:Z,virtual:S,dropdownMatchSelectWidth:O,popupMatchSelectWidth:k,popupOverflow:R,legacyLocale:P,parentContext:F,iconPrefixCls:T,theme:B,componentDisabled:D,segmented:W,statistic:V,spin:q,calendar:X,carousel:G,cascader:U,collapse:$,typography:K,checkbox:Y,descriptions:Q,divider:J,drawer:ee,skeleton:et,steps:en,image:er,layout:eo,list:ea,mentions:ei,modal:ec,progress:el,result:es,slider:eu,breadcrumb:ed,menu:ef,pagination:ep,input:em,textArea:eg,empty:ev,badge:eh,radio:eb,rate:ey,switch:ex,transfer:ew,avatar:eE,message:eC,tag:eZ,table:eS,card:eO,tabs:ek,timeline:ej,timePicker:eI,upload:eM,notification:eR,tree:eN,colorPicker:eP,datePicker:eF,rangePicker:eT,flex:eA,wave:e_,dropdown:eB,warning:eH,tour:ez,tooltip:eL,popover:eD,popconfirm:eW,floatButton:eV,floatButtonGroup:eq,variant:eX,inputNumber:eG,treeSelect:eU}=e,e$=c.useCallback((t,n)=>{let{prefixCls:r}=e;if(n)return n;let o=r||F.getPrefixCls("");return t?"".concat(o,"-").concat(t):o},[F.getPrefixCls,e.prefixCls]),eK=T||F.iconPrefixCls||E.oR,eY=n||F.csp;H(eK,eY);let eQ=function(e,t,n){var r;(0,p.ln)("ConfigProvider");let o=e||{},a=!1!==o.inherit&&t?t:Object.assign(Object.assign({},x.u_),{hashed:null!==(r=null==t?void 0:t.hashed)&&void 0!==r?r:x.u_.hashed,cssVar:null==t?void 0:t.cssVar}),i=N();return(0,d.Z)(()=>{var r,c;if(!e)return t;let l=Object.assign({},a.components);Object.keys(e.components||{}).forEach(t=>{l[t]=Object.assign(Object.assign({},l[t]),e.components[t])});let s="css-var-".concat(i.replace(/:/g,"")),u=(null!==(r=o.cssVar)&&void 0!==r?r:a.cssVar)&&Object.assign(Object.assign(Object.assign({prefix:null==n?void 0:n.prefixCls},"object"==typeof a.cssVar?a.cssVar:{}),"object"==typeof o.cssVar?o.cssVar:{}),{key:"object"==typeof o.cssVar&&(null===(c=o.cssVar)||void 0===c?void 0:c.key)||s});return Object.assign(Object.assign(Object.assign({},a),o),{token:Object.assign(Object.assign({},a.token),o.token),components:l,cssVar:u})},[o,a],(e,t)=>e.some((e,n)=>{let r=t[n];return!(0,M.Z)(e,r,!0)}))}(B,F.theme,{prefixCls:e$("")}),eJ={csp:eY,autoInsertSpaceInButton:r,alert:o,anchor:a,locale:l||P,direction:v,space:C,splitter:Z,virtual:S,popupMatchSelectWidth:null!=k?k:O,popupOverflow:R,getPrefixCls:e$,iconPrefixCls:eK,theme:eQ,segmented:W,statistic:V,spin:q,calendar:X,carousel:G,cascader:U,collapse:$,typography:K,checkbox:Y,descriptions:Q,divider:J,drawer:ee,skeleton:et,steps:en,image:er,input:em,textArea:eg,layout:eo,list:ea,mentions:ei,modal:ec,progress:el,result:es,slider:eu,breadcrumb:ed,menu:ef,pagination:ep,empty:ev,badge:eh,radio:eb,rate:ey,switch:ex,transfer:ew,avatar:eE,message:eC,tag:eZ,table:eS,card:eO,tabs:ek,timeline:ej,timePicker:eI,upload:eM,notification:eR,tree:eN,colorPicker:eP,datePicker:eF,rangePicker:eT,flex:eA,wave:e_,dropdown:eB,warning:eH,tour:ez,tooltip:eL,popover:eD,popconfirm:eW,floatButton:eV,floatButtonGroup:eq,variant:eX,inputNumber:eG,treeSelect:eU},e0=Object.assign({},F);Object.keys(eJ).forEach(e=>{void 0!==eJ[e]&&(e0[e]=eJ[e])}),L.forEach(t=>{let n=e[t];n&&(e0[t]=n)}),void 0!==r&&(e0.button=Object.assign({autoInsertSpace:r},e0.button));let e1=(0,d.Z)(()=>e0,e0,(e,t)=>{let n=Object.keys(e),r=Object.keys(t);return n.length!==r.length||n.some(n=>e[n]!==t[n])}),{layer:e2}=c.useContext(s.uP),e6=c.useMemo(()=>({prefixCls:eK,csp:eY,layer:e2?"antd":void 0}),[eK,eY,e2]),e5=c.createElement(c.Fragment,null,c.createElement(_,{dropdownMatchSelectWidth:O}),t),e4=c.useMemo(()=>{var e,t,n,r;return(0,f.T)((null===(e=b.Z.Form)||void 0===e?void 0:e.defaultValidateMessages)||{},(null===(n=null===(t=e1.locale)||void 0===t?void 0:t.Form)||void 0===n?void 0:n.defaultValidateMessages)||{},(null===(r=e1.form)||void 0===r?void 0:r.validateMessages)||{},(null==i?void 0:i.validateMessages)||{})},[e1,null==i?void 0:i.validateMessages]);Object.keys(e4).length>0&&(e5=c.createElement(m.Z.Provider,{value:e4},e5)),l&&(e5=c.createElement(h,{locale:l,_ANT_MARK__:"internalMark"},e5)),(eK||eY)&&(e5=c.createElement(u.Z.Provider,{value:e6},e5)),g&&(e5=c.createElement(I.q,{size:g},e5)),e5=c.createElement(A,null,e5);let e3=c.useMemo(()=>{let e=eQ||{},{algorithm:t,token:n,components:r,cssVar:o}=e,a=z(e,["algorithm","token","components","cssVar"]),i=t&&(!Array.isArray(t)||t.length>0)?(0,s.jG)(t):y.Z,c={};Object.entries(r||{}).forEach(e=>{let[t,n]=e,r=Object.assign({},n);"algorithm"in r&&(!0===r.algorithm?r.theme=i:(Array.isArray(r.algorithm)||"function"==typeof r.algorithm)&&(r.theme=(0,s.jG)(r.algorithm)),delete r.algorithm),c[t]=r});let l=Object.assign(Object.assign({},w.Z),n);return Object.assign(Object.assign({},a),{theme:i,token:l,components:c,override:Object.assign({override:l},c),cssVar:o})},[eQ]);return B&&(e5=c.createElement(x.Mj.Provider,{value:e3},e5)),e1.warning&&(e5=c.createElement(p.G8.Provider,{value:e1.warning},e5)),void 0!==D&&(e5=c.createElement(j.n,{disabled:D},e5)),c.createElement(E.E_.Provider,{value:e1},e5)},X=e=>{let t=c.useContext(E.E_),n=c.useContext(v.Z);return c.createElement(q,Object.assign({parentContext:t,legacyLocale:n},e))};X.ConfigContext=E.E_,X.SizeContext=I.Z,X.config=e=>{let{prefixCls:t,iconPrefixCls:n,theme:c,holderRender:l}=e;void 0!==t&&(r=t),void 0!==n&&(o=n),"holderRender"in e&&(i=l),c&&(Object.keys(c).some(e=>e.endsWith("Color"))?function(e,t){let n=function(e,t){let n={},r=(e,t)=>{let n=e.clone();return(n=(null==t?void 0:t(n))||n).toRgbString()},o=(e,t)=>{let o=new Z.t(e),a=(0,C.R_)(o.toRgbString());n["".concat(t,"-color")]=r(o),n["".concat(t,"-color-disabled")]=a[1],n["".concat(t,"-color-hover")]=a[4],n["".concat(t,"-color-active")]=a[6],n["".concat(t,"-color-outline")]=o.clone().setA(.2).toRgbString(),n["".concat(t,"-color-deprecated-bg")]=a[0],n["".concat(t,"-color-deprecated-border")]=a[2]};if(t.primaryColor){o(t.primaryColor,"primary");let e=new Z.t(t.primaryColor),a=(0,C.R_)(e.toRgbString());a.forEach((e,t)=>{n["primary-".concat(t+1)]=e}),n["primary-color-deprecated-l-35"]=r(e,e=>e.lighten(35)),n["primary-color-deprecated-l-20"]=r(e,e=>e.lighten(20)),n["primary-color-deprecated-t-20"]=r(e,e=>e.tint(20)),n["primary-color-deprecated-t-50"]=r(e,e=>e.tint(50)),n["primary-color-deprecated-f-12"]=r(e,e=>e.setA(.12*e.a));let i=new Z.t(a[0]);n["primary-color-active-deprecated-f-30"]=r(i,e=>e.setA(.3*e.a)),n["primary-color-active-deprecated-d-02"]=r(i,e=>e.darken(2))}t.successColor&&o(t.successColor,"success"),t.warningColor&&o(t.warningColor,"warning"),t.errorColor&&o(t.errorColor,"error"),t.infoColor&&o(t.infoColor,"info");let a=Object.keys(n).map(t=>"--".concat(e,"-").concat(t,": ").concat(n[t],";"));return"\n :root {\n ".concat(a.join("\n"),"\n }\n ").trim()}(e,t);(0,S.Z)()&&(0,O.hq)(n,"".concat(k,"-dynamic-theme"))}(D(),c):a=c)},X.useConfig=function(){return{componentDisabled:(0,c.useContext)(j.Z),componentSize:(0,c.useContext)(I.Z)}},Object.defineProperty(X,"SizeContext",{get:()=>I.Z});var G=X},85180:function(e,t,n){"use strict";n.d(t,{Z:function(){return b}});var r=n(2265),o=n(36760),a=n.n(o),i=n(71744),c=n(55274),l=n(54558),s=n(84951),u=n(99320),d=n(71140);let f=e=>{let{componentCls:t,margin:n,marginXS:r,marginXL:o,fontSize:a,lineHeight:i}=e;return{[t]:{marginInline:r,fontSize:a,lineHeight:i,textAlign:"center",["".concat(t,"-image")]:{height:e.emptyImgHeight,marginBottom:r,opacity:e.opacityImage,img:{height:"100%"},svg:{maxWidth:"100%",height:"100%",margin:"auto"}},["".concat(t,"-description")]:{color:e.colorTextDescription},["".concat(t,"-footer")]:{marginTop:n},"&-normal":{marginBlock:o,color:e.colorTextDescription,["".concat(t,"-description")]:{color:e.colorTextDescription},["".concat(t,"-image")]:{height:e.emptyImgHeightMD}},"&-small":{marginBlock:r,color:e.colorTextDescription,["".concat(t,"-image")]:{height:e.emptyImgHeightSM}}}}};var p=(0,u.I$)("Empty",e=>{let{componentCls:t,controlHeightLG:n,calc:r}=e;return f((0,d.IX)(e,{emptyImgCls:"".concat(t,"-img"),emptyImgHeight:r(n).mul(2.5).equal(),emptyImgHeightMD:n,emptyImgHeightSM:r(n).mul(.875).equal()}))}),m=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,r=Object.getOwnPropertySymbols(e);ot.indexOf(r[o])&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n};let g=r.createElement(()=>{let[,e]=(0,s.ZP)(),[t]=(0,c.Z)("Empty"),n=new l.t(e.colorBgBase).toHsl().l<.5?{opacity:.65}:{};return r.createElement("svg",{style:n,width:"184",height:"152",viewBox:"0 0 184 152",xmlns:"http://www.w3.org/2000/svg"},r.createElement("title",null,(null==t?void 0:t.description)||"Empty"),r.createElement("g",{fill:"none",fillRule:"evenodd"},r.createElement("g",{transform:"translate(24 31.67)"},r.createElement("ellipse",{fillOpacity:".8",fill:"#F5F5F7",cx:"67.797",cy:"106.89",rx:"67.797",ry:"12.668"}),r.createElement("path",{d:"M122.034 69.674L98.109 40.229c-1.148-1.386-2.826-2.225-4.593-2.225h-51.44c-1.766 0-3.444.839-4.592 2.225L13.56 69.674v15.383h108.475V69.674z",fill:"#AEB8C2"}),r.createElement("path",{d:"M101.537 86.214L80.63 61.102c-1.001-1.207-2.507-1.867-4.048-1.867H31.724c-1.54 0-3.047.66-4.048 1.867L6.769 86.214v13.792h94.768V86.214z",fill:"url(#linearGradient-1)",transform:"translate(13.56)"}),r.createElement("path",{d:"M33.83 0h67.933a4 4 0 0 1 4 4v93.344a4 4 0 0 1-4 4H33.83a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4z",fill:"#F5F5F7"}),r.createElement("path",{d:"M42.678 9.953h50.237a2 2 0 0 1 2 2V36.91a2 2 0 0 1-2 2H42.678a2 2 0 0 1-2-2V11.953a2 2 0 0 1 2-2zM42.94 49.767h49.713a2.262 2.262 0 1 1 0 4.524H42.94a2.262 2.262 0 0 1 0-4.524zM42.94 61.53h49.713a2.262 2.262 0 1 1 0 4.525H42.94a2.262 2.262 0 0 1 0-4.525zM121.813 105.032c-.775 3.071-3.497 5.36-6.735 5.36H20.515c-3.238 0-5.96-2.29-6.734-5.36a7.309 7.309 0 0 1-.222-1.79V69.675h26.318c2.907 0 5.25 2.448 5.25 5.42v.04c0 2.971 2.37 5.37 5.277 5.37h34.785c2.907 0 5.277-2.421 5.277-5.393V75.1c0-2.972 2.343-5.426 5.25-5.426h26.318v33.569c0 .617-.077 1.216-.221 1.789z",fill:"#DCE0E6"})),r.createElement("path",{d:"M149.121 33.292l-6.83 2.65a1 1 0 0 1-1.317-1.23l1.937-6.207c-2.589-2.944-4.109-6.534-4.109-10.408C138.802 8.102 148.92 0 161.402 0 173.881 0 184 8.102 184 18.097c0 9.995-10.118 18.097-22.599 18.097-4.528 0-8.744-1.066-12.28-2.902z",fill:"#DCE0E6"}),r.createElement("g",{transform:"translate(149.65 15.383)",fill:"#FFF"},r.createElement("ellipse",{cx:"20.654",cy:"3.167",rx:"2.849",ry:"2.815"}),r.createElement("path",{d:"M5.698 5.63H0L2.898.704zM9.259.704h4.985V5.63H9.259z"}))))},null),v=r.createElement(()=>{let[,e]=(0,s.ZP)(),[t]=(0,c.Z)("Empty"),{colorFill:n,colorFillTertiary:o,colorFillQuaternary:a,colorBgContainer:i}=e,{borderColor:u,shadowColor:d,contentColor:f}=(0,r.useMemo)(()=>({borderColor:new l.t(n).onBackground(i).toHexString(),shadowColor:new l.t(o).onBackground(i).toHexString(),contentColor:new l.t(a).onBackground(i).toHexString()}),[n,o,a,i]);return r.createElement("svg",{width:"64",height:"41",viewBox:"0 0 64 41",xmlns:"http://www.w3.org/2000/svg"},r.createElement("title",null,(null==t?void 0:t.description)||"Empty"),r.createElement("g",{transform:"translate(0 1)",fill:"none",fillRule:"evenodd"},r.createElement("ellipse",{fill:d,cx:"32",cy:"33",rx:"32",ry:"7"}),r.createElement("g",{fillRule:"nonzero",stroke:u},r.createElement("path",{d:"M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z"}),r.createElement("path",{d:"M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z",fill:f}))))},null),h=e=>{var t;let{className:n,rootClassName:o,prefixCls:l,image:s,description:u,children:d,imageStyle:f,style:h,classNames:b,styles:y}=e,x=m(e,["className","rootClassName","prefixCls","image","description","children","imageStyle","style","classNames","styles"]),{getPrefixCls:w,direction:E,className:C,style:Z,classNames:S,styles:O,image:k}=(0,i.dj)("empty"),j=w("empty",l),[I,M,R]=p(j),[N]=(0,c.Z)("Empty"),P=void 0!==u?u:null==N?void 0:N.description,F=null!==(t=null!=s?s:k)&&void 0!==t?t:g,T=null;return T="string"==typeof F?r.createElement("img",{draggable:!1,alt:"string"==typeof P?P:"empty",src:F}):F,I(r.createElement("div",Object.assign({className:a()(M,R,j,C,{["".concat(j,"-normal")]:F===v,["".concat(j,"-rtl")]:"rtl"===E},n,o,S.root,null==b?void 0:b.root),style:Object.assign(Object.assign(Object.assign(Object.assign({},O.root),Z),null==y?void 0:y.root),h)},x),r.createElement("div",{className:a()("".concat(j,"-image"),S.image,null==b?void 0:b.image),style:Object.assign(Object.assign(Object.assign({},f),O.image),null==y?void 0:y.image)},T),P&&r.createElement("div",{className:a()("".concat(j,"-description"),S.description,null==b?void 0:b.description),style:Object.assign(Object.assign({},O.description),null==y?void 0:y.description)},P),d&&r.createElement("div",{className:a()("".concat(j,"-footer"),S.footer,null==b?void 0:b.footer),style:Object.assign(Object.assign({},O.footer),null==y?void 0:y.footer)},d)))};h.PRESENTED_IMAGE_DEFAULT=g,h.PRESENTED_IMAGE_SIMPLE=v;var b=h},14605:function(e,t,n){"use strict";var r=n(83145),o=n(2265),a=n(36760),i=n.n(a),c=n(66632),l=n(68710),s=n(64024),u=n(39109),d=n(4064),f=n(47713);let p=[];function m(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:a=p,warnings:g=p,className:v,fieldId:h,onVisibleChanged:b}=e,{prefixCls:y}=o.useContext(u.Rk),x="".concat(y,"-item-explain"),w=(0,s.Z)(y),[E,C,Z]=(0,f.ZP)(y,w),S=o.useMemo(()=>(0,l.Z)(y),[y]),O=(0,d.Z)(a),k=(0,d.Z)(g),j=o.useMemo(()=>null!=t?[m(t,"help",n)]:[].concat((0,r.Z)(O.map((e,t)=>m(e,"error","error",t))),(0,r.Z)(k.map((e,t)=>m(e,"warning","warning",t)))),[t,n,O,k]),I=o.useMemo(()=>{let e={};return j.forEach(t=>{let{key:n}=t;e[n]=(e[n]||0)+1}),j.map((t,n)=>Object.assign(Object.assign({},t),{key:e[t.key]>1?"".concat(t.key,"-fallback-").concat(n):t.key}))},[j]),M={};return h&&(M.id="".concat(h,"_help")),E(o.createElement(c.ZP,{motionDeadline:S.motionDeadline,motionName:"".concat(y,"-show-help"),visible:!!I.length,onVisibleChanged:b},e=>{let{className:t,style:n}=e;return o.createElement("div",Object.assign({},M,{className:i()(x,t,Z,w,v,C),style:n}),o.createElement(c.V4,Object.assign({keys:I},(0,l.Z)(y),{motionName:"".concat(y,"-show-help-item"),component:!1}),e=>{let{key:t,error:n,errorStatus:r,className:a,style:c}=e;return o.createElement("div",{key:t,className:i()(a,{["".concat(x,"-").concat(r)]:r}),style:c},n)}))}))}},2740:function(e,t,n){"use strict";n.d(t,{Z:function(){return K}});var r=n(83145),o=n(2265),a=n(36760),i=n.n(a),c=n(87379),l=n(69819),s=n(28791),u=n(19722),d=n(13613),f=n(71744),p=n(64024),m=n(39109),g=n(45287);let v=()=>{let{status:e,errors:t=[],warnings:n=[]}=o.useContext(m.aM);return{status:e,errors:t,warnings:n}};v.Context=m.aM;var h=n(53346),b=n(47713),y=n(13861),x=n(2857),w=n(27380),E=n(18694),C=n(77774),Z=n(74126),S=n(54998),O=n(14605),k=n(99320);let j=e=>{let{formItemCls:t}=e;return{"@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none)":{["".concat(t,"-control")]:{display:"flex"}}}};var I=(0,k.bk)(["Form","item-item"],(e,t)=>{let{rootPrefixCls:n}=t;return j((0,b.B4)(e,n))}),M=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,r=Object.getOwnPropertySymbols(e);ot.indexOf(r[o])&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n},R=e=>{let{prefixCls:t,status:n,labelCol:r,wrapperCol:a,children:c,errors:l,warnings:s,_internalItemRender:u,extra:d,help:f,fieldId:p,marginBottom:g,onErrorVisibleChanged:v,label:h}=e,b="".concat(t,"-item"),y=o.useContext(m.q3),x=o.useMemo(()=>{let e=Object.assign({},a||y.wrapperCol||{});return null!==h||r||a||!y.labelCol||[void 0,"xs","sm","md","lg","xl","xxl"].forEach(t=>{let n=t?[t]:[],r=(0,Z.U2)(y.labelCol,n),o="object"==typeof r?r:{},a=(0,Z.U2)(e,n);"span"in o&&!("offset"in("object"==typeof a?a:{}))&&o.span<24&&(e=(0,Z.t8)(e,[].concat(n,["offset"]),o.span))}),e},[a,y.wrapperCol,y.labelCol,h,r]),E=i()("".concat(b,"-control"),x.className),C=o.useMemo(()=>{let{labelCol:e,wrapperCol:t}=y;return M(y,["labelCol","wrapperCol"])},[y]),k=o.useRef(null),[j,R]=o.useState(0);(0,w.Z)(()=>{d&&k.current?R(k.current.clientHeight):R(0)},[d]);let N=o.createElement("div",{className:"".concat(b,"-control-input")},o.createElement("div",{className:"".concat(b,"-control-input-content")},c)),P=o.useMemo(()=>({prefixCls:t,status:n}),[t,n]),F=null!==g||l.length||s.length?o.createElement(m.Rk.Provider,{value:P},o.createElement(O.Z,{fieldId:p,errors:l,warnings:s,help:f,helpStatus:n,className:"".concat(b,"-explain-connected"),onVisibleChanged:v})):null,T={};p&&(T.id="".concat(p,"_extra"));let A=d?o.createElement("div",Object.assign({},T,{className:"".concat(b,"-extra"),ref:k}),d):null,_=F||A?o.createElement("div",{className:"".concat(b,"-additional"),style:g?{minHeight:g+j}:{}},F,A):null,B=u&&"pro_table_render"===u.mark&&u.render?u.render(e,{input:N,errorList:F,extra:A}):o.createElement(o.Fragment,null,N,_);return o.createElement(m.q3.Provider,{value:C},o.createElement(S.Z,Object.assign({},x,{className:E}),B),o.createElement(I,{prefixCls:t}))},N=n(67187),P=n(55274),F=n(37381),T=n(99981),A=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},_=e=>{var t;let n,{prefixCls:r,label:a,htmlFor:c,labelCol:l,labelAlign:s,colon:u,required:d,requiredMark:f,tooltip:p,vertical:g}=e,[v]=(0,P.Z)("Form"),{labelAlign:h,labelCol:b,labelWrap:y,colon:x}=o.useContext(m.q3);if(!a)return null;let w=l||b||{},E="".concat(r,"-item-label"),C=i()(E,"left"===(s||h)&&"".concat(E,"-left"),w.className,{["".concat(E,"-wrap")]:!!y}),Z=a,O=!0===u||!1!==x&&!1!==u;O&&!g&&"string"==typeof a&&a.trim()&&(Z=a.replace(/[:|:]\s*$/,""));let k=null==p?null:"object"!=typeof p||(0,o.isValidElement)(p)?{title:p}:p;if(k){let{icon:e=o.createElement(N.Z,null)}=k,t=A(k,["icon"]),n=o.createElement(T.Z,Object.assign({},t),o.cloneElement(e,{className:"".concat(r,"-item-tooltip"),title:"",onClick:e=>{e.preventDefault()},tabIndex:null}));Z=o.createElement(o.Fragment,null,Z,n)}let j="optional"===f,I="function"==typeof f;I?Z=f(Z,{required:!!d}):j&&!d&&(Z=o.createElement(o.Fragment,null,Z,o.createElement("span",{className:"".concat(r,"-item-optional"),title:""},(null==v?void 0:v.optional)||(null===(t=F.Z.Form)||void 0===t?void 0:t.optional)))),!1===f?n="hidden":(j||I)&&(n="optional");let M=i()({["".concat(r,"-item-required")]:d,["".concat(r,"-item-required-mark-").concat(n)]:n,["".concat(r,"-item-no-colon")]:!O});return o.createElement(S.Z,Object.assign({},w,{className:C}),o.createElement("label",{htmlFor:c,className:M,title:"string"==typeof a?a:""},Z))},B=n(4064),H=n(8900),z=n(39725),L=n(54537),D=n(61935);let W={success:H.Z,warning:L.Z,error:z.Z,validating:D.Z};function V(e){let{children:t,errors:n,warnings:r,hasFeedback:a,validateStatus:c,prefixCls:l,meta:s,noStyle:u,name:d}=e,f="".concat(l,"-item"),{feedbackIcons:p}=o.useContext(m.q3),g=(0,y.lR)(n,r,s,null,!!a,c),{isFormItemInput:v,status:h,hasFeedback:b,feedbackIcon:x,name:w}=o.useContext(m.aM),E=o.useMemo(()=>{var e;let t;if(a){let c=!0!==a&&a.icons||p,l=g&&(null===(e=null==c?void 0:c({status:g,errors:n,warnings:r}))||void 0===e?void 0:e[g]),s=g?W[g]:null;t=!1!==l&&s?o.createElement("span",{className:i()("".concat(f,"-feedback-icon"),"".concat(f,"-feedback-icon-").concat(g))},l||o.createElement(s,null)):null}let c={status:g||"",errors:n,warnings:r,hasFeedback:!!a,feedbackIcon:t,isFormItemInput:!0,name:d};return u&&(c.status=(null!=g?g:h)||"",c.isFormItemInput=v,c.hasFeedback=!!(null!=a?a:b),c.feedbackIcon=void 0!==a?c.feedbackIcon:x,c.name=null!=d?d:w),c},[g,a,u,v,h]);return o.createElement(m.aM.Provider,{value:E},t)}var q=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 X(e){let{prefixCls:t,className:n,rootClassName:r,style:a,help:c,errors:l,warnings:s,validateStatus:u,meta:d,hasFeedback:f,hidden:p,children:g,fieldId:v,required:h,isRequired:b,onSubItemMetaChange:Z,layout:S,name:O}=e,k=q(e,["prefixCls","className","rootClassName","style","help","errors","warnings","validateStatus","meta","hasFeedback","hidden","children","fieldId","required","isRequired","onSubItemMetaChange","layout","name"]),j="".concat(t,"-item"),{requiredMark:I,layout:M}=o.useContext(m.q3),N=S||M,P="vertical"===N,F=o.useRef(null),T=(0,B.Z)(l),A=(0,B.Z)(s),H=null!=c,z=!!(H||l.length||s.length),L=!!F.current&&(0,x.Z)(F.current),[D,W]=o.useState(null);(0,w.Z)(()=>{z&&F.current&&W(Number.parseInt(getComputedStyle(F.current).marginBottom,10))},[z,L]);let X=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=e?T:d.errors,n=e?A:d.warnings;return(0,y.lR)(t,n,d,"",!!f,u)}(),G=i()(j,n,r,{["".concat(j,"-with-help")]:H||T.length||A.length,["".concat(j,"-has-feedback")]:X&&f,["".concat(j,"-has-success")]:"success"===X,["".concat(j,"-has-warning")]:"warning"===X,["".concat(j,"-has-error")]:"error"===X,["".concat(j,"-is-validating")]:"validating"===X,["".concat(j,"-hidden")]:p,["".concat(j,"-").concat(N)]:N});return o.createElement("div",{className:G,style:a,ref:F},o.createElement(C.Z,Object.assign({className:"".concat(j,"-row")},(0,E.Z)(k,["_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(_,Object.assign({htmlFor:v},e,{requiredMark:I,required:null!=h?h:b,prefixCls:t,vertical:P})),o.createElement(R,Object.assign({},e,d,{errors:T,warnings:A,prefixCls:t,status:X,help:c,marginBottom:D,onErrorVisibleChanged:e=>{e||W(null)}}),o.createElement(m.qI.Provider,{value:Z},o.createElement(V,{prefixCls:t,meta:d,errors:d.errors,warnings:d.warnings,hasFeedback:f,validateStatus:X,name:O},g)))),!!D&&o.createElement("div",{className:"".concat(j,"-margin-offset"),style:{marginBottom:-D}}))}let G=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 U(){return{errors:[],warnings:[],touched:!1,validating:!1,name:[],validated:!1}}let $=function(e){let{name:t,noStyle:n,className:a,dependencies:v,prefixCls:x,shouldUpdate:w,rules:E,children:C,required:Z,label:S,messageVariables:O,trigger:k="onChange",validateTrigger:j,hidden:I,help:M,layout:R}=e,{getPrefixCls:N}=o.useContext(f.E_),{name:P}=o.useContext(m.q3),F=function(e){if("function"==typeof e)return e;let t=(0,g.Z)(e);return t.length<=1?t[0]:t}(C),T="function"==typeof F,A=o.useContext(m.qI),{validateTrigger:_}=o.useContext(c.zb),B=void 0!==j?j:_,H=null!=t,z=N("form",x),L=(0,p.Z)(z),[D,W,q]=(0,b.ZP)(z,L);(0,d.ln)("Form.Item");let $=o.useContext(c.ZM),K=o.useRef(null),[Y,Q]=function(e){let[t,n]=o.useState(e),r=o.useRef(null),a=o.useRef([]),i=o.useRef(!1);return o.useEffect(()=>(i.current=!1,()=>{i.current=!0,h.Z.cancel(r.current),r.current=null}),[]),[t,function(e){i.current||(null===r.current&&(a.current=[],r.current=(0,h.Z)(()=>{r.current=null,n(e=>{let t=e;return a.current.forEach(e=>{t=e(t)}),t})})),a.current.push(e))}]}({}),[J,ee]=(0,l.Z)(()=>U()),et=(e,t)=>{Q(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})},[en,er]=o.useMemo(()=>{let e=(0,r.Z)(J.errors),t=(0,r.Z)(J.warnings);return Object.values(Y).forEach(n=>{e.push.apply(e,(0,r.Z)(n.errors||[])),t.push.apply(t,(0,r.Z)(n.warnings||[]))}),[e,t]},[Y,J.errors,J.warnings]),eo=function(){let{itemRef:e}=o.useContext(m.q3),t=o.useRef({});return function(n,r){let o=r&&"object"==typeof r&&(0,s.C4)(r),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 ea(r,c,l){return n&&!I?o.createElement(V,{prefixCls:z,hasFeedback:e.hasFeedback,validateStatus:e.validateStatus,meta:J,errors:en,warnings:er,noStyle:!0,name:t},r):o.createElement(X,Object.assign({key:"row"},e,{className:i()(a,q,L,W),prefixCls:z,fieldId:c,isRequired:l,errors:en,warnings:er,meta:J,onSubItemMetaChange:et,layout:R,name:t}),r)}if(!H&&!T&&!v)return D(ea(F));let ei={};return"string"==typeof S?ei.label=S:t&&(ei.label=String(t)),O&&(ei=Object.assign(Object.assign({},ei),O)),D(o.createElement(c.gN,Object.assign({},e,{messageVariables:ei,trigger:k,validateTrigger:B,onMetaChange:e=>{let t=null==$?void 0:$.getKey(e.name);if(ee(e.destroy?U():e,!0),n&&!1!==M&&A){let n=e.name;if(e.destroy)n=K.current||n;else if(void 0!==t){let[e,o]=t;n=[e].concat((0,r.Z)(o)),K.current=n}A(e,n)}}}),(n,a,i)=>{let c=(0,y.qo)(t).length&&a?a.name:[],l=(0,y.dD)(c,P),d=void 0!==Z?Z:!!(null==E?void 0:E.some(e=>{if(e&&"object"==typeof e&&e.required&&!e.warningOnly)return!0;if("function"==typeof e){let t=e(i);return(null==t?void 0:t.required)&&!(null==t?void 0:t.warningOnly)}return!1})),f=Object.assign({},n),p=null;if(Array.isArray(F)&&H)p=F;else if(T&&(!(w||v)||H));else if(!v||T||H){if(o.isValidElement(F)){let t=Object.assign(Object.assign({},F.props),f);if(t.id||(t.id=l),M||en.length>0||er.length>0||e.extra){let n=[];(M||en.length>0)&&n.push("".concat(l,"_help")),e.extra&&n.push("".concat(l,"_extra")),t["aria-describedby"]=n.join(" ")}en.length>0&&(t["aria-invalid"]="true"),d&&(t["aria-required"]="true"),(0,s.Yr)(F)&&(t.ref=eo(c,F)),new Set([].concat((0,r.Z)((0,y.qo)(k)),(0,r.Z)((0,y.qo)(B)))).forEach(e=>{t[e]=function(){for(var t,n,r,o=arguments.length,a=Array(o),i=0;i{}}),c=r.createContext(null),l=e=>{let t=(0,a.Z)(e,["prefixCls"]);return r.createElement(o.RV,Object.assign({},t))},s=r.createContext({prefixCls:""}),u=r.createContext({}),d=e=>{let{children:t,status:n,override:o}=e,a=r.useContext(u),i=r.useMemo(()=>{let e=Object.assign({},a);return o&&delete e.isFormItemInput,n&&(delete e.status,delete e.hasFeedback,delete e.feedbackIcon),e},[n,o,a]);return r.createElement(u.Provider,{value:i},t)},f=r.createContext(void 0)},4064:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(2265);function o(e){let[t,n]=r.useState(e);return r.useEffect(()=>{let t=setTimeout(()=>{n(e)},e.length?0:10);return()=>{clearTimeout(t)}},[e]),t}},29487:function(e,t,n){"use strict";n.d(t,{Z:function(){return h},S:function(){return g}});var r=n(2265),o=n(87379),a=n(2868);let i=e=>"object"==typeof e&&null!=e&&1===e.nodeType,c=(e,t)=>(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e,l=(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&&i=t&&c>=n?a-e-r:i>t&&cn?i-t+o:0,u=e=>{let t=e.parentElement;return null==t?e.getRootNode().host||null:t},d=(e,t)=>{var n,r,o,a;if("undefined"==typeof document)return[];let{scrollMode:c,block:d,inline:f,boundary:p,skipOverflowHiddenElements:m}=t,g="function"==typeof p?p:e=>e!==p;if(!i(e))throw TypeError("Invalid target");let v=document.scrollingElement||document.documentElement,h=[],b=e;for(;i(b)&&g(b);){if((b=u(b))===v){h.push(b);break}null!=b&&b===document.body&&l(b)&&!l(document.documentElement)||null!=b&&l(b,m)&&h.push(b)}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:C,width:Z,top:S,right:O,bottom:k,left:j}=e.getBoundingClientRect(),{top:I,right:M,bottom:R,left: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),P="start"===d||"nearest"===d?S-I:"end"===d?k+R:S+C/2-I+R,F="center"===f?j+Z/2-N+M:"end"===f?O+M:j-N,T=[];for(let e=0;e=0&&j>=0&&k<=x&&O<=y&&(t===v&&!l(t)||S>=o&&k<=i&&j>=u&&O<=a))break;let p=getComputedStyle(t),m=parseInt(p.borderLeftWidth,10),g=parseInt(p.borderTopWidth,10),b=parseInt(p.borderRightWidth,10),I=parseInt(p.borderBottomWidth,10),M=0,R=0,N="offsetWidth"in t?t.offsetWidth-t.clientWidth-m-b:0,A="offsetHeight"in t?t.offsetHeight-t.clientHeight-g-I:0,_="offsetWidth"in t?0===t.offsetWidth?0:r/t.offsetWidth:0,B="offsetHeight"in t?0===t.offsetHeight?0:n/t.offsetHeight:0;if(v===t)M="start"===d?P:"end"===d?P-x:"nearest"===d?s(E,E+x,x,g,I,E+P,E+P+C,C):P-x/2,R="start"===f?F:"center"===f?F-y/2:"end"===f?F-y:s(w,w+y,y,m,b,w+F,w+F+Z,Z),M=Math.max(0,M+E),R=Math.max(0,R+w);else{M="start"===d?P-o-g:"end"===d?P-i+I+A:"nearest"===d?s(o,i,n,g,I+A,P,P+C,C):P-(o+n/2)+A/2,R="start"===f?F-u-m:"center"===f?F-(u+r/2)+N/2:"end"===f?F-a+b+N:s(u,a,r,m,b+N,F,F+Z,Z);let{scrollLeft:e,scrollTop:c}=t;M=0===B?0:Math.max(0,Math.min(c+M/B,t.scrollHeight-n/B+A)),R=0===_?0:Math.max(0,Math.min(e+R/_,t.scrollWidth-r/_+N)),P+=c-M,F+=e-R}T.push({el:t,top:M,left:R})}return T},f=e=>!1===e?{block:"end",inline:"nearest"}:e===Object(e)&&0!==Object.keys(e).length?e:{block:"start",inline:"nearest"};var p=n(13861),m=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,r=Object.getOwnPropertySymbols(e);ot.indexOf(r[o])&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n};function g(e){return(0,p.qo)(e).join("_")}function v(e,t){let n=t.getFieldInstance(e),r=(0,a.bn)(n);if(r)return r;let o=(0,p.dD)((0,p.qo)(e),t.__INTERNAL__.name);if(o)return document.getElementById(o)}function h(e){let[t]=(0,o.cI)(),n=r.useRef({}),a=r.useMemo(()=>null!=e?e:Object.assign(Object.assign({},t),{__INTERNAL__:{itemRef:e=>t=>{let r=g(e);t?n.current[r]=t:delete n.current[r]}},scrollToField:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{focus:n}=t,r=m(t,["focus"]),o=v(e,a);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(d(e,t));let r="boolean"==typeof t||null==t?void 0:t.behavior;for(let{el:o,top:a,left:i}of d(e,f(t))){let e=a-n.top+n.bottom,t=i-n.left+n.right;o.scroll({top:e,left:t,behavior:r})}}(o,Object.assign({scrollMode:"if-needed",block:"nearest"},r)),n&&a.focusField(e))},focusField:e=>{var t,n;let r=a.getFieldInstance(e);"function"==typeof(null==r?void 0:r.focus)?r.focus():null===(n=null===(t=v(e,a))||void 0===t?void 0:t.focus)||void 0===n||n.call(t)},getFieldInstance:e=>{let t=g(e);return n.current[t]}}),[e,t]);return[a]}},56250:function(e,t,n){"use strict";var r=n(2265),o=n(71744),a=n(39109);t.Z=(e,t,n)=>{var i,c;let l;let{variant:s,[e]:u}=r.useContext(o.E_),d=r.useContext(a.pg),f=null==u?void 0:u.variant;l=void 0!==t?t:!1===n?"borderless":null!==(c=null!==(i=null!=d?d:f)&&void 0!==i?i:s)&&void 0!==c?c:"outlined";let p=o.tr.includes(l);return[l,p]}},10032:function(e,t,n){"use strict";n.d(t,{Z:function(){return w}});var r=n(39109),o=n(14605),a=n(2265),i=n(36760),c=n.n(i),l=n(87379),s=n(71744),u=n(86586),d=n(64024),f=n(33759),p=n(59189),m=n(29487),g=n(47713),v=n(77360),h=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 b=a.forwardRef((e,t)=>{let n=a.useContext(u.Z),{getPrefixCls:o,direction:i,requiredMark:b,colon:y,scrollToFirstError:x,className:w,style:E}=(0,s.dj)("form"),{prefixCls:C,className:Z,rootClassName:S,size:O,disabled:k=n,form:j,colon:I,labelAlign:M,labelWrap:R,labelCol:N,wrapperCol:P,hideRequiredMark:F,layout:T="horizontal",scrollToFirstError:A,requiredMark:_,onFinishFailed:B,name:H,style:z,feedbackIcons:L,variant:D}=e,W=h(e,["prefixCls","className","rootClassName","size","disabled","form","colon","labelAlign","labelWrap","labelCol","wrapperCol","hideRequiredMark","layout","scrollToFirstError","requiredMark","onFinishFailed","name","style","feedbackIcons","variant"]),V=(0,f.Z)(O),q=a.useContext(v.Z),X=a.useMemo(()=>void 0!==_?_:!F&&(void 0===b||b),[F,_,b]),G=null!=I?I:y,U=o("form",C),$=(0,d.Z)(U),[K,Y,Q]=(0,g.ZP)(U,$),J=c()(U,"".concat(U,"-").concat(T),{["".concat(U,"-hide-required-mark")]:!1===X,["".concat(U,"-rtl")]:"rtl"===i,["".concat(U,"-").concat(V)]:V},Q,$,Y,w,Z,S),[ee]=(0,m.Z)(j),{__INTERNAL__:et}=ee;et.name=H;let en=a.useMemo(()=>({name:H,labelAlign:M,labelCol:N,labelWrap:R,wrapperCol:P,layout:T,colon:G,requiredMark:X,itemRef:et.itemRef,form:ee,feedbackIcons:L}),[H,M,N,P,T,G,X,ee,L]),er=a.useRef(null);a.useImperativeHandle(t,()=>{var e;return Object.assign(Object.assign({},ee),{nativeElement:null===(e=er.current)||void 0===e?void 0:e.nativeElement})});let eo=(e,t)=>{if(e){let n={block:"nearest"};"object"==typeof e&&(n=Object.assign(Object.assign({},n),e)),ee.scrollToField(t,n)}};return K(a.createElement(r.pg.Provider,{value:D},a.createElement(u.n,{disabled:k},a.createElement(p.Z.Provider,{value:V},a.createElement(r.RV,{validateMessages:q},a.createElement(r.q3.Provider,{value:en},a.createElement(r.Ux,{status:!0},a.createElement(l.ZP,Object.assign({id:H},W,{name:H,onFinishFailed:e=>{if(null==B||B(e),e.errorFields.length){let t=e.errorFields[0].name;if(void 0!==A){eo(A,t);return}void 0!==x&&eo(x,t)}},form:ee,ref:er,style:Object.assign(Object.assign({},E),z),className:J})))))))))});var y=n(2740),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};b.Item=y.Z,b.List=e=>{var{prefixCls:t,children:n}=e,o=x(e,["prefixCls","children"]);let{getPrefixCls:i}=a.useContext(s.E_),c=i("form",t),u=a.useMemo(()=>({prefixCls:c,status:"error"}),[c]);return a.createElement(l.aV,Object.assign({},o),(e,t,o)=>a.createElement(r.Rk.Provider,{value:u},n(e.map(e=>Object.assign(Object.assign({},e),{fieldKey:e.key})),t,{errors:o.errors,warnings:o.warnings})))},b.ErrorList=o.Z,b.useForm=m.Z,b.useFormInstance=function(){let{form:e}=a.useContext(r.q3);return e},b.useWatch=l.qo,b.Provider=r.RV,b.create=()=>{};var w=b},47713:function(e,t,n){"use strict";n.d(t,{ZP:function(){return x},B4:function(){return y}});var r=n(93463),o=n(12918),a=n(691),i=n(63074),c=n(71140),l=n(99320),s=e=>{let{componentCls:t}=e,n="".concat(t,"-show-help"),r="".concat(t,"-show-help-item");return{[n]:{transition:"opacity ".concat(e.motionDurationFast," ").concat(e.motionEaseInOut),"&-appear, &-enter":{opacity:0,"&-active":{opacity:1}},"&-leave":{opacity:1,"&-active":{opacity:0}},[r]:{overflow:"hidden",transition:"height ".concat(e.motionDurationFast," ").concat(e.motionEaseInOut,",\n opacity ").concat(e.motionDurationFast," ").concat(e.motionEaseInOut,",\n transform ").concat(e.motionDurationFast," ").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 u=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}}),d=(e,t)=>{let{formItemCls:n}=e;return{[n]:{["".concat(n,"-label > label")]:{height:t},["".concat(n,"-control-input")]:{minHeight:t}}}},f=e=>{let{componentCls:t}=e;return{[e.componentCls]:Object.assign(Object.assign(Object.assign({},(0,o.Wf)(e)),u(e)),{["".concat(t,"-text")]:{display:"inline-block",paddingInlineEnd:e.paddingSM},"&-small":Object.assign({},d(e,e.controlHeightSM)),"&-large":Object.assign({},d(e,e.controlHeightLG))})}},p=e=>{let{formItemCls:t,iconCls:n,rootPrefixCls:r,antCls:i,labelRequiredMarkColor:c,labelColor:l,labelFontSize:s,labelHeight:u,labelColonMarginInlineStart:d,labelColonMarginInlineEnd:f,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(i,"-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":{verticalAlign:"middle",textWrap:"balance"}},"> label":{position:"relative",display:"inline-flex",alignItems:"center",maxWidth:"100%",height:u,color:l,fontSize:s,["> ".concat(n)]:{fontSize:e.fontSize,verticalAlign:"top"},["&".concat(t,"-required")]:{"&::before":{display:"inline-block",marginInlineEnd:e.marginXXS,color:c,fontSize:e.fontSize,fontFamily:"SimSun, sans-serif",lineHeight:1,content:'"*"'},["&".concat(t,"-required-mark-hidden, &").concat(t,"-required-mark-optional")]:{"&::before":{display:"none"}}},["".concat(t,"-optional")]:{display:"inline-block",marginInlineStart:e.marginXXS,color:e.colorTextDescription,["&".concat(t,"-required-mark-hidden")]:{display:"none"}},["".concat(t,"-tooltip")]:{color:e.colorTextDescription,cursor:"help",writingMode:"horizontal-tb",marginInlineStart:e.marginXXS},"&::after":{content:'":"',position:"relative",marginBlock:0,marginInlineStart:d,marginInlineEnd:f},["&".concat(t,"-no-colon::after")]:{content:'"\\a0"'}}},["".concat(t,"-control")]:{"--ant-display":"flex",flexDirection:"column",flexGrow:1,["&:first-child:not([class^=\"'".concat(r,"-col-'\"]):not([class*=\"' ").concat(r,"-col-'\"])")]:{width:"100%"},"&-input":{position:"relative",display:"flex",alignItems:"center",minHeight:e.controlHeight,"&-content":{flex:"auto",maxWidth:"100%",["&:has(> ".concat(i,"-switch:only-child, > ").concat(i,"-rate:only-child)")]:{display:"flex",alignItems:"center"}}}},[t]:{"&-additional":{display:"flex",flexDirection:"column"},"&-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}}})}},m=e=>({padding:e.verticalLabelPadding,margin:e.verticalLabelMargin,whiteSpace:"initial",textAlign:"start","> label":{margin:0,"&::after":{visibility:"hidden"}}}),g=e=>{let{antCls:t,formItemCls:n}=e;return{["".concat(n,"-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"}},["".concat(t,"-col-24").concat(n,"-label,\n ").concat(t,"-col-xl-24").concat(n,"-label")]:m(e)}}},v=e=>{let{componentCls:t,formItemCls:n,inlineItemMarginBottom:r}=e;return{["".concat(t,"-inline")]:{display:"flex",flexWrap:"wrap",["".concat(n,"-inline")]:{flex:"none",marginInlineEnd:e.margin,marginBottom:r,"&-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=>{let{componentCls:t,formItemCls:n,rootPrefixCls:r}=e;return{["".concat(n," ").concat(n,"-label")]:m(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%"}}}}}},b=e=>{let{componentCls:t,formItemCls:n,antCls:o}=e;return{["".concat(n,"-vertical")]:{["".concat(n,"-row")]:{flexDirection:"column"},["".concat(n,"-label > label")]:{height:"auto"},["".concat(n,"-control")]:{width:"100%"},["".concat(n,"-label,\n ").concat(o,"-col-24").concat(n,"-label,\n ").concat(o,"-col-xl-24").concat(n,"-label")]:m(e)},["@media (max-width: ".concat((0,r.bf)(e.screenXSMax),")")]:[h(e),{[t]:{["".concat(n,":not(").concat(n,"-horizontal)")]:{["".concat(o,"-col-xs-24").concat(n,"-label")]:m(e)}}}],["@media (max-width: ".concat((0,r.bf)(e.screenSMMax),")")]:{[t]:{["".concat(n,":not(").concat(n,"-horizontal)")]:{["".concat(o,"-col-sm-24").concat(n,"-label")]:m(e)}}},["@media (max-width: ".concat((0,r.bf)(e.screenMDMax),")")]:{[t]:{["".concat(n,":not(").concat(n,"-horizontal)")]:{["".concat(o,"-col-md-24").concat(n,"-label")]:m(e)}}},["@media (max-width: ".concat((0,r.bf)(e.screenLGMax),")")]:{[t]:{["".concat(n,":not(").concat(n,"-horizontal)")]:{["".concat(o,"-col-lg-24").concat(n,"-label")]:m(e)}}}}},y=(e,t)=>(0,c.IX)(e,{formItemCls:"".concat(e.componentCls,"-item"),rootPrefixCls:t});var x=(0,l.I$)("Form",(e,t)=>{let{rootPrefixCls:n}=t,r=y(e,n);return[f(r),p(r),s(r),g(r),v(r),b(r),(0,i.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,inlineItemMarginBottom:0}),{order:-1e3})},13861:function(e,t,n){"use strict";n.d(t,{dD:function(){return a},lR:function(){return i},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 i(e,t,n,r,o,a){let i=r;return void 0!==a?i=a:n.validating?i="validating":e.length?i="error":t.length?i="warning":(n.touched||o&&n.validated)&&(i="success"),i}},77360:function(e,t,n){"use strict";var r=n(2265);t.Z=(0,r.createContext)(void 0)},62807:function(e,t,n){"use strict";let r=(0,n(2265).createContext)({});t.Z=r},54998:function(e,t,n){"use strict";var r=n(2265),o=n(36760),a=n.n(o),i=n(71744),c=n(62807),l=n(96776),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};function u(e){return"auto"===e?"1 1 auto":"number"==typeof e?"".concat(e," ").concat(e," auto"):/^\d+(\.\d+)?(px|em|rem|%)$/.test(e)?"0 0 ".concat(e):e}let d=["xs","sm","md","lg","xl","xxl"],f=r.forwardRef((e,t)=>{let{getPrefixCls:n,direction:o}=r.useContext(i.E_),{gutter:f,wrap:p}=r.useContext(c.Z),{prefixCls:m,span:g,order:v,offset:h,push:b,pull:y,className:x,children:w,flex:E,style:C}=e,Z=s(e,["prefixCls","span","order","offset","push","pull","className","children","flex","style"]),S=n("col",m),[O,k,j]=(0,l.cG)(S),I={},M={};d.forEach(t=>{let n={},r=e[t];"number"==typeof r?n.span=r:"object"==typeof r&&(n=r||{}),delete Z[t],M=Object.assign(Object.assign({},M),{["".concat(S,"-").concat(t,"-").concat(n.span)]:void 0!==n.span,["".concat(S,"-").concat(t,"-order-").concat(n.order)]:n.order||0===n.order,["".concat(S,"-").concat(t,"-offset-").concat(n.offset)]:n.offset||0===n.offset,["".concat(S,"-").concat(t,"-push-").concat(n.push)]:n.push||0===n.push,["".concat(S,"-").concat(t,"-pull-").concat(n.pull)]:n.pull||0===n.pull,["".concat(S,"-rtl")]:"rtl"===o}),n.flex&&(M["".concat(S,"-").concat(t,"-flex")]=!0,I["--".concat(S,"-").concat(t,"-flex")]=u(n.flex))});let R=a()(S,{["".concat(S,"-").concat(g)]:void 0!==g,["".concat(S,"-order-").concat(v)]:v,["".concat(S,"-offset-").concat(h)]:h,["".concat(S,"-push-").concat(b)]:b,["".concat(S,"-pull-").concat(y)]:y},x,M,k,j),N={};if(null==f?void 0:f[0]){let e="number"==typeof f[0]?"".concat(f[0]/2,"px"):"calc(".concat(f[0]," / 2)");N.paddingLeft=e,N.paddingRight=e}return E&&(N.flex=u(E),!1!==p||N.minWidth||(N.minWidth=0)),O(r.createElement("div",Object.assign({},Z,{style:Object.assign(Object.assign(Object.assign({},N),C),I),className:R,ref:t}),w))});t.Z=f},28617:function(e,t,n){"use strict";var r=n(2265),o=n(27380),a=n(51646),i=n(6543);t.Z=function(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=(0,r.useRef)(t),[,c]=(0,a.N)(),l=(0,i.ZP)();return(0,o.Z)(()=>{let t=l.subscribe(t=>{n.current=t,e&&c()});return()=>l.unsubscribe(t)},[]),n.current}},77774:function(e,t,n){"use strict";n.d(t,{Z:function(){return p}});var r=n(2265),o=n(36760),a=n.n(o),i=n(6543),c=n(71744),l=n(28617),s=n(62807),u=n(96776),d=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 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 p=r.forwardRef((e,t)=>{let{prefixCls:n,justify:o,align:p,className:m,style:g,children:v,gutter:h=0,wrap:b}=e,y=d(e,["prefixCls","justify","align","className","style","children","gutter","wrap"]),{getPrefixCls:x,direction:w}=r.useContext(c.E_),E=(0,l.Z)(!0,null),C=f(p,E),Z=f(o,E),S=x("row",n),[O,k,j]=(0,u.VM)(S),I=function(e,t){let n=[void 0,void 0],r=Array.isArray(e)?e:[e,void 0],o=t||{xs:!0,sm:!0,md:!0,lg:!0,xl:!0,xxl:!0};return r.forEach((e,t)=>{if("object"==typeof e&&null!==e)for(let r=0;r({gutter:[N,P],wrap:b}),[N,P,b]);return O(r.createElement(s.Z.Provider,{value:F},r.createElement("div",Object.assign({},y,{className:M,style:Object.assign(Object.assign({},R),g),ref:t}),v)))})},96776:function(e,t,n){"use strict";n.d(t,{VM:function(){return u},cG:function(){return f},hd:function(){return d}});var r=n(93463),o=n(99320),a=n(71140);let i=e=>{let{componentCls:t}=e;return{[t]:{position:"relative",maxWidth:"100%",minHeight:1}}},c=(e,t)=>{let{prefixCls:n,componentCls:r,gridColumns:o}=e,a={};for(let e=o;e>=0;e--)0===e?(a["".concat(r).concat(t,"-").concat(e)]={display:"none"},a["".concat(r,"-push-").concat(e)]={insetInlineStart:"auto"},a["".concat(r,"-pull-").concat(e)]={insetInlineEnd:"auto"},a["".concat(r).concat(t,"-push-").concat(e)]={insetInlineStart:"auto"},a["".concat(r).concat(t,"-pull-").concat(e)]={insetInlineEnd:"auto"},a["".concat(r).concat(t,"-offset-").concat(e)]={marginInlineStart:0},a["".concat(r).concat(t,"-order-").concat(e)]={order:0}):(a["".concat(r).concat(t,"-").concat(e)]=[{"--ant-display":"block",display:"block"},{display:"var(--ant-display)",flex:"0 0 ".concat(e/o*100,"%"),maxWidth:"".concat(e/o*100,"%")}],a["".concat(r).concat(t,"-push-").concat(e)]={insetInlineStart:"".concat(e/o*100,"%")},a["".concat(r).concat(t,"-pull-").concat(e)]={insetInlineEnd:"".concat(e/o*100,"%")},a["".concat(r).concat(t,"-offset-").concat(e)]={marginInlineStart:"".concat(e/o*100,"%")},a["".concat(r).concat(t,"-order-").concat(e)]={order:e});return a["".concat(r).concat(t,"-flex")]={flex:"var(--".concat(n).concat(t,"-flex)")},a},l=(e,t)=>c(e,t),s=(e,t,n)=>({["@media (min-width: ".concat((0,r.bf)(t),")")]:Object.assign({},l(e,n))}),u=(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"}}}},()=>({})),d=e=>({xs:e.screenXSMin,sm:e.screenSMMin,md:e.screenMDMin,lg:e.screenLGMin,xl:e.screenXLMin,xxl:e.screenXXLMin}),f=(0,o.I$)("Grid",e=>{let t=(0,a.IX)(e,{gridColumns:24}),n=d(t);return delete n.xs,[i(t),l(t,""),l(t,"-xs"),Object.keys(n).map(e=>s(t,n[e],"-".concat(e))).reduce((e,t)=>Object.assign(Object.assign({},e),t),{})]},()=>({}))},19015:function(e,t,n){"use strict";n.d(t,{Z:function(){return ev}});var r=n(2265),o=n(70464),a=n(1119),i={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M890.5 755.3L537.9 269.2c-12.8-17.6-39-17.6-51.7 0L133.5 755.3A8 8 0 00140 768h75c5.1 0 9.9-2.5 12.9-6.6L512 369.8l284.1 391.6c3 4.1 7.8 6.6 12.9 6.6h75c6.5 0 10.3-7.4 6.5-12.7z"}}]},name:"up",theme:"outlined"},c=n(55015),l=r.forwardRef(function(e,t){return r.createElement(c.Z,(0,a.Z)({},e,{ref:t,icon:i}))}),s=n(36760),u=n.n(s),d=n(11993),f=n(41154),p=n(26365),m=n(6989),g=n(76405),v=n(25049);function h(){return"function"==typeof BigInt}function b(e){return!e&&0!==e&&!Number.isNaN(e)||!String(e).trim()}function y(e){var t=e.trim(),n=t.startsWith("-");n&&(t=t.slice(1)),(t=t.replace(/(\.\d*[^0])0*$/,"$1").replace(/\.0*$/,"").replace(/^0+/,"")).startsWith(".")&&(t="0".concat(t));var r=t||"0",o=r.split("."),a=o[0]||"0",i=o[1]||"0";"0"===a&&"0"===i&&(n=!1);var c=n?"-":"";return{negative:n,negativeStr:c,trimStr:r,integerStr:a,decimalStr:i,fullStr:"".concat(c).concat(r)}}function x(e){var t=String(e);return!Number.isNaN(Number(t))&&t.includes("e")}function w(e){var t=String(e);if(x(e)){var n=Number(t.slice(t.indexOf("e-")+2)),r=t.match(/\.(\d+)/);return null!=r&&r[1]&&(n+=r[1].length),n}return t.includes(".")&&C(t)?t.length-t.indexOf(".")-1:0}function E(e){var t=String(e);if(x(e)){if(e>Number.MAX_SAFE_INTEGER)return String(h()?BigInt(e).toString():Number.MAX_SAFE_INTEGER);if(e=this.add(e.negate().toString()).toNumber()}},{key:"toNumber",value:function(){return this.isNaN()?NaN:Number(this.toString())}},{key:"toString",value:function(){var e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];return e?this.isInvalidate()?"":y("".concat(this.getMark()).concat(this.getIntegerStr(),".").concat(this.getDecimalStr())).fullStr:this.origin}}]),e}(),S=function(){function e(t){if((0,g.Z)(this,e),(0,d.Z)(this,"origin",""),(0,d.Z)(this,"number",void 0),(0,d.Z)(this,"empty",void 0),b(t)){this.empty=!0;return}this.origin=String(t),this.number=Number(t)}return(0,v.Z)(e,[{key:"negate",value:function(){return new e(-this.toNumber())}},{key:"add",value:function(t){if(this.isInvalidate())return new e(t);var n=Number(t);if(Number.isNaN(n))return this;var r=this.number+n;if(r>Number.MAX_SAFE_INTEGER)return new e(Number.MAX_SAFE_INTEGER);if(rNumber.MAX_SAFE_INTEGER)return new e(Number.MAX_SAFE_INTEGER);if(r=this.add(e.negate().toString()).toNumber()}},{key:"toNumber",value:function(){return this.number}},{key:"toString",value:function(){var e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];return e?this.isInvalidate()?"":E(this.number):this.origin}}]),e}();function O(e){return h()?new Z(e):new S(e)}function k(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(""===e)return"";var o=y(e),a=o.negativeStr,i=o.integerStr,c=o.decimalStr,l="".concat(t).concat(c),s="".concat(a).concat(i);if(n>=0){var u=Number(c[n]);return u>=5&&!r?k(O(e).add("".concat(a,"0.").concat("0".repeat(n)).concat(10-u)).toString(),t,n,r):0===n?s:"".concat(s).concat(t).concat(c.padEnd(n,"0").slice(0,n))}return".0"===l?s:"".concat(s).concat(l)}var j=n(2027),I=n(27380),M=n(28791),R=n(32559),N=n(79267),P=function(){var e=(0,r.useState)(!1),t=(0,p.Z)(e,2),n=t[0],o=t[1];return(0,I.Z)(function(){o((0,N.Z)())},[]),n},F=n(53346);function T(e){var t=e.prefixCls,n=e.upNode,o=e.downNode,i=e.upDisabled,c=e.downDisabled,l=e.onStep,s=r.useRef(),f=r.useRef([]),p=r.useRef();p.current=l;var m=function(){clearTimeout(s.current)},g=function(e,t){e.preventDefault(),m(),p.current(t),s.current=setTimeout(function e(){p.current(t),s.current=setTimeout(e,200)},600)};if(r.useEffect(function(){return function(){m(),f.current.forEach(function(e){return F.Z.cancel(e)})}},[]),P())return null;var v="".concat(t,"-handler"),h=u()(v,"".concat(v,"-up"),(0,d.Z)({},"".concat(v,"-up-disabled"),i)),b=u()(v,"".concat(v,"-down"),(0,d.Z)({},"".concat(v,"-down-disabled"),c)),y=function(){return f.current.push((0,F.Z)(m))},x={unselectable:"on",role:"button",onMouseUp:y,onMouseLeave:y};return r.createElement("div",{className:"".concat(v,"-wrap")},r.createElement("span",(0,a.Z)({},x,{onMouseDown:function(e){g(e,!0)},"aria-label":"Increase Value","aria-disabled":i,className:h}),n||r.createElement("span",{unselectable:"on",className:"".concat(t,"-handler-up-inner")})),r.createElement("span",(0,a.Z)({},x,{onMouseDown:function(e){g(e,!1)},"aria-label":"Decrease Value","aria-disabled":c,className:b}),o||r.createElement("span",{unselectable:"on",className:"".concat(t,"-handler-down-inner")})))}function A(e){var t="number"==typeof e?E(e):y(e).fullStr;return t.includes(".")?y(t.replace(/(\d)\.(\d)/g,"$1$2.")).fullStr:e+"0"}var _=n(25209),B=function(){var e=(0,r.useRef)(0),t=function(){F.Z.cancel(e.current)};return(0,r.useEffect)(function(){return t},[]),function(n){t(),e.current=(0,F.Z)(function(){n()})}},H=["prefixCls","className","style","min","max","step","defaultValue","value","disabled","readOnly","upHandler","downHandler","keyboard","changeOnWheel","controls","classNames","stringMode","parser","formatter","precision","decimalSeparator","onChange","onInput","onPressEnter","onStep","changeOnBlur","domRef"],z=["disabled","style","prefixCls","value","prefix","suffix","addonBefore","addonAfter","className","classNames"],L=function(e,t){return e||t.isEmpty()?t.toString():t.toNumber()},D=function(e){var t=O(e);return t.isInvalidate()?null:t},W=r.forwardRef(function(e,t){var n,o,i=e.prefixCls,c=e.className,l=e.style,s=e.min,g=e.max,v=e.step,h=void 0===v?1:v,b=e.defaultValue,y=e.value,x=e.disabled,Z=e.readOnly,S=e.upHandler,j=e.downHandler,N=e.keyboard,P=e.changeOnWheel,F=void 0!==P&&P,_=e.controls,z=(e.classNames,e.stringMode),W=e.parser,V=e.formatter,q=e.precision,X=e.decimalSeparator,G=e.onChange,U=e.onInput,$=e.onPressEnter,K=e.onStep,Y=e.changeOnBlur,Q=void 0===Y||Y,J=e.domRef,ee=(0,m.Z)(e,H),et="".concat(i,"-input"),en=r.useRef(null),er=r.useState(!1),eo=(0,p.Z)(er,2),ea=eo[0],ei=eo[1],ec=r.useRef(!1),el=r.useRef(!1),es=r.useRef(!1),eu=r.useState(function(){return O(null!=y?y:b)}),ed=(0,p.Z)(eu,2),ef=ed[0],ep=ed[1],em=r.useCallback(function(e,t){return t?void 0:q>=0?q:Math.max(w(e),w(h))},[q,h]),eg=r.useCallback(function(e){var t=String(e);if(W)return W(t);var n=t;return X&&(n=n.replace(X,".")),n.replace(/[^\w.-]+/g,"")},[W,X]),ev=r.useRef(""),eh=r.useCallback(function(e,t){if(V)return V(e,{userTyping:t,input:String(ev.current)});var n="number"==typeof e?E(e):e;if(!t){var r=em(n,t);C(n)&&(X||r>=0)&&(n=k(n,X||".",r))}return n},[V,em,X]),eb=r.useState(function(){var e=null!=b?b:y;return ef.isInvalidate()&&["string","number"].includes((0,f.Z)(e))?Number.isNaN(e)?"":e:eh(ef.toString(),!1)}),ey=(0,p.Z)(eb,2),ex=ey[0],ew=ey[1];function eE(e,t){ew(eh(e.isInvalidate()?e.toString(!1):e.toString(!t),t))}ev.current=ex;var eC=r.useMemo(function(){return D(g)},[g,q]),eZ=r.useMemo(function(){return D(s)},[s,q]),eS=r.useMemo(function(){return!(!eC||!ef||ef.isInvalidate())&&eC.lessEquals(ef)},[eC,ef]),eO=r.useMemo(function(){return!(!eZ||!ef||ef.isInvalidate())&&ef.lessEquals(eZ)},[eZ,ef]),ek=(n=en.current,o=(0,r.useRef)(null),[function(){try{var e=n.selectionStart,t=n.selectionEnd,r=n.value,a=r.substring(0,e),i=r.substring(t);o.current={start:e,end:t,value:r,beforeTxt:a,afterTxt:i}}catch(e){}},function(){if(n&&o.current&&ea)try{var e=n.value,t=o.current,r=t.beforeTxt,a=t.afterTxt,i=t.start,c=e.length;if(e.startsWith(r))c=r.length;else if(e.endsWith(a))c=e.length-o.current.afterTxt.length;else{var l=r[i-1],s=e.indexOf(l,i-1);-1!==s&&(c=s+1)}n.setSelectionRange(c,c)}catch(e){(0,R.ZP)(!1,"Something warning of cursor restore. Please fire issue about this: ".concat(e.message))}}]),ej=(0,p.Z)(ek,2),eI=ej[0],eM=ej[1],eR=function(e){return eC&&!e.lessEquals(eC)?eC:eZ&&!eZ.lessEquals(e)?eZ:null},eN=function(e){return!eR(e)},eP=function(e,t){var n=e,r=eN(n)||n.isEmpty();if(n.isEmpty()||t||(n=eR(n)||n,r=!0),!Z&&!x&&r){var o,a=n.toString(),i=em(a,t);return i>=0&&!eN(n=O(k(a,".",i)))&&(n=O(k(a,".",i,!0))),n.equals(ef)||(o=n,void 0===y&&ep(o),null==G||G(n.isEmpty()?null:L(z,n)),void 0===y&&eE(n,t)),n}return ef},eF=B(),eT=function e(t){if(eI(),ev.current=t,ew(t),!el.current){var n=O(eg(t));n.isNaN()||eP(n,!0)}null==U||U(t),eF(function(){var n=t;W||(n=t.replace(/。/g,".")),n!==t&&e(n)})},eA=function(e){if((!e||!eS)&&(e||!eO)){ec.current=!1;var t,n=O(es.current?A(h):h);e||(n=n.negate());var r=eP((ef||O(0)).add(n.toString()),!1);null==K||K(L(z,r),{offset:es.current?A(h):h,type:e?"up":"down"}),null===(t=en.current)||void 0===t||t.focus()}},e_=function(e){var t,n=O(eg(ex));t=n.isNaN()?eP(ef,e):eP(n,e),void 0!==y?eE(ef,!1):t.isNaN()||eE(t,!1)};return r.useEffect(function(){if(F&&ea){var e=function(e){eA(e.deltaY<0),e.preventDefault()},t=en.current;if(t)return t.addEventListener("wheel",e,{passive:!1}),function(){return t.removeEventListener("wheel",e)}}}),(0,I.o)(function(){ef.isInvalidate()||eE(ef,!1)},[q,V]),(0,I.o)(function(){var e=O(y);ep(e);var t=O(eg(ex));e.equals(t)&&ec.current&&!V||eE(e,ec.current)},[y]),(0,I.o)(function(){V&&eM()},[ex]),r.createElement("div",{ref:J,className:u()(i,c,(0,d.Z)((0,d.Z)((0,d.Z)((0,d.Z)((0,d.Z)({},"".concat(i,"-focused"),ea),"".concat(i,"-disabled"),x),"".concat(i,"-readonly"),Z),"".concat(i,"-not-a-number"),ef.isNaN()),"".concat(i,"-out-of-range"),!ef.isInvalidate()&&!eN(ef))),style:l,onFocus:function(){ei(!0)},onBlur:function(){Q&&e_(!1),ei(!1),ec.current=!1},onKeyDown:function(e){var t=e.key,n=e.shiftKey;ec.current=!0,es.current=n,"Enter"===t&&(el.current||(ec.current=!1),e_(!1),null==$||$(e)),!1!==N&&!el.current&&["Up","ArrowUp","Down","ArrowDown"].includes(t)&&(eA("Up"===t||"ArrowUp"===t),e.preventDefault())},onKeyUp:function(){ec.current=!1,es.current=!1},onCompositionStart:function(){el.current=!0},onCompositionEnd:function(){el.current=!1,eT(en.current.value)},onBeforeInput:function(){ec.current=!0}},(void 0===_||_)&&r.createElement(T,{prefixCls:i,upNode:S,downNode:j,upDisabled:eS,downDisabled:eO,onStep:eA}),r.createElement("div",{className:"".concat(et,"-wrap")},r.createElement("input",(0,a.Z)({autoComplete:"off",role:"spinbutton","aria-valuemin":s,"aria-valuemax":g,"aria-valuenow":ef.isInvalidate()?null:ef.toString(),step:h},ee,{ref:(0,M.sQ)(en,t),className:et,value:ex,onChange:function(e){eT(e.target.value)},disabled:x,readOnly:Z}))))}),V=r.forwardRef(function(e,t){var n=e.disabled,o=e.style,i=e.prefixCls,c=void 0===i?"rc-input-number":i,l=e.value,s=e.prefix,u=e.suffix,d=e.addonBefore,f=e.addonAfter,p=e.className,g=e.classNames,v=(0,m.Z)(e,z),h=r.useRef(null),b=r.useRef(null),y=r.useRef(null),x=function(e){y.current&&(0,_.nH)(y.current,e)};return r.useImperativeHandle(t,function(){var e,t;return e=y.current,t={focus:x,nativeElement:h.current.nativeElement||b.current},"undefined"!=typeof Proxy&&e?new Proxy(e,{get:function(e,n){if(t[n])return t[n];var r=e[n];return"function"==typeof r?r.bind(e):r}}):e}),r.createElement(j.Q,{className:p,triggerFocus:x,prefixCls:c,value:l,disabled:n,style:o,prefix:s,suffix:u,addonAfter:f,addonBefore:d,classNames:g,components:{affixWrapper:"div",groupWrapper:"div",wrapper:"div",groupAddon:"div"},ref:h},r.createElement(W,(0,a.Z)({prefixCls:c,disabled:n,ref:y,domRef:b,className:null==g?void 0:g.input},v)))}),q=n(391),X=n(12757),G=n(71744),U=n(18310),$=n(86586),K=n(64024),Y=n(33759),Q=n(39109),J=n(56250),ee=n(77685),et=n(93463),en=n(31282),er=n(37433),eo=n(65265),ea=n(12918),ei=n(17691),ec=n(99320),el=n(71140),es=n(54558);let eu=(e,t)=>{let{componentCls:n,borderRadiusSM:r,borderRadiusLG:o}=e,a="lg"===t?o:r;return{["&-".concat(t)]:{["".concat(n,"-handler-wrap")]:{borderStartEndRadius:a,borderEndEndRadius:a},["".concat(n,"-handler-up")]:{borderStartEndRadius:a},["".concat(n,"-handler-down")]:{borderEndEndRadius:a}}}},ed=e=>{let{componentCls:t,lineWidth:n,lineType:r,borderRadius:o,inputFontSizeSM:a,inputFontSizeLG:i,controlHeightLG:c,controlHeightSM:l,colorError:s,paddingInlineSM:u,paddingBlockSM:d,paddingBlockLG:f,paddingInlineLG:p,colorIcon:m,motionDurationMid:g,handleHoverColor:v,handleOpacity:h,paddingInline:b,paddingBlock:y,handleBg:x,handleActiveBg:w,colorTextDisabled:E,borderRadiusSM:C,borderRadiusLG:Z,controlWidth:S,handleBorderColor:O,filledHandleBg:k,lineHeightLG:j,calc:I}=e;return[{[t]:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},(0,ea.Wf)(e)),(0,en.ik)(e)),{display:"inline-block",width:S,margin:0,padding:0,borderRadius:o}),(0,eo.qG)(e,{["".concat(t,"-handler-wrap")]:{background:x,["".concat(t,"-handler-down")]:{borderBlockStart:"".concat((0,et.bf)(n)," ").concat(r," ").concat(O)}}})),(0,eo.H8)(e,{["".concat(t,"-handler-wrap")]:{background:k,["".concat(t,"-handler-down")]:{borderBlockStart:"".concat((0,et.bf)(n)," ").concat(r," ").concat(O)}},"&:focus-within":{["".concat(t,"-handler-wrap")]:{background:x}}})),(0,eo.vc)(e,{["".concat(t,"-handler-wrap")]:{background:x,["".concat(t,"-handler-down")]:{borderBlockStart:"".concat((0,et.bf)(n)," ").concat(r," ").concat(O)}}})),(0,eo.Mu)(e)),{"&-rtl":{direction:"rtl",["".concat(t,"-input")]:{direction:"rtl"}},"&-lg":{padding:0,fontSize:i,lineHeight:j,borderRadius:Z,["input".concat(t,"-input")]:{height:I(c).sub(I(n).mul(2)).equal(),padding:"".concat((0,et.bf)(f)," ").concat((0,et.bf)(p))}},"&-sm":{padding:0,fontSize:a,borderRadius:C,["input".concat(t,"-input")]:{height:I(l).sub(I(n).mul(2)).equal(),padding:"".concat((0,et.bf)(d)," ").concat((0,et.bf)(u))}},"&-out-of-range":{["".concat(t,"-input-wrap")]:{input:{color:s}}},"&-group":Object.assign(Object.assign(Object.assign({},(0,ea.Wf)(e)),(0,en.s7)(e)),{"&-wrapper":Object.assign(Object.assign(Object.assign({display:"inline-block",textAlign:"start",verticalAlign:"top",["".concat(t,"-affix-wrapper")]:{width:"100%"},"&-lg":{["".concat(t,"-group-addon")]:{borderRadius:Z,fontSize:e.fontSizeLG}},"&-sm":{["".concat(t,"-group-addon")]:{borderRadius:C}}},(0,eo.ir)(e)),(0,eo.S5)(e)),{["&:not(".concat(t,"-compact-first-item):not(").concat(t,"-compact-last-item)").concat(t,"-compact-item")]:{["".concat(t,", ").concat(t,"-group-addon")]:{borderRadius:0}},["&:not(".concat(t,"-compact-last-item)").concat(t,"-compact-first-item")]:{["".concat(t,", ").concat(t,"-group-addon")]:{borderStartEndRadius:0,borderEndEndRadius:0}},["&:not(".concat(t,"-compact-first-item)").concat(t,"-compact-last-item")]:{["".concat(t,", ").concat(t,"-group-addon")]:{borderStartStartRadius:0,borderEndStartRadius:0}}})}),["&-disabled ".concat(t,"-input")]:{cursor:"not-allowed"},[t]:{"&-input":Object.assign(Object.assign(Object.assign(Object.assign({},(0,ea.Wf)(e)),{width:"100%",padding:"".concat((0,et.bf)(y)," ").concat((0,et.bf)(b)),textAlign:"start",backgroundColor:"transparent",border:0,borderRadius:o,outline:0,transition:"all ".concat(g," linear"),appearance:"textfield",fontSize:"inherit"}),(0,en.nz)(e.colorTextPlaceholder)),{'&[type="number"]::-webkit-inner-spin-button, &[type="number"]::-webkit-outer-spin-button':{margin:0,appearance:"none"}})},["&:hover ".concat(t,"-handler-wrap, &-focused ").concat(t,"-handler-wrap")]:{width:e.handleWidth,opacity:1}})},{[t]:Object.assign(Object.assign(Object.assign({["".concat(t,"-handler-wrap")]:{position:"absolute",insetBlockStart:0,insetInlineEnd:0,width:e.handleVisibleWidth,opacity:h,height:"100%",borderStartStartRadius:0,borderStartEndRadius:o,borderEndEndRadius:o,borderEndStartRadius:0,display:"flex",flexDirection:"column",alignItems:"stretch",transition:"all ".concat(g),overflow:"hidden",["".concat(t,"-handler")]:{display:"flex",alignItems:"center",justifyContent:"center",flex:"auto",height:"40%",["\n ".concat(t,"-handler-up-inner,\n ").concat(t,"-handler-down-inner\n ")]:{marginInlineEnd:0,fontSize:e.handleFontSize}}},["".concat(t,"-handler")]:{height:"50%",overflow:"hidden",color:m,fontWeight:"bold",lineHeight:0,textAlign:"center",cursor:"pointer",borderInlineStart:"".concat((0,et.bf)(n)," ").concat(r," ").concat(O),transition:"all ".concat(g," linear"),"&:active":{background:w},"&:hover":{height:"60%",["\n ".concat(t,"-handler-up-inner,\n ").concat(t,"-handler-down-inner\n ")]:{color:v}},"&-up-inner, &-down-inner":Object.assign(Object.assign({},(0,ea.Ro)()),{color:m,transition:"all ".concat(g," linear"),userSelect:"none"})},["".concat(t,"-handler-up")]:{borderStartEndRadius:o},["".concat(t,"-handler-down")]:{borderEndEndRadius:o}},eu(e,"lg")),eu(e,"sm")),{"&-disabled, &-readonly":{["".concat(t,"-handler-wrap")]:{display:"none"},["".concat(t,"-input")]:{color:"inherit"}},["\n ".concat(t,"-handler-up-disabled,\n ").concat(t,"-handler-down-disabled\n ")]:{cursor:"not-allowed"},["\n ".concat(t,"-handler-up-disabled:hover &-handler-up-inner,\n ").concat(t,"-handler-down-disabled:hover &-handler-down-inner\n ")]:{color:E}})}]},ef=e=>{let{componentCls:t,paddingBlock:n,paddingInline:r,inputAffixPadding:o,controlWidth:a,borderRadiusLG:i,borderRadiusSM:c,paddingInlineLG:l,paddingInlineSM:s,paddingBlockLG:u,paddingBlockSM:d,motionDurationMid:f}=e;return{["".concat(t,"-affix-wrapper")]:Object.assign(Object.assign({["input".concat(t,"-input")]:{padding:"".concat((0,et.bf)(n)," 0")}},(0,en.ik)(e)),{position:"relative",display:"inline-flex",alignItems:"center",width:a,padding:0,paddingInlineStart:r,"&-lg":{borderRadius:i,paddingInlineStart:l,["input".concat(t,"-input")]:{padding:"".concat((0,et.bf)(u)," 0")}},"&-sm":{borderRadius:c,paddingInlineStart:s,["input".concat(t,"-input")]:{padding:"".concat((0,et.bf)(d)," 0")}},["&:not(".concat(t,"-disabled):hover")]:{zIndex:1},"&-focused, &:focus":{zIndex:1},["&-disabled > ".concat(t,"-disabled")]:{background:"transparent"},["> div".concat(t)]:{width:"100%",border:"none",outline:"none",["&".concat(t,"-focused")]:{boxShadow:"none !important"}},"&::before":{display:"inline-block",width:0,visibility:"hidden",content:'"\\a0"'},["".concat(t,"-handler-wrap")]:{zIndex:2},[t]:{position:"static",color:"inherit","&-prefix, &-suffix":{display:"flex",flex:"none",alignItems:"center",pointerEvents:"none"},"&-prefix":{marginInlineEnd:o},"&-suffix":{insetBlockStart:0,insetInlineEnd:0,height:"100%",marginInlineEnd:r,marginInlineStart:o,transition:"margin ".concat(f)}},["&:hover ".concat(t,"-handler-wrap, &-focused ").concat(t,"-handler-wrap")]:{width:e.handleWidth,opacity:1},["&:not(".concat(t,"-affix-wrapper-without-controls):hover ").concat(t,"-suffix")]:{marginInlineEnd:e.calc(e.handleWidth).add(r).equal()}}),["".concat(t,"-underlined")]:{borderRadius:0}}};var ep=(0,ec.I$)("InputNumber",e=>{let t=(0,el.IX)(e,(0,er.e)(e));return[ed(t),ef(t),(0,ei.c)(t)]},e=>{var t;let n=null!==(t=e.handleVisible)&&void 0!==t?t:"auto",r=e.controlHeightSM-2*e.lineWidth;return Object.assign(Object.assign({},(0,er.T)(e)),{controlWidth:90,handleWidth:r,handleFontSize:e.fontSize/2,handleVisible:n,handleActiveBg:e.colorFillAlter,handleBg:e.colorBgContainer,filledHandleBg:new es.t(e.colorFillSecondary).onBackground(e.colorBgContainer).toHexString(),handleHoverColor:e.colorPrimary,handleBorderColor:e.colorBorder,handleOpacity:!0===n?1:0,handleVisibleWidth:!0===n?r:0})},{unitless:{handleOpacity:!0},resetFont:!1}),em=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 eg=r.forwardRef((e,t)=>{let{getPrefixCls:n,direction:a}=r.useContext(G.E_),i=r.useRef(null);r.useImperativeHandle(t,()=>i.current);let{className:c,rootClassName:s,size:d,disabled:f,prefixCls:p,addonBefore:m,addonAfter:g,prefix:v,suffix:h,bordered:b,readOnly:y,status:x,controls:w,variant:E}=e,C=em(e,["className","rootClassName","size","disabled","prefixCls","addonBefore","addonAfter","prefix","suffix","bordered","readOnly","status","controls","variant"]),Z=n("input-number",p),S=(0,K.Z)(Z),[O,k,j]=ep(Z,S),{compactSize:I,compactItemClassnames:M}=(0,ee.ri)(Z,a),R=r.createElement(l,{className:"".concat(Z,"-handler-up-inner")}),N=r.createElement(o.Z,{className:"".concat(Z,"-handler-down-inner")});"object"==typeof w&&(R=void 0===w.upIcon?R:r.createElement("span",{className:"".concat(Z,"-handler-up-inner")},w.upIcon),N=void 0===w.downIcon?N:r.createElement("span",{className:"".concat(Z,"-handler-down-inner")},w.downIcon));let{hasFeedback:P,status:F,isFormItemInput:T,feedbackIcon:A}=r.useContext(Q.aM),_=(0,X.F)(F,x),B=(0,Y.Z)(e=>{var t;return null!==(t=null!=d?d:I)&&void 0!==t?t:e}),H=r.useContext($.Z),z=null!=f?f:H,[L,D]=(0,J.Z)("inputNumber",E,b),W=P&&r.createElement(r.Fragment,null,A),U=u()({["".concat(Z,"-lg")]:"large"===B,["".concat(Z,"-sm")]:"small"===B,["".concat(Z,"-rtl")]:"rtl"===a,["".concat(Z,"-in-form-item")]:T},k),et="".concat(Z,"-group");return O(r.createElement(V,Object.assign({ref:i,disabled:z,className:u()(j,S,c,s,M),upHandler:R,downHandler:N,prefixCls:Z,readOnly:y,controls:"boolean"==typeof w?w:void 0,prefix:v,suffix:W||h,addonBefore:m&&r.createElement(q.Z,{form:!0,space:!0},m),addonAfter:g&&r.createElement(q.Z,{form:!0,space:!0},g),classNames:{input:U,variant:u()({["".concat(Z,"-").concat(L)]:D},(0,X.Z)(Z,_,P)),affixWrapper:u()({["".concat(Z,"-affix-wrapper-sm")]:"small"===B,["".concat(Z,"-affix-wrapper-lg")]:"large"===B,["".concat(Z,"-affix-wrapper-rtl")]:"rtl"===a,["".concat(Z,"-affix-wrapper-without-controls")]:!1===w||z||y},k),wrapper:u()({["".concat(et,"-rtl")]:"rtl"===a},k),groupWrapper:u()({["".concat(Z,"-group-wrapper-sm")]:"small"===B,["".concat(Z,"-group-wrapper-lg")]:"large"===B,["".concat(Z,"-group-wrapper-rtl")]:"rtl"===a,["".concat(Z,"-group-wrapper-").concat(L)]:D},(0,X.Z)("".concat(Z,"-group-wrapper"),_,P),k)}},C)))});eg._InternalPanelDoNotUseOrYouWillBeFired=e=>r.createElement(U.ZP,{theme:{components:{InputNumber:{handleVisible:!0}}}},r.createElement(eg,Object.assign({},e)));var ev=eg},39454:function(e,t,n){"use strict";n.d(t,{Z:function(){return w}});var r=n(2265),o=n(36760),a=n.n(o),i=n(2027),c=n(28791),l=n(391),s=n(94611),u=n(12757),d=n(71744),f=n(86586),p=n(64024),m=n(33759),g=n(39109),v=n(56250),h=n(77685),b=n(39164),y=n(31282),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},w=(0,r.forwardRef)((e,t)=>{let{prefixCls:n,bordered:o=!0,status:w,size:E,disabled:C,onBlur:Z,onFocus:S,suffix:O,allowClear:k,addonAfter:j,addonBefore:I,className:M,style:R,styles:N,rootClassName:P,onChange:F,classNames:T,variant:A}=e,_=x(e,["prefixCls","bordered","status","size","disabled","onBlur","onFocus","suffix","allowClear","addonAfter","addonBefore","className","style","styles","rootClassName","onChange","classNames","variant"]),{getPrefixCls:B,direction:H,allowClear:z,autoComplete:L,className:D,style:W,classNames:V,styles:q}=(0,d.dj)("input"),X=B("input",n),G=(0,r.useRef)(null),U=(0,p.Z)(X),[$,K,Y]=(0,y.TI)(X,P),[Q]=(0,y.ZP)(X,U),{compactSize:J,compactItemClassnames:ee}=(0,h.ri)(X,H),et=(0,m.Z)(e=>{var t;return null!==(t=null!=E?E:J)&&void 0!==t?t:e}),en=r.useContext(f.Z),{status:er,hasFeedback:eo,feedbackIcon:ea}=(0,r.useContext)(g.aM),ei=(0,u.F)(er,w),ec=!!(e.prefix||e.suffix||e.allowClear||e.showCount)||!!eo;(0,r.useRef)(ec);let el=(0,b.Z)(G,!0),es=(eo||O)&&r.createElement(r.Fragment,null,O,eo&&ea),eu=(0,s.Z)(null!=k?k:z),[ed,ef]=(0,v.Z)("input",A,o);return $(Q(r.createElement(i.Z,Object.assign({ref:(0,c.sQ)(t,G),prefixCls:X,autoComplete:L},_,{disabled:null!=C?C:en,onBlur:e=>{el(),null==Z||Z(e)},onFocus:e=>{el(),null==S||S(e)},style:Object.assign(Object.assign({},W),R),styles:Object.assign(Object.assign({},q),N),suffix:es,allowClear:eu,className:a()(M,P,Y,U,ee,D),onChange:e=>{el(),null==F||F(e)},addonBefore:I&&r.createElement(l.Z,{form:!0,space:!0},I),addonAfter:j&&r.createElement(l.Z,{form:!0,space:!0},j),classNames:Object.assign(Object.assign(Object.assign({},T),V),{input:a()({["".concat(X,"-sm")]:"small"===et,["".concat(X,"-lg")]:"large"===et,["".concat(X,"-rtl")]:"rtl"===H},null==T?void 0:T.input,V.input,K),variant:a()({["".concat(X,"-").concat(ed)]:ef},(0,u.Z)(X,ei)),affixWrapper:a()({["".concat(X,"-affix-wrapper-sm")]:"small"===et,["".concat(X,"-affix-wrapper-lg")]:"large"===et,["".concat(X,"-affix-wrapper-rtl")]:"rtl"===H},K),wrapper:a()({["".concat(X,"-group-rtl")]:"rtl"===H},K),groupWrapper:a()({["".concat(X,"-group-wrapper-sm")]:"small"===et,["".concat(X,"-group-wrapper-lg")]:"large"===et,["".concat(X,"-group-wrapper-rtl")]:"rtl"===H,["".concat(X,"-group-wrapper-").concat(ed)]:ef},(0,u.Z)("".concat(X,"-group-wrapper"),ei,eo),K)})}))))})},34766:function(e,t,n){"use strict";n.d(t,{Z:function(){return W}});var r,o=n(2265),a=n(36760),i=n.n(a),c=n(1119),l=n(11993),s=n(31686),u=n(83145),d=n(26365),f=n(6989),p=n(2027),m=n(96032),g=n(25209),v=n(50506),h=n(41154),b=n(31474),y=n(27380),x=n(53346),w=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break","white-space"],E={},C=["prefixCls","defaultValue","value","autoSize","onResize","className","style","disabled","onChange","onInternalAutoSize"],Z=o.forwardRef(function(e,t){var n=e.prefixCls,a=e.defaultValue,u=e.value,p=e.autoSize,m=e.onResize,g=e.className,Z=e.style,S=e.disabled,O=e.onChange,k=(e.onInternalAutoSize,(0,f.Z)(e,C)),j=(0,v.Z)(a,{value:u,postState:function(e){return null!=e?e:""}}),I=(0,d.Z)(j,2),M=I[0],R=I[1],N=o.useRef();o.useImperativeHandle(t,function(){return{textArea:N.current}});var P=o.useMemo(function(){return p&&"object"===(0,h.Z)(p)?[p.minRows,p.maxRows]:[]},[p]),F=(0,d.Z)(P,2),T=F[0],A=F[1],_=!!p,B=o.useState(2),H=(0,d.Z)(B,2),z=H[0],L=H[1],D=o.useState(),W=(0,d.Z)(D,2),V=W[0],q=W[1],X=function(){L(0)};(0,y.Z)(function(){_&&X()},[u,T,A,_]),(0,y.Z)(function(){if(0===z)L(1);else if(1===z){var e=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r||((r=document.createElement("textarea")).setAttribute("tab-index","-1"),r.setAttribute("aria-hidden","true"),r.setAttribute("name","hiddenTextarea"),document.body.appendChild(r)),e.getAttribute("wrap")?r.setAttribute("wrap",e.getAttribute("wrap")):r.removeAttribute("wrap");var i=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=e.getAttribute("id")||e.getAttribute("data-reactid")||e.getAttribute("name");if(t&&E[n])return E[n];var r=window.getComputedStyle(e),o=r.getPropertyValue("box-sizing")||r.getPropertyValue("-moz-box-sizing")||r.getPropertyValue("-webkit-box-sizing"),a=parseFloat(r.getPropertyValue("padding-bottom"))+parseFloat(r.getPropertyValue("padding-top")),i=parseFloat(r.getPropertyValue("border-bottom-width"))+parseFloat(r.getPropertyValue("border-top-width")),c={sizingStyle:w.map(function(e){return"".concat(e,":").concat(r.getPropertyValue(e))}).join(";"),paddingSize:a,borderSize:i,boxSizing:o};return t&&n&&(E[n]=c),c}(e,n),c=i.paddingSize,l=i.borderSize,s=i.boxSizing,u=i.sizingStyle;r.setAttribute("style","".concat(u,";").concat("\n min-height:0 !important;\n max-height:none !important;\n height:0 !important;\n visibility:hidden !important;\n overflow:hidden !important;\n position:absolute !important;\n z-index:-1000 !important;\n top:0 !important;\n right:0 !important;\n pointer-events: none !important;\n")),r.value=e.value||e.placeholder||"";var d=void 0,f=void 0,p=r.scrollHeight;if("border-box"===s?p+=l:"content-box"===s&&(p-=c),null!==o||null!==a){r.value=" ";var m=r.scrollHeight-c;null!==o&&(d=m*o,"border-box"===s&&(d=d+c+l),p=Math.max(d,p)),null!==a&&(f=m*a,"border-box"===s&&(f=f+c+l),t=p>f?"":"hidden",p=Math.min(f,p))}var g={height:p,overflowY:t,resize:"none"};return d&&(g.minHeight=d),f&&(g.maxHeight=f),g}(N.current,!1,T,A);L(2),q(e)}},[z]);var G=o.useRef(),U=function(){x.Z.cancel(G.current)};o.useEffect(function(){return U},[]);var $=(0,s.Z)((0,s.Z)({},Z),_?V:null);return(0===z||1===z)&&($.overflowY="hidden",$.overflowX="hidden"),o.createElement(b.Z,{onResize:function(e){2===z&&(null==m||m(e),p&&(U(),G.current=(0,x.Z)(function(){X()})))},disabled:!(p||m)},o.createElement("textarea",(0,c.Z)({},k,{ref:N,style:$,className:i()(n,g,(0,l.Z)({},"".concat(n,"-disabled"),S)),disabled:S,value:M,onChange:function(e){R(e.target.value),null==O||O(e)}})))}),S=["defaultValue","value","onFocus","onBlur","onChange","allowClear","maxLength","onCompositionStart","onCompositionEnd","suffix","prefixCls","showCount","count","className","style","disabled","hidden","classNames","styles","onResize","onClear","onPressEnter","readOnly","autoSize","onKeyDown"],O=o.forwardRef(function(e,t){var n,r,a=e.defaultValue,h=e.value,b=e.onFocus,y=e.onBlur,x=e.onChange,w=e.allowClear,E=e.maxLength,C=e.onCompositionStart,O=e.onCompositionEnd,k=e.suffix,j=e.prefixCls,I=void 0===j?"rc-textarea":j,M=e.showCount,R=e.count,N=e.className,P=e.style,F=e.disabled,T=e.hidden,A=e.classNames,_=e.styles,B=e.onResize,H=e.onClear,z=e.onPressEnter,L=e.readOnly,D=e.autoSize,W=e.onKeyDown,V=(0,f.Z)(e,S),q=(0,v.Z)(a,{value:h,defaultValue:a}),X=(0,d.Z)(q,2),G=X[0],U=X[1],$=null==G?"":String(G),K=o.useState(!1),Y=(0,d.Z)(K,2),Q=Y[0],J=Y[1],ee=o.useRef(!1),et=o.useState(null),en=(0,d.Z)(et,2),er=en[0],eo=en[1],ea=(0,o.useRef)(null),ei=(0,o.useRef)(null),ec=function(){var e;return null===(e=ei.current)||void 0===e?void 0:e.textArea},el=function(){ec().focus()};(0,o.useImperativeHandle)(t,function(){var e;return{resizableTextArea:ei.current,focus:el,blur:function(){ec().blur()},nativeElement:(null===(e=ea.current)||void 0===e?void 0:e.nativeElement)||ec()}}),(0,o.useEffect)(function(){J(function(e){return!F&&e})},[F]);var es=o.useState(null),eu=(0,d.Z)(es,2),ed=eu[0],ef=eu[1];o.useEffect(function(){if(ed){var e;(e=ec()).setSelectionRange.apply(e,(0,u.Z)(ed))}},[ed]);var ep=(0,m.Z)(R,M),em=null!==(n=ep.max)&&void 0!==n?n:E,eg=Number(em)>0,ev=ep.strategy($),eh=!!em&&ev>em,eb=function(e,t){var n=t;!ee.current&&ep.exceedFormatter&&ep.max&&ep.strategy(t)>ep.max&&(n=ep.exceedFormatter(t,{max:ep.max}),t!==n&&ef([ec().selectionStart||0,ec().selectionEnd||0])),U(n),(0,g.rJ)(e.currentTarget,e,x,n)},ey=k;ep.show&&(r=ep.showFormatter?ep.showFormatter({value:$,count:ev,maxLength:em}):"".concat(ev).concat(eg?" / ".concat(em):""),ey=o.createElement(o.Fragment,null,ey,o.createElement("span",{className:i()("".concat(I,"-data-count"),null==A?void 0:A.count),style:null==_?void 0:_.count},r)));var ex=!D&&!M&&!w;return o.createElement(p.Q,{ref:ea,value:$,allowClear:w,handleReset:function(e){U(""),el(),(0,g.rJ)(ec(),e,x)},suffix:ey,prefixCls:I,classNames:(0,s.Z)((0,s.Z)({},A),{},{affixWrapper:i()(null==A?void 0:A.affixWrapper,(0,l.Z)((0,l.Z)({},"".concat(I,"-show-count"),M),"".concat(I,"-textarea-allow-clear"),w))}),disabled:F,focused:Q,className:i()(N,eh&&"".concat(I,"-out-of-range")),style:(0,s.Z)((0,s.Z)({},P),er&&!ex?{height:"auto"}:{}),dataAttrs:{affixWrapper:{"data-count":"string"==typeof r?r:void 0}},hidden:T,readOnly:L,onClear:H},o.createElement(Z,(0,c.Z)({},V,{autoSize:D,maxLength:E,onKeyDown:function(e){"Enter"===e.key&&z&&z(e),null==W||W(e)},onChange:function(e){eb(e,e.target.value)},onFocus:function(e){J(!0),null==b||b(e)},onBlur:function(e){J(!1),null==y||y(e)},onCompositionStart:function(e){ee.current=!0,null==C||C(e)},onCompositionEnd:function(e){ee.current=!1,eb(e,e.currentTarget.value),null==O||O(e)},className:i()(null==A?void 0:A.textarea),style:(0,s.Z)((0,s.Z)({},null==_?void 0:_.textarea),{},{resize:null==P?void 0:P.resize}),disabled:F,prefixCls:I,onResize:function(e){var t;null==B||B(e),null!==(t=ec())&&void 0!==t&&t.style.height&&eo(!0)},ref:ei,readOnly:L})))}),k=n(94611),j=n(12757),I=n(71744),M=n(86586),R=n(64024),N=n(33759),P=n(39109),F=n(56250),T=n(77685),A=n(31282),_=n(99320),B=n(71140),H=n(37433);let z=e=>{let{componentCls:t,paddingLG:n}=e,r="".concat(t,"-textarea");return{["textarea".concat(t)]:{maxWidth:"100%",height:"auto",minHeight:e.controlHeight,lineHeight:e.lineHeight,verticalAlign:"bottom",transition:"all ".concat(e.motionDurationSlow),resize:"vertical",["&".concat(t,"-mouse-active")]:{transition:"all ".concat(e.motionDurationSlow,", height 0s, width 0s")}},["".concat(t,"-textarea-affix-wrapper-resize-dirty")]:{width:"auto"},[r]:{position:"relative","&-show-count":{["".concat(t,"-data-count")]:{position:"absolute",bottom:e.calc(e.fontSize).mul(e.lineHeight).mul(-1).equal(),insetInlineEnd:0,color:e.colorTextDescription,whiteSpace:"nowrap",pointerEvents:"none"}},["\n &-allow-clear > ".concat(t,",\n &-affix-wrapper").concat(r,"-has-feedback ").concat(t,"\n ")]:{paddingInlineEnd:n},["&-affix-wrapper".concat(t,"-affix-wrapper")]:{padding:0,["> textarea".concat(t)]:{fontSize:"inherit",border:"none",outline:"none",background:"transparent",minHeight:e.calc(e.controlHeight).sub(e.calc(e.lineWidth).mul(2)).equal(),"&:focus":{boxShadow:"none !important"}},["".concat(t,"-suffix")]:{margin:0,"> *:not(:last-child)":{marginInline:0},["".concat(t,"-clear-icon")]:{position:"absolute",insetInlineEnd:e.paddingInline,insetBlockStart:e.paddingXS},["".concat(r,"-suffix")]:{position:"absolute",top:0,insetInlineEnd:e.paddingInline,bottom:0,zIndex:1,display:"inline-flex",alignItems:"center",margin:"auto",pointerEvents:"none"}}},["&-affix-wrapper".concat(t,"-affix-wrapper-rtl")]:{["".concat(t,"-suffix")]:{["".concat(t,"-data-count")]:{direction:"ltr",insetInlineStart:0}}},["&-affix-wrapper".concat(t,"-affix-wrapper-sm")]:{["".concat(t,"-suffix")]:{["".concat(t,"-clear-icon")]:{insetInlineEnd:e.paddingInlineSM}}}}}};var L=(0,_.I$)(["Input","TextArea"],e=>z((0,B.IX)(e,(0,H.e)(e))),H.T,{resetFont:!1}),D=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},W=(0,o.forwardRef)((e,t)=>{var n;let{prefixCls:r,bordered:a=!0,size:c,disabled:l,status:s,allowClear:u,classNames:d,rootClassName:f,className:p,style:m,styles:v,variant:h,showCount:b,onMouseDown:y,onResize:x}=e,w=D(e,["prefixCls","bordered","size","disabled","status","allowClear","classNames","rootClassName","className","style","styles","variant","showCount","onMouseDown","onResize"]),{getPrefixCls:E,direction:C,allowClear:Z,autoComplete:S,className:_,style:B,classNames:H,styles:z}=(0,I.dj)("textArea"),W=o.useContext(M.Z),{status:V,hasFeedback:q,feedbackIcon:X}=o.useContext(P.aM),G=(0,j.F)(V,s),U=o.useRef(null);o.useImperativeHandle(t,()=>{var e;return{resizableTextArea:null===(e=U.current)||void 0===e?void 0:e.resizableTextArea,focus:e=>{var t,n;(0,g.nH)(null===(n=null===(t=U.current)||void 0===t?void 0:t.resizableTextArea)||void 0===n?void 0:n.textArea,e)},blur:()=>{var e;return null===(e=U.current)||void 0===e?void 0:e.blur()}}});let $=E("input",r),K=(0,R.Z)($),[Y,Q,J]=(0,A.TI)($,f),[ee]=L($,K),{compactSize:et,compactItemClassnames:en}=(0,T.ri)($,C),er=(0,N.Z)(e=>{var t;return null!==(t=null!=c?c:et)&&void 0!==t?t:e}),[eo,ea]=(0,F.Z)("textArea",h,a),ei=(0,k.Z)(null!=u?u:Z),[ec,el]=o.useState(!1),[es,eu]=o.useState(!1);return Y(ee(o.createElement(O,Object.assign({autoComplete:S},w,{style:Object.assign(Object.assign({},B),m),styles:Object.assign(Object.assign({},z),v),disabled:null!=l?l:W,allowClear:ei,className:i()(J,K,p,f,en,_,es&&"".concat($,"-textarea-affix-wrapper-resize-dirty")),classNames:Object.assign(Object.assign(Object.assign({},d),H),{textarea:i()({["".concat($,"-sm")]:"small"===er,["".concat($,"-lg")]:"large"===er},Q,null==d?void 0:d.textarea,H.textarea,ec&&"".concat($,"-mouse-active")),variant:i()({["".concat($,"-").concat(eo)]:ea},(0,j.Z)($,G)),affixWrapper:i()("".concat($,"-textarea-affix-wrapper"),{["".concat($,"-affix-wrapper-rtl")]:"rtl"===C,["".concat($,"-affix-wrapper-sm")]:"small"===er,["".concat($,"-affix-wrapper-lg")]:"large"===er,["".concat($,"-textarea-show-count")]:b||(null===(n=e.count)||void 0===n?void 0:n.show)},Q)}),prefixCls:$,suffix:q&&o.createElement("span",{className:"".concat($,"-textarea-suffix")},X),showCount:b,ref:U,onResize:e=>{var t,n;if(null==x||x(e),ec&&"function"==typeof getComputedStyle){let e=null===(n=null===(t=U.current)||void 0===t?void 0:t.nativeElement)||void 0===n?void 0:n.querySelector("textarea");e&&"both"===getComputedStyle(e).resize&&eu(!0)}},onMouseDown:e=>{el(!0),null==y||y(e);let t=()=>{el(!1),document.removeEventListener("mouseup",t)};document.addEventListener("mouseup",t)}}))))})},39164:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(2265);function o(e,t){let n=(0,r.useRef)([]),o=()=>{n.current.push(setTimeout(()=>{var t,n,r,o;(null===(t=e.current)||void 0===t?void 0:t.input)&&(null===(n=e.current)||void 0===n?void 0:n.input.getAttribute("type"))==="password"&&(null===(r=e.current)||void 0===r?void 0:r.input.hasAttribute("value"))&&(null===(o=e.current)||void 0===o||o.input.removeAttribute("value"))}))};return(0,r.useEffect)(()=>(t&&o(),()=>n.current.forEach(e=>{e&&clearTimeout(e)})),[]),o}},4260:function(e,t,n){"use strict";n.d(t,{default:function(){return q}});var r=n(2265),o=n(36760),a=n.n(o),i=n(71744),c=n(39109),l=n(31282),s=n(39454),u=n(83145),d=n(58525),f=n(18242),p=n(12757),m=n(33759),g=n(99320),v=n(71140),h=n(37433);let b=e=>{let{componentCls:t,paddingXS:n}=e;return{[t]:{display:"inline-flex",alignItems:"center",flexWrap:"nowrap",columnGap:n,["".concat(t,"-input-wrapper")]:{position:"relative",["".concat(t,"-mask-icon")]:{position:"absolute",zIndex:"1",top:"50%",right:"50%",transform:"translate(50%, -50%)",pointerEvents:"none"},["".concat(t,"-mask-input")]:{color:"transparent",caretColor:e.colorText},["".concat(t,"-mask-input[type=number]::-webkit-inner-spin-button")]:{"-webkit-appearance":"none",margin:0},["".concat(t,"-mask-input[type=number]")]:{"-moz-appearance":"textfield"}},"&-rtl":{direction:"rtl"},["".concat(t,"-input")]:{textAlign:"center",paddingInline:e.paddingXXS},["&".concat(t,"-sm ").concat(t,"-input")]:{paddingInline:e.calc(e.paddingXXS).div(2).equal()},["&".concat(t,"-lg ").concat(t,"-input")]:{paddingInline:e.paddingXS}}}};var y=(0,g.I$)(["Input","OTP"],e=>b((0,v.IX)(e,(0,h.e)(e))),h.T),x=n(53346),w=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 E=r.forwardRef((e,t)=>{let{className:n,value:o,onChange:c,onActiveChange:l,index:u,mask:d}=e,f=w(e,["className","value","onChange","onActiveChange","index","mask"]),{getPrefixCls:p}=r.useContext(i.E_),m=p("otp"),g="string"==typeof d?d:o,v=r.useRef(null);r.useImperativeHandle(t,()=>v.current);let h=()=>{(0,x.Z)(()=>{var e;let t=null===(e=v.current)||void 0===e?void 0:e.input;document.activeElement===t&&t&&t.select()})};return r.createElement("span",{className:"".concat(m,"-input-wrapper"),role:"presentation"},d&&""!==o&&void 0!==o&&r.createElement("span",{className:"".concat(m,"-mask-icon"),"aria-hidden":"true"},g),r.createElement(s.Z,Object.assign({"aria-label":"OTP Input ".concat(u+1),type:!0===d?"password":"text"},f,{ref:v,value:o,onInput:e=>{c(u,e.target.value)},onFocus:h,onKeyDown:e=>{let{key:t,ctrlKey:n,metaKey:r}=e;"ArrowLeft"===t?l(u-1):"ArrowRight"===t?l(u+1):"z"===t&&(n||r)?e.preventDefault():"Backspace"!==t||o||l(u-1),h()},onMouseDown:h,onMouseUp:h,className:a()(n,{["".concat(m,"-mask-input")]:d})})))});var C=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 Z(e){return(e||"").split("")}let S=e=>{let{index:t,prefixCls:n,separator:o}=e,a="function"==typeof o?o(t):o;return a?r.createElement("span",{className:"".concat(n,"-separator")},a):null},O=r.forwardRef((e,t)=>{let{prefixCls:n,length:o=6,size:l,defaultValue:s,value:g,onChange:v,formatter:h,separator:b,variant:x,disabled:w,status:O,autoFocus:k,mask:j,type:I,onInput:M,inputMode:R}=e,N=C(e,["prefixCls","length","size","defaultValue","value","onChange","formatter","separator","variant","disabled","status","autoFocus","mask","type","onInput","inputMode"]),{getPrefixCls:P,direction:F}=r.useContext(i.E_),T=P("otp",n),A=(0,f.Z)(N,{aria:!0,data:!0,attr:!0}),[_,B,H]=y(T),z=(0,m.Z)(e=>null!=l?l:e),L=r.useContext(c.aM),D=(0,p.F)(L.status,O),W=r.useMemo(()=>Object.assign(Object.assign({},L),{status:D,hasFeedback:!1,feedbackIcon:null}),[L,D]),V=r.useRef(null),q=r.useRef({});r.useImperativeHandle(t,()=>({focus:()=>{var e;null===(e=q.current[0])||void 0===e||e.focus()},blur:()=>{var e;for(let t=0;th?h(e):e,[G,U]=r.useState(()=>Z(X(s||"")));r.useEffect(()=>{void 0!==g&&U(Z(g))},[g]);let $=(0,d.Z)(e=>{U(e),M&&M(e),v&&e.length===o&&e.every(e=>e)&&e.some((e,t)=>G[t]!==e)&&v(e.join(""))}),K=(0,d.Z)((e,t)=>{let n=(0,u.Z)(G);for(let t=0;t=0&&!n[e];e-=1)n.pop();return n=Z(X(n.map(e=>e||" ").join(""))).map((e,t)=>" "!==e||n[t]?e:n[t])}),Y=(e,t)=>{var n;let r=K(e,t),a=Math.min(e+t.length,o-1);a!==e&&void 0!==r[e]&&(null===(n=q.current[a])||void 0===n||n.focus()),$(r)},Q=e=>{var t;null===(t=q.current[e])||void 0===t||t.focus()},J={variant:x,disabled:w,status:D,mask:j,type:I,inputMode:R};return _(r.createElement("div",Object.assign({},A,{ref:V,className:a()(T,{["".concat(T,"-sm")]:"small"===z,["".concat(T,"-lg")]:"large"===z,["".concat(T,"-rtl")]:"rtl"===F},H,B),role:"group"}),r.createElement(c.aM.Provider,{value:W},Array.from({length:o}).map((e,t)=>{let n="otp-".concat(t),a=G[t]||"";return r.createElement(r.Fragment,{key:n},r.createElement(E,Object.assign({ref:e=>{q.current[t]=e},index:t,size:z,htmlSize:1,className:"".concat(T,"-input"),onChange:Y,value:a,onActiveChange:Q,autoFocus:0===t&&k},J)),tt.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 F=e=>e?r.createElement(j.Z,null):r.createElement(k.Z,null),T={click:"onClick",hover:"onMouseOver"},A=r.forwardRef((e,t)=>{let{disabled:n,action:o="click",visibilityToggle:c=!0,iconRender:l=F,suffix:u}=e,d=r.useContext(R.Z),f=null!=n?n:d,p="object"==typeof c&&void 0!==c.visible,[m,g]=(0,r.useState)(()=>!!p&&c.visible),v=(0,r.useRef)(null);r.useEffect(()=>{p&&g(c.visible)},[p,c]);let h=(0,N.Z)(v),b=()=>{var e;if(f)return;m&&h();let t=!m;g(t),"object"==typeof c&&(null===(e=c.onVisibleChange)||void 0===e||e.call(c,t))},{className:y,prefixCls:x,inputPrefixCls:w,size:E}=e,C=P(e,["className","prefixCls","inputPrefixCls","size"]),{getPrefixCls:Z}=r.useContext(i.E_),S=Z("input",w),O=Z("input-password",x),k=c&&(e=>{let t=T[o]||"",n=l(m);return r.cloneElement(r.isValidElement(n)?n:r.createElement("span",null,n),{[t]:b,className:"".concat(e,"-icon"),key:"passwordIcon",onMouseDown:e=>{e.preventDefault()},onMouseUp:e=>{e.preventDefault()}})})(O),j=a()(O,y,{["".concat(O,"-").concat(E)]:!!E}),A=Object.assign(Object.assign({},(0,I.Z)(C,["suffix","iconRender","visibilityToggle"])),{type:m?"text":"password",className:j,prefixCls:S,suffix:r.createElement(r.Fragment,null,k,u)});return E&&(A.size=E),r.createElement(s.Z,Object.assign({ref:(0,M.sQ)(t,v)},A))});var _=n(29436),B=n(19722),H=n(5545),z=n(77685),L=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=r.forwardRef((e,t)=>{let n;let{prefixCls:o,inputPrefixCls:c,className:l,size:u,suffix:d,enterButton:f=!1,addonAfter:p,loading:g,disabled:v,onSearch:h,onChange:b,onCompositionStart:y,onCompositionEnd:x,variant:w,onPressEnter:E}=e,C=L(e,["prefixCls","inputPrefixCls","className","size","suffix","enterButton","addonAfter","loading","disabled","onSearch","onChange","onCompositionStart","onCompositionEnd","variant","onPressEnter"]),{getPrefixCls:Z,direction:S}=r.useContext(i.E_),O=r.useRef(!1),k=Z("input-search",o),j=Z("input",c),{compactSize:I}=(0,z.ri)(k,S),R=(0,m.Z)(e=>{var t;return null!==(t=null!=u?u:I)&&void 0!==t?t:e}),N=r.useRef(null),P=e=>{var t;document.activeElement===(null===(t=N.current)||void 0===t?void 0:t.input)&&e.preventDefault()},F=e=>{var t,n;h&&h(null===(n=null===(t=N.current)||void 0===t?void 0:t.input)||void 0===n?void 0:n.value,e,{source:"input"})},T="boolean"==typeof f?r.createElement(_.Z,null):null,A="".concat(k,"-button"),D=f||{},W=D.type&&!0===D.type.__ANT_BUTTON;n=W||"button"===D.type?(0,B.Tm)(D,Object.assign({onMouseDown:P,onClick:e=>{var t,n;null===(n=null===(t=null==D?void 0:D.props)||void 0===t?void 0:t.onClick)||void 0===n||n.call(t,e),F(e)},key:"enterButton"},W?{className:A,size:R}:{})):r.createElement(H.ZP,{className:A,color:f?"primary":"default",size:R,disabled:v,key:"enterButton",onMouseDown:P,onClick:F,loading:g,icon:T,variant:"borderless"===w||"filled"===w||"underlined"===w?"text":f?"solid":void 0},f),p&&(n=[n,(0,B.Tm)(p,{key:"addonAfter"})]);let V=a()(k,{["".concat(k,"-rtl")]:"rtl"===S,["".concat(k,"-").concat(R)]:!!R,["".concat(k,"-with-button")]:!!f},l),q=Object.assign(Object.assign({},C),{className:V,prefixCls:j,type:"search",size:R,variant:w,onPressEnter:e=>{O.current||g||(null==E||E(e),F(e))},onCompositionStart:e=>{O.current=!0,null==y||y(e)},onCompositionEnd:e=>{O.current=!1,null==x||x(e)},addonAfter:n,suffix:d,onChange:e=>{(null==e?void 0:e.target)&&"click"===e.type&&h&&h(e.target.value,e,{source:"clear"}),null==b||b(e)},disabled:v});return r.createElement(s.Z,Object.assign({ref:(0,M.sQ)(N,t)},q))});var W=n(34766);let V=s.Z;V.Group=e=>{let{getPrefixCls:t,direction:n}=(0,r.useContext)(i.E_),{prefixCls:o,className:s}=e,u=t("input-group",o),d=t("input"),[f,p,m]=(0,l.ZP)(d),g=a()(u,m,{["".concat(u,"-lg")]:"large"===e.size,["".concat(u,"-sm")]:"small"===e.size,["".concat(u,"-compact")]:e.compact,["".concat(u,"-rtl")]:"rtl"===n},p,s),v=(0,r.useContext)(c.aM),h=(0,r.useMemo)(()=>Object.assign(Object.assign({},v),{isFormItemInput:!1}),[v]);return f(r.createElement("span",{className:g,style:e.style,onMouseEnter:e.onMouseEnter,onMouseLeave:e.onMouseLeave,onFocus:e.onFocus,onBlur:e.onBlur},r.createElement(c.aM.Provider,{value:h},e.children)))},V.Search=D,V.TextArea=W.Z,V.Password=A,V.OTP=O;var q=V},31282:function(e,t,n){"use strict";n.d(t,{TI:function(){return w},ik:function(){return p},nz:function(){return u},s7:function(){return m},x0:function(){return f}});var r=n(93463),o=n(12918),a=n(17691),i=n(99320),c=n(71140),l=n(37433),s=n(65265);let u=e=>({"&::-moz-placeholder":{opacity:1},"&::placeholder":{color:e,userSelect:"none"},"&:placeholder-shown":{textOverflow:"ellipsis"}}),d=e=>{let{paddingBlockLG:t,lineHeightLG:n,borderRadiusLG:o,paddingInlineLG:a}=e;return{padding:"".concat((0,r.bf)(t)," ").concat((0,r.bf)(a)),fontSize:e.inputFontSizeLG,lineHeight:n,borderRadius:o}},f=e=>({padding:"".concat((0,r.bf)(e.paddingBlockSM)," ").concat((0,r.bf)(e.paddingInlineSM)),fontSize:e.inputFontSizeSM,borderRadius:e.borderRadiusSM}),p=e=>Object.assign(Object.assign({position:"relative",display:"inline-block",width:"100%",minWidth:0,padding:"".concat((0,r.bf)(e.paddingBlock)," ").concat((0,r.bf)(e.paddingInline)),color:e.colorText,fontSize:e.inputFontSize,lineHeight:e.lineHeight,borderRadius:e.borderRadius,transition:"all ".concat(e.motionDurationMid)},u(e.colorTextPlaceholder)),{"&-lg":Object.assign({},d(e)),"&-sm":Object.assign({},f(e)),"&-rtl, &-textarea-rtl":{direction:"rtl"}}),m=e=>{let{componentCls:t,antCls:n}=e;return{position:"relative",display:"table",width:"100%",borderCollapse:"separate",borderSpacing:0,"&[class*='col-']":{paddingInlineEnd:e.paddingXS,"&:last-child":{paddingInlineEnd:0}},["&-lg ".concat(t,", &-lg > ").concat(t,"-group-addon")]:Object.assign({},d(e)),["&-sm ".concat(t,", &-sm > ").concat(t,"-group-addon")]:Object.assign({},f(e)),["&-lg ".concat(n,"-select-single ").concat(n,"-select-selector")]:{height:e.controlHeightLG},["&-sm ".concat(n,"-select-single ").concat(n,"-select-selector")]:{height:e.controlHeightSM},["> ".concat(t)]:{display:"table-cell","&:not(:first-child):not(:last-child)":{borderRadius:0}},["".concat(t,"-group")]:{"&-addon, &-wrap":{display:"table-cell",width:1,whiteSpace:"nowrap",verticalAlign:"middle","&:not(:first-child):not(:last-child)":{borderRadius:0}},"&-wrap > *":{display:"block !important"},"&-addon":{position:"relative",padding:"0 ".concat((0,r.bf)(e.paddingInline)),color:e.colorText,fontWeight:"normal",fontSize:e.inputFontSize,textAlign:"center",borderRadius:e.borderRadius,transition:"all ".concat(e.motionDurationSlow),lineHeight:1,["".concat(n,"-select")]:{margin:"".concat((0,r.bf)(e.calc(e.paddingBlock).add(1).mul(-1).equal())," ").concat((0,r.bf)(e.calc(e.paddingInline).mul(-1).equal())),["&".concat(n,"-select-single:not(").concat(n,"-select-customize-input):not(").concat(n,"-pagination-size-changer)")]:{["".concat(n,"-select-selector")]:{backgroundColor:"inherit",border:"".concat((0,r.bf)(e.lineWidth)," ").concat(e.lineType," transparent"),boxShadow:"none"}}},["".concat(n,"-cascader-picker")]:{margin:"-9px ".concat((0,r.bf)(e.calc(e.paddingInline).mul(-1).equal())),backgroundColor:"transparent",["".concat(n,"-cascader-input")]:{textAlign:"start",border:0,boxShadow:"none"}}}},[t]:{width:"100%",marginBottom:0,textAlign:"inherit","&:focus":{zIndex:1,borderInlineEndWidth:1},"&:hover":{zIndex:1,borderInlineEndWidth:1,["".concat(t,"-search-with-button &")]:{zIndex:0}}},["> ".concat(t,":first-child, ").concat(t,"-group-addon:first-child")]:{borderStartEndRadius:0,borderEndEndRadius:0,["".concat(n,"-select ").concat(n,"-select-selector")]:{borderStartEndRadius:0,borderEndEndRadius:0}},["> ".concat(t,"-affix-wrapper")]:{["&:not(:first-child) ".concat(t)]:{borderStartStartRadius:0,borderEndStartRadius:0},["&:not(:last-child) ".concat(t)]:{borderStartEndRadius:0,borderEndEndRadius:0}},["> ".concat(t,":last-child, ").concat(t,"-group-addon:last-child")]:{borderStartStartRadius:0,borderEndStartRadius:0,["".concat(n,"-select ").concat(n,"-select-selector")]:{borderStartStartRadius:0,borderEndStartRadius:0}},["".concat(t,"-affix-wrapper")]:{"&:not(:last-child)":{borderStartEndRadius:0,borderEndEndRadius:0,["".concat(t,"-search &")]:{borderStartStartRadius:e.borderRadius,borderEndStartRadius:e.borderRadius}},["&:not(:first-child), ".concat(t,"-search &:not(:first-child)")]:{borderStartStartRadius:0,borderEndStartRadius:0}},["&".concat(t,"-group-compact")]:Object.assign(Object.assign({display:"block"},(0,o.dF)()),{["".concat(t,"-group-addon, ").concat(t,"-group-wrap, > ").concat(t)]:{"&:not(:first-child):not(:last-child)":{borderInlineEndWidth:e.lineWidth,"&:hover, &:focus":{zIndex:1}}},"& > *":{display:"inline-flex",float:"none",verticalAlign:"top",borderRadius:0},["\n & > ".concat(t,"-affix-wrapper,\n & > ").concat(t,"-number-affix-wrapper,\n & > ").concat(n,"-picker-range\n ")]:{display:"inline-flex"},"& > *:not(:last-child)":{marginInlineEnd:e.calc(e.lineWidth).mul(-1).equal(),borderInlineEndWidth:e.lineWidth},[t]:{float:"none"},["& > ".concat(n,"-select > ").concat(n,"-select-selector,\n & > ").concat(n,"-select-auto-complete ").concat(t,",\n & > ").concat(n,"-cascader-picker ").concat(t,",\n & > ").concat(t,"-group-wrapper ").concat(t)]:{borderInlineEndWidth:e.lineWidth,borderRadius:0,"&:hover, &:focus":{zIndex:1}},["& > ".concat(n,"-select-focused")]:{zIndex:1},["& > ".concat(n,"-select > ").concat(n,"-select-arrow")]:{zIndex:1},["& > *:first-child,\n & > ".concat(n,"-select:first-child > ").concat(n,"-select-selector,\n & > ").concat(n,"-select-auto-complete:first-child ").concat(t,",\n & > ").concat(n,"-cascader-picker:first-child ").concat(t)]:{borderStartStartRadius:e.borderRadius,borderEndStartRadius:e.borderRadius},["& > *:last-child,\n & > ".concat(n,"-select:last-child > ").concat(n,"-select-selector,\n & > ").concat(n,"-cascader-picker:last-child ").concat(t,",\n & > ").concat(n,"-cascader-picker-focused:last-child ").concat(t)]:{borderInlineEndWidth:e.lineWidth,borderStartEndRadius:e.borderRadius,borderEndEndRadius:e.borderRadius},["& > ".concat(n,"-select-auto-complete ").concat(t)]:{verticalAlign:"top"},["".concat(t,"-group-wrapper + ").concat(t,"-group-wrapper")]:{marginInlineStart:e.calc(e.lineWidth).mul(-1).equal(),["".concat(t,"-affix-wrapper")]:{borderRadius:0}},["".concat(t,"-group-wrapper:not(:last-child)")]:{["&".concat(t,"-search > ").concat(t,"-group")]:{["& > ".concat(t,"-group-addon > ").concat(t,"-search-button")]:{borderRadius:0},["& > ".concat(t)]:{borderStartStartRadius:e.borderRadius,borderStartEndRadius:0,borderEndEndRadius:0,borderEndStartRadius:e.borderRadius}}}})}},g=e=>{let{componentCls:t,controlHeightSM:n,lineWidth:r,calc:a}=e,i=a(n).sub(a(r).mul(2)).sub(16).div(2).equal();return{[t]:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},(0,o.Wf)(e)),p(e)),(0,s.qG)(e)),(0,s.H8)(e)),(0,s.Mu)(e)),(0,s.vc)(e)),{'&[type="color"]':{height:e.controlHeight,["&".concat(t,"-lg")]:{height:e.controlHeightLG},["&".concat(t,"-sm")]:{height:n,paddingTop:i,paddingBottom:i}},'&[type="search"]::-webkit-search-cancel-button, &[type="search"]::-webkit-search-decoration':{appearance:"none"}})}},v=e=>{let{componentCls:t}=e;return{["".concat(t,"-clear-icon")]:{margin:0,padding:0,lineHeight:0,color:e.colorTextQuaternary,fontSize:e.fontSizeIcon,verticalAlign:-1,cursor:"pointer",transition:"color ".concat(e.motionDurationSlow),border:"none",outline:"none",backgroundColor:"transparent","&:hover":{color:e.colorIcon},"&:active":{color:e.colorText},"&-hidden":{visibility:"hidden"},"&-has-suffix":{margin:"0 ".concat((0,r.bf)(e.inputAffixPadding))}}}},h=e=>{let{componentCls:t,inputAffixPadding:n,colorTextDescription:r,motionDurationSlow:o,colorIcon:a,colorIconHover:i,iconCls:c}=e,l="".concat(t,"-affix-wrapper"),s="".concat(t,"-affix-wrapper-disabled");return{[l]:Object.assign(Object.assign(Object.assign(Object.assign({},p(e)),{display:"inline-flex",["&:not(".concat(t,"-disabled):hover")]:{zIndex:1,["".concat(t,"-search-with-button &")]:{zIndex:0}},"&-focused, &:focus":{zIndex:1},["> input".concat(t)]:{padding:0},["> input".concat(t,", > textarea").concat(t)]:{fontSize:"inherit",border:"none",borderRadius:0,outline:"none",background:"transparent",color:"inherit","&::-ms-reveal":{display:"none"},"&:focus":{boxShadow:"none !important"}},"&::before":{display:"inline-block",width:0,visibility:"hidden",content:'"\\a0"'},[t]:{"&-prefix, &-suffix":{display:"flex",flex:"none",alignItems:"center","> *:not(:last-child)":{marginInlineEnd:e.paddingXS}},"&-show-count-suffix":{color:r,direction:"ltr"},"&-show-count-has-suffix":{marginInlineEnd:e.paddingXXS},"&-prefix":{marginInlineEnd:n},"&-suffix":{marginInlineStart:n}}}),v(e)),{["".concat(c).concat(t,"-password-icon")]:{color:a,cursor:"pointer",transition:"all ".concat(o),"&:hover":{color:i}}}),["".concat(t,"-underlined")]:{borderRadius:0},[s]:{["".concat(c).concat(t,"-password-icon")]:{color:a,cursor:"not-allowed","&:hover":{color:a}}}}},b=e=>{let{componentCls:t,borderRadiusLG:n,borderRadiusSM:r}=e;return{["".concat(t,"-group")]:Object.assign(Object.assign(Object.assign({},(0,o.Wf)(e)),m(e)),{"&-rtl":{direction:"rtl"},"&-wrapper":Object.assign(Object.assign(Object.assign({display:"inline-block",width:"100%",textAlign:"start",verticalAlign:"top","&-rtl":{direction:"rtl"},"&-lg":{["".concat(t,"-group-addon")]:{borderRadius:n,fontSize:e.inputFontSizeLG}},"&-sm":{["".concat(t,"-group-addon")]:{borderRadius:r}}},(0,s.ir)(e)),(0,s.S5)(e)),{["&:not(".concat(t,"-compact-first-item):not(").concat(t,"-compact-last-item)").concat(t,"-compact-item")]:{["".concat(t,", ").concat(t,"-group-addon")]:{borderRadius:0}},["&:not(".concat(t,"-compact-last-item)").concat(t,"-compact-first-item")]:{["".concat(t,", ").concat(t,"-group-addon")]:{borderStartEndRadius:0,borderEndEndRadius:0}},["&:not(".concat(t,"-compact-first-item)").concat(t,"-compact-last-item")]:{["".concat(t,", ").concat(t,"-group-addon")]:{borderStartStartRadius:0,borderEndStartRadius:0}},["&:not(".concat(t,"-compact-last-item)").concat(t,"-compact-item")]:{["".concat(t,"-affix-wrapper")]:{borderStartEndRadius:0,borderEndEndRadius:0}},["&:not(".concat(t,"-compact-first-item)").concat(t,"-compact-item")]:{["".concat(t,"-affix-wrapper")]:{borderStartStartRadius:0,borderEndStartRadius:0}}})})}},y=e=>{let{componentCls:t,antCls:n}=e,r="".concat(t,"-search");return{[r]:{[t]:{"&:not([disabled]):hover, &:not([disabled]):focus":{["+ ".concat(t,"-group-addon ").concat(r,"-button:not(").concat(n,"-btn-color-primary):not(").concat(n,"-btn-variant-text)")]:{borderInlineStartColor:e.colorPrimaryHover}}},["".concat(t,"-affix-wrapper")]:{height:e.controlHeight,borderRadius:0},["".concat(t,"-lg")]:{lineHeight:e.calc(e.lineHeightLG).sub(2e-4).equal()},["> ".concat(t,"-group")]:{["> ".concat(t,"-group-addon:last-child")]:{insetInlineStart:-1,padding:0,border:0,["".concat(r,"-button")]:{marginInlineEnd:-1,borderStartStartRadius:0,borderEndStartRadius:0,boxShadow:"none"},["".concat(r,"-button:not(").concat(n,"-btn-color-primary)")]:{color:e.colorTextDescription,"&:not([disabled]):hover":{color:e.colorPrimaryHover},"&:active":{color:e.colorPrimaryActive},["&".concat(n,"-btn-loading::before")]:{inset:0}}}},["".concat(r,"-button")]:{height:e.controlHeight,"&:hover, &:focus":{zIndex:1}},"&-large":{["".concat(t,"-affix-wrapper, ").concat(r,"-button")]:{height:e.controlHeightLG}},"&-small":{["".concat(t,"-affix-wrapper, ").concat(r,"-button")]:{height:e.controlHeightSM}},"&-rtl":{direction:"rtl"},["&".concat(t,"-compact-item")]:{["&:not(".concat(t,"-compact-last-item)")]:{["".concat(t,"-group-addon")]:{["".concat(t,"-search-button")]:{marginInlineEnd:e.calc(e.lineWidth).mul(-1).equal(),borderRadius:0}}},["&:not(".concat(t,"-compact-first-item)")]:{["".concat(t,",").concat(t,"-affix-wrapper")]:{borderRadius:0}},["> ".concat(t,"-group-addon ").concat(t,"-search-button,\n > ").concat(t,",\n ").concat(t,"-affix-wrapper")]:{"&:hover, &:focus, &:active":{zIndex:2}},["> ".concat(t,"-affix-wrapper-focused")]:{zIndex:2}}}}},x=e=>{let{componentCls:t}=e;return{["".concat(t,"-out-of-range")]:{["&, & input, & textarea, ".concat(t,"-show-count-suffix, ").concat(t,"-data-count")]:{color:e.colorError}}}},w=(0,i.I$)(["Input","Shared"],e=>{let t=(0,c.IX)(e,(0,l.e)(e));return[g(t),h(t)]},l.T,{resetFont:!1});t.ZP=(0,i.I$)(["Input","Component"],e=>{let t=(0,c.IX)(e,(0,l.e)(e));return[b(t),y(t),x(t),(0,a.c)(t)]},l.T,{resetFont:!1})},37433:function(e,t,n){"use strict";n.d(t,{T:function(){return a},e:function(){return o}});var r=n(71140);function o(e){return(0,r.IX)(e,{inputAffixPadding:e.paddingXXS})}let a=e=>{let{controlHeight:t,fontSize:n,lineHeight:r,lineWidth:o,controlHeightSM:a,controlHeightLG:i,fontSizeLG:c,lineHeightLG:l,paddingSM:s,controlPaddingHorizontalSM:u,controlPaddingHorizontal:d,colorFillAlter:f,colorPrimaryHover:p,colorPrimary:m,controlOutlineWidth:g,controlOutline:v,colorErrorOutline:h,colorWarningOutline:b,colorBgContainer:y,inputFontSize:x,inputFontSizeLG:w,inputFontSizeSM:E}=e,C=x||n,Z=E||C,S=w||c;return{paddingBlock:Math.max(Math.round((t-C*r)/2*10)/10-o,0),paddingBlockSM:Math.max(Math.round((a-Z*r)/2*10)/10-o,0),paddingBlockLG:Math.max(Math.ceil((i-S*l)/2*10)/10-o,0),paddingInline:s-o,paddingInlineSM:u-o,paddingInlineLG:d-o,addonBg:f,activeBorderColor:m,hoverBorderColor:p,activeShadow:"0 0 0 ".concat(g,"px ").concat(v),errorActiveShadow:"0 0 0 ".concat(g,"px ").concat(h),warningActiveShadow:"0 0 0 ".concat(g,"px ").concat(b),hoverBg:y,activeBg:y,inputFontSize:C,inputFontSizeLG:S,inputFontSizeSM:Z}}},65265:function(e,t,n){"use strict";n.d(t,{$U:function(){return c},H8:function(){return g},Mu:function(){return f},S5:function(){return h},Xy:function(){return i},ir:function(){return d},qG:function(){return s},vc:function(){return x}});var r=n(93463),o=n(71140);let a=e=>({borderColor:e.hoverBorderColor,backgroundColor:e.hoverBg}),i=e=>({color:e.colorTextDisabled,backgroundColor:e.colorBgContainerDisabled,borderColor:e.colorBorder,boxShadow:"none",cursor:"not-allowed",opacity:1,"input[disabled], textarea[disabled]":{cursor:"not-allowed"},"&:hover:not([disabled])":Object.assign({},a((0,o.IX)(e,{hoverBorderColor:e.colorBorder,hoverBg:e.colorBgContainerDisabled})))}),c=(e,t)=>({background:e.colorBgContainer,borderWidth:e.lineWidth,borderStyle:e.lineType,borderColor:t.borderColor,"&:hover":{borderColor:t.hoverBorderColor,backgroundColor:e.hoverBg},"&:focus, &:focus-within":{borderColor:t.activeBorderColor,boxShadow:t.activeShadow,outline:0,backgroundColor:e.activeBg}}),l=(e,t)=>({["&".concat(e.componentCls,"-status-").concat(t.status,":not(").concat(e.componentCls,"-disabled)")]:Object.assign(Object.assign({},c(e,t)),{["".concat(e.componentCls,"-prefix, ").concat(e.componentCls,"-suffix")]:{color:t.affixColor}}),["&".concat(e.componentCls,"-status-").concat(t.status).concat(e.componentCls,"-disabled")]:{borderColor:t.borderColor}}),s=(e,t)=>({"&-outlined":Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},c(e,{borderColor:e.colorBorder,hoverBorderColor:e.hoverBorderColor,activeBorderColor:e.activeBorderColor,activeShadow:e.activeShadow})),{["&".concat(e.componentCls,"-disabled, &[disabled]")]:Object.assign({},i(e))}),l(e,{status:"error",borderColor:e.colorError,hoverBorderColor:e.colorErrorBorderHover,activeBorderColor:e.colorError,activeShadow:e.errorActiveShadow,affixColor:e.colorError})),l(e,{status:"warning",borderColor:e.colorWarning,hoverBorderColor:e.colorWarningBorderHover,activeBorderColor:e.colorWarning,activeShadow:e.warningActiveShadow,affixColor:e.colorWarning})),t)}),u=(e,t)=>({["&".concat(e.componentCls,"-group-wrapper-status-").concat(t.status)]:{["".concat(e.componentCls,"-group-addon")]:{borderColor:t.addonBorderColor,color:t.addonColor}}}),d=e=>({"&-outlined":Object.assign(Object.assign(Object.assign({["".concat(e.componentCls,"-group")]:{"&-addon":{background:e.addonBg,border:"".concat((0,r.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorder)},"&-addon:first-child":{borderInlineEnd:0},"&-addon:last-child":{borderInlineStart:0}}},u(e,{status:"error",addonBorderColor:e.colorError,addonColor:e.colorErrorText})),u(e,{status:"warning",addonBorderColor:e.colorWarning,addonColor:e.colorWarningText})),{["&".concat(e.componentCls,"-group-wrapper-disabled")]:{["".concat(e.componentCls,"-group-addon")]:Object.assign({},i(e))}})}),f=(e,t)=>{let{componentCls:n}=e;return{"&-borderless":Object.assign({background:"transparent",border:"none","&:focus, &:focus-within":{outline:"none"},["&".concat(n,"-disabled, &[disabled]")]:{color:e.colorTextDisabled,cursor:"not-allowed"},["&".concat(n,"-status-error")]:{"&, & input, & textarea":{color:e.colorError}},["&".concat(n,"-status-warning")]:{"&, & input, & textarea":{color:e.colorWarning}}},t)}},p=(e,t)=>{var n;return{background:t.bg,borderWidth:e.lineWidth,borderStyle:e.lineType,borderColor:"transparent","input&, & input, textarea&, & textarea":{color:null!==(n=null==t?void 0:t.inputColor)&&void 0!==n?n:"unset"},"&:hover":{background:t.hoverBg},"&:focus, &:focus-within":{outline:0,borderColor:t.activeBorderColor,backgroundColor:e.activeBg}}},m=(e,t)=>({["&".concat(e.componentCls,"-status-").concat(t.status,":not(").concat(e.componentCls,"-disabled)")]:Object.assign(Object.assign({},p(e,t)),{["".concat(e.componentCls,"-prefix, ").concat(e.componentCls,"-suffix")]:{color:t.affixColor}})}),g=(e,t)=>({"&-filled":Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},p(e,{bg:e.colorFillTertiary,hoverBg:e.colorFillSecondary,activeBorderColor:e.activeBorderColor})),{["&".concat(e.componentCls,"-disabled, &[disabled]")]:Object.assign({},i(e))}),m(e,{status:"error",bg:e.colorErrorBg,hoverBg:e.colorErrorBgHover,activeBorderColor:e.colorError,inputColor:e.colorErrorText,affixColor:e.colorError})),m(e,{status:"warning",bg:e.colorWarningBg,hoverBg:e.colorWarningBgHover,activeBorderColor:e.colorWarning,inputColor:e.colorWarningText,affixColor:e.colorWarning})),t)}),v=(e,t)=>({["&".concat(e.componentCls,"-group-wrapper-status-").concat(t.status)]:{["".concat(e.componentCls,"-group-addon")]:{background:t.addonBg,color:t.addonColor}}}),h=e=>({"&-filled":Object.assign(Object.assign(Object.assign({["".concat(e.componentCls,"-group-addon")]:{background:e.colorFillTertiary,"&:last-child":{position:"static"}}},v(e,{status:"error",addonBg:e.colorErrorBg,addonColor:e.colorErrorText})),v(e,{status:"warning",addonBg:e.colorWarningBg,addonColor:e.colorWarningText})),{["&".concat(e.componentCls,"-group-wrapper-disabled")]:{["".concat(e.componentCls,"-group")]:{"&-addon":{background:e.colorFillTertiary,color:e.colorTextDisabled},"&-addon:first-child":{borderInlineStart:"".concat((0,r.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorder),borderTop:"".concat((0,r.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorder),borderBottom:"".concat((0,r.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorder)},"&-addon:last-child":{borderInlineEnd:"".concat((0,r.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorder),borderTop:"".concat((0,r.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorder),borderBottom:"".concat((0,r.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorder)}}}})}),b=(e,t)=>({background:e.colorBgContainer,borderWidth:"".concat((0,r.bf)(e.lineWidth)," 0"),borderStyle:"".concat(e.lineType," none"),borderColor:"transparent transparent ".concat(t.borderColor," transparent"),borderRadius:0,"&:hover":{borderColor:"transparent transparent ".concat(t.hoverBorderColor," transparent"),backgroundColor:e.hoverBg},"&:focus, &:focus-within":{borderColor:"transparent transparent ".concat(t.activeBorderColor," transparent"),outline:0,backgroundColor:e.activeBg}}),y=(e,t)=>({["&".concat(e.componentCls,"-status-").concat(t.status,":not(").concat(e.componentCls,"-disabled)")]:Object.assign(Object.assign({},b(e,t)),{["".concat(e.componentCls,"-prefix, ").concat(e.componentCls,"-suffix")]:{color:t.affixColor}}),["&".concat(e.componentCls,"-status-").concat(t.status).concat(e.componentCls,"-disabled")]:{borderColor:"transparent transparent ".concat(t.borderColor," transparent")}}),x=(e,t)=>({"&-underlined":Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},b(e,{borderColor:e.colorBorder,hoverBorderColor:e.hoverBorderColor,activeBorderColor:e.activeBorderColor,activeShadow:e.activeShadow})),{["&".concat(e.componentCls,"-disabled, &[disabled]")]:{color:e.colorTextDisabled,boxShadow:"none",cursor:"not-allowed","&:hover":{borderColor:"transparent transparent ".concat(e.colorBorder," transparent")}},"input[disabled], textarea[disabled]":{cursor:"not-allowed"}}),y(e,{status:"error",borderColor:e.colorError,hoverBorderColor:e.colorErrorBorderHover,activeBorderColor:e.colorError,activeShadow:e.errorActiveShadow,affixColor:e.colorError})),y(e,{status:"warning",borderColor:e.colorWarning,hoverBorderColor:e.colorWarningBorderHover,activeBorderColor:e.colorWarning,activeShadow:e.warningActiveShadow,affixColor:e.colorWarning})),t)})},91325:function(e,t,n){"use strict";let r=(0,n(2265).createContext)(void 0);t.Z=r},37381:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var r=n(96257),o=n(31686),a=(0,o.Z)((0,o.Z)({},{yearFormat:"YYYY",dayFormat:"D",cellMeridiemFormat:"A",monthBeforeYear:!0}),{},{locale:"en_US",today:"Today",now:"Now",backToToday:"Back to today",ok:"OK",clear:"Clear",week:"Week",month:"Month",year:"Year",timeSelect:"select time",dateSelect:"select date",weekSelect:"Choose a week",monthSelect:"Choose a month",yearSelect:"Choose a year",decadeSelect:"Choose a decade",dateFormat:"M/D/YYYY",dateTimeFormat:"M/D/YYYY HH:mm:ss",previousMonth:"Previous month (PageUp)",nextMonth:"Next month (PageDown)",previousYear:"Last year (Control + left)",nextYear:"Next year (Control + right)",previousDecade:"Last decade",nextDecade:"Next decade",previousCentury:"Last century",nextCentury:"Next century"}),i={placeholder:"Select time",rangePlaceholder:["Start time","End time"]};let c={lang:Object.assign({placeholder:"Select date",yearPlaceholder:"Select year",quarterPlaceholder:"Select quarter",monthPlaceholder:"Select month",weekPlaceholder:"Select week",rangePlaceholder:["Start date","End date"],rangeYearPlaceholder:["Start year","End year"],rangeQuarterPlaceholder:["Start quarter","End quarter"],rangeMonthPlaceholder:["Start month","End month"],rangeWeekPlaceholder:["Start week","End week"]},a),timePickerLocale:Object.assign({},i)},l="${label} is not a valid ${type}";var s={locale:"en",Pagination:r.Z,DatePicker:c,TimePicker:i,Calendar:c,global:{placeholder:"Please select",close:"Close"},Table:{filterTitle:"Filter menu",filterConfirm:"OK",filterReset:"Reset",filterEmptyText:"No filters",filterCheckAll:"Select all items",filterSearchPlaceholder:"Search in filters",emptyText:"No data",selectAll:"Select current page",selectInvert:"Invert current page",selectNone:"Clear all data",selectionAll:"Select all data",sortTitle:"Sort",expand:"Expand row",collapse:"Collapse row",triggerDesc:"Click to sort descending",triggerAsc:"Click to sort ascending",cancelSort:"Click to cancel sorting"},Tour:{Next:"Next",Previous:"Previous",Finish:"Finish"},Modal:{okText:"OK",cancelText:"Cancel",justOkText:"OK"},Popconfirm:{okText:"OK",cancelText:"Cancel"},Transfer:{titles:["",""],searchPlaceholder:"Search here",itemUnit:"item",itemsUnit:"items",remove:"Remove",selectCurrent:"Select current page",removeCurrent:"Remove current page",selectAll:"Select all data",deselectAll:"Deselect all data",removeAll:"Remove all data",selectInvert:"Invert current page"},Upload:{uploading:"Uploading...",removeFile:"Remove file",uploadError:"Upload error",previewFile:"Preview file",downloadFile:"Download file"},Empty:{description:"No data"},Icon:{icon:"icon"},Text:{edit:"Edit",copy:"Copy",copied:"Copied",expand:"Expand",collapse:"Collapse"},Form:{optional:"(optional)",defaultValidateMessages:{default:"Field validation error for ${label}",required:"Please enter ${label}",enum:"${label} must be one of [${enum}]",whitespace:"${label} cannot be a blank character",date:{format:"${label} date format is invalid",parse:"${label} cannot be converted to a date",invalid:"${label} is an invalid date"},types:{string:l,method:l,array:l,object:l,number:l,date:l,boolean:l,integer:l,float:l,regexp:l,email:l,url:l,hex:l},string:{len:"${label} must be ${len} characters",min:"${label} must be at least ${min} characters",max:"${label} must be up to ${max} characters",range:"${label} must be between ${min}-${max} characters"},number:{len:"${label} must be equal to ${len}",min:"${label} must be minimum ${min}",max:"${label} must be maximum ${max}",range:"${label} must be between ${min}-${max}"},array:{len:"Must be ${len} ${label}",min:"At least ${min} ${label}",max:"At most ${max} ${label}",range:"The amount of ${label} must be between ${min}-${max}"},pattern:{mismatch:"${label} does not match the pattern ${pattern}"}}},Image:{preview:"Preview"},QRCode:{expired:"QR code expired",refresh:"Refresh",scanned:"Scanned"},ColorPicker:{presetEmpty:"Empty",transparent:"Transparent",singleColor:"Single",gradientColor:"Gradient"}}},55274:function(e,t,n){"use strict";var r=n(2265),o=n(91325),a=n(37381);t.Z=(e,t)=>{let n=r.useContext(o.Z);return[r.useMemo(()=>{var r;let o=t||a.Z[e],i=null!==(r=null==n?void 0:n[e])&&void 0!==r?r:{};return Object.assign(Object.assign({},"function"==typeof o?o():o),i||{})},[e,t,n]),r.useMemo(()=>{let e=null==n?void 0:n.locale;return(null==n?void 0:n.exist)&&!e?a.Z.locale:e},[n])]}},42264:function(e,t,n){"use strict";n.d(t,{ZP:function(){return X}});var r=n(83145),o=n(2265),a=n(52402),i=n(71744),c=n(18310),l=n(66061),s=n(8900),u=n(39725),d=n(54537),f=n(55726),p=n(61935),m=n(36760),g=n.n(m),v=n(49283),h=n(64024),b=n(93463),y=n(62236),x=n(12918),w=n(99320),E=n(71140);let C=e=>{let{componentCls:t,iconCls:n,boxShadow:r,colorText:o,colorSuccess:a,colorError:i,colorWarning:c,colorInfo:l,fontSizeLG:s,motionEaseInOutCirc:u,motionDurationSlow:d,marginXS:f,paddingXS:p,borderRadiusLG:m,zIndexPopup:g,contentPadding:v,contentBg:h}=e,y="".concat(t,"-notice"),w=new b.E4("MessageMoveIn",{"0%":{padding:0,transform:"translateY(-100%)",opacity:0},"100%":{padding:p,transform:"translateY(0)",opacity:1}}),E=new b.E4("MessageMoveOut",{"0%":{maxHeight:e.height,padding:p,opacity:1},"100%":{maxHeight:0,padding:0,opacity:0}}),C={padding:p,textAlign:"center",["".concat(t,"-custom-content")]:{display:"flex",alignItems:"center"},["".concat(t,"-custom-content > ").concat(n)]:{marginInlineEnd:f,fontSize:s},["".concat(y,"-content")]:{display:"inline-block",padding:v,background:h,borderRadius:m,boxShadow:r,pointerEvents:"all"},["".concat(t,"-success > ").concat(n)]:{color:a},["".concat(t,"-error > ").concat(n)]:{color:i},["".concat(t,"-warning > ").concat(n)]:{color:c},["".concat(t,"-info > ").concat(n,",\n ").concat(t,"-loading > ").concat(n)]:{color:l}};return[{[t]:Object.assign(Object.assign({},(0,x.Wf)(e)),{color:o,position:"fixed",top:f,width:"100%",pointerEvents:"none",zIndex:g,["".concat(t,"-move-up")]:{animationFillMode:"forwards"},["\n ".concat(t,"-move-up-appear,\n ").concat(t,"-move-up-enter\n ")]:{animationName:w,animationDuration:d,animationPlayState:"paused",animationTimingFunction:u},["\n ".concat(t,"-move-up-appear").concat(t,"-move-up-appear-active,\n ").concat(t,"-move-up-enter").concat(t,"-move-up-enter-active\n ")]:{animationPlayState:"running"},["".concat(t,"-move-up-leave")]:{animationName:E,animationDuration:d,animationPlayState:"paused",animationTimingFunction:u},["".concat(t,"-move-up-leave").concat(t,"-move-up-leave-active")]:{animationPlayState:"running"},"&-rtl":{direction:"rtl",span:{direction:"rtl"}}})},{[t]:{["".concat(y,"-wrapper")]:Object.assign({},C)}},{["".concat(t,"-notice-pure-panel")]:Object.assign(Object.assign({},C),{padding:0,textAlign:"start"})}]};var Z=(0,w.I$)("Message",e=>C((0,E.IX)(e,{height:150})),e=>({zIndexPopup:e.zIndexPopupBase+y.u6+10,contentBg:e.colorBgElevated,contentPadding:"".concat((e.controlHeightLG-e.fontSize*e.lineHeight)/2,"px ").concat(e.paddingSM,"px")})),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 O={info:o.createElement(f.Z,null),success:o.createElement(s.Z,null),error:o.createElement(u.Z,null),warning:o.createElement(d.Z,null),loading:o.createElement(p.Z,null)},k=e=>{let{prefixCls:t,type:n,icon:r,children:a}=e;return o.createElement("div",{className:g()("".concat(t,"-custom-content"),"".concat(t,"-").concat(n))},r||O[n],o.createElement("span",null,a))};var j=n(49638),I=n(13613);function M(e){let t;let n=new Promise(n=>{t=e(()=>{n(!0)})}),r=()=>{null==t||t()};return r.then=(e,t)=>n.then(e,t),r.promise=n,r}var R=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 N=e=>{let{children:t,prefixCls:n}=e,r=(0,h.Z)(n),[a,i,c]=Z(n,r);return a(o.createElement(v.JB,{classNames:{list:g()(i,c,r)}},t))},P=(e,t)=>{let{prefixCls:n,key:r}=t;return o.createElement(N,{prefixCls:n,key:r},e)},F=o.forwardRef((e,t)=>{let{top:n,prefixCls:r,getContainer:a,maxCount:c,duration:l=3,rtl:s,transitionName:u,onAllRemoved:d}=e,{getPrefixCls:f,getPopupContainer:p,message:m,direction:h}=o.useContext(i.E_),b=r||f("message"),y=o.createElement("span",{className:"".concat(b,"-close-x")},o.createElement(j.Z,{className:"".concat(b,"-close-icon")})),[x,w]=(0,v.lm)({prefixCls:b,style:()=>({left:"50%",transform:"translateX(-50%)",top:null!=n?n:8}),className:()=>g()({["".concat(b,"-rtl")]:null!=s?s:"rtl"===h}),motion:()=>({motionName:null!=u?u:"".concat(b,"-move-up")}),closable:!1,closeIcon:y,duration:l,getContainer:()=>(null==a?void 0:a())||(null==p?void 0:p())||document.body,maxCount:c,onAllRemoved:d,renderNotifications:P});return o.useImperativeHandle(t,()=>Object.assign(Object.assign({},x),{prefixCls:b,message:m})),w}),T=0;function A(e){let t=o.useRef(null);return(0,I.ln)("Message"),[o.useMemo(()=>{let e=e=>{var n;null===(n=t.current)||void 0===n||n.close(e)},n=n=>{if(!t.current){let e=()=>{};return e.then=()=>{},e}let{open:r,prefixCls:a,message:i}=t.current,c="".concat(a,"-notice"),{content:l,icon:s,type:u,key:d,className:f,style:p,onClose:m}=n,v=R(n,["content","icon","type","key","className","style","onClose"]),h=d;return null==h&&(T+=1,h="antd-message-".concat(T)),M(t=>(r(Object.assign(Object.assign({},v),{key:h,content:o.createElement(k,{prefixCls:a,type:u,icon:s},l),placement:"top",className:g()(u&&"".concat(c,"-").concat(u),f,null==i?void 0:i.className),style:Object.assign(Object.assign({},null==i?void 0:i.style),p),onClose:()=>{null==m||m(),t()}})),()=>{e(h)}))},r={open:n,destroy:n=>{var r;void 0!==n?e(n):null===(r=t.current)||void 0===r||r.destroy()}};return["info","success","warning","error","loading"].forEach(e=>{r[e]=(t,r,o)=>{let a,i,c;return a=t&&"object"==typeof t&&"content"in t?t:{content:t},"function"==typeof r?c=r:(i=r,c=o),n(Object.assign(Object.assign({onClose:c,duration:i},a),{type:e}))}}),r},[]),o.createElement(F,Object.assign({key:"message-holder"},e,{ref:t}))]}let _=null,B=e=>e(),H=[],z={};function L(){let{getContainer:e,duration:t,rtl:n,maxCount:r,top:o}=z,a=(null==e?void 0:e())||document.body;return{getContainer:()=>a,duration:t,rtl:n,maxCount:r,top:o}}let D=o.forwardRef((e,t)=>{let{messageConfig:n,sync:r}=e,{getPrefixCls:c}=(0,o.useContext)(i.E_),l=z.prefixCls||c("message"),s=(0,o.useContext)(a.J),[u,d]=A(Object.assign(Object.assign(Object.assign({},n),{prefixCls:l}),s.message));return o.useImperativeHandle(t,()=>{let e=Object.assign({},u);return Object.keys(e).forEach(t=>{e[t]=function(){for(var e=arguments.length,n=Array(e),o=0;o{let[n,r]=o.useState(L),a=()=>{r(L)};o.useEffect(a,[]);let i=(0,c.w6)(),l=i.getRootPrefixCls(),s=i.getIconPrefixCls(),u=i.getTheme(),d=o.createElement(D,{ref:t,sync:a,messageConfig:n});return o.createElement(c.ZP,{prefixCls:l,iconPrefixCls:s,theme:u},i.holderRender?i.holderRender(d):d)}),V=()=>{if(!_){let e=document.createDocumentFragment(),t={fragment:e};_=t,B(()=>{(0,l.q)()(o.createElement(W,{ref:e=>{let{instance:n,sync:r}=e||{};Promise.resolve().then(()=>{!t.instance&&n&&(t.instance=n,t.sync=r,V())})}}),e)});return}_.instance&&(H.forEach(e=>{let{type:t,skipped:n}=e;if(!n)switch(t){case"open":B(()=>{let t=_.instance.open(Object.assign(Object.assign({},z),e.config));null==t||t.then(e.resolve),e.setCloseFn(t)});break;case"destroy":B(()=>{null==_||_.instance.destroy(e.key)});break;default:B(()=>{var n;let o=(n=_.instance)[t].apply(n,(0,r.Z)(e.args));null==o||o.then(e.resolve),e.setCloseFn(o)})}}),H=[])},q={open:function(e){let t=M(t=>{let n;let r={type:"open",config:e,resolve:t,setCloseFn:e=>{n=e}};return H.push(r),()=>{n?B(()=>{n()}):r.skipped=!0}});return V(),t},destroy:e=>{H.push({type:"destroy",key:e}),V()},config:function(e){z=Object.assign(Object.assign({},z),e),B(()=>{var e;null===(e=null==_?void 0:_.sync)||void 0===e||e.call(_)})},useMessage:function(e){return A(e)},_InternalPanelDoNotUseOrYouWillBeFired:e=>{let{prefixCls:t,className:n,type:r,icon:a,content:c}=e,l=S(e,["prefixCls","className","type","icon","content"]),{getPrefixCls:s}=o.useContext(i.E_),u=t||s("message"),d=(0,h.Z)(u),[f,p,m]=Z(u,d);return f(o.createElement(v.qX,Object.assign({},l,{prefixCls:u,className:g()(n,p,"".concat(u,"-notice-pure-panel"),m,d),eventKey:"pure",duration:null,content:o.createElement(k,{prefixCls:u,type:r,icon:a},c)})))}};["success","info","warning","error","loading"].forEach(e=>{q[e]=function(){for(var t=arguments.length,n=Array(t),r=0;r{let r;let o={type:e,args:t,resolve:n,setCloseFn:e=>{r=e}};return H.push(o),()=>{r?B(()=>{r()}):o.skipped=!0}});return V(),n}(e,n)}});var X=q},92246:function(e,t,n){"use strict";n.d(t,{A:function(){return l},f:function(){return c}});var r=n(37381);let o=Object.assign({},r.Z.Modal),a=[],i=()=>a.reduce((e,t)=>Object.assign(Object.assign({},e),t),r.Z.Modal);function c(e){if(e){let t=Object.assign({},e);return a.push(t),o=i(),()=>{a=a.filter(e=>e!==t),o=i()}}o=Object.assign({},r.Z.Modal)}function l(){return o}},57271:function(e,t,n){"use strict";n.d(t,{ZP:function(){return er}});var r=n(2265),o=n(52402),a=n(71744),i=n(18310),c=n(66061),l=n(8900),s=n(39725),u=n(49638),d=n(54537),f=n(55726),p=n(61935),m=n(36760),g=n.n(m),v=n(49283),h=n(64024),b=n(93463),y=n(62236),x=n(12918),w=n(71140),E=n(99320),C=e=>{let{componentCls:t,notificationMarginEdge:n,animationMaxHeight:r}=e,o="".concat(t,"-notice"),a=new b.E4("antNotificationFadeIn",{"0%":{transform:"translate3d(100%, 0, 0)",opacity:0},"100%":{transform:"translate3d(0, 0, 0)",opacity:1}}),i=new b.E4("antNotificationTopFadeIn",{"0%":{top:-r,opacity:0},"100%":{top:0,opacity:1}}),c=new b.E4("antNotificationBottomFadeIn",{"0%":{bottom:e.calc(r).mul(-1).equal(),opacity:0},"100%":{bottom:0,opacity:1}}),l=new b.E4("antNotificationLeftFadeIn",{"0%":{transform:"translate3d(-100%, 0, 0)",opacity:0},"100%":{transform:"translate3d(0, 0, 0)",opacity:1}});return{[t]:{["&".concat(t,"-top, &").concat(t,"-bottom")]:{marginInline:0,[o]:{marginInline:"auto auto"}},["&".concat(t,"-top")]:{["".concat(t,"-fade-enter").concat(t,"-fade-enter-active, ").concat(t,"-fade-appear").concat(t,"-fade-appear-active")]:{animationName:i}},["&".concat(t,"-bottom")]:{["".concat(t,"-fade-enter").concat(t,"-fade-enter-active, ").concat(t,"-fade-appear").concat(t,"-fade-appear-active")]:{animationName:c}},["&".concat(t,"-topRight, &").concat(t,"-bottomRight")]:{["".concat(t,"-fade-enter").concat(t,"-fade-enter-active, ").concat(t,"-fade-appear").concat(t,"-fade-appear-active")]:{animationName:a}},["&".concat(t,"-topLeft, &").concat(t,"-bottomLeft")]:{marginRight:{value:0,_skip_check_:!0},marginLeft:{value:n,_skip_check_:!0},[o]:{marginInlineEnd:"auto",marginInlineStart:0},["".concat(t,"-fade-enter").concat(t,"-fade-enter-active, ").concat(t,"-fade-appear").concat(t,"-fade-appear-active")]:{animationName:l}}}}};let Z=["top","topLeft","topRight","bottom","bottomLeft","bottomRight"],S={topLeft:"left",topRight:"right",bottomLeft:"left",bottomRight:"right",top:"left",bottom:"left"},O=(e,t)=>{let{componentCls:n}=e;return{["".concat(n,"-").concat(t)]:{["&".concat(n,"-stack > ").concat(n,"-notice-wrapper")]:{[t.startsWith("top")?"top":"bottom"]:0,[S[t]]:{value:0,_skip_check_:!0}}}}},k=e=>{let t={};for(let n=1;n ".concat(e.componentCls,"-notice")]:{opacity:0,transition:"opacity ".concat(e.motionDurationMid)}};return Object.assign({["&:not(:nth-last-child(-n+".concat(e.notificationStackLayer,"))")]:{opacity:0,overflow:"hidden",color:"transparent",pointerEvents:"none"}},t)},j=e=>{let t={};for(let n=1;n{let{componentCls:t}=e;return Object.assign({["".concat(t,"-stack")]:{["& > ".concat(t,"-notice-wrapper")]:Object.assign({transition:"transform ".concat(e.motionDurationSlow,", backdrop-filter 0s"),willChange:"transform, opacity",position:"absolute"},k(e))},["".concat(t,"-stack:not(").concat(t,"-stack-expanded)")]:{["& > ".concat(t,"-notice-wrapper")]:Object.assign({},j(e))},["".concat(t,"-stack").concat(t,"-stack-expanded")]:{["& > ".concat(t,"-notice-wrapper")]:{"&:not(:nth-last-child(-n + 1))":{opacity:1,overflow:"unset",color:"inherit",pointerEvents:"auto",["& > ".concat(e.componentCls,"-notice")]:{opacity:1}},"&:after":{content:'""',position:"absolute",height:e.margin,width:"100%",insetInline:0,bottom:e.calc(e.margin).mul(-1).equal(),background:"transparent",pointerEvents:"auto"}}}},Z.map(t=>O(e,t)).reduce((e,t)=>Object.assign(Object.assign({},e),t),{}))};let M=e=>{let{iconCls:t,componentCls:n,boxShadow:r,fontSizeLG:o,notificationMarginBottom:a,borderRadiusLG:i,colorSuccess:c,colorInfo:l,colorWarning:s,colorError:u,colorTextHeading:d,notificationBg:f,notificationPadding:p,notificationMarginEdge:m,notificationProgressBg:g,notificationProgressHeight:v,fontSize:h,lineHeight:y,width:w,notificationIconSize:E,colorText:C,colorSuccessBg:Z,colorErrorBg:S,colorInfoBg:O,colorWarningBg:k}=e,j="".concat(n,"-notice");return{position:"relative",marginBottom:a,marginInlineStart:"auto",background:f,borderRadius:i,boxShadow:r,[j]:{padding:p,width:w,maxWidth:"calc(100vw - ".concat((0,b.bf)(e.calc(m).mul(2).equal()),")"),lineHeight:y,wordWrap:"break-word",borderRadius:i,overflow:"hidden","&-success":{background:Z},"&-error":{background:S},"&-info":{background:O},"&-warning":{background:k}},["".concat(j,"-message")]:{color:d,fontSize:o,lineHeight:e.lineHeightLG},["".concat(j,"-description")]:{fontSize:h,color:C,marginTop:e.marginXS},["".concat(j,"-closable ").concat(j,"-message")]:{paddingInlineEnd:e.paddingLG},["".concat(j,"-with-icon ").concat(j,"-message")]:{marginInlineStart:e.calc(e.marginSM).add(E).equal(),fontSize:o},["".concat(j,"-with-icon ").concat(j,"-description")]:{marginInlineStart:e.calc(e.marginSM).add(E).equal(),fontSize:h},["".concat(j,"-icon")]:{position:"absolute",fontSize:E,lineHeight:1,["&-success".concat(t)]:{color:c},["&-info".concat(t)]:{color:l},["&-warning".concat(t)]:{color:s},["&-error".concat(t)]:{color:u}},["".concat(j,"-close")]:Object.assign({position:"absolute",top:e.notificationPaddingVertical,insetInlineEnd:e.notificationPaddingHorizontal,color:e.colorIcon,outline:"none",width:e.notificationCloseButtonSize,height:e.notificationCloseButtonSize,borderRadius:e.borderRadiusSM,transition:"background-color ".concat(e.motionDurationMid,", color ").concat(e.motionDurationMid),display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none","&:hover":{color:e.colorIconHover,backgroundColor:e.colorBgTextHover},"&:active":{backgroundColor:e.colorBgTextActive}},(0,x.Qy)(e)),["".concat(j,"-progress")]:{position:"absolute",display:"block",appearance:"none",inlineSize:"calc(100% - ".concat((0,b.bf)(i)," * 2)"),left:{_skip_check_:!0,value:i},right:{_skip_check_:!0,value:i},bottom:0,blockSize:v,border:0,"&, &::-webkit-progress-bar":{borderRadius:i,backgroundColor:"rgba(0, 0, 0, 0.04)"},"&::-moz-progress-bar":{background:g},"&::-webkit-progress-value":{borderRadius:i,background:g}},["".concat(j,"-actions")]:{float:"right",marginTop:e.marginSM}}},R=e=>{let{componentCls:t,notificationMarginBottom:n,notificationMarginEdge:r,motionDurationMid:o,motionEaseInOut:a}=e,i="".concat(t,"-notice"),c=new b.E4("antNotificationFadeOut",{"0%":{maxHeight:e.animationMaxHeight,marginBottom:n},"100%":{maxHeight:0,marginBottom:0,paddingTop:0,paddingBottom:0,opacity:0}});return[{[t]:Object.assign(Object.assign({},(0,x.Wf)(e)),{position:"fixed",zIndex:e.zIndexPopup,marginRight:{value:r,_skip_check_:!0},["".concat(t,"-hook-holder")]:{position:"relative"},["".concat(t,"-fade-appear-prepare")]:{opacity:"0 !important"},["".concat(t,"-fade-enter, ").concat(t,"-fade-appear")]:{animationDuration:e.motionDurationMid,animationTimingFunction:a,animationFillMode:"both",opacity:0,animationPlayState:"paused"},["".concat(t,"-fade-leave")]:{animationTimingFunction:a,animationFillMode:"both",animationDuration:o,animationPlayState:"paused"},["".concat(t,"-fade-enter").concat(t,"-fade-enter-active, ").concat(t,"-fade-appear").concat(t,"-fade-appear-active")]:{animationPlayState:"running"},["".concat(t,"-fade-leave").concat(t,"-fade-leave-active")]:{animationName:c,animationPlayState:"running"},"&-rtl":{direction:"rtl",["".concat(i,"-actions")]:{float:"left"}}})},{[t]:{["".concat(i,"-wrapper")]:M(e)}}]},N=e=>({zIndexPopup:e.zIndexPopupBase+y.u6+50,width:384,colorSuccessBg:e.colorSuccessBg,colorErrorBg:e.colorErrorBg,colorInfoBg:e.colorInfoBg,colorWarningBg:e.colorWarningBg}),P=e=>{let t=e.paddingMD,n=e.paddingLG;return(0,w.IX)(e,{notificationBg:e.colorBgElevated,notificationPaddingVertical:t,notificationPaddingHorizontal:n,notificationIconSize:e.calc(e.fontSizeLG).mul(e.lineHeightLG).equal(),notificationCloseButtonSize:e.calc(e.controlHeightLG).mul(.55).equal(),notificationMarginBottom:e.margin,notificationPadding:"".concat((0,b.bf)(e.paddingMD)," ").concat((0,b.bf)(e.paddingContentHorizontalLG)),notificationMarginEdge:e.marginLG,animationMaxHeight:150,notificationStackLayer:3,notificationProgressHeight:2,notificationProgressBg:"linear-gradient(90deg, ".concat(e.colorPrimaryBorderHover,", ").concat(e.colorPrimary,")")})};var F=(0,E.I$)("Notification",e=>{let t=P(e);return[R(t),C(t),I(t)]},N),T=(0,E.bk)(["Notification","PurePanel"],e=>{let t="".concat(e.componentCls,"-notice"),n=P(e);return{["".concat(t,"-pure-panel")]:Object.assign(Object.assign({},M(n)),{width:n.width,maxWidth:"calc(100vw - ".concat((0,b.bf)(e.calc(n.notificationMarginEdge).mul(2).equal()),")"),margin:0})}},N),A=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 _(e,t){return null===t||!1===t?null:t||r.createElement(u.Z,{className:"".concat(e,"-close-icon")})}f.Z,l.Z,s.Z,d.Z,p.Z;let B={success:l.Z,info:f.Z,error:s.Z,warning:d.Z},H=e=>{let{prefixCls:t,icon:n,type:o,message:a,description:i,actions:c,role:l="alert"}=e,s=null;return n?s=r.createElement("span",{className:"".concat(t,"-icon")},n):o&&(s=r.createElement(B[o]||null,{className:g()("".concat(t,"-icon"),"".concat(t,"-icon-").concat(o))})),r.createElement("div",{className:g()({["".concat(t,"-with-icon")]:s}),role:l},s,r.createElement("div",{className:"".concat(t,"-message")},a),i&&r.createElement("div",{className:"".concat(t,"-description")},i),c&&r.createElement("div",{className:"".concat(t,"-actions")},c))};var z=n(13613),L=n(84951),D=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 W=e=>{let{children:t,prefixCls:n}=e,o=(0,h.Z)(n),[a,i,c]=F(n,o);return a(r.createElement(v.JB,{classNames:{list:g()(i,c,o)}},t))},V=(e,t)=>{let{prefixCls:n,key:o}=t;return r.createElement(W,{prefixCls:n,key:o},e)},q=r.forwardRef((e,t)=>{let{top:n,bottom:o,prefixCls:i,getContainer:c,maxCount:l,rtl:s,onAllRemoved:u,stack:d,duration:f,pauseOnHover:p=!0,showProgress:m}=e,{getPrefixCls:h,getPopupContainer:b,notification:y,direction:x}=(0,r.useContext)(a.E_),[,w]=(0,L.ZP)(),E=i||h("notification"),[C,Z]=(0,v.lm)({prefixCls:E,style:e=>(function(e,t,n){let r;switch(e){case"top":r={left:"50%",transform:"translateX(-50%)",right:"auto",top:t,bottom:"auto"};break;case"topLeft":r={left:0,top:t,bottom:"auto"};break;case"topRight":r={right:0,top:t,bottom:"auto"};break;case"bottom":r={left:"50%",transform:"translateX(-50%)",right:"auto",top:"auto",bottom:n};break;case"bottomLeft":r={left:0,top:"auto",bottom:n};break;default:r={right:0,top:"auto",bottom:n}}return r})(e,null!=n?n:24,null!=o?o:24),className:()=>g()({["".concat(E,"-rtl")]:null!=s?s:"rtl"===x}),motion:()=>({motionName:"".concat(E,"-fade")}),closable:!0,closeIcon:_(E),duration:null!=f?f:4.5,getContainer:()=>(null==c?void 0:c())||(null==b?void 0:b())||document.body,maxCount:l,pauseOnHover:p,showProgress:m,onAllRemoved:u,renderNotifications:V,stack:!1!==d&&{threshold:"object"==typeof d?null==d?void 0:d.threshold:void 0,offset:8,gap:w.margin}});return r.useImperativeHandle(t,()=>Object.assign(Object.assign({},C),{prefixCls:E,notification:y})),Z});function X(e){let t=r.useRef(null);return(0,z.ln)("Notification"),[r.useMemo(()=>{let n=n=>{var o;if(!t.current)return;let{open:a,prefixCls:i,notification:c}=t.current,l="".concat(i,"-notice"),{message:s,description:u,icon:d,type:f,btn:p,actions:m,className:v,style:h,role:b="alert",closeIcon:y,closable:x}=n,w=D(n,["message","description","icon","type","btn","actions","className","style","role","closeIcon","closable"]),E=_(l,void 0!==y?y:void 0!==(null==e?void 0:e.closeIcon)?e.closeIcon:null==c?void 0:c.closeIcon);return a(Object.assign(Object.assign({placement:null!==(o=null==e?void 0:e.placement)&&void 0!==o?o:"topRight"},w),{content:r.createElement(H,{prefixCls:l,icon:d,type:f,message:s,description:u,actions:null!=m?m:p,role:b}),className:g()(f&&"".concat(l,"-").concat(f),v,null==c?void 0:c.className),style:Object.assign(Object.assign({},null==c?void 0:c.style),h),closeIcon:E,closable:null!=x?x:!!E}))},o={open:n,destroy:e=>{var n,r;void 0!==e?null===(n=t.current)||void 0===n||n.close(e):null===(r=t.current)||void 0===r||r.destroy()}};return["success","info","warning","error"].forEach(e=>{o[e]=t=>n(Object.assign(Object.assign({},t),{type:e}))}),o},[]),r.createElement(q,Object.assign({key:"notification-holder"},e,{ref:t}))]}let G=null,U=e=>e(),$=[],K={};function Y(){let{getContainer:e,rtl:t,maxCount:n,top:r,bottom:o,showProgress:a,pauseOnHover:i}=K,c=(null==e?void 0:e())||document.body;return{getContainer:()=>c,rtl:t,maxCount:n,top:r,bottom:o,showProgress:a,pauseOnHover:i}}let Q=r.forwardRef((e,t)=>{let{notificationConfig:n,sync:i}=e,{getPrefixCls:c}=(0,r.useContext)(a.E_),l=K.prefixCls||c("notification"),s=(0,r.useContext)(o.J),[u,d]=X(Object.assign(Object.assign(Object.assign({},n),{prefixCls:l}),s.notification));return r.useEffect(i,[]),r.useImperativeHandle(t,()=>{let e=Object.assign({},u);return Object.keys(e).forEach(t=>{e[t]=function(){for(var e=arguments.length,n=Array(e),r=0;r{let[n,o]=r.useState(Y),a=()=>{o(Y)};r.useEffect(a,[]);let c=(0,i.w6)(),l=c.getRootPrefixCls(),s=c.getIconPrefixCls(),u=c.getTheme(),d=r.createElement(Q,{ref:t,sync:a,notificationConfig:n});return r.createElement(i.ZP,{prefixCls:l,iconPrefixCls:s,theme:u},c.holderRender?c.holderRender(d):d)}),ee=()=>{if(!G){let e=document.createDocumentFragment(),t={fragment:e};G=t,U(()=>{(0,c.q)()(r.createElement(J,{ref:e=>{let{instance:n,sync:r}=e||{};Promise.resolve().then(()=>{!t.instance&&n&&(t.instance=n,t.sync=r,ee())})}}),e)});return}G.instance&&($.forEach(e=>{switch(e.type){case"open":U(()=>{G.instance.open(Object.assign(Object.assign({},K),e.config))});break;case"destroy":U(()=>{var t;null===(t=null==G?void 0:G.instance)||void 0===t||t.destroy(e.key)})}}),$=[])};function et(e){(0,i.w6)(),$.push({type:"open",config:e}),ee()}let en={open:et,destroy:e=>{$.push({type:"destroy",key:e}),ee()},config:function(e){K=Object.assign(Object.assign({},K),e),U(()=>{var e;null===(e=null==G?void 0:G.sync)||void 0===e||e.call(G)})},useNotification:function(e){return X(e)},_InternalPanelDoNotUseOrYouWillBeFired:e=>{let{prefixCls:t,className:n,icon:o,type:i,message:c,description:l,btn:s,actions:u,closable:d=!0,closeIcon:f,className:p}=e,m=A(e,["prefixCls","className","icon","type","message","description","btn","actions","closable","closeIcon","className"]),{getPrefixCls:b}=r.useContext(a.E_),y=t||b("notification"),x="".concat(y,"-notice"),w=(0,h.Z)(y),[E,C,Z]=F(y,w);return E(r.createElement("div",{className:g()("".concat(x,"-pure-panel"),C,n,Z,w)},r.createElement(T,{prefixCls:y}),r.createElement(v.qX,Object.assign({},m,{prefixCls:y,eventKey:"pure",duration:null,closable:d,className:g()({notificationClassName:p}),closeIcon:_(y,f),content:r.createElement(H,{prefixCls:x,icon:o,type:i,message:c,description:l,actions:null!=u?u:s})}))))}};["success","info","warning","error"].forEach(e=>{en[e]=t=>et(Object.assign(Object.assign({},t),{type:e}))});var er=en},37592:function(e,t,n){"use strict";n.d(t,{default:function(){return tf}});var r=n(2265),o=n(36760),a=n.n(o),i=n(1119),c=n(83145),l=n(11993),s=n(31686),u=n(26365),d=n(6989),f=n(41154),p=n(50506),m=n(32559),g=n(27380),v=n(79267),h=n(28791),b=function(e){var t=e.className,n=e.customizeIcon,o=e.customizeIconProps,i=e.children,c=e.onMouseDown,l=e.onClick,s="function"==typeof n?n(o):n;return r.createElement("span",{className:t,onMouseDown:function(e){e.preventDefault(),null==c||c(e)},style:{userSelect:"none",WebkitUserSelect:"none"},unselectable:"on",onClick:l,"aria-hidden":!0},void 0!==s?s:r.createElement("span",{className:a()(t.split(/\s+/).map(function(e){return"".concat(e,"-icon")}))},i))},y=function(e,t,n,o,a){var i=arguments.length>5&&void 0!==arguments[5]&&arguments[5],c=arguments.length>6?arguments[6]:void 0,l=arguments.length>7?arguments[7]:void 0,s=r.useMemo(function(){return"object"===(0,f.Z)(o)?o.clearIcon:a||void 0},[o,a]);return{allowClear:r.useMemo(function(){return!i&&!!o&&(!!n.length||!!c)&&!("combobox"===l&&""===c)},[o,i,n.length,c,l]),clearIcon:r.createElement(b,{className:"".concat(e,"-clear"),onMouseDown:t,customizeIcon:s},"\xd7")}},x=r.createContext(null);function w(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:250,t=r.useRef(null),n=r.useRef(null);return r.useEffect(function(){return function(){window.clearTimeout(n.current)}},[]),[function(){return t.current},function(r){(r||null===t.current)&&(t.current=r),window.clearTimeout(n.current),n.current=window.setTimeout(function(){t.current=null},e)}]}var E=n(95814),C=n(18242),Z=n(1699),S=function(e,t,n){var r=(0,s.Z)((0,s.Z)({},e),n?t:{});return Object.keys(t).forEach(function(n){var o=t[n];"function"==typeof o&&(r[n]=function(){for(var t,r=arguments.length,a=Array(r),i=0;ij&&(a="".concat(i.slice(0,j),"..."))}var c=function(t){t&&t.stopPropagation(),_(e)};return"function"==typeof T?eo(r,a,t,o,c):er(e,a,t,o,c)},renderRest:function(e){if(!c.length)return null;var t="function"==typeof F?F(e):F;return"function"==typeof T?eo(void 0,t,!1,!1,void 0,!0):er({title:t},t,!1)},suffix:ea,itemKey:N,maxCount:O});return r.createElement("span",{className:"".concat(ee,"-wrap")},ei,!c.length&&!et&&r.createElement("span",{className:"".concat(ee,"-placeholder")},m))},T=function(e){var t=e.inputElement,n=e.prefixCls,o=e.id,a=e.inputRef,i=e.disabled,c=e.autoFocus,l=e.autoComplete,s=e.activeDescendantId,d=e.mode,f=e.open,p=e.values,m=e.placeholder,g=e.tabIndex,v=e.showSearch,h=e.searchValue,b=e.activeValue,y=e.maxLength,x=e.onInputKeyDown,w=e.onInputMouseDown,E=e.onInputChange,Z=e.onInputPaste,S=e.onInputCompositionStart,O=e.onInputCompositionEnd,j=e.onInputBlur,I=e.title,M=r.useState(!1),N=(0,u.Z)(M,2),P=N[0],F=N[1],T="combobox"===d,A=T||v,_=p[0],B=h||"";T&&b&&!P&&(B=b),r.useEffect(function(){T&&F(!1)},[T,b]);var H=("combobox"===d||!!f||!!v)&&!!B,z=void 0===I?R(_):I,L=r.useMemo(function(){return _?null:r.createElement("span",{className:"".concat(n,"-selection-placeholder"),style:H?{visibility:"hidden"}:void 0},m)},[_,H,m,n]);return r.createElement("span",{className:"".concat(n,"-selection-wrap")},r.createElement("span",{className:"".concat(n,"-selection-search")},r.createElement(k,{ref:a,prefixCls:n,id:o,open:f,inputElement:t,disabled:i,autoFocus:c,autoComplete:l,editable:A,activeDescendantId:s,value:B,onKeyDown:x,onMouseDown:w,onChange:function(e){F(!0),E(e)},onPaste:Z,onCompositionStart:S,onCompositionEnd:O,onBlur:j,tabIndex:g,attrs:(0,C.Z)(e,!0),maxLength:T?y:void 0})),!T&&_?r.createElement("span",{className:"".concat(n,"-selection-item"),title:z,style:H?{visibility:"hidden"}:void 0},_.label):null,L)},A=r.forwardRef(function(e,t){var n=(0,r.useRef)(null),o=(0,r.useRef)(!1),a=e.prefixCls,c=e.open,l=e.mode,s=e.showSearch,d=e.tokenWithEnter,f=e.disabled,p=e.prefix,m=e.autoClearSearchValue,g=e.onSearch,v=e.onSearchSubmit,h=e.onToggleOpen,b=e.onInputKeyDown,y=e.onInputBlur,x=e.domRef;r.useImperativeHandle(t,function(){return{focus:function(e){n.current.focus(e)},blur:function(){n.current.blur()}}});var C=w(0),Z=(0,u.Z)(C,2),S=Z[0],O=Z[1],k=(0,r.useRef)(null),j=function(e){!1!==g(e,!0,o.current)&&h(!0)},I={inputRef:n,onInputKeyDown:function(e){var t=e.which,r=n.current instanceof HTMLTextAreaElement;!r&&c&&(t===E.Z.UP||t===E.Z.DOWN)&&e.preventDefault(),b&&b(e),t!==E.Z.ENTER||"tags"!==l||o.current||c||null==v||v(e.target.value),r&&!c&&~[E.Z.UP,E.Z.DOWN,E.Z.LEFT,E.Z.RIGHT].indexOf(t)||!t||[E.Z.ESC,E.Z.SHIFT,E.Z.BACKSPACE,E.Z.TAB,E.Z.WIN_KEY,E.Z.ALT,E.Z.META,E.Z.WIN_KEY_RIGHT,E.Z.CTRL,E.Z.SEMICOLON,E.Z.EQUALS,E.Z.CAPS_LOCK,E.Z.CONTEXT_MENU,E.Z.F1,E.Z.F2,E.Z.F3,E.Z.F4,E.Z.F5,E.Z.F6,E.Z.F7,E.Z.F8,E.Z.F9,E.Z.F10,E.Z.F11,E.Z.F12].includes(t)||h(!0)},onInputMouseDown:function(){O(!0)},onInputChange:function(e){var t=e.target.value;if(d&&k.current&&/[\r\n]/.test(k.current)){var n=k.current.replace(/[\r\n]+$/,"").replace(/\r\n/g," ").replace(/[\r\n]/g," ");t=t.replace(n,k.current)}k.current=null,j(t)},onInputPaste:function(e){var t=e.clipboardData,n=null==t?void 0:t.getData("text");k.current=n||""},onInputCompositionStart:function(){o.current=!0},onInputCompositionEnd:function(e){o.current=!1,"combobox"!==l&&j(e.target.value)},onInputBlur:y},M="multiple"===l||"tags"===l?r.createElement(F,(0,i.Z)({},e,I)):r.createElement(T,(0,i.Z)({},e,I));return r.createElement("div",{ref:x,className:"".concat(a,"-selector"),onClick:function(e){e.target!==n.current&&(void 0!==document.body.style.msTouchAction?setTimeout(function(){n.current.focus()}):n.current.focus())},onMouseDown:function(e){var t=S();e.target===n.current||t||"combobox"===l&&f||e.preventDefault(),("combobox"===l||s&&t)&&c||(c&&!1!==m&&g("",!0,!1),h())}},p&&r.createElement("div",{className:"".concat(a,"-prefix")},p),M)}),_=n(97821),B=["prefixCls","disabled","visible","children","popupElement","animation","transitionName","dropdownStyle","dropdownClassName","direction","placement","builtinPlacements","dropdownMatchSelectWidth","dropdownRender","dropdownAlign","getPopupContainer","empty","getTriggerDOMNode","onPopupVisibleChange","onPopupMouseEnter"],H=function(e){var t=!0===e?0:1;return{bottomLeft:{points:["tl","bl"],offset:[0,4],overflow:{adjustX:t,adjustY:1},htmlRegion:"scroll"},bottomRight:{points:["tr","br"],offset:[0,4],overflow:{adjustX:t,adjustY:1},htmlRegion:"scroll"},topLeft:{points:["bl","tl"],offset:[0,-4],overflow:{adjustX:t,adjustY:1},htmlRegion:"scroll"},topRight:{points:["br","tr"],offset:[0,-4],overflow:{adjustX:t,adjustY:1},htmlRegion:"scroll"}}},z=r.forwardRef(function(e,t){var n=e.prefixCls,o=(e.disabled,e.visible),c=e.children,u=e.popupElement,f=e.animation,p=e.transitionName,m=e.dropdownStyle,g=e.dropdownClassName,v=e.direction,h=e.placement,b=e.builtinPlacements,y=e.dropdownMatchSelectWidth,x=e.dropdownRender,w=e.dropdownAlign,E=e.getPopupContainer,C=e.empty,Z=e.getTriggerDOMNode,S=e.onPopupVisibleChange,O=e.onPopupMouseEnter,k=(0,d.Z)(e,B),j="".concat(n,"-dropdown"),I=u;x&&(I=x(u));var M=r.useMemo(function(){return b||H(y)},[b,y]),R=f?"".concat(j,"-").concat(f):p,N="number"==typeof y,P=r.useMemo(function(){return N?null:!1===y?"minWidth":"width"},[y,N]),F=m;N&&(F=(0,s.Z)((0,s.Z)({},F),{},{width:y}));var T=r.useRef(null);return r.useImperativeHandle(t,function(){return{getPopupElement:function(){var e;return null===(e=T.current)||void 0===e?void 0:e.popupElement}}}),r.createElement(_.Z,(0,i.Z)({},k,{showAction:S?["click"]:[],hideAction:S?["click"]:[],popupPlacement:h||("rtl"===(void 0===v?"ltr":v)?"bottomRight":"bottomLeft"),builtinPlacements:M,prefixCls:j,popupTransitionName:R,popup:r.createElement("div",{onMouseEnter:O},I),ref:T,stretch:P,popupAlign:w,popupVisible:o,getPopupContainer:E,popupClassName:a()(g,(0,l.Z)({},"".concat(j,"-empty"),C)),popupStyle:F,getTriggerDOMNode:Z,onPopupVisibleChange:S}),c)}),L=n(87099);function D(e,t){var n,r=e.key;return("value"in e&&(n=e.value),null!=r)?r:void 0!==n?n:"rc-index-key-".concat(t)}function W(e){return void 0!==e&&!Number.isNaN(e)}function V(e,t){var n=e||{},r=n.label,o=n.value,a=n.options,i=n.groupLabel,c=r||(t?"children":"label");return{label:c,value:o||"value",options:a||"options",groupLabel:i||c}}function q(e){var t=(0,s.Z)({},e);return"props"in t||Object.defineProperty(t,"props",{get:function(){return(0,m.ZP)(!1,"Return type is option instead of Option instance. Please read value directly instead of reading from `props`."),t}}),t}var X=function(e,t,n){if(!t||!t.length)return null;var r=!1,o=function e(t,n){var o=(0,L.Z)(n),a=o[0],i=o.slice(1);if(!a)return[t];var l=t.split(a);return r=r||l.length>1,l.reduce(function(t,n){return[].concat((0,c.Z)(t),(0,c.Z)(e(n,i)))},[]).filter(Boolean)}(e,t);return r?void 0!==n?o.slice(0,n):o:null},G=r.createContext(null);function U(e){var t=e.visible,n=e.values;return t?r.createElement("span",{"aria-live":"polite",style:{width:0,height:0,position:"absolute",overflow:"hidden",opacity:0}},"".concat(n.slice(0,50).map(function(e){var t=e.label,n=e.value;return["number","string"].includes((0,f.Z)(t))?t:n}).join(", ")),n.length>50?", ...":null):null}var $=["id","prefixCls","className","showSearch","tagRender","direction","omitDomProps","displayValues","onDisplayValuesChange","emptyOptions","notFoundContent","onClear","mode","disabled","loading","getInputElement","getRawInputElement","open","defaultOpen","onDropdownVisibleChange","activeValue","onActiveValueChange","activeDescendantId","searchValue","autoClearSearchValue","onSearch","onSearchSplit","tokenSeparators","allowClear","prefix","suffixIcon","clearIcon","OptionList","animation","transitionName","dropdownStyle","dropdownClassName","dropdownMatchSelectWidth","dropdownRender","dropdownAlign","placement","builtinPlacements","getPopupContainer","showAction","onFocus","onBlur","onKeyUp","onKeyDown","onMouseDown"],K=["value","onChange","removeIcon","placeholder","autoFocus","maxTagCount","maxTagTextLength","maxTagPlaceholder","choiceTransitionName","onInputKeyDown","onPopupScroll","tabIndex"],Y=function(e){return"tags"===e||"multiple"===e},Q=r.forwardRef(function(e,t){var n,o,f,m,E,C,Z,S=e.id,O=e.prefixCls,k=e.className,j=e.showSearch,I=e.tagRender,M=e.direction,R=e.omitDomProps,N=e.displayValues,P=e.onDisplayValuesChange,F=e.emptyOptions,T=e.notFoundContent,_=void 0===T?"Not Found":T,B=e.onClear,H=e.mode,L=e.disabled,D=e.loading,V=e.getInputElement,q=e.getRawInputElement,Q=e.open,J=e.defaultOpen,ee=e.onDropdownVisibleChange,et=e.activeValue,en=e.onActiveValueChange,er=e.activeDescendantId,eo=e.searchValue,ea=e.autoClearSearchValue,ei=e.onSearch,ec=e.onSearchSplit,el=e.tokenSeparators,es=e.allowClear,eu=e.prefix,ed=e.suffixIcon,ef=e.clearIcon,ep=e.OptionList,em=e.animation,eg=e.transitionName,ev=e.dropdownStyle,eh=e.dropdownClassName,eb=e.dropdownMatchSelectWidth,ey=e.dropdownRender,ex=e.dropdownAlign,ew=e.placement,eE=e.builtinPlacements,eC=e.getPopupContainer,eZ=e.showAction,eS=void 0===eZ?[]:eZ,eO=e.onFocus,ek=e.onBlur,ej=e.onKeyUp,eI=e.onKeyDown,eM=e.onMouseDown,eR=(0,d.Z)(e,$),eN=Y(H),eP=(void 0!==j?j:eN)||"combobox"===H,eF=(0,s.Z)({},eR);K.forEach(function(e){delete eF[e]}),null==R||R.forEach(function(e){delete eF[e]});var eT=r.useState(!1),eA=(0,u.Z)(eT,2),e_=eA[0],eB=eA[1];r.useEffect(function(){eB((0,v.Z)())},[]);var eH=r.useRef(null),ez=r.useRef(null),eL=r.useRef(null),eD=r.useRef(null),eW=r.useRef(null),eV=r.useRef(!1),eq=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,t=r.useState(!1),n=(0,u.Z)(t,2),o=n[0],a=n[1],i=r.useRef(null),c=function(){window.clearTimeout(i.current)};return r.useEffect(function(){return c},[]),[o,function(t,n){c(),i.current=window.setTimeout(function(){a(t),n&&n()},e)},c]}(),eX=(0,u.Z)(eq,3),eG=eX[0],eU=eX[1],e$=eX[2];r.useImperativeHandle(t,function(){var e,t;return{focus:null===(e=eD.current)||void 0===e?void 0:e.focus,blur:null===(t=eD.current)||void 0===t?void 0:t.blur,scrollTo:function(e){var t;return null===(t=eW.current)||void 0===t?void 0:t.scrollTo(e)},nativeElement:eH.current||ez.current}});var eK=r.useMemo(function(){if("combobox"!==H)return eo;var e,t=null===(e=N[0])||void 0===e?void 0:e.value;return"string"==typeof t||"number"==typeof t?String(t):""},[eo,H,N]),eY="combobox"===H&&"function"==typeof V&&V()||null,eQ="function"==typeof q&&q(),eJ=(0,h.x1)(ez,null==eQ||null===(m=eQ.props)||void 0===m?void 0:m.ref),e0=r.useState(!1),e1=(0,u.Z)(e0,2),e2=e1[0],e6=e1[1];(0,g.Z)(function(){e6(!0)},[]);var e5=(0,p.Z)(!1,{defaultValue:J,value:Q}),e4=(0,u.Z)(e5,2),e3=e4[0],e7=e4[1],e9=!!e2&&e3,e8=!_&&F;(L||e8&&e9&&"combobox"===H)&&(e9=!1);var te=!e8&&e9,tt=r.useCallback(function(e){var t=void 0!==e?e:!e9;L||(e7(t),e9!==t&&(null==ee||ee(t)))},[L,e9,e7,ee]),tn=r.useMemo(function(){return(el||[]).some(function(e){return["\n","\r\n"].includes(e)})},[el]),tr=r.useContext(G)||{},to=tr.maxCount,ta=tr.rawValues,ti=function(e,t,n){if(!(eN&&W(to))||!((null==ta?void 0:ta.size)>=to)){var r=!0,o=e;null==en||en(null);var a=X(e,el,W(to)?to-ta.size:void 0),i=n?null:a;return"combobox"!==H&&i&&(o="",null==ec||ec(i),tt(!1),r=!1),ei&&eK!==o&&ei(o,{source:t?"typing":"effect"}),r}};r.useEffect(function(){e9||eN||"combobox"===H||ti("",!1,!1)},[e9]),r.useEffect(function(){e3&&L&&e7(!1),L&&!eV.current&&eU(!1)},[L]);var tc=w(),tl=(0,u.Z)(tc,2),ts=tl[0],tu=tl[1],td=r.useRef(!1),tf=r.useRef(!1),tp=[];r.useEffect(function(){return function(){tp.forEach(function(e){return clearTimeout(e)}),tp.splice(0,tp.length)}},[]);var tm=r.useState({}),tg=(0,u.Z)(tm,2)[1];eQ&&(E=function(e){tt(e)}),n=function(){var e;return[eH.current,null===(e=eL.current)||void 0===e?void 0:e.getPopupElement()]},o=!!eQ,(f=r.useRef(null)).current={open:te,triggerOpen:tt,customizedTrigger:o},r.useEffect(function(){function e(e){if(null===(t=f.current)||void 0===t||!t.customizedTrigger){var t,r=e.target;r.shadowRoot&&e.composed&&(r=e.composedPath()[0]||r),f.current.open&&n().filter(function(e){return e}).every(function(e){return!e.contains(r)&&e!==r})&&f.current.triggerOpen(!1)}}return window.addEventListener("mousedown",e),function(){return window.removeEventListener("mousedown",e)}},[]);var tv=r.useMemo(function(){return(0,s.Z)((0,s.Z)({},e),{},{notFoundContent:_,open:e9,triggerOpen:te,id:S,showSearch:eP,multiple:eN,toggleOpen:tt})},[e,_,te,e9,S,eP,eN,tt]),th=!!ed||D;th&&(C=r.createElement(b,{className:a()("".concat(O,"-arrow"),(0,l.Z)({},"".concat(O,"-arrow-loading"),D)),customizeIcon:ed,customizeIconProps:{loading:D,searchValue:eK,open:e9,focused:eG,showSearch:eP}}));var tb=y(O,function(){var e;null==B||B(),null===(e=eD.current)||void 0===e||e.focus(),P([],{type:"clear",values:N}),ti("",!1,!1)},N,es,ef,L,eK,H),ty=tb.allowClear,tx=tb.clearIcon,tw=r.createElement(ep,{ref:eW}),tE=a()(O,k,(0,l.Z)((0,l.Z)((0,l.Z)((0,l.Z)((0,l.Z)((0,l.Z)((0,l.Z)((0,l.Z)((0,l.Z)((0,l.Z)({},"".concat(O,"-focused"),eG),"".concat(O,"-multiple"),eN),"".concat(O,"-single"),!eN),"".concat(O,"-allow-clear"),es),"".concat(O,"-show-arrow"),th),"".concat(O,"-disabled"),L),"".concat(O,"-loading"),D),"".concat(O,"-open"),e9),"".concat(O,"-customize-input"),eY),"".concat(O,"-show-search"),eP)),tC=r.createElement(z,{ref:eL,disabled:L,prefixCls:O,visible:te,popupElement:tw,animation:em,transitionName:eg,dropdownStyle:ev,dropdownClassName:eh,direction:M,dropdownMatchSelectWidth:eb,dropdownRender:ey,dropdownAlign:ex,placement:ew,builtinPlacements:eE,getPopupContainer:eC,empty:F,getTriggerDOMNode:function(e){return ez.current||e},onPopupVisibleChange:E,onPopupMouseEnter:function(){tg({})}},eQ?r.cloneElement(eQ,{ref:eJ}):r.createElement(A,(0,i.Z)({},e,{domRef:ez,prefixCls:O,inputElement:eY,ref:eD,id:S,prefix:eu,showSearch:eP,autoClearSearchValue:ea,mode:H,activeDescendantId:er,tagRender:I,values:N,open:e9,onToggleOpen:tt,activeValue:et,searchValue:eK,onSearch:ti,onSearchSubmit:function(e){e&&e.trim()&&ei(e,{source:"submit"})},onRemove:function(e){P(N.filter(function(t){return t!==e}),{type:"remove",values:[e]})},tokenWithEnter:tn,onInputBlur:function(){td.current=!1}})));return Z=eQ?tC:r.createElement("div",(0,i.Z)({className:tE},eF,{ref:eH,onMouseDown:function(e){var t,n=e.target,r=null===(t=eL.current)||void 0===t?void 0:t.getPopupElement();if(r&&r.contains(n)){var o=setTimeout(function(){var e,t=tp.indexOf(o);-1!==t&&tp.splice(t,1),e$(),e_||r.contains(document.activeElement)||null===(e=eD.current)||void 0===e||e.focus()});tp.push(o)}for(var a=arguments.length,i=Array(a>1?a-1:0),c=1;c=0;l-=1){var s=a[l];if(!s.disabled){a.splice(l,1),i=s;break}}i&&P(a,{type:"remove",values:[i]})}for(var u=arguments.length,d=Array(u>1?u-1:0),f=1;f1?n-1:0),o=1;o=Z},[p,Z,null==M?void 0:M.size]),L=function(e){e.preventDefault()},D=function(e){var t;null===(t=H.current)||void 0===t||t.scrollTo("number"==typeof e?{index:e}:e)},V=r.useCallback(function(e){return"combobox"!==m&&M.has(e)},[m,(0,c.Z)(M).toString(),M.size]),q=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=B.length,r=0;r1&&void 0!==arguments[1]&&arguments[1];K(e);var n={source:t?"keyboard":"mouse"},r=B[e];if(!r){O(null,-1,n);return}O(r.value,e,n)};(0,r.useEffect)(function(){Y(!1!==k?q(0):-1)},[B.length,g]);var Q=r.useCallback(function(e){return"combobox"===m?String(e).toLowerCase()===g.toLowerCase():M.has(e)},[m,g,(0,c.Z)(M).toString(),M.size]);(0,r.useEffect)(function(){var e,t=setTimeout(function(){if(!p&&f&&1===M.size){var e=Array.from(M)[0],t=B.findIndex(function(t){var n=t.data;return g?String(n.value).startsWith(g):n.value===e});-1!==t&&(Y(t),D(t))}});return f&&(null===(e=H.current)||void 0===e||e.scrollTo(void 0)),function(){return clearTimeout(t)}},[f,g]);var J=function(e){void 0!==e&&j(e,{selected:!M.has(e)}),p||v(!1)};if(r.useImperativeHandle(t,function(){return{onKeyDown:function(e){var t=e.which,n=e.ctrlKey;switch(t){case E.Z.N:case E.Z.P:case E.Z.UP:case E.Z.DOWN:var r=0;if(t===E.Z.UP?r=-1:t===E.Z.DOWN?r=1:/(mac\sos|macintosh)/i.test(navigator.appVersion)&&n&&(t===E.Z.N?r=1:t===E.Z.P&&(r=-1)),0!==r){var o=q($+r,r);D(o),Y(o,!0)}break;case E.Z.TAB:case E.Z.ENTER:var a,i=B[$];!i||null!=i&&null!==(a=i.data)&&void 0!==a&&a.disabled||z?J(void 0):J(i.value),f&&e.preventDefault();break;case E.Z.ESC:v(!1),f&&e.stopPropagation()}},onKeyUp:function(){},scrollTo:function(e){D(e)}}}),0===B.length)return r.createElement("div",{role:"listbox",id:"".concat(s,"_list"),className:"".concat(_,"-empty"),onMouseDown:L},h);var ee=Object.keys(R).map(function(e){return R[e]}),ei=function(e){return e.label};function ec(e,t){return{role:e.group?"presentation":"option",id:"".concat(s,"_list_").concat(t)}}var el=function(e){var t=B[e];if(!t)return null;var n=t.data||{},o=n.value,a=t.group,c=(0,C.Z)(n,!0),l=ei(t);return t?r.createElement("div",(0,i.Z)({"aria-label":"string"!=typeof l||a?null:l},c,{key:e},ec(t,e),{"aria-selected":Q(o)}),o):null},es={role:"listbox",id:"".concat(s,"_list")};return r.createElement(r.Fragment,null,N&&r.createElement("div",(0,i.Z)({},es,{style:{height:0,width:0,overflow:"hidden"}}),el($-1),el($),el($+1)),r.createElement(er.Z,{itemKey:"key",ref:H,data:B,height:F,itemHeight:T,fullHeight:!1,onMouseDown:L,onScroll:y,virtual:N,direction:P,innerProps:N?null:es},function(e,t){var n=e.group,o=e.groupOption,c=e.data,s=e.label,u=e.value,f=c.key;if(n){var p,m=null!==(p=c.title)&&void 0!==p?p:ea(s)?s.toString():void 0;return r.createElement("div",{className:a()(_,"".concat(_,"-group"),c.className),title:m},void 0!==s?s:f)}var g=c.disabled,v=c.title,h=(c.children,c.style),y=c.className,x=(0,d.Z)(c,eo),w=(0,en.Z)(x,ee),E=V(u),Z=g||!E&&z,S="".concat(_,"-option"),O=a()(_,S,y,(0,l.Z)((0,l.Z)((0,l.Z)((0,l.Z)({},"".concat(S,"-grouped"),o),"".concat(S,"-active"),$===t&&!Z),"".concat(S,"-disabled"),Z),"".concat(S,"-selected"),E)),k=ei(e),j=!I||"function"==typeof I||E,M="number"==typeof k?k:k||u,R=ea(M)?M.toString():void 0;return void 0!==v&&(R=v),r.createElement("div",(0,i.Z)({},(0,C.Z)(w),N?{}:ec(e,t),{"aria-selected":Q(u),className:O,title:R,onMouseMove:function(){$===t||Z||Y(t)},onClick:function(){Z||J(u)},style:h}),r.createElement("div",{className:"".concat(S,"-content")},"function"==typeof A?A(e,{index:t}):M),r.isValidElement(I)||E,j&&r.createElement(b,{className:"".concat(_,"-option-state"),customizeIcon:I,customizeIconProps:{value:u,disabled:Z,isSelected:E}},E?"✓":null))}))}),ec=function(e,t){var n=r.useRef({values:new Map,options:new Map});return[r.useMemo(function(){var r=n.current,o=r.values,a=r.options,i=e.map(function(e){if(void 0===e.label){var t;return(0,s.Z)((0,s.Z)({},e),{},{label:null===(t=o.get(e.value))||void 0===t?void 0:t.label})}return e}),c=new Map,l=new Map;return i.forEach(function(e){c.set(e.value,e),l.set(e.value,t.get(e.value)||a.get(e.value))}),n.current.values=c,n.current.options=l,i},[e,t]),r.useCallback(function(e){return t.get(e)||n.current.options.get(e)},[t])]};function el(e,t){return j(e).join("").toUpperCase().includes(t)}var es=n(94981),eu=0,ed=(0,es.Z)(),ef=n(45287),ep=["children","value"],em=["children"];function eg(e){var t=r.useRef();return t.current=e,r.useCallback(function(){return t.current.apply(t,arguments)},[])}var ev=["id","mode","prefixCls","backfill","fieldNames","inputValue","searchValue","onSearch","autoClearSearchValue","onSelect","onDeselect","dropdownMatchSelectWidth","filterOption","filterSort","optionFilterProp","optionLabelProp","options","optionRender","children","defaultActiveFirstOption","menuItemSelectedIcon","virtual","direction","listHeight","listItemHeight","labelRender","value","defaultValue","labelInValue","onChange","maxCount"],eh=["inputValue"],eb=r.forwardRef(function(e,t){var n,o,a,m,g,v=e.id,h=e.mode,b=e.prefixCls,y=e.backfill,x=e.fieldNames,w=e.inputValue,E=e.searchValue,C=e.onSearch,Z=e.autoClearSearchValue,S=void 0===Z||Z,O=e.onSelect,k=e.onDeselect,I=e.dropdownMatchSelectWidth,M=void 0===I||I,R=e.filterOption,N=e.filterSort,P=e.optionFilterProp,F=e.optionLabelProp,T=e.options,A=e.optionRender,_=e.children,B=e.defaultActiveFirstOption,H=e.menuItemSelectedIcon,z=e.virtual,L=e.direction,W=e.listHeight,X=void 0===W?200:W,U=e.listItemHeight,$=void 0===U?20:U,K=e.labelRender,J=e.value,ee=e.defaultValue,et=e.labelInValue,en=e.onChange,er=e.maxCount,eo=(0,d.Z)(e,ev),ea=(n=r.useState(),a=(o=(0,u.Z)(n,2))[0],m=o[1],r.useEffect(function(){var e;m("rc_select_".concat((ed?(e=eu,eu+=1):e="TEST_OR_SSR",e)))},[]),v||a),es=Y(h),eb=!!(!T&&_),ey=r.useMemo(function(){return(void 0!==R||"combobox"!==h)&&R},[R,h]),ex=r.useMemo(function(){return V(x,eb)},[JSON.stringify(x),eb]),ew=(0,p.Z)("",{value:void 0!==E?E:w,postState:function(e){return e||""}}),eE=(0,u.Z)(ew,2),eC=eE[0],eZ=eE[1],eS=r.useMemo(function(){var e=T;T||(e=function e(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return(0,ef.Z)(t).map(function(t,o){if(!r.isValidElement(t)||!t.type)return null;var a,i,c,l,u,f=t.type.isSelectOptGroup,p=t.key,m=t.props,g=m.children,v=(0,d.Z)(m,em);return n||!f?(a=t.key,c=(i=t.props).children,l=i.value,u=(0,d.Z)(i,ep),(0,s.Z)({key:a,value:void 0!==l?l:a,children:c},u)):(0,s.Z)((0,s.Z)({key:"__RC_SELECT_GRP__".concat(null===p?o:p,"__"),label:p},v),{},{options:e(g)})}).filter(function(e){return e})}(_));var t=new Map,n=new Map,o=function(e,t,n){n&&"string"==typeof n&&e.set(t[n],t)};return function e(r){for(var a=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=0;i0?e(t.options):t.options}):t})}(eD):eD},[eD,N,eC]),eV=r.useMemo(function(){return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.fieldNames,r=t.childrenAsData,o=[],a=V(n,!1),i=a.label,c=a.value,l=a.options,s=a.groupLabel;return!function e(t,n){Array.isArray(t)&&t.forEach(function(t){if(!n&&l in t){var a=t[s];void 0===a&&r&&(a=t.label),o.push({key:D(t,o.length),group:!0,data:t,label:a}),e(t[l],!0)}else{var u=t[c];o.push({key:D(t,o.length),groupOption:n,data:t,label:t[i],value:u})}})}(e,!1),o}(eW,{fieldNames:ex,childrenAsData:eb})},[eW,ex,eb]),eq=function(e){var t=eI(e);if(eP(t),en&&(t.length!==eA.length||t.some(function(e,t){var n;return(null===(n=eA[t])||void 0===n?void 0:n.value)!==(null==e?void 0:e.value)}))){var n=et?t:t.map(function(e){return e.value}),r=t.map(function(e){return q(e_(e.value))});en(es?n:n[0],es?r:r[0])}},eX=r.useState(null),eG=(0,u.Z)(eX,2),eU=eG[0],e$=eG[1],eK=r.useState(0),eY=(0,u.Z)(eK,2),eQ=eY[0],eJ=eY[1],e0=void 0!==B?B:"combobox"!==h,e1=r.useCallback(function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.source;eJ(t),y&&"combobox"===h&&null!==e&&"keyboard"===(void 0===r?"keyboard":r)&&e$(String(e))},[y,h]),e2=function(e,t,n){var r=function(){var t,n=e_(e);return[et?{label:null==n?void 0:n[ex.label],value:e,key:null!==(t=null==n?void 0:n.key)&&void 0!==t?t:e}:e,q(n)]};if(t&&O){var o=r(),a=(0,u.Z)(o,2);O(a[0],a[1])}else if(!t&&k&&"clear"!==n){var i=r(),c=(0,u.Z)(i,2);k(c[0],c[1])}},e6=eg(function(e,t){var n=!es||t.selected;eq(n?es?[].concat((0,c.Z)(eA),[e]):[e]:eA.filter(function(t){return t.value!==e})),e2(e,n),"combobox"===h?e$(""):(!Y||S)&&(eZ(""),e$(""))}),e5=r.useMemo(function(){var e=!1!==z&&!1!==M;return(0,s.Z)((0,s.Z)({},eS),{},{flattenOptions:eV,onActiveValue:e1,defaultActiveFirstOption:e0,onSelect:e6,menuItemSelectedIcon:H,rawValues:eH,fieldNames:ex,virtual:e,direction:L,listHeight:X,listItemHeight:$,childrenAsData:eb,maxCount:er,optionRender:A})},[er,eS,eV,e1,e0,e6,H,eH,ex,z,M,L,X,$,eb,A]);return r.createElement(G.Provider,{value:e5},r.createElement(Q,(0,i.Z)({},eo,{id:ea,prefixCls:void 0===b?"rc-select":b,ref:t,omitDomProps:eh,mode:h,displayValues:eB,onDisplayValuesChange:function(e,t){eq(e);var n=t.type,r=t.values;("remove"===n||"clear"===n)&&r.forEach(function(e){e2(e.value,!1,n)})},direction:L,searchValue:eC,onSearch:function(e,t){if(eZ(e),e$(null),"submit"===t.source){var n=(e||"").trim();n&&(eq(Array.from(new Set([].concat((0,c.Z)(eH),[n])))),e2(n,!0),eZ(""));return}"blur"!==t.source&&("combobox"===h&&eq(e),null==C||C(e))},autoClearSearchValue:S,onSearchSplit:function(e){var t=e;"tags"!==h&&(t=e.map(function(e){var t=ek.get(e);return null==t?void 0:t.value}).filter(function(e){return void 0!==e}));var n=Array.from(new Set([].concat((0,c.Z)(eH),(0,c.Z)(t))));eq(n),n.forEach(function(e){e2(e,!0)})},dropdownMatchSelectWidth:M,OptionList:ei,emptyOptions:!eV.length,activeValue:eU,activeDescendantId:"".concat(ea,"_list_").concat(eQ)})))});eb.Option=ee,eb.OptGroup=J;var ey=n(62236),ex=n(68710),ew=n(93942),eE=n(12757),eC=n(71744),eZ=n(91086),eS=n(86586),eO=n(64024),ek=n(33759),ej=n(39109),eI=n(56250),eM=n(77685),eR=n(84951);let eN=e=>{let t={overflow:{adjustX:!0,adjustY:!0,shiftY:!0},htmlRegion:"scroll"===e?"scroll":"visible",dynamicInset:!0};return{bottomLeft:Object.assign(Object.assign({},t),{points:["tl","bl"],offset:[0,4]}),bottomRight:Object.assign(Object.assign({},t),{points:["tr","br"],offset:[0,4]}),topLeft:Object.assign(Object.assign({},t),{points:["bl","tl"],offset:[0,-4]}),topRight:Object.assign(Object.assign({},t),{points:["br","tr"],offset:[0,-4]})}};var eP=n(12918),eF=n(17691),eT=n(99320),eA=n(71140),e_=n(18544),eB=n(29382);let eH=e=>{let{optionHeight:t,optionFontSize:n,optionLineHeight:r,optionPadding:o}=e;return{position:"relative",display:"block",minHeight:t,padding:o,color:e.colorText,fontWeight:"normal",fontSize:n,lineHeight:r,boxSizing:"border-box"}};var ez=e=>{let{antCls:t,componentCls:n}=e,r="".concat(n,"-item"),o="&".concat(t,"-slide-up-enter").concat(t,"-slide-up-enter-active"),a="&".concat(t,"-slide-up-appear").concat(t,"-slide-up-appear-active"),i="&".concat(t,"-slide-up-leave").concat(t,"-slide-up-leave-active"),c="".concat(n,"-dropdown-placement-"),l="".concat(r,"-option-selected");return[{["".concat(n,"-dropdown")]:Object.assign(Object.assign({},(0,eP.Wf)(e)),{position:"absolute",top:-9999,zIndex:e.zIndexPopup,boxSizing:"border-box",padding:e.paddingXXS,overflow:"hidden",fontSize:e.fontSize,fontVariant:"initial",backgroundColor:e.colorBgElevated,borderRadius:e.borderRadiusLG,outline:"none",boxShadow:e.boxShadowSecondary,["\n ".concat(o).concat(c,"bottomLeft,\n ").concat(a).concat(c,"bottomLeft\n ")]:{animationName:e_.fJ},["\n ".concat(o).concat(c,"topLeft,\n ").concat(a).concat(c,"topLeft,\n ").concat(o).concat(c,"topRight,\n ").concat(a).concat(c,"topRight\n ")]:{animationName:e_.Qt},["".concat(i).concat(c,"bottomLeft")]:{animationName:e_.Uw},["\n ".concat(i).concat(c,"topLeft,\n ").concat(i).concat(c,"topRight\n ")]:{animationName:e_.ly},"&-hidden":{display:"none"},[r]:Object.assign(Object.assign({},eH(e)),{cursor:"pointer",transition:"background ".concat(e.motionDurationSlow," ease"),borderRadius:e.borderRadiusSM,"&-group":{color:e.colorTextDescription,fontSize:e.fontSizeSM,cursor:"default"},"&-option":{display:"flex","&-content":Object.assign({flex:"auto"},eP.vS),"&-state":{flex:"none",display:"flex",alignItems:"center"},["&-active:not(".concat(r,"-option-disabled)")]:{backgroundColor:e.optionActiveBg},["&-selected:not(".concat(r,"-option-disabled)")]:{color:e.optionSelectedColor,fontWeight:e.optionSelectedFontWeight,backgroundColor:e.optionSelectedBg,["".concat(r,"-option-state")]:{color:e.colorPrimary}},"&-disabled":{["&".concat(r,"-option-selected")]:{backgroundColor:e.colorBgContainerDisabled},color:e.colorTextDisabled,cursor:"not-allowed"},"&-grouped":{paddingInlineStart:e.calc(e.controlPaddingHorizontal).mul(2).equal()}},"&-empty":Object.assign(Object.assign({},eH(e)),{color:e.colorTextDisabled})}),["".concat(l,":has(+ ").concat(l,")")]:{borderEndStartRadius:0,borderEndEndRadius:0,["& + ".concat(l)]:{borderStartStartRadius:0,borderStartEndRadius:0}},"&-rtl":{direction:"rtl"}})},(0,e_.oN)(e,"slide-up"),(0,e_.oN)(e,"slide-down"),(0,eB.Fm)(e,"move-up"),(0,eB.Fm)(e,"move-down")]},eL=n(93463);let eD=e=>{let{multipleSelectItemHeight:t,paddingXXS:n,lineWidth:r,INTERNAL_FIXED_ITEM_MARGIN:o}=e,a=e.max(e.calc(n).sub(r).equal(),0),i=e.max(e.calc(a).sub(o).equal(),0);return{basePadding:a,containerPadding:i,itemHeight:(0,eL.bf)(t),itemLineHeight:(0,eL.bf)(e.calc(t).sub(e.calc(e.lineWidth).mul(2)).equal())}},eW=e=>{let{multipleSelectItemHeight:t,selectHeight:n,lineWidth:r}=e;return e.calc(n).sub(t).div(2).sub(r).equal()},eV=e=>{let{componentCls:t,iconCls:n,borderRadiusSM:r,motionDurationSlow:o,paddingXS:a,multipleItemColorDisabled:i,multipleItemBorderColorDisabled:c,colorIcon:l,colorIconHover:s,INTERNAL_FIXED_ITEM_MARGIN:u}=e;return{["".concat(t,"-selection-overflow")]:{position:"relative",display:"flex",flex:"auto",flexWrap:"wrap",maxWidth:"100%","&-item":{flex:"none",alignSelf:"center",maxWidth:"calc(100% - 4px)",display:"inline-flex"},["".concat(t,"-selection-item")]:{display:"flex",alignSelf:"center",flex:"none",boxSizing:"border-box",maxWidth:"100%",marginBlock:u,borderRadius:r,cursor:"default",transition:"font-size ".concat(o,", line-height ").concat(o,", height ").concat(o),marginInlineEnd:e.calc(u).mul(2).equal(),paddingInlineStart:a,paddingInlineEnd:e.calc(a).div(2).equal(),["".concat(t,"-disabled&")]:{color:i,borderColor:c,cursor:"not-allowed"},"&-content":{display:"inline-block",marginInlineEnd:e.calc(a).div(2).equal(),overflow:"hidden",whiteSpace:"pre",textOverflow:"ellipsis"},"&-remove":Object.assign(Object.assign({},(0,eP.Ro)()),{display:"inline-flex",alignItems:"center",color:l,fontWeight:"bold",fontSize:10,lineHeight:"inherit",cursor:"pointer",["> ".concat(n)]:{verticalAlign:"-0.2em"},"&:hover":{color:s}})}}}},eq=(e,t)=>{let{componentCls:n,INTERNAL_FIXED_ITEM_MARGIN:r}=e,o="".concat(n,"-selection-overflow"),a=e.multipleSelectItemHeight,i=eW(e),c=t?"".concat(n,"-").concat(t):"",l=eD(e);return{["".concat(n,"-multiple").concat(c)]:Object.assign(Object.assign({},eV(e)),{["".concat(n,"-selector")]:{display:"flex",alignItems:"center",width:"100%",height:"100%",paddingInline:l.basePadding,paddingBlock:l.containerPadding,borderRadius:e.borderRadius,["".concat(n,"-disabled&")]:{background:e.multipleSelectorBgDisabled,cursor:"not-allowed"},"&:after":{display:"inline-block",width:0,margin:"".concat((0,eL.bf)(r)," 0"),lineHeight:(0,eL.bf)(a),visibility:"hidden",content:'"\\a0"'}},["".concat(n,"-selection-item")]:{height:l.itemHeight,lineHeight:(0,eL.bf)(l.itemLineHeight)},["".concat(n,"-selection-wrap")]:{alignSelf:"flex-start","&:after":{lineHeight:(0,eL.bf)(a),marginBlock:r}},["".concat(n,"-prefix")]:{marginInlineStart:e.calc(e.inputPaddingHorizontalBase).sub(l.basePadding).equal()},["".concat(o,"-item + ").concat(o,"-item,\n ").concat(n,"-prefix + ").concat(n,"-selection-wrap\n ")]:{["".concat(n,"-selection-search")]:{marginInlineStart:0},["".concat(n,"-selection-placeholder")]:{insetInlineStart:0}},["".concat(o,"-item-suffix")]:{minHeight:l.itemHeight,marginBlock:r},["".concat(n,"-selection-search")]:{display:"inline-flex",position:"relative",maxWidth:"100%",marginInlineStart:e.calc(e.inputPaddingHorizontalBase).sub(i).equal(),"\n &-input,\n &-mirror\n ":{height:a,fontFamily:e.fontFamily,lineHeight:(0,eL.bf)(a),transition:"all ".concat(e.motionDurationSlow)},"&-input":{width:"100%",minWidth:4.1},"&-mirror":{position:"absolute",top:0,insetInlineStart:0,insetInlineEnd:"auto",zIndex:999,whiteSpace:"pre",visibility:"hidden"}},["".concat(n,"-selection-placeholder")]:{position:"absolute",top:"50%",insetInlineStart:e.calc(e.inputPaddingHorizontalBase).sub(l.basePadding).equal(),insetInlineEnd:e.inputPaddingHorizontalBase,transform:"translateY(-50%)",transition:"all ".concat(e.motionDurationSlow)}})}};function eX(e,t){let{componentCls:n}=e,r=t?"".concat(n,"-").concat(t):"",o={["".concat(n,"-multiple").concat(r)]:{fontSize:e.fontSize,["".concat(n,"-selector")]:{["".concat(n,"-show-search&")]:{cursor:"text"}},["\n &".concat(n,"-show-arrow ").concat(n,"-selector,\n &").concat(n,"-allow-clear ").concat(n,"-selector\n ")]:{paddingInlineEnd:e.calc(e.fontSizeIcon).add(e.controlPaddingHorizontal).equal()}}};return[eq(e,t),o]}var eG=e=>{let{componentCls:t}=e,n=(0,eA.IX)(e,{selectHeight:e.controlHeightSM,multipleSelectItemHeight:e.multipleItemHeightSM,borderRadius:e.borderRadiusSM,borderRadiusSM:e.borderRadiusXS}),r=(0,eA.IX)(e,{fontSize:e.fontSizeLG,selectHeight:e.controlHeightLG,multipleSelectItemHeight:e.multipleItemHeightLG,borderRadius:e.borderRadiusLG,borderRadiusSM:e.borderRadius});return[eX(e),eX(n,"sm"),{["".concat(t,"-multiple").concat(t,"-sm")]:{["".concat(t,"-selection-placeholder")]:{insetInline:e.calc(e.controlPaddingHorizontalSM).sub(e.lineWidth).equal()},["".concat(t,"-selection-search")]:{marginInlineStart:2}}},eX(r,"lg")]};function eU(e,t){let{componentCls:n,inputPaddingHorizontalBase:r,borderRadius:o}=e,a=e.calc(e.controlHeight).sub(e.calc(e.lineWidth).mul(2)).equal(),i=t?"".concat(n,"-").concat(t):"";return{["".concat(n,"-single").concat(i)]:{fontSize:e.fontSize,height:e.controlHeight,["".concat(n,"-selector")]:Object.assign(Object.assign({},(0,eP.Wf)(e,!0)),{display:"flex",borderRadius:o,flex:"1 1 auto",["".concat(n,"-selection-wrap:after")]:{lineHeight:(0,eL.bf)(a)},["".concat(n,"-selection-search")]:{position:"absolute",inset:0,width:"100%","&-input":{width:"100%",WebkitAppearance:"textfield"}},["\n ".concat(n,"-selection-item,\n ").concat(n,"-selection-placeholder\n ")]:{display:"block",padding:0,lineHeight:(0,eL.bf)(a),transition:"all ".concat(e.motionDurationSlow,", visibility 0s"),alignSelf:"center"},["".concat(n,"-selection-placeholder")]:{transition:"none",pointerEvents:"none"},[["&:after","".concat(n,"-selection-item:empty:after"),"".concat(n,"-selection-placeholder:empty:after")].join(",")]:{display:"inline-block",width:0,visibility:"hidden",content:'"\\a0"'}}),["\n &".concat(n,"-show-arrow ").concat(n,"-selection-item,\n &").concat(n,"-show-arrow ").concat(n,"-selection-search,\n &").concat(n,"-show-arrow ").concat(n,"-selection-placeholder\n ")]:{paddingInlineEnd:e.showArrowPaddingInlineEnd},["&".concat(n,"-open ").concat(n,"-selection-item")]:{color:e.colorTextPlaceholder},["&:not(".concat(n,"-customize-input)")]:{["".concat(n,"-selector")]:{width:"100%",height:"100%",alignItems:"center",padding:"0 ".concat((0,eL.bf)(r)),["".concat(n,"-selection-search-input")]:{height:a,fontSize:e.fontSize},"&:after":{lineHeight:(0,eL.bf)(a)}}},["&".concat(n,"-customize-input")]:{["".concat(n,"-selector")]:{"&:after":{display:"none"},["".concat(n,"-selection-search")]:{position:"static",width:"100%"},["".concat(n,"-selection-placeholder")]:{position:"absolute",insetInlineStart:0,insetInlineEnd:0,padding:"0 ".concat((0,eL.bf)(r)),"&:after":{display:"none"}}}}}}}let e$=(e,t)=>{let{componentCls:n,antCls:r,controlOutlineWidth:o}=e;return{["&:not(".concat(n,"-customize-input) ").concat(n,"-selector")]:{border:"".concat((0,eL.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(t.borderColor),background:e.selectorBg},["&:not(".concat(n,"-disabled):not(").concat(n,"-customize-input):not(").concat(r,"-pagination-size-changer)")]:{["&:hover ".concat(n,"-selector")]:{borderColor:t.hoverBorderHover},["".concat(n,"-focused& ").concat(n,"-selector")]:{borderColor:t.activeBorderColor,boxShadow:"0 0 0 ".concat((0,eL.bf)(o)," ").concat(t.activeOutlineColor),outline:0},["".concat(n,"-prefix")]:{color:t.color}}}},eK=(e,t)=>({["&".concat(e.componentCls,"-status-").concat(t.status)]:Object.assign({},e$(e,t))}),eY=e=>({"&-outlined":Object.assign(Object.assign(Object.assign(Object.assign({},e$(e,{borderColor:e.colorBorder,hoverBorderHover:e.hoverBorderColor,activeBorderColor:e.activeBorderColor,activeOutlineColor:e.activeOutlineColor,color:e.colorText})),eK(e,{status:"error",borderColor:e.colorError,hoverBorderHover:e.colorErrorHover,activeBorderColor:e.colorError,activeOutlineColor:e.colorErrorOutline,color:e.colorError})),eK(e,{status:"warning",borderColor:e.colorWarning,hoverBorderHover:e.colorWarningHover,activeBorderColor:e.colorWarning,activeOutlineColor:e.colorWarningOutline,color:e.colorWarning})),{["&".concat(e.componentCls,"-disabled")]:{["&:not(".concat(e.componentCls,"-customize-input) ").concat(e.componentCls,"-selector")]:{background:e.colorBgContainerDisabled,color:e.colorTextDisabled}},["&".concat(e.componentCls,"-multiple ").concat(e.componentCls,"-selection-item")]:{background:e.multipleItemBg,border:"".concat((0,eL.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.multipleItemBorderColor)}})}),eQ=(e,t)=>{let{componentCls:n,antCls:r}=e;return{["&:not(".concat(n,"-customize-input) ").concat(n,"-selector")]:{background:t.bg,border:"".concat((0,eL.bf)(e.lineWidth)," ").concat(e.lineType," transparent"),color:t.color},["&:not(".concat(n,"-disabled):not(").concat(n,"-customize-input):not(").concat(r,"-pagination-size-changer)")]:{["&:hover ".concat(n,"-selector")]:{background:t.hoverBg},["".concat(n,"-focused& ").concat(n,"-selector")]:{background:e.selectorBg,borderColor:t.activeBorderColor,outline:0}}}},eJ=(e,t)=>({["&".concat(e.componentCls,"-status-").concat(t.status)]:Object.assign({},eQ(e,t))}),e0=e=>({"&-filled":Object.assign(Object.assign(Object.assign(Object.assign({},eQ(e,{bg:e.colorFillTertiary,hoverBg:e.colorFillSecondary,activeBorderColor:e.activeBorderColor,color:e.colorText})),eJ(e,{status:"error",bg:e.colorErrorBg,hoverBg:e.colorErrorBgHover,activeBorderColor:e.colorError,color:e.colorError})),eJ(e,{status:"warning",bg:e.colorWarningBg,hoverBg:e.colorWarningBgHover,activeBorderColor:e.colorWarning,color:e.colorWarning})),{["&".concat(e.componentCls,"-disabled")]:{["&:not(".concat(e.componentCls,"-customize-input) ").concat(e.componentCls,"-selector")]:{borderColor:e.colorBorder,background:e.colorBgContainerDisabled,color:e.colorTextDisabled}},["&".concat(e.componentCls,"-multiple ").concat(e.componentCls,"-selection-item")]:{background:e.colorBgContainer,border:"".concat((0,eL.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorSplit)}})}),e1=e=>({"&-borderless":{["".concat(e.componentCls,"-selector")]:{background:"transparent",border:"".concat((0,eL.bf)(e.lineWidth)," ").concat(e.lineType," transparent")},["&".concat(e.componentCls,"-disabled")]:{["&:not(".concat(e.componentCls,"-customize-input) ").concat(e.componentCls,"-selector")]:{color:e.colorTextDisabled}},["&".concat(e.componentCls,"-multiple ").concat(e.componentCls,"-selection-item")]:{background:e.multipleItemBg,border:"".concat((0,eL.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.multipleItemBorderColor)},["&".concat(e.componentCls,"-status-error")]:{["".concat(e.componentCls,"-prefix, ").concat(e.componentCls,"-selection-item")]:{color:e.colorError}},["&".concat(e.componentCls,"-status-warning")]:{["".concat(e.componentCls,"-prefix, ").concat(e.componentCls,"-selection-item")]:{color:e.colorWarning}}}}),e2=(e,t)=>{let{componentCls:n,antCls:r}=e;return{["&:not(".concat(n,"-customize-input) ").concat(n,"-selector")]:{borderWidth:"".concat((0,eL.bf)(e.lineWidth)," 0"),borderStyle:"".concat(e.lineType," none"),borderColor:"transparent transparent ".concat(t.borderColor," transparent"),background:e.selectorBg,borderRadius:0},["&:not(".concat(n,"-disabled):not(").concat(n,"-customize-input):not(").concat(r,"-pagination-size-changer)")]:{["&:hover ".concat(n,"-selector")]:{borderColor:"transparent transparent ".concat(t.hoverBorderHover," transparent")},["".concat(n,"-focused& ").concat(n,"-selector")]:{borderColor:"transparent transparent ".concat(t.activeBorderColor," transparent"),outline:0},["".concat(n,"-prefix")]:{color:t.color}}}},e6=(e,t)=>({["&".concat(e.componentCls,"-status-").concat(t.status)]:Object.assign({},e2(e,t))}),e5=e=>({"&-underlined":Object.assign(Object.assign(Object.assign(Object.assign({},e2(e,{borderColor:e.colorBorder,hoverBorderHover:e.hoverBorderColor,activeBorderColor:e.activeBorderColor,activeOutlineColor:e.activeOutlineColor,color:e.colorText})),e6(e,{status:"error",borderColor:e.colorError,hoverBorderHover:e.colorErrorHover,activeBorderColor:e.colorError,activeOutlineColor:e.colorErrorOutline,color:e.colorError})),e6(e,{status:"warning",borderColor:e.colorWarning,hoverBorderHover:e.colorWarningHover,activeBorderColor:e.colorWarning,activeOutlineColor:e.colorWarningOutline,color:e.colorWarning})),{["&".concat(e.componentCls,"-disabled")]:{["&:not(".concat(e.componentCls,"-customize-input) ").concat(e.componentCls,"-selector")]:{color:e.colorTextDisabled}},["&".concat(e.componentCls,"-multiple ").concat(e.componentCls,"-selection-item")]:{background:e.multipleItemBg,border:"".concat((0,eL.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.multipleItemBorderColor)}})});var e4=e=>({[e.componentCls]:Object.assign(Object.assign(Object.assign(Object.assign({},eY(e)),e0(e)),e1(e)),e5(e))});let e3=e=>{let{componentCls:t}=e;return{position:"relative",transition:"all ".concat(e.motionDurationMid," ").concat(e.motionEaseInOut),input:{cursor:"pointer"},["".concat(t,"-show-search&")]:{cursor:"text",input:{cursor:"auto",color:"inherit",height:"100%"}},["".concat(t,"-disabled&")]:{cursor:"not-allowed",input:{cursor:"not-allowed"}}}},e7=e=>{let{componentCls:t}=e;return{["".concat(t,"-selection-search-input")]:{margin:0,padding:0,background:"transparent",border:"none",outline:"none",appearance:"none",fontFamily:"inherit","&::-webkit-search-cancel-button":{display:"none",appearance:"none"}}}},e9=e=>{let{antCls:t,componentCls:n,inputPaddingHorizontalBase:r,iconCls:o}=e,a={["".concat(n,"-clear")]:{opacity:1,background:e.colorBgBase,borderRadius:"50%"}};return{[n]:Object.assign(Object.assign({},(0,eP.Wf)(e)),{position:"relative",display:"inline-flex",cursor:"pointer",["&:not(".concat(n,"-customize-input) ").concat(n,"-selector")]:Object.assign(Object.assign({},e3(e)),e7(e)),["".concat(n,"-selection-item")]:Object.assign(Object.assign({flex:1,fontWeight:"normal",position:"relative",userSelect:"none"},eP.vS),{["> ".concat(t,"-typography")]:{display:"inline"}}),["".concat(n,"-selection-placeholder")]:Object.assign(Object.assign({},eP.vS),{flex:1,color:e.colorTextPlaceholder,pointerEvents:"none"}),["".concat(n,"-arrow")]:Object.assign(Object.assign({},(0,eP.Ro)()),{position:"absolute",top:"50%",insetInlineStart:"auto",insetInlineEnd:r,height:e.fontSizeIcon,marginTop:e.calc(e.fontSizeIcon).mul(-1).div(2).equal(),color:e.colorTextQuaternary,fontSize:e.fontSizeIcon,lineHeight:1,textAlign:"center",pointerEvents:"none",display:"flex",alignItems:"center",transition:"opacity ".concat(e.motionDurationSlow," ease"),[o]:{verticalAlign:"top",transition:"transform ".concat(e.motionDurationSlow),"> svg":{verticalAlign:"top"},["&:not(".concat(n,"-suffix)")]:{pointerEvents:"auto"}},["".concat(n,"-disabled &")]:{cursor:"not-allowed"},"> *:not(:last-child)":{marginInlineEnd:8}}),["".concat(n,"-selection-wrap")]:{display:"flex",width:"100%",position:"relative",minWidth:0,"&:after":{content:'"\\a0"',width:0,overflow:"hidden"}},["".concat(n,"-prefix")]:{flex:"none",marginInlineEnd:e.selectAffixPadding},["".concat(n,"-clear")]:{position:"absolute",top:"50%",insetInlineStart:"auto",insetInlineEnd:r,zIndex:1,display:"inline-block",width:e.fontSizeIcon,height:e.fontSizeIcon,marginTop:e.calc(e.fontSizeIcon).mul(-1).div(2).equal(),color:e.colorTextQuaternary,fontSize:e.fontSizeIcon,fontStyle:"normal",lineHeight:1,textAlign:"center",textTransform:"none",cursor:"pointer",opacity:0,transition:"color ".concat(e.motionDurationMid," ease, opacity ").concat(e.motionDurationSlow," ease"),textRendering:"auto",transform:"translateZ(0)","&:before":{display:"block"},"&:hover":{color:e.colorIcon}},"@media(hover:none)":a,"&:hover":a}),["".concat(n,"-status")]:{"&-error, &-warning, &-success, &-validating":{["&".concat(n,"-has-feedback")]:{["".concat(n,"-clear")]:{insetInlineEnd:e.calc(r).add(e.fontSize).add(e.paddingXS).equal()}}}}}},e8=e=>{let{componentCls:t}=e;return[{[t]:{["&".concat(t,"-in-form-item")]:{width:"100%"}}},e9(e),function(e){let{componentCls:t}=e,n=e.calc(e.controlPaddingHorizontalSM).sub(e.lineWidth).equal();return[eU(e),eU((0,eA.IX)(e,{controlHeight:e.controlHeightSM,borderRadius:e.borderRadiusSM}),"sm"),{["".concat(t,"-single").concat(t,"-sm")]:{["&:not(".concat(t,"-customize-input)")]:{["".concat(t,"-selector")]:{padding:"0 ".concat((0,eL.bf)(n))},["&".concat(t,"-show-arrow ").concat(t,"-selection-search")]:{insetInlineEnd:e.calc(n).add(e.calc(e.fontSize).mul(1.5)).equal()},["\n &".concat(t,"-show-arrow ").concat(t,"-selection-item,\n &").concat(t,"-show-arrow ").concat(t,"-selection-placeholder\n ")]:{paddingInlineEnd:e.calc(e.fontSize).mul(1.5).equal()}}}},eU((0,eA.IX)(e,{controlHeight:e.singleItemHeightLG,fontSize:e.fontSizeLG,borderRadius:e.borderRadiusLG}),"lg")]}(e),eG(e),ez(e),{["".concat(t,"-rtl")]:{direction:"rtl"}},(0,eF.c)(e,{borderElCls:"".concat(t,"-selector"),focusElCls:"".concat(t,"-focused")})]};var te=(0,eT.I$)("Select",(e,t)=>{let{rootPrefixCls:n}=t,r=(0,eA.IX)(e,{rootPrefixCls:n,inputPaddingHorizontalBase:e.calc(e.paddingSM).sub(1).equal(),multipleSelectItemHeight:e.multipleItemHeight,selectHeight:e.controlHeight});return[e8(r),e4(r)]},e=>{let{fontSize:t,lineHeight:n,lineWidth:r,controlHeight:o,controlHeightSM:a,controlHeightLG:i,paddingXXS:c,controlPaddingHorizontal:l,zIndexPopupBase:s,colorText:u,fontWeightStrong:d,controlItemBgActive:f,controlItemBgHover:p,colorBgContainer:m,colorFillSecondary:g,colorBgContainerDisabled:v,colorTextDisabled:h,colorPrimaryHover:b,colorPrimary:y,controlOutline:x}=e,w=2*c,E=2*r;return{INTERNAL_FIXED_ITEM_MARGIN:Math.floor(c/2),zIndexPopup:s+50,optionSelectedColor:u,optionSelectedFontWeight:d,optionSelectedBg:f,optionActiveBg:p,optionPadding:"".concat((o-t*n)/2,"px ").concat(l,"px"),optionFontSize:t,optionLineHeight:n,optionHeight:o,selectorBg:m,clearBg:m,singleItemHeightLG:i,multipleItemBg:g,multipleItemBorderColor:"transparent",multipleItemHeight:Math.min(o-w,o-E),multipleItemHeightSM:Math.min(a-w,a-E),multipleItemHeightLG:Math.min(i-w,i-E),multipleSelectorBgDisabled:v,multipleItemColorDisabled:h,multipleItemBorderColorDisabled:"transparent",showArrowPaddingInlineEnd:Math.ceil(1.25*e.fontSize),hoverBorderColor:b,activeBorderColor:y,activeOutlineColor:x,selectAffixPadding:c}},{unitless:{optionLineHeight:!0,optionSelectedFontWeight:!0}}),tt=n(9738),tn=n(39725),tr=n(49638),to=n(70464),ta=n(61935),ti=n(29436),tc=n(391),tl=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 ts="SECRET_COMBOBOX_MODE_DO_NOT_USE",tu=r.forwardRef((e,t)=>{var n,o,i,c,l,s,u,d;let f;let{prefixCls:p,bordered:m,className:g,rootClassName:v,getPopupContainer:h,popupClassName:b,dropdownClassName:y,listHeight:x=256,placement:w,listItemHeight:E,size:C,disabled:Z,notFoundContent:S,status:O,builtinPlacements:k,dropdownMatchSelectWidth:j,popupMatchSelectWidth:I,direction:M,style:R,allowClear:N,variant:P,dropdownStyle:F,transitionName:T,tagRender:A,maxCount:_,prefix:B,dropdownRender:H,popupRender:z,onDropdownVisibleChange:L,onOpenChange:D,styles:W,classNames:V}=e,q=tl(e,["prefixCls","bordered","className","rootClassName","getPopupContainer","popupClassName","dropdownClassName","listHeight","placement","listItemHeight","size","disabled","notFoundContent","status","builtinPlacements","dropdownMatchSelectWidth","popupMatchSelectWidth","direction","style","allowClear","variant","dropdownStyle","transitionName","tagRender","maxCount","prefix","dropdownRender","popupRender","onDropdownVisibleChange","onOpenChange","styles","classNames"]),{getPopupContainer:X,getPrefixCls:G,renderEmpty:U,direction:$,virtual:K,popupMatchSelectWidth:Y,popupOverflow:Q}=r.useContext(eC.E_),{showSearch:J,style:ee,styles:et,className:er,classNames:eo}=(0,eC.dj)("select"),[,ea]=(0,eR.ZP)(),ei=null!=E?E:null==ea?void 0:ea.controlHeight,ec=G("select",p),el=G(),es=null!=M?M:$,{compactSize:eu,compactItemClassnames:ed}=(0,eM.ri)(ec,es),[ef,ep]=(0,eI.Z)("select",P,m),em=(0,eO.Z)(ec),[eg,ev,eh]=te(ec,em),ew=r.useMemo(()=>{let{mode:t}=e;return"combobox"===t?void 0:t===ts?"combobox":t},[e.mode]),eP="multiple"===ew||"tags"===ew,eF=(s=e.suffixIcon,void 0!==(u=e.showArrow)?u:null!==s),eT=null!==(n=null!=I?I:j)&&void 0!==n?n:Y,eA=(null===(o=null==W?void 0:W.popup)||void 0===o?void 0:o.root)||(null===(i=et.popup)||void 0===i?void 0:i.root)||F,e_=(d=z||H,r.useMemo(()=>{if(d)return function(){for(var e=arguments.length,t=Array(e),n=0;nnull!==t||l||f?r.createElement(r.Fragment,null,!1!==u&&e,l&&d):null,v=null;if(void 0!==t)v=g(t);else if(i)v=g(r.createElement(ta.Z,{spin:!0}));else{let e="".concat(s,"-suffix");v=t=>{let{open:n,showSearch:o}=t;return n&&o?g(r.createElement(ti.Z,{className:e})):g(r.createElement(to.Z,{className:e}))}}let h=null;return h=void 0!==o?o:c?r.createElement(tt.Z,null):null,{clearIcon:m,suffixIcon:v,itemIcon:h,removeIcon:void 0!==a?a:r.createElement(tr.Z,null)}}(Object.assign(Object.assign({},q),{multiple:eP,hasFeedback:eH,feedbackIcon:eL,showSuffixIcon:eF,prefixCls:ec,componentName:"Select"})),eG=(0,en.Z)(q,["suffixIcon","itemIcon"]),eU=a()((null===(c=null==V?void 0:V.popup)||void 0===c?void 0:c.root)||(null===(l=null==eo?void 0:eo.popup)||void 0===l?void 0:l.root)||b||y,{["".concat(ec,"-dropdown-").concat(es)]:"rtl"===es},v,eo.root,null==V?void 0:V.root,eh,em,ev),e$=(0,ek.Z)(e=>{var t;return null!==(t=null!=C?C:eu)&&void 0!==t?t:e}),eK=r.useContext(eS.Z),eY=a()({["".concat(ec,"-lg")]:"large"===e$,["".concat(ec,"-sm")]:"small"===e$,["".concat(ec,"-rtl")]:"rtl"===es,["".concat(ec,"-").concat(ef)]:ep,["".concat(ec,"-in-form-item")]:ez},(0,eE.Z)(ec,eD,eH),ed,er,g,eo.root,null==V?void 0:V.root,v,eh,em,ev),eQ=r.useMemo(()=>void 0!==w?w:"rtl"===es?"bottomRight":"bottomLeft",[w,es]),[eJ]=(0,ey.Cn)("SelectLike",null==eA?void 0:eA.zIndex);return eg(r.createElement(eb,Object.assign({ref:t,virtual:K,showSearch:J},eG,{style:Object.assign(Object.assign(Object.assign(Object.assign({},et.root),null==W?void 0:W.root),ee),R),dropdownMatchSelectWidth:eT,transitionName:(0,ex.m)(el,"slide-up",T),builtinPlacements:k||eN(Q),listHeight:x,listItemHeight:ei,mode:ew,prefixCls:ec,placement:eQ,direction:es,prefix:B,suffixIcon:eW,menuItemSelectedIcon:eV,removeIcon:eq,allowClear:!0===N?{clearIcon:eX}:N,notFoundContent:f,className:eY,getPopupContainer:h||X,dropdownClassName:eU,disabled:null!=Z?Z:eK,dropdownStyle:Object.assign(Object.assign({},eA),{zIndex:eJ}),maxCount:eP?_:void 0,tagRender:eP?A:void 0,dropdownRender:e_,onDropdownVisibleChange:D||L})))}),td=(0,ew.Z)(tu,"dropdownAlign");tu.SECRET_COMBOBOX_MODE_DO_NOT_USE=ts,tu.Option=ee,tu.OptGroup=J,tu._InternalPanelDoNotUseOrYouWillBeFired=td;var tf=tu},77685:function(e,t,n){"use strict";n.d(t,{BR:function(){return g},ZP:function(){return h},ri:function(){return m}});var r=n(2265),o=n(36760),a=n.n(o),i=n(45287),c=n(71744),l=n(33759),s=n(99320);let u=e=>{let{componentCls:t}=e;return{[t]:{display:"inline-flex","&-block":{display:"flex",width:"100%"},"&-vertical":{flexDirection:"column"},"&-rtl":{direction:"rtl"}}}};var d=(0,s.I$)(["Space","Compact"],e=>[u(e)],()=>({}),{resetStyle:!1}),f=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 p=r.createContext(null),m=(e,t)=>{let n=r.useContext(p),o=r.useMemo(()=>{if(!n)return"";let{compactDirection:r,isFirstItem:o,isLastItem:i}=n,c="vertical"===r?"-vertical-":"-";return a()("".concat(e,"-compact").concat(c,"item"),{["".concat(e,"-compact").concat(c,"first-item")]:o,["".concat(e,"-compact").concat(c,"last-item")]:i,["".concat(e,"-compact").concat(c,"item-rtl")]:"rtl"===t})},[e,t,n]);return{compactSize:null==n?void 0:n.compactSize,compactDirection:null==n?void 0:n.compactDirection,compactItemClassnames:o}},g=e=>{let{children:t}=e;return r.createElement(p.Provider,{value:null},t)},v=e=>{let{children:t}=e,n=f(e,["children"]);return r.createElement(p.Provider,{value:r.useMemo(()=>n,[n])},t)};var h=e=>{let{getPrefixCls:t,direction:n}=r.useContext(c.E_),{size:o,direction:s,block:u,prefixCls:m,className:g,rootClassName:h,children:b}=e,y=f(e,["size","direction","block","prefixCls","className","rootClassName","children"]),x=(0,l.Z)(e=>null!=o?o:e),w=t("space-compact",m),[E,C]=d(w),Z=a()(w,C,{["".concat(w,"-rtl")]:"rtl"===n,["".concat(w,"-block")]:u,["".concat(w,"-vertical")]:"vertical"===s},g,h),S=r.useContext(p),O=(0,i.Z)(b),k=r.useMemo(()=>O.map((e,t)=>{let n=(null==e?void 0:e.key)||"".concat(w,"-item-").concat(t);return r.createElement(v,{key:n,compactSize:x,compactDirection:s,isFirstItem:0===t&&(!S||(null==S?void 0:S.isFirstItem)),isLastItem:t===O.length-1&&(!S||(null==S?void 0:S.isLastItem))},e)}),[O,S,s,x,w]);return 0===O.length?null:E(r.createElement("div",Object.assign({className:Z},y),k))}},17691:function(e,t,n){"use strict";function r(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{focus:!0},{componentCls:n}=e,{componentCls:r}=t,o=r||n,a="".concat(o,"-compact");return{[a]:Object.assign(Object.assign({},function(e,t,n,r){let{focusElCls:o,focus:a,borderElCls:i}=n,c=i?"> *":"",l=["hover",a?"focus":null,"active"].filter(Boolean).map(e=>"&:".concat(e," ").concat(c)).join(",");return{["&-item:not(".concat(t,"-last-item)")]:{marginInlineEnd:e.calc(e.lineWidth).mul(-1).equal()},["&-item:not(".concat(r,"-status-success)")]:{zIndex:2},"&-item":Object.assign(Object.assign({[l]:{zIndex:3}},o?{["&".concat(o)]:{zIndex:3}}:{}),{["&[disabled] ".concat(c)]:{zIndex:0}})}}(e,a,t,o)),function(e,t,n){let{borderElCls:r}=n,o=r?"> ".concat(r):"";return{["&-item:not(".concat(t,"-first-item):not(").concat(t,"-last-item) ").concat(o)]:{borderRadius:0},["&-item:not(".concat(t,"-last-item)").concat(t,"-first-item")]:{["& ".concat(o,", &").concat(e,"-sm ").concat(o,", &").concat(e,"-lg ").concat(o)]:{borderStartEndRadius:0,borderEndEndRadius:0}},["&-item:not(".concat(t,"-first-item)").concat(t,"-last-item")]:{["& ".concat(o,", &").concat(e,"-sm ").concat(o,", &").concat(e,"-lg ").concat(o)]:{borderStartStartRadius:0,borderEndStartRadius:0}}}}(o,a,t))}}n.d(t,{c:function(){return r}})},12918:function(e,t,n){"use strict";n.d(t,{JT:function(){return f},Lx:function(){return l},Nd:function(){return p},Qy:function(){return d},Ro:function(){return i},Wf:function(){return a},dF:function(){return c},du:function(){return s},oN:function(){return u},vS:function(){return o}});var r=n(93463);let o={overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},a=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{boxSizing:"border-box",margin:0,padding:0,color:e.colorText,fontSize:e.fontSize,lineHeight:e.lineHeight,listStyle:"none",fontFamily:t?"inherit":e.fontFamily}},i=()=>({display:"inline-flex",alignItems:"center",color:"inherit",fontStyle:"normal",lineHeight:0,textAlign:"center",textTransform:"none",verticalAlign:"-0.125em",textRendering:"optimizeLegibility","-webkit-font-smoothing":"antialiased","-moz-osx-font-smoothing":"grayscale","> *":{lineHeight:1},svg:{display:"inline-block"}}),c=()=>({"&::before":{display:"table",content:'""'},"&::after":{display:"table",clear:"both",content:'""'}}),l=e=>({a:{color:e.colorLink,textDecoration:e.linkDecoration,backgroundColor:"transparent",outline:"none",cursor:"pointer",transition:"color ".concat(e.motionDurationSlow),"-webkit-text-decoration-skip":"objects","&:hover":{color:e.colorLinkHover},"&:active":{color:e.colorLinkActive},"&:active, &:hover":{textDecoration:e.linkHoverDecoration,outline:0},"&:focus":{textDecoration:e.linkFocusDecoration,outline:0},"&[disabled]":{color:e.colorTextDisabled,cursor:"not-allowed"}}}),s=(e,t,n,r)=>{let o='[class^="'.concat(t,'"], [class*=" ').concat(t,'"]'),a=n?".".concat(n):o,i={boxSizing:"border-box","&::before, &::after":{boxSizing:"border-box"}},c={};return!1!==r&&(c={fontFamily:e.fontFamily,fontSize:e.fontSize}),{[a]:Object.assign(Object.assign(Object.assign({},c),i),{[o]:i})}},u=(e,t)=>({outline:"".concat((0,r.bf)(e.lineWidthFocus)," solid ").concat(e.colorPrimaryBorder),outlineOffset:null!=t?t:1,transition:"outline-offset 0s, outline 0s"}),d=(e,t)=>({"&:focus-visible":u(e,t)}),f=e=>({[".".concat(e)]:Object.assign(Object.assign({},i()),{[".".concat(e," .").concat(e,"-icon")]:{display:"block"}})}),p=e=>Object.assign(Object.assign({color:e.colorLink,textDecoration:e.linkDecoration,outline:"none",cursor:"pointer",transition:"all ".concat(e.motionDurationSlow),border:0,padding:0,background:"none",userSelect:"none"},d(e)),{"&:hover":{color:e.colorLinkHover,textDecoration:e.linkHoverDecoration},"&:focus":{color:e.colorLinkHover,textDecoration:e.linkFocusDecoration},"&:active":{color:e.colorLinkActive,textDecoration:e.linkHoverDecoration}})},63074:function(e,t){"use strict";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")}}})},37133:function(e,t,n){"use strict";n.d(t,{R:function(){return a}});let r=e=>({animationDuration:e,animationFillMode:"both"}),o=e=>({animationDuration:e,animationFillMode:"both"}),a=function(e,t,n,a){let i=arguments.length>4&&void 0!==arguments[4]&&arguments[4],c=i?"&":"";return{["\n ".concat(c).concat(e,"-enter,\n ").concat(c).concat(e,"-appear\n ")]:Object.assign(Object.assign({},r(a)),{animationPlayState:"paused"}),["".concat(c).concat(e,"-leave")]:Object.assign(Object.assign({},o(a)),{animationPlayState:"paused"}),["\n ".concat(c).concat(e,"-enter").concat(e,"-enter-active,\n ").concat(c).concat(e,"-appear").concat(e,"-appear-active\n ")]:{animationName:t,animationPlayState:"running"},["".concat(c).concat(e,"-leave").concat(e,"-leave-active")]:{animationName:n,animationPlayState:"running",pointerEvents:"none"}}}},29382:function(e,t,n){"use strict";n.d(t,{Fm:function(){return f}});var r=n(93463),o=n(37133);let a=new r.E4("antMoveDownIn",{"0%":{transform:"translate3d(0, 100%, 0)",transformOrigin:"0 0",opacity:0},"100%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1}}),i=new r.E4("antMoveDownOut",{"0%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1},"100%":{transform:"translate3d(0, 100%, 0)",transformOrigin:"0 0",opacity:0}}),c=new r.E4("antMoveLeftIn",{"0%":{transform:"translate3d(-100%, 0, 0)",transformOrigin:"0 0",opacity:0},"100%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1}}),l=new r.E4("antMoveLeftOut",{"0%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1},"100%":{transform:"translate3d(-100%, 0, 0)",transformOrigin:"0 0",opacity:0}}),s=new r.E4("antMoveRightIn",{"0%":{transform:"translate3d(100%, 0, 0)",transformOrigin:"0 0",opacity:0},"100%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1}}),u=new r.E4("antMoveRightOut",{"0%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1},"100%":{transform:"translate3d(100%, 0, 0)",transformOrigin:"0 0",opacity:0}}),d={"move-up":{inKeyframes:new r.E4("antMoveUpIn",{"0%":{transform:"translate3d(0, -100%, 0)",transformOrigin:"0 0",opacity:0},"100%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1}}),outKeyframes:new r.E4("antMoveUpOut",{"0%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1},"100%":{transform:"translate3d(0, -100%, 0)",transformOrigin:"0 0",opacity:0}})},"move-down":{inKeyframes:a,outKeyframes:i},"move-left":{inKeyframes:c,outKeyframes:l},"move-right":{inKeyframes:s,outKeyframes:u}},f=(e,t)=>{let{antCls:n}=e,r="".concat(n,"-").concat(t),{inKeyframes:a,outKeyframes:i}=d[t];return[(0,o.R)(r,a,i,e.motionDurationMid),{["\n ".concat(r,"-enter,\n ").concat(r,"-appear\n ")]:{opacity:0,animationTimingFunction:e.motionEaseOutCirc},["".concat(r,"-leave")]:{animationTimingFunction:e.motionEaseInOutCirc}}]}},18544:function(e,t,n){"use strict";n.d(t,{Qt:function(){return c},Uw:function(){return i},fJ:function(){return a},ly:function(){return l},oN:function(){return d}});var r=n(93463),o=n(37133);let a=new r.E4("antSlideUpIn",{"0%":{transform:"scaleY(0.8)",transformOrigin:"0% 0%",opacity:0},"100%":{transform:"scaleY(1)",transformOrigin:"0% 0%",opacity:1}}),i=new r.E4("antSlideUpOut",{"0%":{transform:"scaleY(1)",transformOrigin:"0% 0%",opacity:1},"100%":{transform:"scaleY(0.8)",transformOrigin:"0% 0%",opacity:0}}),c=new r.E4("antSlideDownIn",{"0%":{transform:"scaleY(0.8)",transformOrigin:"100% 100%",opacity:0},"100%":{transform:"scaleY(1)",transformOrigin:"100% 100%",opacity:1}}),l=new r.E4("antSlideDownOut",{"0%":{transform:"scaleY(1)",transformOrigin:"100% 100%",opacity:1},"100%":{transform:"scaleY(0.8)",transformOrigin:"100% 100%",opacity:0}}),s=new r.E4("antSlideLeftIn",{"0%":{transform:"scaleX(0.8)",transformOrigin:"0% 0%",opacity:0},"100%":{transform:"scaleX(1)",transformOrigin:"0% 0%",opacity:1}}),u={"slide-up":{inKeyframes:a,outKeyframes:i},"slide-down":{inKeyframes:c,outKeyframes:l},"slide-left":{inKeyframes:s,outKeyframes:new r.E4("antSlideLeftOut",{"0%":{transform:"scaleX(1)",transformOrigin:"0% 0%",opacity:1},"100%":{transform:"scaleX(0.8)",transformOrigin:"0% 0%",opacity:0}})},"slide-right":{inKeyframes:new r.E4("antSlideRightIn",{"0%":{transform:"scaleX(0.8)",transformOrigin:"100% 0%",opacity:0},"100%":{transform:"scaleX(1)",transformOrigin:"100% 0%",opacity:1}}),outKeyframes:new r.E4("antSlideRightOut",{"0%":{transform:"scaleX(1)",transformOrigin:"100% 0%",opacity:1},"100%":{transform:"scaleX(0.8)",transformOrigin:"100% 0%",opacity:0}})}},d=(e,t)=>{let{antCls:n}=e,r="".concat(n,"-").concat(t),{inKeyframes:a,outKeyframes:i}=u[t];return[(0,o.R)(r,a,i,e.motionDurationMid),{["\n ".concat(r,"-enter,\n ").concat(r,"-appear\n ")]:{transform:"scale(0)",transformOrigin:"0% 0%",opacity:0,animationTimingFunction:e.motionEaseOutQuint,"&-prepare":{transform:"scale(1)"}},["".concat(r,"-leave")]:{animationTimingFunction:e.motionEaseInQuint}}]}},691:function(e,t,n){"use strict";n.d(t,{_y:function(){return g},kr:function(){return a}});var r=n(93463),o=n(37133);let a=new r.E4("antZoomIn",{"0%":{transform:"scale(0.2)",opacity:0},"100%":{transform:"scale(1)",opacity:1}}),i=new r.E4("antZoomOut",{"0%":{transform:"scale(1)"},"100%":{transform:"scale(0.2)",opacity:0}}),c=new r.E4("antZoomBigIn",{"0%":{transform:"scale(0.8)",opacity:0},"100%":{transform:"scale(1)",opacity:1}}),l=new r.E4("antZoomBigOut",{"0%":{transform:"scale(1)"},"100%":{transform:"scale(0.8)",opacity:0}}),s=new r.E4("antZoomUpIn",{"0%":{transform:"scale(0.8)",transformOrigin:"50% 0%",opacity:0},"100%":{transform:"scale(1)",transformOrigin:"50% 0%"}}),u=new r.E4("antZoomUpOut",{"0%":{transform:"scale(1)",transformOrigin:"50% 0%"},"100%":{transform:"scale(0.8)",transformOrigin:"50% 0%",opacity:0}}),d=new r.E4("antZoomLeftIn",{"0%":{transform:"scale(0.8)",transformOrigin:"0% 50%",opacity:0},"100%":{transform:"scale(1)",transformOrigin:"0% 50%"}}),f=new r.E4("antZoomLeftOut",{"0%":{transform:"scale(1)",transformOrigin:"0% 50%"},"100%":{transform:"scale(0.8)",transformOrigin:"0% 50%",opacity:0}}),p=new r.E4("antZoomRightIn",{"0%":{transform:"scale(0.8)",transformOrigin:"100% 50%",opacity:0},"100%":{transform:"scale(1)",transformOrigin:"100% 50%"}}),m={zoom:{inKeyframes:a,outKeyframes:i},"zoom-big":{inKeyframes:c,outKeyframes:l},"zoom-big-fast":{inKeyframes:c,outKeyframes:l},"zoom-left":{inKeyframes:d,outKeyframes:f},"zoom-right":{inKeyframes:p,outKeyframes:new r.E4("antZoomRightOut",{"0%":{transform:"scale(1)",transformOrigin:"100% 50%"},"100%":{transform:"scale(0.8)",transformOrigin:"100% 50%",opacity:0}})},"zoom-up":{inKeyframes:s,outKeyframes:u},"zoom-down":{inKeyframes:new r.E4("antZoomDownIn",{"0%":{transform:"scale(0.8)",transformOrigin:"50% 100%",opacity:0},"100%":{transform:"scale(1)",transformOrigin:"50% 100%"}}),outKeyframes:new r.E4("antZoomDownOut",{"0%":{transform:"scale(1)",transformOrigin:"50% 100%"},"100%":{transform:"scale(0.8)",transformOrigin:"50% 100%",opacity:0}})}},g=(e,t)=>{let{antCls:n}=e,r="".concat(n,"-").concat(t),{inKeyframes:a,outKeyframes:i}=m[t];return[(0,o.R)(r,a,i,"zoom-big-fast"===t?e.motionDurationFast:e.motionDurationMid),{["\n ".concat(r,"-enter,\n ").concat(r,"-appear\n ")]:{transform:"scale(0)",opacity:0,animationTimingFunction:e.motionEaseOutCirc,"&-prepare":{transform:"none"}},["".concat(r,"-leave")]:{animationTimingFunction:e.motionEaseInOutCirc}}]}},88260:function(e,t,n){"use strict";n.d(t,{ZP:function(){return c},qN:function(){return a},wZ:function(){return i}});var r=n(93463),o=n(34442);let a=8;function i(e){let{contentRadius:t,limitVerticalRadius:n}=e,r=t>12?t+2:12;return{arrowOffsetHorizontal:r,arrowOffsetVertical:n?a:r}}function c(e,t,n){var a,i,c,l,s,u,d,f;let{componentCls:p,boxShadowPopoverArrow:m,arrowOffsetVertical:g,arrowOffsetHorizontal:v}=e,{arrowDistance:h=0,arrowPlacement:b={left:!0,right:!0,top:!0,bottom:!0}}=n||{};return{[p]:Object.assign(Object.assign(Object.assign(Object.assign({["".concat(p,"-arrow")]:[Object.assign(Object.assign({position:"absolute",zIndex:1,display:"block"},(0,o.W)(e,t,m)),{"&:before":{background:t}})]},(a=!!b.top,i={[["&-placement-top > ".concat(p,"-arrow"),"&-placement-topLeft > ".concat(p,"-arrow"),"&-placement-topRight > ".concat(p,"-arrow")].join(",")]:{bottom:h,transform:"translateY(100%) rotate(180deg)"},["&-placement-top > ".concat(p,"-arrow")]:{left:{_skip_check_:!0,value:"50%"},transform:"translateX(-50%) translateY(100%) rotate(180deg)"},"&-placement-topLeft":{"--arrow-offset-horizontal":v,["> ".concat(p,"-arrow")]:{left:{_skip_check_:!0,value:v}}},"&-placement-topRight":{"--arrow-offset-horizontal":"calc(100% - ".concat((0,r.bf)(v),")"),["> ".concat(p,"-arrow")]:{right:{_skip_check_:!0,value:v}}}},a?i:{})),(c=!!b.bottom,l={[["&-placement-bottom > ".concat(p,"-arrow"),"&-placement-bottomLeft > ".concat(p,"-arrow"),"&-placement-bottomRight > ".concat(p,"-arrow")].join(",")]:{top:h,transform:"translateY(-100%)"},["&-placement-bottom > ".concat(p,"-arrow")]:{left:{_skip_check_:!0,value:"50%"},transform:"translateX(-50%) translateY(-100%)"},"&-placement-bottomLeft":{"--arrow-offset-horizontal":v,["> ".concat(p,"-arrow")]:{left:{_skip_check_:!0,value:v}}},"&-placement-bottomRight":{"--arrow-offset-horizontal":"calc(100% - ".concat((0,r.bf)(v),")"),["> ".concat(p,"-arrow")]:{right:{_skip_check_:!0,value:v}}}},c?l:{})),(s=!!b.left,u={[["&-placement-left > ".concat(p,"-arrow"),"&-placement-leftTop > ".concat(p,"-arrow"),"&-placement-leftBottom > ".concat(p,"-arrow")].join(",")]:{right:{_skip_check_:!0,value:h},transform:"translateX(100%) rotate(90deg)"},["&-placement-left > ".concat(p,"-arrow")]:{top:{_skip_check_:!0,value:"50%"},transform:"translateY(-50%) translateX(100%) rotate(90deg)"},["&-placement-leftTop > ".concat(p,"-arrow")]:{top:g},["&-placement-leftBottom > ".concat(p,"-arrow")]:{bottom:g}},s?u:{})),(d=!!b.right,f={[["&-placement-right > ".concat(p,"-arrow"),"&-placement-rightTop > ".concat(p,"-arrow"),"&-placement-rightBottom > ".concat(p,"-arrow")].join(",")]:{left:{_skip_check_:!0,value:h},transform:"translateX(-100%) rotate(-90deg)"},["&-placement-right > ".concat(p,"-arrow")]:{top:{_skip_check_:!0,value:"50%"},transform:"translateY(-50%) translateX(-100%) rotate(-90deg)"},["&-placement-rightTop > ".concat(p,"-arrow")]:{top:g},["&-placement-rightBottom > ".concat(p,"-arrow")]:{bottom:g}},d?f:{}))}}},34442:function(e,t,n){"use strict";n.d(t,{W:function(){return a},w:function(){return o}});var r=n(93463);function o(e){let{sizePopupArrow:t,borderRadiusXS:n,borderRadiusOuter:r}=e,o=t/2,a=1*r/Math.sqrt(2),i=o-r*(1-1/Math.sqrt(2)),c=o-1/Math.sqrt(2)*n,l=r*(Math.sqrt(2)-1)+1/Math.sqrt(2)*n,s=2*o-c,u=2*o-a,d=2*o-0,f=o*Math.sqrt(2)+r*(Math.sqrt(2)-2),p=r*(Math.sqrt(2)-1),m="polygon(".concat(p,"px 100%, 50% ").concat(p,"px, ").concat(2*o-p,"px 100%, ").concat(p,"px 100%)");return{arrowShadowWidth:f,arrowPath:"path('M ".concat(0," ").concat(o," A ").concat(r," ").concat(r," 0 0 0 ").concat(a," ").concat(i," L ").concat(c," ").concat(l," A ").concat(n," ").concat(n," 0 0 1 ").concat(s," ").concat(l," L ").concat(u," ").concat(i," A ").concat(r," ").concat(r," 0 0 0 ").concat(d," ").concat(o," Z')"),arrowPolygon:m}}let a=(e,t,n)=>{let{sizePopupArrow:o,arrowPolygon:a,arrowPath:i,arrowShadowWidth:c,borderRadiusXS:l,calc:s}=e;return{pointerEvents:"none",width:o,height:o,overflow:"hidden","&::before":{position:"absolute",bottom:0,insetInlineStart:0,width:o,height:s(o).div(2).equal(),background:t,clipPath:{_multi_value_:!0,value:[a,i]},content:'""'},"&::after":{content:'""',position:"absolute",width:c,height:c,bottom:0,insetInline:0,margin:"auto",borderRadius:{_skip_check_:!0,value:"0 0 ".concat((0,r.bf)(l)," 0")},transform:"translateY(50%) rotate(-135deg)",boxShadow:n,zIndex:0,background:"transparent"}}}},25119:function(e,t,n){"use strict";n.d(t,{Mj:function(){return i},u_:function(){return a}});var r=n(2265),o=n(70774);let a={token:o.Z,override:{override:o.Z},hashed:!0},i=r.createContext(a)},53454:function(e,t,n){"use strict";n.d(t,{i:function(){return r}});let r=["blue","purple","cyan","green","magenta","pink","red","orange","yellow","volcano","geekblue","lime","gold"]},57862:function(e,t,n){"use strict";n.d(t,{Z:function(){return g}});var r=n(93463),o=n(57943),a=n(70774),i=n(54558),c=e=>{let t=e,n=e,r=e,o=e;return e<6&&e>=5?t=e+1:e<16&&e>=6?t=e+2:e>=16&&(t=16),e<7&&e>=5?n=4:e<8&&e>=7?n=5:e<14&&e>=8?n=6:e<16&&e>=14?n=7:e>=16&&(n=8),e<6&&e>=2?r=1:e>=6&&(r=2),e>4&&e<8?o=4:e>=8&&(o=6),{borderRadius:e,borderRadiusXS:r,borderRadiusSM:n,borderRadiusLG:t,borderRadiusOuter:o}},l=e=>{let{controlHeight:t}=e;return{controlHeightSM:.75*t,controlHeightXS:.5*t,controlHeightLG:1.25*t}},s=n(1319),u=e=>{let t=(0,s.Z)(e),n=t.map(e=>e.size),r=t.map(e=>e.lineHeight),o=n[1],a=n[0],i=n[2],c=r[1],l=r[0],u=r[2];return{fontSizeSM:a,fontSize:o,fontSizeLG:i,fontSizeXL:n[3],fontSizeHeading1:n[6],fontSizeHeading2:n[5],fontSizeHeading3:n[4],fontSizeHeading4:n[3],fontSizeHeading5:n[2],lineHeight:c,lineHeightLG:u,lineHeightSM:l,fontHeight:Math.round(c*o),fontHeightLG:Math.round(u*i),fontHeightSM:Math.round(l*a),lineHeightHeading1:r[6],lineHeightHeading2:r[5],lineHeightHeading3:r[4],lineHeightHeading4:r[3],lineHeightHeading5:r[2]}};let d=(e,t)=>new i.t(e).setA(t).toRgbString(),f=(e,t)=>new i.t(e).darken(t).toHexString(),p=e=>{let t=(0,o.R_)(e);return{1:t[0],2:t[1],3:t[2],4:t[3],5:t[4],6:t[5],7:t[6],8:t[4],9:t[5],10:t[6]}},m=(e,t)=>{let n=e||"#fff",r=t||"#000";return{colorBgBase:n,colorTextBase:r,colorText:d(r,.88),colorTextSecondary:d(r,.65),colorTextTertiary:d(r,.45),colorTextQuaternary:d(r,.25),colorFill:d(r,.15),colorFillSecondary:d(r,.06),colorFillTertiary:d(r,.04),colorFillQuaternary:d(r,.02),colorBgSolid:d(r,1),colorBgSolidHover:d(r,.75),colorBgSolidActive:d(r,.95),colorBgLayout:f(n,4),colorBgContainer:f(n,0),colorBgElevated:f(n,0),colorBgSpotlight:d(r,.85),colorBgBlur:"transparent",colorBorder:f(n,15),colorBorderSecondary:f(n,6)}};var g=(0,r.jG)(function(e){o.ez.pink=o.ez.magenta,o.Ti.pink=o.Ti.magenta;let t=Object.keys(a.M).map(t=>{let n=e[t]===o.ez[t]?o.Ti[t]:(0,o.R_)(e[t]);return Array.from({length:10},()=>1).reduce((e,r,o)=>(e["".concat(t,"-").concat(o+1)]=n[o],e["".concat(t).concat(o+1)]=n[o],e),{})}).reduce((e,t)=>e=Object.assign(Object.assign({},e),t),{});return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},e),t),function(e,t){let{generateColorPalettes:n,generateNeutralColorPalettes:r}=t,{colorSuccess:o,colorWarning:a,colorError:c,colorInfo:l,colorPrimary:s,colorBgBase:u,colorTextBase:d}=e,f=n(s),p=n(o),m=n(a),g=n(c),v=n(l),h=r(u,d),b=n(e.colorLink||e.colorInfo),y=new i.t(g[1]).mix(new i.t(g[3]),50).toHexString();return Object.assign(Object.assign({},h),{colorPrimaryBg:f[1],colorPrimaryBgHover:f[2],colorPrimaryBorder:f[3],colorPrimaryBorderHover:f[4],colorPrimaryHover:f[5],colorPrimary:f[6],colorPrimaryActive:f[7],colorPrimaryTextHover:f[8],colorPrimaryText:f[9],colorPrimaryTextActive:f[10],colorSuccessBg:p[1],colorSuccessBgHover:p[2],colorSuccessBorder:p[3],colorSuccessBorderHover:p[4],colorSuccessHover:p[4],colorSuccess:p[6],colorSuccessActive:p[7],colorSuccessTextHover:p[8],colorSuccessText:p[9],colorSuccessTextActive:p[10],colorErrorBg:g[1],colorErrorBgHover:g[2],colorErrorBgFilledHover:y,colorErrorBgActive:g[3],colorErrorBorder:g[3],colorErrorBorderHover:g[4],colorErrorHover:g[5],colorError:g[6],colorErrorActive:g[7],colorErrorTextHover:g[8],colorErrorText:g[9],colorErrorTextActive:g[10],colorWarningBg:m[1],colorWarningBgHover:m[2],colorWarningBorder:m[3],colorWarningBorderHover:m[4],colorWarningHover:m[4],colorWarning:m[6],colorWarningActive:m[7],colorWarningTextHover:m[8],colorWarningText:m[9],colorWarningTextActive:m[10],colorInfoBg:v[1],colorInfoBgHover:v[2],colorInfoBorder:v[3],colorInfoBorderHover:v[4],colorInfoHover:v[4],colorInfo:v[6],colorInfoActive:v[7],colorInfoTextHover:v[8],colorInfoText:v[9],colorInfoTextActive:v[10],colorLinkHover:b[4],colorLink:b[6],colorLinkActive:b[7],colorBgMask:new i.t("#000").setA(.45).toRgbString(),colorWhite:"#fff"})}(e,{generateColorPalettes:p,generateNeutralColorPalettes:m})),u(e.fontSize)),function(e){let{sizeUnit:t,sizeStep:n}=e;return{sizeXXL:t*(n+8),sizeXL:t*(n+4),sizeLG:t*(n+2),sizeMD:t*(n+1),sizeMS:t*n,size:t*n,sizeSM:t*(n-1),sizeXS:t*(n-2),sizeXXS:t*(n-3)}}(e)),l(e)),function(e){let{motionUnit:t,motionBase:n,borderRadius:r,lineWidth:o}=e;return Object.assign({motionDurationFast:"".concat((n+t).toFixed(1),"s"),motionDurationMid:"".concat((n+2*t).toFixed(1),"s"),motionDurationSlow:"".concat((n+3*t).toFixed(1),"s"),lineWidthBold:o+1},c(r))}(e))})},70774:function(e,t,n){"use strict";n.d(t,{M:function(){return r}});let r={blue:"#1677FF",purple:"#722ED1",cyan:"#13C2C2",green:"#52C41A",magenta:"#EB2F96",pink:"#EB2F96",red:"#F5222D",orange:"#FA8C16",yellow:"#FADB14",volcano:"#FA541C",geekblue:"#2F54EB",gold:"#FAAD14",lime:"#A0D911"},o=Object.assign(Object.assign({},r),{colorPrimary:"#1677ff",colorSuccess:"#52c41a",colorWarning:"#faad14",colorError:"#ff4d4f",colorInfo:"#1677ff",colorLink:"",colorTextBase:"",colorBgBase:"",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,\n'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',\n'Noto Color Emoji'",fontFamilyCode:"'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace",fontSize:14,lineWidth:1,lineType:"solid",motionUnit:.1,motionBase:0,motionEaseOutCirc:"cubic-bezier(0.08, 0.82, 0.17, 1)",motionEaseInOutCirc:"cubic-bezier(0.78, 0.14, 0.15, 0.86)",motionEaseOut:"cubic-bezier(0.215, 0.61, 0.355, 1)",motionEaseInOut:"cubic-bezier(0.645, 0.045, 0.355, 1)",motionEaseOutBack:"cubic-bezier(0.12, 0.4, 0.29, 1.46)",motionEaseInBack:"cubic-bezier(0.71, -0.46, 0.88, 0.6)",motionEaseInQuint:"cubic-bezier(0.755, 0.05, 0.855, 0.06)",motionEaseOutQuint:"cubic-bezier(0.23, 1, 0.32, 1)",borderRadius:6,sizeUnit:4,sizeStep:4,sizePopupArrow:16,controlHeight:32,zIndexBase:0,zIndexPopupBase:1e3,opacityImage:1,wireframe:!1,motion:!0});t.Z=o},1319:function(e,t,n){"use strict";function r(e){return(e+8)/e}function o(e){let t=Array.from({length:10}).map((t,n)=>{let r=e*Math.pow(Math.E,(n-1)/5);return 2*Math.floor((n>1?Math.floor(r):Math.ceil(r))/2)});return t[1]=e,t.map(e=>({size:e,lineHeight:r(e)}))}n.d(t,{D:function(){return r},Z:function(){return o}})},84951:function(e,t,n){"use strict";n.d(t,{ZP:function(){return h},NJ:function(){return p}});var r=n(2265),o=n(93463),a=n(25119),i=n(57862),c=n(70774),l=n(54558),s=n(17431),u=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 d(e){let{override:t}=e,n=u(e,["override"]),r=Object.assign({},t);Object.keys(c.Z).forEach(e=>{delete r[e]});let o=Object.assign(Object.assign({},n),r);return!1===o.motion&&(o.motionDurationFast="0s",o.motionDurationMid="0s",o.motionDurationSlow="0s"),Object.assign(Object.assign(Object.assign({},o),{colorFillContent:o.colorFillSecondary,colorFillContentHover:o.colorFill,colorFillAlter:o.colorFillQuaternary,colorBgContainerDisabled:o.colorFillTertiary,colorBorderBg:o.colorBgContainer,colorSplit:(0,s.Z)(o.colorBorderSecondary,o.colorBgContainer),colorTextPlaceholder:o.colorTextQuaternary,colorTextDisabled:o.colorTextQuaternary,colorTextHeading:o.colorText,colorTextLabel:o.colorTextSecondary,colorTextDescription:o.colorTextTertiary,colorTextLightSolid:o.colorWhite,colorHighlight:o.colorError,colorBgTextHover:o.colorFillSecondary,colorBgTextActive:o.colorFill,colorIcon:o.colorTextTertiary,colorIconHover:o.colorText,colorErrorOutline:(0,s.Z)(o.colorErrorBg,o.colorBgContainer),colorWarningOutline:(0,s.Z)(o.colorWarningBg,o.colorBgContainer),fontSizeIcon:o.fontSizeSM,lineWidthFocus:3*o.lineWidth,lineWidth:o.lineWidth,controlOutlineWidth:2*o.lineWidth,controlInteractiveSize:o.controlHeight/2,controlItemBgHover:o.colorFillTertiary,controlItemBgActive:o.colorPrimaryBg,controlItemBgActiveHover:o.colorPrimaryBgHover,controlItemBgActiveDisabled:o.colorFill,controlTmpOutline:o.colorFillQuaternary,controlOutline:(0,s.Z)(o.colorPrimaryBg,o.colorBgContainer),lineType:o.lineType,borderRadius:o.borderRadius,borderRadiusXS:o.borderRadiusXS,borderRadiusSM:o.borderRadiusSM,borderRadiusLG:o.borderRadiusLG,fontWeightStrong:600,opacityLoading:.65,linkDecoration:"none",linkHoverDecoration:"none",linkFocusDecoration:"none",controlPaddingHorizontal:12,controlPaddingHorizontalSM:8,paddingXXS:o.sizeXXS,paddingXS:o.sizeXS,paddingSM:o.sizeSM,padding:o.size,paddingMD:o.sizeMD,paddingLG:o.sizeLG,paddingXL:o.sizeXL,paddingContentHorizontalLG:o.sizeLG,paddingContentVerticalLG:o.sizeMS,paddingContentHorizontal:o.sizeMS,paddingContentVertical:o.sizeSM,paddingContentHorizontalSM:o.size,paddingContentVerticalSM:o.sizeXS,marginXXS:o.sizeXXS,marginXS:o.sizeXS,marginSM:o.sizeSM,margin:o.size,marginMD:o.sizeMD,marginLG:o.sizeLG,marginXL:o.sizeXL,marginXXL:o.sizeXXL,boxShadow:"\n 0 6px 16px 0 rgba(0, 0, 0, 0.08),\n 0 3px 6px -4px rgba(0, 0, 0, 0.12),\n 0 9px 28px 8px rgba(0, 0, 0, 0.05)\n ",boxShadowSecondary:"\n 0 6px 16px 0 rgba(0, 0, 0, 0.08),\n 0 3px 6px -4px rgba(0, 0, 0, 0.12),\n 0 9px 28px 8px rgba(0, 0, 0, 0.05)\n ",boxShadowTertiary:"\n 0 1px 2px 0 rgba(0, 0, 0, 0.03),\n 0 1px 6px -1px rgba(0, 0, 0, 0.02),\n 0 2px 4px 0 rgba(0, 0, 0, 0.02)\n ",screenXS:480,screenXSMin:480,screenXSMax:575,screenSM:576,screenSMMin:576,screenSMMax:767,screenMD:768,screenMDMin:768,screenMDMax:991,screenLG:992,screenLGMin:992,screenLGMax:1199,screenXL:1200,screenXLMin:1200,screenXLMax:1599,screenXXL:1600,screenXXLMin:1600,boxShadowPopoverArrow:"2px 2px 5px rgba(0, 0, 0, 0.05)",boxShadowCard:"\n 0 1px 2px -2px ".concat(new l.t("rgba(0, 0, 0, 0.16)").toRgbString(),",\n 0 3px 6px 0 ").concat(new l.t("rgba(0, 0, 0, 0.12)").toRgbString(),",\n 0 5px 12px 4px ").concat(new l.t("rgba(0, 0, 0, 0.09)").toRgbString(),"\n "),boxShadowDrawerRight:"\n -6px 0 16px 0 rgba(0, 0, 0, 0.08),\n -3px 0 6px -4px rgba(0, 0, 0, 0.12),\n -9px 0 28px 8px rgba(0, 0, 0, 0.05)\n ",boxShadowDrawerLeft:"\n 6px 0 16px 0 rgba(0, 0, 0, 0.08),\n 3px 0 6px -4px rgba(0, 0, 0, 0.12),\n 9px 0 28px 8px rgba(0, 0, 0, 0.05)\n ",boxShadowDrawerUp:"\n 0 6px 16px 0 rgba(0, 0, 0, 0.08),\n 0 3px 6px -4px rgba(0, 0, 0, 0.12),\n 0 9px 28px 8px rgba(0, 0, 0, 0.05)\n ",boxShadowDrawerDown:"\n 0 -6px 16px 0 rgba(0, 0, 0, 0.08),\n 0 -3px 6px -4px rgba(0, 0, 0, 0.12),\n 0 -9px 28px 8px rgba(0, 0, 0, 0.05)\n ",boxShadowTabsOverflowLeft:"inset 10px 0 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowRight:"inset -10px 0 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowTop:"inset 0 10px 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowBottom:"inset 0 -10px 8px -8px rgba(0, 0, 0, 0.08)"}),r)}var f=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 p={lineHeight:!0,lineHeightSM:!0,lineHeightLG:!0,lineHeightHeading1:!0,lineHeightHeading2:!0,lineHeightHeading3:!0,lineHeightHeading4:!0,lineHeightHeading5:!0,opacityLoading:!0,fontWeightStrong:!0,zIndexPopupBase:!0,zIndexBase:!0,opacityImage:!0},m={motionBase:!0,motionUnit:!0},g={screenXS:!0,screenXSMin:!0,screenXSMax:!0,screenSM:!0,screenSMMin:!0,screenSMMax:!0,screenMD:!0,screenMDMin:!0,screenMDMax:!0,screenLG:!0,screenLGMin:!0,screenLGMax:!0,screenXL:!0,screenXLMin:!0,screenXLMax:!0,screenXXL:!0,screenXXLMin:!0},v=(e,t,n)=>{let r=n.getDerivativeToken(e),{override:o}=t,a=f(t,["override"]),i=Object.assign(Object.assign({},r),{override:o});return i=d(i),a&&Object.entries(a).forEach(e=>{let[t,n]=e,{theme:r}=n,o=f(n,["theme"]),a=o;r&&(a=v(Object.assign(Object.assign({},i),o),{override:o},r)),i[t]=a}),i};function h(){let{token:e,hashed:t,theme:n,override:l,cssVar:s}=r.useContext(a.Mj),u="".concat("5.29.1","-").concat(t||""),f=n||i.Z,[h,b,y]=(0,o.fp)(f,[c.Z,e],{salt:u,override:l,getComputedToken:v,formatToken:d,cssVar:s&&{prefix:s.prefix,key:s.key,unitless:p,ignore:m,preserve:g}});return[f,y,t?b:"",h,s]}},18536:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(53454);function o(e,t){return r.i.reduce((n,r)=>{let o=e["".concat(r,"1")],a=e["".concat(r,"3")],i=e["".concat(r,"6")],c=e["".concat(r,"7")];return Object.assign(Object.assign({},n),t(r,{lightColor:o,lightBorderColor:a,darkColor:i,textColor:c}))},{})}},99320:function(e,t,n){"use strict";n.d(t,{A1:function(){return s},I$:function(){return l},bk:function(){return u}});var r=n(2265),o=n(71140),a=n(71744),i=n(12918),c=n(84951);let{genStyleHooks:l,genComponentStyleHook:s,genSubStyleComponent:u}=(0,o.rb)({usePrefix:()=>{let{getPrefixCls:e,iconPrefixCls:t}=(0,r.useContext)(a.E_);return{rootPrefixCls:e(),iconPrefixCls:t}},useToken:()=>{let[e,t,n,r,o]=(0,c.ZP)();return{theme:e,realToken:t,hashId:n,token:r,cssVar:o}},useCSP:()=>{let{csp:e}=(0,r.useContext)(a.E_);return null!=e?e:{}},getResetStyles:(e,t)=>{var n;let r=(0,i.Lx)(e);return[r,{"&":r},(0,i.JT)(null!==(n=null==t?void 0:t.prefix.iconPrefixCls)&&void 0!==n?n:a.oR)]},getCommonStyle:i.du,getCompUnitless:()=>c.NJ})},17431:function(e,t,n){"use strict";var r=n(54558);function o(e){return e>=0&&e<=255}t.Z=function(e,t){let{r:n,g:a,b:i,a:c}=new r.t(e).toRgb();if(c<1)return e;let{r:l,g:s,b:u}=new r.t(t).toRgb();for(let e=.01;e<=1;e+=.01){let t=Math.round((n-l*(1-e))/e),c=Math.round((a-s*(1-e))/e),d=Math.round((i-u*(1-e))/e);if(o(t)&&o(c)&&o(d))return new r.t({r:t,g:c,b:d,a:Math.round(100*e)/100}).toRgbString()}return new r.t({r:n,g:a,b:i,a:1}).toRgbString()}},99981:function(e,t,n){"use strict";n.d(t,{Z:function(){return F}});var r=n(2265),o=n(36760),a=n.n(o),i=n(5769),c=n(50506),l=n(391),s=n(62236),u=n(68710),d=n(92736),f=n(19722),p=n(13613),m=n(95140),g=n(71744),v=n(84951),h=n(93463),b=n(12918),y=n(691),x=n(88260),w=n(34442),E=n(18536),C=n(71140),Z=n(99320);let S=e=>{let{calc:t,componentCls:n,tooltipMaxWidth:r,tooltipColor:o,tooltipBg:a,tooltipBorderRadius:i,zIndexPopup:c,controlHeight:l,boxShadowSecondary:s,paddingSM:u,paddingXS:d,arrowOffsetHorizontal:f,sizePopupArrow:p}=e,m=t(i).add(p).add(f).equal(),g=t(i).mul(2).add(p).equal();return[{[n]:Object.assign(Object.assign(Object.assign(Object.assign({},(0,b.Wf)(e)),{position:"absolute",zIndex:c,display:"block",width:"max-content",maxWidth:r,visibility:"visible","--valid-offset-x":"var(--arrow-offset-horizontal, var(--arrow-x))",transformOrigin:"var(--valid-offset-x, 50%) var(--arrow-y, 50%)","&-hidden":{display:"none"},"--antd-arrow-background-color":a,["".concat(n,"-inner")]:{minWidth:g,minHeight:l,padding:"".concat((0,h.bf)(e.calc(u).div(2).equal())," ").concat((0,h.bf)(d)),color:"var(--ant-tooltip-color, ".concat(o,")"),textAlign:"start",textDecoration:"none",wordWrap:"break-word",backgroundColor:a,borderRadius:i,boxShadow:s,boxSizing:"border-box"},"&-placement-topLeft,&-placement-topRight,&-placement-bottomLeft,&-placement-bottomRight":{minWidth:m},"&-placement-left,&-placement-leftTop,&-placement-leftBottom,&-placement-right,&-placement-rightTop,&-placement-rightBottom":{["".concat(n,"-inner")]:{borderRadius:e.min(i,x.qN)}},["".concat(n,"-content")]:{position:"relative"}}),(0,E.Z)(e,(e,t)=>{let{darkColor:r}=t;return{["&".concat(n,"-").concat(e)]:{["".concat(n,"-inner")]:{backgroundColor:r},["".concat(n,"-arrow")]:{"--antd-arrow-background-color":r}}}})),{"&-rtl":{direction:"rtl"}})},(0,x.ZP)(e,"var(--antd-arrow-background-color)"),{["".concat(n,"-pure")]:{position:"relative",maxWidth:"none",margin:e.sizePopupArrow}}]},O=e=>Object.assign(Object.assign({zIndexPopup:e.zIndexPopupBase+70},(0,x.wZ)({contentRadius:e.borderRadius,limitVerticalRadius:!0})),(0,w.w)((0,C.IX)(e,{borderRadiusOuter:Math.min(e.borderRadiusOuter,4)})));function k(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return(0,Z.I$)("Tooltip",e=>{let{borderRadius:t,colorTextLightSolid:n,colorBgSpotlight:r}=e;return[S((0,C.IX)(e,{tooltipMaxWidth:250,tooltipColor:n,tooltipBorderRadius:t,tooltipBg:r})),(0,y._y)(e,"zoom-big-fast")]},O,{resetStyle:!1,injectStyle:t})(e)}var j=n(93350);n(75669);var I=n(11357);let M=e=>e instanceof I.y9?e:new I.y9(e);function R(e,t){let n=(0,j.o2)(t),r=a()({["".concat(e,"-").concat(t)]:t&&n}),o={},i={},c=M(t).toRgb(),l=(.299*c.r+.587*c.g+.114*c.b)/255;return t&&!n&&(o.background=t,o["--ant-tooltip-color"]=l<.5?"#FFF":"#000",i["--antd-arrow-background-color"]=t),{className:r,overlayStyle:o,arrowStyle:i}}var N=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 P=r.forwardRef((e,t)=>{var n,o;let{prefixCls:h,openClassName:b,getTooltipContainer:y,color:x,overlayInnerStyle:w,children:E,afterOpenChange:C,afterVisibleChange:Z,destroyTooltipOnHide:S,destroyOnHidden:O,arrow:j=!0,title:I,overlay:M,builtinPlacements:P,arrowPointAtCenter:F=!1,autoAdjustOverflow:T=!0,motion:A,getPopupContainer:_,placement:B="top",mouseEnterDelay:H=.1,mouseLeaveDelay:z=.1,overlayStyle:L,rootClassName:D,overlayClassName:W,styles:V,classNames:q}=e,X=N(e,["prefixCls","openClassName","getTooltipContainer","color","overlayInnerStyle","children","afterOpenChange","afterVisibleChange","destroyTooltipOnHide","destroyOnHidden","arrow","title","overlay","builtinPlacements","arrowPointAtCenter","autoAdjustOverflow","motion","getPopupContainer","placement","mouseEnterDelay","mouseLeaveDelay","overlayStyle","rootClassName","overlayClassName","styles","classNames"]),G=!!j,[,U]=(0,v.ZP)(),{getPopupContainer:$,getPrefixCls:K,direction:Y,className:Q,style:J,classNames:ee,styles:et}=(0,g.dj)("tooltip"),en=(0,p.ln)("Tooltip"),er=r.useRef(null),eo=()=>{var e;null===(e=er.current)||void 0===e||e.forceAlign()};r.useImperativeHandle(t,()=>{var e,t;return{forceAlign:eo,forcePopupAlign:()=>{en.deprecated(!1,"forcePopupAlign","forceAlign"),eo()},nativeElement:null===(e=er.current)||void 0===e?void 0:e.nativeElement,popupElement:null===(t=er.current)||void 0===t?void 0:t.popupElement}});let[ea,ei]=(0,c.Z)(!1,{value:null!==(n=e.open)&&void 0!==n?n:e.visible,defaultValue:null!==(o=e.defaultOpen)&&void 0!==o?o:e.defaultVisible}),ec=!I&&!M&&0!==I,el=r.useMemo(()=>{var e,t;let n=F;return"object"==typeof j&&(n=null!==(t=null!==(e=j.pointAtCenter)&&void 0!==e?e:j.arrowPointAtCenter)&&void 0!==t?t:F),P||(0,d.Z)({arrowPointAtCenter:n,autoAdjustOverflow:T,arrowWidth:G?U.sizePopupArrow:0,borderRadius:U.borderRadius,offset:U.marginXXS,visibleFirst:!0})},[F,j,P,U]),es=r.useMemo(()=>0===I?I:M||I||"",[M,I]),eu=r.createElement(l.Z,{space:!0},"function"==typeof es?es():es),ed=K("tooltip",h),ef=K(),ep=e["data-popover-inject"],em=ea;"open"in e||"visible"in e||!ec||(em=!1);let eg=r.isValidElement(E)&&!(0,f.M2)(E)?E:r.createElement("span",null,E),ev=eg.props,eh=ev.className&&"string"!=typeof ev.className?ev.className:a()(ev.className,b||"".concat(ed,"-open")),[eb,ey,ex]=k(ed,!ep),ew=R(ed,x),eE=ew.arrowStyle,eC=a()(W,{["".concat(ed,"-rtl")]:"rtl"===Y},ew.className,D,ey,ex,Q,ee.root,null==q?void 0:q.root),eZ=a()(ee.body,null==q?void 0:q.body),[eS,eO]=(0,s.Cn)("Tooltip",X.zIndex),ek=r.createElement(i.Z,Object.assign({},X,{zIndex:eS,showArrow:G,placement:B,mouseEnterDelay:H,mouseLeaveDelay:z,prefixCls:ed,classNames:{root:eC,body:eZ},styles:{root:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},eE),et.root),J),L),null==V?void 0:V.root),body:Object.assign(Object.assign(Object.assign(Object.assign({},et.body),w),null==V?void 0:V.body),ew.overlayStyle)},getTooltipContainer:_||y||$,ref:er,builtinPlacements:el,overlay:eu,visible:em,onVisibleChange:t=>{var n,r;ei(!ec&&t),ec||(null===(n=e.onOpenChange)||void 0===n||n.call(e,t),null===(r=e.onVisibleChange)||void 0===r||r.call(e,t))},afterVisibleChange:null!=C?C:Z,arrowContent:r.createElement("span",{className:"".concat(ed,"-arrow-content")}),motion:{motionName:(0,u.m)(ef,"zoom-big-fast",e.transitionName),motionDeadline:1e3},destroyTooltipOnHide:null!=O?O:!!S}),em?(0,f.Tm)(eg,{className:eh}):eg);return eb(r.createElement(m.Z.Provider,{value:eO},ek))});P._InternalPanelDoNotUseOrYouWillBeFired=e=>{let{prefixCls:t,className:n,placement:o="top",title:c,color:l,overlayInnerStyle:s}=e,{getPrefixCls:u}=r.useContext(g.E_),d=u("tooltip",t),[f,p,m]=k(d),v=R(d,l),h=v.arrowStyle,b=Object.assign(Object.assign({},s),v.overlayStyle),y=a()(p,m,d,"".concat(d,"-pure"),"".concat(d,"-placement-").concat(o),n,v.className);return f(r.createElement("div",{className:y,style:h},r.createElement("div",{className:"".concat(d,"-arrow")}),r.createElement(i.G,Object.assign({},e,{className:p,prefixCls:d,overlayInnerStyle:b}),c)))};var F=P},99376:function(e,t,n){"use strict";var r=n(35475);n.o(r,"usePathname")&&n.d(t,{usePathname:function(){return r.usePathname}}),n.o(r,"useRouter")&&n.d(t,{useRouter:function(){return r.useRouter}}),n.o(r,"useSearchParams")&&n.d(t,{useSearchParams:function(){return r.useSearchParams}})},40257:function(e,t,n){"use strict";var r,o;e.exports=(null==(r=n.g.process)?void 0:r.env)&&"object"==typeof(null==(o=n.g.process)?void 0:o.env)?n.g.process:n(44227)},44227:function(e){!function(){var t={229:function(e){var t,n,r,o=e.exports={};function a(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function c(e){if(t===setTimeout)return setTimeout(e,0);if((t===a||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:a}catch(e){t=a}try{n="function"==typeof clearTimeout?clearTimeout:i}catch(e){n=i}}();var l=[],s=!1,u=-1;function d(){s&&r&&(s=!1,r.length?l=r.concat(l):u=-1,l.length&&f())}function f(){if(!s){var e=c(d);s=!0;for(var t=l.length;t;){for(r=l,l=[];++u1)for(var n=1;n1?t-1:0),r=1;r=a)return e;switch(e){case"%s":return String(n[o++]);case"%d":return Number(n[o++]);case"%j":try{return JSON.stringify(n[o++])}catch(e){return"[Circular]"}break;default:return e}}):e}function A(e,t){return!!(null==e||"array"===t&&Array.isArray(e)&&!e.length)||("string"===t||"url"===t||"hex"===t||"email"===t||"date"===t||"pattern"===t)&&"string"==typeof e&&!e}function _(e,t,n){var r=0,o=e.length;!function a(i){if(i&&i.length){n(i);return}var c=r;r+=1,c()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/,hex:/^#?([a-f0-9]{6}|[a-f0-9]{3})$/i},q={integer:function(e){return q.number(e)&&parseInt(e,10)===e},float:function(e){return q.number(e)&&!q.integer(e)},array:function(e){return Array.isArray(e)},regexp:function(e){if(e instanceof RegExp)return!0;try{return new RegExp(e),!0}catch(e){return!1}},date:function(e){return"function"==typeof e.getTime&&"function"==typeof e.getMonth&&"function"==typeof e.getYear&&!isNaN(e.getTime())},number:function(e){return!isNaN(e)&&"number"==typeof e},object:function(e){return"object"===(0,S.Z)(e)&&!q.array(e)},method:function(e){return"function"==typeof e},email:function(e){return"string"==typeof e&&e.length<=320&&!!e.match(V.email)},url:function(e){return"string"==typeof e&&e.length<=2048&&!!e.match(W())},hex:function(e){return"string"==typeof e&&!!e.match(V.hex)}},X={required:D,whitespace:function(e,t,n,r,o){(/^\s+$/.test(t)||""===t)&&r.push(T(o.messages.whitespace,e.fullField))},type:function(e,t,n,r,o){if(e.required&&void 0===t){D(e,t,n,r,o);return}var a=e.type;["integer","float","array","regexp","object","method","email","number","date","url","hex"].indexOf(a)>-1?q[a](t)||r.push(T(o.messages.types[a],e.fullField,e.type)):a&&(0,S.Z)(t)!==e.type&&r.push(T(o.messages.types[a],e.fullField,e.type))},range:function(e,t,n,r,o){var a="number"==typeof e.len,i="number"==typeof e.min,c="number"==typeof e.max,l=t,s=null,u="number"==typeof t,d="string"==typeof t,f=Array.isArray(t);if(u?s="number":d?s="string":f&&(s="array"),!s)return!1;f&&(l=t.length),d&&(l=t.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"_").length),a?l!==e.len&&r.push(T(o.messages[s].len,e.fullField,e.len)):i&&!c&&le.max?r.push(T(o.messages[s].max,e.fullField,e.max)):i&&c&&(le.max)&&r.push(T(o.messages[s].range,e.fullField,e.min,e.max))},enum:function(e,t,n,r,o){e[L]=Array.isArray(e[L])?e[L]:[],-1===e[L].indexOf(t)&&r.push(T(o.messages[L],e.fullField,e[L].join(", ")))},pattern:function(e,t,n,r,o){!e.pattern||(e.pattern instanceof RegExp?(e.pattern.lastIndex=0,e.pattern.test(t)||r.push(T(o.messages.pattern.mismatch,e.fullField,t,e.pattern))):"string"!=typeof e.pattern||new RegExp(e.pattern).test(t)||r.push(T(o.messages.pattern.mismatch,e.fullField,t,e.pattern)))}},G=function(e,t,n,r,o){var a=e.type,i=[];if(e.required||!e.required&&r.hasOwnProperty(e.field)){if(A(t,a)&&!e.required)return n();X.required(e,t,r,i,o,a),A(t,a)||X.type(e,t,r,i,o)}n(i)},U={string:function(e,t,n,r,o){var a=[];if(e.required||!e.required&&r.hasOwnProperty(e.field)){if(A(t,"string")&&!e.required)return n();X.required(e,t,r,a,o,"string"),A(t,"string")||(X.type(e,t,r,a,o),X.range(e,t,r,a,o),X.pattern(e,t,r,a,o),!0===e.whitespace&&X.whitespace(e,t,r,a,o))}n(a)},method:function(e,t,n,r,o){var a=[];if(e.required||!e.required&&r.hasOwnProperty(e.field)){if(A(t)&&!e.required)return n();X.required(e,t,r,a,o),void 0!==t&&X.type(e,t,r,a,o)}n(a)},number:function(e,t,n,r,o){var a=[];if(e.required||!e.required&&r.hasOwnProperty(e.field)){if(""===t&&(t=void 0),A(t)&&!e.required)return n();X.required(e,t,r,a,o),void 0!==t&&(X.type(e,t,r,a,o),X.range(e,t,r,a,o))}n(a)},boolean:function(e,t,n,r,o){var a=[];if(e.required||!e.required&&r.hasOwnProperty(e.field)){if(A(t)&&!e.required)return n();X.required(e,t,r,a,o),void 0!==t&&X.type(e,t,r,a,o)}n(a)},regexp:function(e,t,n,r,o){var a=[];if(e.required||!e.required&&r.hasOwnProperty(e.field)){if(A(t)&&!e.required)return n();X.required(e,t,r,a,o),A(t)||X.type(e,t,r,a,o)}n(a)},integer:function(e,t,n,r,o){var a=[];if(e.required||!e.required&&r.hasOwnProperty(e.field)){if(A(t)&&!e.required)return n();X.required(e,t,r,a,o),void 0!==t&&(X.type(e,t,r,a,o),X.range(e,t,r,a,o))}n(a)},float:function(e,t,n,r,o){var a=[];if(e.required||!e.required&&r.hasOwnProperty(e.field)){if(A(t)&&!e.required)return n();X.required(e,t,r,a,o),void 0!==t&&(X.type(e,t,r,a,o),X.range(e,t,r,a,o))}n(a)},array:function(e,t,n,r,o){var a=[];if(e.required||!e.required&&r.hasOwnProperty(e.field)){if(null==t&&!e.required)return n();X.required(e,t,r,a,o,"array"),null!=t&&(X.type(e,t,r,a,o),X.range(e,t,r,a,o))}n(a)},object:function(e,t,n,r,o){var a=[];if(e.required||!e.required&&r.hasOwnProperty(e.field)){if(A(t)&&!e.required)return n();X.required(e,t,r,a,o),void 0!==t&&X.type(e,t,r,a,o)}n(a)},enum:function(e,t,n,r,o){var a=[];if(e.required||!e.required&&r.hasOwnProperty(e.field)){if(A(t)&&!e.required)return n();X.required(e,t,r,a,o),void 0!==t&&X.enum(e,t,r,a,o)}n(a)},pattern:function(e,t,n,r,o){var a=[];if(e.required||!e.required&&r.hasOwnProperty(e.field)){if(A(t,"string")&&!e.required)return n();X.required(e,t,r,a,o),A(t,"string")||X.pattern(e,t,r,a,o)}n(a)},date:function(e,t,n,r,o){var a,i=[];if(e.required||!e.required&&r.hasOwnProperty(e.field)){if(A(t,"date")&&!e.required)return n();X.required(e,t,r,i,o),!A(t,"date")&&(a=t instanceof Date?t:new Date(t),X.type(e,a,r,i,o),a&&X.range(e,a.getTime(),r,i,o))}n(i)},url:G,hex:G,email:G,required:function(e,t,n,r,o){var a=[],i=Array.isArray(t)?"array":(0,S.Z)(t);X.required(e,t,r,a,o,i),n(a)},any:function(e,t,n,r,o){var a=[];if(e.required||!e.required&&r.hasOwnProperty(e.field)){if(A(t)&&!e.required)return n();X.required(e,t,r,a,o)}n(a)}},$=function(){function e(t){(0,d.Z)(this,e),(0,v.Z)(this,"rules",null),(0,v.Z)(this,"_messages",k),this.define(t)}return(0,f.Z)(e,[{key:"define",value:function(e){var t=this;if(!e)throw Error("Cannot configure a schema with no rules");if("object"!==(0,S.Z)(e)||Array.isArray(e))throw Error("Rules must be an object");this.rules={},Object.keys(e).forEach(function(n){var r=e[n];t.rules[n]=Array.isArray(r)?r:[r]})}},{key:"messages",value:function(e){return e&&(this._messages=z(O(),e)),this._messages}},{key:"validate",value:function(t){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},a=t,i=r,c=o;if("function"==typeof i&&(c=i,i={}),!this.rules||0===Object.keys(this.rules).length)return c&&c(null,a),Promise.resolve(a);if(i.messages){var l=this.messages();l===k&&(l=O()),z(l,i.messages),i.messages=l}else i.messages=this.messages();var d={};(i.keys||Object.keys(this.rules)).forEach(function(e){var r=n.rules[e],o=a[e];r.forEach(function(r){var i=r;"function"==typeof i.transform&&(a===t&&(a=(0,s.Z)({},a)),null!=(o=a[e]=i.transform(o))&&(i.type=i.type||(Array.isArray(o)?"array":(0,S.Z)(o)))),(i="function"==typeof i?{validator:i}:(0,s.Z)({},i)).validator=n.getValidationMethod(i),i.validator&&(i.field=e,i.fullField=i.fullField||e,i.type=n.getType(i),d[e]=d[e]||[],d[e].push({rule:i,value:o,source:a,field:e}))})});var f={};return function(e,t,n,r,o){if(t.first){var a=new Promise(function(t,a){var i;_((i=[],Object.keys(e).forEach(function(t){i.push.apply(i,(0,u.Z)(e[t]||[]))}),i),n,function(e){return r(e),e.length?a(new B(e,F(e))):t(o)})});return a.catch(function(e){return e}),a}var i=!0===t.firstFields?Object.keys(e):t.firstFields||[],c=Object.keys(e),l=c.length,s=0,d=[],f=new Promise(function(t,a){var f=function(e){if(d.push.apply(d,e),++s===l)return r(d),d.length?a(new B(d,F(d))):t(o)};c.length||(r(d),t(o)),c.forEach(function(t){var r=e[t];-1!==i.indexOf(t)?_(r,n,f):function(e,t,n){var r=[],o=0,a=e.length;function i(e){r.push.apply(r,(0,u.Z)(e||[])),++o===a&&n(r)}e.forEach(function(e){t(e,i)})}(r,n,f)})});return f.catch(function(e){return e}),f}(d,i,function(t,n){var r,o,c,l=t.rule,d=("object"===l.type||"array"===l.type)&&("object"===(0,S.Z)(l.fields)||"object"===(0,S.Z)(l.defaultField));function p(e,t){return(0,s.Z)((0,s.Z)({},t),{},{fullField:"".concat(l.fullField,".").concat(e),fullFields:l.fullFields?[].concat((0,u.Z)(l.fullFields),[e]):[e]})}function m(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],o=Array.isArray(r)?r:[r];!i.suppressWarning&&o.length&&e.warning("async-validator:",o),o.length&&void 0!==l.message&&(o=[].concat(l.message));var c=o.map(H(l,a));if(i.first&&c.length)return f[l.field]=1,n(c);if(d){if(l.required&&!t.value)return void 0!==l.message?c=[].concat(l.message).map(H(l,a)):i.error&&(c=[i.error(l,T(i.messages.required,l.field))]),n(c);var m={};l.defaultField&&Object.keys(t.value).map(function(e){m[e]=l.defaultField});var g={};Object.keys(m=(0,s.Z)((0,s.Z)({},m),t.rule.fields)).forEach(function(e){var t=m[e],n=Array.isArray(t)?t:[t];g[e]=n.map(p.bind(null,e))});var v=new e(g);v.messages(i.messages),t.rule.options&&(t.rule.options.messages=i.messages,t.rule.options.error=i.error),v.validate(t.value,t.rule.options||i,function(e){var t=[];c&&c.length&&t.push.apply(t,(0,u.Z)(c)),e&&e.length&&t.push.apply(t,(0,u.Z)(e)),n(t.length?t:null)})}else n(c)}if(d=d&&(l.required||!l.required&&t.value),l.field=t.field,l.asyncValidator)r=l.asyncValidator(l,t.value,m,t.source,i);else if(l.validator){try{r=l.validator(l,t.value,m,t.source,i)}catch(e){null===(o=(c=console).error)||void 0===o||o.call(c,e),i.suppressValidatorError||setTimeout(function(){throw e},0),m(e.message)}!0===r?m():!1===r?m("function"==typeof l.message?l.message(l.fullField||l.field):l.message||"".concat(l.fullField||l.field," fails")):r instanceof Array?m(r):r instanceof Error&&m(r.message)}r&&r.then&&r.then(function(){return m()},function(e){return m(e)})},function(e){!function(e){for(var t=[],n={},r=0;r0)){e.next=23;break}return e.next=21,Promise.all(n.map(function(e,n){return ee("".concat(t,".").concat(n),e,f,a,i)}));case 21:return h=e.sent,e.abrupt("return",h.reduce(function(e,t){return[].concat((0,u.Z)(e),(0,u.Z)(t))},[]));case 23:return b=(0,s.Z)((0,s.Z)({},r),{},{name:t,enum:(r.enum||[]).join(", ")},i),y=g.map(function(e){return"string"==typeof e?function(e,t){return e.replace(/\\?\$\{\w+\}/g,function(e){return e.startsWith("\\")?e.slice(1):t[e.slice(2,-1)]})}(e,b):e}),e.abrupt("return",y);case 26:case"end":return e.stop()}},e,null,[[10,15]])}))).apply(this,arguments)}function en(){return(en=(0,l.Z)((0,c.Z)().mark(function e(t){return(0,c.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Promise.all(t).then(function(e){var t;return(t=[]).concat.apply(t,(0,u.Z)(e))}));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function er(){return(er=(0,l.Z)((0,c.Z)().mark(function e(t){var n;return(0,c.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=0,e.abrupt("return",new Promise(function(e){t.forEach(function(r){r.then(function(r){r.errors.length&&e([r]),(n+=1)===t.length&&e([])})})}));case 2:case"end":return e.stop()}},e)}))).apply(this,arguments)}var eo=n(16847);function ea(e){return Z(e)}function ei(e,t){var n={};return t.forEach(function(t){var r=(0,eo.Z)(e,t);n=(0,Q.Z)(n,t,r)}),n}function ec(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return e&&e.some(function(e){return el(t,e,n)})}function el(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return!!e&&!!t&&(!!n||e.length===t.length)&&t.every(function(t,n){return e[n]===t})}function es(e){var t=arguments.length<=1?void 0:arguments[1];return t&&t.target&&"object"===(0,S.Z)(t.target)&&e in t.target?t.target[e]:t}function eu(e,t,n){var r=e.length;if(t<0||t>=r||n<0||n>=r)return e;var o=e[t],a=t-n;return a>0?[].concat((0,u.Z)(e.slice(0,n)),[o],(0,u.Z)(e.slice(n,t)),(0,u.Z)(e.slice(t+1,r))):a<0?[].concat((0,u.Z)(e.slice(0,t)),(0,u.Z)(e.slice(t+1,n+1)),[o],(0,u.Z)(e.slice(n+1,r))):e}var ed=["name"],ef=[];function ep(e,t,n,r,o,a){return"function"==typeof e?e(t,n,"source"in a?{source:a.source}:{}):r!==o}var em=function(e){(0,m.Z)(n,e);var t=(0,g.Z)(n);function n(e){var r;return(0,d.Z)(this,n),r=t.call(this,e),(0,v.Z)((0,p.Z)(r),"state",{resetCount:0}),(0,v.Z)((0,p.Z)(r),"cancelRegisterFunc",null),(0,v.Z)((0,p.Z)(r),"mounted",!1),(0,v.Z)((0,p.Z)(r),"touched",!1),(0,v.Z)((0,p.Z)(r),"dirty",!1),(0,v.Z)((0,p.Z)(r),"validatePromise",void 0),(0,v.Z)((0,p.Z)(r),"prevValidating",void 0),(0,v.Z)((0,p.Z)(r),"errors",ef),(0,v.Z)((0,p.Z)(r),"warnings",ef),(0,v.Z)((0,p.Z)(r),"cancelRegister",function(){var e=r.props,t=e.preserve,n=e.isListField,o=e.name;r.cancelRegisterFunc&&r.cancelRegisterFunc(n,t,ea(o)),r.cancelRegisterFunc=null}),(0,v.Z)((0,p.Z)(r),"getNamePath",function(){var e=r.props,t=e.name,n=e.fieldContext.prefixName;return void 0!==t?[].concat((0,u.Z)(void 0===n?[]:n),(0,u.Z)(t)):[]}),(0,v.Z)((0,p.Z)(r),"getRules",function(){var e=r.props,t=e.rules,n=e.fieldContext;return(void 0===t?[]:t).map(function(e){return"function"==typeof e?e(n):e})}),(0,v.Z)((0,p.Z)(r),"refresh",function(){r.mounted&&r.setState(function(e){return{resetCount:e.resetCount+1}})}),(0,v.Z)((0,p.Z)(r),"metaCache",null),(0,v.Z)((0,p.Z)(r),"triggerMetaEvent",function(e){var t=r.props.onMetaChange;if(t){var n=(0,s.Z)((0,s.Z)({},r.getMeta()),{},{destroy:e});(0,b.Z)(r.metaCache,n)||t(n),r.metaCache=n}else r.metaCache=null}),(0,v.Z)((0,p.Z)(r),"onStoreChange",function(e,t,n){var o=r.props,a=o.shouldUpdate,i=o.dependencies,c=void 0===i?[]:i,l=o.onReset,s=n.store,u=r.getNamePath(),d=r.getValue(e),f=r.getValue(s),p=t&&ec(t,u);switch("valueUpdate"!==n.type||"external"!==n.source||(0,b.Z)(d,f)||(r.touched=!0,r.dirty=!0,r.validatePromise=null,r.errors=ef,r.warnings=ef,r.triggerMetaEvent()),n.type){case"reset":if(!t||p){r.touched=!1,r.dirty=!1,r.validatePromise=void 0,r.errors=ef,r.warnings=ef,r.triggerMetaEvent(),null==l||l(),r.refresh();return}break;case"remove":if(a&&ep(a,e,s,d,f,n)){r.reRender();return}break;case"setField":var m=n.data;if(p){"touched"in m&&(r.touched=m.touched),"validating"in m&&!("originRCField"in m)&&(r.validatePromise=m.validating?Promise.resolve([]):null),"errors"in m&&(r.errors=m.errors||ef),"warnings"in m&&(r.warnings=m.warnings||ef),r.dirty=!0,r.triggerMetaEvent(),r.reRender();return}if("value"in m&&ec(t,u,!0)||a&&!u.length&&ep(a,e,s,d,f,n)){r.reRender();return}break;case"dependenciesUpdate":if(c.map(ea).some(function(e){return ec(n.relatedFields,e)})){r.reRender();return}break;default:if(p||(!c.length||u.length||a)&&ep(a,e,s,d,f,n)){r.reRender();return}}!0===a&&r.reRender()}),(0,v.Z)((0,p.Z)(r),"validateRules",function(e){var t=r.getNamePath(),n=r.getValue(),o=e||{},a=o.triggerName,i=o.validateOnly,d=Promise.resolve().then((0,l.Z)((0,c.Z)().mark(function o(){var i,f,p,m,g,v,h;return(0,c.Z)().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(r.mounted){o.next=2;break}return o.abrupt("return",[]);case 2:if(p=void 0!==(f=(i=r.props).validateFirst)&&f,m=i.messageVariables,g=i.validateDebounce,v=r.getRules(),a&&(v=v.filter(function(e){return e}).filter(function(e){var t=e.validateTrigger;return!t||Z(t).includes(a)})),!(g&&a)){o.next=10;break}return o.next=8,new Promise(function(e){setTimeout(e,g)});case 8:if(!(r.validatePromise!==d)){o.next=10;break}return o.abrupt("return",[]);case 10:return(h=function(e,t,n,r,o,a){var i,u,d=e.join("."),f=n.map(function(e,t){var n=e.validator,r=(0,s.Z)((0,s.Z)({},e),{},{ruleIndex:t});return n&&(r.validator=function(e,t,r){var o=!1,a=n(e,t,function(){for(var e=arguments.length,t=Array(e),n=0;n0&&void 0!==arguments[0]?arguments[0]:ef;if(r.validatePromise===d){r.validatePromise=null;var t,n=[],o=[];null===(t=e.forEach)||void 0===t||t.call(e,function(e){var t=e.rule.warningOnly,r=e.errors,a=void 0===r?ef:r;t?o.push.apply(o,(0,u.Z)(a)):n.push.apply(n,(0,u.Z)(a))}),r.errors=n,r.warnings=o,r.triggerMetaEvent(),r.reRender()}}),o.abrupt("return",h);case 13:case"end":return o.stop()}},o)})));return void 0!==i&&i||(r.validatePromise=d,r.dirty=!0,r.errors=ef,r.warnings=ef,r.triggerMetaEvent(),r.reRender()),d}),(0,v.Z)((0,p.Z)(r),"isFieldValidating",function(){return!!r.validatePromise}),(0,v.Z)((0,p.Z)(r),"isFieldTouched",function(){return r.touched}),(0,v.Z)((0,p.Z)(r),"isFieldDirty",function(){return!!r.dirty||void 0!==r.props.initialValue||void 0!==(0,r.props.fieldContext.getInternalHooks(x).getInitialValue)(r.getNamePath())}),(0,v.Z)((0,p.Z)(r),"getErrors",function(){return r.errors}),(0,v.Z)((0,p.Z)(r),"getWarnings",function(){return r.warnings}),(0,v.Z)((0,p.Z)(r),"isListField",function(){return r.props.isListField}),(0,v.Z)((0,p.Z)(r),"isList",function(){return r.props.isList}),(0,v.Z)((0,p.Z)(r),"isPreserve",function(){return r.props.preserve}),(0,v.Z)((0,p.Z)(r),"getMeta",function(){return r.prevValidating=r.isFieldValidating(),{touched:r.isFieldTouched(),validating:r.prevValidating,errors:r.errors,warnings:r.warnings,name:r.getNamePath(),validated:null===r.validatePromise}}),(0,v.Z)((0,p.Z)(r),"getOnlyChild",function(e){if("function"==typeof e){var t=r.getMeta();return(0,s.Z)((0,s.Z)({},r.getOnlyChild(e(r.getControlled(),t,r.props.fieldContext))),{},{isFunction:!0})}var n=(0,h.Z)(e);return 1===n.length&&o.isValidElement(n[0])?{child:n[0],isFunction:!1}:{child:n,isFunction:!1}}),(0,v.Z)((0,p.Z)(r),"getValue",function(e){var t=r.props.fieldContext.getFieldsValue,n=r.getNamePath();return(0,eo.Z)(e||t(!0),n)}),(0,v.Z)((0,p.Z)(r),"getControlled",function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=r.props,n=t.name,o=t.trigger,a=t.validateTrigger,i=t.getValueFromEvent,c=t.normalize,l=t.valuePropName,u=t.getValueProps,d=t.fieldContext,f=void 0!==a?a:d.validateTrigger,p=r.getNamePath(),m=d.getInternalHooks,g=d.getFieldsValue,h=m(x).dispatch,b=r.getValue(),y=u||function(e){return(0,v.Z)({},l,e)},w=e[o],E=void 0!==n?y(b):{},C=(0,s.Z)((0,s.Z)({},e),E);return C[o]=function(){r.touched=!0,r.dirty=!0,r.triggerMetaEvent();for(var e,t=arguments.length,n=Array(t),o=0;o=0&&t<=n.length?(f.keys=[].concat((0,u.Z)(f.keys.slice(0,t)),[f.id],(0,u.Z)(f.keys.slice(t))),o([].concat((0,u.Z)(n.slice(0,t)),[e],(0,u.Z)(n.slice(t))))):(f.keys=[].concat((0,u.Z)(f.keys),[f.id]),o([].concat((0,u.Z)(n),[e]))),f.id+=1},remove:function(e){var t=i(),n=new Set(Array.isArray(e)?e:[e]);n.size<=0||(f.keys=f.keys.filter(function(e,t){return!n.has(t)}),o(t.filter(function(e,t){return!n.has(t)})))},move:function(e,t){if(e!==t){var n=i();e<0||e>=n.length||t<0||t>=n.length||(f.keys=eu(f.keys,e,t),o(eu(n,e,t)))}}},t)})))},eh=n(26365),eb="__@field_split__";function ey(e){return e.map(function(e){return"".concat((0,S.Z)(e),":").concat(e)}).join(eb)}var ex=function(){function e(){(0,d.Z)(this,e),(0,v.Z)(this,"kvs",new Map)}return(0,f.Z)(e,[{key:"set",value:function(e,t){this.kvs.set(ey(e),t)}},{key:"get",value:function(e){return this.kvs.get(ey(e))}},{key:"update",value:function(e,t){var n=t(this.get(e));n?this.set(e,n):this.delete(e)}},{key:"delete",value:function(e){this.kvs.delete(ey(e))}},{key:"map",value:function(e){return(0,u.Z)(this.kvs.entries()).map(function(t){var n=(0,eh.Z)(t,2),r=n[0],o=n[1];return e({key:r.split(eb).map(function(e){var t=e.match(/^([^:]*):(.*)$/),n=(0,eh.Z)(t,3),r=n[1],o=n[2];return"number"===r?Number(o):o}),value:o})})}},{key:"toJSON",value:function(){var e={};return this.map(function(t){var n=t.key,r=t.value;return e[n.join(".")]=r,null}),e}}]),e}(),ew=["name"],eE=(0,f.Z)(function e(t){var n=this;(0,d.Z)(this,e),(0,v.Z)(this,"formHooked",!1),(0,v.Z)(this,"forceRootUpdate",void 0),(0,v.Z)(this,"subscribable",!0),(0,v.Z)(this,"store",{}),(0,v.Z)(this,"fieldEntities",[]),(0,v.Z)(this,"initialValues",{}),(0,v.Z)(this,"callbacks",{}),(0,v.Z)(this,"validateMessages",null),(0,v.Z)(this,"preserve",null),(0,v.Z)(this,"lastValidatePromise",null),(0,v.Z)(this,"getForm",function(){return{getFieldValue:n.getFieldValue,getFieldsValue:n.getFieldsValue,getFieldError:n.getFieldError,getFieldWarning:n.getFieldWarning,getFieldsError:n.getFieldsError,isFieldsTouched:n.isFieldsTouched,isFieldTouched:n.isFieldTouched,isFieldValidating:n.isFieldValidating,isFieldsValidating:n.isFieldsValidating,resetFields:n.resetFields,setFields:n.setFields,setFieldValue:n.setFieldValue,setFieldsValue:n.setFieldsValue,validateFields:n.validateFields,submit:n.submit,_init:!0,getInternalHooks:n.getInternalHooks}}),(0,v.Z)(this,"getInternalHooks",function(e){return e===x?(n.formHooked=!0,{dispatch:n.dispatch,initEntityValue:n.initEntityValue,registerField:n.registerField,useSubscribe:n.useSubscribe,setInitialValues:n.setInitialValues,destroyForm:n.destroyForm,setCallbacks:n.setCallbacks,setValidateMessages:n.setValidateMessages,getFields:n.getFields,setPreserve:n.setPreserve,getInitialValue:n.getInitialValue,registerWatch:n.registerWatch}):((0,y.ZP)(!1,"`getInternalHooks` is internal usage. Should not call directly."),null)}),(0,v.Z)(this,"useSubscribe",function(e){n.subscribable=e}),(0,v.Z)(this,"prevWithoutPreserves",null),(0,v.Z)(this,"setInitialValues",function(e,t){if(n.initialValues=e||{},t){var r,o=(0,Q.T)(e,n.store);null===(r=n.prevWithoutPreserves)||void 0===r||r.map(function(t){var n=t.key;o=(0,Q.Z)(o,n,(0,eo.Z)(e,n))}),n.prevWithoutPreserves=null,n.updateStore(o)}}),(0,v.Z)(this,"destroyForm",function(e){if(e)n.updateStore({});else{var t=new ex;n.getFieldEntities(!0).forEach(function(e){n.isMergedPreserve(e.isPreserve())||t.set(e.getNamePath(),!0)}),n.prevWithoutPreserves=t}}),(0,v.Z)(this,"getInitialValue",function(e){var t=(0,eo.Z)(n.initialValues,e);return e.length?(0,Q.T)(t):t}),(0,v.Z)(this,"setCallbacks",function(e){n.callbacks=e}),(0,v.Z)(this,"setValidateMessages",function(e){n.validateMessages=e}),(0,v.Z)(this,"setPreserve",function(e){n.preserve=e}),(0,v.Z)(this,"watchList",[]),(0,v.Z)(this,"registerWatch",function(e){return n.watchList.push(e),function(){n.watchList=n.watchList.filter(function(t){return t!==e})}}),(0,v.Z)(this,"notifyWatch",function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(n.watchList.length){var t=n.getFieldsValue(),r=n.getFieldsValue(!0);n.watchList.forEach(function(n){n(t,r,e)})}}),(0,v.Z)(this,"timeoutId",null),(0,v.Z)(this,"warningUnhooked",function(){}),(0,v.Z)(this,"updateStore",function(e){n.store=e}),(0,v.Z)(this,"getFieldEntities",function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e?n.fieldEntities.filter(function(e){return e.getNamePath().length}):n.fieldEntities}),(0,v.Z)(this,"getFieldsMap",function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=new ex;return n.getFieldEntities(e).forEach(function(e){var n=e.getNamePath();t.set(n,e)}),t}),(0,v.Z)(this,"getFieldEntitiesForNamePathList",function(e){if(!e)return n.getFieldEntities(!0);var t=n.getFieldsMap(!0);return e.map(function(e){var n=ea(e);return t.get(n)||{INVALIDATE_NAME_PATH:ea(e)}})}),(0,v.Z)(this,"getFieldsValue",function(e,t){if(n.warningUnhooked(),!0===e||Array.isArray(e)?(r=e,o=t):e&&"object"===(0,S.Z)(e)&&(a=e.strict,o=e.filter),!0===r&&!o)return n.store;var r,o,a,i=n.getFieldEntitiesForNamePathList(Array.isArray(r)?r:null),c=[];return i.forEach(function(e){var t,n,i,l="INVALIDATE_NAME_PATH"in e?e.INVALIDATE_NAME_PATH:e.getNamePath();if(a){if(null!==(i=e.isList)&&void 0!==i&&i.call(e))return}else if(!r&&null!==(t=(n=e).isListField)&&void 0!==t&&t.call(n))return;if(o){var s="getMeta"in e?e.getMeta():null;o(s)&&c.push(l)}else c.push(l)}),ei(n.store,c.map(ea))}),(0,v.Z)(this,"getFieldValue",function(e){n.warningUnhooked();var t=ea(e);return(0,eo.Z)(n.store,t)}),(0,v.Z)(this,"getFieldsError",function(e){return n.warningUnhooked(),n.getFieldEntitiesForNamePathList(e).map(function(t,n){return!t||"INVALIDATE_NAME_PATH"in t?{name:ea(e[n]),errors:[],warnings:[]}:{name:t.getNamePath(),errors:t.getErrors(),warnings:t.getWarnings()}})}),(0,v.Z)(this,"getFieldError",function(e){n.warningUnhooked();var t=ea(e);return n.getFieldsError([t])[0].errors}),(0,v.Z)(this,"getFieldWarning",function(e){n.warningUnhooked();var t=ea(e);return n.getFieldsError([t])[0].warnings}),(0,v.Z)(this,"isFieldsTouched",function(){n.warningUnhooked();for(var e,t=arguments.length,r=Array(t),o=0;o0&&void 0!==arguments[0]?arguments[0]:{},r=new ex,o=n.getFieldEntities(!0);o.forEach(function(e){var t=e.props.initialValue,n=e.getNamePath();if(void 0!==t){var o=r.get(n)||new Set;o.add({entity:e,value:t}),r.set(n,o)}}),t.entities?e=t.entities:t.namePathList?(e=[],t.namePathList.forEach(function(t){var n,o=r.get(t);o&&(n=e).push.apply(n,(0,u.Z)((0,u.Z)(o).map(function(e){return e.entity})))})):e=o,function(e){e.forEach(function(e){if(void 0!==e.props.initialValue){var o=e.getNamePath();if(void 0!==n.getInitialValue(o))(0,y.ZP)(!1,"Form already set 'initialValues' with path '".concat(o.join("."),"'. Field can not overwrite it."));else{var a=r.get(o);if(a&&a.size>1)(0,y.ZP)(!1,"Multiple Field with path '".concat(o.join("."),"' set 'initialValue'. Can not decide which one to pick."));else if(a){var i=n.getFieldValue(o);e.isListField()||t.skipExist&&void 0!==i||n.updateStore((0,Q.Z)(n.store,o,(0,u.Z)(a)[0].value))}}}})}(e)}),(0,v.Z)(this,"resetFields",function(e){n.warningUnhooked();var t=n.store;if(!e){n.updateStore((0,Q.T)(n.initialValues)),n.resetWithFieldInitialValue(),n.notifyObservers(t,null,{type:"reset"}),n.notifyWatch();return}var r=e.map(ea);r.forEach(function(e){var t=n.getInitialValue(e);n.updateStore((0,Q.Z)(n.store,e,t))}),n.resetWithFieldInitialValue({namePathList:r}),n.notifyObservers(t,r,{type:"reset"}),n.notifyWatch(r)}),(0,v.Z)(this,"setFields",function(e){n.warningUnhooked();var t=n.store,r=[];e.forEach(function(e){var o=e.name,a=(0,i.Z)(e,ew),c=ea(o);r.push(c),"value"in a&&n.updateStore((0,Q.Z)(n.store,c,a.value)),n.notifyObservers(t,[c],{type:"setField",data:e})}),n.notifyWatch(r)}),(0,v.Z)(this,"getFields",function(){return n.getFieldEntities(!0).map(function(e){var t=e.getNamePath(),r=e.getMeta(),o=(0,s.Z)((0,s.Z)({},r),{},{name:t,value:n.getFieldValue(t)});return Object.defineProperty(o,"originRCField",{value:!0}),o})}),(0,v.Z)(this,"initEntityValue",function(e){var t=e.props.initialValue;if(void 0!==t){var r=e.getNamePath();void 0===(0,eo.Z)(n.store,r)&&n.updateStore((0,Q.Z)(n.store,r,t))}}),(0,v.Z)(this,"isMergedPreserve",function(e){var t=void 0!==e?e:n.preserve;return null==t||t}),(0,v.Z)(this,"registerField",function(e){n.fieldEntities.push(e);var t=e.getNamePath();if(n.notifyWatch([t]),void 0!==e.props.initialValue){var r=n.store;n.resetWithFieldInitialValue({entities:[e],skipExist:!0}),n.notifyObservers(r,[e.getNamePath()],{type:"valueUpdate",source:"internal"})}return function(r,o){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(n.fieldEntities=n.fieldEntities.filter(function(t){return t!==e}),!n.isMergedPreserve(o)&&(!r||a.length>1)){var i=r?void 0:n.getInitialValue(t);if(t.length&&n.getFieldValue(t)!==i&&n.fieldEntities.every(function(e){return!el(e.getNamePath(),t)})){var c=n.store;n.updateStore((0,Q.Z)(c,t,i,!0)),n.notifyObservers(c,[t],{type:"remove"}),n.triggerDependenciesUpdate(c,t)}}n.notifyWatch([t])}}),(0,v.Z)(this,"dispatch",function(e){switch(e.type){case"updateValue":var t=e.namePath,r=e.value;n.updateValue(t,r);break;case"validateField":var o=e.namePath,a=e.triggerName;n.validateFields([o],{triggerName:a})}}),(0,v.Z)(this,"notifyObservers",function(e,t,r){if(n.subscribable){var o=(0,s.Z)((0,s.Z)({},r),{},{store:n.getFieldsValue(!0)});n.getFieldEntities().forEach(function(n){(0,n.onStoreChange)(e,t,o)})}else n.forceRootUpdate()}),(0,v.Z)(this,"triggerDependenciesUpdate",function(e,t){var r=n.getDependencyChildrenFields(t);return r.length&&n.validateFields(r),n.notifyObservers(e,r,{type:"dependenciesUpdate",relatedFields:[t].concat((0,u.Z)(r))}),r}),(0,v.Z)(this,"updateValue",function(e,t){var r=ea(e),o=n.store;n.updateStore((0,Q.Z)(n.store,r,t)),n.notifyObservers(o,[r],{type:"valueUpdate",source:"internal"}),n.notifyWatch([r]);var a=n.triggerDependenciesUpdate(o,r),i=n.callbacks.onValuesChange;i&&i(ei(n.store,[r]),n.getFieldsValue()),n.triggerOnFieldsChange([r].concat((0,u.Z)(a)))}),(0,v.Z)(this,"setFieldsValue",function(e){n.warningUnhooked();var t=n.store;if(e){var r=(0,Q.T)(n.store,e);n.updateStore(r)}n.notifyObservers(t,null,{type:"valueUpdate",source:"external"}),n.notifyWatch()}),(0,v.Z)(this,"setFieldValue",function(e,t){n.setFields([{name:e,value:t,errors:[],warnings:[]}])}),(0,v.Z)(this,"getDependencyChildrenFields",function(e){var t=new Set,r=[],o=new ex;return n.getFieldEntities().forEach(function(e){(e.props.dependencies||[]).forEach(function(t){var n=ea(t);o.update(n,function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Set;return t.add(e),t})})}),function e(n){(o.get(n)||new Set).forEach(function(n){if(!t.has(n)){t.add(n);var o=n.getNamePath();n.isFieldDirty()&&o.length&&(r.push(o),e(o))}})}(e),r}),(0,v.Z)(this,"triggerOnFieldsChange",function(e,t){var r=n.callbacks.onFieldsChange;if(r){var o=n.getFields();if(t){var a=new ex;t.forEach(function(e){var t=e.name,n=e.errors;a.set(t,n)}),o.forEach(function(e){e.errors=a.get(e.name)||e.errors})}var i=o.filter(function(t){return ec(e,t.name)});i.length&&r(i,o)}}),(0,v.Z)(this,"validateFields",function(e,t){n.warningUnhooked(),Array.isArray(e)||"string"==typeof e||"string"==typeof t?(i=e,c=t):c=e;var r,o,a,i,c,l=!!i,d=l?i.map(ea):[],f=[],p=String(Date.now()),m=new Set,g=c||{},v=g.recursive,h=g.dirty;n.getFieldEntities(!0).forEach(function(e){if(l||d.push(e.getNamePath()),e.props.rules&&e.props.rules.length&&(!h||e.isFieldDirty())){var t=e.getNamePath();if(m.add(t.join(p)),!l||ec(d,t,v)){var r=e.validateRules((0,s.Z)({validateMessages:(0,s.Z)((0,s.Z)({},Y),n.validateMessages)},c));f.push(r.then(function(){return{name:t,errors:[],warnings:[]}}).catch(function(e){var n,r=[],o=[];return(null===(n=e.forEach)||void 0===n||n.call(e,function(e){var t=e.rule.warningOnly,n=e.errors;t?o.push.apply(o,(0,u.Z)(n)):r.push.apply(r,(0,u.Z)(n))}),r.length)?Promise.reject({name:t,errors:r,warnings:o}):{name:t,errors:r,warnings:o}}))}}});var b=(r=!1,o=f.length,a=[],f.length?new Promise(function(e,t){f.forEach(function(n,i){n.catch(function(e){return r=!0,e}).then(function(n){o-=1,a[i]=n,o>0||(r&&t(a),e(a))})})}):Promise.resolve([]));n.lastValidatePromise=b,b.catch(function(e){return e}).then(function(e){var t=e.map(function(e){return e.name});n.notifyObservers(n.store,t,{type:"validateFinish"}),n.triggerOnFieldsChange(t,e)});var y=b.then(function(){return n.lastValidatePromise===b?Promise.resolve(n.getFieldsValue(d)):Promise.reject([])}).catch(function(e){var t=e.filter(function(e){return e&&e.errors.length});return Promise.reject({values:n.getFieldsValue(d),errorFields:t,outOfDate:n.lastValidatePromise!==b})});y.catch(function(e){return e});var x=d.filter(function(e){return m.has(e.join(p))});return n.triggerOnFieldsChange(x),y}),(0,v.Z)(this,"submit",function(){n.warningUnhooked(),n.validateFields().then(function(e){var t=n.callbacks.onFinish;if(t)try{t(e)}catch(e){console.error(e)}}).catch(function(e){var t=n.callbacks.onFinishFailed;t&&t(e)})}),this.forceRootUpdate=t}),eC=function(e){var t=o.useRef(),n=o.useState({}),r=(0,eh.Z)(n,2)[1];if(!t.current){if(e)t.current=e;else{var a=new eE(function(){r({})});t.current=a.getForm()}}return[t.current]},eZ=o.createContext({triggerFormChange:function(){},triggerFormFinish:function(){},registerForm:function(){},unregisterForm:function(){}}),eS=function(e){var t=e.validateMessages,n=e.onFormChange,r=e.onFormFinish,a=e.children,i=o.useContext(eZ),c=o.useRef({});return o.createElement(eZ.Provider,{value:(0,s.Z)((0,s.Z)({},i),{},{validateMessages:(0,s.Z)((0,s.Z)({},i.validateMessages),t),triggerFormChange:function(e,t){n&&n(e,{changedFields:t,forms:c.current}),i.triggerFormChange(e,t)},triggerFormFinish:function(e,t){r&&r(e,{values:t,forms:c.current}),i.triggerFormFinish(e,t)},registerForm:function(e,t){e&&(c.current=(0,s.Z)((0,s.Z)({},c.current),{},(0,v.Z)({},e,t))),i.registerForm(e,t)},unregisterForm:function(e){var t=(0,s.Z)({},c.current);delete t[e],c.current=t,i.unregisterForm(e)}})},a)},eO=["name","initialValues","fields","form","preserve","children","component","validateMessages","validateTrigger","onValuesChange","onFieldsChange","onFinish","onFinishFailed","clearOnDestroy"];function ek(e){try{return JSON.stringify(e)}catch(e){return Math.random()}}var ej=function(){},eI=function(){for(var e=arguments.length,t=Array(e),n=0;n1?t-1:0),o=1;oea;(0,s.useImperativeHandle)(t,function(){var e;return{focus:U,blur:function(){var e;null===(e=X.current)||void 0===e||e.blur()},setSelectionRange:function(e,t,n){var r;null===(r=X.current)||void 0===r||r.setSelectionRange(e,t,n)},select:function(){var e;null===(e=X.current)||void 0===e||e.select()},input:X.current,nativeElement:(null===(e=G.current)||void 0===e?void 0:e.nativeElement)||X.current}}),(0,s.useEffect)(function(){q.current&&(q.current=!1),W(function(e){return(!e||!O)&&e})},[O]);var el=function(e,t,n){var r,o,a=t;if(!V.current&&eo.exceedFormatter&&eo.max&&eo.strategy(t)>eo.max)a=eo.exceedFormatter(t,{max:eo.max}),t!==a&&er([(null===(r=X.current)||void 0===r?void 0:r.selectionStart)||0,(null===(o=X.current)||void 0===o?void 0:o.selectionEnd)||0]);else if("compositionEnd"===n.source)return;Q(a),X.current&&(0,u.rJ)(X.current,e,c,a)};(0,s.useEffect)(function(){if(en){var e;null===(e=X.current)||void 0===e||e.setSelectionRange.apply(e,(0,f.Z)(en))}},[en]);var es=ec&&"".concat(S,"-out-of-range");return s.createElement(d,(0,o.Z)({},H,{prefixCls:S,className:l()(j,es),handleReset:function(e){Q(""),U(),X.current&&(0,u.rJ)(X.current,e,c)},value:J,focused:D,triggerFocus:U,suffix:function(){var e=Number(ea)>0;if(M||eo.show){var t=eo.showFormatter?eo.showFormatter({value:J,count:ei,maxLength:ea}):"".concat(ei).concat(e?" / ".concat(ea):"");return s.createElement(s.Fragment,null,eo.show&&s.createElement("span",{className:l()("".concat(S,"-show-count-suffix"),(0,a.Z)({},"".concat(S,"-show-count-has-suffix"),!!M),null==T?void 0:T.count),style:(0,r.Z)({},null==A?void 0:A.count)},t),M)}return null}(),disabled:O,classes:F,classNames:T,styles:A,ref:G}),(n=(0,v.Z)(e,["prefixCls","onPressEnter","addonBefore","addonAfter","prefix","suffix","allowClear","defaultValue","showCount","count","classes","htmlSize","styles","classNames","onClear"]),s.createElement("input",(0,o.Z)({autoComplete:i},n,{onChange:function(e){el(e,e.target.value,{source:"change"})},onFocus:function(e){W(!0),null==y||y(e)},onBlur:function(e){q.current&&(q.current=!1),W(!1),null==x||x(e)},onKeyDown:function(e){w&&"Enter"===e.key&&!q.current&&(q.current=!0,w(e)),null==E||E(e)},onKeyUp:function(e){"Enter"===e.key&&(q.current=!1),null==C||C(e)},className:l()(S,(0,a.Z)({},"".concat(S,"-disabled"),O),null==T?void 0:T.input),style:null==A?void 0:A.input,ref:X,size:k,type:void 0===P?"text":P,onCompositionStart:function(e){V.current=!0,null==_||_(e)},onCompositionEnd:function(e){V.current=!1,el(e,e.currentTarget.value,{source:"compositionEnd"}),null==B||B(e)}}))))})},25209:function(e,t,n){"use strict";function r(e){return!!(e.addonBefore||e.addonAfter)}function o(e){return!!(e.prefix||e.suffix||e.allowClear)}function a(e,t,n){var r=t.cloneNode(!0),o=Object.create(e,{target:{value:r},currentTarget:{value:r}});return r.value=n,"number"==typeof t.selectionStart&&"number"==typeof t.selectionEnd&&(r.selectionStart=t.selectionStart,r.selectionEnd=t.selectionEnd),r.setSelectionRange=function(){t.setSelectionRange.apply(t,arguments)},o}function i(e,t,n,r){if(n){var o=t;if("click"===t.type){n(o=a(t,e,""));return}if("file"!==e.type&&void 0!==r){n(o=a(t,e,r));return}n(o)}}function c(e,t){if(e){e.focus(t);var n=(t||{}).cursor;if(n){var r=e.value.length;switch(n){case"start":e.setSelectionRange(0,0);break;case"end":e.setSelectionRange(r,r);break;default:e.setSelectionRange(0,r)}}}}n.d(t,{He:function(){return r},X3:function(){return o},nH:function(){return c},rJ:function(){return i}})},66632:function(e,t,n){"use strict";n.d(t,{V4:function(){return eg},zt:function(){return x},ZP:function(){return ev}});var r,o,a,i,c,l=n(11993),s=n(31686),u=n(26365),d=n(41154),f=n(36760),p=n.n(f),m=n(2868),g=n(28791),v=n(2265),h=n(6989),b=["children"],y=v.createContext({});function x(e){var t=e.children,n=(0,h.Z)(e,b);return v.createElement(y.Provider,{value:n},t)}var w=n(76405),E=n(25049),C=n(41690),Z=n(15900),S=function(e){(0,C.Z)(n,e);var t=(0,Z.Z)(n);function n(){return(0,w.Z)(this,n),t.apply(this,arguments)}return(0,E.Z)(n,[{key:"render",value:function(){return this.props.children}}]),n}(v.Component),O=n(74126),k=n(69819),j=n(58525),I="none",M="appear",R="enter",N="leave",P="none",F="prepare",T="start",A="active",_="prepared",B=n(94981);function H(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit".concat(e)]="webkit".concat(t),n["Moz".concat(e)]="moz".concat(t),n["ms".concat(e)]="MS".concat(t),n["O".concat(e)]="o".concat(t.toLowerCase()),n}var z=(r=(0,B.Z)(),o="undefined"!=typeof window?window:{},a={animationend:H("Animation","AnimationEnd"),transitionend:H("Transition","TransitionEnd")},!r||("AnimationEvent"in o||delete a.animationend.animation,"TransitionEvent"in o||delete a.transitionend.transition),a),L={};(0,B.Z)()&&(L=document.createElement("div").style);var D={};function W(e){if(D[e])return D[e];var t=z[e];if(t)for(var n=Object.keys(t),r=n.length,o=0;o1&&void 0!==arguments[1]?arguments[1]:2;t();var a=(0,Q.Z)(function(){o<=1?r({isCanceled:function(){return a!==e.current}}):n(r,o-1)});e.current=a},t]},ee=[F,T,A,"end"],et=[F,_];function en(e){return e===A||"end"===e}var er=function(e,t,n){var r=(0,k.Z)(P),o=(0,u.Z)(r,2),a=o[0],i=o[1],c=J(),l=(0,u.Z)(c,2),s=l[0],d=l[1],f=t?et:ee;return Y(function(){if(a!==P&&"end"!==a){var e=f.indexOf(a),t=f[e+1],r=n(a);!1===r?i(t,!0):t&&s(function(e){function n(){e.isCanceled()||i(t,!0)}!0===r?n():Promise.resolve(r).then(n)})}},[e,a]),v.useEffect(function(){return function(){d()}},[]),[function(){i(F,!0)},a]},eo=(i=X,"object"===(0,d.Z)(X)&&(i=X.transitionSupport),(c=v.forwardRef(function(e,t){var n=e.visible,r=void 0===n||n,o=e.removeOnLeave,a=void 0===o||o,c=e.forceRender,d=e.children,f=e.motionName,h=e.leavedClassName,b=e.eventProps,x=v.useContext(y).motion,w=!!(e.motionName&&i&&!1!==x),E=(0,v.useRef)(),C=(0,v.useRef)(),Z=function(e,t,n,r){var o,a,i,c=r.motionEnter,d=void 0===c||c,f=r.motionAppear,p=void 0===f||f,m=r.motionLeave,g=void 0===m||m,h=r.motionDeadline,b=r.motionLeaveImmediately,y=r.onAppearPrepare,x=r.onEnterPrepare,w=r.onLeavePrepare,E=r.onAppearStart,C=r.onEnterStart,Z=r.onLeaveStart,S=r.onAppearActive,P=r.onEnterActive,B=r.onLeaveActive,H=r.onAppearEnd,z=r.onEnterEnd,L=r.onLeaveEnd,D=r.onVisibleChanged,W=(0,k.Z)(),V=(0,u.Z)(W,2),q=V[0],X=V[1],G=(o=v.useReducer(function(e){return e+1},0),a=(0,u.Z)(o,2)[1],i=v.useRef(I),[(0,j.Z)(function(){return i.current}),(0,j.Z)(function(e){i.current="function"==typeof e?e(i.current):e,a()})]),U=(0,u.Z)(G,2),$=U[0],Q=U[1],J=(0,k.Z)(null),ee=(0,u.Z)(J,2),et=ee[0],eo=ee[1],ea=$(),ei=(0,v.useRef)(!1),ec=(0,v.useRef)(null),el=(0,v.useRef)(!1);function es(){Q(I),eo(null,!0)}var eu=(0,O.zX)(function(e){var t,r=$();if(r!==I){var o=n();if(!e||e.deadline||e.target===o){var a=el.current;r===M&&a?t=null==H?void 0:H(o,e):r===R&&a?t=null==z?void 0:z(o,e):r===N&&a&&(t=null==L?void 0:L(o,e)),a&&!1!==t&&es()}}}),ed=K(eu),ef=(0,u.Z)(ed,1)[0],ep=function(e){switch(e){case M:return(0,l.Z)((0,l.Z)((0,l.Z)({},F,y),T,E),A,S);case R:return(0,l.Z)((0,l.Z)((0,l.Z)({},F,x),T,C),A,P);case N:return(0,l.Z)((0,l.Z)((0,l.Z)({},F,w),T,Z),A,B);default:return{}}},em=v.useMemo(function(){return ep(ea)},[ea]),eg=er(ea,!e,function(e){if(e===F){var t,r=em[F];return!!r&&r(n())}return eb in em&&eo((null===(t=em[eb])||void 0===t?void 0:t.call(em,n(),null))||null),eb===A&&ea!==I&&(ef(n()),h>0&&(clearTimeout(ec.current),ec.current=setTimeout(function(){eu({deadline:!0})},h))),eb===_&&es(),!0}),ev=(0,u.Z)(eg,2),eh=ev[0],eb=ev[1],ey=en(eb);el.current=ey;var ex=(0,v.useRef)(null);Y(function(){if(!ei.current||ex.current!==t){X(t);var n,r=ei.current;ei.current=!0,!r&&t&&p&&(n=M),r&&t&&d&&(n=R),(r&&!t&&g||!r&&b&&!t&&g)&&(n=N);var o=ep(n);n&&(e||o[F])?(Q(n),eh()):Q(I),ex.current=t}},[t]),(0,v.useEffect)(function(){(ea!==M||p)&&(ea!==R||d)&&(ea!==N||g)||Q(I)},[p,d,g]),(0,v.useEffect)(function(){return function(){ei.current=!1,clearTimeout(ec.current)}},[]);var ew=v.useRef(!1);(0,v.useEffect)(function(){q&&(ew.current=!0),void 0!==q&&ea===I&&((ew.current||q)&&(null==D||D(q)),ew.current=!0)},[q,ea]);var eE=et;return em[F]&&eb===T&&(eE=(0,s.Z)({transition:"none"},eE)),[ea,eb,eE,null!=q?q:t]}(w,r,function(){try{return E.current instanceof HTMLElement?E.current:(0,m.ZP)(C.current)}catch(e){return null}},e),P=(0,u.Z)(Z,4),B=P[0],H=P[1],z=P[2],L=P[3],D=v.useRef(L);L&&(D.current=!0);var W=v.useCallback(function(e){E.current=e,(0,g.mH)(t,e)},[t]),V=(0,s.Z)((0,s.Z)({},b),{},{visible:r});if(d){if(B===I)q=L?d((0,s.Z)({},V),W):!a&&D.current&&h?d((0,s.Z)((0,s.Z)({},V),{},{className:h}),W):!c&&(a||h)?null:d((0,s.Z)((0,s.Z)({},V),{},{style:{display:"none"}}),W);else{H===F?X="prepare":en(H)?X="active":H===T&&(X="start");var q,X,G=$(f,"".concat(B,"-").concat(X));q=d((0,s.Z)((0,s.Z)({},V),{},{className:p()($(f,B),(0,l.Z)((0,l.Z)({},G,G&&X),f,"string"==typeof f)),style:z}),W)}}else q=null;return v.isValidElement(q)&&(0,g.Yr)(q)&&!(0,g.C4)(q)&&(q=v.cloneElement(q,{ref:W})),v.createElement(S,{ref:C},q)})).displayName="CSSMotion",c),ea=n(1119),ei=n(63496),ec="keep",el="remove",es="removed";function eu(e){var t;return t=e&&"object"===(0,d.Z)(e)&&"key"in e?e:{key:e},(0,s.Z)((0,s.Z)({},t),{},{key:String(t.key)})}function ed(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.map(eu)}var ef=["component","children","onVisibleChanged","onAllRemoved"],ep=["status"],em=["eventProps","visible","children","motionName","motionAppear","motionEnter","motionLeave","motionLeaveImmediately","motionDeadline","removeOnLeave","leavedClassName","onAppearPrepare","onAppearStart","onAppearActive","onAppearEnd","onEnterStart","onEnterActive","onEnterEnd","onLeaveStart","onLeaveActive","onLeaveEnd"],eg=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:eo,n=function(e){(0,C.Z)(r,e);var n=(0,Z.Z)(r);function r(){var e;(0,w.Z)(this,r);for(var t=arguments.length,o=Array(t),a=0;a0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=[],r=0,o=t.length,a=ed(e),i=ed(t);a.forEach(function(e){for(var t=!1,a=r;a1}).forEach(function(e){(n=n.filter(function(t){var n=t.key,r=t.status;return n!==e||r!==el})).forEach(function(t){t.key===e&&(t.status=ec)})}),n})(r,ed(n)).filter(function(e){var t=r.find(function(t){var n=t.key;return e.key===n});return!t||t.status!==es||e.status!==el})}}}]),r}(v.Component);return(0,l.Z)(n,"defaultProps",{component:"div"}),n}(X),ev=eo},49283:function(e,t,n){"use strict";n.d(t,{qX:function(){return h},JB:function(){return y},lm:function(){return j}});var r=n(83145),o=n(26365),a=n(6989),i=n(2265),c=n(31686),l=n(54887),s=n(1119),u=n(11993),d=n(36760),f=n.n(d),p=n(66632),m=n(41154),g=n(95814),v=n(18242),h=i.forwardRef(function(e,t){var n=e.prefixCls,r=e.style,a=e.className,c=e.duration,l=void 0===c?4.5:c,d=e.showProgress,p=e.pauseOnHover,h=void 0===p||p,b=e.eventKey,y=e.content,x=e.closable,w=e.closeIcon,E=void 0===w?"x":w,C=e.props,Z=e.onClick,S=e.onNoticeClose,O=e.times,k=e.hovering,j=i.useState(!1),I=(0,o.Z)(j,2),M=I[0],R=I[1],N=i.useState(0),P=(0,o.Z)(N,2),F=P[0],T=P[1],A=i.useState(0),_=(0,o.Z)(A,2),B=_[0],H=_[1],z=k||M,L=l>0&&d,D=function(){S(b)};i.useEffect(function(){if(!z&&l>0){var e=Date.now()-B,t=setTimeout(function(){D()},1e3*l-B);return function(){h&&clearTimeout(t),H(Date.now()-e)}}},[l,z,O]),i.useEffect(function(){if(!z&&L&&(h||0===B)){var e,t=performance.now();return function n(){cancelAnimationFrame(e),e=requestAnimationFrame(function(e){var r=Math.min((e+B-t)/(1e3*l),1);T(100*r),r<1&&n()})}(),function(){h&&cancelAnimationFrame(e)}}},[l,B,z,L,O]);var W=i.useMemo(function(){return"object"===(0,m.Z)(x)&&null!==x?x:x?{closeIcon:E}:{}},[x,E]),V=(0,v.Z)(W,!0),q=100-(!F||F<0?0:F>100?100:F),X="".concat(n,"-notice");return i.createElement("div",(0,s.Z)({},C,{ref:t,className:f()(X,a,(0,u.Z)({},"".concat(X,"-closable"),x)),style:r,onMouseEnter:function(e){var t;R(!0),null==C||null===(t=C.onMouseEnter)||void 0===t||t.call(C,e)},onMouseLeave:function(e){var t;R(!1),null==C||null===(t=C.onMouseLeave)||void 0===t||t.call(C,e)},onClick:Z}),i.createElement("div",{className:"".concat(X,"-content")},y),x&&i.createElement("a",(0,s.Z)({tabIndex:0,className:"".concat(X,"-close"),onKeyDown:function(e){("Enter"===e.key||"Enter"===e.code||e.keyCode===g.Z.ENTER)&&D()},"aria-label":"Close"},V,{onClick:function(e){e.preventDefault(),e.stopPropagation(),D()}}),W.closeIcon),L&&i.createElement("progress",{className:"".concat(X,"-progress"),max:"100",value:q},q+"%"))}),b=i.createContext({}),y=function(e){var t=e.children,n=e.classNames;return i.createElement(b.Provider,{value:{classNames:n}},t)},x=function(e){var t,n,r,o={offset:8,threshold:3,gap:16};return e&&"object"===(0,m.Z)(e)&&(o.offset=null!==(t=e.offset)&&void 0!==t?t:8,o.threshold=null!==(n=e.threshold)&&void 0!==n?n:3,o.gap=null!==(r=e.gap)&&void 0!==r?r:16),[!!e,o]},w=["className","style","classNames","styles"],E=function(e){var t=e.configList,n=e.placement,l=e.prefixCls,d=e.className,m=e.style,g=e.motion,v=e.onAllNoticeRemoved,y=e.onNoticeClose,E=e.stack,C=(0,i.useContext)(b).classNames,Z=(0,i.useRef)({}),S=(0,i.useState)(null),O=(0,o.Z)(S,2),k=O[0],j=O[1],I=(0,i.useState)([]),M=(0,o.Z)(I,2),R=M[0],N=M[1],P=t.map(function(e){return{config:e,key:String(e.key)}}),F=x(E),T=(0,o.Z)(F,2),A=T[0],_=T[1],B=_.offset,H=_.threshold,z=_.gap,L=A&&(R.length>0||P.length<=H),D="function"==typeof g?g(n):g;return(0,i.useEffect)(function(){A&&R.length>1&&N(function(e){return e.filter(function(e){return P.some(function(t){return e===t.key})})})},[R,P,A]),(0,i.useEffect)(function(){var e,t;A&&Z.current[null===(e=P[P.length-1])||void 0===e?void 0:e.key]&&j(Z.current[null===(t=P[P.length-1])||void 0===t?void 0:t.key])},[P,A]),i.createElement(p.V4,(0,s.Z)({key:n,className:f()(l,"".concat(l,"-").concat(n),null==C?void 0:C.list,d,(0,u.Z)((0,u.Z)({},"".concat(l,"-stack"),!!A),"".concat(l,"-stack-expanded"),L)),style:m,keys:P,motionAppear:!0},D,{onAllRemoved:function(){v(n)}}),function(e,t){var o=e.config,u=e.className,d=e.style,p=e.index,m=o.key,g=o.times,v=String(m),b=o.className,x=o.style,E=o.classNames,S=o.styles,O=(0,a.Z)(o,w),j=P.findIndex(function(e){return e.key===v}),I={};if(A){var M=P.length-1-(j>-1?j:p-1),F="top"===n||"bottom"===n?"-50%":"0";if(M>0){I.height=L?null===(T=Z.current[v])||void 0===T?void 0:T.offsetHeight:null==k?void 0:k.offsetHeight;for(var T,_,H,D,W=0,V=0;V-1?Z.current[v]=e:delete Z.current[v]},prefixCls:l,classNames:E,styles:S,className:f()(b,null==C?void 0:C.notice),style:x,times:g,key:m,eventKey:m,onNoticeClose:y,hovering:A&&R.length>0})))})},C=i.forwardRef(function(e,t){var n=e.prefixCls,a=void 0===n?"rc-notification":n,s=e.container,u=e.motion,d=e.maxCount,f=e.className,p=e.style,m=e.onAllRemoved,g=e.stack,v=e.renderNotifications,h=i.useState([]),b=(0,o.Z)(h,2),y=b[0],x=b[1],w=function(e){var t,n=y.find(function(t){return t.key===e});null==n||null===(t=n.onClose)||void 0===t||t.call(n),x(function(t){return t.filter(function(t){return t.key!==e})})};i.useImperativeHandle(t,function(){return{open:function(e){x(function(t){var n,o=(0,r.Z)(t),a=o.findIndex(function(t){return t.key===e.key}),i=(0,c.Z)({},e);return a>=0?(i.times=((null===(n=t[a])||void 0===n?void 0:n.times)||0)+1,o[a]=i):(i.times=0,o.push(i)),d>0&&o.length>d&&(o=o.slice(-d)),o})},close:function(e){w(e)},destroy:function(){x([])}}});var C=i.useState({}),Z=(0,o.Z)(C,2),S=Z[0],O=Z[1];i.useEffect(function(){var e={};y.forEach(function(t){var n=t.placement,r=void 0===n?"topRight":n;r&&(e[r]=e[r]||[],e[r].push(t))}),Object.keys(S).forEach(function(t){e[t]=e[t]||[]}),O(e)},[y]);var k=function(e){O(function(t){var n=(0,c.Z)({},t);return(n[e]||[]).length||delete n[e],n})},j=i.useRef(!1);if(i.useEffect(function(){Object.keys(S).length>0?j.current=!0:j.current&&(null==m||m(),j.current=!1)},[S]),!s)return null;var I=Object.keys(S);return(0,l.createPortal)(i.createElement(i.Fragment,null,I.map(function(e){var t=S[e],n=i.createElement(E,{key:e,configList:t,placement:e,prefixCls:a,className:null==f?void 0:f(e),style:null==p?void 0:p(e),motion:u,onNoticeClose:w,onAllNoticeRemoved:k,stack:g});return v?v(n,{prefixCls:a,key:e}):n})),s)}),Z=n(74126),S=["getContainer","motion","prefixCls","maxCount","className","style","onAllRemoved","stack","renderNotifications"],O=function(){return document.body},k=0;function j(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.getContainer,n=void 0===t?O:t,c=e.motion,l=e.prefixCls,s=e.maxCount,u=e.className,d=e.style,f=e.onAllRemoved,p=e.stack,m=e.renderNotifications,g=(0,a.Z)(e,S),v=i.useState(),h=(0,o.Z)(v,2),b=h[0],y=h[1],x=i.useRef(),w=i.createElement(C,{container:b,ref:x,prefixCls:l,motion:c,maxCount:s,className:u,style:d,onAllRemoved:f,stack:p,renderNotifications:m}),E=i.useState([]),j=(0,o.Z)(E,2),I=j[0],M=j[1],R=(0,Z.zX)(function(e){var t=function(){for(var e={},t=arguments.length,n=Array(t),r=0;rN,eP=(0,c.useMemo)(function(){var e=g;return eM?e=null===q&&L?g:g.slice(0,Math.min(g.length,G/j)):"number"==typeof N&&(e=g.slice(0,N)),e},[g,j,q,N,eM]),eF=(0,c.useMemo)(function(){return eM?g.slice(eE+1):g.slice(eP.length)},[g,eP,eM,eE]),eT=(0,c.useCallback)(function(e,t){var n;return"function"==typeof E?E(e):null!==(n=E&&(null==e?void 0:e[E]))&&void 0!==n?n:t},[E]),eA=(0,c.useCallback)(x||function(e){return e},[x]);function e_(e,t,n){(ex!==e||void 0!==t&&t!==ev)&&(ew(e),n||(eO(eG){e_(r-1,e-o-ef+eo);break}}A&&eH(0)+ef>G&&eh(null)}},[G,K,eo,el,ef,eT,eP]);var ez=eS&&!!eF.length,eL={};null!==ev&&eM&&(eL={position:"absolute",left:ev,top:0});var eD={prefixCls:ek,responsive:eM,component:B,invalidate:eR},eW=w?function(e,t){var n=eT(e,t);return c.createElement(y.Provider,{key:n,value:(0,o.Z)((0,o.Z)({},eD),{},{order:t,item:e,itemKey:n,registerSize:eB,display:t<=eE})},w(e,t))}:function(e,t){var n=eT(e,t);return c.createElement(m,(0,r.Z)({},eD,{order:t,key:n,item:e,renderItem:eA,itemKey:n,registerSize:eB,display:t<=eE}))},eV={order:ez?eE:Number.MAX_SAFE_INTEGER,className:"".concat(ek,"-rest"),registerSize:function(e,t){ea(t),et(eo)},display:ez},eq=P||k,eX=F?c.createElement(y.Provider,{value:(0,o.Z)((0,o.Z)({},eD),eV)},F(eF)):c.createElement(m,(0,r.Z)({},eD,eV),"function"==typeof eq?eq(eF):eq),eG=c.createElement(void 0===_?"div":_,(0,r.Z)({className:s()(!eR&&f,R),style:M,ref:t},z),T&&c.createElement(m,(0,r.Z)({},eD,{responsive:eI,responsiveDisabled:!eM,order:-1,className:"".concat(ek,"-prefix"),registerSize:function(e,t){es(t)},display:!0}),T),eP.map(eW),eN?eX:null,A&&c.createElement(m,(0,r.Z)({},eD,{responsive:eI,responsiveDisabled:!eM,order:eE,className:"".concat(ek,"-suffix"),registerSize:function(e,t){ep(t)},display:!0,style:eL}),A));return eI?c.createElement(u.Z,{onResize:function(e,t){X(t.clientWidth)},disabled:!eM},eG):eG});j.displayName="Overflow",j.Item=C,j.RESPONSIVE=S,j.INVALIDATE=O;var I=j},96257:function(e,t){"use strict";t.Z={items_per_page:"/ page",jump_to:"Go to",jump_to_confirm:"confirm",page:"Page",prev_page:"Previous Page",next_page:"Next Page",prev_5:"Previous 5 Pages",next_5:"Next 5 Pages",prev_3:"Previous 3 Pages",next_3:"Next 3 Pages",page_size:"Page Size"}},31474:function(e,t,n){"use strict";n.d(t,{Z:function(){return z}});var r=n(1119),o=n(2265),a=n(45287);n(32559);var i=n(31686),c=n(41154),l=n(2868),s=n(28791),u=o.createContext(null),d=function(){if("undefined"!=typeof Map)return Map;function e(e,t){var n=-1;return e.some(function(e,r){return e[0]===t&&(n=r,!0)}),n}return function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(t){var n=e(this.__entries__,t),r=this.__entries__[n];return r&&r[1]},t.prototype.set=function(t,n){var r=e(this.__entries__,t);~r?this.__entries__[r][1]=n:this.__entries__.push([t,n])},t.prototype.delete=function(t){var n=this.__entries__,r=e(n,t);~r&&n.splice(r,1)},t.prototype.has=function(t){return!!~e(this.__entries__,t)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(e,t){void 0===t&&(t=null);for(var n=0,r=this.__entries__;n0},e.prototype.connect_=function(){f&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),v?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){f&&this.connected_&&(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(e){var t=e.propertyName,n=void 0===t?"":t;g.some(function(e){return!!~n.indexOf(e)})&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),b=function(e,t){for(var n=0,r=Object.keys(t);n0},e}(),j="undefined"!=typeof WeakMap?new WeakMap:new d,I=function e(t){if(!(this instanceof e))throw TypeError("Cannot call a class as a function.");if(!arguments.length)throw TypeError("1 argument required, but only 0 present.");var n=new k(t,h.getInstance(),this);j.set(this,n)};["observe","unobserve","disconnect"].forEach(function(e){I.prototype[e]=function(){var t;return(t=j.get(this))[e].apply(t,arguments)}});var M=void 0!==p.ResizeObserver?p.ResizeObserver:I,R=new Map,N=new M(function(e){e.forEach(function(e){var t,n=e.target;null===(t=R.get(n))||void 0===t||t.forEach(function(e){return e(n)})})}),P=n(76405),F=n(25049),T=n(41690),A=n(15900),_=function(e){(0,T.Z)(n,e);var t=(0,A.Z)(n);function n(){return(0,P.Z)(this,n),t.apply(this,arguments)}return(0,F.Z)(n,[{key:"render",value:function(){return this.props.children}}]),n}(o.Component),B=o.forwardRef(function(e,t){var n=e.children,r=e.disabled,a=o.useRef(null),d=o.useRef(null),f=o.useContext(u),p="function"==typeof n,m=p?n(a):n,g=o.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),v=!p&&o.isValidElement(m)&&(0,s.Yr)(m),h=v?(0,s.C4)(m):null,b=(0,s.x1)(h,a),y=function(){var e;return(0,l.ZP)(a.current)||(a.current&&"object"===(0,c.Z)(a.current)?(0,l.ZP)(null===(e=a.current)||void 0===e?void 0:e.nativeElement):null)||(0,l.ZP)(d.current)};o.useImperativeHandle(t,function(){return y()});var x=o.useRef(e);x.current=e;var w=o.useCallback(function(e){var t=x.current,n=t.onResize,r=t.data,o=e.getBoundingClientRect(),a=o.width,c=o.height,l=e.offsetWidth,s=e.offsetHeight,u=Math.floor(a),d=Math.floor(c);if(g.current.width!==u||g.current.height!==d||g.current.offsetWidth!==l||g.current.offsetHeight!==s){var p={width:u,height:d,offsetWidth:l,offsetHeight:s};g.current=p;var m=(0,i.Z)((0,i.Z)({},p),{},{offsetWidth:l===Math.round(a)?a:l,offsetHeight:s===Math.round(c)?c:s});null==f||f(m,e,r),n&&Promise.resolve().then(function(){n(m,e)})}},[]);return o.useEffect(function(){var e=y();return e&&!r&&(R.has(e)||(R.set(e,new Set),N.observe(e)),R.get(e).add(w)),function(){R.has(e)&&(R.get(e).delete(w),R.get(e).size||(N.unobserve(e),R.delete(e)))}},[a.current,r]),o.createElement(_,{ref:d},v?o.cloneElement(m,{ref:b}):m)}),H=o.forwardRef(function(e,t){var n=e.children;return("function"==typeof n?[n]:(0,a.Z)(n)).map(function(n,a){var i=(null==n?void 0:n.key)||"".concat("rc-observer-key","-").concat(a);return o.createElement(B,(0,r.Z)({},e,{key:i,ref:0===a?t:void 0}),n)})});H.Collection=function(e){var t=e.children,n=e.onBatchResize,r=o.useRef(0),a=o.useRef([]),i=o.useContext(u),c=o.useCallback(function(e,t,o){r.current+=1;var c=r.current;a.current.push({size:e,element:t,data:o}),Promise.resolve().then(function(){c===r.current&&(null==n||n(a.current),a.current=[])}),null==i||i(e,t,o)},[n,i]);return o.createElement(u.Provider,{value:c},t)};var z=H},5769:function(e,t,n){"use strict";n.d(t,{G:function(){return i},Z:function(){return h}});var r=n(36760),o=n.n(r),a=n(2265);function i(e){var t=e.children,n=e.prefixCls,r=e.id,i=e.overlayInnerStyle,c=e.bodyClassName,l=e.className,s=e.style;return a.createElement("div",{className:o()("".concat(n,"-content"),l),style:s},a.createElement("div",{className:o()("".concat(n,"-inner"),c),id:r,role:"tooltip",style:i},"function"==typeof t?t():t))}var c=n(1119),l=n(31686),s=n(6989),u=n(97821),d={shiftX:64,adjustY:1},f={adjustX:1,shiftY:!0},p=[0,0],m={left:{points:["cr","cl"],overflow:f,offset:[-4,0],targetOffset:p},right:{points:["cl","cr"],overflow:f,offset:[4,0],targetOffset:p},top:{points:["bc","tc"],overflow:d,offset:[0,-4],targetOffset:p},bottom:{points:["tc","bc"],overflow:d,offset:[0,4],targetOffset:p},topLeft:{points:["bl","tl"],overflow:d,offset:[0,-4],targetOffset:p},leftTop:{points:["tr","tl"],overflow:f,offset:[-4,0],targetOffset:p},topRight:{points:["br","tr"],overflow:d,offset:[0,-4],targetOffset:p},rightTop:{points:["tl","tr"],overflow:f,offset:[4,0],targetOffset:p},bottomRight:{points:["tr","br"],overflow:d,offset:[0,4],targetOffset:p},rightBottom:{points:["bl","br"],overflow:f,offset:[4,0],targetOffset:p},bottomLeft:{points:["tl","bl"],overflow:d,offset:[0,4],targetOffset:p},leftBottom:{points:["br","bl"],overflow:f,offset:[-4,0],targetOffset:p}},g=n(92491),v=["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","motion","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle","arrowContent","overlay","id","showArrow","classNames","styles"],h=(0,a.forwardRef)(function(e,t){var n,r,d,f=e.overlayClassName,p=e.trigger,h=e.mouseEnterDelay,b=e.mouseLeaveDelay,y=e.overlayStyle,x=e.prefixCls,w=void 0===x?"rc-tooltip":x,E=e.children,C=e.onVisibleChange,Z=e.afterVisibleChange,S=e.transitionName,O=e.animation,k=e.motion,j=e.placement,I=e.align,M=e.destroyTooltipOnHide,R=e.defaultVisible,N=e.getTooltipContainer,P=e.overlayInnerStyle,F=(e.arrowContent,e.overlay),T=e.id,A=e.showArrow,_=e.classNames,B=e.styles,H=(0,s.Z)(e,v),z=(0,g.Z)(T),L=(0,a.useRef)(null);(0,a.useImperativeHandle)(t,function(){return L.current});var D=(0,l.Z)({},H);return"visible"in e&&(D.popupVisible=e.visible),a.createElement(u.Z,(0,c.Z)({popupClassName:o()(f,null==_?void 0:_.root),prefixCls:w,popup:function(){return a.createElement(i,{key:"content",prefixCls:w,id:z,bodyClassName:null==_?void 0:_.body,overlayInnerStyle:(0,l.Z)((0,l.Z)({},P),null==B?void 0:B.body)},F)},action:void 0===p?["hover"]:p,builtinPlacements:m,popupPlacement:void 0===j?"right":j,ref:L,popupAlign:void 0===I?{}:I,getPopupContainer:N,onPopupVisibleChange:C,afterPopupVisibleChange:Z,popupTransitionName:S,popupAnimation:O,popupMotion:k,defaultPopupVisible:R,autoDestroy:void 0!==M&&M,mouseLeaveDelay:void 0===b?.1:b,popupStyle:(0,l.Z)((0,l.Z)({},y),null==B?void 0:B.root),mouseEnterDelay:void 0===h?0:h,arrow:void 0===A||A},D),(r=(null==(n=a.Children.only(E))?void 0:n.props)||{},d=(0,l.Z)((0,l.Z)({},r),{},{"aria-describedby":F?z:null}),a.cloneElement(E,d)))})},45287:function(e,t,n){"use strict";n.d(t,{Z:function(){return function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=[];return o.Children.forEach(t,function(t){(null!=t||n.keepEmpty)&&(Array.isArray(t)?a=a.concat(e(t)):(0,r.Z)(t)&&t.props?a=a.concat(e(t.props.children,n)):a.push(t))}),a}}});var r=n(10477),o=n(2265)},94981:function(e,t,n){"use strict";function r(){return!!("undefined"!=typeof window&&window.document&&window.document.createElement)}n.d(t,{Z:function(){return r}})},2161:function(e,t,n){"use strict";function r(e,t){if(!e)return!1;if(e.contains)return e.contains(t);for(var n=t;n;){if(n===e)return!0;n=n.parentNode}return!1}n.d(t,{Z:function(){return r}})},21717:function(e,t,n){"use strict";n.d(t,{hq:function(){return g},jL:function(){return m}});var r=n(31686),o=n(94981),a=n(2161),i="data-rc-order",c="data-rc-priority",l=new Map;function s(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.mark;return t?t.startsWith("data-")?t:"data-".concat(t):"rc-util-key"}function u(e){return e.attachTo?e.attachTo:document.querySelector("head")||document.body}function d(e){return Array.from((l.get(e)||e).children).filter(function(e){return"STYLE"===e.tagName})}function f(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(0,o.Z)())return null;var n=t.csp,r=t.prepend,a=t.priority,l=void 0===a?0:a,s="queue"===r?"prependQueue":r?"prepend":"append",f="prependQueue"===s,p=document.createElement("style");p.setAttribute(i,s),f&&l&&p.setAttribute(c,"".concat(l)),null!=n&&n.nonce&&(p.nonce=null==n?void 0:n.nonce),p.innerHTML=e;var m=u(t),g=m.firstChild;if(r){if(f){var v=(t.styles||d(m)).filter(function(e){return!!["prepend","prependQueue"].includes(e.getAttribute(i))&&l>=Number(e.getAttribute(c)||0)});if(v.length)return m.insertBefore(p,v[v.length-1].nextSibling),p}m.insertBefore(p,g)}else m.appendChild(p);return p}function p(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=u(t);return(t.styles||d(n)).find(function(n){return n.getAttribute(s(t))===e})}function m(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=p(e,t);n&&u(t).removeChild(n)}function g(e,t){var n,o,i,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},m=u(c),g=d(m),v=(0,r.Z)((0,r.Z)({},c),{},{styles:g});!function(e,t){var n=l.get(e);if(!n||!(0,a.Z)(document,n)){var r=f("",t),o=r.parentNode;l.set(e,o),e.removeChild(r)}}(m,v);var h=p(t,v);if(h)return null!==(n=v.csp)&&void 0!==n&&n.nonce&&h.nonce!==(null===(o=v.csp)||void 0===o?void 0:o.nonce)&&(h.nonce=null===(i=v.csp)||void 0===i?void 0:i.nonce),h.innerHTML!==e&&(h.innerHTML=e),h;var b=f(e,v);return b.setAttribute(s(v),t),b}},2868:function(e,t,n){"use strict";n.d(t,{Sh:function(){return i},ZP:function(){return l},bn:function(){return c}});var r=n(41154),o=n(2265),a=n(54887);function i(e){return e instanceof HTMLElement||e instanceof SVGElement}function c(e){return e&&"object"===(0,r.Z)(e)&&i(e.nativeElement)?e.nativeElement:i(e)?e:null}function l(e){var t;return c(e)||(e instanceof o.Component?null===(t=a.findDOMNode)||void 0===t?void 0:t.call(a,e):null)}},2857:function(e,t){"use strict";t.Z=function(e){if(!e)return!1;if(e instanceof Element){if(e.offsetParent)return!0;if(e.getBBox){var t=e.getBBox(),n=t.width,r=t.height;if(n||r)return!0}if(e.getBoundingClientRect){var o=e.getBoundingClientRect(),a=o.width,i=o.height;if(a||i)return!0}}return!1}},13211:function(e,t,n){"use strict";function r(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}function o(e){return r(e) instanceof ShadowRoot?r(e):null}n.d(t,{A:function(){return o}})},95814:function(e,t){"use strict";var n={MAC_ENTER:3,BACKSPACE:8,TAB:9,NUM_CENTER:12,ENTER:13,SHIFT:16,CTRL:17,ALT:18,PAUSE:19,CAPS_LOCK:20,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,PRINT_SCREEN:44,INSERT:45,DELETE:46,ZERO:48,ONE:49,TWO:50,THREE:51,FOUR:52,FIVE:53,SIX:54,SEVEN:55,EIGHT:56,NINE:57,QUESTION_MARK:63,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,META:91,WIN_KEY_RIGHT:92,CONTEXT_MENU:93,NUM_ZERO:96,NUM_ONE:97,NUM_TWO:98,NUM_THREE:99,NUM_FOUR:100,NUM_FIVE:101,NUM_SIX:102,NUM_SEVEN:103,NUM_EIGHT:104,NUM_NINE:105,NUM_MULTIPLY:106,NUM_PLUS:107,NUM_MINUS:109,NUM_PERIOD:110,NUM_DIVISION:111,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,NUMLOCK:144,SEMICOLON:186,DASH:189,EQUALS:187,COMMA:188,PERIOD:190,SLASH:191,APOSTROPHE:192,SINGLE_QUOTE:222,OPEN_SQUARE_BRACKET:219,BACKSLASH:220,CLOSE_SQUARE_BRACKET:221,WIN_KEY:224,MAC_FF_META:224,WIN_IME:229,isTextModifyingKeyEvent:function(e){var t=e.keyCode;if(e.altKey&&!e.ctrlKey||e.metaKey||t>=n.F1&&t<=n.F12)return!1;switch(t){case n.ALT:case n.CAPS_LOCK:case n.CONTEXT_MENU:case n.CTRL:case n.DOWN:case n.END:case n.ESC:case n.HOME:case n.INSERT:case n.LEFT:case n.MAC_FF_META:case n.META:case n.NUMLOCK:case n.NUM_CENTER:case n.PAGE_DOWN:case n.PAGE_UP:case n.PAUSE:case n.PRINT_SCREEN:case n.RIGHT:case n.SHIFT:case n.UP:case n.WIN_KEY:case n.WIN_KEY_RIGHT:return!1;default:return!0}},isCharacterKey:function(e){if(e>=n.ZERO&&e<=n.NINE||e>=n.NUM_ZERO&&e<=n.NUM_MULTIPLY||e>=n.A&&e<=n.Z||-1!==window.navigator.userAgent.indexOf("WebKit")&&0===e)return!0;switch(e){case n.SPACE:case n.QUESTION_MARK:case n.NUM_PLUS:case n.NUM_MINUS:case n.NUM_PERIOD:case n.NUM_DIVISION:case n.SEMICOLON:case n.DASH:case n.EQUALS:case n.COMMA:case n.PERIOD:case n.SLASH:case n.APOSTROPHE:case n.SINGLE_QUOTE:case n.OPEN_SQUARE_BRACKET:case n.BACKSLASH:case n.CLOSE_SQUARE_BRACKET:return!0;default:return!1}}};t.Z=n},10477:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(41154),o=Symbol.for("react.element"),a=Symbol.for("react.transitional.element"),i=Symbol.for("react.fragment");function c(e){return e&&"object"===(0,r.Z)(e)&&(e.$$typeof===o||e.$$typeof===a)&&e.type===i}},3208:function(e,t,n){"use strict";n.d(t,{Z:function(){return i},o:function(){return c}});var r,o=n(21717);function a(e){var t,n,r="rc-scrollbar-measure-".concat(Math.random().toString(36).substring(7)),a=document.createElement("div");a.id=r;var i=a.style;if(i.position="absolute",i.left="0",i.top="0",i.width="100px",i.height="100px",i.overflow="scroll",e){var c=getComputedStyle(e);i.scrollbarColor=c.scrollbarColor,i.scrollbarWidth=c.scrollbarWidth;var l=getComputedStyle(e,"::-webkit-scrollbar"),s=parseInt(l.width,10),u=parseInt(l.height,10);try{var d=s?"width: ".concat(l.width,";"):"",f=u?"height: ".concat(l.height,";"):"";(0,o.hq)("\n#".concat(r,"::-webkit-scrollbar {\n").concat(d,"\n").concat(f,"\n}"),r)}catch(e){console.error(e),t=s,n=u}}document.body.appendChild(a);var p=e&&t&&!isNaN(t)?t:a.offsetWidth-a.clientWidth,m=e&&n&&!isNaN(n)?n:a.offsetHeight-a.clientHeight;return document.body.removeChild(a),(0,o.jL)(r),{width:p,height:m}}function i(e){return"undefined"==typeof document?0:((e||void 0===r)&&(r=a()),r.width)}function c(e){return"undefined"!=typeof document&&e&&e instanceof Element?a(e):{width:0,height:0}}},58525:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(2265);function o(e){var t=r.useRef();return t.current=e,r.useCallback(function(){for(var e,n=arguments.length,r=Array(n),o=0;o2&&void 0!==arguments[2]&&arguments[2],a=new Set;return function e(t,i){var c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,l=a.has(t);if((0,o.ZP)(!l,"Warning: There may be circular references"),l)return!1;if(t===i)return!0;if(n&&c>1)return!1;a.add(t);var s=c+1;if(Array.isArray(t)){if(!Array.isArray(i)||t.length!==i.length)return!1;for(var u=0;u