"use strict";(globalThis.webpackChunkcomplianz_gdpr=globalThis.webpackChunkcomplianz_gdpr||[]).push([[7234,9091,9758,1366,4098],{99091:(e,t,n)=>{n.r(t),n.d(t,{UseCookieScanData:()=>r});var a=n(81621),o=n(9588);const r=(0,a.vt)(((e,t)=>({initialLoadCompleted:!1,setInitialLoadCompleted:t=>e({initialLoadCompleted:t}),iframeLoaded:!1,loading:!1,nextPage:!1,progress:0,cookies:[],lastLoadedIframe:"",setIframeLoaded:t=>e({iframeLoaded:t}),setLastLoadedIframe:t=>e((e=>({lastLoadedIframe:t}))),setProgress:t=>e({progress:t}),fetchProgress:()=>(e({loading:!0}),o.doAction("get_scan_progress",{}).then((t=>(e({initialLoadCompleted:!0,loading:!1,nextPage:t.next_page,progress:t.progress,cookies:t.cookies}),t))))})))},79758:(e,t,n)=>{n.r(t),n.d(t,{default:()=>d});var a=n(86087),o=n(9588),r=n(4219),s=n(52043),c=n(56427),l=n(99091),i=n(32828);const d=(0,a.memo)((({type:e="action",style:t="tertiary",label:n,onClick:d,href:u="",target:m="",disabled:p,action:f,field:g,children:h})=>{if(!n&&!h)return null;const b=(g&&g.button_text?g.button_text:n)||h,{fetchFieldsData:_,showSavedSettingsNotice:v}=(0,r.default)(),{setInitialLoadCompleted:E,setProgress:k}=(0,l.UseCookieScanData)(),{setProgressLoaded:y}=(0,i.default)(),{selectedSubMenuItem:w}=(0,s.default)(),[C,N]=(0,a.useState)(!1),L=`button cmplz-button button--${t} button-${e}`,z=async e=>{await o.doAction(g.action,{}).then((e=>{e.success&&(_(w),"reset_settings"===e.id&&(E(!1),k(0),y(!1)),v(e.message))}))},A=g&&g.warn?g.warn:"";return"action"===e?(0,a.createElement)(a.Fragment,null,c.__experimentalConfirmDialog&&(0,a.createElement)(c.__experimentalConfirmDialog,{isOpen:C,onConfirm:async()=>{N(!1),await z()},onCancel:()=>{N(!1)}},A),(0,a.createElement)("button",{className:L,onClick:async t=>{if("action"!==e||!d)return"action"===e&&f?c.__experimentalConfirmDialog?void(g&&g.warn?N(!0):await z()):void await z():void(window.location.href=g.url);d(t)},disabled:p},b)):"link"===e?(0,a.createElement)("a",{className:L,href:u,target:m},b):void 0}))},81366:(e,t,n)=>{n.r(t),n.d(t,{default:()=>A});var a=n(86087),o=n(58168),r=n(51609),s=n(91071),c=n(62133),l=n(9957),i=n(81351),d=n(85357),u=n(31769),m=n(7971),p=n(12579);const f="Checkbox",[g,h]=(0,c.A)(f),[b,_]=g(f),v=(0,r.forwardRef)(((e,t)=>{const{__scopeCheckbox:n,name:a,checked:c,defaultChecked:d,required:u,disabled:m,value:f="on",onCheckedChange:g,...h}=e,[_,v]=(0,r.useState)(null),w=(0,s.s)(t,(e=>v(e))),C=(0,r.useRef)(!1),N=!_||Boolean(_.closest("form")),[L=!1,z]=(0,i.i)({prop:c,defaultProp:d,onChange:g}),A=(0,r.useRef)(L);return(0,r.useEffect)((()=>{const e=null==_?void 0:_.form;if(e){const t=()=>z(A.current);return e.addEventListener("reset",t),()=>e.removeEventListener("reset",t)}}),[_,z]),(0,r.createElement)(b,{scope:n,state:L,disabled:m},(0,r.createElement)(p.sG.button,(0,o.A)({type:"button",role:"checkbox","aria-checked":k(L)?"mixed":L,"aria-required":u,"data-state":y(L),"data-disabled":m?"":void 0,disabled:m,value:f},h,{ref:w,onKeyDown:(0,l.m)(e.onKeyDown,(e=>{"Enter"===e.key&&e.preventDefault()})),onClick:(0,l.m)(e.onClick,(e=>{z((e=>!!k(e)||!e)),N&&(C.current=e.isPropagationStopped(),C.current||e.stopPropagation())}))})),N&&(0,r.createElement)(E,{control:_,bubbles:!C.current,name:a,value:f,checked:L,required:u,disabled:m,style:{transform:"translateX(-100%)"}}))})),E=e=>{const{control:t,checked:n,bubbles:a=!0,...s}=e,c=(0,r.useRef)(null),l=(0,d.Z)(n),i=(0,u.X)(t);return(0,r.useEffect)((()=>{const e=c.current,t=window.HTMLInputElement.prototype,o=Object.getOwnPropertyDescriptor(t,"checked").set;if(l!==n&&o){const t=new Event("click",{bubbles:a});e.indeterminate=k(n),o.call(e,!k(n)&&n),e.dispatchEvent(t)}}),[l,n,a]),(0,r.createElement)("input",(0,o.A)({type:"checkbox","aria-hidden":!0,defaultChecked:!k(n)&&n},s,{tabIndex:-1,ref:c,style:{...e.style,...i,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function k(e){return"indeterminate"===e}function y(e){return k(e)?"indeterminate":e?"checked":"unchecked"}const w=v,C=(0,r.forwardRef)(((e,t)=>{const{__scopeCheckbox:n,forceMount:a,...s}=e,c=_("CheckboxIndicator",n);return(0,r.createElement)(m.C,{present:a||k(c.state)||!0===c.state},(0,r.createElement)(p.sG.span,(0,o.A)({"data-state":y(c.state),"data-disabled":c.disabled?"":void 0},s,{ref:t,style:{pointerEvents:"none",...e.style}})))}));var N=n(27723),L=n(45111),z=n(79758);const A=(0,a.memo)((({indeterminate:e,label:t,value:n,id:o,onChange:r,required:s,disabled:c,options:l={}})=>{const[i,d]=(0,a.useState)(!1),[u,m]=(0,a.useState)(!1);let p=n;Array.isArray(p)||(p=""===p?[]:[p]),(0,a.useEffect)((()=>{let e=1===Object.keys(l).length&&"true"===Object.keys(l)[0];d(e)}),[]),e&&(n=!0);const f=p;let g=!1;Object.keys(l).length>10&&(g=!0);const h=e=>i?n:f.includes(""+e)||f.includes(parseInt(e)),b=()=>{m(!u)};let _=c&&!Array.isArray(c);return 0===Object.keys(l).length?(0,a.createElement)(a.Fragment,null,(0,N.__)("No options found","complianz-gdpr")):(0,a.createElement)("div",{className:"cmplz-checkbox-group"},Object.entries(l).map((([l,d],m)=>(0,a.createElement)("div",{key:l,className:"cmplz-checkbox-group__item"+(!u&&m>9?" cmplz-hidden":"")},(0,a.createElement)(w,{className:"cmplz-checkbox-group__checkbox",id:o+"_"+l,checked:h(l),"aria-label":t,disabled:_||Array.isArray(c)&&c.includes(l),required:s,onCheckedChange:e=>((e,t)=>{if(i)r(!n);else{const e=f.includes(""+t)||f.includes(parseInt(t))?f.filter((e=>e!==""+t&&e!==parseInt(t))):[...f,t];r(e)}})(0,l)},(0,a.createElement)(C,{className:"cmplz-checkbox-group__indicator"},(0,a.createElement)(L.default,{name:e?"indeterminate":"check",size:14,color:"dark-blue"}))),(0,a.createElement)("label",{className:"cmplz-checkbox-group__label",htmlFor:o+"_"+l},d)))),!u&&g&&(0,a.createElement)(z.default,{onClick:()=>b()},(0,N.__)("Show more","complianz-gdpr")),u&&g&&(0,a.createElement)(z.default,{onClick:()=>b()},(0,N.__)("Show less","complianz-gdpr")))}))},97234:(e,t,n)=>{n.r(t),n.d(t,{default:()=>c});var a=n(86087),o=n(81366),r=n(27723),s=n(54098);const c=(0,a.memo)((()=>{const{documents:e,downloadUrl:t,deleteDocuments:c,documentsLoaded:l,fetchData:i}=(0,s.default)(),[d,u]=(0,a.useState)(""),[m,p]=(0,a.useState)([]),[f,g]=(0,a.useState)({}),[h,b]=(0,a.useState)(!1),[_,v]=(0,a.useState)(!1),[E,k]=(0,a.useState)(null);(0,a.useEffect)((()=>{n.e(3757).then(n.bind(n,83757)).then((({default:e})=>{k((()=>e))}))}),[]),(0,a.useEffect)((()=>{l||i()}),[l]);const y=async()=>{let n=e.filter((e=>m.includes(e.id)));p([]);const a=async()=>{if(n.length>0){const e=n.shift(),o=t+"/"+e.file;u(!0);try{let t=new XMLHttpRequest;t.responseType="blob",t.open("get",o,!0),t.send(),t.onreadystatechange=function(){if(4===this.readyState&&200===this.status){let t=window.URL.createObjectURL(this.response),n=window.document.createElement("a");n.setAttribute("href",t),n.setAttribute("download",e.file),window.document.body.appendChild(n),n.click(),setTimeout((function(){window.URL.revokeObjectURL(t)}),6e4)}},await a()}catch(e){console.error(e),u(!1)}}};await a(),u(!1)},w=e=>(e.sort(((e,t)=>e.file<t.file?-1:e.file>t.file?1:0)),e),C=[{name:(0,a.createElement)(o.default,{options:{true:""},indeterminate:h,value:_,onChange:t=>(t=>{if(t){v(!0);let t=f.currentPage?f.currentPage:1,n=w(e).slice(10*(t-1),10*t);p(n.map((e=>e.id)))}else v(!1),p([]);b(!1)})(t)}),selector:e=>e.selectControl,grow:1,minWidth:"50px"},{name:(0,r.__)("Document","complianz-gdpr"),selector:e=>e.file,sortable:!0,grow:5},{name:(0,r.__)("Region","complianz-gdpr"),selector:e=>(0,a.createElement)("img",{alt:"region",width:"20px",height:"20px",src:cmplz_settings.plugin_url+"assets/images/"+e.region+".svg"}),sortable:!0,grow:2,right:!0},{name:(0,r.__)("Consent","complianz-gdpr"),selector:e=>e.consent,sortable:!0,grow:2,right:!0},{name:(0,r.__)("Date","complianz-gdpr"),selector:e=>e.time,sortable:!0,grow:4,right:!0}];let N=[...e];N=w(N);let L=[];return N.forEach((t=>{let n={...t};n.selectControl=(0,a.createElement)(o.default,{value:m.includes(n.id),options:{true:""},onChange:t=>((t,n)=>{let a=[...m];t?a.includes(n)||(a.push(n),p(a)):(a=[...m.filter((e=>e!==n))],p(a));let o=f.currentPage?f.currentPage:1,r=w(e).slice(10*(o-1),10*o),s=!0,c=!1;r.forEach((e=>{a.includes(e.id)?c=!0:s=!1})),s?(v(!0),b(!1)):c?(v(!1),b(!0)):b(!1)})(!m.includes(n.id),n.id)}),L.push(n)})),(0,a.createElement)(a.Fragment,null,m.length>0&&(0,a.createElement)("div",{className:"cmplz-selected-document"},m.length>1&&(0,r.__)("%s items selected","complianz-gdpr").replace("%s",m.length),1===m.length&&(0,r.__)("1 item selected","complianz-gdpr"),(0,a.createElement)("div",{className:"cmplz-selected-document-controls"},(0,a.createElement)("button",{disabled:d,className:"button button-default cmplz-btn-reset",onClick:()=>y()},(0,r.__)("Download Proof of Consent","complianz-gdpr")),(0,a.createElement)("button",{className:"button button-default cmplz-reset-button",onClick:()=>(async e=>{p([]),await c(e)})(m)},(0,r.__)("Delete","complianz-gdpr")))),E&&(0,a.createElement)(a.Fragment,null,(0,a.createElement)(E,{className:"cmplz-data-table",columns:C,data:L,dense:!0,pagination:!0,paginationPerPage:10,onChangePage:e=>{g({...f,currentPage:e})},paginationState:f,noDataComponent:(0,a.createElement)("div",{className:"cmplz-no-documents"},(0,r.__)("No documents","complianz-gdpr")),persistTableHead:!0,theme:"really-simple-plugins",customStyles:{headCells:{style:{paddingLeft:"0",paddingRight:"0"}},cells:{style:{paddingLeft:"0",paddingRight:"0"}}}})))}))},54098:(e,t,n)=>{n.r(t),n.d(t,{default:()=>r});var a=n(81621),o=n(9588);const r=(0,a.vt)(((e,t)=>({documentsLoaded:!1,fetching:!1,generating:!1,documents:[],downloadUrl:"",regions:[],fields:[],deleteDocuments:async n=>{let a=t().documents.filter((e=>n.includes(e.id)));e((e=>({documents:e.documents.filter((e=>!n.includes(e.id)))})));let r={};r.documents=a,await o.doAction("delete_proof_of_consent_documents",r).then((e=>e)).catch((e=>{console.error(e)}))},generateProofOfConsent:async()=>{e({generating:!0}),await o.doAction("generate_proof_of_consent",{}).then((e=>e)).catch((e=>{console.error(e)})),await t().fetchData(),e({generating:!1})},fetchData:async()=>{if(t().fetching)return;e({fetching:!0});const{documents:n,regions:a,download_url:r}=await o.doAction("get_proof_of_consent_documents",{}).then((e=>e)).catch((e=>{console.error(e)}));e((e=>({documentsLoaded:!0,documents:n,regions:a,downloadUrl:r,fetching:!1})))}})))},7971:(e,t,n)=>{n.d(t,{C:()=>c});var a=n(51609),o=n(75795),r=n(91071),s=n(88200);const c=e=>{const{present:t,children:n}=e,c=function(e){const[t,n]=(0,a.useState)(),r=(0,a.useRef)({}),c=(0,a.useRef)(e),i=(0,a.useRef)("none"),d=e?"mounted":"unmounted",[u,m]=function(e,t){return(0,a.useReducer)(((e,n)=>{const a=t[e][n];return null!=a?a:e}),e)}(d,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return(0,a.useEffect)((()=>{const e=l(r.current);i.current="mounted"===u?e:"none"}),[u]),(0,s.N)((()=>{const t=r.current,n=c.current;if(n!==e){const a=i.current,o=l(t);e?m("MOUNT"):"none"===o||"none"===(null==t?void 0:t.display)?m("UNMOUNT"):m(n&&a!==o?"ANIMATION_OUT":"UNMOUNT"),c.current=e}}),[e,m]),(0,s.N)((()=>{if(t){const e=e=>{const n=l(r.current).includes(e.animationName);e.target===t&&n&&(0,o.flushSync)((()=>m("ANIMATION_END")))},n=e=>{e.target===t&&(i.current=l(r.current))};return t.addEventListener("animationstart",n),t.addEventListener("animationcancel",e),t.addEventListener("animationend",e),()=>{t.removeEventListener("animationstart",n),t.removeEventListener("animationcancel",e),t.removeEventListener("animationend",e)}}m("ANIMATION_END")}),[t,m]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:(0,a.useCallback)((e=>{e&&(r.current=getComputedStyle(e)),n(e)}),[])}}(t),i="function"==typeof n?n({present:c.isPresent}):a.Children.only(n),d=(0,r.s)(c.ref,i.ref);return"function"==typeof n||c.isPresent?(0,a.cloneElement)(i,{ref:d}):null};function l(e){return(null==e?void 0:e.animationName)||"none"}c.displayName="Presence"},85357:(e,t,n)=>{n.d(t,{Z:()=>o});var a=n(51609);function o(e){const t=(0,a.useRef)({value:e,previous:e});return(0,a.useMemo)((()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous)),[e])}}}]);