"use strict";(globalThis.webpackChunkcomplianz_gdpr=globalThis.webpackChunkcomplianz_gdpr||[]).push([[277,5228],{40277:(e,l,t)=>{t.r(l),t.d(l,{default:()=>s});var a=t(86087),n=t(25228),o=t(88499),c=t(4219),r=t(27723),m=t(42838),i=t.n(m);const s=(0,a.memo)((e=>{const{customizeUrl:l,selectedBanner:t,bannerDataLoaded:m}=(0,o.default)(),{updateField:s,setChangedField:u}=(0,c.default)();let p,d="cmplz-logo-preview";return"complianz"===e.value?d+=" cmplz-complianz-logo":"site"===e.value&&(d+=" cmplz-theme-image"),(0,a.createElement)("div",{className:"cmplz-logo-container"},(0,a.createElement)(n.default,{label:e.label,onChange:l=>{return a=l,s(e.id,a),u(e.id,a),void(document.querySelector(".cmplz-cookiebanner .cmplz-logo").innerHTML=t.logo_options[a]);var a},value:e.value,options:e.options}),"complianz"===e.value&&(0,a.createElement)("div",{className:d},(0,a.createElement)("div",{dangerouslySetInnerHTML:{__html:i().sanitize(t.logo_options[e.value])}})),"site"===e.value&&(0,a.createElement)("div",{className:d},(0,a.createElement)("div",{dangerouslySetInnerHTML:{__html:i().sanitize(t.logo_options[e.value])}}),"site"===e.value&&0===t.logo_options[e.value].length&&(0,a.createElement)(a.Fragment,null,(0,a.createElement)("p",null,(0,r.__)("No logo found. Please add a logo in the customizer.","complianz-gdpr")))),"custom"===e.value&&(0,a.createElement)("div",{className:"cmplz-logo-preview cmplz-clickable",onClick:()=>(p||(p=wp.media({title:(0,r.__)("Select a logo","complianz-gdpr"),button:{text:(0,r.__)("Set logo","complianz-gdpr")},multiple:!1}),p.on("select",(function(){for(var e=p.state().get("selection").length,l=p.state().get("selection").models,t=0;t<e;t++){var a=l[t].id,n=!1;if((n=l[t].attributes.sizes.cmplz_banner_image)||(n=l[t].attributes.sizes.medium),n||(n=l[t].attributes.sizes.thumbnail),n||(n=l[t].attributes.sizes.full),n){var o=n.url;s("logo_attachment_id",a),u("logo_attachment_id",a);let e=document.createElement("img");document.querySelector(".cmplz-cookiebanner .cmplz-logo").appendChild(e),document.querySelector(".cmplz-cookiebanner .cmplz-logo img").src=o,document.querySelector(".cmplz-custom-image img").src=o}}}))),void p.open())},(0,a.createElement)("div",{dangerouslySetInnerHTML:{__html:i().sanitize(t.logo_options[e.value])},alt:"Banner Logo",className:"cmplz-custom-image"})))}))},25228:(e,l,t)=>{t.r(l),t.d(l,{default:()=>r});var a=t(86087),n=t(45296),o=t(45111),c=t(27723);const r=(0,a.memo)((({value:e=!1,onChange:l,required:t,defaultValue:r,disabled:m,options:i={},canBeEmpty:s=!0,label:u})=>{if(Array.isArray(i)){let e={};i.map((l=>{e[l.value]=l.label})),i=e}return s?(""===e||!1===e||0===e)&&(e="0",i={0:(0,c.__)("Select an option","complianz-gdpr"),...i}):e||(e=Object.keys(i)[0]),(0,a.createElement)("div",{className:"cmplz-input-group cmplz-select-group",key:u},(0,a.createElement)(n.bL,{value:e,defaultValue:r,onValueChange:l,required:t,disabled:m&&!Array.isArray(m)},(0,a.createElement)(n.l9,{className:"cmplz-select-group__trigger"},(0,a.createElement)(n.WT,null),(0,a.createElement)(o.default,{name:"chevron-down"})),(0,a.createElement)(n.UC,{className:"cmplz-select-group__content",position:"popper"},(0,a.createElement)(n.PP,{className:"cmplz-select-group__scroll-button"},(0,a.createElement)(o.default,{name:"chevron-up"})),(0,a.createElement)(n.LM,{className:"cmplz-select-group__viewport"},(0,a.createElement)(n.YJ,null,Object.entries(i).map((([e,l])=>(0,a.createElement)(n.q7,{disabled:Array.isArray(m)&&m.includes(e),className:"cmplz-select-group__item",key:e,value:e},(0,a.createElement)(n.p4,null,l)))))),(0,a.createElement)(n.wn,{className:"cmplz-select-group__scroll-button"},(0,a.createElement)(o.default,{name:"chevron-down"})))))}))}}]);