!function(){"use strict";var e=window.wp.element,t=window.wp.blocks,r=JSON.parse('{"u2":"wpzoom-forms/text-plain-field"}');function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},o.apply(this,arguments)}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r<t;r++)o[r]=e[r];return o}var n=window.wp.blockEditor,a=window.wp.i18n,u=window.wp.components,c=r.u2;(0,t.registerBlockType)(c,{icon:(0,e.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",version:"1.1",viewBox:"0 0 100 100"},(0,e.createElement)("path",{d:"M15,58.75c-0.69,0-1.25,0.56-1.25,1.25s0.56,1.25,1.25,1.25h10c0.69,0,1.25-0.56,1.25-1.25s-0.56-1.25-1.25-1.25h-3.75 v-17.5H25c0.69,0,1.25-0.56,1.25-1.25s-0.56-1.25-1.25-1.25H15c-0.69,0-1.25,0.56-1.25,1.25s0.56,1.25,1.25,1.25h3.75v17.5H15z"}),(0,e.createElement)("path",{d:"M92.5,30h-85C6.119,30,5,31.119,5,32.5v35C5,68.881,6.119,70,7.5,70h85c1.381,0,2.5-1.119,2.5-2.5v-35 C95,31.119,93.881,30,92.5,30z M90,65H10V35h80V65z"})),edit:function(t){var r=(0,n.useBlockProps)(),c=t.attributes,m=t.setAttributes,i=t.clientId,s=c.id,p=c.name,f=c.type,b=c.placeholder,d=c.label,h=c.showLabel,w=c.required,_=c.subject;(0,e.useEffect)((function(){s||m({id:"input_"+i.substr(0,8)})}),[]);var v,g,y=(v=(0,e.useState)(s),g=1,function(e){if(Array.isArray(e))return e}(v)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o,l,_x,n,a=[],_n=!0,u=!1;try{if(_x=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;_n=!1}else for(;!(_n=(o=_x.call(r)).done)&&(a.push(o.value),a.length!==t);_n=!0);}catch(e){u=!0,l=e}finally{try{if(!_n&&null!=r.return&&(n=r.return(),Object(n)!==n))return}finally{if(u)throw l}}return a}}(v,g)||function(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}(v,g)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0];return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.InspectorControls,null,(0,e.createElement)(u.PanelBody,{title:(0,a.__)("Options","wpzoom-forms")},(0,e.createElement)(u.TextControl,{label:(0,a.__)("Name","wpzoom-forms"),value:p,placeholder:(0,a.__)("e.g. My Text Field","wpzoom-forms"),onChange:function(e){e.replace(/\s/g,"_").toLowerCase(),m({name:e,id:"input_"+i.substr(0,8)})}}),(0,e.createElement)(u.SelectControl,{label:(0,a.__)("Type","wpzoom-forms"),value:f,options:[{label:(0,a.__)("Text","wpzoom-forms"),value:"text"},{label:(0,a.__)("Number","wpzoom-forms"),value:"number"},{label:(0,a.__)("Email","wpzoom-forms"),value:"email"},{label:(0,a.__)("Button","wpzoom-forms"),value:"button"},{label:(0,a.__)("URL","wpzoom-forms"),value:"url"},{label:(0,a.__)("Hidden","wpzoom-forms"),value:"hidden"}],onChange:function(e){return m({type:e})}}),(0,e.createElement)(u.TextControl,{label:(0,a.__)("Placeholder","wpzoom-forms"),value:b,onChange:function(e){return m({placeholder:e})}}),(0,e.createElement)(u.ToggleControl,{label:(0,a.__)("Show Label","wpzoom-forms"),checked:!!h,onChange:function(e){return m({showLabel:!!e})}}),h&&(0,e.createElement)(u.TextControl,{label:(0,a.__)("Label","wpzoom-forms"),value:d,onChange:function(e){return m({label:e})}}),(0,e.createElement)(u.ToggleControl,{label:(0,a.__)("Required","wpzoom-forms"),checked:!!w,onChange:function(e){return m({required:!!e})}}),(0,e.createElement)(u.ToggleControl,{label:(0,a.__)("Is Subject","wpzoom-forms"),help:(0,a.__)("Whether this text field should be used as the subject field in the form (useful for contact forms).","wpzoom-forms"),checked:!!_,onChange:function(e){return m({subject:!!e})}}))),(0,e.createElement)(e.Fragment,null,h&&(0,e.createElement)("label",{htmlFor:y},(0,e.createElement)(n.RichText,{tagName:"label",placeholder:(0,a.__)("Label","wpzoom-forms"),value:d,htmlFor:y,onChange:function(e){return m({label:e})}}),w&&(0,e.createElement)("sup",{className:"wp-block-wpzoom-forms-required"},(0,a.__)("*","wpzoom-forms"))),(0,e.createElement)("input",o({type:f,name:y,id:y,placeholder:b,required:!!w,"data-subject":!!_},r))))},save:function(t){var r=t.attributes,l=n.useBlockProps.save(),u=r.id,c=(r.name,r.type),m=r.placeholder,i=r.label,s=r.showLabel,p=r.required,f=r.subject;return(0,e.createElement)(e.Fragment,null,s&&(0,e.createElement)("label",{htmlFor:u},(0,e.createElement)(n.RichText.Content,{tagName:"label",value:i,htmlFor:u}),p&&(0,e.createElement)("sup",{className:"wp-block-wpzoom-forms-required"},(0,a.__)("*","wpzoom-forms"))),(0,e.createElement)("input",o({type:c,name:u,id:u,placeholder:m,required:!!p,"data-subject":!!f},l)))}})}();