import{o as S,k as v,l as x,R as F,j as s,G as j,az as b,cD as y,F as R}from"./app-BgLa5dit.js";import{A as q}from"./MscBOfIw.chunk.js";import{g as B,D as C}from"./R0q2T0lv.chunk.js";import{b as c,a as I,D as m,A as J}from"./DlWawfes.chunk.js";import"./BbLwn0px.chunk.js";import"./D6bTl1fN.chunk.js";import"./kOrk-qeI.chunk.js";const O="settings.automaticAccess",u=R.encloseNamespace(O);function T(l){const{customerId:a}=l,n=B(a),t=S(a&&m.domains(a)),p=v(),o=x(),[d,g]=F.useState([]);async function A(e,f){var i;const D=c.formatRequestData(t.data,e.automaticAccess,J.AutoJoin);try{await p(m.updateDomains(a,D)),o.success(u("success"))}catch(r){(i=r.responseJSON)!=null&&i.problems&&g(r.responseJSON.problems),o.error(u("error"))}finally{f()}}if(!t.hasCompleted)return s.jsx(s.Fragment,{});const h={requestingAccess:c.getInitialJoinRequests(t.data),teacherInvites:!1,automaticAccess:c.getInitialAccessBehaviour(t.data)};return s.jsxs(s.Fragment,{children:[s.jsx(C,{active:"automatic-access",appLinks:n}),s.jsx(j,{initialValues:h,onSubmit:A,validate:e=>I({values:e,alerts:o,setShowPopup:()=>{}}),validateOnChange:!1,validateOnBlur:!1,children:e=>s.jsxs(b,{children:[s.jsx(q,{formikProps:e,errors:d,appLinks:n}),s.jsx(y,{variant:"dark",disabled:!e.dirty,onClick:()=>e.submitForm(),children:"Save changes"})]})})]})}export{T as AutomaticAccessView};
//# sourceMappingURL=UTA9BnUq.chunk.js.map
