(()=>{"use strict";const t=window.React,{createSlotFill:e}=wp.components,{Slot:o,Fill:n}=e("JFBCaptchaOptions");function c({children:e,provider:o=!1}){return(0,t.createElement)(n,null,(({args:t,setArgs:n})=>o&&o!==t.captcha?null:"function"!=typeof e?e:e({args:t,setArgs:n})))}c.Slot=o;const a=c,{createSlotFill:r}=wp.components,{Slot:i,Fill:l}=r("JFBCaptchaBlockEdit");function s({children:e,provider:o}){return(0,t.createElement)(l,null,(({attributes:t,...n})=>o&&o!==t.provider?null:"function"!=typeof e?e:e({attributes:t,...n})))}s.Slot=i;const u=s,{useMetaState:p}=JetFBHooks,d=function(){var t;return null!==(t=window.JetFormEditorData["captcha-tab-config"])&&void 0!==t?t:[]},f=window.wp.i18n,{useMetaState:m}=JetFBHooks,{useMemo:w,useCallback:h}=wp.element,{useDispatch:B,useSelect:b}=wp.data,{createBlock:k}=wp.blocks,{Tip:v,Button:F}=wp.components,C="jet-forms/captcha-container";window.JetFBComponents={...window.JetFBComponents,CaptchaOptions:a,CaptchaBlockEdit:u,CaptchaBlockTip:function(){const[e]=m("_jf_recaptcha"),o=w((()=>(t=>{var e;const o=d().find((({value:e})=>e===t));return null!==(e=o?.label)&&void 0!==e?e:(0,f.__)("captcha","jet-form-builder")})(e.captcha)),[e.captcha]),{insertBlock:n}=B("core/block-editor"),c=b((t=>!t("jet-forms/fields").getBlock(C))),a=h((()=>{if(!c)return;const t=k(C,{provider:e.captcha});n(t)}),[c]);return(0,t.createElement)(t.Fragment,null,(0,t.createElement)("div",{style:{marginBottom:"1.5em"}},(0,t.createElement)(v,null,(0,f.__)("By default, the captcha is added before the submit button of the form. However, you can determine its location yourself using the block.","jet-form-builder"))),(0,t.createElement)(F,{variant:"secondary",disabled:!c,onClick:a},(0,f.sprintf)((0,f.__)("Add %s block","jet-form-builder"),o)))}},window.JetFBActions={...window.JetFBActions,getCaptchaProviders:d},window.JetFBHooks={...window.JetFBHooks,useCaptchaProvider:function(){var t;const[e,o]=p("_jf_recaptcha"),{captcha:n}=e;if(!n)return[{},()=>{}];const c=null!==(t=e?.[n])&&void 0!==t?t:{};return[c,(t={})=>{n&&o((e=>({...e,[n]:{...c,...t}})))}]}}})();