(()=>{"use strict";const e=window.wp.blocks,a=window.React,l=window.wp.components,n=window.wp.blockEditor,t=window.wp.element,o=window.wp.serverSideRender,r=window.wp.i18n,s=JSON.parse('{"UU":"sabaiapps/drts-search"}');(0,e.registerBlockType)(s.UU,{edit:function({attributes:e,setAttributes:_}){const[i,p]=(0,t.useState)(drts_wordpress_block_editor_vars_search.bundles||[]),[c,b]=(0,t.useState)(!1),u=drts_wordpress_block_editor_vars_search.extra_bundles||[],d=drts_wordpress_block_editor_vars_search.colors||[],m=drts_wordpress_block_editor_vars_search.bgcolors||[],h=drts_wordpress_block_editor_vars_search.sizes||[],g=drts_wordpress_block_editor_vars_search.responsives||[],C=e.bundle&&""!==e.bundle&&"auto"!==e.bundle,w=Array.isArray(u)&&u.length>=2,v=Array.isArray(e.extraBundles)?e.extraBundles.length>0:!!e.extraBundles;return(0,t.useEffect)((()=>{p((e=>[{value:"",label:(0,r.__)("Select form","directories-pro")},...e])),b(!0)}),[]),(0,a.createElement)(a.Fragment,null,(0,a.createElement)(n.InspectorControls,null,(0,a.createElement)(l.PanelBody,{title:(0,r.__)("Settings","directories-pro")},(0,a.createElement)(l.SelectControl,{value:e.bundle,options:i,onChange:e=>_({bundle:e})}),C&&(0,a.createElement)(a.Fragment,null,w&&(0,a.createElement)(l.SelectControl,{multiple:!0,label:(0,r.__)("Extra forms","directories-pro"),value:e.extraBundles,options:u,onChange:e=>_({extraBundles:e})}),(0,a.createElement)(l.TextControl,{label:(0,r.__)("Button text","directories-pro"),value:e.btnText,onChange:e=>_({btnText:e})}),(0,a.createElement)(l.SelectControl,{label:(0,r.__)("Button color","directories-pro"),value:e.btnColor,options:d,onChange:e=>_({btnColor:e})}),(0,a.createElement)(l.SelectControl,{label:(0,r.__)("Background color","directories-pro"),value:e.bgColor,options:m,onChange:e=>_({bgColor:e})}),(0,a.createElement)(l.SelectControl,{label:(0,r.__)("Shadow color","directories-pro"),value:e.shadowColor,options:m,onChange:e=>_({shadowColor:e})}),v&&(0,a.createElement)(l.SelectControl,{label:(0,r.__)("Nav link color","directories-pro"),value:e.navLinkColor,options:d,onChange:e=>_({navLinkColor:e})}),(0,a.createElement)(l.SelectControl,{label:(0,r.__)("Size","directories-pro"),value:e.size,options:h,onChange:e=>_({size:e})}),(0,a.createElement)(l.SelectControl,{label:(0,r.__)("Display style","directories-pro"),value:e.responsive,options:g,onChange:e=>_({responsive:parseInt(e,10)})}),(0,a.createElement)(l.TextControl,{label:(0,r.__)("Custom CSS","directories-pro"),value:e.style,onChange:e=>_({style:e}),help:(0,r.__)("Custom CSS styles applied to the search form, added as the style attribute to the <form> tag.","directories-pro")}),(0,a.createElement)(l.ToggleControl,{label:(0,r.__)("Display filter form","directories-pro"),help:(0,r.__)("Whether to display the filter form as the second step of the search process.","directories-pro"),checked:e.filter,onChange:e=>{_({filter:e})}}),(0,a.createElement)(l.ToggleControl,{label:(0,r.__)("Delay show","directories-pro"),help:(0,r.__)("Whether to delay displaying of the search form until CSS files are fully loaded.","directories-pro"),checked:e.delayShow,onChange:e=>{_({delayShow:e})}})))),(0,a.createElement)("div",{...(0,n.useBlockProps)()},C?(0,a.createElement)(l.Disabled,null,(0,a.createElement)(o.ServerSideRender,{block:s.UU,attributes:e})):(0,a.createElement)(l.SelectControl,{value:e.bundle,options:i,onChange:e=>_({bundle:e})})))}})})();