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