import{h as e}from"./p-083180bf.js";import{i}from"./p-f8a09b0f.js";import{j as l,a}from"./p-cef45012.js";import{E as o}from"./p-49b20dae.js";const t={ErrorStyle:o,FieldContainer:{"margin-bottom":"var(--sl-spacing-medium)"}};l.setup(a());const s=l.createStyleSheet(t),r=s.toString();function n(l){var a,o,t,n,d,p;const{states:u,content:v}=l;return e("div",{class:s.classes.FieldContainer,part:"sqm-base"},e("style",{type:"text/css"},"\n:host {\n  margin: 0 auto;\n  width: 100%;\n  display: block;\n}\n",r),e("sl-input",Object.assign({exportparts:"label: input-label, base: input-base",name:`/${v.fieldName}`,type:v.fieldType,label:`${v.fieldLabel}${v.fieldOptional?` ${v.optionalLabel}`:""}`},v.fieldOptional?[]:{required:!0},{disabled:(null===(a=u.leadFormState)||void 0===a?void 0:a.loading)||(null===(o=u.leadFormState)||void 0===o?void 0:o.disabled),validationError:({value:e})=>{if(!e&&!v.fieldOptional)return(({fieldLabel:e})=>i.formatMessage({id:`requiredFieldErrorMessage-${e}`,defaultMessage:v.requiredFieldErrorMessage},{fieldLabel:e}))({fieldLabel:v.fieldLabel})}},(null===(n=null===(t=u.leadFormState)||void 0===t?void 0:t.validationErrors)||void 0===n?void 0:n[v.fieldName])?{class:s.classes.ErrorStyle,helpText:(null===(p=null===(d=u.leadFormState)||void 0===d?void 0:d.validationErrors)||void 0===p?void 0:p[v.fieldName])||v.requiredFieldErrorMessage}:[])))}export{n as L}