(()=>{"use strict";var e,t={6813:()=>{const e=window.wp.blocks,t=window.wp.i18n,r=window.wp.blockEditor,a=window.wp.components,l=window.ReactJSXRuntime,o=(e,t)=>{const{inputFontSize:r,inputLineHeight:a,inputPadding:l,inputBorderWidth:o,inputBorderRadius:s,fieldWidth:n,fieldTextColor:i,fieldBackgroundColor:d,borderColor:u}=t,h={opacity:1};return["checkbox","radio","hidden"].includes(e)?h.cursor="default":(h.cursor="text",void 0!==r&&(h.fontSize=`${r}`),void 0!==a&&(h.lineHeight=a),i&&(h.color=i),d&&(h.backgroundColor=d),void 0!==l&&(h.padding=`${l}px`),void 0!==s&&(h.borderRadius=`${s}px`),void 0!==n&&(h.width=`${n}%`),void 0!==o&&(h.borderWidth=`${o}px`),u&&(h.borderColor=u)),["checkbox","radio"].includes(e)&&(h.opacity=1),d||["checkbox","radio","hidden"].includes(e)||(h.backgroundColor="transparent"),i||(h.color="inherit"),h},s=e=>{const{labelTextColor:t}=e,r={};return t&&(r.color=t),r.cursor="text",r},n=e=>{const{labelFontSize:t,labelLineHeight:r}=e,a={};return void 0!==t&&(a.fontSize=`${t}`),void 0!==r&&(a.lineHeight=r),a},i=e=>{const{optionFontSize:t,optionLineHeight:r,optionTextColor:a}=e,l={};return void 0!==t&&(l.fontSize=`${t}`),void 0!==r&&(l.lineHeight=r),a&&(l.color=a),l.cursor="text",l},d=(e,t,r=!1)=>{let a=`${t.className||""} gatherpress-form-field--${e}`;return r&&!["checkbox","radio","hidden","textarea"].includes(e)&&(a+=" gatherpress-inline-layout"),a.trim()};function u({fieldType:e,attributes:r,setAttributes:o}){const{fieldValue:s}=r;switch(e){case"email":return(0,l.jsx)(a.TextControl,{label:(0,t.__)("Default Value","gatherpress"),type:"email",value:s,onChange:e=>o({fieldValue:e}),help:(0,t.__)("Default email address for this field.","gatherpress")});case"url":return(0,l.jsx)(a.TextControl,{label:(0,t.__)("Default Value","gatherpress"),type:"url",value:s,onChange:e=>o({fieldValue:e}),help:(0,t.__)("Default URL for this field.","gatherpress")});case"tel":return(0,l.jsx)(a.TextControl,{label:(0,t.__)("Default Value","gatherpress"),type:"tel",value:s,onChange:e=>o({fieldValue:e}),help:(0,t.__)("Default telephone number for this field.","gatherpress")});case"number":return(0,l.jsx)(a.TextControl,{label:(0,t.__)("Default Value","gatherpress"),type:"number",value:s,onChange:e=>o({fieldValue:e}),help:(0,t.__)("Default number value for this field.","gatherpress")});case"textarea":return(0,l.jsx)(a.TextareaControl,{label:(0,t.__)("Default Value","gatherpress"),value:s,onChange:e=>o({fieldValue:e}),help:(0,t.__)("Default content for this textarea.","gatherpress"),rows:3});case"checkbox":return(0,l.jsx)(a.ToggleControl,{label:(0,t.__)("Default Checked","gatherpress"),checked:!!s,onChange:e=>o({fieldValue:e}),help:(0,t.__)("Whether this checkbox should be checked by default.","gatherpress")});case"radio":return null;case"hidden":return(0,l.jsx)(a.TextControl,{label:(0,t.__)("Value","gatherpress"),value:s,onChange:e=>o({fieldValue:e}),help:(0,t.__)("The value for this hidden field.","gatherpress")});default:return(0,l.jsx)(a.TextControl,{label:(0,t.__)("Default Value","gatherpress"),value:s,onChange:e=>o({fieldValue:e}),help:(0,t.__)("Default value for this field.","gatherpress")})}}function h({attributes:e,setAttributes:a,blockProps:i,generateFieldName:u}){const{fieldType:h,fieldName:p,fieldValue:g,label:c,placeholder:x,required:b,requiredText:m,requiredTextColor:_,minValue:f,maxValue:C,inlineLayout:v}=e;return(0,l.jsxs)("div",{...i,className:d(h,i,v),children:[(0,l.jsxs)("div",{className:"gatherpress-label-wrapper",style:n(e),children:[(0,l.jsx)(r.RichText,{tagName:"label",placeholder:(0,t.__)("Add label…","gatherpress"),value:c,onChange:e=>a({label:e}),onBlur:()=>(e=>{if(!p&&e){const t=u(e);t&&a({fieldName:t})}})(c),allowedFormats:[],style:s(e)}),b&&(0,l.jsx)(r.RichText,{tagName:"span",className:"gatherpress-label-required",placeholder:(0,t.__)("(required)","gatherpress"),value:m,onChange:e=>a({requiredText:e}),allowedFormats:[],style:{..._&&{color:_}}})]}),(0,l.jsx)("input",{style:o(h,e),type:h,name:p,defaultValue:g,placeholder:x,required:b,readOnly:!0,tabIndex:-1,autoComplete:"off",...void 0!==f&&{min:f},...void 0!==C&&{max:C}})]})}const p={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let g;const c=new Uint8Array(16),x=[];for(let e=0;e<256;++e)x.push((e+256).toString(16).slice(1));const b=function(e,t,r){if(p.randomUUID&&!t&&!e)return p.randomUUID();const a=(e=e||{}).random??e.rng?.()??function(){if(!g){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");g=crypto.getRandomValues.bind(crypto)}return g(c)}();if(a.length<16)throw new Error("Random bytes length must be >= 16");if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,t){if((r=r||0)<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[r+e]=a[e];return t}return function(e,t=0){return(x[e[t+0]]+x[e[t+1]]+x[e[t+2]]+x[e[t+3]]+"-"+x[e[t+4]]+x[e[t+5]]+"-"+x[e[t+6]]+x[e[t+7]]+"-"+x[e[t+8]]+x[e[t+9]]+"-"+x[e[t+10]]+x[e[t+11]]+x[e[t+12]]+x[e[t+13]]+x[e[t+14]]+x[e[t+15]]).toLowerCase()}(a)};function m({attributes:e,setAttributes:a,blockProps:u,generateFieldName:h}){const{fieldType:p,fieldName:g,fieldValue:c,label:x,required:m,requiredText:_,requiredTextColor:f,radioOptions:C=[{label:"",value:"",id:b()}]}=e;return(0,l.jsxs)("div",{...u,className:d(p,u),children:[(0,l.jsxs)("div",{className:"gatherpress-label-wrapper",style:n(e),children:[(0,l.jsx)(r.RichText,{tagName:"legend",placeholder:(0,t.__)("Radio group title…","gatherpress"),value:x,onChange:e=>a({label:e}),onBlur:()=>(e=>{if(!g&&e){const t=h(e);t&&a({fieldName:t})}})(x),allowedFormats:[],style:s(e)}),m&&(0,l.jsx)(r.RichText,{tagName:"span",className:"gatherpress-label-required",placeholder:(0,t.__)("(required)","gatherpress"),value:_,onChange:e=>a({requiredText:e}),allowedFormats:[],style:{...f&&{color:f}}})]}),(0,l.jsx)("div",{className:"gatherpress-radio-group",style:n(e),children:C.map((s,n)=>(0,l.jsxs)("div",{className:"gatherpress-radio-option",children:[(0,l.jsx)("input",{style:o(p,e),type:"radio",name:g,value:s.value,checked:c===s.value&&""!==s.value,disabled:!0,tabIndex:-1,autoComplete:"off"}),(0,l.jsx)(r.RichText,{tagName:"label",placeholder:(0,t.__)("Option label…","gatherpress"),value:s.label,onChange:e=>((e,t,r)=>{const l=[...C];l[e]={...l[e],[t]:r};{const t=r.toLowerCase().split(/[^a-z0-9]+/).filter(e=>0((e,t)=>{"Enter"===e.key?(e.preventDefault(),(()=>{const e=[...C,{label:"",value:"",id:b()}];a({radioOptions:e}),setTimeout(()=>{const e=document.querySelectorAll(".gatherpress-radio-option .rich-text"),t=e[e.length-1];t&&t.focus()},50)})()):"Backspace"!==e.key&&"Delete"!==e.key||!C[t].label&&1{const t=C[e],r={radioOptions:C.filter((t,r)=>r!==e)};c===t.value&&(r.fieldValue=""),a(r),setTimeout(()=>{const t=Math.max(0,e-1),r=document.querySelectorAll(".gatherpress-radio-option .rich-text");if(r[t]){const e=r[t];e.focus();const a=document.createRange(),l=getSelection();a.selectNodeContents(e),a.collapse(!1),l.removeAllRanges(),l.addRange(a)}},50)})(t))})(e,n),allowedFormats:[],identifier:`radio-option-${n}`,style:i(e)})]},s.id))})]})}function _({attributes:e,setAttributes:a,blockProps:i,generateFieldName:u}){const{fieldType:h,fieldName:p,fieldValue:g,label:c,required:x,requiredText:b,requiredTextColor:m}=e;return(0,l.jsxs)("div",{...i,className:d(h,i),children:[(0,l.jsx)("input",{style:o(h,e),type:"checkbox",name:p,required:x,checked:!!g,disabled:!0,tabIndex:-1,autoComplete:"off"}),(0,l.jsxs)("div",{className:"gatherpress-label-wrapper",style:n(e),children:[(0,l.jsx)(r.RichText,{tagName:"label",placeholder:(0,t.__)("Add checkbox label…","gatherpress"),value:c,onChange:e=>a({label:e}),onBlur:()=>(e=>{if(!p&&e){const t=u(e);t&&a({fieldName:t})}})(c),allowedFormats:[],style:s(e)}),x&&(0,l.jsx)(r.RichText,{tagName:"span",className:"gatherpress-label-required",placeholder:(0,t.__)("(required)","gatherpress"),value:b,onChange:e=>a({requiredText:e}),allowedFormats:[],style:{...m&&{color:m}}})]})]})}function f({attributes:e,setAttributes:a,blockProps:i,generateFieldName:u}){const{fieldType:h,fieldName:p,fieldValue:g,label:c,placeholder:x,required:b,requiredText:m,requiredTextColor:_,minValue:f,maxValue:C,inlineLayout:v,textareaRows:y}=e;return(0,l.jsxs)("div",{...i,className:d(h,i,v),children:[(0,l.jsxs)("div",{className:"gatherpress-label-wrapper",style:n(e),children:[(0,l.jsx)(r.RichText,{tagName:"label",placeholder:(0,t.__)("Add label…","gatherpress"),value:c,onChange:e=>a({label:e}),onBlur:()=>(e=>{if(!p&&e){const t=u(e);t&&a({fieldName:t})}})(c),allowedFormats:[],style:s(e)}),b&&(0,l.jsx)(r.RichText,{tagName:"span",className:"gatherpress-label-required",placeholder:(0,t.__)("(required)","gatherpress"),value:m,onChange:e=>a({requiredText:e}),allowedFormats:[],style:{..._&&{color:_}}})]}),(0,l.jsx)("textarea",{style:o(h,e),name:p,placeholder:x,defaultValue:g,required:b,readOnly:!0,tabIndex:-1,autoComplete:"off",rows:y,...void 0!==f&&{minLength:f},...void 0!==C&&{maxLength:C}})]})}function C({attributes:e,blockProps:r}){const{fieldType:a,fieldName:o,fieldValue:s}=e;return(0,l.jsx)("div",{...r,className:d(a,r),children:(0,l.jsxs)("div",{className:"gatherpress-hidden-field-indicator",style:{padding:"12px",border:"2px dashed #ccc",borderRadius:"4px",textAlign:"center",opacity:.7,fontSize:"14px",color:"#666"},children:[(0,l.jsx)("span",{className:"dashicons dashicons-hidden",style:{marginRight:"8px"}}),(0,t.__)("Hidden Field","gatherpress"),o&&`: ${o}`,s&&(0,l.jsxs)("div",{style:{fontSize:"12px",marginTop:"4px"},children:[(0,t.__)("Value:","gatherpress")," ",s]})]})})}function v({attributes:e,setAttributes:o}){const{fieldType:s,required:n,inputFontSize:i,inputLineHeight:d,inputPadding:u,inputBorderWidth:h,inputBorderRadius:p,labelFontSize:g,labelLineHeight:c,inlineLayout:x,fieldWidth:b,labelTextColor:m,fieldTextColor:_,requiredTextColor:f,fieldBackgroundColor:C,textareaRows:v,borderColor:y}=e;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(a.PanelBody,{title:(0,t.__)("Layout Settings","gatherpress"),children:["textarea"!==s&&(0,l.jsx)(a.ToggleControl,{label:(0,t.__)("Inline Layout","gatherpress"),checked:x,onChange:e=>o({inlineLayout:e}),help:(0,t.__)("Display label and input on the same line.","gatherpress")}),(0,l.jsx)(a.RangeControl,{label:(0,t.__)("Field Width (%)","gatherpress"),value:b,onChange:e=>o({fieldWidth:e}),min:1,max:100,help:(0,t.__)("Width of the input field as a percentage.","gatherpress")})]}),(0,l.jsxs)(a.PanelBody,{title:(0,t.__)("Label Styles","gatherpress"),children:[(0,l.jsx)(a.BaseControl,{__nextHasNoMarginBottom:!0,children:(0,l.jsx)(r.FontSizePicker,{withReset:!0,size:"__unstable-large",__nextHasNoMarginBottom:!0,onChange:e=>o({labelFontSize:e}),value:g})}),(0,l.jsx)(a.RangeControl,{label:(0,t.__)("Line Height","gatherpress"),value:c,onChange:e=>o({labelLineHeight:e}),min:1,max:3,step:.1})]}),(0,l.jsxs)(a.PanelBody,{title:(0,t.__)("Input Field Styles","gatherpress"),children:[(0,l.jsx)(a.BaseControl,{__nextHasNoMarginBottom:!0,children:(0,l.jsx)(r.FontSizePicker,{withReset:!0,size:"__unstable-large",__nextHasNoMarginBottom:!0,onChange:e=>o({inputFontSize:e}),value:i})}),(0,l.jsx)(a.RangeControl,{label:(0,t.__)("Line Height","gatherpress"),value:d,onChange:e=>o({inputLineHeight:e}),min:1,max:3,step:.1}),(0,l.jsx)(a.RangeControl,{label:(0,t.__)("Padding (px)","gatherpress"),value:u,onChange:e=>o({inputPadding:e}),min:0,max:32}),"textarea"===s&&(0,l.jsx)(a.RangeControl,{label:(0,t.__)("Rows","gatherpress"),value:v,onChange:e=>o({textareaRows:e}),min:1,max:20,help:(0,t.__)("Number of visible text lines.","gatherpress")}),(0,l.jsx)(a.RangeControl,{label:(0,t.__)("Border Width (px)","gatherpress"),value:h,onChange:e=>o({inputBorderWidth:e}),min:0,max:10}),(0,l.jsx)(a.RangeControl,{label:(0,t.__)("Border Radius (px)","gatherpress"),value:p,onChange:e=>o({inputBorderRadius:e}),min:0,max:100})]}),(0,l.jsx)(r.PanelColorSettings,{title:(0,t.__)("Colors","gatherpress"),colorSettings:[{value:m,onChange:e=>o({labelTextColor:e}),label:(0,t.__)("Label Text","gatherpress")},{value:_,onChange:e=>o({fieldTextColor:e}),label:(0,t.__)("Field Text","gatherpress")},...n?[{value:f,onChange:e=>o({requiredTextColor:e}),label:(0,t.__)("Required Text","gatherpress")}]:[],{value:C,onChange:e=>o({fieldBackgroundColor:e}),label:(0,t.__)("Field Background","gatherpress")},{value:y,onChange:e=>o({borderColor:e}),label:(0,t.__)("Border","gatherpress")}]})]})}function y({attributes:e,setAttributes:o}){const{radioOptions:s=[{label:"",value:"",id:b()}],fieldValue:n,required:i,labelFontSize:d,labelLineHeight:u,optionFontSize:h,optionLineHeight:p,labelTextColor:g,requiredTextColor:c,optionTextColor:x}=e;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(a.PanelBody,{title:(0,t.__)("Radio Options","gatherpress"),children:[s.map((e,r)=>(0,l.jsx)("div",{children:(0,l.jsxs)(a.Flex,{justify:"normal",gap:"2",style:{position:"relative"},children:[(0,l.jsxs)(a.FlexItem,{children:[(0,l.jsx)(a.TextControl,{label:`${(0,t.__)("Option","gatherpress")} ${r+1}`,value:e.label,onChange:e=>((e,t,r)=>{const a=[...s];a[e]={...a[e],[t]:r};{const t=r.toLowerCase().split(/[^a-z0-9]+/).filter(e=>0{o({fieldValue:t?e.value:""})},help:(0,t.__)("Select this option by default.","gatherpress")})]}),(0,l.jsx)(a.FlexItem,{children:1(e=>{const t=s[e],r={radioOptions:s.filter((t,r)=>r!==e)};n===t.value&&(r.fieldValue=""),o(r)})(r),style:{padding:0,position:"absolute",top:"1.45rem",width:"2rem",height:"2rem"},icon:"no-alt",label:(0,t.__)("Remove option","gatherpress")})})]})},e.id)),(0,l.jsx)(a.Button,{variant:"secondary",onClick:()=>{const e=[...s,{label:"",value:"",id:b()}];o({radioOptions:e})},children:(0,t.__)("Add Option","gatherpress")})]}),(0,l.jsxs)(a.PanelBody,{title:(0,t.__)("Label Styles","gatherpress"),children:[(0,l.jsx)(a.BaseControl,{__nextHasNoMarginBottom:!0,children:(0,l.jsx)(r.FontSizePicker,{withReset:!0,size:"__unstable-large",__nextHasNoMarginBottom:!0,onChange:e=>o({labelFontSize:e}),value:d})}),(0,l.jsx)(a.RangeControl,{label:(0,t.__)("Line Height","gatherpress"),value:u,onChange:e=>o({labelLineHeight:e}),min:1,max:3,step:.1})]}),(0,l.jsxs)(a.PanelBody,{title:(0,t.__)("Option Styles","gatherpress"),children:[(0,l.jsx)(a.BaseControl,{__nextHasNoMarginBottom:!0,children:(0,l.jsx)(r.FontSizePicker,{withReset:!0,size:"__unstable-large",__nextHasNoMarginBottom:!0,onChange:e=>o({optionFontSize:e}),value:h})}),(0,l.jsx)(a.RangeControl,{label:(0,t.__)("Line Height","gatherpress"),value:p,onChange:e=>o({optionLineHeight:e}),min:1,max:3,step:.1})]}),(0,l.jsx)(r.PanelColorSettings,{title:(0,t.__)("Colors","gatherpress"),colorSettings:[{value:g,onChange:e=>o({labelTextColor:e}),label:(0,t.__)("Label Text","gatherpress")},...i?[{value:c,onChange:e=>o({requiredTextColor:e}),label:(0,t.__)("Required Text","gatherpress")}]:[],{value:x,onChange:e=>o({optionTextColor:e}),label:(0,t.__)("Option Text","gatherpress")}]})]})}function j({attributes:e,setAttributes:o}){const{required:s,labelFontSize:n,labelLineHeight:i,labelTextColor:d,requiredTextColor:u}=e;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(a.PanelBody,{title:(0,t.__)("Label Styles","gatherpress"),children:[(0,l.jsx)(a.BaseControl,{__nextHasNoMarginBottom:!0,children:(0,l.jsx)(r.FontSizePicker,{withReset:!0,size:"__unstable-large",__nextHasNoMarginBottom:!0,onChange:e=>o({labelFontSize:e}),value:n})}),(0,l.jsx)(a.RangeControl,{label:(0,t.__)("Line Height","gatherpress"),value:i,onChange:e=>o({labelLineHeight:e}),min:1,max:3,step:.1})]}),(0,l.jsx)(r.PanelColorSettings,{title:(0,t.__)("Colors","gatherpress"),colorSettings:[{value:d,onChange:e=>o({labelTextColor:e}),label:(0,t.__)("Label Text","gatherpress")},...s?[{value:u,onChange:e=>o({requiredTextColor:e}),label:(0,t.__)("Required Text","gatherpress")}]:[]]})]})}const T=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"gatherpress/form-field","version":"1.0.0","title":"Form Field","category":"gatherpress","icon":"text","example":{},"description":"A flexible form field that can be configured as various input types.","attributes":{"fieldType":{"type":"string","default":"text"},"fieldName":{"type":"string","default":""},"fieldValue":{"type":["string","boolean"],"default":""},"label":{"type":"string","default":""},"placeholder":{"type":"string","default":""},"required":{"type":"boolean","default":false},"requiredText":{"type":"string","default":"(required)"},"minValue":{"type":"number"},"maxValue":{"type":"number"},"radioOptions":{"type":"array","default":[{"label":"","value":""}]},"inlineLayout":{"type":"boolean","default":false},"fieldWidth":{"type":"number","default":100},"labelTextColor":{"type":"string"},"fieldTextColor":{"type":"string"},"requiredTextColor":{"type":"string"},"fieldBackgroundColor":{"type":"string"},"borderColor":{"type":"string"},"optionTextColor":{"type":"string"},"labelFontSize":{"type":"string"},"labelLineHeight":{"type":"number","default":1.5},"optionFontSize":{"type":"string"},"optionLineHeight":{"type":"number","default":1.5},"inputFontSize":{"type":"string"},"inputLineHeight":{"type":"number","default":1.5},"inputPadding":{"type":"number","default":16},"inputBorderWidth":{"type":"number","default":1},"inputBorderRadius":{"type":"number","default":0},"textareaRows":{"type":"number","default":4},"autocomplete":{"type":"string","default":"on"}},"supports":{"html":false},"textdomain":"gatherpress","editorScript":"file:./index.js","style":"file:./style-index.css","render":"file:./render.php"}');(0,e.registerBlockType)(T,{edit:function({attributes:e,setAttributes:o}){const{fieldType:s,fieldName:n,minValue:i,maxValue:d,placeholder:p,required:g,autocomplete:c}=e,x={};e["data-gatherpress-no-render"]&&(x["data-gatherpress-no-render"]=e["data-gatherpress-no-render"]);const b=(0,r.useBlockProps)(x),T=e=>e.toLowerCase().trim().replaceAll(/[^a-z0-9\s]/g,"").split(/\s+/).filter(e=>0{switch(e){case"email":return"email";case"url":return"url";case"tel":return"tel";default:return"on"}};return(0,l.jsxs)(l.Fragment,{children:[(()=>{const t={attributes:e,setAttributes:o,blockProps:b,generateFieldName:T};switch(s){case"radio":return(0,l.jsx)(m,{...t});case"checkbox":return(0,l.jsx)(_,{...t});case"textarea":return(0,l.jsx)(f,{...t});case"hidden":return(0,l.jsx)(C,{...t});default:return(0,l.jsx)(h,{...t})}})(),(0,l.jsxs)(r.InspectorControls,{children:[(0,l.jsxs)(a.PanelBody,{title:(0,t.__)("Field Settings","gatherpress"),children:[(0,l.jsx)(a.SelectControl,{label:(0,t.__)("Field Type","gatherpress"),value:s,options:[{label:(0,t.__)("Text","gatherpress"),value:"text"},{label:(0,t.__)("Email","gatherpress"),value:"email"},{label:(0,t.__)("Telephone","gatherpress"),value:"tel"},{label:(0,t.__)("URL","gatherpress"),value:"url"},{label:(0,t.__)("Number","gatherpress"),value:"number"},{label:(0,t.__)("Textarea","gatherpress"),value:"textarea"},{label:(0,t.__)("Checkbox","gatherpress"),value:"checkbox"},{label:(0,t.__)("Radio","gatherpress"),value:"radio"},{label:(0,t.__)("Hidden","gatherpress"),value:"hidden"}],onChange:e=>{o({fieldType:e,fieldValue:"",autocomplete:w(e)})}}),(0,l.jsx)(a.TextControl,{label:(0,t.__)("Field Name","gatherpress"),value:n,onChange:e=>{const t=e.replaceAll(/[^a-zA-Z0-9_-]/g,"");o({fieldName:t})},help:(0,t.__)("The name attribute for the form field.","gatherpress")}),"hidden"!==s&&(0,l.jsx)(a.ToggleControl,{label:(0,t.__)("Required","gatherpress"),checked:g,onChange:e=>o({required:e}),help:(0,t.__)("Make this field required.","gatherpress")}),(0,l.jsx)(u,{fieldType:s,attributes:e,setAttributes:o}),!["hidden","checkbox","radio"].includes(s)&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(a.TextControl,{label:(0,t.__)("Placeholder","gatherpress"),value:p,onChange:e=>o({placeholder:e}),help:(0,t.__)("Placeholder text shown inside the field.","gatherpress")}),(0,l.jsx)(a.__experimentalNumberControl,{label:"number"===s?(0,t.__)("Minimum Value","gatherpress"):(0,t.__)("Minimum Length","gatherpress"),value:i,onChange:e=>o({minValue:""===e?void 0:parseInt(e,10)}),min:0,help:"number"===s?(0,t.__)("Minimum allowed value for this number field.","gatherpress"):(0,t.__)("Minimum number of characters required.","gatherpress")}),(0,l.jsx)(a.__experimentalNumberControl,{label:"number"===s?(0,t.__)("Maximum Value","gatherpress"):(0,t.__)("Maximum Length","gatherpress"),value:d,onChange:e=>o({maxValue:""===e?void 0:parseInt(e,10)}),min:0,help:"number"===s?(0,t.__)("Maximum allowed value for this number field.","gatherpress"):(0,t.__)("Maximum number of characters allowed.","gatherpress")})]}),!["hidden"].includes(s)&&(0,l.jsx)(a.TextControl,{label:(0,t.__)("Autocomplete","gatherpress"),value:c,onChange:e=>{const t=e.replaceAll(/[^a-z0-9_\s-]/g,"");o({autocomplete:t})},help:(0,l.jsxs)(l.Fragment,{children:[(0,t.__)('Controls browser autocomplete behavior. Use "on", "off", or specific values like "email", "name", etc.',"gatherpress"),(0,l.jsx)("br",{}),(0,l.jsx)("a",{href:"https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete",target:"_blank",rel:"noopener noreferrer",children:(0,t.__)("Learn more","gatherpress")})]})})]}),(()=>{const t={attributes:e,setAttributes:o};switch(s){case"radio":return(0,l.jsx)(y,{...t});case"checkbox":return(0,l.jsx)(j,{...t});case"hidden":return(0,l.jsx)(l.Fragment,{});default:return(0,l.jsx)(v,{...t})}})()]})]})},save:()=>null})}},r={};function a(e){var l=r[e];if(void 0!==l)return l.exports;var o=r[e]={exports:{}};return t[e](o,o.exports,a),o.exports}a.m=t,e=[],a.O=(t,r,l,o)=>{if(!r){var s=1/0;for(u=0;u=o)&&Object.keys(a.O).every(e=>a.O[e](r[i]))?r.splice(i--,1):(n=!1,o0&&e[u-1][2]>o;u--)e[u]=e[u-1];e[u]=[r,l,o]},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={7076:0,3596:0};a.O.j=t=>0===e[t];var t=(t,r)=>{var l,o,[s,n,i]=r,d=0;if(s.some(t=>0!==e[t])){for(l in n)a.o(n,l)&&(a.m[l]=n[l]);if(i)var u=i(a)}for(t&&t(r);da(6813));l=a.O(l)})();