import{o as e}from"./rolldown-runtime-GyhWBpbT.js";import{F as t,s as n}from"./react-vendor-ChE_eana.js";import{Fr as r,Gr as i,Nr as a,Ur as o,ii as s,ni as c}from"./mui-vendor-K60S-ugg.js";import{st as l}from"./index-Cz-yne81.js";s();var u=c(),d=({children:e,partnerType:s})=>{let c=t(),{data:d,isLoading:f,error:p}=n({queryKey:[`channelConfig`],queryFn:async()=>{let e=await l.get(`/api/masters/channel-config/`);return{enable_superstockist:e.data.enable_superstockist||!1,enable_distributor:e.data.enable_distributor||!1,enable_retailer:e.data.enable_retailer||!1}},refetchOnMount:`always`,staleTime:0}),m=d?s===`superstockist`?d.enable_superstockist:s===`distributor`?d.enable_distributor:d.enable_retailer:!1;return f?(0,u.jsx)(r,{sx:{display:`flex`,justifyContent:`center`,alignItems:`center`,minHeight:`60vh`},children:(0,u.jsx)(i,{})}):p?(0,u.jsx)(r,{sx:{p:3},children:(0,u.jsx)(o,{severity:`error`,children:`Failed to load channel configuration`})}):m?(0,u.jsx)(u.Fragment,{children:e}):(0,u.jsxs)(r,{sx:{display:`flex`,flexDirection:`column`,justifyContent:`center`,alignItems:`center`,minHeight:`60vh`,gap:2},children:[(0,u.jsxs)(o,{severity:`warning`,sx:{maxWidth:600},children:[s.charAt(0).toUpperCase()+s.slice(1).replace(`_`,` `),` feature is currently disabled. Please enable it in Channel Configuration to access this feature.`]}),(0,u.jsxs)(r,{sx:{display:`flex`,gap:2},children:[(0,u.jsx)(a,{variant:`outlined`,onClick:()=>c(`/masters`),children:`Back to Masters`}),(0,u.jsx)(a,{variant:`contained`,onClick:()=>c(`/settings/channel-configuration`),children:`Channel Configuration`})]})]})};export{d as t};