import{a9 as e,r as i,a7 as $,aZ as Z,j as u,l as q,aL as G,aM as P,ak as K}from"./index-cc84e56a.js";import{g as Q,a as X,s as D,u as Y}from"./useThemeProps-34ae68cb.js";import{a as S,u as x}from"./useSlot-ba206985.js";function w(r){return Q("MuiTypography",r)}X("MuiTypography",["root","h1","h2","h3","h4","title-lg","title-md","title-sm","body-lg","body-md","body-sm","body-xs","noWrap","gutterBottom","startDecorator","endDecorator","colorPrimary","colorNeutral","colorDanger","colorSuccess","colorWarning","colorContext","variantPlain","variantOutlined","variantSoft","variantSolid"]);const oo=["color","textColor"],ro=["component","gutterBottom","noWrap","level","levelMapping","children","endDecorator","startDecorator","variant","slots","slotProps"],b=i.createContext(!1),eo=i.createContext(!1),to=r=>{const{gutterBottom:o,noWrap:n,level:a,color:t,variant:l}=r,s={root:["root",a,o&&"gutterBottom",n&&"noWrap",t&&`color${P(t)}`,l&&`variant${P(l)}`],startDecorator:["startDecorator"],endDecorator:["endDecorator"]};return K(s,w,{})},ao=D("span",{name:"JoyTypography",slot:"StartDecorator",overridesResolver:(r,o)=>o.startDecorator})({display:"inline-flex",marginInlineEnd:"clamp(4px, var(--Typography-gap, 0.375em), 0.75rem)"}),lo=D("span",{name:"JoyTypography",slot:"endDecorator",overridesResolver:(r,o)=>o.endDecorator})({display:"inline-flex",marginInlineStart:"clamp(4px, var(--Typography-gap, 0.375em), 0.75rem)"}),no=D("span",{name:"JoyTypography",slot:"Root",overridesResolver:(r,o)=>o.root})(({theme:r,ownerState:o})=>{var n,a,t,l,s;const p=o.level!=="inherit"?(n=r.typography[o.level])==null?void 0:n.lineHeight:"1";return e({"--Icon-fontSize":`calc(1em * ${p})`},o.color&&{"--Icon-color":"currentColor"},{margin:"var(--Typography-margin, 0px)"},o.nesting?{display:"inline"}:{display:"block",position:"relative"},(o.startDecorator||o.endDecorator)&&e({display:"flex",alignItems:"center"},o.nesting&&e({display:"inline-flex"},o.startDecorator&&{verticalAlign:"bottom"})),o.level&&o.level!=="inherit"&&r.typography[o.level],{fontSize:`var(--Typography-fontSize, ${o.level&&o.level!=="inherit"&&(a=(t=r.typography[o.level])==null?void 0:t.fontSize)!=null?a:"inherit"})`},o.noWrap&&{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},o.gutterBottom&&{marginBottom:"0.35em"},o.color&&o.color!=="context"&&{color:`rgba(${(l=r.vars.palette[o.color])==null?void 0:l.mainChannel} / 1)`},o.variant&&e({borderRadius:r.vars.radius.xs,paddingBlock:"min(0.1em, 4px)",paddingInline:"0.25em"},!o.nesting&&{marginInline:"-0.25em"},(s=r.variants[o.variant])==null?void 0:s[o.color]))}),_={h1:"h1",h2:"h2",h3:"h3",h4:"h4","title-lg":"p","title-md":"p","title-sm":"p","body-lg":"p","body-md":"p","body-sm":"p","body-xs":"span",inherit:"p"},I=i.forwardRef(function(o,n){const a=Y({props:o,name:"JoyTypography"}),{color:t,textColor:l}=a,s=$(a,oo),p=i.useContext(b),B=i.useContext(eo),d=Z(e({},s,{color:l})),{component:R,gutterBottom:W=!1,noWrap:M=!1,level:E="body-md",levelMapping:N=_,children:c,endDecorator:T,startDecorator:f,variant:m,slots:z={},slotProps:j={}}=d,k=$(d,ro),{getColor:J}=S(m),U=J(o.color,m?t??"neutral":t),g=p||B?o.level||"inherit":E,C=R||(p?"span":N[g]||_[g]||"span"),y=e({},d,{level:g,component:C,color:U,gutterBottom:W,noWrap:M,nesting:p,variant:m}),h=to(y),v=e({},k,{component:C,slots:z,slotProps:j}),[H,L]=x("root",{ref:n,className:h.root,elementType:no,externalForwardedProps:v,ownerState:y}),[O,A]=x("startDecorator",{className:h.startDecorator,elementType:ao,externalForwardedProps:v,ownerState:y}),[F,V]=x("endDecorator",{className:h.endDecorator,elementType:lo,externalForwardedProps:v,ownerState:y});return u(b.Provider,{value:!0,children:q(H,e({},L,{children:[f&&u(O,e({},A,{children:f})),G(c,["Skeleton"])?i.cloneElement(c,{variant:c.props.variant||"inline"}):c,T&&u(F,e({},V,{children:T}))]}))})});I.muiName="Typography";const co=I;export{co as T};
