import{lt as e,o as t,u as n}from"./vscode-api-DjORcpSo.js";import{d as r,o as i,u as a}from"./statsig-BP9zNYqZ.js";import{t as o}from"./use-auth-CI-WraL2.js";import{p as s}from"./codex-api-BCmX_VRU.js";import{n as c,t as l}from"./skus-CJAzlvMK.js";var u=e(),d=`1636924626`,f=`enable_free_go_usage_settings`;function p(){let e=(0,u.c)(21),{authMethod:l,isLoading:p}=o(),h=l===`chatgpt`,_=a(d),v=i(`3909937021`),y=r(),{data:b,isLoading:x,hasEverErrored:S}=s(),C;e[0]===h?C=e[1]:(C={queryConfig:{enabled:h,staleTime:n.ONE_MINUTE}},e[0]=h,e[1]=C);let{data:w,isLoading:T}=t(`account-info`,C),E=b?.plan_type??(!x||S?w?.plan:void 0),D;e[2]===E?D=e[3]:(D=g(E),e[2]=E,e[3]=D);let O=D,k,A,j,M;if(e[4]!==l||e[5]!==S||e[6]!==h||e[7]!==x||e[8]!==O||e[9]!==v||e[10]!==y||e[11]!==E||e[12]!==_){let t=c(E),n=h&&O&&!y?_.get(f,!1):!1,r=h&&t&&v;k=h&&x&&!S,j=h&&O&&y,A=h&&t&&y,M=m({authMethod:l,plan:E,isFreeGoUsageSettingsEnabled:n,isEnterpriseUsageSettingsEnabled:r}),e[4]=l,e[5]=S,e[6]=h,e[7]=x,e[8]=O,e[9]=v,e[10]=y,e[11]=E,e[12]=_,e[13]=k,e[14]=A,e[15]=j,e[16]=M}else k=e[13],A=e[14],j=e[15],M=e[16];let N=p||h&&T||k||j||A,P;return e[17]!==E||e[18]!==M||e[19]!==N?(P={...M,isUsageSettingsAccessLoading:N,plan:E},e[17]=E,e[18]=M,e[19]=N,e[20]=P):P=e[20],P}function m({authMethod:e,plan:t,isFreeGoUsageSettingsEnabled:n,isEnterpriseUsageSettingsEnabled:r=!1}){let i=e===`chatgpt`,a=i&&h(t),o=g(t),s=c(t);return{canManageCreditSettings:a,isUsageSettingsVisible:a||i&&o&&n||i&&s&&r}}function h(e){return e===l.PLUS||e===l.PRO||e===l.PROLITE}function g(e){return e===l.FREE||e===l.GO}export{p as t};
//# sourceMappingURL=use-usage-settings-access-CTzpOQCS.js.map