import{cG as r,dA as j,dB as R,f as B,R as k,o as e,r as b,dC as M,t as W,cI as z,j as u}from"./index-3141de2d.js";import{u as O}from"./Select-369b8a03.js";import{c as U}from"./composeClasses-b42b2e69.js";import{C as _}from"./CircularProgress-a64e9e1b.js";function $(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]=$(s[l],a[l])}))}else i[t]===void 0&&(i[t]=n[t])}),i}function F(n){return R("MuiLoadingButton",n)}const G=j("MuiLoadingButton",["root","loading","loadingIndicator","loadingIndicatorCenter","loadingIndicatorStart","loadingIndicatorEnd","endIconLoadingEnd","startIconLoadingStart"]),d=G,m=["children","disabled","id","loading","loadingIndicator","loadingPosition","variant"],p=n=>{const{loading:o,loadingPosition:i,classes:t}=n,s={root:["root",o&&"loading"],startIcon:[o&&`startIconLoading${e(i)}`],endIcon:[o&&`endIconLoading${e(i)}`],loadingIndicator:["loadingIndicator",o&&`loadingIndicator${e(i)}`]},a=U(s,F,t);return r({},t,a)},A=n=>n!=="ownerState"&&n!=="theme"&&n!=="sx"&&n!=="as"&&n!=="classes",D=B(k,{shouldForwardProp:n=>A(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=B("span",{name:"MuiLoadingButton",slot:"LoadingIndicator",overridesResolver:(n,o)=>{const{ownerState:i}=n;return[o.loadingIndicator,o[`loadingIndicator${e(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})),H=b.forwardRef(function(o,i){const t=b.useContext(M),s=$(t,o),a=W({props:s,name:"MuiLoadingButton"}),{children:l,disabled:I=!1,id:C,loading:g=!1,loadingIndicator:L,loadingPosition:y="center",variant:f="text"}=a,E=z(a,m),P=O(C),v=L??u.jsx(_,{"aria-labelledby":P,color:"inherit",size:16}),c=r({},a,{disabled:I,loading:g,loadingIndicator:v,loadingPosition:y,variant:f}),h=p(c),x=g?u.jsx(q,{className:h.loadingIndicator,ownerState:c,children:v}):null;return u.jsxs(D,r({disabled:I||g,id:P,ref:i},E,{variant:f,classes:h,ownerState:c,children:[c.loadingPosition==="end"?l:x,c.loadingPosition==="end"?x:l]}))}),V=H;export{V as L};
