import{r as e}from"./rolldown-runtime-iuO8RvI4.js";import{Gl as s,bi as t}from"./shared-0-C4kdVF7Y.js";import{ki as n}from"./vendor-frame-CwiylG4Y.js";import{nn as a}from"./vendor-all-2-BJdkbLSj.js";import{w as i}from"./shared-frame-DbQbH4Yr.js";import{Qi as o}from"./shared-4-6CEyRAHb.js";import{kt as r,ot as m,ut as u}from"./shared-3-D-Ux4aGn.js";import{n as d}from"./c66328a02-DNiR1l6P.js";import{t as c}from"./c5167c748-DP_4E3py.js";var l=e({SetOverageLimitsBody:()=>h,SetOverageLimitsModal:()=>g}),p=n();function h({onDone:e,currentLimit:s,isPureUsageBased:n,hideDescription:a}){const i=t(),{data:o,refetch:d}=u(),l=o?.currency,{mutate:h,isPending:g}=r({onSuccess:s=>{d(),i.track({event_key:"claudeai.overages.monthly_limit_updated",is_unlimited:null===s.monthly_credit_limit}),e()}}),{mutate:j,isPending:y}=m({onSuccess:s=>{d(),i.track({event_key:"claudeai.overages.monthly_limit_set",is_unlimited:null===s.monthly_credit_limit}),e()}});return(0,p.jsx)(c,{onNext:e=>{void 0!==s?h({monthlyLimit:"unlimited"===e?null:Math.round(100*e),currency:l}):j({monthlyLimit:"unlimited"===e?null:Math.round(100*e),isEnabled:!0,currency:l})},currentLimit:s,isPending:g||y,isSetupFlow:!1,isPureUsageBased:n,contractCapCents:o?.contractSpendCapCents??void 0,hideDescription:a})}function g({isOpen:e,onClose:t,currentLimit:n,isPureUsageBased:r,onBack:m}){const u=s(),c=o(),l=(0,p.jsx)(a,{defaultMessage:"Set monthly spend limit",id:"XX5bYk4jBa"});return(0,p.jsx)(i.Root,{open:e,onOpenChange:e=>!e&&t(),children:m?(0,p.jsx)(d,{onBack:m,title:l,children:(0,p.jsx)(h,{onDone:t,currentLimit:n,isPureUsageBased:r})}):(0,p.jsxs)(i.Popup,{size:"md",children:[(0,p.jsx)(i.Header,{description:r?u?(0,p.jsx)(a,{defaultMessage:"You can set a maximum amount your org can spend on Claude usage per month.",id:"j9F//smyFV"}):(0,p.jsx)(a,{defaultMessage:"You can set a maximum amount you can spend on Claude usage per month.",id:"ttCKBZjl7g"}):c?u?(0,p.jsx)(a,{defaultMessage:"You can set a maximum amount your org can spend on extra usage per month.",id:"dS0ay0syRz"}):(0,p.jsx)(a,{defaultMessage:"You can set a maximum amount you can spend on extra usage per month.",id:"d7TvT9SzSL"}):u?(0,p.jsx)(a,{defaultMessage:"Set a monthly limit for how much your org can spend on usage credits.",id:"baRcrmm2eL"}):(0,p.jsx)(a,{defaultMessage:"Set a monthly limit for how much you can spend on usage credits.",id:"p4dedeqQvo"}),children:l}),(0,p.jsx)(h,{onDone:t,currentLimit:n,isPureUsageBased:r,hideDescription:!0})]})})}export{l as n,g as t};