import{a4 as u,c2 as T,h as a,i as e,o as l,b as x,aT as R,ag as f,j as i,e9 as I}from"./app-BgLa5dit.js";import{B as M}from"./3nM7jLnE.chunk.js";import{C as U}from"./ChrB5FYK.chunk.js";import{a as _}from"./DR2FaZH9.chunk.js";import{C as O}from"./q-IBKcuF.chunk.js";import{s as g}from"./8iu0vnCW.chunk.js";function h(t,s,o){const d=s(u.CustomerIpAuth),r=s(u.CustomerOptionsManage),m=s(u.CustomerSso),c=o==null?void 0:o.some(n=>n.id===T.Online);return[{id:"overview",text:"Overview",appLink:{application:e.CRM_STUDIO,action:a.CrmStudio.CUSTOMER_OVERVIEW,args:[t]}},{id:"users",text:"Users",appLink:{application:e.CRM_STUDIO,action:a.CrmStudio.CUSTOMER_USERS,args:[t]}},{id:"products",text:"Products",appLink:{application:e.CRM_STUDIO,action:a.CrmStudio.CUSTOMER_PRODUCTS,args:[t]}},{id:"content",text:"Content",appLink:{application:e.CRM_STUDIO,action:a.CrmStudio.CUSTOMER_CONTENT,args:[t]}},{id:"options",text:"Options",appLink:{application:e.CRM_STUDIO,action:a.CrmStudio.CUSTOMER_OPTIONS,args:[t]}},{id:"sso",text:"SSO",appLink:{application:e.CRM_STUDIO,action:a.CrmStudio.CUSTOMER_SSO,args:[t]}},{id:"domains",text:"Domains",appLink:{application:e.CRM_STUDIO,action:a.CrmStudio.CUSTOMER_DOMAINS,args:[t]}},{id:"pilot",text:"Pilot",appLink:{application:e.CRM_STUDIO,action:a.CrmStudio.CUSTOMER_PILOT,args:[t]}},{id:"cft",text:"CFT",appLink:{application:e.CRM_STUDIO,action:a.CrmStudio.CUSTOMER_CFT,args:[t]}},{id:"settings",text:"Access Settings",appLink:{application:e.CRM_STUDIO,action:a.CrmStudio.CUSTOMER_ACCESS_SETTINGS_DOMAIN,args:[t]}},{id:"ipAuth",text:"IP Auth",appLink:{application:e.CRM_STUDIO,action:a.CrmStudio.CUSTOMER_IP_AUTH,args:[t]}}].filter(n=>!(n.id==="pilot"&&c||n.id==="options"&&!r||n.id==="ipAuth"&&!d||(n.id==="sso"||n.id==="domains")&&!m))}function v(t){var p,n,S;const s=l(O.customer(t.id)),{hasPermissions:o,isLoading:d}=x();R.useEffect(()=>{!s.data||!s.data.id||_(s.data.id,f.Customer)},[s.hasCompleted]);const r=l(O.getCustomerProducts(t.id));if(!s.hasCompleted||!r.hasCompleted||d)return i.jsx(i.Fragment,{});const m=h(t.id,o,r.data),c=(p=s.data)==null?void 0:p.name,C=(n=s.data)==null?void 0:n.crmId;return i.jsxs("div",{className:"d-flex flex-column gap-4",children:[i.jsxs("div",{className:"d-flex flex-row justify-content-between",children:[i.jsxs("div",{children:[i.jsxs("p",{children:[c," · ",C]}),i.jsx("h1",{children:t.title}),i.jsx(M,{breadcrumbs:[{name:"Curation Studio"},{name:"Customers",appLink:{application:e.CRM_STUDIO,action:a.CrmStudio.CUSTOMERS}},{name:c+" · "+C,appLink:{application:e.CRM_STUDIO,action:a.CrmStudio.CUSTOMER_OVERVIEW,args:[t.id]},active:!((S=t.extraBreadcrumbsItems)!=null&&S.length)},...t.extraBreadcrumbsItems||[]].filter(Boolean)})]}),t.rightContent&&i.jsx("div",{children:t.rightContent})]}),i.jsxs("div",{className:"w-100 h-100 d-flex flex-row gap-3",children:[i.jsx("div",{className:g.crmStudioNav,children:i.jsx(U,{currentTabId:t.currentTabId,items:m})}),i.jsx("div",{className:"flex-grow-1",children:t.loading?i.jsx(I,{}):t.children})]})]})}export{v as C};
//# sourceMappingURL=C2cKa2R1.chunk.js.map
