"use strict";(self.webpackChunkcomplianz_gdpr=self.webpackChunkcomplianz_gdpr||[]).push([[8217,5228],{98217:(e,t,l)=>{l.r(t),l.d(t,{default:()=>s});var a=l(51609),n=l(45111),r=l(27723),c=l(86087),o=l(25228);const s=e=>{const[t,l]=(0,c.useState)(!1),[s,i]=(0,c.useState)(!1),[u,m]=(0,c.useState)(!1);(0,c.useEffect)((()=>{let t=e.options;if(0===t.length){let l={label:e.name,value:0};t.unshift(l)}else if(!t.filter((e=>0===e.value)).length>0){let l={label:e.name,value:0};t.unshift(l)}m(t)}),[e.options]);const p=()=>{if(s||!t||0===t)return;i(!0);let e=new XMLHttpRequest;e.responseType="blob",e.open("get",t,!0),e.send(),e.onreadystatechange=function(){if(4==this.readyState&&200==this.status){var e=window.URL.createObjectURL(this.response),l=window.document.createElement("a");l.setAttribute("href",e),l.setAttribute("download",u.filter((e=>e.value===t))[0].label),window.document.body.appendChild(l),l.click(),setTimeout((function(){window.URL.revokeObjectURL(e)}),6e4)}},e.onprogress=function(e){i(!0)}};return(0,a.createElement)("div",{className:"cmplz-single-document-other-documents"},(0,a.createElement)(o.default,{onChange:e=>l(e),defaultValue:"0",canBeEmpty:!1,value:t,options:u}),(0,a.createElement)("div",{onClick:()=>p()},(0,a.createElement)(n.default,{name:"file-download",color:0==t||s?"grey":"black",tooltip:(0,r.__)("Download file","complianz-gdpr"),size:14})),u.length>0&&(0,a.createElement)("a",{href:e.link},(0,a.createElement)(n.default,{name:"circle-chevron-right",color:"black",tooltip:(0,r.__)("Go to overview","complianz-gdpr"),size:14})),0===u.length&&(0,a.createElement)("a",{href:e.link},(0,a.createElement)(n.default,{name:"plus",color:"black",tooltip:(0,r.__)("Create new","complianz-gdpr"),size:14})))}},25228:(e,t,l)=>{l.r(t),l.d(t,{default:()=>s});var a=l(51609),n=l(86087),r=l(45296),c=l(45111),o=l(27723);const s=(0,n.memo)((({value:e=!1,onChange:t,required:l,defaultValue:n,disabled:s,options:i={},canBeEmpty:u=!0,label:m})=>{if(Array.isArray(i)){let e={};i.map((t=>{e[t.value]=t.label})),i=e}return u?(""===e||!1===e||0===e)&&(e="0",i={0:(0,o.__)("Select an option","complianz-gdpr"),...i}):e||(e=Object.keys(i)[0]),(0,a.createElement)("div",{className:"cmplz-input-group cmplz-select-group",key:m},(0,a.createElement)(r.bL,{value:e,defaultValue:n,onValueChange:t,required:l,disabled:s&&!Array.isArray(s)},(0,a.createElement)(r.l9,{className:"cmplz-select-group__trigger"},(0,a.createElement)(r.WT,null),(0,a.createElement)(c.default,{name:"chevron-down"})),(0,a.createElement)(r.UC,{className:"cmplz-select-group__content",position:"popper"},(0,a.createElement)(r.PP,{className:"cmplz-select-group__scroll-button"},(0,a.createElement)(c.default,{name:"chevron-up"})),(0,a.createElement)(r.LM,{className:"cmplz-select-group__viewport"},(0,a.createElement)(r.YJ,null,Object.entries(i).map((([e,t])=>(0,a.createElement)(r.q7,{disabled:Array.isArray(s)&&s.includes(e),className:"cmplz-select-group__item",key:e,value:e},(0,a.createElement)(r.p4,null,t)))))),(0,a.createElement)(r.wn,{className:"cmplz-select-group__scroll-button"},(0,a.createElement)(c.default,{name:"chevron-down"})))))}))}}]);