import{fE as E,fv as C,f as h,E as y,cz as r,r as B,fT as z,cJ as R,cx as j,j as g,Y as M}from"./index-6fe66247.js";import{u as d}from"./index-25f54021.js";import{r as W}from"./resolveProps-d8ef25a0.js";import{c as U}from"./composeClasses-b42b2e69.js";function _(n){return C("MuiLoadingButton",n)}const F=E("MuiLoadingButton",["root","loading","loadingIndicator","loadingIndicatorCenter","loadingIndicatorStart","loadingIndicatorEnd","endIconLoadingEnd","startIconLoadingStart"]),i=F,k=["children","disabled","id","loading","loadingIndicator","loadingPosition","variant"],D=n=>{const{loading:o,loadingPosition:t,classes:l}=n,c={root:["root",o&&"loading"],startIcon:[o&&`startIconLoading${d.capitalize(t)}`],endIcon:[o&&`endIconLoading${d.capitalize(t)}`],loadingIndicator:["loadingIndicator",o&&`loadingIndicator${d.capitalize(t)}`]},a=U(c,_,l);return r({},l,a)},G=n=>n!=="ownerState"&&n!=="theme"&&n!=="sx"&&n!=="as"&&n!=="classes",J=h(y,{shouldForwardProp:n=>G(n)||n==="classes",name:"MuiLoadingButton",slot:"Root",overridesResolver:(n,o)=>[o.root,o.startIconLoadingStart&&{[`& .${i.startIconLoadingStart}`]:o.startIconLoadingStart},o.endIconLoadingEnd&&{[`& .${i.endIconLoadingEnd}`]:o.endIconLoadingEnd}]})(({ownerState:n,theme:o})=>r({[`& .${i.startIconLoadingStart}, & .${i.endIconLoadingEnd}`]:{transition:o.transitions.create(["opacity"],{duration:o.transitions.duration.short}),opacity:0}},n.loadingPosition==="center"&&{transition:o.transitions.create(["background-color","box-shadow","border-color"],{duration:o.transitions.duration.short}),[`&.${i.loading}`]:{color:"transparent"}},n.loadingPosition==="start"&&n.fullWidth&&{[`& .${i.startIconLoadingStart}, & .${i.endIconLoadingEnd}`]:{transition:o.transitions.create(["opacity"],{duration:o.transitions.duration.short}),opacity:0,marginRight:-8}},n.loadingPosition==="end"&&n.fullWidth&&{[`& .${i.startIconLoadingStart}, & .${i.endIconLoadingEnd}`]:{transition:o.transitions.create(["opacity"],{duration:o.transitions.duration.short}),opacity:0,marginLeft:-8}})),N=h("span",{name:"MuiLoadingButton",slot:"LoadingIndicator",overridesResolver:(n,o)=>{const{ownerState:t}=n;return[o.loadingIndicator,o[`loadingIndicator${d.capitalize(t.loadingPosition)}`]]}})(({theme:n,ownerState:o})=>r({position:"absolute",visibility:"visible",display:"flex"},o.loadingPosition==="start"&&(o.variant==="outlined"||o.variant==="contained")&&{left:o.size==="small"?10:14},o.loadingPosition==="start"&&o.variant==="text"&&{left:6},o.loadingPosition==="center"&&{left:"50%",transform:"translate(-50%)",color:(n.vars||n).palette.action.disabled},o.loadingPosition==="end"&&(o.variant==="outlined"||o.variant==="contained")&&{right:o.size==="small"?10:14},o.loadingPosition==="end"&&o.variant==="text"&&{right:6},o.loadingPosition==="start"&&o.fullWidth&&{position:"relative",left:-10},o.loadingPosition==="end"&&o.fullWidth&&{position:"relative",right:-10})),T=B.forwardRef(function(o,t){const l=B.useContext(z),c=W(l,o),a=R({props:c,name:"MuiLoadingButton"}),{children:u,disabled:I=!1,id:$,loading:e=!1,loadingIndicator:p,loadingPosition:b="center",variant:L="text"}=a,m=j(a,k),f=d.unstable_useId($),P=p??g.jsx(M,{"aria-labelledby":f,color:"inherit",size:16}),s=r({},a,{disabled:I,loading:e,loadingIndicator:P,loadingPosition:b,variant:L}),v=D(s),x=e?g.jsx(N,{className:v.loadingIndicator,ownerState:s,children:P}):null;return g.jsxs(J,r({disabled:I||e,id:f,ref:t},m,{variant:L,classes:v,ownerState:s,children:[s.loadingPosition==="end"?u:x,s.loadingPosition==="end"?x:u]}))}),K=T;export{K as L};
