import{ao as a,L as m,e3 as C,ck as f,aR as R,aq as b,c4 as j,bc as k,az as F,aF as P,m as v,o as g,W as E,E as N,r as V,p as w}from"./app-k0jcl5PQ.js";import{l as c}from"./DLmnDxSd.chunk.js";import{F as B}from"./DzRq1F5-.chunk.js";import{F as y}from"./DV1GpLCe.chunk.js";import{F as S}from"./C3DvQ1wU.chunk.js";import{R as u}from"./DDerB2uY.chunk.js";import"./CW7x8M-z.chunk.js";import"./Di9d6zcy.chunk.js";import"./CKctgafI.chunk.js";const l="shared.editResource",s=m.encloseNamespace(l),I=c.object().shape({name:c.string().trim().max(255,()=>s("nameTooLong")).required(()=>s("nameRequired")).default("")}).noUnknown();function L(e){const t=C();return a.jsxs(f,{children:[a.jsx(y,{label:s("name"),name:"name",id:"name",value:t.values.name,placeholder:s("namePlaceholder"),autoFocus:!0}),a.jsxs("div",{className:e.buttonContainerClassName||"",children:[a.jsx(R,{variant:"link",className:"me-2",onClick:e.onClickCancel,children:a.jsx(b,{namespace:l,phrase:"cancel"})}),a.jsx(B,{isNew:!1,variant:e.submitBtnVariant})]})]})}d.defaultProps={submitBtnVariant:"primary"};function d(e){return a.jsx(S,{initialValues:e.resource,validationSchema:I,onSubmit:e.saveResource,children:a.jsx(L,{onClickCancel:e.onClickCancel,buttonContainerClassName:e.buttonContainerClassName,submitBtnVariant:e.submitBtnVariant})})}const n=m.encloseNamespace("shared.editResourceView");function G(e){const t=j(),r=k(),o=F(u.resource(e.resourceId));function p(i){const h=()=>{r.success(n("success")),g.logUserAction({id:e.resourceId,parentId:e.videoId,name:i.name},{location:w.Popup,actionType:V.Edit,entity:N.Resource,workflowPhase:E.Complete})},x=()=>r.error(n("error"));v(t,u.updateResource(e.resourceId,i,h,x,e.closePopup))}return a.jsx(P,{title:n("heading"),closePopup:e.closePopup,showLoadingSpinner:!o.data,children:!!o.data&&a.jsx(d,{resource:o.data,saveResource:p,onClickCancel:e.closePopup,buttonContainerClassName:"d-flex justify-content-end border-top pt-3 px-3 mx-n3",submitBtnVariant:"dark"})})}export{G as EditResourceView};
//# sourceMappingURL=84OC82Oy.chunk.js.map
