import{ao as e,aq as c,L as x,aG as j,aH as p,ar as N,ei as S,aI as v,bq as f,bN as L,b0 as y,bc as R,az as C,dm as E,aZ as k,v as $,f as A,e as P}from"./app-k0jcl5PQ.js";import{R as T}from"./DzJMFLaU.chunk.js";import{S as _}from"./EHuWazu9.chunk.js";import{C as w}from"./Cw9cwr2f.chunk.js";import"./DwDhXSrj.chunk.js";import"./CCtuxSlD.chunk.js";import"./CPXlV0fg.chunk.js";import"./ApI7cEru.chunk.js";import"./DXxHdeNz.chunk.js";import"./CpGXOT1_.chunk.js";import"./DkDkjje4.chunk.js";import"./hKqzfsO4.chunk.js";import"./fstW5ZQE.chunk.js";import"./9ls1F1Ve.chunk.js";import"./DRKUY7jf.chunk.js";const u="settings.contentReviewSettings",D=x.encloseNamespace(u),I=[{phrase:"14days",value:14},{phrase:"21days",value:21},{phrase:"30days",value:30}];function H(s){function i(a){s.onChange(parseInt(a.target.value))}function o(){const a="fw-bold mb-1";return s.isSettingEnabled?a:`${a} text-secondary`}return e.jsxs("div",{className:"mb-3 d-flex",children:[e.jsxs("div",{children:[e.jsx("p",{className:o(),children:e.jsx(c,{namespace:u,phrase:"reviewHeading"})}),e.jsx("p",{className:"mb-1 text-secondary",children:e.jsx(c,{namespace:u,phrase:"reviewDescription",options:{days:s.selected}})})]}),e.jsx("div",{className:"flex-shrink-0 ms-2",children:e.jsx("select",{id:"review-days",name:"review-days",autoComplete:"off",className:"form-select",value:s.selected||"",disabled:!s.isSettingEnabled||s.disabled,onChange:i,children:I.map((a,n)=>e.jsx("option",{value:a.value,children:D(a.phrase)},n))})})]})}const h="settings.contentReviewSettings";function O(s){const i=j.getLiteArticle(p.ContentReview);return e.jsxs("div",{className:"row mb-3",children:[e.jsxs("div",{className:"col-10",children:[e.jsx("p",{className:"fw-bold mb-1",children:e.jsx(c,{namespace:h,phrase:"subHeading"})}),e.jsx("p",{className:"mb-1 text-secondary",children:e.jsx(c,{namespace:h,phrase:"description"})}),e.jsx("p",{className:"mb-0",children:e.jsx(N,{href:i,className:"info-link",children:e.jsx(c,{namespace:h,phrase:"learnMore"})})})]}),e.jsx("div",{className:"col",children:e.jsx(S,{on:s.isEnabled,onClick:s.toggleSwitch,disabled:s.disabled,showStateWhenDisabled:!0})})]})}const F="settings.contentReviewSettings";function V(s){const[i,o]=v.useState(s.isEnabled),[a,n]=v.useState(s.reviewDays);function m(){!i&&!a&&n(14),o(r=>!r)}function g(){l&&s.handleOnSave(i,a)}const l=s.reviewDays!==a||s.isEnabled!==i;return e.jsx("div",{className:"row",children:e.jsxs("div",{className:"col col-md-8 col-lg-6",children:[e.jsx(O,{disabled:s.isLoading,isEnabled:i,toggleSwitch:m}),e.jsx(H,{disabled:s.isLoading,selected:a,isSettingEnabled:i,onChange:r=>n(r)}),e.jsx(f,{onClick:g,showSpinner:s.isLoading,variant:"dark",disabled:s.isLoading||!l,children:e.jsx(c,{namespace:F,phrase:"saveButton"})})]})})}const q="_oneLine_wdpd3_1",B="_twoLine_wdpd3_4",t={oneLine:q,twoLine:B};function G(){return e.jsx("div",{className:"row g-0",children:e.jsxs("div",{className:"col col-md-7 col-lg-5",children:[e.jsxs("div",{className:"row mb-3",children:[e.jsxs("div",{className:"col-10",children:[e.jsx("div",{className:`partial-loading-background w-50 mb-1 ${t.oneLine}`}),e.jsx("div",{className:`partial-loading-background w-100 mb-1 ${t.twoLine}`}),e.jsx("div",{className:`partial-loading-background w-100 ${t.oneLine}`})]}),e.jsx("div",{className:"col",children:e.jsx("div",{className:`partial-loading-background w-100 ${t.oneLine}`})})]}),e.jsxs("div",{className:"row mb-2",children:[e.jsxs("div",{className:"col-9",children:[e.jsx("div",{className:`partial-loading-background w-50 mb-1 ${t.oneLine}`}),e.jsx("div",{className:`partial-loading-background w-100 mb-1 ${t.twoLine}`})]}),e.jsx("div",{className:"col",children:e.jsx("div",{className:`partial-loading-background w-100 ${t.twoLine}`})})]}),e.jsx("div",{className:`partial-loading-background w-25 ${t.twoLine}`})]})})}const M="settings.contentReviewSettings",d=x.encloseNamespace(M);function ce(){var l;L({title:d("pageTitle")});const s=y(),i=R(),[o,a]=v.useState(!1),n=C(w.getLibraryReviewPeriod());async function m(r,b){if(!r){$.trigger({application:P.SETTINGS,action:A.Settings.TURN_OFF_CONTENT_REVIEW});return}a(!0);try{await s(w.setLibraryReviewPeriod(b)),i.success(d("success"))}catch{i.error(d("error"))}a(!1)}const g=!(n.hasError||n.statusCode===E.NotFound);return e.jsxs(_,{heading:d("heading"),breadcrumbs:[d("heading")],requiredPermissions:k.ManageVideoAccess,children:[e.jsx(T,{active:"content-review-settings"}),n.hasCompleted?e.jsx(V,{isLoading:o,isEnabled:g,reviewDays:(l=n.data)==null?void 0:l.reviewPeriod,handleOnSave:m}):e.jsx(G,{})]})}export{ce as ContentReviewSettingsView};
//# sourceMappingURL=C0d6PNYB.chunk.js.map
