import{h}from"./index-38ad4957.js";import{i as intl}from"./global-96c14d63.js";import{j as jss,a as create}from"./JSS-67b5cff8.js";var style={ErrorStyle:{"&::part(control)":{borderColor:"var(--sl-color-danger-500)",outline:"var(--sl-color-danger-500)"},"&:host":{"--focus-ring":"0 0 0 var(--sl-focus-ring-width) red !important"}},ErrorMessageStyle:{margin:0,marginTop:"5px",color:"var(--sl-color-danger-500)",fontSize:"var(--sl-input-help-text-font-size-medium)",fontFamily:"var(--sl-font-sans)",fontWeight:"var(--sl-font-weight-normal)"},FieldContainer:{"margin-bottom":"var(--sl-spacing-large)"}};var vanillaStyle="\n:host {\n  margin: 0 auto;\n  width: 100%;\n  display: block;\n}\nsl-checkbox::part(label){\n  font-size: var(--sl-input-label-font-size-small);\n  font-weight: var(--sl-font-weight-normal);\n  line-height: 20px;\n}\nsl-checkbox::part(base){\n  align-items: start;\n}\n";jss.setup(create());var sheet=jss.createStyleSheet(style);var styleString=sheet.toString();function LeadCheckboxFieldView(e){var a,l,t,r,o;var s=e.states,n=e.content;var i=(a=s===null||s===void 0?void 0:s.leadFormState)===null||a===void 0?void 0:a.validationErrors;var c=function(e){var a=e.checkboxLabel;return intl.formatMessage({id:"requiredFieldErrorMessage-"+a,defaultMessage:n.errorMessage},{checkboxLabel:a})};return h("div",{class:sheet.classes.FieldContainer,part:"sqm-base"},h("style",{type:"text/css"},vanillaStyle,styleString),h("sl-checkbox",Object.assign({exportparts:"label: input-label, base: input-base",name:"/"+n.checkboxName,"onSl-change":function(e){e.target.value=e.target.checked}},!n.checkboxOptional?{required:false}:[],{disabled:((l=s.leadFormState)===null||l===void 0?void 0:l.loading)||((t=s.leadFormState)===null||t===void 0?void 0:t.disabled),validationError:function(e){var a=e.value;if(!a&&!n.checkboxOptional){return c({checkboxLabel:n.checkboxLabel})}}},((o=(r=s.leadFormState)===null||r===void 0?void 0:r.validationErrors)===null||o===void 0?void 0:o[n.checkboxName])?{class:sheet.classes.ErrorStyle}:[]),intl.formatMessage({id:n.checkboxName+"-message",defaultMessage:n.checkboxLabel},{labelLink:h("a",{href:n.checkboxLabelLink,target:"_blank"},n.checkboxLabelLinkText||n.checkboxLabelLink)})),(i===null||i===void 0?void 0:i[n.checkboxName])&&h("p",{class:sheet.classes.ErrorMessageStyle},c({checkboxLabel:n.checkboxLabel})))}export{LeadCheckboxFieldView as L};