import{L as p,ao as a,e3 as _,ck as L,bN as h,c4 as k,bc as y,az as C,aI as N,v as S,f as j,e as f,m as E}from"./app-k0jcl5PQ.js";import{u as P}from"./CAxN5LKv.chunk.js";import{C as o}from"./BRytmq3u.chunk.js";import{F as T}from"./DzRq1F5-.chunk.js";import{F as $}from"./DV1GpLCe.chunk.js";import{F as I}from"./C3DvQ1wU.chunk.js";import{l as d}from"./DLmnDxSd.chunk.js";import{E as A}from"./DJz7dW8z.chunk.js";import{L as g}from"./uC6ielRn.chunk.js";import{u as H}from"./DRKUY7jf.chunk.js";import{P as B}from"./CCtuxSlD.chunk.js";import"./DIAJ896Y.chunk.js";import"./BhAq_-86.chunk.js";import"./Bj7bJt_4.chunk.js";import"./Di9d6zcy.chunk.js";import"./CKctgafI.chunk.js";import"./CW7x8M-z.chunk.js";import"./CPXlV0fg.chunk.js";const G="settings.editLtiConsumerForm",x=p.encloseNamespace(G),D=d.object().shape({name:d.string().max(255,()=>x("nameExceeds")).required(()=>x("nameRequired")).default("").trim()}),R="_formContainer_1141p_1",W={formContainer:R},q="settings.editLtiConsumerForm",s=p.encloseNamespace(q);function M(){const e=_();return a.jsxs(L,{className:W.formContainer,children:[a.jsx($,{label:s("name"),type:"text",name:"name",id:"name",autoFocus:!0,showRequiredStar:!0}),a.jsx(o,{value:e.values.key,label:s("key"),styling:"greyed"}),a.jsx(o,{value:e.values.secret,label:s("secret"),styling:"greyed"}),a.jsx(o,{value:e.values.toolUrl,label:s("launchUrl"),styling:"greyed"}),a.jsx(o,{value:e.values.configUrl,label:s("xmlUrl"),styling:"greyed"}),a.jsx(T,{variant:"dark",submitText:s("saveChanges"),isNew:!1,size:"lg"})]})}function U(e){return a.jsx(I,{initialValues:e.consumer,onSubmit:e.onClickSave,validationSchema:D,children:a.jsx(M,{})})}const O="_partialHeading_1jpm0_1",V="_partialDeleteButton_1jpm0_5",z="_partialFormWrapper_1jpm0_9",w="_partialFormGroup_1jpm0_12",K="_partialLabel_1jpm0_15",J="_partialInput_1jpm0_20",Q="_partialSubmit_1jpm0_23",t={partialHeading:O,partialDeleteButton:V,partialFormWrapper:z,partialFormGroup:w,partialLabel:K,partialInput:J,partialSubmit:Q};function i(){return a.jsxs("div",{className:t.partialFormGroup,children:[a.jsx("div",{className:`${t.partialLabel} partial-loading-background`}),a.jsx("div",{className:`${t.partialInput} partial-loading-background rounded`})]})}function X(){return a.jsxs("div",{className:"px-3 pb-3",children:[a.jsxs("div",{className:"d-flex align-items-center justify-content-between",children:[a.jsx("div",{className:`${t.partialHeading} mb-2 partial-loading-background`}),a.jsx("div",{className:`${t.partialDeleteButton} partial-loading-background`})]}),a.jsx("div",{className:"pb-3",children:a.jsx(B,{})}),a.jsxs("div",{className:t.partialFormWrapper,children:[a.jsx(i,{}),a.jsx(i,{}),a.jsx(i,{}),a.jsx(i,{}),a.jsx(i,{}),a.jsx("div",{className:`${t.partialSubmit} partial-loading-background rounded`})]})]})}const Y="settings.editLtiConsumer",m=p.encloseNamespace(Y);function Z(e){return{application:f.SETTINGS,action:j.Settings.DELETE_LTI_PLATFORM,params:{consumerKey:e}}}function ba(e){h({title:m("pageTitle")});const b=k(),c=y(),{canAccess:l}=H(),r=C(g.getConsumer(e.consumerKey));P(r);function v(n,u){const F=g.updateConsumer({name:n.name,key:n.key,secret:n.secret},()=>{c.success(m("success",{name:n.name,escapeText:!0})),u()},()=>{c.error(m("error",{name:r.data.name,escapeText:!0})),u()});E(b,F)}return N.useEffect(()=>{l===!1&&S.trigger({application:f.SETTINGS,action:j.Settings.HOME})},[l]),l!==!0?a.jsx(a.Fragment,{}):r.data?a.jsxs("div",{className:"px-3 pb-3",children:[a.jsx(A,{name:r.data.name,deleteAppLink:Z(r.data.key)}),a.jsx(U,{consumer:r.data,onClickSave:v})]}):a.jsx(X,{})}export{ba as EditLtiConsumerView};
//# sourceMappingURL=BHHPCV3w.chunk.js.map
