(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4650],{68523:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/settings/regulations",function(){return t(28160)}])},28160:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return q}});var i=t(24246),s=t(69746),l=t(79894),o=t.n(l),a=t(44296),r=t(43124),c=t(11032),d=t(12783),u=t(98784),h=t.n(u),m=t(86677),g=t(27378),x=t(60136),p=t(77650),j=t(33312),C=t(16781),v=t(93595),f=t(43073),y=t(93329),w=t(70218),_=t(51541),S=e=>{let{regulations:n,isOpen:t,onClose:l,selected:o,onChange:a}=e,[r,c]=(0,g.useState)(o),{allSelected:d,handleToggleAll:u,handleToggleSelection:h}=(0,w.QZ)({items:n,selected:r,onChange:c}),m=r.length,x=n[0].continent;return(0,i.jsxs)(s.u_l,{size:"2xl",isOpen:t,onClose:l,isCentered:!0,children:[(0,i.jsx)(s.ZAr,{}),(0,i.jsxs)(s.hzk,{"data-testid":"regulation-modal",children:[(0,i.jsx)(_.h4,{title:"Select regulations"}),(0,i.jsxs)(s.fef,{p:6,maxHeight:"70vh",overflowY:"auto",children:[(0,i.jsx)(_.x$,{title:x,allSelected:d,onToggleAll:u,numSelected:m}),(0,i.jsx)(s.MIq,{columns:3,spacing:6,paddingInline:4,children:n.map(e=>(0,i.jsx)(s.XZJ,{size:"sm",colorScheme:"complimentary",isChecked:r.includes(e.id),onChange:()=>h(e.id),"data-testid":"".concat(e.name,"-checkbox"),children:e.name},e.id))})]}),(0,i.jsx)(_.$_,{onApply:()=>{a(r),l()},onClose:l})]})]})},k=e=>{let{title:n,items:t,selected:l,onChange:o}=e,a=(0,s.qY0)();return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(y.ZP,{title:n,items:t,selected:l,onChange:o,numSelected:l.length,indeterminate:[],onViewMore:t.length>y.I_?a.onOpen:void 0}),(0,i.jsx)(S,{regulations:t,isOpen:a.isOpen,onClose:a.onClose,selected:l,onChange:o},"regulation-modal-selected-".concat(l.length))]})},O=t(77464);let Z=(e,n)=>{var t;return null===(t=e.name)||void 0===t?void 0:t.toLocaleLowerCase().includes(n.toLocaleLowerCase())};var b=e=>{var n;let{data:t}=e,l=(0,s.pmc)(),o=(0,s.qY0)(),[a,r]=(0,g.useState)(null!==(n=t.regulations)&&void 0!==n?n:[]),[u,y]=(0,g.useState)(""),[w,{isLoading:_}]=(0,d.WA)(),S=(0,g.useMemo)(()=>{var e,n;let i=null!==(n=null===(e=t.regulations)||void 0===e?void 0:e.filter(e=>Z(e,u)))&&void 0!==n?n:[];return(0,O.F7)(i)},[t.regulations,u]),b=!h().isEqual(a,t.regulations),q=(0,m.useRouter)(),N=()=>{q.push(c.r5).then(()=>{l.closeAll()})},z=async()=>{let e=await w({regulations:a.map(e=>({id:e.id,selected:e.selected})),locations:[]});(0,f.D4)(e)?l((0,C.Vo)((0,x.e$)(e.error))):l((0,C.t5)((0,i.jsxs)(s.xvT,{display:"inline",children:["Fides has automatically associated the relevant locations with your regulation choices.",(0,i.jsx)(v.Z,{onClick:N,children:"View locations here."})]})))},E=e=>{r(a.map(n=>{let t=e.find(e=>e.id===n.id);return null!=t?t:n}))};return(0,i.jsxs)(s.gCW,{alignItems:"start",spacing:4,children:[(0,i.jsx)(s.xuv,{maxWidth:"510px",width:"100%",children:(0,i.jsx)(j.Z,{onChange:y,placeholder:"Search",search:u,onClear:()=>y(""),"data-testid":"search-bar"})}),(0,i.jsx)(s.MIq,{columns:{base:1,md:2,xl:3},spacing:6,width:"100%",children:Object.entries(S).map(e=>{let[n,t]=e,s=a.filter(e=>t.find(n=>n.id===e.id)&&e.selected).map(e=>e.id);return(0,i.jsx)(k,{title:n,items:t,selected:s,onChange:e=>{E(t.map(n=>e.includes(n.id)?{...n,selected:!0}:{...n,selected:!1}))}},n)})}),(0,i.jsx)(p.Z,{isOpen:o.isOpen,onClose:o.onClose,onConfirm:()=>{z(),o.onClose()},title:"Location updates",message:"Modifications in your regulation settings may also affect your location settings to simplify management. You can override any Fides-initiated changes directly in the location settings.",isCentered:!0,icon:(0,i.jsx)(s.aNP,{color:"orange"})}),b&&(0,i.jsx)(s.wpx,{type:"primary",onClick:o.onOpen,loading:_,"data-testid":"save-btn",children:"Save"})]})},q=()=>{let{isLoading:e}=(0,d.QM)(),n=(0,a.C)(d.P8);return(0,i.jsx)(r.Z,{title:"Regulations",children:(0,i.jsxs)(s.xuv,{"data-testid":"regulation-management",children:[(0,i.jsx)(s.X6q,{marginBottom:2,fontSize:"2xl",children:"Regulations"}),(0,i.jsxs)(s.xuv,{children:[(0,i.jsxs)(s.xvT,{marginBottom:4,fontSize:"sm",maxWidth:"600px",children:["Select the regulations that apply to your organizations compliance requirements. The selections you make here will automatically update your location selections."," ",(0,i.jsx)(s.rUS,{as:o(),href:c.r5,color:"complimentary.500",children:"You can view your location settings here."})]}),(0,i.jsx)(s.xuv,{children:e?(0,i.jsx)(s.$jN,{}):(0,i.jsx)(b,{data:n})})]})]})})}}},function(e){e.O(0,[8033,2137,2888,9774,179],function(){return e(e.s=68523)}),_N_E=e.O()}]);