"use strict";(globalThis.webpackChunkcomplianz_gdpr=globalThis.webpackChunkcomplianz_gdpr||[]).push([[9788],{59788:(e,t,a)=>{a.r(t),a.d(t,{default:()=>u});var n=a(51280),l=a(93396),i=a(25536),o=a(76300),s=a(15832),r=a(88496),d=a(87287);const u=(0,r.memo)((()=>{const{cssLoading:e,selectedBanner:t}=(0,o.default)(),[a,u]=(0,r.useState)(!1),[c,f]=(0,r.useState)(!1),{updateField:m,setChangedField:p,fields:g}=(0,i.default)(),[_,b]=(0,r.useState)(!1);(0,r.useEffect)((()=>{e||u(!1)}),[e]),(0,r.useEffect)((()=>{a||f(!1)}),[g]);const h=async()=>{b(!1),f(!0),await C()},C=()=>{u(!0);let e=t.banner_fields;for(const t of e)if(t.hasOwnProperty("default")){if("hidden"===t.type)continue;m(t.id,t.default),p(t.id,t.default)}};return(0,n.createElement)(n.Fragment,null,d.__experimentalConfirmDialog&&(0,n.createElement)(d.__experimentalConfirmDialog,{isOpen:_,onConfirm:()=>h(),onCancel:()=>b(!1)},(0,l.__)("Are you sure you want to reset this banner to the default settings?","complianz-gdpr")),(0,n.createElement)("button",{disabled:c||a,onClick:()=>(async()=>{d.__experimentalConfirmDialog?b(!0):await h()})(),className:"button button-default"},(0,l.__)("Reset","complianz-gdpr"),a&&(0,n.createElement)(s.default,{name:"loading",color:"grey"})))}))}}]);