import{w as Z,g as I,j as k,h as j,i as w,o as b,B as G,m as z,p as B,q as U,s as $}from"./polymorphic-factory-EW0USS3V.js";import{j as n}from"./jsx-runtime-D_zvdyIk.js";import{a as v}from"./chunk-QMGIS6GS-CBZUm-7V.js";function q({color:r,theme:o,autoContrast:t}){return(typeof t=="boolean"?t:o.autoContrast)&&Z({color:r||o.primaryColor,theme:o}).isLight?"var(--mantine-color-black)":"var(--mantine-color-white)"}function er(r,o){return q({color:r.colors[r.primaryColor][I(r,o)],theme:r,autoContrast:null})}const R=v.createContext(null),F=R.Provider;function L(){return{withinGroup:!!v.useContext(R)}}var C={group:"m_11def92b",root:"m_f85678b6",image:"m_11f8ac07",placeholder:"m_104cd71f"};const T={},V=b((r,{spacing:o})=>({group:{"--ag-spacing":z(o)}})),h=k((r,o)=>{const t=j("AvatarGroup",T,r),{classNames:a,className:l,style:c,styles:p,unstyled:i,vars:d,spacing:s,...e}=t,m=w({name:"AvatarGroup",classes:C,props:t,className:l,style:c,classNames:a,styles:p,unstyled:i,vars:d,varsResolver:V,rootSelector:"group"});return n.jsx(F,{value:!0,children:n.jsx(G,{ref:o,...m("group"),...e})})});h.classes=C;h.displayName="@mantine/core/AvatarGroup";function D(r){return n.jsx("svg",{...r,"data-avatar-placeholder-icon":!0,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:n.jsx("path",{d:"M0.877014 7.49988C0.877014 3.84219 3.84216 0.877045 7.49985 0.877045C11.1575 0.877045 14.1227 3.84219 14.1227 7.49988C14.1227 11.1575 11.1575 14.1227 7.49985 14.1227C3.84216 14.1227 0.877014 11.1575 0.877014 7.49988ZM7.49985 1.82704C4.36683 1.82704 1.82701 4.36686 1.82701 7.49988C1.82701 8.97196 2.38774 10.3131 3.30727 11.3213C4.19074 9.94119 5.73818 9.02499 7.50023 9.02499C9.26206 9.02499 10.8093 9.94097 11.6929 11.3208C12.6121 10.3127 13.1727 8.97172 13.1727 7.49988C13.1727 4.36686 10.6328 1.82704 7.49985 1.82704ZM10.9818 11.9787C10.2839 10.7795 8.9857 9.97499 7.50023 9.97499C6.01458 9.97499 4.71624 10.7797 4.01845 11.9791C4.97952 12.7272 6.18765 13.1727 7.49985 13.1727C8.81227 13.1727 10.0206 12.727 10.9818 11.9787ZM5.14999 6.50487C5.14999 5.207 6.20212 4.15487 7.49999 4.15487C8.79786 4.15487 9.84999 5.207 9.84999 6.50487C9.84999 7.80274 8.79786 8.85487 7.49999 8.85487C6.20212 8.85487 5.14999 7.80274 5.14999 6.50487ZM7.49999 5.10487C6.72679 5.10487 6.09999 5.73167 6.09999 6.50487C6.09999 7.27807 6.72679 7.90487 7.49999 7.90487C8.27319 7.90487 8.89999 7.27807 8.89999 6.50487C8.89999 5.73167 8.27319 5.10487 7.49999 5.10487Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})})}function H(r){let o=0;for(let t=0;t<r.length;t+=1){const a=r.charCodeAt(t);o=(o<<5)-o+a,o|=0}return o}const J=["blue","cyan","grape","green","indigo","lime","orange","pink","red","teal","violet"];function K(r,o=J){const t=H(r),a=Math.abs(t)%o.length;return o[a]}function O(r,o=2){const t=r.split(" ");return t.length===1?r.slice(0,o).toUpperCase():t.map(a=>a[0]).slice(0,o).join("").toUpperCase()}const Q={},W=b((r,{size:o,radius:t,variant:a,gradient:l,color:c,autoContrast:p,name:i,allowedInitialsColors:d})=>{const s=c==="initials"&&typeof i=="string"?K(i,d):c,e=r.variantColorResolver({color:s||"gray",theme:r,gradient:l,variant:a||"light",autoContrast:p});return{root:{"--avatar-size":$(o,"avatar-size"),"--avatar-radius":t===void 0?void 0:U(t),"--avatar-bg":s||a?e.background:void 0,"--avatar-color":s||a?e.color:void 0,"--avatar-bd":s||a?e.border:void 0}}}),f=B((r,o)=>{const t=j("Avatar",Q,r),{classNames:a,className:l,style:c,styles:p,unstyled:i,vars:d,src:s,alt:e,radius:m,color:X,gradient:Y,imageProps:u,children:S,autoContrast:rr,mod:_,name:x,allowedInitialsColors:or,...E}=t,M=L(),[N,y]=v.useState(!s),g=w({name:"Avatar",props:t,classes:C,className:l,style:c,classNames:a,styles:p,unstyled:i,vars:d,varsResolver:W});return v.useEffect(()=>y(!s),[s]),n.jsx(G,{...g("root"),mod:[{"within-group":M.withinGroup},_],ref:o,...E,children:N||!s?n.jsx("span",{...g("placeholder"),title:e,children:S||typeof x=="string"&&O(x)||n.jsx(D,{})}):n.jsx("img",{...u,...g("image"),src:s,alt:e,onError:P=>{var A;y(!0),(A=u==null?void 0:u.onError)==null||A.call(u,P)}})})});f.classes=C;f.displayName="@mantine/core/Avatar";f.Group=h;export{f as A,q as a,er as g};
