import{r as g,Z as d,O as l}from"./index-BuFgUdF6.js";function p(e){const n=parseInt(e.slice(1,3),16)/255,t=parseInt(e.slice(3,5),16)/255,r=parseInt(e.slice(5,7),16)/255,o=Math.max(n,t,r),i=Math.min(n,t,r),a=(o+i)/2;if(o===i)return[0,0,a];const s=o-i,u=a>.5?s/(2-o-i):s/(o+i);let c=0;return o===n?c=((t-r)/s+(t<r?6:0))/6:o===t?c=((r-n)/s+2)/6:c=((n-t)/s+4)/6,[c,u,a]}function E(e,n,t){if(n===0)return`#${Math.round(t*255).toString(16).padStart(2,"0").repeat(3)}`;const r=(s,u,c)=>(c<0&&(c+=1),c>1&&(c-=1),c<1/6?s+(u-s)*6*c:c<1/2?u:c<2/3?s+(u-s)*(2/3-c)*6:s),o=t<.5?t*(1+n):t+n-t*n,i=2*t-o,a=s=>Math.round(s*255).toString(16).padStart(2,"0");return`#${a(r(i,o,e+1/3))}${a(r(i,o,e))}${a(r(i,o,e-1/3))}`}function S(e,n,t){let r=n[0]-e[0];return r>.5&&(r-=1),r<-.5&&(r+=1),[(e[0]+r*t+1)%1,e[1]+(n[1]-e[1])*t,e[2]+(n[2]-e[2])*t]}const x=[l.red,l.orange,l.amber,l.green,l.teal,l.cyan,l.blue,l.indigo,l.purple,l.pink],m=4,h=[];{const e=x.map(p);for(let n=0;n<e.length;n++){const t=(n+1)%e.length;for(let r=0;r<m;r++){const[o,i,a]=S(e[n],e[t],r/m);h.push(E(o,i,a))}}}function j(e){let n=0;for(let t=0;t<e.length;t++)n=e.charCodeAt(t)+((n<<5)-n);return h[Math.abs(n)%h.length]}const f=new RegExp("(?:\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F)","gu");function N(e){const n=e.trim();if(!n)return 0;const t=n.match(f);return!t||t.length===0||t.length>3||n.replace(f,"").replace(/[\u200D\uFE0F\s]/g,"").length>0?0:t.length}function C(e){const n=e.match(f);if(n&&n.length>0){const t=n[0],r=e.replace(f,"").trim();return{emoji:t,cleanName:r||e}}return{emoji:null,cleanName:e}}function y(e){const{cleanName:n}=C(e),t=n.split(/[\s-_]+/).filter(Boolean);if(t.length>=2){const o=Array.from(t[0])[0]||"",i=Array.from(t[1])[0]||"";return(o+i).toUpperCase()}return Array.from(n).slice(0,2).join("").toUpperCase()}function M(e){return new Date(e*1e3).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1})}function T(e,n){const t=/@\[([^\]]+)\]/g,r=[];let o=0,i;const a=n!=null&&n.isOutgoing?d[200]:l.blue,s=n==null?void 0:n.onMentionClick;for(;(i=t.exec(e))!==null;){i.index>o&&r.push(e.slice(o,i.index));const u=i[1];r.push(g.createElement(s?"button":"span",{key:i.index,className:s?"font-bold hover:underline underline-offset-2 cursor-pointer":"font-bold",style:{color:a},...s&&{type:"button",onClick:c=>{c.stopPropagation(),s(u)}}},u)),o=i.index+i[0].length}return o<e.length&&r.push(e.slice(o)),r.length>0?r:e}export{y as a,M as b,N as c,C as e,T as f,j as g};
