import{ao as a,ei as F,e3 as j,aT as y,aq as o,L as h,bc as p,az as I,bv as w,bw as C,M as T}from"./app-k0jcl5PQ.js";import{l as d}from"./DLmnDxSd.chunk.js";import{F as L}from"./C3DvQ1wU.chunk.js";import{u as N}from"./CX-R8N_3.chunk.js";import{u as V}from"./C8ys3yUG.chunk.js";import{S as D}from"./D-iHOjjO.chunk.js";const H=d.object().shape({preventScrubbing:d.boolean(),immediateFeedback:d.boolean()});function m(e){return a.jsxs("div",{children:[a.jsxs("div",{className:"d-flex flex-row gap-1 justify-content-between align-items-center w-100 mb-1",children:[a.jsx("label",{className:"m-0 cursor-pointer",htmlFor:e.id,onClick:e.onClick,children:e.label}),a.jsx(F,{id:e.id,name:e.id,onClick:e.onClick,on:e.checked})]}),a.jsx("p",{className:"m-0 text-secondary",children:e.description})]})}const l="sharev2.shareSettingsForm",c=h.encloseNamespace(l);function E(e){const t=j();function s(i,n){t.setFieldValue(i,n),t.submitForm()}return a.jsxs(y,{className:"d-flex flex-column gap-2",children:[!e.hideFormHeading&&a.jsxs("div",{className:"d-flex flex-row gap-2 justify-content-between align-items-center",children:[a.jsx("h3",{className:"h6 m-0",children:a.jsx(o,{namespace:l,phrase:"heading"})}),typeof e.onClickDelete=="function"&&a.jsx("a",{onClick:e.onClickDelete,className:"text-danger cursor-pointer",children:e.deleteText||a.jsx(o,{namespace:l,phrase:"delete"})})]}),a.jsxs("div",{className:"d-flex flex-column gap-2",children:[e.showPreventScrubbingField&&a.jsx(m,{id:"prevent-scrubbing",label:c("preventScrubbingLabel"),description:c("preventScrubbingDescription"),checked:!!t.values.preventScrubbing,onClick:()=>s("preventScrubbing",!t.values.preventScrubbing)}),e.showImmediateFeedbackField&&a.jsx(m,{id:"immediate-feedback",label:c("immediateFeedbackLabel"),description:c("immediateFeedbackDescription"),checked:!!t.values.immediateFeedback,onClick:()=>s("immediateFeedback",!t.values.immediateFeedback)})]})]})}function W(e){return e.hideFormHeading&&!e.showImmediateFeedbackField&&!e.showPreventScrubbingField?a.jsx(a.Fragment,{}):a.jsx(L,{initialValues:e.initialValues,onSubmit:e.onSubmit,castInitialValues:!1,validationSchema:H,children:a.jsx(E,{...e})})}const P="sharev2.useShareSettingsData",u=h.encloseNamespace(P);function G(e){const t=p(),{config:s,entity:i,share:n}=V({entityId:e.entityId,entityType:e.entityType,shareId:e.shareId}),{loaded:b,updateShareLink:g}=N({entityId:e.entityId}),S=I(w.isType(i.data,T.Interactive)&&i.data.interactiveId&&C.interactive(i.data.interactiveId));function x(r){e.log({type:"update-share-link",share:r}),t.success(u("editSuccess",{name:i.data.name,escapeText:!0}))}function v(r,f){g(n.data.shareId,r).then(x).catch(()=>{t.error(u("editError",{name:i.data.name,escapeText:!0})),f()})}const k=D.getShareSettingsInitialValues(n.data,S.data);return{data:{loaded:b&&!!n.data&&!!s.data&&!!i.data},initialValues:k,onClickSaveLink:v}}export{W as S,G as u};
//# sourceMappingURL=Dfatwnqz.chunk.js.map
