@grasco/profile-picture 0.1.7 → 0.1.8

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/react.cjs ADDED
@@ -0,0 +1,1013 @@
1
+ 'use strict';var Ae=require('react'),lit=require('lit'),decorators_js=require('lit/decorators.js'),styleMap_js=require('lit/directives/style-map.js');var _documentCurrentScript=typeof document!=='undefined'?document.currentScript:null;function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Ae__default=/*#__PURE__*/_interopDefault(Ae);var Be=Object.defineProperty;var Oe=Object.getOwnPropertyDescriptor;var s=(r,n,e,t)=>{for(var o=t>1?void 0:t?Oe(n,e):n,i=r.length-1,p;i>=0;i--)(p=r[i])&&(o=(t?p(n,e,o):p(o))||o);return t&&o&&Be(n,e,o),o};var ee="grasco-profile-picture-styles",F=false,pe=false;function de(){if(F||typeof document>"u")return;if(document.getElementById(ee)){F=true;return}if(document.querySelector('link[href*="profile-picture"][href$="styles.css"]')){F=true;return}pe||(pe=true,Ge());}function Ge(){(typeof requestIdleCallback<"u"?requestIdleCallback:n=>setTimeout(n,1))(()=>Fe());}function Fe(){if(F||typeof document>"u")return;if(document.getElementById(ee)){F=true;return}let r=Ne();if(!r)return;let n=document.createElement("link");n.id=ee,n.rel="stylesheet",n.href=r,document.head.appendChild(n),F=true;}function Ne(){if(typeof window<"u"&&window.__GRASCO_PROFILE_PICTURE_CSS__)return window.__GRASCO_PROFILE_PICTURE_CSS__;try{let n=(typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('react.cjs', document.baseURI).href));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 N={"2xs":20,xs:24,sm:32,md:40,lg:48,xl:64,"2xl":80,"3xl":120},le={online:"#30D158",away:"#FFD60A",busy:"#FF453A",offline:"#8E8E93",dnd:"#FF453A"},ce={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)"},$={size:"md",variant:"circle",loading:"lazy",placeholder:"shimmer",borderWidth:2,borderColor:"#ffffff",placeholderColor:"#f3f4f6",shadow:"sm"};var H={circle:"9999px",rounded:"12px",squircle:"30%",square:"0px"},I={max:4,direction:"ltr",overlap:.3,size:"md",tooltipDelay:300,dropdownMaxHeight:280,animated:true};function A(...r){return r.filter(Boolean).join(" ")}function te(r){return /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/.test(r)}function Y(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.at(-1)?.[0]??"")).toUpperCase()}function re(r){return Math.round(r*.38)}function ue(r,n){let e;if(n){let o=Math.round(r*.31);e=Math.min(24,Math.max(14,o));}else {let o=Math.round(r*.22);e=Math.min(14,Math.max(8,o));}let t=Math.max(9,Math.round(e*.55));return {size:e,fontSize:t}}function ge(r,n){let e=Math.min(16,Math.max(8,Math.round(r*.2)));return Math.min(18,e+(n-1)*2)}function fe(r,n){return typeof r=="string"?r:n&&r>n?`${n}+`:r.toString()}function me(r){return r.length===0?"transparent":r.length===1?r[0]:`conic-gradient(${r.map((e,t)=>{let o=t/r.length*360,i=(t+1)/r.length*360;return `${e} ${o}deg ${i}deg`}).join(", ")})`}function He(r){let n=0;for(let e=0;e<r.length;e++){let t=r.charCodeAt(e);n=(n<<5)-n+t,n&=n;}return Math.abs(n)}function he(r,n,e){let o=Math.max(0,Math.min(100,r))/100*360;return `conic-gradient(from 270deg, ${n} 0deg ${o}deg, ${e} ${o}deg 360deg)`}function K(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%)"],e=He(r)%n.length;return n[e]}function be(r){return typeof r=="number"?r:N[r]??N[I.size]}function ne(r,n,e){let t=e?n-1:n;if(r<=t)return {visible:r,hidden:0,showCounter:false};let o=t-1,i=r-o;return {visible:o,hidden:i,showCounter:true}}function X(r,n,e,t,o){let i=o??n*(1-e);return r*i}function xe(r,n,e){return e==="ltr"?n-r:r+1}function ve(r,n,e,t){if(r===0)return 0;if(r===1)return n;let o=t??n*(1-e);return n+o*(r-1)}function we(r){return r>99?"+99":`+${r}`}function ye(r){return r<=80?"80":r<=120?"120":r<=240?"240":r<=480?"480":"960"}function Ce(r){if(!(r&&te(r)))return "light";let n=r.replace("#","");n.length===3&&(n=n.split("").map(p=>p+p).join(""));let e=Number.parseInt(n.slice(0,2),16),t=Number.parseInt(n.slice(2,4),16),o=Number.parseInt(n.slice(4,6),16);return (.299*e+.587*t+.114*o)/255>.5?"light":"dark"}function Se(r,n,e,t,o){let i=r.endsWith("/")?r.slice(0,-1):r,p=`${n}_${e}_${t}.webp`;return `${i}/api/profile-picture/cdn/${p}?hostname=${o}`}function ke(r){return {circle:"np:rounded-full",rounded:"np:rounded-xl",squircle:"np:rounded-[30%]",square:"np:rounded-none"}[r]}function $e(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 Ie(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 Ee(r){return {boxShadow:ce[r]}}var je={shimmer:`
2
+ @keyframes pp-shimmer {
3
+ 0% { transform: translateX(-100%); }
4
+ 100% { transform: translateX(100%); }
5
+ }`,pulse:`
6
+ @keyframes pp-pulse {
7
+ 0%, 100% { opacity: 1; transform: scale(1); }
8
+ 50% { opacity: 0.7; transform: scale(0.98); }
9
+ }`,skeleton:`
10
+ @keyframes pp-skeleton {
11
+ 0%, 100% { opacity: 1; }
12
+ 50% { opacity: 0.5; }
13
+ }`,badgeBounce:`
14
+ @keyframes pp-badge-bounce {
15
+ 0% { transform: scale(0) translateY(10px); opacity: 0; }
16
+ 50% { transform: scale(1.2) translateY(-2px); }
17
+ 100% { transform: scale(1) translateY(0); opacity: 1; }
18
+ }`,ringRotate:`
19
+ @keyframes pp-ring-rotate {
20
+ from { transform: rotate(0deg); }
21
+ to { transform: rotate(360deg); }
22
+ }`,presencePulse:`
23
+ @keyframes pp-presence-pulse {
24
+ 0%, 100% { box-shadow: 0 0 0 0 currentColor; }
25
+ 50% { box-shadow: 0 0 0 4px transparent; }
26
+ }`,glow:`
27
+ @keyframes pp-glow {
28
+ 0%, 100% { box-shadow: 0 0 20px 0 var(--pp-glow-color, rgba(99, 102, 241, 0.3)); }
29
+ 50% { box-shadow: 0 0 30px 5px var(--pp-glow-color, rgba(99, 102, 241, 0.5)); }
30
+ }`,fadeIn:`
31
+ @keyframes pp-fade-in {
32
+ from { opacity: 0; }
33
+ to { opacity: 1; }
34
+ }`,scaleIn:`
35
+ @keyframes pp-scale-in {
36
+ 0% { transform: scale(0.8); opacity: 0; }
37
+ 50% { transform: scale(1.05); }
38
+ 100% { transform: scale(1); opacity: 1; }
39
+ }`},Ve=Object.values(je).join(`
40
+ `),We=`
41
+ /* Profile Picture Component Styles */
42
+ .pp-container {
43
+ --pp-transition-duration: 200ms;
44
+ --pp-transition-timing: cubic-bezier(0.4, 0, 0.2, 1);
45
+ --pp-spring-timing: cubic-bezier(0.34, 1.56, 0.64, 1);
46
+ position: relative;
47
+ display: inline-flex;
48
+ align-items: center;
49
+ justify-content: center;
50
+ user-select: none;
51
+ -webkit-user-select: none;
52
+ flex-shrink: 0;
53
+ }
54
+
55
+ /* Inner container for image clipping - allows badges/rings to overflow */
56
+ .pp-inner {
57
+ position: absolute;
58
+ inset: 0;
59
+ overflow: hidden;
60
+ border-radius: inherit;
61
+ }
62
+
63
+ /* Interactive states */
64
+ .pp-interactive {
65
+ cursor: pointer;
66
+ transition: transform var(--pp-transition-duration) var(--pp-spring-timing),
67
+ box-shadow var(--pp-transition-duration) var(--pp-transition-timing);
68
+ }
69
+
70
+ .pp-interactive:hover {
71
+ transform: scale(1.05);
72
+ }
73
+
74
+ .pp-interactive:active {
75
+ transform: scale(0.95);
76
+ }
77
+
78
+ .pp-interactive:focus-visible {
79
+ outline: none;
80
+ box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.5);
81
+ }
82
+
83
+ /* Image styles */
84
+ .pp-image {
85
+ position: absolute;
86
+ inset: 0;
87
+ width: 100%;
88
+ height: 100%;
89
+ object-fit: cover;
90
+ transition: opacity var(--pp-transition-duration) var(--pp-transition-timing);
91
+ }
92
+
93
+ .pp-image-loading {
94
+ opacity: 0;
95
+ }
96
+
97
+ .pp-image-loaded {
98
+ opacity: 1;
99
+ }
100
+
101
+ /* Fallback styles */
102
+ .pp-fallback {
103
+ display: flex;
104
+ align-items: center;
105
+ justify-content: center;
106
+ width: 100%;
107
+ height: 100%;
108
+ font-weight: 500;
109
+ color: rgba(255, 255, 255, 0.9);
110
+ text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
111
+ font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
112
+ letter-spacing: 0.02em;
113
+ }
114
+
115
+ .pp-fallback-icon {
116
+ color: rgba(156, 163, 175, 0.8);
117
+ }
118
+
119
+ /* Shimmer placeholder */
120
+ .pp-shimmer {
121
+ position: absolute;
122
+ inset: 0;
123
+ overflow: hidden;
124
+ }
125
+
126
+ .pp-shimmer::after {
127
+ content: '';
128
+ position: absolute;
129
+ inset: 0;
130
+ background: linear-gradient(
131
+ 90deg,
132
+ transparent 0%,
133
+ rgba(255, 255, 255, 0.4) 50%,
134
+ transparent 100%
135
+ );
136
+ animation: pp-shimmer 1.5s infinite;
137
+ }
138
+
139
+ /* Pulse placeholder */
140
+ .pp-pulse {
141
+ animation: pp-pulse 2s ease-in-out infinite;
142
+ }
143
+
144
+ /* Skeleton placeholder */
145
+ .pp-skeleton {
146
+ background: linear-gradient(90deg, #e5e7eb 0%, #f3f4f6 50%, #e5e7eb 100%);
147
+ background-size: 200% 100%;
148
+ animation: pp-skeleton 1.5s ease-in-out infinite;
149
+ }
150
+
151
+ /* Badge styles */
152
+ .pp-badge {
153
+ position: absolute;
154
+ display: flex;
155
+ align-items: center;
156
+ justify-content: center;
157
+ font-weight: 600;
158
+ font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
159
+ line-height: 1;
160
+ animation: pp-badge-bounce 0.4s var(--pp-spring-timing);
161
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
162
+ }
163
+
164
+ .pp-badge-with-icon {
165
+ gap: 4px;
166
+ }
167
+
168
+ .pp-badge-icon {
169
+ display: inline-flex;
170
+ align-items: center;
171
+ justify-content: center;
172
+ line-height: 1;
173
+ flex-shrink: 0;
174
+ }
175
+
176
+ .pp-badge-pulse {
177
+ animation: pp-badge-bounce 0.4s var(--pp-spring-timing),
178
+ pp-presence-pulse 2s ease-in-out infinite 0.4s;
179
+ }
180
+
181
+ .pp-badge-glow {
182
+ box-shadow: 0 0 10px 2px var(--pp-badge-glow-color, currentColor);
183
+ }
184
+
185
+ /* Ring effect (Instagram-style) */
186
+ .pp-ring {
187
+ position: absolute;
188
+ inset: -4px;
189
+ border-radius: inherit;
190
+ padding: 3px;
191
+ background: var(--pp-ring-color, linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888));
192
+ -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
193
+ mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
194
+ -webkit-mask-composite: xor;
195
+ mask-composite: exclude;
196
+ transition: background 0.3s ease;
197
+ }
198
+
199
+ .pp-ring-animated {
200
+ animation: pp-ring-rotate 3s linear infinite;
201
+ }
202
+
203
+ .pp-ring-progress {
204
+ /* Progress rings should not animate rotation */
205
+ animation: none;
206
+ }
207
+
208
+ /* Presence indicator */
209
+ .pp-presence {
210
+ position: absolute;
211
+ bottom: 0;
212
+ right: 0;
213
+ border-radius: 9999px;
214
+ border: 2px solid white;
215
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
216
+ }
217
+
218
+ .pp-presence-animated {
219
+ animation: pp-presence-pulse 2s ease-in-out infinite;
220
+ }
221
+
222
+ /* Glow effect */
223
+ .pp-glow {
224
+ animation: pp-glow 2s ease-in-out infinite;
225
+ }
226
+
227
+ /* Reduced motion support */
228
+ @media (prefers-reduced-motion: reduce) {
229
+ .pp-container,
230
+ .pp-interactive,
231
+ .pp-image,
232
+ .pp-shimmer::after,
233
+ .pp-pulse,
234
+ .pp-skeleton,
235
+ .pp-badge,
236
+ .pp-ring-animated,
237
+ .pp-presence-animated,
238
+ .pp-glow {
239
+ animation: none !important;
240
+ transition: none !important;
241
+ }
242
+ }
243
+ `,ze=`${Ve}
244
+ ${We}`,Te=`
245
+ @keyframes np-shimmer {
246
+ 0% { background-position: -200% 0; }
247
+ 100% { background-position: 200% 0; }
248
+ }
249
+ .np-shimmer {
250
+ background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.4) 50%, transparent 100%);
251
+ background-size: 200% 100%;
252
+ animation: np-shimmer 1.5s infinite;
253
+ }
254
+ `;function De(r,n=.3){if(te(r)){let e=Number.parseInt(r.slice(1,3),16),t=Number.parseInt(r.slice(3,5),16),o=Number.parseInt(r.slice(5,7),16);return `0 0 20px 0 rgba(${e}, ${t}, ${o}, ${n})`}return `0 0 20px 0 ${r}`}var qe=`
255
+ @keyframes ppg-tooltip-in {
256
+ from {
257
+ opacity: 0;
258
+ transform: translateX(-50%) translateY(4px) scale(0.96);
259
+ }
260
+ to {
261
+ opacity: 1;
262
+ transform: translateX(-50%) translateY(0) scale(1);
263
+ }
264
+ }
265
+
266
+ @keyframes ppg-dropdown-in {
267
+ from {
268
+ opacity: 0;
269
+ transform: translateY(-6px) scale(0.95);
270
+ }
271
+ to {
272
+ opacity: 1;
273
+ transform: translateY(0) scale(1);
274
+ }
275
+ }
276
+
277
+ @keyframes ppg-avatar-lift {
278
+ from {
279
+ transform: translateY(0) scale(1);
280
+ }
281
+ to {
282
+ transform: translateY(-4px) scale(1.08);
283
+ }
284
+ }
285
+
286
+ @keyframes ppg-modal-in {
287
+ from {
288
+ opacity: 0;
289
+ transform: translate(-50%, -50%) scale(0.9);
290
+ }
291
+ to {
292
+ opacity: 1;
293
+ transform: translate(-50%, -50%) scale(1);
294
+ }
295
+ }
296
+
297
+ @keyframes ppg-backdrop-in {
298
+ from {
299
+ opacity: 0;
300
+ }
301
+ to {
302
+ opacity: 1;
303
+ }
304
+ }
305
+ `,Je=`
306
+ /* Profile Picture Group Container */
307
+ .ppg-container {
308
+ --ppg-transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
309
+ --ppg-spring: 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
310
+ --ppg-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
311
+ --ppg-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
312
+ --ppg-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
313
+ --ppg-radius: 12px;
314
+ --ppg-counter-bg: #f5f5f7;
315
+ --ppg-counter-text: #1d1d1f;
316
+ --ppg-add-bg: #f5f5f7;
317
+ --ppg-add-hover: #e8e8ed;
318
+ --ppg-add-icon: #86868b;
319
+ --ppg-border: rgba(0, 0, 0, 0.08);
320
+ --ppg-tooltip-bg: rgba(29, 29, 31, 0.95);
321
+ --ppg-tooltip-text: #ffffff;
322
+ --ppg-dropdown-bg: #ffffff;
323
+ --ppg-dropdown-hover: #f5f5f7;
324
+
325
+ position: relative;
326
+ display: inline-flex;
327
+ align-items: center;
328
+ isolation: isolate;
329
+ }
330
+
331
+ /* Avatar wrapper for positioning */
332
+ .ppg-avatar-wrapper {
333
+ position: absolute;
334
+ top: 0;
335
+ transition: transform var(--ppg-spring), z-index 0s;
336
+ cursor: pointer;
337
+ border-radius: 9999px;
338
+ }
339
+
340
+ .ppg-avatar-wrapper:focus-visible {
341
+ outline: none;
342
+ box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.4);
343
+ }
344
+
345
+ /* Hover lift animation */
346
+ .ppg-animated .ppg-avatar-wrapper:hover {
347
+ z-index: 100 !important;
348
+ animation: ppg-avatar-lift var(--ppg-spring) forwards;
349
+ }
350
+
351
+ .ppg-avatar-wrapper:hover {
352
+ z-index: 100 !important;
353
+ }
354
+
355
+ /* Nested profile-picture styling */
356
+ .ppg-avatar-wrapper profile-picture {
357
+ display: block;
358
+ width: 100%;
359
+ height: 100%;
360
+ border-radius: inherit;
361
+ }
362
+
363
+ /* Counter button */
364
+ .ppg-counter {
365
+ position: absolute;
366
+ top: 0;
367
+ display: flex;
368
+ align-items: center;
369
+ justify-content: center;
370
+ border-radius: 9999px;
371
+ background: var(--ppg-counter-bg);
372
+ color: var(--ppg-counter-text);
373
+ font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
374
+ font-weight: 600;
375
+ font-size: 13px;
376
+ letter-spacing: -0.01em;
377
+ cursor: pointer;
378
+ border: none;
379
+ box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.95), var(--ppg-shadow-sm);
380
+ transition: transform var(--ppg-spring), background-color var(--ppg-transition);
381
+ user-select: none;
382
+ -webkit-user-select: none;
383
+ }
384
+
385
+ .ppg-counter:hover {
386
+ background: #ebebed;
387
+ transform: scale(1.05);
388
+ }
389
+
390
+ .ppg-counter:active {
391
+ transform: scale(0.98);
392
+ }
393
+
394
+ .ppg-counter:focus-visible {
395
+ outline: none;
396
+ box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.95), 0 0 0 4px rgba(0, 122, 255, 0.4);
397
+ }
398
+
399
+ /* Add button */
400
+ .ppg-add-button {
401
+ position: absolute;
402
+ top: 0;
403
+ display: flex;
404
+ align-items: center;
405
+ justify-content: center;
406
+ border-radius: 9999px;
407
+ background: var(--ppg-add-bg);
408
+ border: 2px dashed var(--ppg-border);
409
+ cursor: pointer;
410
+ transition: all var(--ppg-spring);
411
+ box-shadow: var(--ppg-shadow-sm);
412
+ }
413
+
414
+ .ppg-add-button:hover {
415
+ background: var(--ppg-add-hover);
416
+ border-color: rgba(0, 0, 0, 0.15);
417
+ transform: scale(1.05);
418
+ }
419
+
420
+ .ppg-add-button:active {
421
+ transform: scale(0.98);
422
+ }
423
+
424
+ .ppg-add-button:focus-visible {
425
+ outline: none;
426
+ box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.4);
427
+ }
428
+
429
+ .ppg-add-icon {
430
+ color: var(--ppg-add-icon);
431
+ transition: color var(--ppg-transition);
432
+ }
433
+
434
+ .ppg-add-button:hover .ppg-add-icon {
435
+ color: #1d1d1f;
436
+ }
437
+
438
+ /* Tooltip */
439
+ .ppg-tooltip {
440
+ position: absolute;
441
+ z-index: 9999;
442
+ padding: 6px 12px;
443
+ background: var(--ppg-tooltip-bg);
444
+ color: var(--ppg-tooltip-text);
445
+ font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
446
+ font-size: 13px;
447
+ font-weight: 500;
448
+ border-radius: 8px;
449
+ box-shadow: var(--ppg-shadow-lg);
450
+ pointer-events: none;
451
+ white-space: nowrap;
452
+ transform: translateX(-50%);
453
+ animation: ppg-tooltip-in 150ms ease-out forwards;
454
+ backdrop-filter: blur(20px);
455
+ -webkit-backdrop-filter: blur(20px);
456
+ }
457
+
458
+ .ppg-tooltip::after {
459
+ content: '';
460
+ position: absolute;
461
+ width: 8px;
462
+ height: 8px;
463
+ background: inherit;
464
+ transform: rotate(45deg);
465
+ }
466
+
467
+ .ppg-tooltip[data-position="top"]::after {
468
+ bottom: -4px;
469
+ left: 50%;
470
+ margin-left: -4px;
471
+ }
472
+
473
+ .ppg-tooltip[data-position="bottom"]::after {
474
+ top: -4px;
475
+ left: 50%;
476
+ margin-left: -4px;
477
+ }
478
+
479
+ /* Dropdown */
480
+ .ppg-dropdown {
481
+ position: absolute;
482
+ z-index: 9998;
483
+ right: 0;
484
+ min-width: 220px;
485
+ max-width: 300px;
486
+ background: var(--ppg-dropdown-bg);
487
+ border-radius: 14px;
488
+ box-shadow:
489
+ 0 4px 24px rgba(0, 0, 0, 0.12),
490
+ 0 1px 4px rgba(0, 0, 0, 0.08),
491
+ 0 0 0 1px var(--ppg-border);
492
+ overflow: hidden;
493
+ animation: ppg-dropdown-in 200ms cubic-bezier(0.32, 0.72, 0, 1) forwards;
494
+ transform-origin: top right;
495
+ backdrop-filter: blur(20px);
496
+ -webkit-backdrop-filter: blur(20px);
497
+ }
498
+
499
+ .ppg-dropdown[data-position="bottom"] {
500
+ top: calc(100% + 10px);
501
+ }
502
+
503
+ .ppg-dropdown[data-position="top"] {
504
+ bottom: calc(100% + 10px);
505
+ transform-origin: bottom right;
506
+ }
507
+
508
+ /* Modal style for mobile */
509
+ .ppg-dropdown[data-position="modal"] {
510
+ transform-origin: center center;
511
+ animation: ppg-modal-in 250ms cubic-bezier(0.32, 0.72, 0, 1) forwards;
512
+ border-radius: 20px;
513
+ }
514
+
515
+ .ppg-backdrop-visible {
516
+ background: rgba(0, 0, 0, 0.4);
517
+ animation: ppg-backdrop-in 200ms ease-out forwards;
518
+ }
519
+
520
+ .ppg-dropdown-header {
521
+ padding: 14px 16px 10px;
522
+ font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
523
+ font-size: 11px;
524
+ font-weight: 600;
525
+ color: #86868b;
526
+ text-transform: uppercase;
527
+ letter-spacing: 0.06em;
528
+ background: linear-gradient(to bottom, rgba(0,0,0,0.02), transparent);
529
+ }
530
+
531
+ .ppg-dropdown-list {
532
+ overflow-y: auto;
533
+ padding: 6px;
534
+ scrollbar-width: thin;
535
+ scrollbar-color: rgba(0,0,0,0.2) transparent;
536
+ }
537
+
538
+ .ppg-dropdown-list::-webkit-scrollbar {
539
+ width: 6px;
540
+ }
541
+
542
+ .ppg-dropdown-list::-webkit-scrollbar-track {
543
+ background: transparent;
544
+ }
545
+
546
+ .ppg-dropdown-list::-webkit-scrollbar-thumb {
547
+ background: rgba(0,0,0,0.15);
548
+ border-radius: 3px;
549
+ }
550
+
551
+ .ppg-dropdown-item {
552
+ display: flex;
553
+ align-items: center;
554
+ gap: 12px;
555
+ padding: 10px 12px;
556
+ cursor: pointer;
557
+ border-radius: 10px;
558
+ transition: all 150ms ease;
559
+ margin: 2px 0;
560
+ }
561
+
562
+ .ppg-dropdown-item:hover {
563
+ background: var(--ppg-dropdown-hover);
564
+ transform: translateX(2px);
565
+ }
566
+
567
+ .ppg-dropdown-item:focus-visible {
568
+ outline: none;
569
+ background: var(--ppg-dropdown-hover);
570
+ box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.4);
571
+ }
572
+
573
+ .ppg-dropdown-item:active {
574
+ transform: scale(0.98);
575
+ }
576
+
577
+ .ppg-dropdown-avatar {
578
+ flex-shrink: 0;
579
+ width: 36px;
580
+ height: 36px;
581
+ border-radius: 9999px;
582
+ object-fit: cover;
583
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
584
+ border: 2px solid rgba(255, 255, 255, 0.8);
585
+ }
586
+
587
+ .ppg-dropdown-avatar-fallback {
588
+ flex-shrink: 0;
589
+ width: 36px;
590
+ height: 36px;
591
+ border-radius: 9999px;
592
+ display: flex;
593
+ align-items: center;
594
+ justify-content: center;
595
+ font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', system-ui, sans-serif;
596
+ font-size: 13px;
597
+ font-weight: 600;
598
+ color: white;
599
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
600
+ border: 2px solid rgba(255, 255, 255, 0.3);
601
+ }
602
+
603
+ .ppg-dropdown-info {
604
+ flex: 1;
605
+ min-width: 0;
606
+ padding-right: 4px;
607
+ text-align: left;
608
+ }
609
+
610
+ .ppg-dropdown-name {
611
+ font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
612
+ font-size: 14px;
613
+ font-weight: 500;
614
+ color: #1d1d1f;
615
+ white-space: nowrap;
616
+ overflow: hidden;
617
+ text-overflow: ellipsis;
618
+ line-height: 1.3;
619
+ text-align: left;
620
+ }
621
+
622
+ .ppg-dropdown-status {
623
+ display: flex;
624
+ align-items: center;
625
+ gap: 5px;
626
+ font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
627
+ font-size: 12px;
628
+ color: #86868b;
629
+ margin-top: 2px;
630
+ line-height: 1.2;
631
+ }
632
+
633
+ .ppg-dropdown-presence {
634
+ width: 7px;
635
+ height: 7px;
636
+ border-radius: 9999px;
637
+ flex-shrink: 0;
638
+ box-shadow: 0 0 0 1.5px var(--ppg-dropdown-bg);
639
+ }
640
+
641
+ .ppg-dropdown-presence[data-status="online"] {
642
+ background: #30D158;
643
+ box-shadow: 0 0 0 1.5px var(--ppg-dropdown-bg), 0 0 6px rgba(48, 209, 88, 0.5);
644
+ }
645
+
646
+ .ppg-dropdown-presence[data-status="away"] {
647
+ background: #FFD60A;
648
+ }
649
+
650
+ .ppg-dropdown-presence[data-status="busy"],
651
+ .ppg-dropdown-presence[data-status="dnd"] {
652
+ background: #FF453A;
653
+ }
654
+
655
+ .ppg-dropdown-presence[data-status="offline"] {
656
+ background: #8E8E93;
657
+ }
658
+
659
+ /* Backdrop for dropdown */
660
+ .ppg-backdrop {
661
+ position: fixed;
662
+ inset: 0;
663
+ z-index: 9997;
664
+ }
665
+
666
+ /* Reduced motion */
667
+ @media (prefers-reduced-motion: reduce) {
668
+ .ppg-container,
669
+ .ppg-avatar-wrapper,
670
+ .ppg-counter,
671
+ .ppg-add-button,
672
+ .ppg-tooltip,
673
+ .ppg-dropdown {
674
+ animation: none !important;
675
+ transition: none !important;
676
+ }
677
+
678
+ .ppg-animated .ppg-avatar-wrapper:hover {
679
+ animation: none !important;
680
+ transform: none !important;
681
+ }
682
+ }
683
+
684
+ /* Dark mode support */
685
+ @media (prefers-color-scheme: dark) {
686
+ .ppg-container {
687
+ --ppg-counter-bg: #2c2c2e;
688
+ --ppg-counter-text: #ffffff;
689
+ --ppg-add-bg: #2c2c2e;
690
+ --ppg-add-hover: #3a3a3c;
691
+ --ppg-add-icon: #98989d;
692
+ --ppg-border: rgba(255, 255, 255, 0.1);
693
+ --ppg-dropdown-bg: #2c2c2e;
694
+ --ppg-dropdown-hover: #3a3a3c;
695
+ }
696
+
697
+ .ppg-avatar-wrapper profile-picture {
698
+ box-shadow: 0 0 6px 1.5px rgb(28 28 30 / 16%), var(--ppg-shadow-sm);
699
+ }
700
+
701
+ .ppg-counter {
702
+ box-shadow: 0 0 0 1.5px rgba(28, 28, 30, 0.95), var(--ppg-shadow-sm);
703
+ }
704
+
705
+ .ppg-counter:hover {
706
+ background: #3a3a3c;
707
+ }
708
+
709
+ .ppg-dropdown {
710
+ background: rgba(44, 44, 46, 0.95);
711
+ box-shadow:
712
+ 0 4px 24px rgba(0, 0, 0, 0.4),
713
+ 0 1px 4px rgba(0, 0, 0, 0.2),
714
+ 0 0 0 1px rgba(255, 255, 255, 0.08);
715
+ }
716
+
717
+ .ppg-dropdown-name {
718
+ color: #ffffff;
719
+ }
720
+
721
+ .ppg-dropdown-header {
722
+ color: #98989d;
723
+ background: linear-gradient(to bottom, rgba(255,255,255,0.03), transparent);
724
+ }
725
+
726
+ .ppg-dropdown-avatar {
727
+ border-color: rgba(255, 255, 255, 0.15);
728
+ }
729
+
730
+ .ppg-dropdown-avatar-fallback {
731
+ border-color: rgba(255, 255, 255, 0.1);
732
+ }
733
+
734
+ .ppg-dropdown-list {
735
+ scrollbar-color: rgba(255,255,255,0.35) transparent;
736
+ }
737
+
738
+ .ppg-dropdown-list::-webkit-scrollbar-thumb {
739
+ background: rgba(255,255,255,0.35);
740
+ }
741
+
742
+ .ppg-dropdown-presence {
743
+ box-shadow: 0 0 0 1.5px rgba(44, 44, 46, 0.95);
744
+ }
745
+
746
+ .ppg-dropdown-presence[data-status="online"] {
747
+ box-shadow: 0 0 0 1.5px rgba(44, 44, 46, 0.95), 0 0 6px rgba(48, 209, 88, 0.5);
748
+ }
749
+ }
750
+ `,Re=`${qe}
751
+ ${Je}`;var a=class extends lit.LitElement{constructor(){super(...arguments);this.src="";this.alt="";this.size=$.size;this.variant=$.variant;this.shadow=$.shadow;this.border=false;this.borderWidth=$.borderWidth;this.borderColor=$.borderColor;this.rotation=0;this.loading=$.loading;this.placeholder=$.placeholder;this.placeholderColor=$.placeholderColor;this.isLoaded=false;this.hasError=false;this.cdnLoadFailed=false;this.previousSrc="";this.RETRY_DELAY_MS=3e4;}static setCdnBaseUrl(e){a.cdnBaseUrl=e,a.instances.forEach(t=>{t.extCustomerId&&!t.cdnImageUrl&&(t.cdnLoadFailed=false,t.retryTimeoutId&&(clearTimeout(t.retryTimeoutId),t.retryTimeoutId=void 0),t.previousExtCustomerId||(t.previousExtCustomerId=t.extCustomerId),t.loadCdnImage());});}static getCdnBaseUrl(){return a.cdnBaseUrl}createRenderRoot(){return a.injectStylesOnce(),this}static injectStylesOnce(){if(a.stylesInjected||typeof document>"u")return;(typeof requestIdleCallback<"u"?requestIdleCallback:t=>setTimeout(t,1))(()=>{if(a.stylesInjected)return;let t=document.createElement("style");t.textContent=ze,document.head.appendChild(t),a.stylesInjected=true;});}get pixelSize(){let e=this.size;return typeof e=="number"?e:N[e]??N[$.size]}connectedCallback(){super.connectedCallback(),a.instances.add(this);}disconnectedCallback(){super.disconnectedCallback(),a.instances.delete(this),this.retryTimeoutId&&(clearTimeout(this.retryTimeoutId),this.retryTimeoutId=void 0);}firstUpdated(){this.extCustomerId&&a.cdnBaseUrl&&(this.previousExtCustomerId=this.extCustomerId,this.loadCdnImage());}updated(e){super.updated(e),this.extCustomerId&&a.cdnBaseUrl&&!this.cdnImageUrl&&(this.cdnLoadFailed||!this.previousExtCustomerId)&&(this.previousExtCustomerId||(this.previousExtCustomerId=this.extCustomerId),this.cdnLoadFailed=false,this.loadCdnImage());}willUpdate(e){e.has("src")&&this.src!==this.previousSrc&&(this.isLoaded=false,this.hasError=false,this.previousSrc=this.src),(e.has("extCustomerId")||e.has("size")||e.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&&a.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&&a.cdnBaseUrl)){this.cdnLoadFailed=true;return}let e=ye(this.pixelSize),t=Ce(this.bgColor),o=typeof window<"u"?window.location.hostname:"localhost";this.cdnImageUrl=Se(a.cdnBaseUrl,this.extCustomerId,e,t,o);}getContainerStyles(){let e=Ie(this.bgColor,this.bgGradient),t=this.border?$e(this.borderWidth,this.borderColor):null,o=Ee(this.shadow),i={};if(this.glow){let d=this.glow.color??this.borderColor??"#6366f1";i={"--pp-glow-color":d,boxShadow:De(d,this.glow.intensity??.3)};}let p=this.interactive?.hoverable||this.interactive?.pressable;return {classes:A("pp-container",ke(this.variant),e.className,t?.className,p&&"pp-interactive",this.glow?.animate&&"pp-glow"),styles:{width:`${this.pixelSize}px`,height:`${this.pixelSize}px`,borderRadius:H[this.variant],...e.style,...t?.style,...o,...i,cursor:this.interactive?.cursor??(p?"pointer":"default"),transform:this.rotation?`rotate(${this.rotation}deg)`:void 0}}}renderPlaceholder(){if(this.isLoaded||this.placeholder==="none")return lit.nothing;let e={shimmer:"pp-shimmer",pulse:"pp-pulse",skeleton:"pp-skeleton",blur:"",none:""}[this.placeholder];return lit.html`
752
+ ${this.placeholder==="shimmer"?lit.html`<style>${Te}</style>`:lit.nothing}
753
+ <div
754
+ class=${A("np:absolute np:inset-0",e)}
755
+ style=${styleMap_js.styleMap({backgroundColor:this.placeholderColor,borderRadius:"inherit"})}>
756
+ </div>
757
+ `}renderFallback(){if(this.fallback)return lit.html`
758
+ <span
759
+ class="pp-fallback"
760
+ style=${styleMap_js.styleMap({fontSize:`${re(this.pixelSize)}px`})}>
761
+ ${this.fallback}
762
+ </span>
763
+ `;if(this.alt){let t=K(this.alt);return lit.html`
764
+ <div
765
+ class="pp-fallback np:absolute np:inset-0"
766
+ style=${styleMap_js.styleMap({background:this.bgColor??t,fontSize:`${re(this.pixelSize)}px`})}>
767
+ ${Y(this.alt)}
768
+ </div>
769
+ `}let e=this.pixelSize*.5;return lit.html`
770
+ <svg
771
+ class="pp-fallback-icon"
772
+ style="width: ${e}px; height: ${e}px;"
773
+ fill="currentColor"
774
+ viewBox="0 0 24 24">
775
+ <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" />
776
+ </svg>
777
+ `}renderImage(){let e=!!(this.extCustomerId&&a.cdnBaseUrl),t;return this.cdnImageUrl?t=this.cdnImageUrl:(!e||this.cdnLoadFailed)&&(t=this.src),this.hasError||!t?this.renderFallback():lit.html`
778
+ <img
779
+ src=${t}
780
+ alt=${this.alt}
781
+ loading=${this.loading}
782
+ decoding="async"
783
+ @load=${this.handleLoad}
784
+ @error=${this.handleError}
785
+ class=${A("pp-image",this.isLoaded?"pp-image-loaded":"pp-image-loading")}
786
+ draggable="false" />
787
+ `}renderRing(){if(!this.ring?.show)return lit.nothing;let e=this.ring.width??3,t=this.ring.gap??3,o=e+t,i,p=this.ring.progress!==void 0;if(p){let d=this.ring.progress??0,g=this.ring.color??"#30D158",m=this.ring.emptyColor??"#8E8E93";i=he(d,g,m);}else this.ring.gradient&&this.ring.gradient.length>0?i=me(this.ring.gradient):i=this.ring.color??"linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888)";return lit.html`
788
+ <div
789
+ class=${A("pp-ring",this.ring.animate&&!p&&"pp-ring-animated",p&&"pp-ring-progress")}
790
+ style=${styleMap_js.styleMap({inset:`-${o}px`,padding:`${e}px`,background:i,borderRadius:H[this.variant]})}>
791
+ </div>
792
+ `}getCornerOffset(){let e=this.border?this.borderWidth:0,t=this.pixelSize*.08,i={circle:1,square:.5,rounded:.8,squircle:1.2}[this.variant];return Math.round(t*i-e*.5)}renderPresence(){if(!this.presence)return lit.nothing;let e=this.presence.thickness??2,t=ge(this.pixelSize,e),o=le[this.presence.status],i=this.getCornerOffset();return lit.html`
793
+ <div
794
+ class=${A("pp-presence",this.presence.animate&&"pp-presence-animated")}
795
+ style=${styleMap_js.styleMap({width:`${t}px`,height:`${t}px`,backgroundColor:o,bottom:`${i}px`,right:`${i}px`,color:o})}
796
+ title=${this.presence.status}>
797
+ </div>
798
+ `}renderBadge(){if(!this.badge)return lit.nothing;let e=this.badge.position??"bottom-right",t=this.badge.content!==void 0,o=this.badge.icon!==void 0,i=t||o,{size:p,fontSize:d}=ue(this.pixelSize,i),g=this.badge.bgColor??"#22c55e",m=this.badge.color??"#ffffff",h=this.badge.borderRadius??"9999px",b=t&&this.badge.content!==void 0?fe(this.badge.content,this.badge.max):null,v=o?this.badge.icon:null,T=d*.9,c=`${-this.getCornerOffset()}px`,U={"top-left":{top:c,left:c},"top-center":{top:c,left:"50%",transform:"translateX(-50%)"},"top-right":{top:c,right:c},"bottom-left":{bottom:c,left:c},"bottom-center":{bottom:c,left:"50%",transform:"translateX(-50%)"},"bottom-right":{bottom:c,right:c}};return lit.html`
799
+ <div
800
+ class=${A("pp-badge",this.badge.pulse&&"pp-badge-pulse",this.badge.glow&&"pp-badge-glow",o&&"pp-badge-with-icon")}
801
+ style=${styleMap_js.styleMap({width:i?"auto":`${p}px`,minWidth:`${p}px`,height:`${p}px`,padding:i?"0 6px":"0",fontSize:`${d}px`,backgroundColor:g,color:m,borderRadius:h,"--pp-badge-glow-color":g,gap:o&&t?"4px":"0",...U[e]})}>
802
+ ${v?lit.html`<span class="pp-badge-icon" style=${styleMap_js.styleMap({fontSize:`${T}px`})}>${v}</span>`:lit.nothing}
803
+ ${b??lit.nothing}
804
+ </div>
805
+ `}render(){let e=this.getContainerStyles(),t=this.interactive?.focusable||this.interactive?.pressable?0:void 0;return lit.html`
806
+ <div
807
+ class=${e.classes}
808
+ style=${styleMap_js.styleMap(e.styles)}
809
+ tabindex=${t??lit.nothing}
810
+ role=${this.interactive?.pressable?"button":lit.nothing}
811
+ aria-label=${this.alt||lit.nothing}
812
+ data-profile-picture>
813
+
814
+ <!-- Ring Effect (behind everything) -->
815
+ ${this.renderRing()}
816
+
817
+ <!-- Inner container for image clipping -->
818
+ <div
819
+ class="pp-inner"
820
+ style=${styleMap_js.styleMap({borderRadius:H[this.variant]})}>
821
+ <!-- Placeholder -->
822
+ ${this.renderPlaceholder()}
823
+
824
+ <!-- Main Image or Fallback -->
825
+ ${this.renderImage()}
826
+ </div>
827
+
828
+ <!-- Badge -->
829
+ ${this.renderBadge()}
830
+
831
+ <!-- Presence Indicator -->
832
+ ${this.renderPresence()}
833
+ </div>
834
+ `}};a.stylesInjected=false,a.cdnBaseUrl="",a.instances=new Set,s([decorators_js.property({type:String})],a.prototype,"src",2),s([decorators_js.property({type:String})],a.prototype,"alt",2),s([decorators_js.property({type:String,attribute:"ext-customer-id"})],a.prototype,"extCustomerId",2),s([decorators_js.property({type:String})],a.prototype,"size",2),s([decorators_js.property({type:String})],a.prototype,"variant",2),s([decorators_js.property({type:String})],a.prototype,"shadow",2),s([decorators_js.property({type:Boolean})],a.prototype,"border",2),s([decorators_js.property({type:Number,attribute:"border-width"})],a.prototype,"borderWidth",2),s([decorators_js.property({type:String,attribute:"border-color"})],a.prototype,"borderColor",2),s([decorators_js.property({type:Number})],a.prototype,"rotation",2),s([decorators_js.property({type:String,attribute:"bg-color"})],a.prototype,"bgColor",2),s([decorators_js.property({type:String,attribute:"bg-gradient"})],a.prototype,"bgGradient",2),s([decorators_js.property({type:Object,attribute:"ring",converter:{fromAttribute:e=>{if(e)try{return JSON.parse(e)}catch{return}},toAttribute:e=>e?JSON.stringify(e):null}})],a.prototype,"ring",2),s([decorators_js.property({type:Object,attribute:"presence",converter:{fromAttribute:e=>{if(e)try{return JSON.parse(e)}catch{return}},toAttribute:e=>e?JSON.stringify(e):null}})],a.prototype,"presence",2),s([decorators_js.property({type:Object,attribute:"glow",converter:{fromAttribute:e=>{if(e)try{return JSON.parse(e)}catch{return}},toAttribute:e=>e?JSON.stringify(e):null}})],a.prototype,"glow",2),s([decorators_js.property({type:Object,attribute:"badge",converter:{fromAttribute:e=>{if(e)try{return JSON.parse(e)}catch{return}},toAttribute:e=>e?JSON.stringify(e):null}})],a.prototype,"badge",2),s([decorators_js.property({type:String})],a.prototype,"loading",2),s([decorators_js.property({type:String})],a.prototype,"placeholder",2),s([decorators_js.property({type:String,attribute:"placeholder-color"})],a.prototype,"placeholderColor",2),s([decorators_js.property({type:String})],a.prototype,"fallback",2),s([decorators_js.property({type:Object,attribute:"interactive",converter:{fromAttribute:e=>{if(e)try{return JSON.parse(e)}catch{return}},toAttribute:e=>e?JSON.stringify(e):null}})],a.prototype,"interactive",2),s([decorators_js.state()],a.prototype,"isLoaded",2),s([decorators_js.state()],a.prototype,"hasError",2),s([decorators_js.state()],a.prototype,"cdnImageUrl",2),s([decorators_js.state()],a.prototype,"cdnLoadFailed",2),a=s([decorators_js.customElement("profile-picture")],a);var ae=false;function Pe(){if(ae||typeof document>"u")return;(typeof requestIdleCallback<"u"?requestIdleCallback:n=>setTimeout(n,1))(()=>{if(ae)return;let n=document.createElement("style");n.textContent=Re,document.head.appendChild(n),ae=true;});}var f=class extends lit.LitElement{constructor(){super(...arguments);this.max=I.max;this.direction=I.direction;this.overlap=I.overlap;this.size=I.size;this.showAddButton=false;this.addButtonLabel="Add user";this.animated=I.animated;this.rotationAmount=0;this.users=[];this.dropdownOpen=false;this.tooltipData=null;this.tooltipTimeout=null;this.slotObserver=null;this.portalContainer=null;this.counterRef=null;this.handleBackdropClick=()=>{this.dropdownOpen=false,this.destroyPortal();};}createRenderRoot(){return Pe(),this}get pixelSize(){return be(this.size)}get tooltipEnabled(){return this.tooltip?.enabled!==false}get tooltipPosition(){return this.tooltip?.position??"top"}get tooltipDelay(){return this.tooltip?.delay??I.tooltipDelay}get dropdownMaxHeight(){return this.dropdown?.maxHeight??I.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(),this.destroyPortal();}setupSlotObserver(){this.slotObserver=new MutationObserver(()=>{this.updateUsers();}),this.slotObserver.observe(this,{childList:true,subtree:true,attributes:true,attributeFilter:["src","alt","ext-customer-id","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,o)=>{let i=(g,m)=>{let h=m??g,b=t[g];return b!=null&&b!==""?String(b):t.getAttribute(h)??void 0},p=i("borderWidth","border-width"),d=p?Number.parseInt(String(p),10):void 0;return {id:i("dataUserId","data-user-id"),name:i("alt")??`User ${o+1}`,src:i("src"),extCustomerId:i("extCustomerId","ext-customer-id"),status:i("dataStatus","data-status"),element:t,index:o,variant:i("variant"),shadow:i("shadow"),border:!!(t.border??t.hasAttribute("border")),borderWidth:d,borderColor:i("borderColor","border-color"),bgColor:i("bgColor","bg-color"),bgGradient:i("bgGradient","bg-gradient")}});for(let t of this.users)t.element&&(t.element.style.display="none");}createPortal(){this.portalContainer||(this.portalContainer=document.createElement("div"),this.portalContainer.className="ppg-portal",this.portalContainer.style.cssText="position: fixed; z-index: 99999; pointer-events: none;",document.body.appendChild(this.portalContainer),document.body.style.overflow="hidden");}destroyPortal(){this.portalContainer&&(lit.render(lit.nothing,this.portalContainer),this.portalContainer.remove(),this.portalContainer=null,document.body.style.overflow="");}updatePortalContent(e){if(!(this.portalContainer&&this.counterRef))return;let t=this.counterRef.getBoundingClientRect(),o=10,i=280,p=Math.min(this.dropdownMaxHeight+60,e.length*56+60),d=window.innerWidth,g=window.innerHeight;if(d<480){let y=lit.html`
835
+ <div
836
+ class="ppg-backdrop ppg-backdrop-visible"
837
+ style="pointer-events: auto; background: rgba(0,0,0,0.5);"
838
+ @click=${this.handleBackdropClick}
839
+ aria-hidden="true"
840
+ ></div>
841
+ <div
842
+ class="ppg-dropdown ppg-dropdown-modal"
843
+ style=${styleMap_js.styleMap({position:"fixed",pointerEvents:"auto",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"calc(100vw - 32px)",maxWidth:"320px",maxHeight:"70vh"})}
844
+ data-position="modal"
845
+ role="menu"
846
+ aria-label="Hidden users"
847
+ >
848
+ <div class="ppg-dropdown-header">
849
+ ${e.length} more
850
+ </div>
851
+ <div
852
+ class="ppg-dropdown-list"
853
+ style=${styleMap_js.styleMap({maxHeight:"calc(70vh - 60px)"})}
854
+ >
855
+ ${e.map(D=>this.renderDropdownItem(D))}
856
+ </div>
857
+ </div>
858
+ `;lit.render(y,this.portalContainer);return}let h=g-t.bottom-o,b=t.top-o,v=d-t.left,T=t.right,x=this.dropdownPosition;x==="bottom"&&h<p&&b>h?x="top":x==="top"&&b<p&&h>b&&(x="bottom");let c;v>=i?c=t.left:T>=i?c=t.right-i:c=(d-i)/2,c=Math.max(8,Math.min(c,d-i-8));let U=x==="bottom"?t.bottom+o:void 0,M=x==="top"?g-t.top+o:void 0,j=lit.html`
859
+ <div
860
+ class="ppg-backdrop"
861
+ style="pointer-events: auto;"
862
+ @click=${this.handleBackdropClick}
863
+ aria-hidden="true"
864
+ ></div>
865
+ <div
866
+ class="ppg-dropdown ppg-dropdown-portal"
867
+ style=${styleMap_js.styleMap({position:"fixed",pointerEvents:"auto",top:U!==void 0?`${U}px`:"auto",bottom:M!==void 0?`${M}px`:"auto",left:`${c}px`,width:`${i}px`})}
868
+ data-position=${x}
869
+ role="menu"
870
+ aria-label="Hidden users"
871
+ >
872
+ <div class="ppg-dropdown-header">
873
+ ${e.length} more
874
+ </div>
875
+ <div
876
+ class="ppg-dropdown-list"
877
+ style=${styleMap_js.styleMap({maxHeight:`${this.dropdownMaxHeight}px`})}
878
+ >
879
+ ${e.map(y=>this.renderDropdownItem(y))}
880
+ </div>
881
+ </div>
882
+ `;lit.render(j,this.portalContainer);}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 o=t.currentTarget;this.tooltipTimeout=window.setTimeout(()=>{this.tooltipData={user:e,rect:o.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.dropdownOpen?(this.createPortal(),this.updatePortalContent(e)):this.destroyPortal(),this.dispatchEvent(new CustomEvent("counter-click",{detail:{hiddenUsers:e,open:this.dropdownOpen},bubbles:true,composed:true}));}handleDropdownItemClick(e){this.dropdownOpen=false,this.destroyPortal(),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,o){let i=X(t,this.pixelSize,this.overlap,this.direction,this.spacing),p=xe(t,o,this.direction),d=e.variant??"circle",g=e.shadow??"none",m=this.rotationAmount?t%2===0?-this.rotationAmount:this.rotationAmount:0;return lit.html`
883
+ <div
884
+ class="ppg-avatar-wrapper"
885
+ style=${styleMap_js.styleMap({left:`${i}px`,zIndex:String(p),width:`${this.pixelSize}px`,height:`${this.pixelSize}px`})}
886
+ tabindex="0"
887
+ role="button"
888
+ aria-label=${e.name}
889
+ @click=${()=>this.handleAvatarClick(e)}
890
+ @mouseenter=${h=>this.handleAvatarHover(e,h)}
891
+ @mouseleave=${this.handleAvatarLeave}
892
+ @keydown=${h=>this.handleKeyDown(h,()=>this.handleAvatarClick(e))}
893
+ >
894
+ ${this.renderProfilePicture(e,d,g,m)}
895
+ </div>
896
+ `}renderProfilePicture(e,t,o,i){return lit.html`
897
+ <profile-picture
898
+ .src=${e.src||void 0}
899
+ .alt=${e.name}
900
+ .size=${this.pixelSize}
901
+ .variant=${t}
902
+ .shadow=${o}
903
+ .rotation=${i}
904
+ .extCustomerId=${e.extCustomerId}
905
+ ?border=${e.border}
906
+ .borderWidth=${e.border?e.borderWidth??2:2}
907
+ .borderColor=${e.border?e.borderColor??"#ffffff":"#ffffff"}
908
+ .bgColor=${e.bgGradient?void 0:e.bgColor??"#ffffff"}
909
+ .bgGradient=${e.bgGradient??void 0}
910
+ data-user-id=${e.id??""}
911
+ data-status=${e.status??""}
912
+ ></profile-picture>
913
+ `}renderCounter(e,t,o){return lit.html`
914
+ <button
915
+ class="ppg-counter"
916
+ style=${styleMap_js.styleMap({left:`${t}px`,width:`${this.pixelSize}px`,height:`${this.pixelSize}px`,zIndex:"1"})}
917
+ aria-label=${`${e} more users`}
918
+ aria-expanded=${this.dropdownOpen}
919
+ aria-haspopup="true"
920
+ @click=${()=>this.handleCounterClick(o)}
921
+ >
922
+ ${we(e)}
923
+ </button>
924
+ `}renderAddButton(e){let t=Math.round(this.pixelSize*.4);return lit.html`
925
+ <button
926
+ class="ppg-add-button"
927
+ style=${styleMap_js.styleMap({left:`${e}px`,width:`${this.pixelSize}px`,height:`${this.pixelSize}px`,zIndex:"1"})}
928
+ aria-label=${this.addButtonLabel}
929
+ @click=${this.handleAddClick}
930
+ >
931
+ <svg
932
+ class="ppg-add-icon"
933
+ width=${t}
934
+ height=${t}
935
+ viewBox="0 0 24 24"
936
+ fill="none"
937
+ stroke="currentColor"
938
+ stroke-width="2.5"
939
+ stroke-linecap="round"
940
+ stroke-linejoin="round"
941
+ >
942
+ <line x1="12" y1="5" x2="12" y2="19"></line>
943
+ <line x1="5" y1="12" x2="19" y2="12"></line>
944
+ </svg>
945
+ </button>
946
+ `}renderTooltip(){if(!this.tooltipData)return lit.nothing;let{user:e,rect:t}=this.tooltipData,o=8,i=this.getBoundingClientRect(),p=t.left-i.left+t.width/2,d=t.top-i.top,g=t.bottom-i.top,m=this.tooltipPosition==="top";return lit.html`
947
+ <div
948
+ class="ppg-tooltip"
949
+ style=${styleMap_js.styleMap({top:m?"auto":`${g+o}px`,bottom:m?`${i.height-d+o}px`:"auto",left:`${p}px`})}
950
+ data-position=${this.tooltipPosition}
951
+ role="tooltip"
952
+ >
953
+ ${e.name}
954
+ </div>
955
+ `}renderDropdownItem(e){let t=K(e.name),o=e.src||e.extCustomerId;return lit.html`
956
+ <div
957
+ class="ppg-dropdown-item"
958
+ role="menuitem"
959
+ tabindex="0"
960
+ @click=${()=>this.handleDropdownItemClick(e)}
961
+ @keydown=${i=>this.handleKeyDown(i,()=>this.handleDropdownItemClick(e))}
962
+ >
963
+ ${o?lit.html`<profile-picture
964
+ class="ppg-dropdown-avatar"
965
+ .src=${e.src||void 0}
966
+ .alt=${e.name}
967
+ .extCustomerId=${e.extCustomerId}
968
+ .size=${40}
969
+ variant="circle"
970
+ shadow="none"
971
+ ></profile-picture>`:lit.html`<div
972
+ class="ppg-dropdown-avatar-fallback"
973
+ style=${styleMap_js.styleMap({background:t})}
974
+ >
975
+ ${Y(e.name)}
976
+ </div>`}
977
+ <div class="ppg-dropdown-info">
978
+ <div class="ppg-dropdown-name">${e.name}</div>
979
+ ${this.showPresence&&e.status?lit.html`
980
+ <div class="ppg-dropdown-status">
981
+ <span
982
+ class="ppg-dropdown-presence"
983
+ data-status=${e.status}
984
+ ></span>
985
+ ${this.formatStatus(e.status)}
986
+ </div>
987
+ `:lit.nothing}
988
+ </div>
989
+ </div>
990
+ `}formatStatus(e){return {online:"Online",away:"Away",busy:"Busy",offline:"Offline",dnd:"Do not disturb"}[e]??e}updated(e){super.updated(e);let t=this.querySelector(".ppg-counter");if(t&&(this.counterRef=t),this.dropdownOpen&&this.portalContainer){let{visible:o}=ne(this.users.length,this.max,this.showAddButton),i=this.users.slice(o);this.updatePortalContent(i);}}render(){let{visible:e,hidden:t,showCounter:o}=ne(this.users.length,this.max,this.showAddButton),i=this.direction==="ltr"?this.users.slice(0,e):this.users.slice(0,e).reverse(),p=this.users.slice(e),d=e;o&&d++,this.showAddButton&&d++;let g=ve(d,this.pixelSize,this.overlap,this.spacing),m=o?X(e,this.pixelSize,this.overlap,this.direction,this.spacing):0,h=X(e+(o?1:0),this.pixelSize,this.overlap,this.direction,this.spacing);return lit.html`
991
+ <div
992
+ class=${A("ppg-container",this.animated&&"ppg-animated")}
993
+ style=${styleMap_js.styleMap({width:`${g}px`,height:`${this.pixelSize}px`})}
994
+ role="group"
995
+ aria-label="User avatars"
996
+ >
997
+ <!-- Hidden slot for original children -->
998
+ <slot style="display: none;"></slot>
999
+
1000
+ <!-- Visible avatars -->
1001
+ ${i.map((b,v)=>this.renderAvatar(b,v,e))}
1002
+
1003
+ <!-- Counter -->
1004
+ ${o?this.renderCounter(t,m,p):lit.nothing}
1005
+
1006
+ <!-- Add button -->
1007
+ ${this.showAddButton?this.renderAddButton(h):lit.nothing}
1008
+
1009
+ <!-- Tooltip -->
1010
+ ${this.renderTooltip()}
1011
+ </div>
1012
+ `}};s([decorators_js.property({type:Number})],f.prototype,"max",2),s([decorators_js.property({type:String})],f.prototype,"direction",2),s([decorators_js.property({type:Number})],f.prototype,"overlap",2),s([decorators_js.property({type:String})],f.prototype,"size",2),s([decorators_js.property({type:Number})],f.prototype,"spacing",2),s([decorators_js.property({type:Object})],f.prototype,"tooltip",2),s([decorators_js.property({type:Object})],f.prototype,"dropdown",2),s([decorators_js.property({type:Boolean,attribute:"show-add-button"})],f.prototype,"showAddButton",2),s([decorators_js.property({type:String,attribute:"add-button-label"})],f.prototype,"addButtonLabel",2),s([decorators_js.property({type:Boolean})],f.prototype,"animated",2),s([decorators_js.property({type:Number,attribute:"rotation-amount"})],f.prototype,"rotationAmount",2),s([decorators_js.state()],f.prototype,"users",2),s([decorators_js.state()],f.prototype,"dropdownOpen",2),s([decorators_js.state()],f.prototype,"tooltipData",2),f=s([decorators_js.customElement("profile-picture-group")],f);var Ue=Ae__default.default.forwardRef(({max:r,direction:n,overlap:e,size:t,spacing:o,tooltip:i,dropdown:p,showAddButton:d,addButtonLabel:g,animated:m,rotationAmount:h,onAvatarClick:b,onAvatarHover:v,onCounterClick:T,onDropdownItemClick:x,onAddClick:c,className:U,style:M,children:j},y)=>{let D=Ae.useRef(null),B=Ae.useCallback(l=>{b?.(l.detail.user);},[b]),O=Ae.useCallback(l=>{v?.(l.detail.user);},[v]),G=Ae.useCallback(l=>{let k=l;T?.(k.detail.hiddenUsers,k.detail.open);},[T]),V=Ae.useCallback(l=>{x?.(l.detail.user);},[x]),W=Ae.useCallback(()=>{c?.();},[c]);return Ae.useEffect(()=>{let l=D.current;if(l)return l.addEventListener("avatar-click",B),l.addEventListener("avatar-hover",O),l.addEventListener("counter-click",G),l.addEventListener("dropdown-item-click",V),l.addEventListener("add-click",W),()=>{l.removeEventListener("avatar-click",B),l.removeEventListener("avatar-hover",O),l.removeEventListener("counter-click",G),l.removeEventListener("dropdown-item-click",V),l.removeEventListener("add-click",W);}},[B,O,G,V,W]),Ae.useEffect(()=>{typeof y=="function"?y(D.current):y&&(y.current=D.current);},[y]),Ae__default.default.createElement("profile-picture-group",{ref:D,max:r,direction:n,overlap:e,size:t,spacing:o,tooltip:i?JSON.stringify(i):void 0,dropdown:p?JSON.stringify(p):void 0,"show-add-button":d||void 0,"add-button-label":g,animated:m,"rotation-amount":h,class:U,style:M},j)});Ue.displayName="ProfilePictureGroup";function Lt(r){a.setCdnBaseUrl(r);}function Ut(){return a.getCdnBaseUrl()}function tt({src:r,alt:n,extCustomerId:e,size:t,variant:o,shadow:i,border:p,borderWidth:d,borderColor:g,rotation:m,bgColor:h,bgGradient:b,glow:v,ring:T,presence:x,badge:c,loading:U,placeholder:M,placeholderColor:j,fallback:y,interactive:D,onLoad:B,onError:O,onCdnError:G,className:V,style:W,ref:l}){let k=Ae.useRef(null),P=Ae.useCallback(()=>{B?.();},[B]),Q=Ae.useCallback(()=>{O?.();},[O]),_=Ae.useCallback(R=>{G?.(R.detail);},[G]);return Ae.useEffect(()=>{let R=k.current;if(R)return R.addEventListener("load",P),R.addEventListener("error",Q),R.addEventListener("cdn-error",_),()=>{R.removeEventListener("load",P),R.removeEventListener("error",Q),R.removeEventListener("cdn-error",_);}},[P,Q,_]),Ae.useEffect(()=>{typeof l=="function"?l(k.current):l&&(l.current=k.current);},[l]),Ae__default.default.createElement("profile-picture",{ref:k,src:r||void 0,alt:n,"ext-customer-id":e,size:t,variant:o,shadow:i,border:p||void 0,"border-width":d,"border-color":g,rotation:m,"bg-color":h,"bg-gradient":b,glow:v?JSON.stringify(v):void 0,ring:T?JSON.stringify(T):void 0,presence:x?JSON.stringify(x):void 0,badge:c?JSON.stringify(c):void 0,loading:U,placeholder:M,"placeholder-color":j,fallback:y,interactive:D?JSON.stringify(D):void 0,class:V,style:W})}tt.displayName="ProfilePicture";de();exports.ProfilePicture=tt;exports.ProfilePictureGroup=Ue;exports.getCdnBaseUrl=Ut;exports.setCdnBaseUrl=Lt;//# sourceMappingURL=react.cjs.map
1013
+ //# sourceMappingURL=react.cjs.map