import{b7 as r,e4 as j,e5 as z,d as $,K as R,r as x,e6 as k,bk as M,b9 as W,j as u,e3 as p}from"./index-76d4793e.js";import{u as e}from"./index-ecea5cfc.js";import{c as O}from"./composeClasses-b42b2e69.js";function B(n,o){const i=r({},o);return Object.keys(n).forEach(t=>{if(t.toString().match(/^(components|slots)$/))i[t]=r({},n[t],i[t]);else if(t.toString().match(/^(componentsProps|slotProps)$/)){const s=n[t]||{},a=o[t];i[t]={},!a||!Object.keys(a)?i[t]=s:!s||!Object.keys(s)?i[t]=a:(i[t]=r({},a),Object.keys(s).forEach(l=>{i[t][l]=B(s[l],a[l])}))}else i[t]===void 0&&(i[t]=n[t])}),i}function U(n){return z("MuiLoadingButton",n)}const _=j("MuiLoadingButton",["root","loading","loadingIndicator","loadingIndicatorCenter","loadingIndicatorStart","loadingIndicatorEnd","endIconLoadingEnd","startIconLoadingStart"]),d=_,F=["children","disabled","id","loading","loadingIndicator","loadingPosition","variant"],D=n=>{const{loading:o,loadingPosition:i,classes:t}=n,s={root:["root",o&&"loading"],startIcon:[o&&`startIconLoading${e.capitalize(i)}`],endIcon:[o&&`endIconLoading${e.capitalize(i)}`],loadingIndicator:["loadingIndicator",o&&`loadingIndicator${e.capitalize(i)}`]},a=O(s,U,t);return r({},t,a)},G=n=>n!=="ownerState"&&n!=="theme"&&n!=="sx"&&n!=="as"&&n!=="classes",K=$(R,{shouldForwardProp:n=>G(n)||n==="classes",name:"MuiLoadingButton",slot:"Root",overridesResolver:(n,o)=>[o.root,o.startIconLoadingStart&&{[`& .${d.startIconLoadingStart}`]:o.startIconLoadingStart},o.endIconLoadingEnd&&{[`& .${d.endIconLoadingEnd}`]:o.endIconLoadingEnd}]})(({ownerState:n,theme:o})=>r({[`& .${d.startIconLoadingStart}, & .${d.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}),[`&.${d.loading}`]:{color:"transparent"}},n.loadingPosition==="start"&&n.fullWidth&&{[`& .${d.startIconLoadingStart}, & .${d.endIconLoadingEnd}`]:{transition:o.transitions.create(["opacity"],{duration:o.transitions.duration.short}),opacity:0,marginRight:-8}},n.loadingPosition==="end"&&n.fullWidth&&{[`& .${d.startIconLoadingStart}, & .${d.endIconLoadingEnd}`]:{transition:o.transitions.create(["opacity"],{duration:o.transitions.duration.short}),opacity:0,marginLeft:-8}})),q=$("span",{name:"MuiLoadingButton",slot:"LoadingIndicator",overridesResolver:(n,o)=>{const{ownerState:i}=n;return[o.loadingIndicator,o[`loadingIndicator${e.capitalize(i.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})),A=x.forwardRef(function(o,i){const t=x.useContext(k),s=B(t,o),a=M({props:s,name:"MuiLoadingButton"}),{children:l,disabled:I=!1,id:y,loading:g=!1,loadingIndicator:L,loadingPosition:E="center",variant:f="text"}=a,C=W(a,F),P=e.unstable_useId(y),b=L??u.jsx(p,{"aria-labelledby":P,color:"inherit",size:16}),c=r({},a,{disabled:I,loading:g,loadingIndicator:b,loadingPosition:E,variant:f}),v=D(c),h=g?u.jsx(q,{className:v.loadingIndicator,ownerState:c,children:b}):null;return u.jsxs(K,r({disabled:I||g,id:P,ref:i},C,{variant:f,classes:v,ownerState:c,children:[c.loadingPosition==="end"?l:h,c.loadingPosition==="end"?h:l]}))}),T=A;export{T as L};
