"use strict";(globalThis.blocksyNewsletterSubscribeExtJsonp=globalThis.blocksyNewsletterSubscribeExtJsonp||[]).push([[864],{864(e,t,n){n.r(t);var a=n(168),c=n(230),i=n(981),o=n(754),s=n(942),l=n.n(s);let r=null;t.default=function({value:e,onChange:t}){const[n,s]=(0,c.useState)(r||[]),[u,d]=(0,c.useState)(!r);return(0,c.useEffect)(function(){!async function(e=!0){e&&d(!0);const t=new FormData;t.append("action","blocksy_ext_newsletter_subscribe_get_actual_lists"),t.append("nonce",(window.ctDashboardLocalizations||window.ct_localizations||window.ct_customizer_localizations).dashboard_actions_nonce);try{const e=await fetch(ajaxurl,{method:"POST",body:t});if(200===e.status){const t=await e.json();if(t.success&&"api_key_invalid"!==t.data.result)return d(!1),s(t.data.result),void(r=t.data.result)}}catch(e){}d(!1)}(!r)},[]),0===n.length?(0,c.createElement)("div",{className:"ct-select-input"},(0,c.createElement)("input",{disabled:!0,placeholder:u?(0,o.__)("Loading...","blocksy-companion"):(0,o.__)("Invalid API Key...","blocksy-companion")})):(0,c.createElement)(i.Ay,{selectedItem:e||n[0].id,onChange:function(e){return t(e)},itemToString:function(e){return e?(n.find(function({id:t}){return t===e})||{}).name:""}},function({getInputProps:e,getItemProps:t,getLabelProps:i,getMenuProps:s,isOpen:r,inputValue:u,highlightedIndex:d,selectedItem:p,openMenu:m}){return(0,c.createElement)("div",{className:"ct-select-input"},(0,c.createElement)("input",(0,a.A)({},e({onFocus:function(){return m()},onClick:function(){return m()}}),{placeholder:(0,o.__)("Select list...","blocksy-companion"),readOnly:!0})),r&&(0,c.createElement)("div",s({className:"ct-select-dropdown"}),n.map(function(e,n){return(0,c.createElement)("div",t({key:e.id,index:n,item:e.id,className:l()("ct-select-dropdown-item",{active:d===n,selected:p===e.id})}),e.name)})))})}}}]);