(()=>{"use strict";const e=window.React,t=window.wp.element,o=window.jfb.actions,n=window.jfb.components,{ActionFieldsMapContext:l,CurrentPropertyMapContext:r}=JetFBComponents,i=function(){const{FieldSelect:i,property:a}=(0,t.useContext)(r),{source:s,setMapField:c,getMapField:d}=(0,t.useContext)(o.CurrentActionEditContext),{name:p,index:m}=(0,t.useContext)(l);return"term_meta"===a?(0,e.createElement)("div",{className:"components-base-control jet-margin-bottom-wrapper"},i,(0,e.createElement)(n.StyledTextControl,{key:p+m+"_text",value:d({name:p}),onChange:e=>c({nameField:p,value:e})})):i},a=window.wp.components,s=window.wp.hooks;var c=function(){const e=Array.prototype.slice.call(arguments).filter(Boolean),t={},o=[];e.forEach(e=>{(e?e.split(" "):[]).forEach(e=>{if(e.startsWith("atm_")){const[,o]=e.split("_");t[o]=e}else o.push(e)})});const n=[];for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&n.push(t[e]);return n.push(...o),n.join(" ")};const d=window.wp.i18n,p=window.jfb.blocksToActions,{convertListToFieldsMap:m}=JetFBActions,{ActionFieldsMap:u,WrapperRequiredControl:C,DynamicPropertySelect:f}=JetFBComponents,w=(0,s.applyFilters)("jet.fb.insert.term.modifiers",[{id:"all",isSupported:()=>!0}]),E=e=>{for(const t of w)if(t.isSupported(e))return t.id},h={type:"insert_term",label:(0,d.__)("Insert/Update Term","jet-form-builder"),edit:function(l){const{settings:r,onChangeSettingObj:s,source:w,help:h,label:y}=l,v=m((0,p.useFields)()),[x,F]=(0,t.useState)(()=>{var e;const t=E(r);return null!==(e=w.properties[t])&&void 0!==e?e:[]});return(0,t.useEffect)(()=>{r.requestFields?.length&&s({requestFields:null})},[]),(0,t.useEffect)(()=>{var e;const t=E(r);F(null!==(e=w.properties[t])&&void 0!==e?e:[])},[r.taxonomy]),(0,p.useSanitizeFieldsMap)(),(0,e.createElement)(a.Flex,{direction:"column"},(0,e.createElement)(n.RowControl,null,({id:t})=>(0,e.createElement)(o.ValidatorProvider,{isSupported:e=>"taxonomy"===e?.property},({hasError:o,setShowError:l})=>(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.RequiredLabel,{htmlFor:t},(0,d.__)("Taxonomy","jet-form-builder")),(0,e.createElement)(a.Flex,{className:c(n.RowControlEndStyle,o&&n.ControlWithErrorStyle),direction:"column"},o&&(0,e.createElement)(n.IconText,null,(0,d.__)("Please fill this required field","jet-form-builder")),(0,e.createElement)(n.StyledSelectControl,{id:t,value:r.taxonomy,options:w.taxonomies,help:h("taxonomy"),onChange:e=>s({taxonomy:e}),onBlur:()=>l(!0)}))))),(0,e.createElement)(n.WideLine,null),(0,e.createElement)(u,{label:y("fields_map"),fields:v},(0,e.createElement)(C,null,(0,e.createElement)(f,{dynamic:["term_meta"],properties:x,parseValue:e=>"term_meta"},(0,e.createElement)(i,null)))))},icon:(0,e.createElement)("svg",{width:"64",height:"64",viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",focusable:"false"},(0,e.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M26 4C28.2091 4 30 5.79086 30 8V26C30 28.2091 28.2091 30 26 30H8C5.79086 30 4 28.2091 4 26V8C4 5.79086 5.79086 4 8 4H26ZM8 6C6.89543 6 6 6.89543 6 8V26C6 27.1046 6.89543 28 8 28H26C27.1046 28 28 27.1046 28 26V8C28 6.89543 27.1046 6 26 6H8Z",fill:"currentColor"}),(0,e.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M56 4C58.2091 4 60 5.79086 60 8V26C60 28.2091 58.2091 30 56 30H38C35.7909 30 34 28.2091 34 26V8C34 5.79086 35.7909 4 38 4H56ZM38 6C36.8954 6 36 6.89543 36 8V26C36 27.1046 36.8954 28 38 28H56C57.1046 28 58 27.1046 58 26V8C58 6.89543 57.1046 6 56 6H38Z",fill:"currentColor"}),(0,e.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M26 34C28.2091 34 30 35.7909 30 38V56C30 58.2091 28.2091 60 26 60H8C5.79086 60 4 58.2091 4 56V38C4 35.7909 5.79086 34 8 34H26ZM8 36C6.89543 36 6 36.8954 6 38V56C6 57.1046 6.89543 58 8 58H26C27.1046 58 28 57.1046 28 56V38C28 36.8954 27.1046 36 26 36H8Z",fill:"currentColor"}),(0,e.createElement)("path",{d:"M47 40C47.5523 40 48 40.4477 48 41V46H53C53.5523 46 54 46.4477 54 47C54 47.5523 53.5523 48 53 48H48V53C48 53.5523 47.5523 54 47 54C46.4477 54 46 53.5523 46 53V48H41C40.4477 48 40 47.5523 40 47C40 46.4477 40.4477 46 41 46H46V41C46 40.4477 46.4477 40 47 40Z",fill:"currentColor"}),(0,e.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M47 34C54.1797 34 60 39.8203 60 47C60 54.1797 54.1797 60 47 60C39.8203 60 34 54.1797 34 47C34 39.8203 39.8203 34 47 34ZM47 36C40.9249 36 36 40.9249 36 47C36 53.0751 40.9249 58 47 58C53.0751 58 58 53.0751 58 47C58 40.9249 53.0751 36 47 36Z",fill:"currentColor"})),category:"content",validators:[({settings:e})=>!e?.taxonomy&&{type:"empty",property:"taxonomy"}]};(0,o.registerAction)(h)})();