import{r as d,j as t,c as y}from"./iframe-B8FSoBNY.js";import{c as u,m as j}from"./factory-DAJZwK4o.js";import{c as C}from"./create-recipe-context-BU56IzEo.js";import{S as N,d as R}from"./spinner-ZYH_gvW-.js";import{S as l}from"./index-CXwl6T4k.js";const m=u("div",{base:{position:"absolute",display:"flex",alignItems:"center",justifyContent:"center"},variants:{axis:{horizontal:{insetStart:"50%",translate:"-50%",_rtl:{translate:"50%"}},vertical:{top:"50%",translate:"0 -50%"},both:{insetStart:"50%",top:"50%",translate:"-50% -50%",_rtl:{translate:"50% -50%"}}}},defaultVariants:{axis:"both"}});m.displayName="AbsoluteCenter";const x=d.forwardRef(function(o,i){const{spinner:s=t.jsx(N,{size:"inherit",borderWidth:"0.125em",color:"inherit"}),spinnerPlacement:e="start",children:n,text:a,visible:c=!0,...r}=o;return c?a?t.jsxs(l,{ref:i,display:"contents",...r,children:[e==="start"&&s,a,e==="end"&&s]}):s?t.jsxs(l,{ref:i,display:"contents",...r,children:[t.jsx(m,{display:"inline-flex",children:s}),t.jsx(l,{visibility:"hidden",display:"contents",children:n})]}):t.jsx(l,{ref:i,display:"contents",...r,children:n}):n});x.displayName="Loader";const{useRecipeResult:S,usePropsContext:g}=C({key:"button"}),v=d.forwardRef(function(o,i){const s=g(),e=d.useMemo(()=>j(s,o),[s,o]),n=S(e),{loading:a,loadingText:c,children:r,spinner:h,spinnerPlacement:b,...p}=n.props;return t.jsx(u.button,{type:"button",ref:i,...p,"data-loading":R(a),disabled:a||p.disabled,className:y(n.className,e.className),css:[n.styles,e.css],children:!e.asChild&&a?t.jsx(x,{spinner:h,text:c,spinnerPlacement:b,children:r}):r})});v.displayName="Button";export{m as A,v as B};
