import{X as h,dr as S,ay as r,b as d,az as f,c as o,aA as p,b4 as F,ax as I,aB as R,aC as M,ds as C}from"./index.BdH_oWMm.js";import{m as x}from"./iconPosition.BmsruyBM.js";function y(i){const{disabled:l,element:t,widgetMgr:e,fragmentId:u}=i,{formId:s}=t,c=t.shortcut?t.shortcut:void 0,{formsData:b}=h(S),B=b.formsWithUploads.has(s);let a=r.SECONDARY_FORM_SUBMIT;t.type==="primary"?a=r.PRIMARY_FORM_SUBMIT:t.type==="tertiary"&&(a=r.TERTIARY_FORM_SUBMIT);const n=l||B;d.useEffect(()=>(e.addSubmitButton(s,t),()=>e.removeSubmitButton(s,t)),[e,s,t]);const m=d.useCallback(()=>{n||e.submitForm(t.formId,u,t)},[n,e,t,u]);return f({shortcut:c,disabled:n,onActivate:m}),o(M,{className:"stFormSubmitButton","data-testid":"stFormSubmitButton",children:o(p,{help:t.help,containerWidth:!0,children:o(F,{kind:a,size:I.SMALL,containerWidth:!0,disabled:n,onClick:m,children:o(R,{icon:t.icon,iconPosition:x(t.iconPosition),label:t.label,shortcut:c})})})})}function T(i){return o(C,{children:o(y,{...i})})}export{T as FormSubmitContent};
