import{o as e}from"./rolldown-runtime.C0FnF6B9.js";import{r as t}from"./emotion-is-prop-valid.esm.CuYlOKOk.js";import{i as n}from"./emotion-styled.browser.esm.BYv_Qzcq.js";import{i as r}from"./Tooltip.CcubhKj6.js";import{n as i,t as a}from"./styled-components.BjKbfR5p.js";import{t as o}from"./BaseButton.eTlHCX_j.js";import{t as s}from"./BaseButtonTooltip.B83DZSNb.js";import{i as c,t as l}from"./DynamicButtonLabel.BTjDBnmI.js";import{t as u}from"./useResolvedWrap.DnjqnyWR.js";import{r as d,t as f}from"./FormsContext.C6bVDc7u.js";import{t as p}from"./useRequiredContext.DBsQavvD.js";import{t as m}from"./iconPosition.DwITqWdC.js";var h=e(t(),1),g=(0,h.memo)(function(e){let{disabled:t,element:d,widgetMgr:g,fragmentId:_}=e,{formId:v}=d,y=d.shortcut?d.shortcut:void 0,b=u(d.wrap),x=!b&&!d.help,{formsData:S}=p(f),C=S.formsWithUploads.has(v),w=a.SECONDARY_FORM_SUBMIT;d.type===`primary`?w=a.PRIMARY_FORM_SUBMIT:d.type===`tertiary`&&(w=a.TERTIARY_FORM_SUBMIT);let T=t||C;(0,h.useEffect)(()=>(g.addSubmitButton(v,d),()=>g.removeSubmitButton(v,d)),[g,v,d]);let E=(0,h.useCallback)(()=>{T||g.submitForm(d.formId,_,d)},[T,g,d,_]);return c({shortcut:y,disabled:T,onActivate:E}),n(r,{className:`stFormSubmitButton`,"data-testid":`stFormSubmitButton`,children:n(s,{help:d.help,containerWidth:!0,children:n(o,{kind:w,size:i.SMALL,containerWidth:!0,disabled:T,onClick:E,children:n(l,{icon:d.icon,iconPosition:m(d.iconPosition),label:d.label,shortcut:y,wrap:b,addTitleTooltip:x})})})})});function _(e){return n(d,{children:n(g,{...e})})}export{_ as FormSubmitContent};