1import{E as e,_ as t,p as n,x as r}from"./institution-DyFDvNu6.js";import{Qn as i,Yn as a,Zn as o,st as s}from"./main-5Sl8yySz.js";import"./jha-button-Dyau4S4K.js";import{t as c}from"./observable-models-lit-Conecq5s.js";import{t as l}from"./color-scheme-images-lit-jcglFLH3.js";import"./jha-avatar-BLCfUxg0.js";var u=l(t);window.BannowebConversationsFiAvatarElement=class extends u{constructor(){super()}static get is(){return`bannoweb-conversations-fi-avatar`}static get styles(){return e`.fi-avatar{vertical-align:middle;background-color:#0000;background-position:50%;background-repeat:no-repeat;background-size:cover;border-radius:50%;width:100%;height:100%;margin-right:16px;position:relative}`}render(){return r`<div class="fi-avatar" style="background-image:url(${this.iconImage})"></div>`}},customElements.define(window.BannowebConversationsFiAvatarElement.is,window.BannowebConversationsFiAvatarElement),window.BannowebConversationsFiAvatarElement;var{UserType:d}=a;window.BannowebConversationsUserAvatar=class extends t{static get is(){return`bannoweb-conversations-user-avatar`}static get properties(){return{userId:{type:String},userType:{type:String}}}constructor(){super(),this.userType=null,this.userId=null}static get styles(){return e`:host{background-color:var(--secondary-content-background-color);text-align:center;border-radius:50%;width:100%;height:100%;display:inline-block;position:relative}jha-avatar{width:100%;height:100%}`}
1get avatarUrl(){let e={id:this.userId,userType:this.userType};return this.userId&&this.userType?s.getAvatarUrl(e):null}render(){return this.avatarUrl===null?r`<bannoweb-conversations-fi-avatar></bannoweb-conversations-fi-avatar>`:r`<jha-avatar small style="${this.avatarUrl}"></jha-avatar>`}},customElements.define(window.BannowebConversationsUserAvatar.is,window.BannowebConversationsUserAvatar),window.BannowebConversationsUserAvatar;function f(e,t=!1,n=``,r=!1,a=1/0){if(!e||!e.length&&!t)return``;if(t&&e.length===0)return n;let o=e.slice().sort((e,t)=>m(e).localeCompare(m(t))).map((e,t,n)=>n.length===1?m(e):p(e)||e.name);if(t&&!e.some(e=>e instanceof i)&&o.push(n),o.sort((e,t)=>(e||``).localeCompare(t)),o.length===1)return o[0];if(r)return o.join(`, `);if(o.length===2)return o.join(` and `);if(o.length===a){let e=o.slice(0,a-1),t=o.slice(-1);return`${e.join(`, `)} and ${t}`}let s=o.slice(0,a===1/0?-1:a);return a===1/0||o.length<=a?`${s.join(`, `)} and ${o.slice(-1)}`:`${s.join(`, `)} and ${o.length-a===1?`one other person`:`${o.length-a} others`}`}function p(e={}){return e.preferredName||e.firstName||``}function m(e){let t=p(e);return e instanceof i?t:t&&e.lastName?`${t} ${e.lastName}`:!t&&e.lastName?e.lastName:e.name}var{UserType:h}=a,g=c(t);window.BannowebConversationsParticipantsElement=class extends g{static get is(){return`bannoweb-conversations-participants`}static get properties(){return{displayNames_:{type:String},_participants:{type:Object},simpleDisplay:{type:Boolean,reflect:!0,attribute:`simple-display`},multipleParticipants:{type:Boolean,reflect:!0,attribute:`multiple-participants`},institutionIncluded_:{type:Boolean},institutionName:{type:String}}}constructor(){super(),this.participantNameSubscription=null,this.displayNames_=``,this._participants=null,this.simpleDisplay=!1,this.institutionIncluded_=!1,this.institutionName=``,this.multipleParticipants=!1}disconnectedCallback(){super.disconnectedCallback(),this.participantNameSubscription!==null&&this.participantNameSubscription.unsubscribe()}participantsChanged_(){this.participantNameSubscription!==null&&this.participantNameSubscription.unsubscribe(),this.constructDisplayNames_(),this.participants&&(this.participantNameSubscription=n.from(this.participants).subscribe(e=>{let t=e.type===`change`,n=[`firstName`,`lastName`,`name`,`preferredName`].includes(e.property);(e.type===`splice`||t&&n)&&this.constructDisplayNames_()}))}constructDisplayNames_(){this.participants&&(this.displayNames_=f(this.participants?.items,this.institutionIncluded,this.institutionName,!0))}getFullUserName(e){if(!e.firstName&&e.lastName)return e.lastName;if(e.preferredName||e.firstName)return`${e.preferredName||e.firstName} ${e.lastName}`;if(e.name)return e.name}getParticipants_(e,t){let n=(e||[]).slice();return this.groupWithNoAgent_(e||[],t)&&n.push(this.institutionName),n.sort((e,t)=>{let n=e instanceof i?e.firstName:typeof e==`string`?e:this.getFullUserName(e),r=t instanceof i?t.firstName:typeof t==`string`?t:this.getFullUserName(t);return n.localeCompare(r)}),n.slice(0,2).reverse()}groupWithNoAgent_(e,t){return t&&!e.some(e=>e instanceof i)}isEnterpriseUser(e){return e instanceof i}getUserType(e){return this.isEnterpriseUser(e)?h.ENTERPRISE:h.CONSUMER}isUser(e){return e instanceof i||e instanceof o}setMultipleParticipants(){let e=this.participants?.items;this.multipleParticipants=!!((e?.length||0)>1||e&&this.groupWithNoAgent_(e,this.institutionIncluded))}set participants(e){this._participants=e,this.participantsChanged_(),this.setMultipleParticipants()}get participants(){return this._participants}set institutionIncluded(e){this.institutionIncluded_=e,this.constructDisplayNames_(),this.setMultipleParticipants()}get institutionIncluded(){return this.institutionIncluded_}static get styles(){return e`:host{--jha-avatar-left-margin-offset:-16px;display:flex}:host>div{flex-grow:1;width:1px;display:inline}bannoweb-conversations-user-avatar{width:32px;height:32px;box-shadow:0 0 0 2px var(--primary-content-background-color);margin-right:0}:host([multiple-participants]) bannoweb-conversations-user-avatar{width:24px;height:24px}bannoweb-conversations-user-avatar:nth-of-type(n+2){margin-left:var(--jha-avatar-left-margin-offset)}
1bannoweb-conversations-user-avatar:nth-of-type(n+4){display:none}jha-button{text-align:left;--jha-button-link-line-height:18px;--jha-button-link-text-size:14px;--jha-button-link-font-weight:600;display:block}.names,.subtitle{text-overflow:ellipsis;margin-left:4px;overflow:hidden}:host([chat-header]){align-items:center;font-weight:500;display:flex}:host([chat-header])>div{width:auto;display:inline}:host([chat-header]) bannoweb-conversations-user-avatar{width:36px;height:36px;margin-right:8px}:host([chat-header]) bannoweb-conversations-user-avatar+bannoweb-conversations-user-avatar{margin-left:-20px}:host([people]) .names{color:var(--jha-text-dark);margin-left:8px;font-size:16px}:host([people]) div{width:500px}:host([no-names]) .names{display:none}:host([people]) bannoweb-conversations-user-avatar{flex-shrink:0;width:24px;height:24px}:host([no-avatars]) bannoweb-conversations-user-avatar{display:none}:host([no-avatars]) .names{margin-left:0}`}render(){return r`${this.getParticipants_(this.participants?.items,this.institutionIncluded).map(e=>r`${this.isUser(e)?r`<bannoweb-conversations-user-avatar .userId="${e.id}" .userType="${this.getUserType(e)}"></bannoweb-conversations-user-avatar>`:``} ${this.isUser(e)?``:r`<bannoweb-conversations-user-avatar></bannoweb-conversations-user-avatar>`}`)} <div> <div class="names">${this.displayNames_}</div> <div class="subtitle"> <slot></slot> </div> </div>`}},customElements.define(window.BannowebConversationsParticipantsElement.is,window.BannowebConversationsParticipantsElement),window.BannowebConversationsParticipantsElement;export{f as t};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.