@grasco/profile-picture 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import Ce,{useRef,useCallback,useEffect}from'react';import {LitElement,nothing,html}from'lit';import {property,state,customElement}from'lit/decorators.js';import {styleMap}from'lit/directives/style-map.js';var De=Object.defineProperty;var Ee=Object.getOwnPropertyDescriptor;var i=(r,o,e,t)=>{for(var n=t>1?void 0:t?Ee(o,e):o,a=r.length-1,p;a>=0;a--)(p=r[a])&&(n=(t?p(o,e,n):p(n))||n);return t&&n&&De(o,e,n),n};var J="grasco-profile-picture-styles",M=false;function Q(){if(M||typeof document>"u")return;if(document.getElementById(J)){M=true;return}if(document.querySelector('link[href*="profile-picture"][href$="styles.css"]')){M=true;return}let o=Re();if(!o)return;let e=document.createElement("link");e.id=J,e.rel="stylesheet",e.href=o,document.head.appendChild(e),M=true;}function Re(){if(typeof window<"u"&&window.__GRASCO_PROFILE_PICTURE_CSS__)return window.__GRASCO_PROFILE_PICTURE_CSS__;try{let o=import.meta.url;if(o)return `${o.substring(0,o.lastIndexOf("/")+1)}styles.css`}catch{}let r=document.currentScript;if(r?.src){let o=new URL(r.src);return `${o.href.substring(0,o.href.lastIndexOf("/")+1)}styles.css`}return null}var R={"2xs":20,xs:24,sm:32,md:40,lg:48,xl:64,"2xl":80,"3xl":120},ee={online:"#30D158",away:"#FFD60A",busy:"#FF453A",offline:"#8E8E93",dnd:"#FF453A"},te={none:"none",sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)",glow:"0 0 20px 0 rgba(99, 102, 241, 0.3)"},v={size:"md",variant:"circle",loading:"lazy",placeholder:"shimmer",borderWidth:2,borderColor:"#ffffff",placeholderColor:"#f3f4f6",shadow:"sm"};var A={circle:"9999px",rounded:"12px",squircle:"30%",square:"0px"},w={max:4,direction:"ltr",overlap:.3,size:"md",tooltipDelay:300,dropdownMaxHeight:280,animated:true};function h(...r){return r.filter(Boolean).join(" ")}function B(r){return /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/.test(r)}function re(r){return {"top-left":"np:top-0 np:left-0","top-right":"np:top-0 np:right-0","bottom-left":"np:bottom-0 np:left-0","bottom-right":"np:bottom-0 np:right-0"}[r]}function oe(r){return {"top-left":"np:-rotate-45 np:-translate-x-1/4 np:-translate-y-1/2","top-right":"np:rotate-45 np:translate-x-1/4 np:-translate-y-1/2","bottom-left":"np:rotate-45 np:-translate-x-1/4 np:translate-y-1/2","bottom-right":"np:-rotate-45 np:translate-x-1/4 np:translate-y-1/2"}[r]}function O(r){let e=r.trim().replace(/[^\w\s]/g,"").split(/\s+/).filter(Boolean);return e.length===0?"?":e.length===1?e[0].slice(0,1).toUpperCase():(e[0][0]+e[e.length-1][0]).toUpperCase()}function Z(r){return Math.round(r*.38)}function ne(r,o){let t=Math.max(o?18:10,Math.round(r*(o?.32:.22))),n=Math.round(t*.6);return {size:t,fontSize:n}}function ie(r,o){return Math.max(8,Math.round(r*.25))+(o-1)*2}function ae(r,o){return typeof r=="string"?r:o&&r>o?`${o}+`:r.toString()}function se(r){return r.length===0?"transparent":r.length===1?r[0]:`conic-gradient(${r.map((e,t)=>{let n=t/r.length*360,a=(t+1)/r.length*360;return `${e} ${n}deg ${a}deg`}).join(", ")})`}function Ae(r){let o=0;for(let e=0;e<r.length;e++){let t=r.charCodeAt(e);o=(o<<5)-o+t,o&=o;}return Math.abs(o)}function F(r){let o=["linear-gradient(135deg, #667eea 0%, #764ba2 100%)","linear-gradient(135deg, #f093fb 0%, #f5576c 100%)","linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)","linear-gradient(135deg, #43e97b 0%, #38f9d7 100%)","linear-gradient(135deg, #fa709a 0%, #fee140 100%)","linear-gradient(135deg, #a8edea 0%, #fed6e3 100%)","linear-gradient(135deg, #d299c2 0%, #fef9d7 100%)","linear-gradient(135deg, #89f7fe 0%, #66a6ff 100%)","linear-gradient(135deg, #cd9cf2 0%, #f6f3ff 100%)","linear-gradient(135deg, #fddb92 0%, #d1fdff 100%)"],e=Ae(r)%o.length;return o[e]}function pe(r){return typeof r=="number"?r:R[r]??R[w.size]}function de(r,o,e){let t=e?o-1:o;if(r<=t)return {visible:r,hidden:0,showCounter:false};let n=t-1,a=r-n;return {visible:n,hidden:a,showCounter:true}}function P(r,o,e,t,n){let a=n??o*(1-e);return r*a}function le(r,o,e){return e==="ltr"?o-r:r+1}function ce(r,o,e,t){if(r===0)return 0;if(r===1)return o;let n=t??o*(1-e);return o+n*(r-1)}function ge(r){return r>99?"+99":`+${r}`}function ue(r){return {circle:"np:rounded-full",rounded:"np:rounded-xl",squircle:"np:rounded-[30%]",square:"np:rounded-none"}[r]}function be(r,o){return {className:{1:"np:border",2:"np:border-2",3:"np:border-[3px]",4:"np:border-4"}[r],style:{borderColor:o,borderStyle:"solid"}}}function fe(r,o){return o?{className:"",style:{background:o}}:r?r.includes("gradient")?{className:"",style:{background:r}}:{className:"",style:{backgroundColor:r}}:{className:"np:bg-gray-100"}}function he(r){return {boxShadow:te[r]}}var Te={shimmer:`
1
+ import zt,{useRef,useCallback,useEffect}from'react';import {LitElement,nothing,html}from'lit';import {property,state,customElement}from'lit/decorators.js';import {styleMap}from'lit/directives/style-map.js';var Rt=Object.defineProperty;var Tt=Object.getOwnPropertyDescriptor;var s=(r,n,t,e)=>{for(var o=e>1?void 0:e?Tt(n,t):n,a=r.length-1,p;a>=0;a--)(p=r[a])&&(o=(e?p(n,t,o):p(o))||o);return e&&o&&Rt(n,t,o),o};var rt="grasco-profile-picture-styles",M=false;function nt(){if(M||typeof document>"u")return;if(document.getElementById(rt)){M=true;return}if(document.querySelector('link[href*="profile-picture"][href$="styles.css"]')){M=true;return}let n=Ut();if(!n)return;let t=document.createElement("link");t.id=rt,t.rel="stylesheet",t.href=n,document.head.appendChild(t),M=true;}function Ut(){if(typeof window<"u"&&window.__GRASCO_PROFILE_PICTURE_CSS__)return window.__GRASCO_PROFILE_PICTURE_CSS__;try{let n=import.meta.url;if(n)return `${n.substring(0,n.lastIndexOf("/")+1)}dist/styles.css`}catch{}let r=document.currentScript;if(r?.src){let n=new URL(r.src);return `${n.href.substring(0,n.href.lastIndexOf("/")+1)}dist/styles.css`}return null}var D={"2xs":20,xs:24,sm:32,md:40,lg:48,xl:64,"2xl":80,"3xl":120},ot={online:"#30D158",away:"#FFD60A",busy:"#FF453A",offline:"#8E8E93",dnd:"#FF453A"},it={none:"none",sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)",glow:"0 0 20px 0 rgba(99, 102, 241, 0.3)"},C={size:"md",variant:"circle",loading:"lazy",placeholder:"shimmer",borderWidth:2,borderColor:"#ffffff",placeholderColor:"#f3f4f6",shadow:"sm"};var R={circle:"9999px",rounded:"12px",squircle:"30%",square:"0px"},S={max:4,direction:"ltr",overlap:.3,size:"md",tooltipDelay:300,dropdownMaxHeight:280,animated:true};function x(...r){return r.filter(Boolean).join(" ")}function L(r){return /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/.test(r)}function at(r){return {"top-left":"np:top-0 np:left-0","top-right":"np:top-0 np:right-0","bottom-left":"np:bottom-0 np:left-0","bottom-right":"np:bottom-0 np:right-0"}[r]}function st(r){return {"top-left":"np:-rotate-45 np:-translate-x-1/4 np:-translate-y-1/2","top-right":"np:rotate-45 np:translate-x-1/4 np:-translate-y-1/2","bottom-left":"np:rotate-45 np:-translate-x-1/4 np:translate-y-1/2","bottom-right":"np:-rotate-45 np:translate-x-1/4 np:translate-y-1/2"}[r]}function O(r){let t=r.trim().replace(/[^\w\s]/g,"").split(/\s+/).filter(Boolean);return t.length===0?"?":t.length===1?t[0].slice(0,1).toUpperCase():(t[0][0]+t[t.length-1][0]).toUpperCase()}function X(r){return Math.round(r*.38)}function pt(r,n){let e=Math.max(n?18:10,Math.round(r*(n?.32:.22))),o=Math.round(e*.6);return {size:e,fontSize:o}}function dt(r,n){return Math.max(8,Math.round(r*.25))+(n-1)*2}function lt(r,n){return typeof r=="string"?r:n&&r>n?`${n}+`:r.toString()}function ct(r){return r.length===0?"transparent":r.length===1?r[0]:`conic-gradient(${r.map((t,e)=>{let o=e/r.length*360,a=(e+1)/r.length*360;return `${t} ${o}deg ${a}deg`}).join(", ")})`}function Lt(r){let n=0;for(let t=0;t<r.length;t++){let e=r.charCodeAt(t);n=(n<<5)-n+e,n&=n;}return Math.abs(n)}function gt(r,n,t){let o=Math.max(0,Math.min(100,r))/100*360;return `conic-gradient(from 270deg, ${n} 0deg ${o}deg, ${t} ${o}deg 360deg)`}function F(r){let n=["linear-gradient(135deg, #667eea 0%, #764ba2 100%)","linear-gradient(135deg, #f093fb 0%, #f5576c 100%)","linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)","linear-gradient(135deg, #43e97b 0%, #38f9d7 100%)","linear-gradient(135deg, #fa709a 0%, #fee140 100%)","linear-gradient(135deg, #a8edea 0%, #fed6e3 100%)","linear-gradient(135deg, #d299c2 0%, #fef9d7 100%)","linear-gradient(135deg, #89f7fe 0%, #66a6ff 100%)","linear-gradient(135deg, #cd9cf2 0%, #f6f3ff 100%)","linear-gradient(135deg, #fddb92 0%, #d1fdff 100%)"],t=Lt(r)%n.length;return n[t]}function ut(r){return typeof r=="number"?r:D[r]??D[S.size]}function bt(r,n,t){let e=t?n-1:n;if(r<=e)return {visible:r,hidden:0,showCounter:false};let o=e-1,a=r-o;return {visible:o,hidden:a,showCounter:true}}function N(r,n,t,e,o){let a=o??n*(1-t);return r*a}function ft(r,n,t){return t==="ltr"?n-r:r+1}function ht(r,n,t,e){if(r===0)return 0;if(r===1)return n;let o=e??n*(1-t);return n+o*(r-1)}function mt(r){return r>99?"+99":`+${r}`}function Q(r){return r<=80?"80":r<=120?"120":r<=240?"240":r<=480?"480":"960"}function P(r){if(!(r&&L(r)))return "light";let n=r.replace("#","");n.length===3&&(n=n.split("").map(p=>p+p).join(""));let t=Number.parseInt(n.slice(0,2),16),e=Number.parseInt(n.slice(2,4),16),o=Number.parseInt(n.slice(4,6),16);return (.299*t+.587*e+.114*o)/255>.5?"light":"dark"}function _(r,n,t,e,o){let a=r.endsWith("/")?r.slice(0,-1):r,p=`${n}_${t}_${e}.webp`;return `${a}/api/profile-picture/cdn/${p}?hostname=${o}`}function xt(r){return {circle:"np:rounded-full",rounded:"np:rounded-xl",squircle:"np:rounded-[30%]",square:"np:rounded-none"}[r]}function vt(r,n){return {className:{1:"np:border",2:"np:border-2",3:"np:border-[3px]",4:"np:border-4",5:"np:border-[5px]",6:"np:border-[6px]",8:"np:border-8"}[r],style:{borderColor:n,borderStyle:"solid"}}}function yt(r,n){return n?{className:"",style:{background:n}}:r?r.includes("gradient")?{className:"",style:{background:r}}:{className:"",style:{backgroundColor:r}}:{className:"",style:{backgroundColor:"#e7e7e7"}}}function wt(r){return {boxShadow:it[r]}}var Bt={shimmer:`
2
2
  @keyframes pp-shimmer {
3
3
  0% { transform: translateX(-100%); }
4
4
  100% { transform: translateX(100%); }
@@ -36,8 +36,8 @@ import Ce,{useRef,useCallback,useEffect}from'react';import {LitElement,nothing,h
36
36
  0% { transform: scale(0.8); opacity: 0; }
37
37
  50% { transform: scale(1.05); }
38
38
  100% { transform: scale(1); opacity: 1; }
39
- }`},Ue=Object.values(Te).join(`
40
- `),Le=`
39
+ }`},Gt=Object.values(Bt).join(`
40
+ `),Mt=`
41
41
  /* Profile Picture Component Styles */
