1"use strict";(self.webpackChunkcitizex=self.webpackChunkcitizex||[]).push([[278],{4804:(z,E,b)=>{b.d(E,{y:()=>T});var a=b(4438),x=b(2955),p=b(8059);let T=(()=>{class I{constructor(l,h){this.linkifyService=l,this.editorHtmlSanitizer=h}transform(l,h){if(!l)return l;const d=(new DOMParser).parseFromString(l,"text/html");this.processNode(d.body);let y=d.body.innerHTML;return h?.limit?this.editorHtmlSanitizer.sanitizePreview(y,h?.limitChars||40):this.editorHtmlSanitizer.sanitize(y)}processNode(l){Array.from(l.childNodes).forEach(v=>{if(v.nodeType===Node.TEXT_NODE)this.linkifyTextNode(v);else if(v.nodeType===Node.ELEMENT_NODE){const d=v;"a"!==d.tagName.toLowerCase()&&this.processNode(d)}})}linkifyTextNode(l){const h=l.textContent||"";if(!h.trim())return;const v=this.linkifyService.find(h).reduce((A,S)=>{const w=S.start;if(!Number.isInteger(w))return A;const N=S.value.replace(/["'<>].*$/,""),L=S.href.replace(/["'<>].*$/,"");return!N||!L||A.push({type:"link",start:w,end:w+N.length,value:N,href:L}),A},[]),d=[],y=/@[\w-]+(?:\.[\w-]+)*/g;let f;for(;null!==(f=y.exec(h));)d.push({type:"mention",start:f.index,end:f.index+f[0].length,value:f[0],href:`/profile/view-profile/${f[0].substring(1)}`});const m=[...v,...d].sort((A,S)=>A.start-S.start||("link"===A.type?-1:1)-("link"===S.type?-1:1));if(0===m.length)return;const g=document.createDocumentFragment();let c=0;for(const A of m){if(A.start<c)continue;g.append(document.createTextNode(h.slice(c,A.start)));const S=document.createElement("a");if(S.href=A.href,S.textContent=A.value,"mention"===A.type){S.className="linkify linkify-mention";const C=document.createElement("span");C.className="mention",C.append(S),g.append(C)}else S.target="_blank",S.rel="noopener noreferrer",g.append(S);c=A.end}g.append(document.createTextNode(h.slice(c))),l.parentNode?.replaceChild(g,l)}static{this.\u0275fac=function(h){return new(h||I)(a.rXU(x.az,16),a.rXU(p.I,16))}}static{this.\u0275pipe=a.EJ8({name:"applinkifyHtml",type:I,pure:!0})}}return I})()},8059:(z,E,b)=>{b.d(E,{I:()=>p});var a=b(4438),x=b(345);let p=(()=>{class T{constructor(u){this.sanitizer=u}sanitize(u){return this.sanitizer.bypassSecurityTrustHtml(this.sanitizeToHtml(u||""))}sanitizePreview(u,l){const h=this.sanitizeToHtml(u||""),v=this.truncateHtml(h,Math.max(0,Math.floor(l)));return this.sanitizer.bypassSecurityTrustHtml(v)}sanitizeToHtml(u){const l=new DOMParser,h=l.parseFromString(u,"text/html"),v=new Map;h.body.querySelectorAll("[class]").forEach(f=>{Array.from(f.classList).filter(m=>/^cx-safe-style-\d+$/.test(m)).forEach(m=>f.classList.remove(m))}),h.body.querySelectorAll("[style]").forEach(f=>{const m=this.getAllowedEditorStyle(f);if(f.removeAttribute("style"),!m)return;const g=`cx-safe-style-${v.size}`;f.classList.add(g),v.set(g,m)});const d=this.sanitizer.sanitize(a.WPN.HTML,h.body.innerHTML)||"",y=l.parseFromString(d,"text/html");return v.forEach((f,m)=>{const g=y.body.querySelector(`.${m}`);g&&(g.setAttribute("style",f),g.classList.remove(m),0===g.classList.length&&g.removeAttribute("class"))}),y.body.querySelectorAll("[href], [src]").forEach(f=>{for(const m of["href","src"])f.getAttribute(m)?.toLowerCase().startsWith("unsafe:")&&f.removeAttribute(m)}),y.body.innerHTML}getAllowedEditorStyle(u){const l=[],h=u.tagName.toLowerCase();if(/^(?:p|blockquote|h[1-6])$/.test(h)){const d=u.style.getPropertyValue("text-align").trim();["left","center","right","justify"].includes(d)&&l.push(`text-align: ${d}`);const y=u.style.getPropertyValue("margin-left").trim(),f=/^(\d+(?:\.\d+)?)px$/.exec(y);f&&Number(f[1])<=400&&l.push(`margin-left: ${y}`)}if("span"===h)for(const d of["color","background-color"]){const y=u.style.getPropertyValue(d).trim();this.isAllowedEditorColor(y)&&l.push(`${d}: ${y}`)}return l.join("; ")}isAllowedEditorColor(u){return/^#[\da-f]{3,8}$/i.test(u)||/^rgba?\([\d.,%\s/]+\)$/i.test(u)}truncateHtml(u,l){const v=(new DOMParser).parseFromString(u,"text/html");if((v.body.textContent||"").length<=l)return u;const y=v.createElement("div"),f={remaining:l};for(const m of Array.from(v.body.childNodes)){const g=this.cloneWithinTextLimit(m,f);if(g&&y.append(g),0===f.remaining)break}return this.appendEllipsis(y),y.innerHTML}appendEllipsis(u){const l=u.lastChild;
1l?.nodeType!==Node.ELEMENT_NODE||["br","hr","img"].includes(l.tagName.toLowerCase())?u.appendChild(document.createTextNode("...")):l.appendChild(document.createTextNode("..."))}cloneWithinTextLimit(u,l){if(u.nodeType===Node.TEXT_NODE){if(0===l.remaining)return null;const d=(u.textContent||"").slice(0,l.remaining);return l.remaining-=d.length,document.createTextNode(d)}if(u.nodeType!==Node.ELEMENT_NODE)return null;const h=u.cloneNode(!1);for(const v of Array.from(u.childNodes)){const d=this.cloneWithinTextLimit(v,l);if(d&&h.appendChild(d),0===l.remaining)break}return h}static{this.\u0275fac=function(l){return new(l||T)(a.KVO(x.up))}}static{this.\u0275prov=a.jDH({token:T,factory:T.\u0275fac,providedIn:"root"})}}return T})()},9589:(z,E,b)=>{b.d(E,{fw:()=>X,mC:()=>Y});var a=b(4438),x=b(177);class p{constructor(){this._dataLength=0,this._bufferLength=0,this._state=new Int32Array(4),this._buffer=new ArrayBuffer(68),this._buffer8=new Uint8Array(this._buffer,0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}static hashStr(o,t=!1){return this.onePassHasher.start().appendStr(o).end(t)}static hashAsciiStr(o,t=!1){return this.onePassHasher.start().appendAsciiStr(o).end(t)}static _hex(o){const t=p.hexChars,e=p.hexOut;let r,s,i,_;for(_=0;_<4;_+=1)for(s=8*_,r=o[_],i=0;i<8;i+=2)e[s+1+i]=t.charAt(15&r),r>>>=4,e[s+0+i]=t.charAt(15&r),r>>>=4;return e.join("")}static _md5cycle(o,t){let e=o[0],r=o[1],s=o[2],i=o[3];e+=(r&s|~r&i)+t[0]-680876936|0,e=(e<<7|e>>>25)+r|0,i+=(e&r|~e&s)+t[1]-389564586|0,i=(i<<12|i>>>20)+e|0,s+=(i&e|~i&r)+t[2]+606105819|0,s=(s<<17|s>>>15)+i|0,r+=(s&i|~s&e)+t[3]-1044525330|0,r=(r<<22|r>>>10)+s|0,e+=(r&s|~r&i)+t[4]-176418897|0,e=(e<<7|e>>>25)+r|0,i+=(e&r|~e&s)+t[5]+1200080426|0,i=(i<<12|i>>>20)+e|0,s+=(i&e|~i&r)+t[6]-1473231341|0,s=(s<<17|s>>>15)+i|0,r+=(s&i|~s&e)+t[7]-45705983|0,r=(r<<22|r>>>10)+s|0,e+=(r&s|~r&i)+t[8]+1770035416|0,e=(e<<7|e>>>25)+r|0,i+=(e&r|~e&s)+t[9]-1958414417|0,i=(i<<12|i>>>20)+e|0,s+=(i&e|~i&r)+t[10]-42063|0,s=(s<<17|s>>>15)+i|0,r+=(s&i|~s&e)+t[11]-1990404162|0,r=(r<<22|r>>>10)+s|0,e+=(r&s|~r&i)+t[12]+1804603682|0,e=(e<<7|e>>>25)+r|0,i+=(e&r|~e&s)+t[13]-40341101|0,i=(i<<12|i>>>20)+e|0,s+=(i&e|~i&r)+t[14]-1502002290|0,s=(s<<17|s>>>15)+i|0,r+=(s&i|~s&e)+t[15]+1236535329|0,r=(r<<22|r>>>10)+s|0,e+=(r&i|s&~i)+t[1]-165796510|0,e=(e<<5|e>>>27)+r|0,i+=(e&s|r&~s)+t[6]-1069501632|0,i=(i<<9|i>>>23)+e|0,s+=(i&r|e&~r)+t[11]+643717713|0,s=(s<<14|s>>>18)+i|0,r+=(s&e|i&~e)+t[0]-373897302|0,r=(r<<20|r>>>12)+s|0,e+=(r&i|s&~i)+t[5]-701558691|0,e=(e<<5|e>>>27)+r|0,i+=(e&s|r&~s)+t[10]+38016083|0,i=(i<<9|i>>>23)+e|0,s+=(i&r|e&~r)+t[15]-660478335|0,s=(s<<14|s>>>18)+i|0,r+=(s&e|i&~e)+t[4]-405537848|0,r=(r<<20|r>>>12)+s|0,e+=(r&i|s&~i)+t[9]+568446438|0,e=(e<<5|e>>>27)+r|0,i+=(e&s|r&~s)+t[14]-1019803690|0,i=(i<<9|i>>>23)+e|0,s+=(i&r|e&~r)+t[3]-187363961|0,s=(s<<14|s>>>18)+i|0,r+=(s&e|i&~e)+t[8]+1163531501|0,r=(r<<20|r>>>12)+s|0,e+=(r&i|s&~i)+t[13]-1444681467|0,e=(e<<5|e>>>27)+r|0,i+=(e&s|r&~s)+t[2]-51403784|0,i=(i<<9|i>>>23)+e|0,s+=(i&r|e&~r)+t[7]+1735328473|0,s=(s<<14|s>>>18)+i|0,r+=(s&e|i&~e)+t[12]-1926607734|0,r=(r<<20|r>>>12)+s|0,e+=(r^s^i)+t[5]-378558|0,e=(e<<4|e>>>28)+r|0,i+=(e^r^s)+t[8]-2022574463|0,i=(i<<11|i>>>21)+e|0,s+=(i^e^r)+t[11]+1839030562|0,s=(s<<16|s>>>16)+i|0,r+=(s^i^e)+t[14]-35309556|0,r=(r<<23|r>>>9)+s|0,e+=(r^s^i)+t[1]-1530992060|0,e=(e<<4|e>>>28)+r|0,i+=(e^r^s)+t[4]+1272893353|0,i=(i<<11|i>>>21)+e|0,s+=(i^e^r)+t[7]-155497632|0,s=(s<<16|s>>>16)+i|0,r+=(s^i^e)+t[10]-1094730640|0,r=(r<<23|r>>>9)+s|0,e+=(r^s^i)+t[13]+681279174|0,e=(e<<4|e>>>28)+r|0,i+=(e^r^s)+t[0]-358537222|0,i=(i<<11|i>>>21)+e|0,s+=(i^e^r)+t[3]-722521979|0,s=(s<<16|s>>>16)+i|0,r+=(s^i^e)+t[6]+76029189|0,r=(r<<23|r>>>9)+s|0,e+=(r^s^i)+t[9]-640364487|0,e=(e<<4|e>>>28)+r|0,i+=(e^r^s)+t[12]-421815835|0,i=(i<<11|i>>>21)+e|0,s+=(i^e^r)+t[15]+530742520|0,s=(s<<16|s>>>16)+i|0,r+=(s^i^e)+t[2]-995338651|0,r=(r<<23|r>>>9)+s|0,e+=(s^(r|~i))+t[0]-198630844|0,e=(e<<6|e>>>26)+r|0,i+=(r^(e|~s))+t[7]+1126891415|0,i=(i<<10|i>>>22)+e|0,s+=(e^(i|~r))+t[14]-1416354905|0,s=(s<<15|s>>>17)+i|0,r+=(i^(s|~e))+t[5]-57434055|0,r=(r<<21|r>>>11)+s|0,e+=(s^(r|~i))+t[12]+1700485571|0,e=(e<<6|e>>>26)+r|0,i+=(r^(e|~s))+t[3]-1894986606|0,i=(i<<10|i>>>22)+e|0,s+=(e^(i|~r))+t[10]-1051523|0,s=(s<<15|s>>>
117)+i|0,r+=(i^(s|~e))+t[1]-2054922799|0,r=(r<<21|r>>>11)+s|0,e+=(s^(r|~i))+t[8]+1873313359|0,e=(e<<6|e>>>26)+r|0,i+=(r^(e|~s))+t[15]-30611744|0,i=(i<<10|i>>>22)+e|0,s+=(e^(i|~r))+t[6]-1560198380|0,s=(s<<15|s>>>17)+i|0,r+=(i^(s|~e))+t[13]+1309151649|0,r=(r<<21|r>>>11)+s|0,e+=(s^(r|~i))+t[4]-145523070|0,e=(e<<6|e>>>26)+r|0,i+=(r^(e|~s))+t[11]-1120210379|0,i=(i<<10|i>>>22)+e|0,s+=(e^(i|~r))+t[2]+718787259|0,s=(s<<15|s>>>17)+i|0,r+=(i^(s|~e))+t[9]-343485551|0,r=(r<<21|r>>>11)+s|0,o[0]=e+o[0]|0,o[1]=r+o[1]|0,o[2]=s+o[2]|0,o[3]=i+o[3]|0}start(){return this._dataLength=0,this._bufferLength=0,this._state.set(p.stateIdentity),this}appendStr(o){const t=this._buffer8,e=this._buffer32;let s,i,r=this._bufferLength;for(i=0;i<o.length;i+=1){if(s=o.charCodeAt(i),s<128)t[r++]=s;else if(s<2048)t[r++]=192+(s>>>6),t[r++]=63&s|128;else if(s<55296||s>56319)t[r++]=224+(s>>>12),t[r++]=s>>>6&63|128,t[r++]=63&s|128;else{if(s=1024*(s-55296)+(o.charCodeAt(++i)-56320)+65536,s>1114111)throw new Error("Unicode standard supports code points up to U+10FFFF");t[r++]=240+(s>>>18),t[r++]=s>>>12&63|128,t[r++]=s>>>6&63|128,t[r++]=63&s|128}r>=64&&(this._dataLength+=64,p._md5cycle(this._state,e),r-=64,e[0]=e[16])}return this._bufferLength=r,this}appendAsciiStr(o){const t=this._buffer8,e=this._buffer32;let s,r=this._bufferLength,i=0;for(;;){for(s=Math.min(o.length-i,64-r);s--;)t[r++]=o.charCodeAt(i++);if(r<64)break;this._dataLength+=64,p._md5cycle(this._state,e),r=0}return this._bufferLength=r,this}appendByteArray(o){const t=this._buffer8,e=this._buffer32;let s,r=this._bufferLength,i=0;for(;;){for(s=Math.min(o.length-i,64-r);s--;)t[r++]=o[i++];if(r<64)break;this._dataLength+=64,p._md5cycle(this._state,e),r=0}return this._bufferLength=r,this}getState(){const o=this._state;return{buffer:String.fromCharCode.apply(null,Array.from(this._buffer8)),buflen:this._bufferLength,length:this._dataLength,state:[o[0],o[1],o[2],o[3]]}}setState(o){const t=o.buffer,e=o.state,r=this._state;let s;for(this._dataLength=o.length,this._bufferLength=o.buflen,r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],s=0;s<t.length;s+=1)this._buffer8[s]=t.charCodeAt(s)}end(o=!1){const t=this._bufferLength,e=this._buffer8,r=this._buffer32,s=1+(t>>2);this._dataLength+=t;const i=8*this._dataLength;if(e[t]=128,e[t+1]=e[t+2]=e[t+3]=0,r.set(p.buffer32Identity.subarray(s),s),t>55&&(p._md5cycle(this._state,r),r.set(p.buffer32Identity)),i<=4294967295)r[14]=i;else{const _=i.toString(16).match(/(.*?)(.{0,8})$/);if(null===_)return;const k=parseInt(_[2],16),Q=parseInt(_[1],16)||0;r[14]=k,r[15]=Q}return p._md5cycle(this._state,r),o?this._state:p._hex(this._state)}}if(p.stateIdentity=new Int32Array([1732584193,-271733879,-1732584194,271733878]),p.buffer32Identity=new Int32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),p.hexChars="0123456789abcdef",p.hexOut=[],p.onePassHasher=new p,"5d41402abc4b2a76b9719d911017c592"!==p.hashStr("hello"))throw new Error("Md5 self test failed.");var I=b(1626),u=b(9974),l=b(4360),v=b(6354),d=b(345);function y(n,o){if(1&n){const t=a.RV6();a.j41(0,"img",3),a.bIt("error",function(){a.eBV(t);const r=a.XpG();return a.Njj(r.fetchAvatarSource())}),a.k0s()}if(2&n){const t=a.XpG();a.Y8G("src",t.avatarSrc,a.B4B)("alt",t.customAlt?t.customAlt:t.avatarAlt)("width",t.size)("height",t.size)("ngStyle",t.avatarStyle)("referrerPolicy",t.referrerpolicy)}}function f(n,o){if(1&n&&(a.j41(0,"div",5),a.EFF(1),a.k0s()),2&n){const t=a.XpG(2);a.Y8G("ngStyle",t.avatarStyle),a.R7$(),a.SpI(" ",t.avatarText," ")}}function m(n,o){if(1&n&&a.DNE(0,f,2,2,"div",4),2&n){const t=a.XpG();a.Y8G("ngIf",t.avatarText)}}class g{constructor(o){this.sourceId=o}}var c=function(n){return n.FACEBOOK="facebook",n.GOOGLE="google",n.TWITTER="twitter",n.INSTAGRAM="instagram",n.VKONTAKTE="vkontakte",n.SKYPE="skype",n.GRAVATAR="gravatar",n.GITHUB="github",n.CUSTOM="custom",n.INITIALS="initials",n.VALUE="value",n}(c||{});class A{constructor(o){this.sourceId=o,this.sourceType=c.FACEBOOK}getAvatar(o){return`https://graph.facebook.com/${this.sourceId}/picture?width=${o}&height=${o}`}}class S{constructor(o){this.sourceId=o,this.sourceType=c.TWITTER}getAvatar(o){const t=this.getImageSize(o);return`https://twitter.com/${this.sourceId}/profile_image?size=${t}`}getImageSize(o){return o<=24?"mini":o<=48?"normal":o<=73?"bigger":"original"}}class C extends g{constructor(o){super(o),this.sourceType=c.GOOGLE}getAvatar(){return`https://picasaweb.google.com/data/entry/api/user/${this.sourceId}?alt=json`}processResponse(o,t){const e=o.entry.gphoto$thumbnail.$t;return e?e.replace("s64","s"+t):null}}class w extends g{constructor(o){super(o),this.sourceType=c.INSTAGRAM}getAvatar(){return`https://www.instagram.com/${this.sourceId}/?__a=1`}processResponse(o,t){return`${o.graphql.user.profile_pic_url_hd}&s=${t}`}}class N{constructor(o){this.sourceId=o,this.sourceType=c.CUSTOM}getAvatar(){return this.sourceId}}class L{constructor(o){this.sourceId=o,this.sourceType=c.INITIALS}getAvatar(o){return this.getInitials(this.sourceId,o)}getInitials(o,t){if(!(o=o.trim()))return"";const e=o.split(" ");return this.constructInitials(t&&t<e.length?e.slice(0,t):e)}constructInitials(o){return o&&o.length?o.filter(t=>t&&t.length>0).map(t=>t[0].toUpperCase()).join(""):""}}class H{constructor(o){this.value=o,this.sourceType=c.GRAVATAR,this.sourceId=o.match("^[a-f0-9]{32}$")?o:p.hashStr(o).toString()}getAvatar(o){const t=function $(){return!!(typeof window<"u"&&null!==window&&(window.devicePixelRatio>1.25||window.matchMedia&&window.matchMedia("(-webkit-min-device-pixel-ratio: 1.25), (min--moz-device-pixel-ratio: 1.25), (-o-min-device-pixel-ratio: 5/4), (min-resolution: 1.25dppx)").matches))}()?2*o:o;return`https://secure.gravatar.com/avatar/${this.sourceId}?s=${t}&d=404`}}class j{constructor(o){this.sourceId=o,this.sourceType=c.SKYPE}getAvatar(){return`https://api.skype.com/users/${this.sourceId}/profile/avatar`}}class G{constructor(o){this.sourceId=o,this.sourceType=c.VALUE}getAvatar(){return this.sourceId}}class B extends g{constructor(o){super(o),this.sourceType=c.VKONTAKTE}getAvatar(o){const t=this.getImageSize(o);return`https://api.vk.com/method/users.get?user_id=${this.sourceId}&v=5.8&fields=${t}`}processResponse(o){const t=Object.keys(o.response[0]).pop();return t&&o.response[0][t]||null}getImageSize(o){return o<=50?"photo_50":o<=100?"photo_100":o<=200?"photo_200":"photo_max"}}class V extends g{constructor(o){super(o),this.sourceType=c.GITHUB}getAvatar(){return`https://api.github.com/users/${this.sourceId}`}processResponse(o,t){return t?`${o.avatar_url}&s=${t}`:o.avatar_url}}const F=new a.nKC("avatar.config");let O=(()=>{class n{constructor(t){this.userConfig=t}getAvatarSources(t){if(this.userConfig&&this.userConfig.sourcePriorityOrder&&this.userConfig.sourcePriorityOrder.length){const r=[...new Set(this.userConfig.sourcePriorityOrder)].filter(s=>t.includes(s));return[...r,...t.filter(s=>!r.includes(s))]}return t}getAvatarColors(t){return this.userConfig&&this.userConfig.colors&&this.userConfig.colors.length&&this.userConfig.colors||t}getDisableSrcCache(t){return null==this.userConfig||null==this.userConfig.disableSrcCache?t:this.userConfig.disableSrcCache}static{this.\u0275fac=function(e){return new(e||n)(a.KVO(F,8))}}static{this.\u0275prov=a.jDH({token:n,factory:n.\u0275fac,providedIn:"root"})}}return n})();const M=[c.FACEBOOK,c.GOOGLE,c.TWITTER,c.INSTAGRAM,c.VKONTAKTE,c.SKYPE,c.GRAVATAR,c.GITHUB,c.CUSTOM,c.INITIALS,c.VALUE],R=["#1abc9c","#3498db","#f1c40f","#8e44ad","#e74c3c","#d35400","#2c3e50","#7f8c8d"];let D=(()=>{class n{constructor(t,e){this.http=t,this.avatarConfigService=e,this.avatarSources=M,this.avatarColors=R,this.failedSources=new Map,this.overrideAvatarSources(),this.overrideAvatarColors()}fetchAvatar(t){return this.http.get(t)}getRandomColor(t){if(!t)return"transparent";const e=this.calculateAsciiCode(t);return this.avatarColors[e%this.avatarColors.length]}
1compareSources(t,e){return this.getSourcePriority(t)-this.getSourcePriority(e)}isSource(t){return this.avatarSources.includes(t)}isTextAvatar(t){return[c.INITIALS,c.VALUE].includes(t)}buildSourceKey(t){return t.sourceType+"-"+t.sourceId}sourceHasFailedBefore(t){return this.failedSources.has(this.buildSourceKey(t))}markSourceAsFailed(t){this.failedSources.set(this.buildSourceKey(t),t)}overrideAvatarSources(){this.avatarSources=this.avatarConfigService.getAvatarSources(M)}overrideAvatarColors(){this.avatarColors=this.avatarConfigService.getAvatarColors(R)}calculateAsciiCode(t){return t.split("").map(e=>e.charCodeAt(0)).reduce((e,r)=>e+r)}getSourcePriority(t){return this.avatarSources.indexOf(t)}static{this.\u0275fac=function(e){return new(e||n)(a.KVO(I.Qq),a.KVO(O))}}static{this.\u0275prov=a.jDH({token:n,factory:n.\u0275fac,providedIn:"root"})}}return n})();class W{constructor(o){this.sourceId=o,this.sourceType=c.CUSTOM}getAvatar(){const o=Math.random();return`${this.sourceId}${this.sourceId.indexOf("?")>-1?"&":"?"}_=${o}`}}let P=(()=>{class n{constructor(t){this.sources={};const e=t.getDisableSrcCache(!1);this.sources[c.FACEBOOK]=A,this.sources[c.TWITTER]=S,this.sources[c.GOOGLE]=C,this.sources[c.INSTAGRAM]=w,this.sources[c.SKYPE]=j,this.sources[c.GRAVATAR]=H,this.sources[c.CUSTOM]=e?W:N,this.sources[c.INITIALS]=L,this.sources[c.VALUE]=G,this.sources[c.VKONTAKTE]=B,this.sources[c.GITHUB]=V}newInstance(t,e){return new this.sources[t](e)}static{this.\u0275fac=function(e){return new(e||n)(a.KVO(O))}}static{this.\u0275prov=a.jDH({token:n,factory:n.\u0275fac,providedIn:"root"})}}return n})(),X=(()=>{class n{constructor(t,e,r){this.sourceFactory=t,this.avatarService=e,this.sanitizer=r,this.round=!0,this.size=50,this.textSizeRatio=3,this.fgColor="#FFF",this.style={},this.cornerRadius=0,this.initialsSize=0,this.clickOnAvatar=new a.bkB,this.isAlive=!0,this.avatarSrc=null,this.avatarAlt=null,this.avatarText=null,this.avatarStyle={},this.hostStyle={},this.currentIndex=-1,this.sources=[]}onAvatarClicked(){this.clickOnAvatar.emit(this.sources[this.currentIndex])}ngOnChanges(t){for(const e in t)if(this.avatarService.isSource(e)){const r=c[e.toUpperCase()],s=t[e].currentValue;if(s&&"string"==typeof s)this.addSource(r,s);else{const i=this.sanitizer.sanitize(a.WPN.URL,s);i?this.addSource(r,i):this.removeSource(r)}}this.initializeAvatar()}fetchAvatarSource(){const t=this.sources[this.currentIndex];t&&this.avatarService.markSourceAsFailed(t);const e=this.findNextSource();e&&(this.avatarService.isTextAvatar(e.sourceType)?(this.buildTextAvatar(e),this.avatarSrc=null):this.buildImageAvatar(e))}findNextSource(){for(;++this.currentIndex<this.sources.length;){const t=this.sources[this.currentIndex];if(t&&!this.avatarService.sourceHasFailedBefore(t))return t}return null}ngOnDestroy(){this.isAlive=!1}initializeAvatar(){this.currentIndex=-1,this.sources.length>0&&(this.sortAvatarSources(),this.fetchAvatarSource(),this.hostStyle={width:this.size+"px",height:this.size+"px"})}sortAvatarSources(){this.sources.sort((t,e)=>this.avatarService.compareSources(t.sourceType,e.sourceType))}buildTextAvatar(t){this.avatarText=t.getAvatar(+this.initialsSize),this.avatarStyle=this.getInitialsStyle(t.sourceId)}buildImageAvatar(t){this.avatarStyle=this.getImageStyle(),t instanceof g?this.fetchAndProcessAsyncAvatar(t):(this.avatarSrc=this.sanitizer.bypassSecurityTrustUrl(t.getAvatar(+this.size)),this.avatarAlt=t.getAvatar(+this.size))}getInitialsStyle(t){return{textAlign:"center",borderRadius:this.round?"100%":this.cornerRadius+"px",border:this.borderColor?"1px solid "+this.borderColor:"",textTransform:"uppercase",color:this.fgColor,backgroundColor:this.bgColor?this.bgColor:this.avatarService.getRandomColor(t),font:Math.floor(+this.size/this.textSizeRatio)+"px Helvetica, Arial, sans-serif",lineHeight:this.size+"px",...this.style}}getImageStyle(){return{maxWidth:"100%",borderRadius:this.round?"50%":this.cornerRadius+"px",border:this.borderColor?"1px solid "+this.borderColor:"",width:this.size+"px",height:this.size+"px",...this.style}}fetchAndProcessAsyncAvatar(t){this.avatarService.sourceHasFailedBefore(t)||this.avatarService.fetchAvatar(t.getAvatar(+this.size)).pipe(function h(n,o=!1){return(0,u.N)((t,e)=>{let r=0;t.subscribe((0,l._)(e,s=>{const i=n(s,r++);(i||o)&&e.next(s),!i&&e.complete()}
1))})}(()=>this.isAlive),(0,v.T)(e=>t.processResponse(e,+this.size))).subscribe({next:e=>this.avatarSrc=e,error:()=>{this.fetchAvatarSource()}})}addSource(t,e){const r=this.sources.find(s=>s.sourceType===t);r?r.sourceId=e:this.sources.push(this.sourceFactory.newInstance(t,e))}removeSource(t){this.sources=this.sources.filter(e=>e.sourceType!==t)}static{this.\u0275fac=function(e){return new(e||n)(a.rXU(P),a.rXU(D),a.rXU(d.up))}}static{this.\u0275cmp=a.VBU({type:n,selectors:[["ngx-avatars"]],inputs:{round:"round",size:"size",textSizeRatio:"textSizeRatio",bgColor:"bgColor",fgColor:"fgColor",borderColor:"borderColor",style:"style",cornerRadius:"cornerRadius",facebook:[a.Mj6.None,"facebookId","facebook"],twitter:[a.Mj6.None,"twitterId","twitter"],google:[a.Mj6.None,"googleId","google"],instagram:[a.Mj6.None,"instagramId","instagram"],vkontakte:[a.Mj6.None,"vkontakteId","vkontakte"],skype:[a.Mj6.None,"skypeId","skype"],gravatar:[a.Mj6.None,"gravatarId","gravatar"],github:[a.Mj6.None,"githubId","github"],custom:[a.Mj6.None,"src","custom"],customAlt:[a.Mj6.None,"alt","customAlt"],initials:[a.Mj6.None,"name","initials"],value:"value",referrerpolicy:"referrerpolicy",placeholder:"placeholder",initialsSize:"initialsSize"},outputs:{clickOnAvatar:"clickOnAvatar"},features:[a.OA$],decls:4,vars:3,consts:[["textAvatar",""],[1,"avatar-container",3,"click","ngStyle"],["class","avatar-content","loading","lazy",3,"src","alt","width","height","ngStyle","referrerPolicy","error",4,"ngIf","ngIfElse"],["loading","lazy",1,"avatar-content",3,"error","src","alt","width","height","ngStyle","referrerPolicy"],["class","avatar-content",3,"ngStyle",4,"ngIf"],[1,"avatar-content",3,"ngStyle"]],template:function(e,r){if(1&e){const s=a.RV6();a.j41(0,"div",1),a.bIt("click",function(){return a.eBV(s),a.Njj(r.onAvatarClicked())}),a.DNE(1,y,1,6,"img",2)(2,m,1,1,"ng-template",null,0,a.C5r),a.k0s()}if(2&e){const s=a.sdS(3);a.Y8G("ngStyle",r.hostStyle),a.R7$(),a.Y8G("ngIf",r.avatarSrc)("ngIfElse",s)}},dependencies:[x.bT,x.B3],styles:["[_nghost-%COMP%]{border-radius:50%}"]})}}return n})(),Y=(()=>{class n{static forRoot(t){return{ngModule:n,providers:[{provide:F,useValue:t||{}}]}}static{this.\u0275fac=function(e){return new(e||n)}}static{this.\u0275mod=a.$C({type:n})}static{this.\u0275inj=a.G2t({providers:[P,D,O],imports:[x.MD]})}}return n})()}}]);
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.