"use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[5084],{25084:(e,t,n)=>{n.r(t),n.d(t,{default:()=>h});var l=n(69060),s=n(66152),a=n(61180),i=n(78256),r=n(95705),c=n(66156),o=n(24256),d=n(61628),u=n(82496);const h=e=>{let{closeVersioningModalAndRefresh:t,modalOpen:n,selectedBucket:h,versioningInfo:x={},objectLockingEnabled:g}=e;const p=(0,c.Ab)(),[f,m]=(0,l.useState)(!1),[v,b]=(0,l.useState)("Enabled"===(null===x||void 0===x?void 0:x.status)),[j,k]=(0,l.useState)(!(null===x||void 0===x||!x.excludeFolders)),[C,w]=(0,l.useState)((e=>{const t=null===e||void 0===e?void 0:e.excludedPrefixes;return t?t.map((e=>e.prefix)).join(","):""})(x));return(0,u.jsx)(s.CaN,{onClose:()=>t(!1),open:n,title:"Versioning on Bucket",children:(0,u.jsxs)(s.yE_,{withBorders:!1,containerPadding:!1,children:[(0,u.jsx)(s.Wkk,{id:"activateVersioning",label:"Versioning Status",checked:v,onChange:e=>{b(e.target.checked)},indicatorLabels:["Enabled","Disabled"]}),v&&!g&&(0,u.jsxs)(l.Fragment,{children:[(0,u.jsx)(s.Wkk,{id:"excludeFolders",label:"Exclude Folders",checked:j,onChange:e=>{k(e.target.checked)},indicatorLabels:["Enabled","Disabled"]}),(0,u.jsx)(o.c,{elements:C,label:"Excluded Prefixes",name:"excludedPrefixes",onChange:e=>{let t="";t=Array.isArray(e)?e.join(","):e,w(t)},withBorder:!0})]}),(0,u.jsxs)(s.kvh,{sx:d.W2.modalButtonBar,children:[(0,u.jsx)(s.qaq,{id:"clear",type:"button",variant:"regular",color:"primary",onClick:()=>{w(""),k(!1),b(!1)},label:"Clear"}),(0,u.jsx)(s.qaq,{type:"submit",variant:"callAction",onClick:()=>{f||(m(!0),a.m.buckets.setBucketVersioning(h,{enabled:v,excludeFolders:!!v&&j,excludePrefixes:v?C.split(",").filter((e=>""!==e.trim())):[]}).then((()=>{m(!1),t(!0)})).catch((e=>{m(!1),p((0,r.aW)((0,i.K)(e.error)))})))},id:"saveTag",label:"Save"})]})]})})}},24256:(e,t,n)=>{n.d(t,{c:()=>c});var l=n(69060),s=n(58564),a=n.n(s),i=n(66152),r=n(82496);const c=e=>{let{elements:t,name:n,label:s,tooltip:c="",commonPlaceholder:o="",onChange:d,withBorder:u=!1}=e;const[h,x]=(0,l.useState)([""]),g=(0,l.createRef)();(0,l.useEffect)((()=>{if(1===h.length&&""===h[0]&&t&&""!==t){const e=t.split(",");e.push(""),x(e)}}),[t,h]),(0,l.useEffect)((()=>{if(h.length>1){const e=g.current;e&&e.scrollIntoView(!1)}}),[h,g]);const p=(0,l.useCallback)((e=>{d(e)}),[d]),f=(0,l.useRef)(!0);(0,l.useEffect)((()=>{if(f.current)return void(f.current=!1);const e=h.filter((e=>""!==e.trim())).join(",");p(e)}),[h]);const m=e=>{e.persist();let t=[...h];const n=a()(e.target,"dataset.index","0");t[parseInt(n)]=e.target.value,x(t)},v=h.map(((e,t)=>(0,r.jsx)(i.q22,{id:"".concat(n,"-").concat(t.toString()),label:"",name:"".concat(n,"-").concat(t.toString()),value:h[t],onChange:m,index:t,placeholder:o,overlayIcon:t===h.length-1?(0,r.jsx)(i.EgV,{}):null,overlayAction:()=>{(e=>{if(""!==e[e.length-1].trim()){const t=[...e];t.push(""),x(t)}})(h)}},"csv-multi-".concat(n,"-").concat(t.toString()))));return(0,r.jsx)(l.Fragment,{children:(0,r.jsxs)(i.kvh,{sx:{display:"flex"},className:"inputItem",children:[(0,r.jsxs)(i.mWW,{sx:{alignItems:"flex-start"},children:[(0,r.jsx)("span",{children:s}),""!==c&&(0,r.jsx)(i.kvh,{sx:{marginLeft:5,display:"flex",alignItems:"center","& .min-icon":{width:13}},children:(0,r.jsx)(i.o5h,{tooltip:c,placement:"top",children:(0,r.jsx)(i.kvh,{className:c,children:(0,r.jsx)(i.OKz,{})})})})]}),(0,r.jsxs)(i.kvh,{withBorders:u,sx:{width:"100%",overflowY:"auto",height:150,position:"relative"},children:[v,(0,r.jsx)("div",{ref:g})]})]})})}}}]);
//# sourceMappingURL=5084.978ad614.chunk.js.map