42
42
  .pp-container {
43
43
  --pp-transition-duration: 200ms;
@@ -160,7 +160,18 @@ import Ce,{useRef,useCallback,useEffect}from'react';import {LitElement,nothing,h
160
160
  line-height: 1;
161
161
  animation: pp-badge-bounce 0.4s var(--pp-spring-timing);
162
162
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
163
- border: 2px solid white;
163
+ }
164
+
165
+ .pp-badge-with-icon {
166
+ gap: 4px;
167
+ }
168
+
169
+ .pp-badge-icon {
170
+ display: inline-flex;
171
+ align-items: center;
172
+ justify-content: center;
173
+ line-height: 1;
174
+ flex-shrink: 0;
164
175
  }
165
176
 
166
177
  .pp-badge-pulse {
@@ -201,12 +212,18 @@ import Ce,{useRef,useCallback,useEffect}from'react';import {LitElement,nothing,h
201
212
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
202
213
  -webkit-mask-composite: xor;
203
214
  mask-composite: exclude;
215
+ transition: background 0.3s ease;
204
216
  }
205
217
 
206
218
  .pp-ring-animated {
207
219
  animation: pp-ring-rotate 3s linear infinite;
208
220
  }
209
221
 
222
+ .pp-ring-progress {
223
+ /* Progress rings should not animate rotation */
224
+ animation: none;
225
+ }
226
+
210
227
  /* Presence indicator */
211
228
  .pp-presence {
212
229
  position: absolute;
@@ -242,8 +259,8 @@ import Ce,{useRef,useCallback,useEffect}from'react';import {LitElement,nothing,h
242
259
  transition: none !important;
243
260
  }
244
261
  }
245
- `,me=`${Ue}
246
- ${Le}`,xe=`
262
+ `,Ct=`${Gt}
263
+ ${Mt}`,St=`
247
264
  @keyframes np-shimmer {
248
265
  0% { background-position: -200% 0; }
249
266
  100% { background-position: 200% 0; }
@@ -253,7 +270,7 @@ ${Le}`,xe=`
253
270
  background-size: 200% 100%;
254
271
  animation: np-shimmer 1.5s infinite;
255
272
  }
256
- `;function ve(r,o=.3){if(B(r)){let e=Number.parseInt(r.slice(1,3),16),t=Number.parseInt(r.slice(3,5),16),n=Number.parseInt(r.slice(5,7),16);return `0 0 20px 0 rgba(${e}, ${t}, ${n}, ${o})`}return `0 0 20px 0 ${r}`}var Ie=`
273
+ `;function kt(r,n=.3){if(L(r)){let t=Number.parseInt(r.slice(1,3),16),e=Number.parseInt(r.slice(3,5),16),o=Number.parseInt(r.slice(5,7),16);return `0 0 20px 0 rgba(${t}, ${e}, ${o}, ${n})`}return `0 0 20px 0 ${r}`}var Ot=`
257
274
  @keyframes ppg-tooltip-in {
258
275
  from {
259
276
  opacity: 0;
@@ -284,7 +301,7 @@ ${Le}`,xe=`
284
301
  transform: translateY(-4px) scale(1.08);
285
302
  }
286
303
  }
287
- `,Ge=`
304
+ `,Ft=`
288
305
  /* Profile Picture Group Container */
289
306
  .ppg-container {
290
307
  --ppg-transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
@@ -635,76 +652,77 @@ ${Le}`,xe=`
635
652
  border-color: rgba(255, 255, 255, 0.1);
636
653
  }
637
654
  }
638
- `,we=`${Ie}
639
- ${Ge}`;var s=class extends LitElement{constructor(){super(...arguments);this.src="";this.alt="";this.size=v.size;this.variant=v.variant;this.shadow=v.shadow;this.border=false;this.borderWidth=v.borderWidth;this.borderColor=v.borderColor;this.loading=v.loading;this.placeholder=v.placeholder;this.placeholderColor=v.placeholderColor;this.isLoaded=false;this.hasError=false;this.previousSrc="";}createRenderRoot(){return s.injectStylesOnce(),this}static injectStylesOnce(){if(s.stylesInjected||typeof document>"u")return;let e=document.createElement("style");e.textContent=me,document.head.appendChild(e),s.stylesInjected=true;}get pixelSize(){let e=this.size;return typeof e=="number"?e:R[e]??R[v.size]}willUpdate(e){e.has("src")&&this.src!==this.previousSrc&&(this.isLoaded=false,this.hasError=false,this.previousSrc=this.src);}handleLoad(){this.isLoaded=true,this.dispatchEvent(new CustomEvent("load",{bubbles:true,composed:true}));}handleError(){this.hasError=true,this.isLoaded=true,this.dispatchEvent(new CustomEvent("error",{bubbles:true,composed:true}));}getContainerStyles(){let e=fe(this.bgColor,this.bgGradient),t=this.border?be(this.borderWidth,this.borderColor):null,n=he(this.shadow),a={};if(this.glow){let g=this.glow.color??this.borderColor??"#6366f1";a={"--pp-glow-color":g,boxShadow:ve(g,this.glow.intensity??.3)};}let p=this.interactive?.hoverable||this.interactive?.pressable;return {classes:h("pp-container",ue(this.variant),e.className,t?.className,p&&"pp-interactive",this.glow?.animate&&"pp-glow"),styles:{width:`${this.pixelSize}px`,height:`${this.pixelSize}px`,borderRadius:A[this.variant],...e.style,...t?.style,...n,...a,cursor:this.interactive?.cursor??(p?"pointer":"default")}}}renderPlaceholder(){if(this.isLoaded||this.placeholder==="none")return nothing;let e={shimmer:"pp-shimmer",pulse:"pp-pulse",skeleton:"pp-skeleton",blur:"",none:""}[this.placeholder];return html`
640
- ${this.placeholder==="shimmer"?html`<style>${xe}</style>`:nothing}
655
+ `,$t=`${Ot}
656
+ ${Ft}`;var i=class extends LitElement{constructor(){super(...arguments);this.src="";this.alt="";this.size=C.size;this.variant=C.variant;this.shadow=C.shadow;this.border=false;this.borderWidth=C.borderWidth;this.borderColor=C.borderColor;this.rotation=0;this.loading=C.loading;this.placeholder=C.placeholder;this.placeholderColor=C.placeholderColor;this.isLoaded=false;this.hasError=false;this.cdnLoadFailed=false;this.previousSrc="";this.RETRY_DELAY_MS=3e4;}static setCdnBaseUrl(t){i.cdnBaseUrl=t,i.instances.forEach(e=>{e.extCustomerId&&!e.cdnImageUrl&&(e.cdnLoadFailed=false,e.retryTimeoutId&&(clearTimeout(e.retryTimeoutId),e.retryTimeoutId=void 0),e.previousExtCustomerId||(e.previousExtCustomerId=e.extCustomerId),e.loadCdnImage());});}static getCdnBaseUrl(){return i.cdnBaseUrl}createRenderRoot(){return i.injectStylesOnce(),this}static injectStylesOnce(){if(i.stylesInjected||typeof document>"u")return;let t=document.createElement("style");t.textContent=Ct,document.head.appendChild(t),i.stylesInjected=true;}get pixelSize(){let t=this.size;return typeof t=="number"?t:D[t]??D[C.size]}connectedCallback(){super.connectedCallback(),i.instances.add(this);}disconnectedCallback(){super.disconnectedCallback(),i.instances.delete(this),this.retryTimeoutId&&(clearTimeout(this.retryTimeoutId),this.retryTimeoutId=void 0);}firstUpdated(){this.extCustomerId&&i.cdnBaseUrl&&(this.previousExtCustomerId=this.extCustomerId,this.loadCdnImage());}updated(t){super.updated(t),this.extCustomerId&&i.cdnBaseUrl&&!this.cdnImageUrl&&(this.cdnLoadFailed||!this.previousExtCustomerId)&&(this.previousExtCustomerId||(this.previousExtCustomerId=this.extCustomerId),this.cdnLoadFailed=false,this.loadCdnImage());}willUpdate(t){t.has("src")&&this.src!==this.previousSrc&&(this.isLoaded=false,this.hasError=false,this.previousSrc=this.src),(t.has("extCustomerId")||t.has("size")||t.has("bgColor"))&&this.extCustomerId!==this.previousExtCustomerId&&(this.previousExtCustomerId=this.extCustomerId,this.cdnImageUrl=void 0,this.cdnLoadFailed=false,this.isLoaded=false,this.hasError=false,this.retryTimeoutId&&(clearTimeout(this.retryTimeoutId),this.retryTimeoutId=void 0),this.loadCdnImage());}handleLoad(){this.isLoaded=true,this.dispatchEvent(new CustomEvent("load",{bubbles:true,composed:true}));}handleError(){if(this.cdnImageUrl&&!this.cdnLoadFailed){this.cdnLoadFailed=true,this.cdnImageUrl=void 0,this.dispatchEvent(new CustomEvent("cdn-error",{bubbles:true,composed:true,detail:{error:"Image load failed"}})),this.retryTimeoutId&&clearTimeout(this.retryTimeoutId),this.retryTimeoutId=setTimeout(()=>{this.retryTimeoutId=void 0,this.extCustomerId&&i.cdnBaseUrl&&(this.cdnLoadFailed=false,this.hasError=false,this.isLoaded=false,this.loadCdnImage());},this.RETRY_DELAY_MS);return}this.hasError=true,this.isLoaded=true,this.dispatchEvent(new CustomEvent("error",{bubbles:true,composed:true}));}loadCdnImage(){if(!(this.extCustomerId&&i.cdnBaseUrl)){this.cdnLoadFailed=true;return}let t=Q(this.pixelSize),e=P(this.bgColor),o=typeof window<"u"?window.location.hostname:"localhost";this.cdnImageUrl=_(i.cdnBaseUrl,this.extCustomerId,t,e,o);}getContainerStyles(){let t=yt(this.bgColor,this.bgGradient),e=this.border?vt(this.borderWidth,this.borderColor):null,o=wt(this.shadow),a={};if(this.glow){let l=this.glow.color??this.borderColor??"#6366f1";a={"--pp-glow-color":l,boxShadow:kt(l,this.glow.intensity??.3)};}let p=this.interactive?.hoverable||this.interactive?.pressable;return {classes:x("pp-container",xt(this.variant),t.className,e?.className,p&&"pp-interactive",this.glow?.animate&&"pp-glow"),styles:{width:`${this.pixelSize}px`,height:`${this.pixelSize}px`,borderRadius:R[this.variant],...t.style,...e?.style,...o,...a,cursor:this.interactive?.cursor??(p?"pointer":"default"),transform:this.rotation?`rotate(${this.rotation}deg)`:void 0}}}renderPlaceholder(){if(this.isLoaded||this.placeholder==="none")return nothing;let t={shimmer:"pp-shimmer",pulse:"pp-pulse",skeleton:"pp-skeleton",blur:"",none:""}[this.placeholder];return html`
657
+ ${this.placeholder==="shimmer"?html`<style>${St}</style>`:nothing}
641
658
  <div
642
- class=${h("np:absolute np:inset-0",e)}
659
+ class=${x("np:absolute np:inset-0",t)}
643
660
  style=${styleMap({backgroundColor:this.placeholderColor,borderRadius:"inherit"})}>
644
661
  </div>
645
662
  `}renderFallback(){if(this.fallback)return html`
646
663
  <span
647
664
  class="pp-fallback"
648
- style=${styleMap({fontSize:`${Z(this.pixelSize)}px`})}>
665
+ style=${styleMap({fontSize:`${X(this.pixelSize)}px`})}>
649
666
  ${this.fallback}
650
667
  </span>
651
- `;if(this.alt){let t=F(this.alt);return html`
668
+ `;if(this.alt){let e=F(this.alt);return html`
652
669
  <div
653
670
  class="pp-fallback np:absolute np:inset-0"
654
- style=${styleMap({background:this.bgColor??t,fontSize:`${Z(this.pixelSize)}px`})}>
671
+ style=${styleMap({background:this.bgColor??e,fontSize:`${X(this.pixelSize)}px`})}>
655
672
  ${O(this.alt)}
656
673
  </div>
657
- `}let e=this.pixelSize*.5;return html`
674
+ `}let t=this.pixelSize*.5;return html`
658
675
  <svg
659
676
  class="pp-fallback-icon"
660
- style="width: ${e}px; height: ${e}px;"
677
+ style="width: ${t}px; height: ${t}px;"
661
678
  fill="currentColor"
662
679
  viewBox="0 0 24 24">
663
680
  <path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z" />
664
681
  </svg>
665
- `}renderImage(){return this.hasError||!this.src?this.renderFallback():html`
682
+ `}renderImage(){let t=!!(this.extCustomerId&&i.cdnBaseUrl),e;return this.cdnImageUrl?e=this.cdnImageUrl:(!t||this.cdnLoadFailed)&&(e=this.src),this.hasError||!e?this.renderFallback():html`
666
683
  <img
667
- src=${this.src}
684
+ src=${e}
668
685
  alt=${this.alt}
669
686
  loading=${this.loading}
670
687
  decoding="async"
671
688
  @load=${this.handleLoad}
672
689
  @error=${this.handleError}
673
- class=${h("pp-image",this.isLoaded?"pp-image-loaded":"pp-image-loading")}
690
+ class=${x("pp-image",this.isLoaded?"pp-image-loaded":"pp-image-loading")}
674
691
  draggable="false" />
675
- `}renderRing(){if(!this.ring?.show)return nothing;let e=this.ring.width??3,t=this.ring.gap??3,n=e+t,a;return this.ring.gradient&&this.ring.gradient.length>0?a=se(this.ring.gradient):a=this.ring.color??"linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888)",html`
692
+ `}renderRing(){if(!this.ring?.show)return nothing;let t=this.ring.width??3,e=this.ring.gap??3,o=t+e,a,p=this.ring.progress!==void 0;if(p){let l=this.ring.progress??0,u=this.ring.color??"#30D158",b=this.ring.emptyColor??"#8E8E93";a=gt(l,u,b);}else this.ring.gradient&&this.ring.gradient.length>0?a=ct(this.ring.gradient):a=this.ring.color??"linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888)";return html`
676
693
  <div
677
- class=${h("pp-ring",this.ring.animate&&"pp-ring-animated")}
678
- style=${styleMap({inset:`-${n}px`,padding:`${e}px`,background:a,borderRadius:A[this.variant]})}>
694
+ class=${x("pp-ring",this.ring.animate&&!p&&"pp-ring-animated",p&&"pp-ring-progress")}
695
+ style=${styleMap({inset:`-${o}px`,padding:`${t}px`,background:a,borderRadius:R[this.variant]})}>
679
696
  </div>
680
- `}renderPresence(){if(!this.presence)return nothing;let e=this.presence.thickness??2,t=ie(this.pixelSize,e),n=ee[this.presence.status],a=Math.max(0,this.pixelSize*.02);return html`
697
+ `}renderPresence(){if(!this.presence)return nothing;let t=this.presence.thickness??2,e=dt(this.pixelSize,t),o=ot[this.presence.status],a=Math.max(0,this.pixelSize*.02);return html`
681
698
  <div
682
- class=${h("pp-presence",this.presence.animate&&"pp-presence-animated")}
683
- style=${styleMap({width:`${t}px`,height:`${t}px`,backgroundColor:n,bottom:`${a}px`,right:`${a}px`,color:n})}
699
+ class=${x("pp-presence",this.presence.animate&&"pp-presence-animated")}
700
+ style=${styleMap({width:`${e}px`,height:`${e}px`,backgroundColor:o,bottom:`${a}px`,right:`${a}px`,color:o})}
684
701
  title=${this.presence.status}>
685
702
  </div>
686
- `}renderBadge(){if(!this.badge)return nothing;let e=this.badge.position??"bottom-right",t=this.badge.content!==void 0,{size:n,fontSize:a}=ne(this.pixelSize,t),p=this.badge.bgColor??"#22c55e",g=this.badge.color??"#ffffff",f=t&&this.badge.content!==void 0?ae(this.badge.content,this.badge.max):null,u={"top-left":{top:"-4px",left:"-4px"},"top-right":{top:"-4px",right:"-4px"},"bottom-left":{bottom:"-4px",left:"-4px"},"bottom-right":{bottom:"-4px",right:"-4px"}};return html`
703
+ `}renderBadge(){if(!this.badge)return nothing;let t=this.badge.position??"bottom-right",e=this.badge.content!==void 0,o=this.badge.icon!==void 0,a=e||o,{size:p,fontSize:l}=pt(this.pixelSize,a),u=this.badge.bgColor??"#22c55e",b=this.badge.color??"#ffffff",h=e&&this.badge.content!==void 0?lt(this.badge.content,this.badge.max):null,k=o?this.badge.icon:null,$=l*.9,E={"top-left":{top:"-4px",left:"-4px"},"top-right":{top:"-4px",right:"-4px"},"bottom-left":{bottom:"-4px",left:"-4px"},"bottom-right":{bottom:"-4px",right:"-4px"}};return html`
687
704
  <div
688
- class=${h("pp-badge",this.badge.pulse&&"pp-badge-pulse",this.badge.glow&&"pp-badge-glow")}
689
- style=${styleMap({width:t?"auto":`${n}px`,minWidth:`${n}px`,height:`${n}px`,padding:t?"0 6px":"0",fontSize:`${a}px`,backgroundColor:p,color:g,"--pp-badge-glow-color":p,...u[e]})}>
690
- ${f??nothing}
705
+ class=${x("pp-badge",this.badge.pulse&&"pp-badge-pulse",this.badge.glow&&"pp-badge-glow",o&&"pp-badge-with-icon")}
706
+ style=${styleMap({width:a?"auto":`${p}px`,minWidth:`${p}px`,height:`${p}px`,padding:a?"0 6px":"0",fontSize:`${l}px`,backgroundColor:u,color:b,"--pp-badge-glow-color":u,gap:o&&e?"4px":"0",...E[t]})}>
707
+ ${k?html`<span class="pp-badge-icon" style=${styleMap({fontSize:`${$}px`})}>${k}</span>`:nothing}
708
+ ${h??nothing}
691
709
  </div>
692
- `}renderRibbon(){if(!this.ribbon)return nothing;let e=this.ribbon.position??"top-right",t=this.ribbon.bgColor??"#ef4444",n=this.ribbon.color??"#ffffff",a=B(t)?{backgroundColor:t}:{background:t},p={color:n},g=this.pixelSize*.9,f=this.pixelSize*.4,u=Math.max(8,this.pixelSize*.11);return html`
710
+ `}renderRibbon(){if(!this.ribbon)return nothing;let t=this.ribbon.position??"top-right",e=this.ribbon.bgColor??"#ef4444",o=this.ribbon.color??"#ffffff",a=L(e)?{backgroundColor:e}:{background:e},p={color:o},l=this.pixelSize*.9,u=this.pixelSize*.4,b=Math.max(8,this.pixelSize*.11);return html`
693
711
  <div
694
- class=${h("pp-ribbon-container",re(e))}
695
- style=${styleMap({width:`${g}px`,height:`${f}px`})}>
712
+ class=${x("pp-ribbon-container",at(t))}
713
+ style=${styleMap({width:`${l}px`,height:`${u}px`})}>
696
714
  <div
697
- class=${h("pp-ribbon np:origin-center np:transform",oe(e))}
698
- style=${styleMap({fontSize:`${u}px`,padding:`${u*.3}px 0`,...a,...p})}>
715
+ class=${x("pp-ribbon np:origin-center np:transform",st(t))}
716
+ style=${styleMap({fontSize:`${b}px`,padding:`${b*.3}px 0`,...a,...p})}>
699
717
  ${this.ribbon.icon?html`<span style="margin-right: 2px">${this.ribbon.icon}</span>`:nothing}
700
718
  ${this.ribbon.text}
701
719
  </div>
702
720
  </div>
703
- `}render(){let e=this.getContainerStyles(),t=this.interactive?.focusable||this.interactive?.pressable?0:void 0;return html`
721
+ `}render(){let t=this.getContainerStyles(),e=this.interactive?.focusable||this.interactive?.pressable?0:void 0;return html`
704
722
  <div
705
- class=${e.classes}
706
- style=${styleMap(e.styles)}
707
- tabindex=${t??nothing}
723
+ class=${t.classes}
724
+ style=${styleMap(t.styles)}
725
+ tabindex=${e??nothing}
708
726
  role=${this.interactive?.pressable?"button":nothing}
709
727
  aria-label=${this.alt||nothing}
710
728
  data-profile-picture>
@@ -715,7 +733,7 @@ ${Ge}`;var s=class extends LitElement{constructor(){super(...arguments);this.src
715
733
  <!-- Inner container for image clipping -->
716
734
  <div
717
735
  class="pp-inner"
718
- style=${styleMap({borderRadius:A[this.variant]})}>
736
+ style=${styleMap({borderRadius:R[this.variant]})}>
719
737
  <!-- Placeholder -->
720
738
  ${this.renderPlaceholder()}
721
739
 
@@ -732,57 +750,58 @@ ${Ge}`;var s=class extends LitElement{constructor(){super(...arguments);this.src
732
750
  <!-- Presence Indicator -->
733
751
  ${this.renderPresence()}
734
752
  </div>
735
- `}};s.stylesInjected=false,i([property({type:String})],s.prototype,"src",2),i([property({type:String})],s.prototype,"alt",2),i([property({type:String})],s.prototype,"size",2),i([property({type:String})],s.prototype,"variant",2),i([property({type:String})],s.prototype,"shadow",2),i([property({type:Boolean})],s.prototype,"border",2),i([property({type:Number,attribute:"border-width"})],s.prototype,"borderWidth",2),i([property({type:String,attribute:"border-color"})],s.prototype,"borderColor",2),i([property({type:String,attribute:"bg-color"})],s.prototype,"bgColor",2),i([property({type:String,attribute:"bg-gradient"})],s.prototype,"bgGradient",2),i([property({type:Object,attribute:false})],s.prototype,"ring",2),i([property({type:Object,attribute:false})],s.prototype,"presence",2),i([property({type:Object,attribute:false})],s.prototype,"glow",2),i([property({type:Object,attribute:false})],s.prototype,"ribbon",2),i([property({type:Object,attribute:false})],s.prototype,"badge",2),i([property({type:String})],s.prototype,"loading",2),i([property({type:String})],s.prototype,"placeholder",2),i([property({type:String,attribute:"placeholder-color"})],s.prototype,"placeholderColor",2),i([property({type:String})],s.prototype,"fallback",2),i([property({type:Object,attribute:false})],s.prototype,"interactive",2),i([state()],s.prototype,"isLoaded",2),i([state()],s.prototype,"hasError",2),s=i([customElement("profile-picture")],s);var Se=false;function Pe(){if(Se||typeof document>"u")return;let r=document.createElement("style");r.textContent=we,document.head.appendChild(r),Se=true;}var c=class extends LitElement{constructor(){super(...arguments);this.max=w.max;this.direction=w.direction;this.overlap=w.overlap;this.size=w.size;this.showAddButton=false;this.addButtonLabel="Add user";this.animated=w.animated;this.users=[];this.dropdownOpen=false;this.tooltipData=null;this.tooltipTimeout=null;this.slotObserver=null;this.handleBackdropClick=()=>{this.dropdownOpen=false;};}createRenderRoot(){return Pe(),this}get pixelSize(){return pe(this.size)}get tooltipEnabled(){return this.tooltip?.enabled!==false}get tooltipPosition(){return this.tooltip?.position??"top"}get tooltipDelay(){return this.tooltip?.delay??w.tooltipDelay}get dropdownMaxHeight(){return this.dropdown?.maxHeight??w.dropdownMaxHeight}get showPresence(){return this.dropdown?.showPresence!==false}get dropdownPosition(){return this.dropdown?.position??"bottom"}connectedCallback(){super.connectedCallback(),this.updateUsers(),this.setupSlotObserver();}disconnectedCallback(){super.disconnectedCallback(),this.slotObserver?.disconnect(),this.clearTooltipTimeout();}setupSlotObserver(){this.slotObserver=new MutationObserver(()=>{this.updateUsers();}),this.slotObserver.observe(this,{childList:true,subtree:true,attributes:true,attributeFilter:["src","alt","data-user-id","data-status","variant","shadow","border","border-width","border-color","bg-color","bg-gradient"]});}updateUsers(){let e=Array.from(this.children).filter(t=>t.tagName.toLowerCase()==="profile-picture"&&t.getAttribute("slot")!=="internal");this.users=e.map((t,n)=>{let a=t.getAttribute("border-width"),p=a?Number.parseInt(a,10):void 0;return {id:t.getAttribute("data-user-id")??void 0,name:t.getAttribute("alt")??`User ${n+1}`,src:t.getAttribute("src")??void 0,status:t.getAttribute("data-status")??void 0,element:t,index:n,variant:t.getAttribute("variant")??void 0,shadow:t.getAttribute("shadow")??void 0,border:t.hasAttribute("border"),borderWidth:p,borderColor:t.getAttribute("border-color")??void 0,bgColor:t.getAttribute("bg-color")??void 0,bgGradient:t.getAttribute("bg-gradient")??void 0}});for(let t of this.users)t.element&&(t.element.style.display="none");}handleAvatarClick(e){this.dispatchEvent(new CustomEvent("avatar-click",{detail:{user:e},bubbles:true,composed:true}));}handleAvatarHover(e,t){if(!this.tooltipEnabled)return;this.clearTooltipTimeout();let n=t.currentTarget;this.tooltipTimeout=window.setTimeout(()=>{this.tooltipData={user:e,rect:n.getBoundingClientRect()};},this.tooltipDelay),this.dispatchEvent(new CustomEvent("avatar-hover",{detail:{user:e},bubbles:true,composed:true}));}handleAvatarLeave(){this.clearTooltipTimeout(),this.tooltipData=null;}clearTooltipTimeout(){this.tooltipTimeout&&(window.clearTimeout(this.tooltipTimeout),this.tooltipTimeout=null);}handleCounterClick(e){this.dropdownOpen=!this.dropdownOpen,this.dispatchEvent(new CustomEvent("counter-click",{detail:{hiddenUsers:e,open:this.dropdownOpen},bubbles:true,composed:true}));}handleDropdownItemClick(e){this.dropdownOpen=false,this.dispatchEvent(new CustomEvent("dropdown-item-click",{detail:{user:e},bubbles:true,composed:true}));}handleAddClick(){this.dispatchEvent(new CustomEvent("add-click",{bubbles:true,composed:true}));}handleKeyDown(e,t){(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),t());}renderAvatar(e,t,n){let a=P(t,this.pixelSize,this.overlap,this.direction,this.spacing),p=le(t,n,this.direction),g=e.variant??"circle",f=e.shadow??"none";return html`
753
+ `}};i.stylesInjected=false,i.cdnBaseUrl="",i.instances=new Set,s([property({type:String})],i.prototype,"src",2),s([property({type:String})],i.prototype,"alt",2),s([property({type:String,attribute:"ext-customer-id"})],i.prototype,"extCustomerId",2),s([property({type:String})],i.prototype,"size",2),s([property({type:String})],i.prototype,"variant",2),s([property({type:String})],i.prototype,"shadow",2),s([property({type:Boolean})],i.prototype,"border",2),s([property({type:Number,attribute:"border-width"})],i.prototype,"borderWidth",2),s([property({type:String,attribute:"border-color"})],i.prototype,"borderColor",2),s([property({type:Number})],i.prototype,"rotation",2),s([property({type:String,attribute:"bg-color"})],i.prototype,"bgColor",2),s([property({type:String,attribute:"bg-gradient"})],i.prototype,"bgGradient",2),s([property({type:Object,attribute:"ring",converter:{fromAttribute:t=>{if(t)try{return JSON.parse(t)}catch{return}},toAttribute:t=>t?JSON.stringify(t):null}})],i.prototype,"ring",2),s([property({type:Object,attribute:"presence",converter:{fromAttribute:t=>{if(t)try{return JSON.parse(t)}catch{return}},toAttribute:t=>t?JSON.stringify(t):null}})],i.prototype,"presence",2),s([property({type:Object,attribute:"glow",converter:{fromAttribute:t=>{if(t)try{return JSON.parse(t)}catch{return}},toAttribute:t=>t?JSON.stringify(t):null}})],i.prototype,"glow",2),s([property({type:Object,attribute:"ribbon",converter:{fromAttribute:t=>{if(t)try{return JSON.parse(t)}catch{return}},toAttribute:t=>t?JSON.stringify(t):null}})],i.prototype,"ribbon",2),s([property({type:Object,attribute:"badge",converter:{fromAttribute:t=>{if(t)try{return JSON.parse(t)}catch{return}},toAttribute:t=>t?JSON.stringify(t):null}})],i.prototype,"badge",2),s([property({type:String})],i.prototype,"loading",2),s([property({type:String})],i.prototype,"placeholder",2),s([property({type:String,attribute:"placeholder-color"})],i.prototype,"placeholderColor",2),s([property({type:String})],i.prototype,"fallback",2),s([property({type:Object,attribute:"interactive",converter:{fromAttribute:t=>{if(t)try{return JSON.parse(t)}catch{return}},toAttribute:t=>t?JSON.stringify(t):null}})],i.prototype,"interactive",2),s([state()],i.prototype,"isLoaded",2),s([state()],i.prototype,"hasError",2),s([state()],i.prototype,"cdnImageUrl",2),s([state()],i.prototype,"cdnLoadFailed",2),i=s([customElement("profile-picture")],i);var It=false;function Wt(){if(It||typeof document>"u")return;let r=document.createElement("style");r.textContent=$t,document.head.appendChild(r),It=true;}var g=class extends LitElement{constructor(){super(...arguments);this.max=S.max;this.direction=S.direction;this.overlap=S.overlap;this.size=S.size;this.showAddButton=false;this.addButtonLabel="Add user";this.animated=S.animated;this.rotationAmount=0;this.users=[];this.dropdownOpen=false;this.tooltipData=null;this.tooltipTimeout=null;this.slotObserver=null;this.handleBackdropClick=()=>{this.dropdownOpen=false;};}createRenderRoot(){return Wt(),this}get pixelSize(){return ut(this.size)}get tooltipEnabled(){return this.tooltip?.enabled!==false}get tooltipPosition(){return this.tooltip?.position??"top"}get tooltipDelay(){return this.tooltip?.delay??S.tooltipDelay}get dropdownMaxHeight(){return this.dropdown?.maxHeight??S.dropdownMaxHeight}get showPresence(){return this.dropdown?.showPresence!==false}get dropdownPosition(){return this.dropdown?.position??"bottom"}connectedCallback(){super.connectedCallback(),this.updateUsers(),this.setupSlotObserver();}disconnectedCallback(){super.disconnectedCallback(),this.slotObserver?.disconnect(),this.clearTooltipTimeout();}setupSlotObserver(){this.slotObserver=new MutationObserver(()=>{this.updateUsers();}),this.slotObserver.observe(this,{childList:true,subtree:true,attributes:true,attributeFilter:["src","alt","data-user-id","data-status","variant","shadow","border","border-width","border-color","bg-color","bg-gradient"]});}updateUsers(){let t=Array.from(this.children).filter(e=>e.tagName.toLowerCase()==="profile-picture"&&e.getAttribute("slot")!=="internal");this.users=t.map((e,o)=>{let a=e.getAttribute("border-width"),p=a?Number.parseInt(a,10):void 0;return {id:e.getAttribute("data-user-id")??void 0,name:e.getAttribute("alt")??`User ${o+1}`,src:e.getAttribute("src")??void 0,status:e.getAttribute("data-status")??void 0,element:e,index:o,variant:e.getAttribute("variant")??void 0,shadow:e.getAttribute("shadow")??void 0,border:e.hasAttribute("border"),borderWidth:p,borderColor:e.getAttribute("border-color")??void 0,bgColor:e.getAttribute("bg-color")??void 0,bgGradient:e.getAttribute("bg-gradient")??void 0}});for(let e of this.users)e.element&&(e.element.style.display="none");}handleAvatarClick(t){this.dispatchEvent(new CustomEvent("avatar-click",{detail:{user:t},bubbles:true,composed:true}));}handleAvatarHover(t,e){if(!this.tooltipEnabled)return;this.clearTooltipTimeout();let o=e.currentTarget;this.tooltipTimeout=window.setTimeout(()=>{this.tooltipData={user:t,rect:o.getBoundingClientRect()};},this.tooltipDelay),this.dispatchEvent(new CustomEvent("avatar-hover",{detail:{user:t},bubbles:true,composed:true}));}handleAvatarLeave(){this.clearTooltipTimeout(),this.tooltipData=null;}clearTooltipTimeout(){this.tooltipTimeout&&(window.clearTimeout(this.tooltipTimeout),this.tooltipTimeout=null);}handleCounterClick(t){this.dropdownOpen=!this.dropdownOpen,this.dispatchEvent(new CustomEvent("counter-click",{detail:{hiddenUsers:t,open:this.dropdownOpen},bubbles:true,composed:true}));}handleDropdownItemClick(t){this.dropdownOpen=false,this.dispatchEvent(new CustomEvent("dropdown-item-click",{detail:{user:t},bubbles:true,composed:true}));}handleAddClick(){this.dispatchEvent(new CustomEvent("add-click",{bubbles:true,composed:true}));}handleKeyDown(t,e){(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),e());}renderAvatar(t,e,o){let a=N(e,this.pixelSize,this.overlap,this.direction,this.spacing),p=ft(e,o,this.direction),l=t.variant??"circle",u=t.shadow??"none",b=this.rotationAmount?e%2===0?-this.rotationAmount:this.rotationAmount:0;return html`
736
754
  <div
737
755
  class="ppg-avatar-wrapper"
738
756
  style=${styleMap({left:`${a}px`,zIndex:String(p),width:`${this.pixelSize}px`,height:`${this.pixelSize}px`})}
739
757
  tabindex="0"
740
758
  role="button"
741
- aria-label=${e.name}
742
- @click=${()=>this.handleAvatarClick(e)}
743
- @mouseenter=${u=>this.handleAvatarHover(e,u)}
759
+ aria-label=${t.name}
760
+ @click=${()=>this.handleAvatarClick(t)}
761
+ @mouseenter=${h=>this.handleAvatarHover(t,h)}
744
762
  @mouseleave=${this.handleAvatarLeave}
745
- @keydown=${u=>this.handleKeyDown(u,()=>this.handleAvatarClick(e))}
763
+ @keydown=${h=>this.handleKeyDown(h,()=>this.handleAvatarClick(t))}
746
764
  >
747
- ${this.renderProfilePicture(e,g,f)}
765
+ ${this.renderProfilePicture(t,l,u,b)}
748
766
  </div>
749
- `}renderProfilePicture(e,t,n){return html`
767
+ `}renderProfilePicture(t,e,o,a){return html`
750
768
  <profile-picture
751
- .src=${e.src??""}
752
- .alt=${e.name}
769
+ .src=${t.src??""}
770
+ .alt=${t.name}
753
771
  .size=${this.pixelSize}
754
- .variant=${t}
755
- .shadow=${n}
756
- ?border=${e.border}
757
- .borderWidth=${e.border?e.borderWidth??2:2}
758
- .borderColor=${e.border?e.borderColor??"#ffffff":"#ffffff"}
759
- .bgColor=${e.bgGradient?void 0:e.bgColor??"#ffffff"}
760
- .bgGradient=${e.bgGradient??void 0}
761
- data-user-id=${e.id??""}
762
- data-status=${e.status??""}
772
+ .variant=${e}
773
+ .shadow=${o}
774
+ .rotation=${a}
775
+ ?border=${t.border}
776
+ .borderWidth=${t.border?t.borderWidth??2:2}
777
+ .borderColor=${t.border?t.borderColor??"#ffffff":"#ffffff"}
778
+ .bgColor=${t.bgGradient?void 0:t.bgColor??"#ffffff"}
779
+ .bgGradient=${t.bgGradient??void 0}
780
+ data-user-id=${t.id??""}
781
+ data-status=${t.status??""}
763
782
  ></profile-picture>
764
- `}renderCounter(e,t){return html`
783
+ `}renderCounter(t,e){return html`
765
784
  <button
766
785
  class="ppg-counter"
767
- style=${styleMap({left:`${t}px`,width:`${this.pixelSize}px`,height:`${this.pixelSize}px`,zIndex:"1"})}
768
- aria-label=${`${e} more users`}
786
+ style=${styleMap({left:`${e}px`,width:`${this.pixelSize}px`,height:`${this.pixelSize}px`,zIndex:"1"})}
787
+ aria-label=${`${t} more users`}
769
788
  aria-expanded=${this.dropdownOpen}
770
789
  aria-haspopup="true"
771
- @click=${()=>this.handleCounterClick(this.users.slice(-e))}
790
+ @click=${()=>this.handleCounterClick(this.users.slice(-t))}
772
791
  >
773
- ${ge(e)}
792
+ ${mt(t)}
774
793
  </button>
775
- `}renderAddButton(e){let t=Math.round(this.pixelSize*.4);return html`
794
+ `}renderAddButton(t){let e=Math.round(this.pixelSize*.4);return html`
776
795
  <button
777
796
  class="ppg-add-button"
778
- style=${styleMap({left:`${e}px`,width:`${this.pixelSize}px`,height:`${this.pixelSize}px`,zIndex:"1"})}
797
+ style=${styleMap({left:`${t}px`,width:`${this.pixelSize}px`,height:`${this.pixelSize}px`,zIndex:"1"})}
779
798
  aria-label=${this.addButtonLabel}
780
799
  @click=${this.handleAddClick}
781
800
  >
782
801
  <svg
783
802
  class="ppg-add-icon"
784
- width=${t}
785
- height=${t}
803
+ width=${e}
804
+ height=${e}
786
805
  viewBox="0 0 24 24"
787
806
  fill="none"
788
807
  stroke="currentColor"
@@ -794,16 +813,16 @@ ${Ge}`;var s=class extends LitElement{constructor(){super(...arguments);this.src
794
813
  <line x1="5" y1="12" x2="19" y2="12"></line>
795
814
  </svg>
796
815
  </button>
797
- `}renderTooltip(){if(!this.tooltipData)return nothing;let{user:e,rect:t}=this.tooltipData,n=8,a,p;return this.tooltipPosition==="bottom"?(a=t.bottom+n,p=t.left+t.width/2):(a=t.top-n,p=t.left+t.width/2),html`
816
+ `}renderTooltip(){if(!this.tooltipData)return nothing;let{user:t,rect:e}=this.tooltipData,o=8,a,p;return this.tooltipPosition==="bottom"?(a=e.bottom+o,p=e.left+e.width/2):(a=e.top-o,p=e.left+e.width/2),html`
798
817
  <div
799
818
  class="ppg-tooltip"
800
- style=${styleMap({top:this.tooltipPosition==="top"?"auto":`${a}px`,bottom:this.tooltipPosition==="top"?`${window.innerHeight-t.top+n}px`:"auto",left:`${p}px`,transform:"translateX(-50%)"})}
819
+ style=${styleMap({top:this.tooltipPosition==="top"?"auto":`${a}px`,bottom:this.tooltipPosition==="top"?`${window.innerHeight-e.top+o}px`:"auto",left:`${p}px`,transform:"translateX(-50%)"})}
801
820
  data-position=${this.tooltipPosition}
802
821
  role="tooltip"
803
822
  >
804
- ${e.name}
823
+ ${t.name}
805
824
  </div>
806
- `}renderDropdown(e){return this.dropdownOpen?html`
825
+ `}renderDropdown(t){return this.dropdownOpen?html`
807
826
  <div
808
827
  class="ppg-backdrop"
809
828
  @click=${this.handleBackdropClick}
@@ -816,50 +835,50 @@ ${Ge}`;var s=class extends LitElement{constructor(){super(...arguments);this.src
816
835
  aria-label="Hidden users"
817
836
  >
818
837
  <div class="ppg-dropdown-header">
819
- ${e.length} more
838
+ ${t.length} more
820
839
  </div>
821
840
  <div
822
841
  class="ppg-dropdown-list"
823
842
  style=${styleMap({maxHeight:`${this.dropdownMaxHeight}px`})}
824
843
  >
825
- ${e.map(t=>this.renderDropdownItem(t))}
844
+ ${t.map(e=>this.renderDropdownItem(e))}
826
845
  </div>
827
846
  </div>
828
- `:nothing}renderDropdownItem(e){let t=F(e.name);return html`
847
+ `:nothing}renderDropdownItem(t){let e=F(t.name);return html`
829
848
  <div
830
849
  class="ppg-dropdown-item"
831
850
  role="menuitem"
832
851
  tabindex="0"
833
- @click=${()=>this.handleDropdownItemClick(e)}
834
- @keydown=${n=>this.handleKeyDown(n,()=>this.handleDropdownItemClick(e))}
852
+ @click=${()=>this.handleDropdownItemClick(t)}
853
+ @keydown=${o=>this.handleKeyDown(o,()=>this.handleDropdownItemClick(t))}
835
854
  >
836
- ${e.src?html`<img
855
+ ${t.src?html`<img
837
856
  class="ppg-dropdown-avatar"
838
- src=${e.src}
839
- alt=${e.name}
857
+ src=${t.src}
858
+ alt=${t.name}
840
859
  />`:html`<div
841
860
  class="ppg-dropdown-avatar-fallback"
842
- style=${styleMap({background:t})}
861
+ style=${styleMap({background:e})}
843
862
  >
844
- ${O(e.name)}
863
+ ${O(t.name)}
845
864
  </div>`}
846
865
  <div class="ppg-dropdown-info">
847
- <div class="ppg-dropdown-name">${e.name}</div>
848
- ${this.showPresence&&e.status?html`
866
+ <div class="ppg-dropdown-name">${t.name}</div>
867
+ ${this.showPresence&&t.status?html`
849
868
  <div class="ppg-dropdown-status">
850
869
  <span
851
870
  class="ppg-dropdown-presence"
852
- data-status=${e.status}
871
+ data-status=${t.status}
853
872
  ></span>
854
- ${this.formatStatus(e.status)}
873
+ ${this.formatStatus(t.status)}
855
874
  </div>
856
875
  `:nothing}
857
876
  </div>
858
877
  </div>
859
- `}formatStatus(e){return {online:"Online",away:"Away",busy:"Busy",offline:"Offline",dnd:"Do not disturb"}[e]??e}render(){let{visible:e,hidden:t,showCounter:n}=de(this.users.length,this.max,this.showAddButton),a=this.direction==="ltr"?this.users.slice(0,e):this.users.slice(0,e).reverse(),p=this.users.slice(e),g=e;n&&g++,this.showAddButton&&g++;let f=ce(g,this.pixelSize,this.overlap,this.spacing),u=n?P(e,this.pixelSize,this.overlap,this.direction,this.spacing):0,$=P(e+(n?1:0),this.pixelSize,this.overlap,this.direction,this.spacing);return html`
878
+ `}formatStatus(t){return {online:"Online",away:"Away",busy:"Busy",offline:"Offline",dnd:"Do not disturb"}[t]??t}render(){let{visible:t,hidden:e,showCounter:o}=bt(this.users.length,this.max,this.showAddButton),a=this.direction==="ltr"?this.users.slice(0,t):this.users.slice(0,t).reverse(),p=this.users.slice(t),l=t;o&&l++,this.showAddButton&&l++;let u=ht(l,this.pixelSize,this.overlap,this.spacing),b=o?N(t,this.pixelSize,this.overlap,this.direction,this.spacing):0,h=N(t+(o?1:0),this.pixelSize,this.overlap,this.direction,this.spacing);return html`
860
879
  <div
861
- class=${h("ppg-container",this.animated&&"ppg-animated")}
862
- style=${styleMap({width:`${f}px`,height:`${this.pixelSize}px`})}
880
+ class=${x("ppg-container",this.animated&&"ppg-animated")}
881
+ style=${styleMap({width:`${u}px`,height:`${this.pixelSize}px`})}
863
882
  role="group"
864
883
  aria-label="User avatars"
865
884
  >
@@ -867,19 +886,19 @@ ${Ge}`;var s=class extends LitElement{constructor(){super(...arguments);this.src
867
886
  <slot style="display: none;"></slot>
868
887
 
869
888
  <!-- Visible avatars -->
870
- ${a.map((z,D)=>this.renderAvatar(z,D,e))}
889
+ ${a.map((k,$)=>this.renderAvatar(k,$,t))}
871
890
 
872
891
  <!-- Counter -->
873
- ${n?this.renderCounter(t,u):nothing}
892
+ ${o?this.renderCounter(e,b):nothing}
874
893
 
875
894
  <!-- Add button -->
876
- ${this.showAddButton?this.renderAddButton($):nothing}
895
+ ${this.showAddButton?this.renderAddButton(h):nothing}
877
896
 
878
897
  <!-- Tooltip -->
879
898
  ${this.renderTooltip()}
880
899
 
881
900
  <!-- Dropdown -->
882
- ${n?this.renderDropdown(p):nothing}
901
+ ${o?this.renderDropdown(p):nothing}
883
902
  </div>
884
- `}};i([property({type:Number})],c.prototype,"max",2),i([property({type:String})],c.prototype,"direction",2),i([property({type:Number})],c.prototype,"overlap",2),i([property({type:String})],c.prototype,"size",2),i([property({type:Number})],c.prototype,"spacing",2),i([property({type:Object})],c.prototype,"tooltip",2),i([property({type:Object})],c.prototype,"dropdown",2),i([property({type:Boolean,attribute:"show-add-button"})],c.prototype,"showAddButton",2),i([property({type:String,attribute:"add-button-label"})],c.prototype,"addButtonLabel",2),i([property({type:Boolean})],c.prototype,"animated",2),i([state()],c.prototype,"users",2),i([state()],c.prototype,"dropdownOpen",2),i([state()],c.prototype,"tooltipData",2),c=i([customElement("profile-picture-group")],c);var X=Ce.forwardRef(({max:r,direction:o,overlap:e,size:t,spacing:n,tooltip:a,dropdown:p,showAddButton:g,addButtonLabel:f,animated:u,onAvatarClick:$,onAvatarHover:z,onCounterClick:D,onDropdownItemClick:I,onAddClick:G,className:N,style:H,children:j},C)=>{let E=useRef(null),V=useCallback(l=>{$?.(l.detail.user);},[$]),W=useCallback(l=>{z?.(l.detail.user);},[z]),Y=useCallback(l=>{let U=l;D?.(U.detail.hiddenUsers,U.detail.open);},[D]),K=useCallback(l=>{I?.(l.detail.user);},[I]),q=useCallback(()=>{G?.();},[G]);return useEffect(()=>{let l=E.current;if(l)return l.addEventListener("avatar-click",V),l.addEventListener("avatar-hover",W),l.addEventListener("counter-click",Y),l.addEventListener("dropdown-item-click",K),l.addEventListener("add-click",q),()=>{l.removeEventListener("avatar-click",V),l.removeEventListener("avatar-hover",W),l.removeEventListener("counter-click",Y),l.removeEventListener("dropdown-item-click",K),l.removeEventListener("add-click",q);}},[V,W,Y,K,q]),useEffect(()=>{typeof C=="function"?C(E.current):C&&(C.current=E.current);},[C]),Ce.createElement("profile-picture-group",{ref:E,max:r,direction:o,overlap:e,size:t,spacing:n,tooltip:a,dropdown:p,"show-add-button":g||void 0,"add-button-label":f,animated:u,class:N,style:H},j)});X.displayName="ProfilePictureGroup";var ze=Ce.forwardRef(({src:r,alt:o,size:e,variant:t,border:n,borderWidth:a,borderColor:p,bgColor:g,bgGradient:f,ribbon:u,badge:$,loading:z,placeholder:D,placeholderColor:I,fallback:G,onLoad:N,onError:H,className:j,style:C},E)=>Ce.createElement("profile-picture",{ref:E,src:r,alt:o,size:e,variant:t,border:n,"border-width":a,"border-color":p,"bg-color":g,"bg-gradient":f,ribbon:u,badge:$,loading:z,placeholder:D,"placeholder-color":I,fallback:G,onLoad:N,onError:H,className:j,style:C}));ze.displayName="ProfilePicture";Q();export{ze as ProfilePicture,X as ProfilePictureGroup};//# sourceMappingURL=index.js.map
903
+ `}};s([property({type:Number})],g.prototype,"max",2),s([property({type:String})],g.prototype,"direction",2),s([property({type:Number})],g.prototype,"overlap",2),s([property({type:String})],g.prototype,"size",2),s([property({type:Number})],g.prototype,"spacing",2),s([property({type:Object})],g.prototype,"tooltip",2),s([property({type:Object})],g.prototype,"dropdown",2),s([property({type:Boolean,attribute:"show-add-button"})],g.prototype,"showAddButton",2),s([property({type:String,attribute:"add-button-label"})],g.prototype,"addButtonLabel",2),s([property({type:Boolean})],g.prototype,"animated",2),s([property({type:Number,attribute:"rotation-amount"})],g.prototype,"rotationAmount",2),s([state()],g.prototype,"users",2),s([state()],g.prototype,"dropdownOpen",2),s([state()],g.prototype,"tooltipData",2),g=s([customElement("profile-picture-group")],g);var et=zt.forwardRef(({max:r,direction:n,overlap:t,size:e,spacing:o,tooltip:a,dropdown:p,showAddButton:l,addButtonLabel:u,animated:b,onAvatarClick:h,onAvatarHover:k,onCounterClick:$,onDropdownItemClick:E,onAddClick:G,className:H,style:V,children:W},I)=>{let A=useRef(null),Y=useCallback(c=>{h?.(c.detail.user);},[h]),J=useCallback(c=>{k?.(c.detail.user);},[k]),K=useCallback(c=>{let U=c;$?.(U.detail.hiddenUsers,U.detail.open);},[$]),q=useCallback(c=>{E?.(c.detail.user);},[E]),Z=useCallback(()=>{G?.();},[G]);return useEffect(()=>{let c=A.current;if(c)return c.addEventListener("avatar-click",Y),c.addEventListener("avatar-hover",J),c.addEventListener("counter-click",K),c.addEventListener("dropdown-item-click",q),c.addEventListener("add-click",Z),()=>{c.removeEventListener("avatar-click",Y),c.removeEventListener("avatar-hover",J),c.removeEventListener("counter-click",K),c.removeEventListener("dropdown-item-click",q),c.removeEventListener("add-click",Z);}},[Y,J,K,q,Z]),useEffect(()=>{typeof I=="function"?I(A.current):I&&(I.current=A.current);},[I]),zt.createElement("profile-picture-group",{ref:A,max:r,direction:n,overlap:t,size:e,spacing:o,tooltip:a,dropdown:p,"show-add-button":l||void 0,"add-button-label":u,animated:b,class:H,style:V},W)});et.displayName="ProfilePictureGroup";var Dt=zt.forwardRef(({src:r,alt:n,size:t,variant:e,border:o,borderWidth:a,borderColor:p,bgColor:l,bgGradient:u,ribbon:b,badge:h,loading:k,placeholder:$,placeholderColor:E,fallback:G,onLoad:H,onError:V,className:W,style:I},A)=>zt.createElement("profile-picture",{ref:A,src:r,alt:n,size:t,variant:e,border:o,"border-width":a,"border-color":p,"bg-color":l,"bg-gradient":u,ribbon:b,badge:h,loading:k,placeholder:$,"placeholder-color":E,fallback:G,onLoad:H,onError:V,className:W,style:I}));Dt.displayName="ProfilePicture";nt();export{Dt as ProfilePicture,et as ProfilePictureGroup,_ as constructCdnUrl,P as detectThemeFromColor,Q as getCdnSizeLabel};//# sourceMappingURL=index.js.map
885
904
  //# sourceMappingURL=index.js.map