@veltdev/sdk-dev 4.5.0-beta.75 → 4.5.0-beta.77

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/velt.js +3 -3
package/velt.js CHANGED
@@ -1,4 +1,4 @@
1
- var SNIPPYLY_VERSION = '4.5.0-beta.75';
1
+ var SNIPPYLY_VERSION = '4.5.0-beta.77';
2
2
  (function(m,w){"use strict";function rt(){var e=K.splice(0,K.length);for(ie=0;e.length;)e.shift().call(null,e.shift())}function me(e,t){for(var n=0,r=e.length;n<r;n++)Te(e[n],t)}function ot(e){for(var t,n=0,r=e.length;n<r;n++)t=e[n],U(t,q[pe(t)])}function fe(e){return function(t){Lt(t)&&(Te(t,e),L.length&&me(t.querySelectorAll(L),e))}}function pe(e){var t=le.call(e,"is"),n=e.nodeName.toUpperCase(),r=v.call(D,t?Y+t.toUpperCase():x+n);return t&&-1<r&&!De(n,t)?-1:r}function De(e,t){return-1<L.indexOf(e+'[is="'+t+'"]')}function Ie(e){var t=e.currentTarget,n=e.attrChange,r=e.attrName,o=e.target,l=e[W]||2,a=e[He]||3;!ce||o&&o!==t||!t[y]||r==="style"||e.prevValue===e.newValue&&(e.newValue!==""||n!==l&&n!==a)||t[y](r,n===l?null:e.prevValue,n===a?null:e.newValue)}function Fe(e){var t=fe(e);return function(n){K.push(t,n.target),ie&&clearTimeout(ie),ie=setTimeout(rt,1)}}function de(e){nt&&(nt=!1,e.currentTarget.removeEventListener(Ze,de)),L.length&&me((e.target||u).querySelectorAll(L),e.detail===E?E:b),R&&at()}function lt(e,t){var n=this;Ye.call(n,e,t),Me.call(n,{target:n})}function Se(e,t,n){var r=t.apply(e,n),o=pe(r);return-1<o&&U(r,q[o]),n.pop()&&L.length&&ot(r.querySelectorAll(L)),r}function he(e,t){Tt(e,t),$?$.observe(e,gt):(ue&&(e.setAttribute=lt,e[H]=Ee(e),e[g](st,Me)),e[g](N,Ie)),e[k]&&ce&&(e.created=!0,e[k](),e.created=!1)}function at(){for(var e,t=0,n=G.length;t<n;t++)e=G[t],V.contains(e)||(n--,G.splice(t--,1),Te(e,E))}function Ve(e){throw new Error("A "+e+" type is already registered")}function Te(e,t){var n,r,o=pe(e);-1<o&&!Mt.call(e,"TEMPLATE")&&(Q(e,q[o]),o=0,t!==b||e[b]?t!==E||e[E]||(e[b]=!1,e[E]=!0,r="disconnected",o=1):(e[E]=!1,e[b]=!0,r="connected",o=1,R&&v.call(G,e)<0&&G.push(e)),o&&(n=e[t+O]||e[r+O])&&n.call(e))}function z(){}function Pe(e,t,n){var r=n&&n[_]||"",o=t.prototype,l=Ce(o),a=t.observedAttributes||ye,s={prototype:l};oe(l,k,{value:function(){if(te)te=!1;else if(!this[B]){this[B]=!0,new t(this),o[k]&&o[k].call(this);var i=j[ne.get(t)];(!Z||i.create.length>1)&&_e(this)}}}),oe(l,y,{value:function(i){-1<v.call(a,i)&&o[y]&&o[y].apply(this,arguments)}}),o[qe]&&oe(l,ut,{value:o[qe]}),o[Be]&&oe(l,ct,{value:o[Be]}),r&&(s[_]=r),e=e.toUpperCase(),j[e]={constructor:t,create:r?[r,re(e)]:[e]},ne.set(t,e),u[S](e.toLowerCase(),s),Le(e),P[e].r()}function Re(e){var t=j[e.toUpperCase()];return t&&t.constructor}function Ue(e){return typeof e=="string"?e:e&&e.is||""}function _e(e){for(var t,n=e[y],r=n?e.attributes:ye,o=r.length;o--;)t=r[o],n.call(e,t.name||t.nodeName,null,t.value||t.nodeValue)}function Le(e){return e=e.toUpperCase(),e in P||(P[e]={},P[e].p=new Xe(function(t){P[e].r=t})),P[e].p}function ke(){C&&delete m.customElements,I(m,"customElements",{configurable:!0,value:new z}),I(m,"CustomElementRegistry",{configurable:!0,value:z});for(var e=it.get(/^HTML[A-Z]*[a-z]/),t=e.length;t--;function(n){var r=m[n];if(r){m[n]=function(o){var l,a;return o||(o=this),o[B]||(te=!0,l=j[ne.get(o.constructor)],a=Z&&l.create.length===1,o=a?Reflect.construct(r,ye,l.constructor):u.createElement.apply(u,l.create),o[B]=!0,te=!1,a||_e(o)),o},m[n].prototype=r.prototype;try{r.prototype.constructor=m[n]}catch{dt=!0,I(r,B,{value:m[n]})}}}(e[t]));u.createElement=function(n,r){var o=Ue(r);return o?Ae.call(this,n,re(o)):Ae.call(this,n)},et||(Oe=!0,u[S](""))}var u=m.document,T=m.Object,it=function(e){var t,n,r,o,l=/^[A-Z]+[a-z]/,a=function(p){var f,h=[];for(f in i)p.test(f)&&h.push(f);return h},s=function(p,f){(f=f.toLowerCase())in i||(i[p]=(i[p]||[]).concat(f),i[f]=i[f.toUpperCase()]=p)},i=(T.create||T)(null),c={};for(n in e)for(o in e[n])for(r=e[n][o],i[o]=r,t=0;t<r.length;t++)i[r[t].toLowerCase()]=i[r[t].toUpperCase()]=o;return c.get=function(p){return typeof p=="string"?i[p]||(l.test(p)?[]:""):a(p)},c.set=function(p,f){return l.test(p)?s(p,f):s(f,p),c},c}({collections:{HTMLAllCollection:["all"],HTMLCollection:["forms"],HTMLFormControlsCollection:["elements"],HTMLOptionsCollection:["options"]},elements:{Element:["element"],HTMLAnchorElement:["a"],HTMLAppletElement:["applet"],HTMLAreaElement:["area"],HTMLAttachmentElement:["attachment"],HTMLAudioElement:["audio"],HTMLBRElement:["br"],HTMLBaseElement:["base"],HTMLBodyElement:["body"],HTMLButtonElement:["button"],HTMLCanvasElement:["canvas"],HTMLContentElement:["content"],HTMLDListElement:["dl"],HTMLDataElement:["data"],HTMLDataListElement:["datalist"],HTMLDetailsElement:["details"],HTMLDialogElement:["dialog"],HTMLDirectoryElement:["dir"],HTMLDivElement:["div"],HTMLDocument:["document"],HTMLElement:["element","abbr","address","article","aside","b","bdi","bdo","cite","code","command","dd","dfn","dt","em","figcaption","figure","footer","header","i","kbd","mark","nav","noscript","rp","rt","ruby","s","samp","section","small","strong","sub","summary","sup","u","var","wbr"],HTMLEmbedElement:["embed"],HTMLFieldSetElement:["fieldset"],HTMLFontElement:["font"],HTMLFormElement:["form"],HTMLFrameElement:["frame"],HTMLFrameSetElement:["frameset"],HTMLHRElement:["hr"],HTMLHeadElement:["head"],HTMLHeadingElement:["h1","h2","h3","h4","h5","h6"],HTMLHtmlElement:["html"],HTMLIFrameElement:["iframe"],HTMLImageElement:["img"],HTMLInputElement:["input"],HTMLKeygenElement:["keygen"],HTMLLIElement:["li"],HTMLLabelElement:["label"],HTMLLegendElement:["legend"],HTMLLinkElement:["link"],HTMLMapElement:["map"],HTMLMarqueeElement:["marquee"],HTMLMediaElement:["media"],HTMLMenuElement:["menu"],HTMLMenuItemElement:["menuitem"],HTMLMetaElement:["meta"],HTMLMeterElement:["meter"],HTMLModElement:["del","ins"],HTMLOListElement:["ol"],HTMLObjectElement:["object"],HTMLOptGroupElement:["optgroup"],HTMLOptionElement:["option"],HTMLOutputElement:["output"],HTMLParagraphElement:["p"],HTMLParamElement:["param"],HTMLPictureElement:["picture"],HTMLPreElement:["pre"],HTMLProgressElement:["progress"],HTMLQuoteElement:["blockquote","q","quote"],HTMLScriptElement:["script"],HTMLSelectElement:["select"],HTMLShadowElement:["shadow"],HTMLSlotElement:["slot"],HTMLSourceElement:["source"],HTMLSpanElement:["span"],HTMLStyleElement:["style"],HTMLTableCaptionElement:["caption"],HTMLTableCellElement:["td","th"],HTMLTableColElement:["col","colgroup"],HTMLTableElement:["table"],HTMLTableRowElement:["tr"],HTMLTableSectionElement:["thead","tbody","tfoot"],HTMLTemplateElement:["template"],HTMLTextAreaElement:["textarea"],HTMLTimeElement:["time"],HTMLTitleElement:["title"],HTMLTrackElement:["track"],HTMLUListElement:["ul"],HTMLUnknownElement:["unknown","vhgroupv","vkeygen"],HTMLVideoElement:["video"]},nodes:{Attr:["node"],Audio:["audio"],CDATASection:["node"],CharacterData:["node"],Comment:["#comment"],Document:["#document"],DocumentFragment:["#document-fragment"],DocumentType:["node"],HTMLDocument:["#document"],Image:["img"],Option:["option"],ProcessingInstruction:["node"],ShadowRoot:["#shadow-root"],Text:["#text"],XMLDocument:["xml"]}});typeof w!="object"&&(w={type:w||"auto"});var K,Me,X,Ee,$,ve,Q,U,A,S="registerElement",xe=1e5*m.Math.random()>>0,H="__"+S+xe,g="addEventListener",b="attached",O="Callback",E="detached",_="extends",y="attributeChanged"+O,ut=b+O,qe="connected"+O,Be="disconnected"+O,k="created"+O,ct=E+O,W="ADDITION",He="REMOVAL",N="DOMAttrModified",Ze="DOMContentLoaded",st="DOMSubtreeModified",x="<",Y="=",mt=/^[A-Z][._A-Z0-9]*-[-._A-Z0-9]*$/,ft=["ANNOTATION-XML","COLOR-PROFILE","FONT-FACE","FONT-FACE-SRC","FONT-FACE-URI","FONT-FACE-FORMAT","FONT-FACE-NAME","MISSING-GLYPH"],D=[],q=[],L="",V=u.documentElement,v=D.indexOf||function(e){for(var t=this.length;t--&&this[t]!==e;);return t},ge=T.prototype,be=ge.hasOwnProperty,J=ge.isPrototypeOf,I=T.defineProperty,ye=[],ee=T.getOwnPropertyDescriptor,je=T.getOwnPropertyNames,pt=T.getPrototypeOf,Ge=T.setPrototypeOf,ze=!!T.__proto__,dt=!1,B="__dreCEv1",C=m.customElements,Z=!/^force/.test(w.type)&&!!(C&&C.define&&C.get&&C.whenDefined),Ke=T.create||T,ht=m.Map||function(){var e,t=[],n=[];return{get:function(r){return n[v.call(t,r)]},set:function(r,o){e=v.call(t,r),e<0?n[t.push(r)-1]=o:n[e]=o}}},Xe=m.Promise||function(e){function t(l){for(r=!0;n.length;)n.shift()(l)}var n=[],r=!1,o={catch:function(){return o},then:function(l){return n.push(l),r&&setTimeout(t,1),o}};return e(t),o},te=!1,j=Ke(null),P=Ke(null),ne=new ht,re=function(e){return e.toLowerCase()},Ce=T.create||function e(t){return t?(e.prototype=t,new e):this},Tt=Ge||(ze?function(e,t){return e.__proto__=t,e}:je&&ee?function(){function e(t,n){for(var r,o=je(n),l=0,a=o.length;l<a;l++)r=o[l],be.call(t,r)||I(t,r,ee(n,r))}return function(t,n){do e(t,n);while((n=pt(n))&&!J.call(n,t));return t}}():function(e,t){for(var n in t)e[n]=t[n];return e}),F=m.MutationObserver||m.WebKitMutationObserver,$e=m.HTMLAnchorElement,d=(m.HTMLElement||m.Element||m.Node).prototype,R=!J.call(d,V),oe=R?function(e,t,n){return e[t]=n.value,e}:I,Lt=R?function(e){return e.nodeType===1}:function(e){return J.call(d,e)},G=R&&[],Qe=d.attachShadow,We=d.cloneNode,Mt=d.closest||function(e){for(var t=this;t&&t.nodeName!==e;)t=t.parentNode;return t},we=d.dispatchEvent,le=d.getAttribute,Et=d.hasAttribute,vt=d.removeAttribute,Ye=d.setAttribute,ae=u.createElement,Ht=u.importNode,Ae=ae,gt=F&&{attributes:!0,characterData:!0,attributeOldValue:!0},Je=F||function(e){ue=!1,V.removeEventListener(N,Je)},ie=0,et=S in u&&!/^force-all/.test(w.type),tt=!0,Oe=!1,ue=!0,nt=!0,ce=!0;if(F&&(A=u.createElement("div"),A.innerHTML="<div><div></div></div>",new F(function(e,t){if(e[0]&&e[0].type=="childList"&&!e[0].removedNodes[0].childNodes.length){A=ee(d,"innerHTML");var n=A&&A.set;n&&I(d,"innerHTML",{set:function(r){for(;this.lastChild;)this.removeChild(this.lastChild);n.call(this,r)}})}t.disconnect(),A=null}).observe(A,{childList:!0,subtree:!0}),A.innerHTML=""),et||(Ge||ze?(Q=function(e,t){J.call(t,e)||he(e,t)},U=he):(Q=function(e,t){e[H]||(e[H]=T(!0),he(e,t))},U=Q),R?(ue=!1,function(){var e=ee(d,g),t=e.value,n=function(l){var a=new CustomEvent(N,{bubbles:!0});a.attrName=l,a.prevValue=le.call(this,l),a.newValue=null,a[He]=a.attrChange=2,vt.call(this,l),we.call(this,a)},r=function(l,a){var s=Et.call(this,l),i=s&&le.call(this,l),c=new CustomEvent(N,{bubbles:!0});Ye.call(this,l,a),c.attrName=l,c.prevValue=s?i:null,c.newValue=a,s?c.MODIFICATION=c.attrChange=1:c[W]=c.attrChange=0,we.call(this,c)},o=function(l){var a,s=l.currentTarget,i=s[H],c=l.propertyName;i.hasOwnProperty(c)&&(i=i[c],a=new CustomEvent(N,{bubbles:!0}),a.attrName=i.name,a.prevValue=i.value||null,a.newValue=i.value=s[c]||null,a.prevValue==null?a[W]=a.attrChange=0:a.MODIFICATION=a.attrChange=1,we.call(s,a))};e.value=function(l,a,s){l===N&&this[y]&&this.setAttribute!==r&&(this[H]={className:{name:"class",value:this.className}},this.setAttribute=r,this.removeAttribute=n,t.call(this,"propertychange",o)),t.call(this,l,a,s)},I(d,g,e)}()):F||(V[g](N,Je),V.setAttribute(H,1),V.removeAttribute(H),ue&&(Me=function(e){var t,n,r,o=this;if(o===e.target){t=o[H],o[H]=n=Ee(o);for(r in n){if(!(r in t))return X(0,o,r,t[r],n[r],W);if(n[r]!==t[r])return X(1,o,r,t[r],n[r],"MODIFICATION")}for(r in t)if(!(r in n))return X(2,o,r,t[r],n[r],He)}},X=function(e,t,n,r,o,l){var a={attrChange:e,currentTarget:t,attrName:n,prevValue:r,newValue:o};a[l]=e,Ie(a)},Ee=function(e){for(var t,n,r={},o=e.attributes,l=0,a=o.length;l<a;l++)t=o[l],(n=t.name)!=="setAttribute"&&(r[n]=t.value);return r})),u[S]=function(e,t){if(n=e.toUpperCase(),tt&&(tt=!1,F?($=function(i,c){function p(f,h){for(var M=0,se=f.length;M<se;h(f[M++]));}return new F(function(f){for(var h,M,se,Ne=0,bt=f.length;Ne<bt;Ne++)h=f[Ne],h.type==="childList"?(p(h.addedNodes,i),p(h.removedNodes,c)):(M=h.target,ce&&M[y]&&h.attributeName!=="style"&&(se=le.call(M,h.attributeName))!==h.oldValue&&M[y](h.attributeName,h.oldValue,se))})}(fe(b),fe(E)),ve=function(i){return $.observe(i,{childList:!0,subtree:!0}),i},ve(u),Qe&&(d.attachShadow=function(){return ve(Qe.apply(this,arguments))})):(K=[],u[g]("DOMNodeInserted",Fe(b)),u[g]("DOMNodeRemoved",Fe(E))),u[g](Ze,de),u[g]("readystatechange",de),u.importNode=function(i,c){switch(i.nodeType){case 1:return Se(u,Ht,[i,!!c]);case 11:for(var p=u.createDocumentFragment(),f=i.childNodes,h=f.length,M=0;M<h;M++)p.appendChild(u.importNode(f[M],!!c));return p;default:return We.call(i,!!c)}},d.cloneNode=function(i){return Se(this,We,[!!i])}),Oe)return Oe=!1;if(-2<v.call(D,Y+n)+v.call(D,x+n)&&Ve(e),!mt.test(n)||-1<v.call(ft,n))throw new Error("The type "+e+" is invalid");var n,r,o=function(){return a?u.createElement(s,n):u.createElement(s)},l=t||ge,a=be.call(l,_),s=a?t[_].toUpperCase():n;return a&&-1<v.call(D,x+s)&&Ve(s),r=D.push((a?Y:x)+n)-1,L=L.concat(L.length?",":"",a?s+'[is="'+e.toLowerCase()+'"]':s),o.prototype=q[r]=be.call(l,"prototype")?l.prototype:Ce(d),L.length&&me(u.querySelectorAll(L),b),o},u.createElement=Ae=function(e,t){var n=Ue(t),r=n?ae.call(u,e,re(n)):ae.call(u,e),o=""+e,l=v.call(D,(n?Y:x)+(n||o).toUpperCase()),a=-1<l;return n&&(r.setAttribute("is",n=n.toLowerCase()),a&&(a=De(o.toUpperCase(),n))),ce=!u.createElement.innerHTMLHelper,a&&U(r,q[l]),r}),addEventListener("beforeunload",function(){delete u.createElement,delete u.importNode,delete u[S]},!1),z.prototype={constructor:z,define:Z?function(e,t,n){if(n)Pe(e,t,n);else{var r=e.toUpperCase();j[r]={constructor:t,create:[r]},ne.set(t,r),C.define(e,t)}}:Pe,get:Z?function(e){return C.get(e)||Re(e)}:Re,whenDefined:Z?function(e){return Xe.race([C.whenDefined(e),Le(e)])}:Le},!C||/^force/.test(w.type))ke();else if(!w.noBuiltIn)try{(function(e,t,n){var r=new RegExp(`^<a\\s+is=('|")`+n+"\\1></a>$");if(t[_]="a",e.prototype=Ce($e.prototype),e.prototype.constructor=e,m.customElements.define(n,e,t),!r.test(u.createElement("a",{is:n}).outerHTML)||!r.test(new e().outerHTML))throw t})(function e(){return Reflect.construct($e,[],e)},{},"document-register-element-a"+xe)}catch{ke()}if(!w.noBuiltIn)try{if(ae.call(u,"a","a").outerHTML.indexOf("is")<0)throw{}}catch{re=function(t){return{is:t.toLowerCase()}}}})(window);
3
3
 
4
4
  var N0e=Object.create;var Tw=Object.defineProperty,F0e=Object.defineProperties,L0e=Object.getOwnPropertyDescriptor,B0e=Object.getOwnPropertyDescriptors,V0e=Object.getOwnPropertyNames,xw=Object.getOwnPropertySymbols,xG=Object.getPrototypeOf,S7=Object.prototype.hasOwnProperty,TG=Object.prototype.propertyIsEnumerable,U0e=Reflect.get;var EG=(n,o,t)=>o in n?Tw(n,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[o]=t,I=(n,o)=>{for(var t in o||={})S7.call(o,t)&&EG(n,t,o[t]);if(xw)for(var t of xw(o))TG.call(o,t)&&EG(n,t,o[t]);return n},T=(n,o)=>F0e(n,B0e(o));var b7=(n,o)=>{var t={};for(var e in n)S7.call(n,e)&&o.indexOf(e)<0&&(t[e]=n[e]);if(n!=null&&xw)for(var e of xw(n))o.indexOf(e)<0&&TG.call(n,e)&&(t[e]=n[e]);return t};var j0e=(n,o)=>()=>(o||n((o={exports:{}}).exports,o),o.exports),Dw=(n,o)=>{for(var t in o)Tw(n,t,{get:o[t],enumerable:!0})},$0e=(n,o,t,e)=>{if(o&&typeof o=="object"||typeof o=="function")for(let i of V0e(o))!S7.call(n,i)&&i!==t&&Tw(n,i,{get:()=>o[i],enumerable:!(e=L0e(o,i))||e.enumerable});return n};var DG=(n,o,t)=>(t=n!=null?N0e(xG(n)):{},$0e(o||!n||!n.__esModule?Tw(t,"default",{value:n,enumerable:!0}):t,n));var $d=(n,o,t)=>U0e(xG(n),t,o);var Q=(n,o,t)=>new Promise((e,i)=>{var r=m=>{try{s(t.next(m))}catch(p){i(p)}},a=m=>{try{s(t.throw(m))}catch(p){i(p)}},s=m=>m.done?e(m.value):Promise.resolve(m.value).then(r,a);s((t=t.apply(n,o)).next())});var Hz=j0e((fro,$z)=>{"use strict";var yt={};yt.generateIdentifier=function(){return Math.random().toString(36).substring(2,12)};yt.localCName=yt.generateIdentifier();yt.splitLines=function(n){return n.trim().split(`
@@ -192,7 +192,7 @@ This typically indicates that your device does not have a healthy Internet conne
192
192
  <img src="${o||this.thumbnailWithPlayIconUrl||this.thumbnailUrl}" />
193
193
  </a>
194
194
  `}};var zp=class{constructor(){this.type="recorder",this.recordingType="audio",this.mode="floating",this.attachment=null,this.attachments=[],this.pageInfo=new Ji}};var hM=class{constructor(){this.type="rewriter",this.rewriterType="copywriter",this.pageInfo=new Ji}};var ob=class{constructor(){this.screenWidth=0,this.screenHeight=0,this.screenScrollHeight=0}};var Gp=class{constructor(){this.pageInfo=new Ji}},rb=function(n){return n.Start="start",n.End="end",n}(rb||{}),Xv=function(n){return n.Avatar="avatar",n.Label="label",n}(Xv||{});var fM=class{constructor(){this.sources=[],this.playerState=new ab}},ab=class{constructor(){this.volume=1}};var sb=class{constructor(){this.to=[],this.resolved=!1,this.type="tag",this.pageInfo=new Ji}};var Wp=class{constructor(){this.visibility="private"}};var vM=class{constructor(){this.reactions=[],this.type="reaction",this.pageInfo=new Ji,this.isReactionResolverUsed=!1}};var CM=class{};var jt=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.analyticsService=i,this.config$=new Ce(null),this.disableLogsConfig$=new Ce({warnings:!0,suppressAll:!1}),this.apiKey$=new Ce(""),this.baseFeatureAllowList=[],this.sf$=new Ce(!1),this.sdkType$=new Ce("core"),this.logsEnabled$=new Ce(!0);try{this.analyticsService.setConfigService(this),this.sdkType$.subscribe(r=>{this.analyticsService.updateDefaultProperties({sdkType:r})},r=>{this.loggingService.catch("Error in ConfigService sdkType$: ",r)}),this.logsEnabled$.subscribe(r=>{r?this.loggingService.enableLogs():this.loggingService.disableLogs(),dt.logsEnabled=r},r=>{this.loggingService.catch("Error in ConfigService logsEnabled$: ",r)})}catch(r){this.loggingService.catch("Error in ConfigService constructor: ",r)}}initConfig(e){try{e.featureAllowList?.length||(e.featureAllowList=Object.values(ke)),this.baseFeatureAllowList=e.featureAllowList?.slice(),this.config$.next(e)}catch(i){this.loggingService.catch("Error in ConfigService initConfig: ",i)}}setApiKey(e){this.apiKey$.next(e)}getApiKey(){return this.apiKey$.value}getApiKey$(){return this.apiKey$.asObservable()}getConfig(){return this.config$.value}getConfig$(){return this.config$.asObservable()}disableFeatures(e){try{let i=this.config$.value;i&&(e?.length?i.featureAllowList=this.baseFeatureAllowList.filter(r=>!e.includes(r)):i.featureAllowList=this.baseFeatureAllowList.slice()),this.config$.next(i)}catch(i){this.loggingService.catch("Error in ConfigService disableFeatures: ",i)}}setSF(e){try{this.sf$.next(e),this.analyticsService.setSF(e)}catch(i){this.loggingService.catch("Error in ConfigService setSF: ",i)}}getSF(){try{return this.sf$.value}catch(e){return this.loggingService.catch("Error in ConfigService getSF: ",e),!1}}getSF$(){try{return this.sf$.asObservable()}catch(e){return this.loggingService.catch("Error in ConfigService getSF$: ",e),se(!1)}}setSdkType(e){try{this.sdkType$.next(e)}catch(i){this.loggingService.catch("Error in ConfigService setSdkType: ",i)}}getSdkType(){try{return this.sdkType$.value}catch(e){return this.loggingService.catch("Error in ConfigService getSdkType: ",e),"core"}}getSdkType$(){try{return this.sdkType$.asObservable()}catch(e){return this.loggingService.catch("Error in ConfigService getSdkType$: ",e),se("core")}}enableLogs(){try{if(this.logsEnabled$.value===!0)return;this.logsEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in ConfigService enableLogs: ",e)}}disableLogs(e){try{e&&this.disableLogsConfig$.next({warnings:e.warnings??!0,suppressAll:e.suppressAll??!1}),e?.warnings!==!1&&this.logsEnabled$.next(!1)}catch(i){this.loggingService.catch("Error in ConfigService disableLogs: ",i)}}getDisableLogsConfig(){return this.disableLogsConfig$.value}getDisableLogsConfig$(){return this.disableLogsConfig$.asObservable()}getApiProxyDomain(){try{return this.config$.value?.apiProxyDomain}catch(e){this.loggingService.catch("Error in ConfigService getApiProxyDomain: ",e);return}}};o.\u0275fac=function(i){return new(i||o)(J(y),J(Ze))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var ale=(()=>{let o=class o{constructor(e){this.loggingService=e,this.initLocalStorageData()}initLocalStorageData(){this.loggingService.log("%c[WB] Calling FUNCTION: initLocalStorageData","color: green;"),this.getLocalStorageData(),this.getSessionStorageData()}getLocalStorageData(){this.loggingService.log("%c[WB] Calling FUNCTION: getLocalStorageData","color: green;");try{let e=localStorage?.getItem(j.LOCALSTORAGE_DATA_ID);if(e)return JSON.parse(e);{let i=new ih;return this.setLocalStorageData(i),i}}catch(e){return this.loggingService.catch("Error in getLocalStorageData:",e),new ih}}setLocalStorageData(e){this.loggingService.log("%c[WB] Calling FUNCTION: setLocalStorageData","color: green;");try{if(e){let i=JSON.stringify(e);localStorage?.setItem(j.LOCALSTORAGE_DATA_ID,i)}}catch(i){this.loggingService.catch("Error in setLocalStorageData:",i)}}deleteLocalStorageData(){this.loggingService.log("%c[WB] Calling FUNCTION: deleteLocalStorageData","color: green;"),localStorage?.removeItem(j.LOCALSTORAGE_DATA_ID)}getSessionStorageData(){this.loggingService.log("%c[WB] Calling FUNCTION: getSessionStorageData","color: green;");try{let e=sessionStorage?.getItem(j.LOCALSTORAGE_DATA_ID);if(e)return JSON.parse(e);{let i=new ih;return this.setSessionStorageData(i),i}}catch(e){return this.loggingService.catch("Error in getSessionStorageData:",e),new ih}}setSessionStorageData(e){this.loggingService.log("%c[WB] Calling FUNCTION: setSessionStorageData","color: green;");try{if(e){let i=JSON.stringify(e);sessionStorage?.setItem(j.LOCALSTORAGE_DATA_ID,i)}}catch(i){this.loggingService.catch("Error in setSessionStorageData:",i)}}deleteSessionStorageData(){this.loggingService.log("%c[WB] Calling FUNCTION: deleteSessionStorageData","color: green;");try{sessionStorage?.removeItem(j.LOCALSTORAGE_DATA_ID)}catch(e){this.loggingService.catch("Error in deleteSessionStorageData:",e)}}};o.\u0275fac=function(i){return new(i||o)(J(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Dm=(()=>{let o=class o{constructor(e,i){this.localStorageService=e,this.loggingService=i,this.avatarList=[{userId:"1",name:"Bear",photoUrl:"https://snippyly.com/assets/avatars/avatar-bear.svg",type:"anonymous"},{userId:"2",name:"Beaver",photoUrl:"https://snippyly.com/assets/avatars/avatar-beaver.svg",type:"anonymous"},{userId:"3",name:"Bunny",photoUrl:"https://snippyly.com/assets/avatars/avatar-bunny.svg",type:"anonymous"},{userId:"4",name:"Cat",photoUrl:"https://snippyly.com/assets/avatars/avatar-cat.svg",type:"anonymous"},{userId:"5",name:"Cow",photoUrl:"https://snippyly.com/assets/avatars/avatar-cow.svg",type:"anonymous"},{userId:"6",name:"Dinosaur",photoUrl:"https://snippyly.com/assets/avatars/avatar-dinosaur.svg",type:"anonymous"},{userId:"7",name:"Elephant",photoUrl:"https://snippyly.com/assets/avatars/avatar-elephant.svg",type:"anonymous"},{userId:"8",name:"Monkey",photoUrl:"https://snippyly.com/assets/avatars/avatar-monkey.svg",type:"anonymous"},{userId:"9",name:"Hedgehog",photoUrl:"https://snippyly.com/assets/avatars/avatar-hedgehog.svg",type:"anonymous"},{userId:"10",name:"Hippo",photoUrl:"https://snippyly.com/assets/avatars/avatar-hippo.svg",type:"anonymous"},{userId:"11",name:"Horse",photoUrl:"https://snippyly.com/assets/avatars/avatar-horse.svg",type:"anonymous"},{userId:"12",name:"Kitten",photoUrl:"https://snippyly.com/assets/avatars/avatar-kitten.svg",type:"anonymous"},{userId:"13",name:"Octopus",photoUrl:"https://snippyly.com/assets/avatars/avatar-octopus.svg",type:"anonymous"},{userId:"14",name:"Oink",photoUrl:"https://snippyly.com/assets/avatars/avatar-oink.svg",type:"anonymous"},{userId:"15",name:"Panda",photoUrl:"https://snippyly.com/assets/avatars/avatar-panda.svg",type:"anonymous"},{userId:"16",name:"Penguin",photoUrl:"https://snippyly.com/assets/avatars/avatar-penguin.svg",type:"anonymous"},{userId:"17",name:"Rabbit",photoUrl:"https://snippyly.com/assets/avatars/avatar-rabbit.svg",type:"anonymous"},{userId:"18",name:"Tiger",photoUrl:"https://snippyly.com/assets/avatars/avatar-tiger.svg",type:"anonymous"}],this.loggingService.log("%c[WB] Creating SERVICE AvatarService","color: blue;")}getSessionAvatar(){this.loggingService.log("%c[WB] Calling FUNCTION: getSessionAvatar","color: green;");try{let e=new wo,i=this.localStorageService.getSessionStorageData();if(i.snippylyAvatar)e=i.snippylyAvatar;else{let r=this.generateUserAvatar();i.snippylyAvatar=r,this.localStorageService.setSessionStorageData(i)}return e}catch(e){return this.loggingService.catch("Error in getSessionAvatar:",e),new wo}}generateUserAvatar(){this.loggingService.log("%c[WB] Calling FUNCTION: generateUserAvatar","color: green;");try{let e=Math.floor(Math.random()*this.avatarList.length),i=this.avatarList[e];return i.color=this.generateUserColor(),i}catch(e){return this.loggingService.catch("Error in generateUserAvatar:",e),this.avatarList[0]}}generateUserColor(e){this.loggingService.log("%c[WB] Calling FUNCTION: generateUserColor","color: green;");try{if(e)return j.AVATAR_COLOR_LIST[e%j.AVATAR_COLOR_LIST.length];let i=Math.floor(Math.random()*j.AVATAR_COLOR_LIST.length);return j.AVATAR_COLOR_LIST[i]}catch(i){return this.loggingService.catch("Error in generateUserColor:",i),""}}generateUserImage(){this.loggingService.log("%c[WB] Calling FUNCTION: generateUserImage","color: green;");try{return this.getSessionAvatar().photoUrl}catch(e){return this.loggingService.catch("Error in generateUserImage:",e),""}}};o.\u0275fac=function(i){return new(i||o)(J(ale),J(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var wm=(()=>{let o=class o{constructor(e){this.loggingService=e,this.actionSubjects=new Map,this.subscriptions=[]}triggerAction(e,i){try{this.actionSubjects.has(e)||this.actionSubjects.set(e,new Ke),this.actionSubjects.get(e)?.next(i)}catch(r){this.loggingService.catch("Error in CoreActionsService triggerAction: ",r)}}onAction(e){try{return this.actionSubjects.has(e)||this.actionSubjects.set(e,new Ke),this.actionSubjects.get(e)?.asObservable()}catch(i){return this.loggingService.catch("Error in CoreActionsService onAction: ",i),se(null)}}};o.\u0275fac=function(i){return new(i||o)(J(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var{entries:fle,setPrototypeOf:sle,isFrozen:h7e,getPrototypeOf:f7e,getOwnPropertyDescriptor:v7e}=Object,{freeze:Xa,seal:Al,create:vle}=Object,{apply:gH,construct:uH}=typeof Reflect<"u"&&Reflect;Xa||(Xa=function(o){return o});Al||(Al=function(o){return o});gH||(gH=function(o,t,e){return o.apply(t,e)});uH||(uH=function(o,t){return new o(...t)});var yM=Qa(Array.prototype.forEach),C7e=Qa(Array.prototype.lastIndexOf),lle=Qa(Array.prototype.pop),cb=Qa(Array.prototype.push),_7e=Qa(Array.prototype.splice),bM=Qa(String.prototype.toLowerCase),lH=Qa(String.prototype.toString),cle=Qa(String.prototype.match),mb=Qa(String.prototype.replace),y7e=Qa(String.prototype.indexOf),S7e=Qa(String.prototype.trim),Tc=Qa(Object.prototype.hasOwnProperty),Za=Qa(RegExp.prototype.test),db=b7e(TypeError);function Qa(n){return function(o){o instanceof RegExp&&(o.lastIndex=0);for(var t=arguments.length,e=new Array(t>1?t-1:0),i=1;i<t;i++)e[i-1]=arguments[i];return gH(n,o,e)}}function b7e(n){return function(){for(var o=arguments.length,t=new Array(o),e=0;e<o;e++)t[e]=arguments[e];return uH(n,t)}}function ni(n,o){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:bM;sle&&sle(n,null);let e=o.length;for(;e--;){let i=o[e];if(typeof i=="string"){let r=t(i);r!==i&&(h7e(o)||(o[e]=r),i=r)}n[i]=!0}return n}function I7e(n){for(let o=0;o<n.length;o++)Tc(n,o)||(n[o]=null);return n}function oh(n){let o=vle(null);for(let[t,e]of fle(n))Tc(n,t)&&(Array.isArray(e)?o[t]=I7e(e):e&&typeof e=="object"&&e.constructor===Object?o[t]=oh(e):o[t]=e);return o}function pb(n,o){for(;n!==null;){let e=v7e(n,o);if(e){if(e.get)return Qa(e.get);if(typeof e.value=="function")return Qa(e.value)}n=f7e(n)}function t(){return null}return t}var mle=Xa(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),cH=Xa(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),mH=Xa(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),E7e=Xa(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),dH=Xa(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),x7e=Xa(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),dle=Xa(["#text"]),ple=Xa(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),pH=Xa(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),gle=Xa(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),SM=Xa(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),T7e=Al(/\{\{[\w\W]*|[\w\W]*\}\}/gm),D7e=Al(/<%[\w\W]*|[\w\W]*%>/gm),w7e=Al(/\$\{[\w\W]*/gm),O7e=Al(/^data-[\-\w.\u00B7-\uFFFF]+$/),A7e=Al(/^aria-[\-\w]+$/),Cle=Al(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),P7e=Al(/^(?:\w+script|data):/i),M7e=Al(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),_le=Al(/^html$/i),k7e=Al(/^[a-z][.\w]*(-[.\w]+)+$/i),ule=Object.freeze({__proto__:null,ARIA_ATTR:A7e,ATTR_WHITESPACE:M7e,CUSTOM_ELEMENT:k7e,DATA_ATTR:O7e,DOCTYPE_NAME:_le,ERB_EXPR:D7e,IS_ALLOWED_URI:Cle,IS_SCRIPT_OR_DATA:P7e,MUSTACHE_EXPR:T7e,TMPLIT_EXPR:w7e}),gb={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},R7e=function(){return typeof window>"u"?null:window},N7e=function(o,t){if(typeof o!="object"||typeof o.createPolicy!="function")return null;let e=null,i="data-tt-policy-suffix";t&&t.hasAttribute(i)&&(e=t.getAttribute(i));let r="dompurify"+(e?"#"+e:"");try{return o.createPolicy(r,{createHTML(a){return a},createScriptURL(a){return a}})}catch{return console.warn("TrustedTypes policy "+r+" could not be created."),null}},hle=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function yle(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:R7e(),o=Yt=>yle(Yt);if(o.version="3.2.5",o.removed=[],!n||!n.document||n.document.nodeType!==gb.document||!n.Element)return o.isSupported=!1,o;let{document:t}=n,e=t,i=e.currentScript,{DocumentFragment:r,HTMLTemplateElement:a,Node:s,Element:m,NodeFilter:p,NamedNodeMap:h=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:_,DOMParser:E,trustedTypes:D}=n,L=m.prototype,H=pb(L,"cloneNode"),K=pb(L,"remove"),oe=pb(L,"nextSibling"),ue=pb(L,"childNodes"),be=pb(L,"parentNode");if(typeof a=="function"){let Yt=t.createElement("template");Yt.content&&Yt.content.ownerDocument&&(t=Yt.content.ownerDocument)}let Le,qe="",{implementation:Re,createNodeIterator:_e,createDocumentFragment:Ee,getElementsByTagName:Oe}=t,{importNode:ye}=e,fe=hle();o.isSupported=typeof fle=="function"&&typeof be=="function"&&Re&&Re.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:Be,ERB_EXPR:xe,TMPLIT_EXPR:wn,DATA_ATTR:$t,ARIA_ATTR:ft,IS_SCRIPT_OR_DATA:Ot,ATTR_WHITESPACE:Mt,CUSTOM_ELEMENT:ln}=ule,{IS_ALLOWED_URI:no}=ule,oi=null,Ri=ni({},[...mle,...cH,...mH,...dH,...dle]),pn=null,_i=ni({},[...ple,...pH,...gle,...SM]),Ni=Object.seal(vle(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),zm=null,vo=null,ol=!0,$r=!0,rl=!1,Ll=!0,kc=!1,fg=!0,Bl=!1,vg=!1,fh=!1,Gm=!1,vh=!1,Cg=!1,g_=!0,Ch=!1,cw="user-content-",u_=!0,Wm=!1,Rc={},Nc=null,wr=ni({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),Hr=null,_g=ni({},["audio","video","img","source","image","track"]),_h=null,h_=ni({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),yh="http://www.w3.org/1998/Math/MathML",Fc="http://www.w3.org/2000/svg",al="http://www.w3.org/1999/xhtml",qm=al,yg=!1,f_=null,g7=ni({},[yh,Fc,al],lH),Vd=ni({},["mi","mo","mn","ms","mtext"]),Sg=ni({},["annotation-xml"]),mw=ni({},["title","style","font","a","script"]),Vl=null,v_=["application/xhtml+xml","text/html"],C_="text/html",Co=null,Ym=null,Sh=t.createElement("form"),__=function(Ve){return Ve instanceof RegExp||Ve instanceof Function},Km=function(){let Ve=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Ym&&Ym===Ve)){if((!Ve||typeof Ve!="object")&&(Ve={}),Ve=oh(Ve),Vl=v_.indexOf(Ve.PARSER_MEDIA_TYPE)===-1?C_:Ve.PARSER_MEDIA_TYPE,Co=Vl==="application/xhtml+xml"?lH:bM,oi=Tc(Ve,"ALLOWED_TAGS")?ni({},Ve.ALLOWED_TAGS,Co):Ri,pn=Tc(Ve,"ALLOWED_ATTR")?ni({},Ve.ALLOWED_ATTR,Co):_i,f_=Tc(Ve,"ALLOWED_NAMESPACES")?ni({},Ve.ALLOWED_NAMESPACES,lH):g7,_h=Tc(Ve,"ADD_URI_SAFE_ATTR")?ni(oh(h_),Ve.ADD_URI_SAFE_ATTR,Co):h_,Hr=Tc(Ve,"ADD_DATA_URI_TAGS")?ni(oh(_g),Ve.ADD_DATA_URI_TAGS,Co):_g,Nc=Tc(Ve,"FORBID_CONTENTS")?ni({},Ve.FORBID_CONTENTS,Co):wr,zm=Tc(Ve,"FORBID_TAGS")?ni({},Ve.FORBID_TAGS,Co):{},vo=Tc(Ve,"FORBID_ATTR")?ni({},Ve.FORBID_ATTR,Co):{},Rc=Tc(Ve,"USE_PROFILES")?Ve.USE_PROFILES:!1,ol=Ve.ALLOW_ARIA_ATTR!==!1,$r=Ve.ALLOW_DATA_ATTR!==!1,rl=Ve.ALLOW_UNKNOWN_PROTOCOLS||!1,Ll=Ve.ALLOW_SELF_CLOSE_IN_ATTR!==!1,kc=Ve.SAFE_FOR_TEMPLATES||!1,fg=Ve.SAFE_FOR_XML!==!1,Bl=Ve.WHOLE_DOCUMENT||!1,Gm=Ve.RETURN_DOM||!1,vh=Ve.RETURN_DOM_FRAGMENT||!1,Cg=Ve.RETURN_TRUSTED_TYPE||!1,fh=Ve.FORCE_BODY||!1,g_=Ve.SANITIZE_DOM!==!1,Ch=Ve.SANITIZE_NAMED_PROPS||!1,u_=Ve.KEEP_CONTENT!==!1,Wm=Ve.IN_PLACE||!1,no=Ve.ALLOWED_URI_REGEXP||Cle,qm=Ve.NAMESPACE||al,Vd=Ve.MATHML_TEXT_INTEGRATION_POINTS||Vd,Sg=Ve.HTML_INTEGRATION_POINTS||Sg,Ni=Ve.CUSTOM_ELEMENT_HANDLING||{},Ve.CUSTOM_ELEMENT_HANDLING&&__(Ve.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Ni.tagNameCheck=Ve.CUSTOM_ELEMENT_HANDLING.tagNameCheck),Ve.CUSTOM_ELEMENT_HANDLING&&__(Ve.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Ni.attributeNameCheck=Ve.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),Ve.CUSTOM_ELEMENT_HANDLING&&typeof Ve.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Ni.allowCustomizedBuiltInElements=Ve.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),kc&&($r=!1),vh&&(Gm=!0),Rc&&(oi=ni({},dle),pn=[],Rc.html===!0&&(ni(oi,mle),ni(pn,ple)),Rc.svg===!0&&(ni(oi,cH),ni(pn,pH),ni(pn,SM)),Rc.svgFilters===!0&&(ni(oi,mH),ni(pn,pH),ni(pn,SM)),Rc.mathMl===!0&&(ni(oi,dH),ni(pn,gle),ni(pn,SM))),Ve.ADD_TAGS&&(oi===Ri&&(oi=oh(oi)),ni(oi,Ve.ADD_TAGS,Co)),Ve.ADD_ATTR&&(pn===_i&&(pn=oh(pn)),ni(pn,Ve.ADD_ATTR,Co)),Ve.ADD_URI_SAFE_ATTR&&ni(_h,Ve.ADD_URI_SAFE_ATTR,Co),Ve.FORBID_CONTENTS&&(Nc===wr&&(Nc=oh(Nc)),ni(Nc,Ve.FORBID_CONTENTS,Co)),u_&&(oi["#text"]=!0),Bl&&ni(oi,["html","head","body"]),oi.table&&(ni(oi,["tbody"]),delete zm.tbody),Ve.TRUSTED_TYPES_POLICY){if(typeof Ve.TRUSTED_TYPES_POLICY.createHTML!="function")throw db('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof Ve.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw db('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');Le=Ve.TRUSTED_TYPES_POLICY,qe=Le.createHTML("")}else Le===void 0&&(Le=N7e(D,i)),Le!==null&&typeof qe=="string"&&(qe=Le.createHTML(""));Xa&&Xa(Ve),Ym=Ve}},y_=ni({},[...cH,...mH,...E7e]),zr=ni({},[...dH,...x7e]),dw=function(Ve){let It=be(Ve);(!It||!It.tagName)&&(It={namespaceURI:qm,tagName:"template"});let Gt=bM(Ve.tagName),io=bM(It.tagName);return f_[Ve.namespaceURI]?Ve.namespaceURI===Fc?It.namespaceURI===al?Gt==="svg":It.namespaceURI===yh?Gt==="svg"&&(io==="annotation-xml"||Vd[io]):!!y_[Gt]:Ve.namespaceURI===yh?It.namespaceURI===al?Gt==="math":It.namespaceURI===Fc?Gt==="math"&&Sg[io]:!!zr[Gt]:Ve.namespaceURI===al?It.namespaceURI===Fc&&!Sg[io]||It.namespaceURI===yh&&!Vd[io]?!1:!zr[Gt]&&(mw[Gt]||!y_[Gt]):!!(Vl==="application/xhtml+xml"&&f_[Ve.namespaceURI]):!1},Ca=function(Ve){cb(o.removed,{element:Ve});try{be(Ve).removeChild(Ve)}catch{K(Ve)}},Lc=function(Ve,It){try{cb(o.removed,{attribute:It.getAttributeNode(Ve),from:It})}catch{cb(o.removed,{attribute:null,from:It})}if(It.removeAttribute(Ve),Ve==="is")if(Gm||vh)try{Ca(It)}catch{}else try{It.setAttribute(Ve,"")}catch{}},pw=function(Ve){let It=null,Gt=null;if(fh)Ve="<remove></remove>"+Ve;else{let Ar=cle(Ve,/^[\r\n\t ]+/);Gt=Ar&&Ar[0]}Vl==="application/xhtml+xml"&&qm===al&&(Ve='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+Ve+"</body></html>");let io=Le?Le.createHTML(Ve):Ve;if(qm===al)try{It=new E().parseFromString(io,Vl)}catch{}if(!It||!It.documentElement){It=Re.createDocument(qm,"template",null);try{It.documentElement.innerHTML=yg?qe:io}catch{}}let Or=It.body||It.documentElement;return Ve&&Gt&&Or.insertBefore(t.createTextNode(Gt),Or.childNodes[0]||null),qm===al?Oe.call(It,Bl?"html":"body")[0]:Bl?It.documentElement:Or},gw=function(Ve){return _e.call(Ve.ownerDocument||Ve,Ve,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},Bc=function(Ve){return Ve instanceof _&&(typeof Ve.nodeName!="string"||typeof Ve.textContent!="string"||typeof Ve.removeChild!="function"||!(Ve.attributes instanceof h)||typeof Ve.removeAttribute!="function"||typeof Ve.setAttribute!="function"||typeof Ve.namespaceURI!="string"||typeof Ve.insertBefore!="function"||typeof Ve.hasChildNodes!="function")},uw=function(Ve){return typeof s=="function"&&Ve instanceof s};function Ul(Yt,Ve,It){yM(Yt,Gt=>{Gt.call(o,Ve,It,Ym)})}let bg=function(Ve){let It=null;if(Ul(fe.beforeSanitizeElements,Ve,null),Bc(Ve))return Ca(Ve),!0;let Gt=Co(Ve.nodeName);if(Ul(fe.uponSanitizeElement,Ve,{tagName:Gt,allowedTags:oi}),Ve.hasChildNodes()&&!uw(Ve.firstElementChild)&&Za(/<[/\w!]/g,Ve.innerHTML)&&Za(/<[/\w!]/g,Ve.textContent)||Ve.nodeType===gb.progressingInstruction||fg&&Ve.nodeType===gb.comment&&Za(/<[/\w]/g,Ve.data))return Ca(Ve),!0;if(!oi[Gt]||zm[Gt]){if(!zm[Gt]&&bh(Gt)&&(Ni.tagNameCheck instanceof RegExp&&Za(Ni.tagNameCheck,Gt)||Ni.tagNameCheck instanceof Function&&Ni.tagNameCheck(Gt)))return!1;if(u_&&!Nc[Gt]){let io=be(Ve)||Ve.parentNode,Or=ue(Ve)||Ve.childNodes;if(Or&&io){let Ar=Or.length;for(let Pr=Ar-1;Pr>=0;--Pr){let Os=H(Or[Pr],!0);Os.__removalCount=(Ve.__removalCount||0)+1,io.insertBefore(Os,oe(Ve))}}}return Ca(Ve),!0}return Ve instanceof m&&!dw(Ve)||(Gt==="noscript"||Gt==="noembed"||Gt==="noframes")&&Za(/<\/no(script|embed|frames)/i,Ve.innerHTML)?(Ca(Ve),!0):(kc&&Ve.nodeType===gb.text&&(It=Ve.textContent,yM([Be,xe,wn],io=>{It=mb(It,io," ")}),Ve.textContent!==It&&(cb(o.removed,{element:Ve.cloneNode()}),Ve.textContent=It)),Ul(fe.afterSanitizeElements,Ve,null),!1)},S_=function(Ve,It,Gt){if(g_&&(It==="id"||It==="name")&&(Gt in t||Gt in Sh))return!1;if(!($r&&!vo[It]&&Za($t,It))){if(!(ol&&Za(ft,It))){if(!pn[It]||vo[It]){if(!(bh(Ve)&&(Ni.tagNameCheck instanceof RegExp&&Za(Ni.tagNameCheck,Ve)||Ni.tagNameCheck instanceof Function&&Ni.tagNameCheck(Ve))&&(Ni.attributeNameCheck instanceof RegExp&&Za(Ni.attributeNameCheck,It)||Ni.attributeNameCheck instanceof Function&&Ni.attributeNameCheck(It))||It==="is"&&Ni.allowCustomizedBuiltInElements&&(Ni.tagNameCheck instanceof RegExp&&Za(Ni.tagNameCheck,Gt)||Ni.tagNameCheck instanceof Function&&Ni.tagNameCheck(Gt))))return!1}else if(!_h[It]){if(!Za(no,mb(Gt,Mt,""))){if(!((It==="src"||It==="xlink:href"||It==="href")&&Ve!=="script"&&y7e(Gt,"data:")===0&&Hr[Ve])){if(!(rl&&!Za(Ot,mb(Gt,Mt,"")))){if(Gt)return!1}}}}}}return!0},bh=function(Ve){return Ve!=="annotation-xml"&&cle(Ve,ln)},Ig=function(Ve){Ul(fe.beforeSanitizeAttributes,Ve,null);let{attributes:It}=Ve;if(!It||Bc(Ve))return;let Gt={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:pn,forceKeepAttr:void 0},io=It.length;for(;io--;){let Or=It[io],{name:Ar,namespaceURI:Pr,value:Os}=Or,Zm=Co(Ar),or=Ar==="value"?Os:S7e(Os);if(Gt.attrName=Zm,Gt.attrValue=or,Gt.keepAttr=!0,Gt.forceKeepAttr=void 0,Ul(fe.uponSanitizeAttribute,Ve,Gt),or=Gt.attrValue,Ch&&(Zm==="id"||Zm==="name")&&(Lc(Ar,Ve),or=cw+or),fg&&Za(/((--!?|])>)|<\/(style|title)/i,or)){Lc(Ar,Ve);continue}if(Gt.forceKeepAttr||(Lc(Ar,Ve),!Gt.keepAttr))continue;if(!Ll&&Za(/\/>/i,or)){Lc(Ar,Ve);continue}kc&&yM([Be,xe,wn],Ih=>{or=mb(or,Ih," ")});let Uc=Co(Ve.nodeName);if(S_(Uc,Zm,or)){if(Le&&typeof D=="object"&&typeof D.getAttributeType=="function"&&!Pr)switch(D.getAttributeType(Uc,Zm)){case"TrustedHTML":{or=Le.createHTML(or);break}case"TrustedScriptURL":{or=Le.createScriptURL(or);break}}try{Pr?Ve.setAttributeNS(Pr,Ar,or):Ve.setAttribute(Ar,or),Bc(Ve)?Ca(Ve):lle(o.removed)}catch{}}}Ul(fe.afterSanitizeAttributes,Ve,null)},Vc=function Yt(Ve){let It=null,Gt=gw(Ve);for(Ul(fe.beforeSanitizeShadowDOM,Ve,null);It=Gt.nextNode();)Ul(fe.uponSanitizeShadowNode,It,null),bg(It),Ig(It),It.content instanceof r&&Yt(It.content);Ul(fe.afterSanitizeShadowDOM,Ve,null)};return o.sanitize=function(Yt){let Ve=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},It=null,Gt=null,io=null,Or=null;if(yg=!Yt,yg&&(Yt="<!-->"),typeof Yt!="string"&&!uw(Yt))if(typeof Yt.toString=="function"){if(Yt=Yt.toString(),typeof Yt!="string")throw db("dirty is not a string, aborting")}else throw db("toString is not a function");if(!o.isSupported)return Yt;if(vg||Km(Ve),o.removed=[],typeof Yt=="string"&&(Wm=!1),Wm){if(Yt.nodeName){let Os=Co(Yt.nodeName);if(!oi[Os]||zm[Os])throw db("root node is forbidden and cannot be sanitized in-place")}}else if(Yt instanceof s)It=pw("<!---->"),Gt=It.ownerDocument.importNode(Yt,!0),Gt.nodeType===gb.element&&Gt.nodeName==="BODY"||Gt.nodeName==="HTML"?It=Gt:It.appendChild(Gt);else{if(!Gm&&!kc&&!Bl&&Yt.indexOf("<")===-1)return Le&&Cg?Le.createHTML(Yt):Yt;if(It=pw(Yt),!It)return Gm?null:Cg?qe:""}It&&fh&&Ca(It.firstChild);let Ar=gw(Wm?Yt:It);for(;io=Ar.nextNode();)bg(io),Ig(io),io.content instanceof r&&Vc(io.content);if(Wm)return Yt;if(Gm){if(vh)for(Or=Ee.call(It.ownerDocument);It.firstChild;)Or.appendChild(It.firstChild);else Or=It;return(pn.shadowroot||pn.shadowrootmode)&&(Or=ye.call(e,Or,!0)),Or}let Pr=Bl?It.outerHTML:It.innerHTML;return Bl&&oi["!doctype"]&&It.ownerDocument&&It.ownerDocument.doctype&&It.ownerDocument.doctype.name&&Za(_le,It.ownerDocument.doctype.name)&&(Pr="<!DOCTYPE "+It.ownerDocument.doctype.name+`>
195
- `+Pr),kc&&yM([Be,xe,wn],Os=>{Pr=mb(Pr,Os," ")}),Le&&Cg?Le.createHTML(Pr):Pr},o.setConfig=function(){let Yt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Km(Yt),vg=!0},o.clearConfig=function(){Ym=null,vg=!1},o.isValidAttribute=function(Yt,Ve,It){Ym||Km({});let Gt=Co(Yt),io=Co(Ve);return S_(Gt,io,It)},o.addHook=function(Yt,Ve){typeof Ve=="function"&&cb(fe[Yt],Ve)},o.removeHook=function(Yt,Ve){if(Ve!==void 0){let It=C7e(fe[Yt],Ve);return It===-1?void 0:_7e(fe[Yt],It,1)[0]}return lle(fe[Yt])},o.removeHooks=function(Yt){fe[Yt]=[]},o.removeAllHooks=function(){fe=hle()},o}var hH=yle();var Sle={ADD_TAGS:["velt-skeleton-loader"],ADD_ATTR:["border-radius"]},Ne=(()=>{let o=class o{constructor(e,i,r){this.rendererFactory2=e,this.loggingService=i,this.sanitizer=r,this.isVideoEditorHandlingDelete=!1,this.pageScrollHeight=0,this.enableRectSelectionSubject$=new Ce(!1),this.enableRectSelection$=this.enableRectSelectionSubject$.asObservable(),this.scrollableElementsIds$=new Ce([]),this.mousedown=!1,this.windowMouseDown$=new Ke,this.windowPointerMove$=new Ce(null),this.windowPointerUp$=new Ce(null),this.documentSelectionChange$=new Ce(null),this.windowClick$=new Ce(null),this.windowScroll$=new Ce(null),this.windowResize$=new Ce(null),this.windowKeyupBackspace$=new Ce(null),this.windowKeyupDelete$=new Ce(null),this.windowKeyupEsc$=new Ce(null),this.windowPopState$=new Ce(null),this.documentClick$=new Ce(null),this.documentClickSubject$=new Ke,this.documentFocus$=new Ce(null),this.windowKeydownShift$=new Ce(null),this.windowKeyupShift$=new Ce(null),this.mutation$=new Ce(null),this.childListMutation$=new Ce(null),this.networkStatus$=new Ce(!1),this.xpathCache=new Map,this.xpathCacheId=new Map,this.selectedAnnotationsMap$=new Ce({}),this.selectedAnnotationsLocationMap$=new Ce({}),this.recordingInProgress$=new Ce({}),this.deleteAnnotations$=new Ce([]),this.pinHighlighterClass$=new Ce(null),this.dialogOpenedInSidebar$=new Ce(!1),this.textHighlighterClass$=new Ce(null),this.commentPinHighlighter$=new Ce(!1),this.deviceInfo$=new Ce(new ei),this.customCss$=new Ce(null),this.mutationObserver=null,this.previousMousePosition={pageX:0,pageY:0,clientX:0,clientY:0},this.currentMousePosition={pageX:0,pageY:0,clientX:0,clientY:0,element:{xpath:"",topPercentage:0,leftPercentage:0}},this.nodeMap={},this.unlistenElementScroll={},this.filterSnippylyNodes=a=>{try{let s=[];return a.forEach(m=>{if(!zi(m))if(m instanceof HTMLElement){if(m.className.includes("cdk-overlay-container")||m.className.includes("cdk-overlay-connected-position-bounding-box"))return;if(m.className.includes("cdk-overlay")){let p=!1;m.childNodes.forEach(h=>{zi(h)&&(p=!0)}),p||s.push(m)}else s.push(m)}else s.push(m)}),s}catch(s){return this.loggingService.catch("Error in DomService filterSnippylyNodes: ",s),[]}},this.loggingService.log("%c[WB] Creating CLASS: DomService","color: blue;");try{this.renderer=this.rendererFactory2.createRenderer(null,null);let a=this.calculateScreenSize();this.currentScreenSize$=new Ce(a),this.currentMousePosition$=new Ce(this.currentMousePosition),this.detectNetworkStatusChange(),this.getScrollableElementsIds$().pipe(Pi(),gn(([s,m])=>{try{let p=m.filter(_=>!s.includes(_)),h=s.filter(_=>!m.includes(_));h.length&&h.map(E=>document.getElementById(E)).filter(E=>E).forEach(E=>{this.unlistenElementScroll&&this.unlistenElementScroll[E.id]&&this.unlistenElementScroll[E.id]()}),p.length&&p.map(E=>document.getElementById(E)).filter(E=>E).forEach(E=>{this.unlistenElementScroll[E.id]=this.renderer.listen(E,"scroll",D=>{let L=this.calculateScreenSize();this.currentScreenSize$.next(L)})})}catch(p){this.loggingService.catch("Error in DomService getScrollableElementsIds subscription: ",p)}})).subscribe(()=>{},s=>{this.loggingService.catch("Error in DomService getScrollableElementsIds subscription: ",s)}),this.getSelectedAnnotationsMap$().subscribe(s=>{Object.keys(s||{})?.length?Joe("snippylyUserScalableNo","viewport","width=device-width, user-scalable=no"):ere("snippylyUserScalableNo")},s=>{this.loggingService.catch("Error in DomService getSelectedAnnotationsMap$ subscription: ",s)})}catch(a){this.loggingService.catch("Error in DomService constructor: ",a)}}setDocService(e){try{this.docService=e,this.subscribeToDomEvents()}catch(i){this.loggingService.catch("Error in DomService setDocService: ",i)}}subscribeToDomEvents(){try{this.docService?.getDocumentPaths$().pipe(ce(e=>{e?(this.onWindowResize(),this.onWindowScroll(),this.onPointerDown(),this.onWindowClick(),this.onWindowKeyupBackspace(),this.onWindowKeyupDelete(),this.onWindowKeyupEsc(),this.onWindowPopState(),this.onWindowKeydownShift(),this.onWindowKeyupShift(),this.addPointerMoveListener(),this.addPointerUpListener(),this.addSelectionChangeListener(),this.onDocumentClick(),this.onDocumentFocus()):(this.unsubscribeFromWindowResize(),this.unsubscribeFromWindowScroll(),this.unsubscribeFromPointerDown(),this.unsubscribeFromWindowClick(),this.unsubscribeFromWindowKeyupBackspace(),this.unsubscribeFromWindowKeyupDelete(),this.unsubscribeFromWindowKeyupEsc(),this.unsubscribeFromWindowPopState(),this.unsubscribeFromWindowKeydownShift(),this.unsubscribeFromWindowKeyupShift(),this.unsubscribeFromPointerMoveListener(),this.unsubscribeFromPointerUpListener(),this.unsubscribeFromSelectionChangeListener(),this.unsubscribeFromDocumentClick(),this.unsubscribeFromDocumentFocus(),this.unsetMutationObserver())})).subscribe()}catch(e){this.loggingService.catch("Error in DomService subscribeToDomEvents: ",e)}}setScrollableElementsIds(e){try{e&&e.length&&this.scrollableElementsIds$.next(Array.from(new Set(e)))}catch(i){this.loggingService.catch("Error in DomService setScrollableElementsIds: ",i)}}getScrollableElementsIds$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getScrollableElementsIds$","color: green;"),this.scrollableElementsIds$.asObservable()}removeScrollableElementsIds(){this.scrollableElementsIds$.next([])}setMutationObserver(e){try{this.mutationObserver||(this.loggingService.log("%c[WB] Calling DomService FUNCTION: setMutationObserver","color: green;"),this.loggingService.log("%c[WB] setMutationObserver from: "+e,"color: green;"),this.mutationObserver=new MutationObserver(i=>{try{if(i?.find(a=>a?.attributeName===j.VELT_IGNORE_CHANGE_DETECTION))return;let r=i.filter(a=>a.type==="childList").filter(a=>{let s=a.target;return a.removedNodes.forEach(m=>{let p=m;if(typeof p.getAttribute=="function"){let h=p.getAttribute(j.ATTRIBUTES.VELT_ELEMENT_CACHE_ID);if(h!==null&&h!==""){let _=this.xpathCacheId.get(h);_!==void 0&&(this.xpathCacheId.delete(h),this.xpathCache.delete(_))}}}),zi(s)?!1:!!(this.filterSnippylyNodes(a.addedNodes).length||this.filterSnippylyNodes(a.removedNodes).length)});this.childListMutation$.next(r),r.push(...i.filter(a=>a.type==="attributes").filter(a=>!zi(a.target)).filter(a=>this.filterSnippylyNodes([a.target]).length).filter(a=>{if(a){let s=a.target;return s?.classList?.contains("snippyly-sidebar-panel")?!1:s?!s.getAttribute(j.VELT_IGNORE_CHANGE_DETECTION):!0}return!0})),r=r.filter(a=>{let s=!0;return Object.keys(j.INGNORE_MUTATION_OBSERVER_CHANGE_TAGS).forEach(m=>{a.target?.closest(m)&&(s=!1)}),s}),r=r.filter(a=>a.target&&Do(a.target)),r.length&&this.mutation$.next(r)}catch(r){this.loggingService.catch("Error in DomService change detection: ",r)}}),this.mutationObserver.observe(document.body,{childList:!0,subtree:!0,attributes:!0}))}catch(i){this.loggingService.catch("Error in DomService change detection: ",i)}}unsetMutationObserver(){try{this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=null)}catch(e){this.loggingService.catch("Error in DomService unsetMutationObserver: ",e)}}detectNetworkStatusChange(){this.loggingService.log("%c[WB] Calling FUNCTION: detectNetworkStatusChange","color: green;");try{ro(ri(window,"offline").pipe(ce(()=>!1)),ri(window,"online").pipe(ce(()=>!0)),new Lt(e=>{e.next(navigator.onLine),e.complete()})).subscribe(e=>{this.networkStatus$.next(e)})}catch(e){this.loggingService.catch("Error in DomService detectNetworkStatusChange: ",e)}}onWindowResize(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowResize","color: green;");try{this.unsubscribeFromWindowResize(),this.unlistenWindowResize=this.renderer.listen("window","resize",e=>{this.windowResize$.next(e);let i=this.calculateScreenSize();this.deviceInfo$.next(new ei),this.currentScreenSize$.next(i)})}catch(e){this.loggingService.catch("Error in DomService onWindowResize: ",e)}}unsubscribeFromWindowResize(){try{this.unlistenWindowResize&&typeof this.unlistenWindowResize=="function"&&(this.unlistenWindowResize(),this.unlistenWindowResize=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowResize: ",e)}}onWindowScroll(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowScroll","color: green;");try{this.unsubscribeFromWindowScroll(),this.unlistenWindowScroll=this.renderer.listen("window","scroll",e=>{this.windowScroll$.next(e);let i=this.calculateScreenSize();this.currentScreenSize$.next(i)})}catch(e){this.loggingService.catch("Error in DomService onWindowScroll: ",e)}}unsubscribeFromWindowScroll(){try{this.unlistenWindowScroll&&typeof this.unlistenWindowScroll=="function"&&(this.unlistenWindowScroll(),this.unlistenWindowScroll=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowScroll: ",e)}}onPointerDown(){this.loggingService.log("%c[WB] Calling FUNCTION: onPointerDown","color: green;");try{this.unsubscribeFromPointerDown(),this.unlistenPointerDown=this.renderer.listen("window","pointerdown",e=>{this.mousedown=!0,this.windowMouseDown$.next(e),this.setPointerPosition(e)})}catch(e){this.loggingService.catch("Error in DomService onPointerDown: ",e)}}unsubscribeFromPointerDown(){try{this.unlistenPointerDown&&typeof this.unlistenPointerDown=="function"&&(this.unlistenPointerDown(),this.unlistenPointerDown=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromPointerDown: ",e)}}onWindowClick(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeyupBackspace","color: green;");try{this.unsubscribeFromWindowClick(),this.unlistenWindowClick=this.renderer.listen("window","click",e=>{this.windowClick$.next(e)})}catch(e){this.loggingService.catch("Error in DomService onWindowClick: ",e)}}unsubscribeFromWindowClick(){try{this.unlistenWindowClick&&typeof this.unlistenWindowClick=="function"&&(this.unlistenWindowClick(),this.unlistenWindowClick=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowClick: ",e)}}onWindowKeyupBackspace(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeyupBackspace","color: green;");try{this.unsubscribeFromWindowKeyupBackspace(),this.unlistenWindowKeyupBackspace=this.renderer.listen("window","keyup.backspace",e=>{this.isVideoEditorHandlingDelete||this.windowKeyupBackspace$.next(e)})}catch(e){this.loggingService.catch("Error in DomService onWindowKeyupBackspace: ",e)}}unsubscribeFromWindowKeyupBackspace(){try{this.unlistenWindowKeyupBackspace&&typeof this.unlistenWindowKeyupBackspace=="function"&&(this.unlistenWindowKeyupBackspace(),this.unlistenWindowKeyupBackspace=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeyupBackspace: ",e)}}onWindowKeyupDelete(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeyupDelete","color: green;");try{this.unsubscribeFromWindowKeyupDelete(),this.unlistenWindowKeyupDelete=this.renderer.listen("window","keyup.delete",e=>{this.isVideoEditorHandlingDelete||this.windowKeyupDelete$.next(e)})}catch(e){this.loggingService.catch("Error in DomService onWindowKeyupDelete: ",e)}}unsubscribeFromWindowKeyupDelete(){try{this.unlistenWindowKeyupDelete&&typeof this.unlistenWindowKeyupDelete=="function"&&(this.unlistenWindowKeyupDelete(),this.unlistenWindowKeyupDelete=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeyupDelete: ",e)}}onWindowKeyupEsc(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeyupEsc","color: green;");try{this.unsubscribeFromWindowKeyupEsc(),this.unlistenWindowKeyupEsc=this.renderer.listen("window","keyup.esc",e=>{this.windowKeyupEsc$.next(e)})}catch(e){this.loggingService.catch("Error in DomService onWindowKeyupEsc: ",e)}}unsubscribeFromWindowKeyupEsc(){try{this.unlistenWindowKeyupEsc&&typeof this.unlistenWindowKeyupEsc=="function"&&(this.unlistenWindowKeyupEsc(),this.unlistenWindowKeyupEsc=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeyupEsc: ",e)}}onWindowPopState(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowPopState","color: green;");try{this.unsubscribeFromWindowPopState(),this.unlistenWindowPopState=this.renderer.listen("window","popstate",e=>{this.windowPopState$.next(e)})}catch(e){this.loggingService.catch("Error in DomService onWindowPopState: ",e)}}unsubscribeFromWindowPopState(){try{this.unlistenWindowPopState&&typeof this.unlistenWindowPopState=="function"&&(this.unlistenWindowPopState(),this.unlistenWindowPopState=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowPopState: ",e)}}onDocumentClick(){this.loggingService.log("%c[WB] Calling FUNCTION: onDocumentClick","color: green;");try{this.unsubscribeFromDocumentClick(),this.documentClickListener=e=>{e?.target?.tagName?.toLowerCase()!==j.TAGS.SUPERFLOW_TOOLBAR&&(this.documentClick$.next(e),this.documentClickSubject$.next(e))},document.addEventListener("click",this.documentClickListener,!0)}catch(e){this.loggingService.catch("Error in DomService onDocumentClick: ",e)}}unsubscribeFromDocumentClick(){try{this.documentClickListener&&typeof this.documentClickListener=="function"&&(document.removeEventListener("click",this.documentClickListener,!0),this.documentClickListener=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromDocumentClick: ",e)}}onDocumentFocus(){this.loggingService.log("%c[WB] Calling FUNCTION: onDocumentFocus","color: green;");try{this.unsubscribeFromDocumentFocus(),this.documentFocusListener=e=>{this.documentFocus$.next(e)},document.addEventListener("focus",this.documentFocusListener,!0)}catch(e){this.loggingService.catch("Error in DomService onDocumentFocus: ",e)}}unsubscribeFromDocumentFocus(){try{this.documentFocusListener&&typeof this.documentFocusListener=="function"&&(document.removeEventListener("focus",this.documentFocusListener,!0),this.documentFocusListener=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromDocumentFocus: ",e)}}onWindowKeydownShift(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeydownShift","color: green;");try{this.unsubscribeFromWindowKeydownShift(),this.unlistenWindowKeydownShift=this.renderer.listen("window","keydown.shift",e=>{this.windowKeydownShift$.next(e),this.windowKeyupShift$.next(null)})}catch(e){this.loggingService.catch("Error in DomService onWindowKeydownShift: ",e)}}unsubscribeFromWindowKeydownShift(){try{this.unlistenWindowKeydownShift&&typeof this.unlistenWindowKeydownShift=="function"&&(this.unlistenWindowKeydownShift(),this.unlistenWindowKeydownShift=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeydownShift: ",e)}}onWindowKeyupShift(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeyupShift","color: green;");try{this.unsubscribeFromWindowKeyupShift(),this.unlistenWindowKeyupShift=this.renderer.listen("window","keyup.shift",e=>{this.windowKeyupShift$.next(e),this.windowKeydownShift$.next(null)})}catch(e){this.loggingService.catch("Error in DomService onWindowKeyupShift: ",e)}}unsubscribeFromWindowKeyupShift(){try{this.unlistenWindowKeyupShift&&typeof this.unlistenWindowKeyupShift=="function"&&(this.unlistenWindowKeyupShift(),this.unlistenWindowKeyupShift=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeyupShift: ",e)}}onWindowKeydown$(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeydown$","color: green;");try{return ri(window,"keydown")}catch(e){return this.loggingService.catch("Error in DomService onWindowKeydown$: ",e),Pg}}addPointerMoveListener(){this.loggingService.log("%c[WB] Calling FUNCTION: addPointerMoveListener","color: green;");try{this.unsubscribeFromPointerMoveListener(),this.unlistenPointerMoveListener=this.renderer.listen("document","pointermove",e=>{this.windowPointerMove$.next(e),this.mouseMoveEvent=e})}catch(e){this.loggingService.catch("Error in DomService addPointerMoveListener: ",e)}}unsubscribeFromPointerMoveListener(){try{this.unlistenPointerMoveListener&&typeof this.unlistenPointerMoveListener=="function"&&(this.unlistenPointerMoveListener(),this.unlistenPointerMoveListener=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromPointerMoveListener: ",e)}}addPointerUpListener(){this.loggingService.log("%c[WB] Calling FUNCTION: addPointerUpListener","color: green;");try{this.unsubscribeFromPointerUpListener(),this.unlistenPointerUpListener=this.renderer.listen("document","pointerup",e=>{this.windowPointerUp$.next(e)})}catch(e){this.loggingService.catch("Error in DomService addPointerUpListener: ",e)}}unsubscribeFromPointerUpListener(){try{this.unlistenPointerUpListener&&typeof this.unlistenPointerUpListener=="function"&&(this.unlistenPointerUpListener(),this.unlistenPointerUpListener=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromPointerUpListener: ",e)}}addSelectionChangeListener(){this.loggingService.log("%c[WB] Calling FUNCTION: addPointerUpListener","color: green;");try{this.unsubscribeFromSelectionChangeListener(),this.unlistenSelectionChangeListener=this.renderer.listen("document","selectionchange",e=>{this.documentSelectionChange$.next(e)})}catch(e){this.loggingService.catch("Error in DomService addPointerUpListener: ",e)}}unsubscribeFromSelectionChangeListener(){try{this.unlistenSelectionChangeListener&&typeof this.unlistenSelectionChangeListener=="function"&&(this.unlistenSelectionChangeListener(),this.unlistenSelectionChangeListener=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromSelectionChangeListener: ",e)}}updateCurrentMousePosition(e){try{if(this.currentMousePosition.pageX=e.pageX,this.currentMousePosition.pageY=e.pageY,this.currentMousePosition.clientX=e.clientX,this.currentMousePosition.clientY=e.clientY,e.target){let i=this.getXPath(e.target),r=e.target;if(i?.includes("name()='svg'")){let _=this.getXPath(i);_&&(r=_.iterateNext()||e.target)}let a=r.getBoundingClientRect(),s=e.clientX-a.x,m=e.clientY-a.y,p=s*100/(a.width||1),h=m*100/(a.height||1);this.currentMousePosition.element={xpath:i,topPercentage:h,leftPercentage:p}}else this.currentMousePosition.element=null;this.currentMousePosition$.next(this.currentMousePosition)}catch(i){this.loggingService.catch("Error in DomService updateCurrentMousePosition: ",i)}}getTargetElementForCursorPosition(e,i=!0,r=!1,a=!0,s){try{let m=e,p=m?.touches?.length?m.touches[0]?.clientX:m.clientX,h=m?.touches?.length?m.touches[0]?.clientY:m.clientY,_=this.getBackgroundElement(p,h,i,r);if(_&&s&&typeof s=="function"&&(_=s(_)),_){let E=this.getXPath(_),D=this.getXPath(_,!0),L=_.getBoundingClientRect(),H=p-L.x,K=h-L.y,oe=H*100/(L.width||1),ue=K*100/(L.height||1),be={xpath:E,fXpath:D,leftPercentage:oe,topPercentage:ue};if(a){let Le=this.getXPath(_,!0,!0);be.cfXpath=Le}return be}else return null}catch(m){return this.loggingService.catch("Error in DomService getTargetElementForCommentPinAnnotation: ",m),null}}getBackgroundElement(e,i,r=!0,a=!1){try{let s=document.elementsFromPoint(e,i),m=[];s.forEach(h=>{zi(h)?m=[]:Do(h)&&m.push(h)}),a&&(m=m.filter(h=>this.isElementVisibleOnScreen(h)));let p=0;return r||m?.forEach((h,_)=>{h.tagName.toLowerCase()==="svg"&&(p=_)}),m[p]}catch(s){return this.loggingService.catch("Error in DomService getBackgroundElement: ",s),null}}getBackgroundVeltElement(e,i){try{let r=document.elementsFromPoint(e,i),a=[];return r.forEach(s=>{zi(s)&&Do(s)&&a.push(s)}),a[0]}catch(r){return this.loggingService.catch("Error in DomService getBackgroundSnippylyElement: ",r),null}}setPointerPosition(e){this.loggingService.log("%c[WB] Calling FUNCTION: setPointerPosition","color: green;");try{this.previousMousePosition.pageX=e.pageX,this.previousMousePosition.pageY=e.pageY,this.currentMousePosition.pageX=e.pageX,this.currentMousePosition.pageY=e.pageY}catch(i){this.loggingService.catch("Error in DomService setPointerPosition: ",i)}}getCurrentWindowSize$(e){return this.loggingService.log("%c[WB] Calling FUNCTION: getCurrentWindowSize","color: green;"),this.currentScreenSize$.asObservable()}getCurrentMousePosition$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getCurrentMousePosition","color: green;"),this.currentMousePosition$.asObservable()}getCurrentWindowSizeValue(){return this.loggingService.log("%c[WB] Calling FUNCTION: getCurrentWindowSizeValue","color: green;"),this.currentScreenSize$.value}getTopLeftPosition(){this.loggingService.log("%c[WB] Calling FUNCTION: getTopLeftPosition","color: green;");try{let e=document?.body?.getBoundingClientRect()||document?.documentElement?.getBoundingClientRect(),i=this.currentMousePosition?.pageX||e.x+200,r=Math.min(i,e.width/2),a=Math.abs(e.y),s=e.y-20;return a>50&&(s=Math.abs(e.y)+180),this.loggingService.log(e),this.loggingService.log(r),this.loggingService.log(s),{topPositionX:r,topPositionY:s}}catch(e){return this.loggingService.catch("Error in DomService getTopLeftPosition: ",e),{topPositionX:0,topPositionY:0}}}toggleSelection(){this.enableRectSelectionSubject$.next(!this.enableRectSelectionSubject$.value)}enableSelection(){this.enableRectSelectionSubject$.next(!0)}disableSelection(){this.enableRectSelectionSubject$.next(!1)}setPinHighlighterClass(e){this.pinHighlighterClass$.next(e)}setTextHighlighterClass(e){this.textHighlighterClass$.next(e)}getTextHighlighterClass(){return this.textHighlighterClass$.asObservable()}enableCommentPinHighlighter(){this.commentPinHighlighter$.next(!0)}disableCommentPinHighlighter(){this.commentPinHighlighter$.next(!1)}getCommentPinHighlighter$(){return this.commentPinHighlighter$.asObservable()}getCommentPinHighlighter(){return this.commentPinHighlighter$?.value}highlightElement(e,i,r){if(e){if(!r&&this.getCommentPinHighlighter()&&(this.pinHighlighterClass$.value?this.addClassToElement(e,this.pinHighlighterClass$.value):this.addClassToElement(e,j.SNIPPYLY_HIGHLIGHT)),i&&!e.hasAttribute(j.ATTRIBUTES.DEFAULT_CURSOR)){let a=e.style.getPropertyValue("cursor"),s=e.style.getPropertyPriority("cursor"),m=a?{defaultCursorValue:a,defaultCursorPriority:s}:"";e.setAttribute(j.ATTRIBUTES.DEFAULT_CURSOR,m?JSON.stringify(m):""),e.style.setProperty("cursor",i,"important")}e.setAttribute(j.SNIPPYLY_HIGHLIGHT,"true"),e.setAttribute(j.VELT_IGNORE_CHANGE_DETECTION,"true")}}removeHighlightFromElement(e){if(e&&(this.pinHighlighterClass$.value&&this.removeClassFromElement(e,this.pinHighlighterClass$.value),this.removeClassFromElement(e,j.SNIPPYLY_HIGHLIGHT),e.removeAttribute(j.SNIPPYLY_HIGHLIGHT),e.removeAttribute(j.VELT_IGNORE_CHANGE_DETECTION),e.hasAttribute(j.ATTRIBUTES.DEFAULT_CURSOR))){try{if(e.style.removeProperty("cursor"),e.getAttribute(j.ATTRIBUTES.DEFAULT_CURSOR)){let i=JSON.parse(e.getAttribute(j.ATTRIBUTES.DEFAULT_CURSOR));e.style.setProperty("cursor",i.defaultCursorValue,i.defaultCursorPriority)}}catch{}e.removeAttribute(j.ATTRIBUTES.DEFAULT_CURSOR)}}highlightUserElement(e,i,r,a=!1){try{e&&(this.addClassToElement(e,j.VELT_LIVE_SELECTION_ON_ELEMENT),a&&this.addClassToElement(e,j.VELT_LIVE_SELECTION_ON_ELEMENT_DEFAULT),e.setAttribute(j.SNIPPYLY_HIGHLIGHT,"true"),e.setAttribute(j.VELT_IGNORE_CHANGE_DETECTION,"true"),i&&!e.style.getPropertyValue(j.VELT_SELECTION_COLOR)&&e.style.setProperty(j.VELT_SELECTION_COLOR,i),r&&e.setAttribute(j.SNIPPYLY_HIGHLIGHT_USER_NAME,r))}catch(s){this.loggingService.catch("Error in DomService highlightUserElement: ",s)}}removeHighlightUserFromElement(e){try{e&&(this.removeClassFromElement(e,j.VELT_LIVE_SELECTION_ON_ELEMENT),this.removeClassFromElement(e,j.VELT_LIVE_SELECTION_ON_ELEMENT_DEFAULT),e.removeAttribute(j.SNIPPYLY_HIGHLIGHT),e.removeAttribute(j.VELT_IGNORE_CHANGE_DETECTION),e.removeAttribute(j.VELT_SELECTION_COLOR),e.removeAttribute(j.SNIPPYLY_HIGHLIGHT_USER_NAME),e.style.removeProperty(j.VELT_SELECTION_COLOR))}catch(i){this.loggingService.catch("Error in DomService removeHighlightUserFromElement: ",i)}}previewHighlightElement(e){e&&e.setAttribute(j.SNIPPYLY_HIGHLIGHT_PREVIEW,"true")}removePreviewHighlightFromElement(e){e&&e.removeAttribute(j.SNIPPYLY_HIGHLIGHT_PREVIEW)}getXPath(e,i=!1,r=!1,a){try{let s=this.calculateXPath(e,i,r,a);if(s&&typeof s=="string"&&s.includes("/svg")){let m=s.split("/"),p=!1;m.forEach((h,_)=>{h.includes("svg")&&(p=!0),p&&(m[_]="svg:"+h)}),s=m.join("/")}return s}catch(s){this.loggingService.catch("Error in DomService getXPath:",s)}}namespaceResolver(e){return e==="svg"?"http://www.w3.org/2000/svg":null}calculateXPath(e,i,r,a){try{if(e){if(typeof e=="string")return document.evaluate(e,a||document,this.namespaceResolver,XPathResult.ANY_TYPE,null);if(!e||e.nodeType!=1)return"";if(e.id&&document.querySelectorAll(`[id='${e.id}']`)?.length===1&&!i)return"//*[@id='"+e.id+"']";if(r&&e.className&&e.className.split){let m=e.className?.split(" ")?.filter(p=>!p?.includes("snippyly")&&!p?.includes("velt")&&!["show-pin-cursor"].includes(p))[0];if(m){let p=this.calculateXPath(e.parentNode,i,r,a)+"/"+e.tagName.toLowerCase(),h=Array.from(e.parentNode?.children||[]).filter(_=>_.nodeType===1&&_.tagName===e.tagName?_.className?.split(" ")?.filter(D=>D?.includes("snippyly")||D?.includes("velt")||["show-pin-cursor"].includes(D))[0]===m:!1);if(h.length>1){let _=h.indexOf(e)+1;p+=`[contains(concat(' ', normalize-space(@class), ' '), ' ${m} ')][${_}]`}else p+=`[contains(concat(' ', normalize-space(@class), ' '), ' ${m} ')]`;return p}}let s=[].filter.call(e.parentNode?.children?e.parentNode?.children:[],function(m){return m.tagName==e.tagName});return this.calculateXPath(e.parentNode,i,r)+"/"+e.tagName.toLowerCase()+(s.length>1?"["+([].indexOf.call(s,e)+1)+"]":"")}}catch(s){this.loggingService.catch("Error in DomService calculateXPath:",s)}}getElementFromXPath(e,i=document){try{if(this.xpathCache.has(e)){let a=this.xpathCache.get(e);if(a!==void 0&&document.contains(a))return a;this.xpathCache.delete(e)}let r=this.getXPath(e,!1,!1,i);if(r){let a=r?.iterateNext();if(a!==null&&typeof a.setAttribute=="function"){let s=Pn();a.setAttribute(j.ATTRIBUTES.VELT_ELEMENT_CACHE_ID,s),this.xpathCacheId.set(s,e)}return this.xpathCache.set(e,a),a}return null}catch(r){return this.loggingService.catch("Error in DomService getElementFromXPath:",r),null}}calculateScreenSize(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowResize","color: green;");try{let e=[document?.body?.clientHeight||0,document?.documentElement?.clientHeight||0,window?.innerHeight||0],i=[document?.body?.clientWidth||0,document?.documentElement?.clientWidth||0,window?.innerWidth||0];this.calculatePageScrollHeight(),this.loggingService.log(this.pageScrollHeight),this.loggingService.log(this.nodeMap),this.highestNode=this.nodeMap[this.pageScrollHeight];let r=new ob;return r.screenWidth=Math.max(...i),r.screenHeight=Math.max(...e),r.screenScrollHeight=this.pageScrollHeight,r}catch(e){return this.loggingService.catch("Error in DomService calculateScreenSize:",e),new ob}}calculatePageScrollHeight(){this.loggingService.log("%c[WB] Calling FUNCTION: calculatePageScrollHeight","color: green;");try{this.pageScrollHeight=0,this.findLongestNode(document?.documentElement?.childNodes)}catch(e){this.loggingService.catch("Error in DomService calculatePageScrollHeight: ",e)}}removeSnippylyContent(e){this.loggingService.log("%c[WB] Calling FUNCTION: removeSnippylyContent","color: green;");try{let r=new DOMParser().parseFromString(e,"text/html");r.querySelectorAll("[data-snippyly-cache-id]").forEach(E=>{E.removeAttribute("data-snippyly-cache-id")}),r.querySelectorAll("[data-velt-cache-id]").forEach(E=>{E.removeAttribute("data-velt-cache-id")}),r.querySelectorAll(".comment-text-highlight").forEach(E=>{E?.parentNode?.insertBefore(document.createTextNode(E?.textContent),E),E.remove()});let p=document.createNodeIterator(r,NodeFilter.SHOW_COMMENT),h;for(;h=p.nextNode();)h?.remove();return this.mergeAdjacentTextNodes(r.body),this.sanitizeHtml(r.body.innerHTML)}catch(i){return this.loggingService.catch("Error in DomService removeSnippylyContent: ",i),e}}mergeAdjacentTextNodes(e){try{let i=e.firstChild;for(;i;){if(i.nodeType===Node.TEXT_NODE){let r=i.nextSibling;for(;r&&r.nodeType===Node.TEXT_NODE;)i.textContent+=r.textContent,r.remove(),r=i.nextSibling}i=i.nextSibling}}catch(i){this.loggingService.catch("Error in DomService mergeAdjacentTextNodes: ",i)}}findLongestNode(e){try{for(let i=e.length-1;i>=0;i--){if(e[i]?.scrollHeight&&e[i]?.clientHeight){let r=Math.max(e[i]?.scrollHeight,e[i]?.clientHeight);this.pageScrollHeight=Math.max(r,this.pageScrollHeight),this.nodeMap[r]=e[i]}e[i]?.childNodes?.length&&this.findLongestNode(e[i]?.childNodes)}}catch(i){this.loggingService.catch("Error in DomService findLongestNode: ",i)}}resetSelectedAnnotationsMap(e=!0,i){try{let r=Array.from(document.querySelectorAll(`[${j.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`)),a=this.getDraftCommentAnnotationDialogs()||[];r.push(...a),r=Array.from(new Set(r));let s=r.map(_=>_.classList.contains("velt-annotation-draft-checked")?(_.classList.remove("velt-annotation-draft-checked"),null):(this.removeClassFromElement(_,"velt-comment-dialog-shake"),setTimeout(()=>{this.addClassToElement(_,"velt-comment-dialog-shake"),_.getAttribute(j.ATTRIBUTES.VELT_ANNOTATION_EDIT_COMMENT)||_.classList.contains("velt-annotation-draft-checked")||this.addClassToElement(_,"velt-annotation-draft-checked")},100),_.getAttribute(j.ATTRIBUTES.VELT_ANNOTATION_DRAFT))).filter(_=>_),m=Object.keys(this.getRecordingInProgress()||{});s=[...s,...m];let p=this.selectedAnnotationsMap$.value;if(e&&this.selectedAnnotationsMap$.value&&Object.keys(this.selectedAnnotationsMap$.value).length){let _=[];Object.keys(p).forEach(E=>{if(p[E]?.type==="tag"){let D=p[E];D?.to?.length||s.includes(E)||_.push(D)}else p[E]?.comments?.length||s.includes(E)||_.push(p[E])}),this.deleteAnnotations$.next(_),this.deleteAnnotations$.next([])}let h={};Object.keys(p).forEach(_=>{if(s.includes(_)&&(h[_]=p[_]),i)switch(i){case"comment":["comment","videoPin"].includes(p[_]?.type)||(h[_]=p[_]);break;default:p[_]?.type!==i&&(h[_]=p[_]);break}}),Object.keys(h).forEach(_=>{let E=h[_]?.multiThreadAnnotationId;E&&!h[E]&&(h[E]={annotationId:E,type:"multiThread"})}),JSON.stringify(this.selectedAnnotationsMap$.value)!==JSON.stringify(h)&&this.selectedAnnotationsMap$.next(h),this.setDialogOpenedInSidebar(!1)}catch(r){this.loggingService.catch("Error in DomService resetSelectedAnnotationsMap: ",r)}}setRecordingInProgress(e,i){try{if(i)this.recordingInProgress$.next(T(I({},this.recordingInProgress$.value),{[e]:i}));else{let r=this.recordingInProgress$.value;delete r[e],this.recordingInProgress$.next(r)}}catch(r){this.loggingService.catch("Error in DomService setRecordingInProgress: ",r)}}resetRecordingInProgress(){try{this.recordingInProgress$.next({})}catch(e){this.loggingService.catch("Error in DomService resetRecordingInProgress: ",e)}}getRecordingInProgress(){try{return this.recordingInProgress$.value}catch(e){return this.loggingService.catch("Error in DomService getRecordingInProgress: ",e),{}}}getDraftCommentAnnotationDialogs(){try{let e=[];return Array.from(document.querySelectorAll(`${j.TAGS.SNIPPYLY_COMMENT_DIALOG}`)).forEach(r=>{if(r?.shadowRoot){let a=r.shadowRoot.querySelector(`[${j.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);a&&e.push(a)}else{let a=r.querySelector(`${j.TAGS.VELT_SHADOW_DOM_INTERNAL}`);if(a?.shadowRoot){let s=a.shadowRoot?.querySelector(`[${j.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);s&&e.push(s)}else{let s=r.querySelector(`[${j.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);s&&e.push(s)}}}),e}catch(e){return this.loggingService.catch("Error in DomService getDraftCommentAnnotationDialogs: ",e),[]}}getSelectedAnnotationsMap(e){try{let i=this.selectedAnnotationsMap$.value;if(e){let r={};return Object.keys(i).forEach(a=>{switch(e){case"comment":["comment","videoPin"].includes(i[a].type)&&(r[a]=i[a]);break;default:i[a].type===e&&(r[a]=i[a]);break}}),r}else return i}catch(i){return this.loggingService.catch("Error in DomService getSelectedAnnotationsMap: ",i),{}}}getSelectedAnnotationsMap$(e){return this.selectedAnnotationsMap$.asObservable().pipe(ce(i=>{if(e){let r={};return Object.keys(i).forEach(a=>{i[a].type===e&&(r[a]=i[a])}),r}else return i}))}getSelectedComments$(){return this.selectedAnnotationsMap$.asObservable().pipe(ce(e=>Object.values(e)))}getSelectedAnnotationsLocationMap(){try{return this.selectedAnnotationsLocationMap$.value}catch(e){return this.loggingService.catch("Error in DomService getSelectedAnnotationsLocationMap: ",e),{}}}getSelectedAnnotationsLocationMap$(){return this.selectedAnnotationsLocationMap$.asObservable()}toggleAnnotationSelection(e,i,r,a=!1){try{r==="sidebarShowReplies"?this.setDialogOpenedInSidebar(!0):this.setDialogOpenedInSidebar(!1);let s=JSON.parse(JSON.stringify(this.selectedAnnotationsMap$.value||{})),m=JSON.parse(JSON.stringify(this.selectedAnnotationsLocationMap$.value||{}));if(s[e.annotationId]&&!a)delete s[e.annotationId];else{(!this.windowKeydownShift$.value||a)&&(s={}),s[e.annotationId]=e,m[e.annotationId]=i;let p=e?.multiThreadAnnotationId;p&&(s[p]={annotationId:p,type:"multiThread"},m[p]=i)}this.selectedAnnotationsMap$.next(s),Object.keys(m).forEach(p=>{s[p]||delete m[p]}),this.selectedAnnotationsLocationMap$.next(m)}catch(s){this.loggingService.catch("Error in DomService toggleAnnotationSelection: ",s)}}setSelectedAnnotationLocation(e,i){try{let r=JSON.parse(JSON.stringify(this.getSelectedAnnotationsLocationMap()||{}));r?.[e]!==i&&(r[e]=i,this.selectedAnnotationsLocationMap$.next(r))}catch(r){this.loggingService.catch("Error in DomService setSelectedAnnotationLocation: ",r)}}updateSelectedAnnotationInMap(e){try{let i=this.selectedAnnotationsMap$.value;e.forEach(r=>{i[r.annotationId]&&(i[r.annotationId]=r)}),this.selectedAnnotationsMap$.next(i)}catch(i){this.loggingService.catch("Error in DomService updateSelectedAnnotationInMap: ",i)}}getDeleteCommmentAnnotations$(){try{return this.deleteAnnotations$.asObservable()}catch(e){return this.loggingService.catch("Error in DomService getDeleteCommmentAnnotations$: ",e),se([])}}getHighestNode(){return this.loggingService.log("%c[WB] Calling FUNCTION: getHighestNode","color: green;"),this.highestNode}onWindowMouseDown$(){return this.windowMouseDown$.asObservable()}onWindowPointerMove$(){return this.windowPointerMove$.asObservable()}onWindowPointerMove(){return this.windowPointerMove$.value}onWindowPointerUp$(){return this.windowPointerUp$.asObservable()}onSelectionChange$(){return this.documentSelectionChange$.asObservable()}onWindowClick$(){return this.windowClick$.asObservable()}onWindowScroll$(){return this.windowScroll$.asObservable()}onWindowResize$(){return this.windowResize$.asObservable()}onWindowKeyupBackspace$(){return this.windowKeyupBackspace$.asObservable()}onWindowKeyupDelete$(){return this.windowKeyupDelete$.asObservable()}onWindowKeyupEsc$(){return this.windowKeyupEsc$.asObservable()}onWindowPopState$(){return this.windowPopState$.asObservable()}onDocumentClick$(){return this.documentClick$.asObservable()}getLastDocumentClick(){return this.documentClick$.value}onDocumentClickSubject$(){return this.documentClickSubject$.asObservable()}onDocumentFocus$(){return this.documentFocus$.asObservable()}onDomChange$(e){try{return this.mutationObserver||this.setMutationObserver(e),this.mutation$.asObservable()}catch(i){return this.loggingService.catch("Error in DomService onDomChange$: ",i),se([])}}getChildListMutation$(){return this.childListMutation$.asObservable()}onNetworkStatusChange$(){return this.networkStatus$.asObservable()}getElementOffset(e,i){try{let r={offsetTop:0,offsetLeft:0},a=e;if(a===i){let s=window.getComputedStyle(e);s.position==="static"&&s.transformStyle!="preserve-3d"&&s.transform=="none"&&(r.offsetLeft=e?.offsetLeft||0,r.offsetTop=e?.offsetTop||0)}if(a!==i)if(e?.closest("svg"))for(;a&&a!==i;){let m=window.getComputedStyle(a);if(a.tagName.toLowerCase()==="svg"||a instanceof SVGElement){let p=a.parentElement;if(p){let h=p.getBoundingClientRect(),_=a.getBoundingClientRect();r.offsetLeft+=_.left-h.left,r.offsetTop+=_.top-h.top}}else m.position==="static"?m.transformStyle!="preserve-3d"&&m.transform=="none"&&(r.offsetLeft+=a?.offsetLeft||0,r.offsetTop+=a?.offsetTop||0):(r.offsetLeft+=a.offsetLeft,r.offsetTop+=a.offsetTop);if(a=a.parentElement,e instanceof SVGElement&&a===i){let p=window.getComputedStyle(a);p.position==="static"&&p.transformStyle!="preserve-3d"&&p.transform=="none"&&(r.offsetLeft+=a?.offsetLeft||0,r.offsetTop+=a?.offsetTop||0)}}else{let m=window.getComputedStyle(a);m.position==="static"?m.transformStyle!="preserve-3d"&&m.transform=="none"&&(r.offsetLeft+=a?.offsetLeft||0,r.offsetTop+=a?.offsetTop||0):(r.offsetLeft+=a.offsetLeft,r.offsetTop+=a.offsetTop)}return r}catch(r){return this.loggingService.catch("Error in DomService getElementOffset: ",r),{offsetTop:0,offsetLeft:0}}}isElementVisible(e){try{if(typeof e?.getBoundingClientRect=="function"){let{width:i,height:r,top:a,bottom:s}=e?.getBoundingClientRect();return i>0||r>0||a<window.innerHeight&&s>0}else return!1}catch(i){return this.loggingService.catch("Error in DomService isElementVisible: ",i),!1}}isElementVisibleOnScreen(e){try{if(e){if(!(e instanceof Element))return!1;let i=e,r=window.getComputedStyle(i);return!(r.display==="none"||r.visibility==="hidden"||parseFloat(r.opacity)===0)}return!1}catch(i){return this.loggingService.catch("Error in DomService isElementVisibleOnScreen: ",i),!1}}getClickAndDragPointsObservable(){return new Lt(e=>{let i=ri(document,"mousedown").pipe(ce(p=>({type:p.type,x:p.clientX+window.scrollX,y:p.clientY+window.scrollY,event:p}))),r=ri(document,"mousemove").pipe(ce(p=>({type:p.type,x:p.clientX+window.scrollX,y:p.clientY+window.scrollY,event:p}))),a=ri(document,"mouseup").pipe(ce(p=>({type:p.type,x:p.clientX+window.scrollX,y:p.clientY+window.scrollY,event:p}))),m=i.pipe(he(p=>r.pipe(Pi(),ce(([h,_])=>({startPoint:p,prevPoint:h,curPoint:_})),ao(a)))).subscribe(e);return()=>m.unsubscribe()})}drawRectangle(e,i){let r=document.querySelector(".rectangle");r||(r=document.createElement("div"),this.addClassToElement(r,"rectangle"),r.setAttribute(j.ATTRIBUTES.VELT_COMMENT_DISABLED,"true"),r.setAttribute(j.VELT_IGNORE_CHANGE_DETECTION,"true"),document.body.appendChild(r));let a=Math.abs(i.x-e.x),s=Math.abs(i.y-e.y),m=Math.min(e.x,i.x),p=Math.min(e.y,i.y);return r.style.width=`${a}px`,r.style.height=`${s}px`,r.style.left=`${m}px`,r.style.top=`${p}px`,r.style.position="absolute",r.style.border="2px dashed #f00",r.style.pointerEvents="none",r.style.zIndex="2147483577",r}getRange(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: getRange","color: green;"),window.getSelection()?.toString()){let e=window.getSelection();if(e?.rangeCount)return e.getRangeAt(0)}return null}catch(e){return this.loggingService.catch("Error in DomService getRange: ",e),null}}clearTextSelection(){try{this.loggingService.log("%c[WB] Calling FUNCTION: clearTextSelection","color: green;"),window.getSelection&&(window.getSelection()?.empty?window.getSelection()?.empty():window.getSelection()?.removeAllRanges&&window.getSelection()?.removeAllRanges())}catch(e){this.loggingService.catch("Error in DomService clearTextSelection: ",e)}}getTargetTextRangeFromSelectionRange(e){try{let i={},r=e.commonAncestorContainer;r?.nodeType===Node.TEXT_NODE&&(r=r.parentElement);let a=document.body;if(r){let m=this.getTextXPath(r);this.isXpathWithId(m)&&(a=r)}let s=this.getAdditionalLocationContainer(r);if(s&&(a=s),i.commonAncestorContainer=this.getTextXPath(a),i.commonAncestorContainer){let m=this.getElementFromXPath(i.commonAncestorContainer);m&&(i.commonAncestorContainerFXpath=this.getXPath(m,!0),i.commonAncestorContainerCFXpath=this.getXPath(m,!0,!0))}return i.text=e.toString(),i.occurrence=ju(a,0,e.startContainer,e.startOffset,e.toString())+1,i}catch(i){this.loggingService.catch("Error in DomService getTargetTextRangeFromSelectionRange: ",i);return}}getTextXPath(e){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: getTextXPath","color: green;"),e.nodeType===Node.TEXT_NODE){let i=1,r=e.previousSibling;for(;r;)r.nodeType===Node.TEXT_NODE&&i++,r=r.previousSibling;return this.getXPath(e.parentElement)}else return this.getXPath(e)}catch(i){this.loggingService.catch("Error in DomService getTextXPath: ",i);return}}getHostElement(e){try{if(j.NON_NESTABLE_ELEMENTS[e?.tagName?.toLowerCase()]){let r=e?.closest("picture");return r?r?.parentElement:e.parentElement}let i=e.closest("svg");return i?i?.parentElement:e}catch(i){return this.loggingService.catch("Error in DomService getHostElement: ",i),e}}isElementInsideAdditionalLocationContainer(e){try{return!!e?.closest(`[${j.ATTRIBUTES.VELT_LOCATION}], [${j.ATTRIBUTES.VELT_LOCATION_ID}]`)}catch(i){return this.loggingService.catch("Error in DomService isElementInsideAdditionalLocationContainer: ",i),!1}}getAdditionalLocationContainer(e){try{return e?.closest(`[${j.ATTRIBUTES.VELT_LOCATION}], [${j.ATTRIBUTES.VELT_LOCATION_ID}]`)||null}catch(i){return this.loggingService.catch("Error in DomService getAdditionalLocationContainer: ",i),null}}isXpathWithId(e){try{return typeof e=="string"?!!e?.includes("[@id="):!1}catch(i){return this.loggingService.catch("Error in DomService isXpathWithId: ",i),!1}}getListedElements({elementIds:e,elementClassNames:i,elementQuerySelectors:r}){try{let a=[];if(e?.length)for(let s=0;s<e.length;s++){let m=document.getElementById(e[s]);m&&a.push(m)}if(i?.length)for(let s=0;s<i.length;s++){let m=document.getElementsByClassName(i[s]);for(let p=0;p<m.length;p++){let h=m[p];h&&h instanceof HTMLElement&&a.push(h)}}if(r?.length)for(let s=0;s<r.length;s++){let m=document.querySelectorAll(r[s]);for(let p=0;p<m.length;p++){let h=m[p];h&&h instanceof HTMLElement&&a.push(h)}}return a}catch(a){return this.loggingService.catch("Error in DomService getListedElements: ",a),[]}}isElementInsideListedElementIds(e,i){try{if(i?.length){for(let r=0;r<i.length;r++){let a=document.getElementById(i[r]);if(a&&a.contains(e))return!0}return!1}return!0}catch(r){return this.loggingService.catch("Error in DomService isElementInsideListedElementIds: ",r),!1}}isElementInsideListedElementClassNames(e,i){try{if(i?.length){for(let r=0;r<i.length;r++){let a=document.getElementsByClassName(i[r]);for(let s=0;s<a.length;s++)if(a[s].contains(e))return!0}return!1}return!0}catch(r){return this.loggingService.catch("Error in DomService isElementInsideListedElementClassNames: ",r),!1}}isElementInsideListedElementQuerySelectors(e,i){try{if(i?.length){for(let r=0;r<i.length;r++){let a=document.querySelectorAll(i[r]);for(let s=0;s<a.length;s++)if(a[s].contains(e))return!0}return!1}return!0}catch(r){return this.loggingService.catch("Error in DomService isElementInsideListedElementQuerySelectors: ",r),!1}}addClassToElement(e,i){try{this.loggingService.log("%c[WB] Calling FUNCTION: addClassToElement","color: green;"),e&&(e.classList?.contains(i)||e.classList?.add(i))}catch(r){this.loggingService.catch("Error in DomService addClassToElement: ",r)}}removeClassFromElement(e,i){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeClassFromElement","color: green;"),e&&e.classList?.contains(i)&&e.classList?.remove(i)}catch(r){this.loggingService.catch("Error in DomService removeClassFromElement: ",r)}}isElementInsideParentWithAttribute(e,i,r){try{let a=e;for(;a&&a!==document.body;){if(a?.getAttribute&&a?.getAttribute(i)===r)return!0;a=a.parentElement}return!1}catch(a){return this.loggingService.catch("Error in DomService isElementInsideParentWithAttribute: ",a),!1}}setVideoEditorHandlingDelete(e){try{this.isVideoEditorHandlingDelete=e}catch(i){this.loggingService.catch("Error in DomService setVideoEditorHandlingDelete: ",i)}}isVideoEditorHandlingDeleteKey(){try{return this.isVideoEditorHandlingDelete}catch(e){return this.loggingService.catch("Error in DomService isVideoEditorHandlingDeleteKey: ",e),!1}}setCustomCss(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setCustomCss","color: green;"),this.customCss$.next(e)}catch(i){this.loggingService.catch("Error in DomService setCustomCss: ",i)}}getCustomCss$(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getCustomCss$","color: green;"),this.customCss$.asObservable()}catch(e){return this.loggingService.catch("Error in DomService getCustomCss$: ",e),se(null)}}injectCustomCss(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: injectCustomCss","color: green;");let i=this.customCss$.value;if(i){let r=e?.shadowRoot?.querySelector(`[${j.VELT_CUSTOM_CSS}]`);if(r&&r.remove(),i?.type==="link"){let a=document.createElement("link");a.href=i?.value,a.rel="stylesheet",a.setAttribute(j.VELT_CUSTOM_CSS,"true"),e?.shadowRoot?.appendChild(a)}else{let a=document.createElement("style");a.innerHTML=this.sanitizeHtml(i?.value),a.setAttribute(j.VELT_CUSTOM_CSS,"true"),e?.shadowRoot?.appendChild(a)}}}catch(i){this.loggingService.catch("Error in DomService injectCustomCss: ",i)}}trimCommentHtml(e){try{let i=document.createElement("div");i.innerHTML=e,this.removeEmptyElements(i);let r=i.innerHTML;return r=r.replace(o.MULTIPLE_NBSP_REGEX," ").replace(o.TRIM_NBSP_REGEX,"").trim(),r}catch(i){return this.loggingService.catch("Error in DomService trimCommentHtml: ",i),e}}removeEmptyElements(e){try{let a=function(s){return r.test(s.innerHTML)};var i=a;let r=/^\s*(<br\s*\/?>)?\s*$/;for(;e.firstChild&&a(e.firstChild);)e.removeChild(e.firstChild);for(;e.lastChild&&a(e.lastChild);)e.removeChild(e.lastChild)}catch(r){this.loggingService.catch("Error in DomService removeEmptyElements: ",r)}}normalizeWhitespace(e){try{e.childNodes.forEach(i=>{i.nodeType===Node.TEXT_NODE?i.nodeValue=i.nodeValue?.replace(/\s+/g," ").trim()??"":i.nodeType===Node.ELEMENT_NODE&&this.normalizeWhitespace(i)})}catch(i){this.loggingService.catch("Error in DomService normalizeWhitespace: ",i)}}sanitizeHtml(e){try{return this.loggingService.log("%c[WB] Calling FUNCTION: sanitizeHtml","color: green;"),hH.sanitize(e,Sle)}catch(i){return this.loggingService.catch("Error in DomService sanitizeHtml: ",i),""}}sanitizeSvg(e){try{return hH.sanitize(e,Sle)}catch(i){return this.loggingService.catch("Error in DomService sanitizeSvg: ",i),e}}setDeviceInfo(){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDeviceInfo","color: green;");let e=new ei;this.deviceInfo$.next(e)}catch(e){this.loggingService.catch("Error in DomService setDeviceInfo: ",e)}}getDeviceInfo$(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getDeviceInfo$","color: green;"),this.deviceInfo$.asObservable()}catch(e){return this.loggingService.catch("Error in DomService getDeviceInfo$: ",e),se(new ei)}}getTabId(){try{let e=sessionStorage.getItem(j.SESSION_STORAGE.VELT_TAB_ID),i=this.getTabIdFromWindowName();return(!e||e!==i)&&(e=Pn(),sessionStorage.setItem(j.SESSION_STORAGE.VELT_TAB_ID,e),this.setTabIdToWindowName(e)),e}catch(e){return this.loggingService.catch("Error in DomService getTabId: ",e),null}}getTabIdFromWindowName(){try{return window.name}catch(e){return this.loggingService.catch("Error in DomService getTabIdFromWindowName: ",e),null}}setTabIdToWindowName(e){try{window.name=e}catch(i){this.loggingService.catch("Error in DomService setTabIdToWindowName: ",i)}}getDeviceInfo(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getDeviceInfo","color: green;"),this.deviceInfo$.value}catch(e){return this.loggingService.catch("Error in DomService getDeviceInfo: ",e),new ei}}isMobileDevice(){try{return new ei().getDeviceType()===Qo.MOBILE}catch(e){return this.loggingService.catch("Error in DomService isMobileDevice: ",e),!1}}isTabletDevice(){try{return new ei().getDeviceType()===Qo.TABLET}catch(e){return this.loggingService.catch("Error in DomService isTabletDevice: ",e),!1}}isDesktopDevice(){try{return new ei().getDeviceType()===Qo.DESKTOP}catch(e){return this.loggingService.catch("Error in DomService isDesktopDevice: ",e),!1}}deepCloneElement(e){try{var i=document.createElement(e?.tagName);return Array.from(e.attributes).forEach(r=>{i.setAttribute(r.nodeName,r.nodeValue)}),e.childNodes.forEach(r=>{r.nodeType===Node.ELEMENT_NODE?i.appendChild(this.deepCloneElement(r)):r.nodeType===Node.TEXT_NODE&&i.appendChild(document.createTextNode(r.nodeValue))}),i}catch(r){return this.loggingService.catch("Error in DomService deepCloneElement: ",r),e}}setRandomNumberToElementRecursive(e){try{if(!e)return;let i=Math.random().toString(36).substring(7);e&&e.setAttribute&&typeof e.setAttribute=="function"&&(e.getAttribute("velt-wireframe-id")||e.setAttribute("velt-wireframe-id",i)),Array.from(e.children).forEach(a=>{this.setRandomNumberToElementRecursive(a)})}catch(i){this.loggingService.catch("Error in DomService setRandomNumberToElementRecursive: ",i)}}setDialogOpenedInSidebar(e){this.dialogOpenedInSidebar$.next(e)}getDialogOpenedInSidebar(){return this.dialogOpenedInSidebar$.asObservable()}removeWireframeSuffixFromTags(e){if(!e)return;Array.from(e.children).forEach(r=>{if(this.removeWireframeSuffixFromTags(r),r.tagName.toLowerCase().endsWith("-wireframe")){let a=r.tagName.toLowerCase().replace("-wireframe",""),s=document.createElement(a);for(Array.from(r.attributes).forEach(m=>{s.setAttribute(m.name,m.value)});r.firstChild;)s.appendChild(r.firstChild);r.parentNode.replaceChild(s,r)}})}isMonitorDevice(){try{return new ei().getDeviceType()===Qo.MONITOR}catch(e){return this.loggingService.catch("Error in DomService isMonitorDevice: ",e),!1}}};o.MULTIPLE_NBSP_REGEX=/(?:&nbsp;\s*){2,}/g,o.TRIM_NBSP_REGEX=/^(?:&nbsp;\s*)+|(?:&nbsp;\s*)+$/g,o.\u0275fac=function(i){return new(i||o)(J(Ko),J(y),J(Ls))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var He=(()=>{let o=class o{constructor(e,i,r,a,s,m,p,h){this.afAuth=e,this.configService=i,this.avatarService=r,this.coreActionsService=a,this.domService=s,this.functions=m,this.analyticsService=p,this.loggingService=h,this.user$=new Ce(null),this.userOptions$=new Ce(null),this.userContacts$=new Ce(null),this.userOrganization$=new Ce(null),this.providedUser=new wo,this.firebaseConfig$=new Ce(null),this.advancedQueries$=new Ce(null),this.planDetails$=new Ce(null),this.signOutPreviousUser$=new Ce(null),this.preSignOutFunctions=new Map,this.autoLoginCalled=!1,this.autoLoginRequired=!0,this.config=null,this.getPlanDetailsCalled=!1,this.forceReLoggedIn=!1,this.lastLoggedInUserData=null,this.sessionReLoginCount=0,this.SESSION_RE_LOGIN_COUNT_LIMIT=10,this.sessionReLoginSubscription=null,this.TOKEN_EXPIRED_ERROR_COUNT_LIMIT=3,this.tokenExpiredErrorCount=0,this.loggingService.log("%c[WB] Creating CLASS: AuthService","color: blue;");try{this.analyticsService.setAuthService(this),this.configService.getConfig$().subscribe(_=>{this.config=_}),this.forceReLoggedIn=localStorage.getItem(j.LOCAL_STORAGE.VELT_USER_FORCE_RE_LOGGED_IN)==="true",this.sessionReLoginSubscription=qn(this.afAuth).pipe(qo(this.afAuth.currentUser),Pi(),he(([_,E])=>this.domService.onNetworkStatusChange$().pipe(Fe(D=>D),tt(1),ce(()=>({previousUser:_,currentUser:E}))))).subscribe(D=>Q(this,[D],function*({previousUser:_,currentUser:E}){if(!E&&_){let L=_?.stsTokenManager?.expirationTime,H=new Date().getTime(),K=L-H;H>L&&(this.analyticsService.trackEvent(X.Events.Core.SDK_SESSION_TOKEN_EXPIRED,{apiKey:this.apiKey,user:this.user$.value,lastLoggedInUserData:this.lastLoggedInUserData,timeLeft:K,forceReset:this.userOptions$.value?.forceReset,sessionReLoginCount:this.sessionReLoginCount},!0,this.user$.value?.userSnippylyId),this.user$.value&&_?.uid===this.user$.value?.userSnippylyId&&this.lastLoggedInUserData?.user?.userSnippylyId===this.user$.value?.userSnippylyId&&(this.sessionReLoginCount>this.SESSION_RE_LOGIN_COUNT_LIMIT?(this.analyticsService.trackEvent(X.Events.Core.SDK_SESSION_RE_LOGIN_COUNT_EXCEEDED,{apiKey:this.apiKey,clientUserId:this.lastLoggedInUserData.user.userId,snippylyUserId:this.lastLoggedInUserData.user.userSnippylyId,timeLeft:K,forceReset:this.userOptions$.value?.forceReset,sessionReLoginCount:this.sessionReLoginCount},!0,this.user$.value?.userSnippylyId),this.sessionReLoginSubscription?.unsubscribe()):(this.sessionReLoginCount++,this.analyticsService.trackEvent(X.Events.Core.SDK_SESSION_RE_LOGIN_TRIGGERED,{apiKey:this.apiKey,clientUserId:this.lastLoggedInUserData.user.userId,snippylyUserId:this.lastLoggedInUserData.user.userSnippylyId,user:this.getUserWithoutContacts(this.lastLoggedInUserData.user),timeLeft:K,forceReset:this.userOptions$.value?.forceReset,sessionReLoginCount:this.sessionReLoginCount},!0,this.lastLoggedInUserData.user.userSnippylyId),this.initializeClient(this.lastLoggedInUserData.user,this.lastLoggedInUserData.userOptions,this.lastLoggedInUserData.initializeClientToken,this.lastLoggedInUserData.autoLogin,"internal-sessionReLogin"))))}}),_=>{this.loggingService.catch("Error in AuthService sessionReLoginSubscription: ",_)}),this.getUser$().pipe(qt(Vi)).subscribe(_=>{let E=ha(_);this.coreActionsService.triggerAction(Xi.USER_UPDATE,E),this.coreActionsService.triggerAction(Xi.INIT_UPDATE,{event:Xi.USER_UPDATE,payload:{user:E}})})}catch(_){this.loggingService.catch("Error in AuthService constructor: ",_)}}setApiKey(e,i){this.loggingService.log("%c[WB] Calling FUNCTION: setApiKey","color: green;",e);try{if(this.apiKey){this.loggingService.log("API key is already set");return}this.apiKey=e,this.configService.setApiKey(this.apiKey),i||(i=new iM),this.configService.initConfig(i),i.debugMode?sessionStorage.setItem("debugMode","true"):sessionStorage.removeItem("debugMode"),this.autoLoginCalled||qn(this.afAuth).pipe(tt(1)).subscribe(r=>Q(this,null,function*(){if(this.autoLoginCalled=!0,r){let a=yield Sd(r,!0).catch(s=>null);if(a){let{user:s}=a?.claims;this.autoLoginRequired&&this.initializeClient(s,this.userOptions$?.value?T(I({},this.userOptions$?.value),{replaceContacts:!1,replaceGroupContacts:!1,replacePrivateContacts:!1}):{},new Date().getTime(),!0,"internal-autoLogin")}}}))}catch(r){this.loggingService.catch("Error in setApiKey: ",r)}}setUsersService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setUsersService","color: green;"),this.usersService=e}catch(i){this.loggingService.catch("Error in setUsersService: ",i)}}setDocService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocService","color: green;"),this.docService=e}catch(i){this.loggingService.catch("Error in setDocService: ",i)}}setContactService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setContactService","color: green;"),this.contactService=e}catch(i){this.loggingService.catch("Error in setContactService: ",i)}}setIamService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setIamService","color: green;"),this.iamService=e}catch(i){this.loggingService.catch("Error in setIamService: ",i)}}setAreaService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setAreaService","color: green;"),this.areaService=e}catch(i){this.loggingService.catch("Error in setAreaService: ",i)}}setCommentService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setCommentService","color: green;"),this.commentService=e}catch(i){this.loggingService.catch("Error in setCommentService: ",i)}}setReactionService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setReactionService","color: green;"),this.reactionService=e}catch(i){this.loggingService.catch("Error in setReactionService: ",i)}}setRecorderAnnotationService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setRecorderAnnotationService","color: green;"),this.recorderAnnotationService=e}catch(i){this.loggingService.catch("Error in setRecorderAnnotationService: ",i)}}setViewsService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setViewsService","color: green;"),this.viewsService=e}catch(i){this.loggingService.catch("Error in setViewsService: ",i)}}setCommonDbService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setCommonDbService","color: green;"),this.commonDbService=e}catch(i){this.loggingService.catch("Error in setCommonDbService: ",i)}}validateOrganizationId(e){if(this.isVersionGreaterThanOrEqualTo4()&&!e?.organizationId)if(this.analyticsService.trackEvent(X.Events.Core.SDK_VALIDATE_CLIENT_FAILED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,message:"Organization Id is not set",forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e)},!0,e.userSnippylyId),this.configService.getSF())this.loggingService.catch("OrganizationId is not set in Identify method",void 0,void 0,!0);else throw new Error("OrganizationId is not set in Identify method")}initializeClient(e,i,r,a,s){return Q(this,null,function*(){try{if(this.autoLoginRequired=!1,this.userOptions$.next(i),this.initializeClientToken)this.pendingUserLogin=e,this.pendingUserLoginSource=s;else{e.userSnippylyId=ym(this.configService.getApiKey(),e.userId),this.pendingUserLogin=void 0,this.pendingUserLoginSource=void 0,this.initializeClientToken=r;let m=yield qn(this.afAuth).pipe(tt(1)).toPromise().catch(h=>null),p=!0;if(this.providedUser=JSON.parse(JSON.stringify(e)),m){let h=yield Sd(m,!0).catch(D=>null);if(!h)return;let{user:_,firebaseConfig:E}=h.claims;if(m?.uid!==e?.userSnippylyId||e?.groupId!==_?.groupId||e?.organizationId!==_?.organizationId||i?.forceReset||!a&&e?.organizationId&&!this.forceReLoggedIn||this.forceReLoginRequiredForAdvancedQueries(e)||this.forceReLoginRequiredForRegion(e,E))localStorage.setItem(j.LOCAL_STORAGE.VELT_USER_FORCE_RE_LOGGED_IN,"true"),this.forceReLoggedIn=!0,yield this.signOutUser("internal");else{this.loggingService.log("%c[WB] Calling FUNCTION: reinitializeCurrentUser","color: green;"),this.loggingService.log("Keeping user");let D=yield Sd(m,!0).catch(oe=>null);if(!D)return;let{firebaseConfig:L,user:H,advancedQueries:K}=D.claims;this.validateOrganizationId(e),this.setFirebaseConfig(L),this.setAdvancedQueries(K),H&&(this.providedUser.isAdmin=!!H.isAdmin),this.initializeSignedInUser(m,a),p=!1,this.analyticsService.trackEvent(X.Events.Core.SDK_USER_AUTH_SUCCESS,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,authType:"auto",forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e),source:s})}}if(p){this.analyticsService.trackEvent(X.Events.Core.SDK_VALIDATE_CLIENT_TRIGGERED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e),source:s},!0,e.userSnippylyId,e.userId);let h=yr(this.functions,br({url:Xn.cloudFunction.validateClient,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:20*60*1e3}),_=ga(),E=(yield h({apiKey:this.apiKey,user:e,version:_,authToken:i?.authToken}))?.data;if(E.error){if(this.analyticsService.trackEvent(X.Events.Core.SDK_VALIDATE_CLIENT_FAILED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,message:E.error,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e),source:s},!0,e.userSnippylyId,e.userId),E.error&&typeof E.error=="string"&&E.error?.toLowerCase()?.includes("token expired"))if(this.tokenExpiredErrorCount++,this.tokenExpiredErrorCount<=this.TOKEN_EXPIRED_ERROR_COUNT_LIMIT){let D={code:"token_expired",message:"Token expired"};this.coreActionsService.triggerAction(Xi.ERROR,D)}else{let D={code:"too_many_retries",message:"Token expired. Too many retries."};this.coreActionsService.triggerAction(Xi.ERROR,D),this.analyticsService.trackEvent(X.Events.Core.SDK_JWT_EXPIRED_RETRY_EXCEEDED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,forceReset:this.userOptions$.value?.forceReset,source:s},!0,e.userSnippylyId,e.userId)}throw E.error}else this.tokenExpiredErrorCount=0;if(this.analyticsService.trackEvent(X.Events.Core.SDK_VALIDATE_CLIENT_SUCCESS,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e),source:s},!0,e.userSnippylyId,e.userId),this.validateOrganizationId(e),E.firebaseConfig){this.setFirebaseConfig(E.firebaseConfig),yield this.signInWithCustomToken(e,E.token),this.loggingService.log("new signed in user",this.afAuth.currentUser);let D=yield Sd(this.afAuth.currentUser,!0).catch(K=>null);if(!D)return;let{user:L,advancedQueries:H}=D.claims;this.setAdvancedQueries(H),this.providedUser.isAdmin=!!L?.isAdmin,this.initializeSignedInUser(this.afAuth.currentUser,a)}}this.initializeClientToken=0,this.lastLoggedInUserData={user:e,userOptions:i,initializeClientToken:r,autoLogin:a},this.checkForPendingLogin()}return e}catch(m){return this.initializeClientToken=0,this.checkForPendingLogin(),this.loggingService.catch("Error in initializeClient: ",m),Promise.resolve(null)}})}isVersionGreaterThanOrEqualTo4(){try{let e=ga();return(e?parseInt(e.split(".")?.[0]||"0"):0)>=4}catch(e){return this.loggingService.catch("Error in isVersionGreaterThanOrEqualTo4: ",e),!1}}forceReLoginRequiredForAdvancedQueries(e){try{let i=this.isVersionGreaterThanOrEqualTo4(),r=!1;try{let a=localStorage.getItem(j.LOCAL_STORAGE.VELT_ADVANCED_QUERIES);a&&(r=JSON.parse(a)?.advancedQueriesEnabled)}catch(a){this.loggingService.catch("Error in forceReLoginRequiredForAdvancedQueries: ",a)}return!!(i&&e.organizationId&&!r)}catch(i){return this.loggingService.catch("Error in forceReLoginRequiredForAdvancedQueries: ",i),!1}}forceReLoginRequiredForRegion(e,i){try{return!!(this.isVersionGreaterThanOrEqualTo4()&&e.organizationId&&!i?.region)}catch(r){return this.loggingService.catch("Error in forceReLoginRequiredForRegion: ",r),!1}}checkForPendingLogin(){this.pendingUserLogin&&this.initializeClient(this.pendingUserLogin,this.userOptions$?.value||{},new Date().getTime(),void 0,this.pendingUserLoginSource)}setFirebaseConfig(e){this.loggingService.log("%c[WB] Calling FUNCTION: setFirebaseConfig","color: green;");try{this.firebaseConfig$.value||this.firebaseConfig$.next({firebaseOptions:I(I({},Xn.firebaseConfig),e)})}catch(i){this.loggingService.catch("Error in setFirebaseConfig: ",i)}}getFirebaseConfig$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getFirebaseConfig","color: green;"),this.firebaseConfig$.asObservable()}getFirebaseConfig(){return this.loggingService.log("%c[WB] Calling FUNCTION: getFirebaseConfig","color: green;"),this.firebaseConfig$.value}setAdvancedQueries(e){this.loggingService.log("%c[WB] Calling FUNCTION: setAdvancedQueries","color: green;");try{e&&typeof e=="object"&&localStorage.setItem(j.LOCAL_STORAGE.VELT_ADVANCED_QUERIES,JSON.stringify(e)),this.advancedQueries$.next(e)}catch(i){this.loggingService.catch("Error in setAdvancedQueries: ",i)}}getAdvancedQueries$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getAdvancedQueries$","color: green;"),this.advancedQueries$.asObservable()}getAdvancedQueries(){return this.loggingService.log("%c[WB] Calling FUNCTION: getAdvancedQueries","color: green;"),this.advancedQueries$.value}getAdvancedQueriesEnabled$(){return Rn([this.configService.getConfig$(),this.getAdvancedQueries$()]).pipe(ce(()=>this.getAdvancedQueriesEnabled()),jn(()=>se(!1)))}getAdvancedQueriesEnabled(){try{return!this.configService.getConfig()?.advancedQueriesDisabled&&!!this.getAdvancedQueries()?.advancedQueriesEnabled}catch(e){return this.loggingService.catch("Error in getAdvancedQueriesEnabled: ",e),!1}}signOutPreviousUser(){return this.signOutPreviousUser$.asObservable()}getUser(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUser","color: green;"),this.afAuth?.currentUser?this.user$.value:null}getUser$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUser$","color: green;"),qn(this.afAuth).pipe(he(e=>e?this.user$.asObservable():se(null)))}getAuthUser(){return this.loggingService.log("%c[WB] Calling FUNCTION: getAuthUser","color: green;"),this.afAuth?.currentUser}getUserOptions(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUserOptions","color: green;"),this.userOptions$.value}getUserOptions$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUserOptions$","color: green;"),this.userOptions$.asObservable()}updateUser(e){this.loggingService.log("%c[WB] Calling FUNCTION: updateUser","color: green;");try{let i=this.user$.value;if(e.userId&&e.userId!==i?.userId||e?.groupId&&e?.groupId!==i?.groupId||e?.organizationId&&e?.organizationId!==i?.organizationId)this.providedUser=e,this.initializeClient(e,this.userOptions$?.value||{},new Date().getTime(),void 0,"internal-updateUser");else if(this.providedUser=I(I({},this.providedUser),e),i){let r=I(I({},i),e);this.updateUserInternally(r)}}catch(i){this.loggingService.catch("Error in updateUser: ",i)}}signInWithCustomToken(e,i,r="manual"){this.loggingService.log("%c[WB] Calling FUNCTION: signInWithCustomToken","color: green;");try{return bJ(this.afAuth,i).then(a=>(this.analyticsService.trackEvent(X.Events.Core.SDK_USER_AUTH_SUCCESS,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,authType:r,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e)}),a)).catch(a=>(this.analyticsService.trackEvent(X.Events.Core.SDK_USER_AUTH_FAILED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,authType:r,forceReset:this.userOptions$.value?.forceReset,message:a.message,user:this.getUserWithoutContacts(e)}),a))}catch(a){return this.loggingService.catch("Error in signInWithCustomToken: ",a),Promise.reject(a)}}resetServicesCache(){this.loggingService.log("%c[WB] Calling FUNCTION: resetServicesCache in AuthService","color: green;");try{this.commonDbService?.unsubscribeFromObservables(),this.docService?.clearCacheOnUserCascade(),this.contactService?.clearCache(),this.iamService?.clearCache(),this.areaService?.clearCache(),this.commentService?.clearCache(),this.reactionService?.clearCache(),this.recorderAnnotationService?.clearCache(),this.viewsService?.clearCache()}catch(e){this.loggingService.catch("Error in resetServicesCache: ",e)}}initializeSignedInUser(e,i){this.loggingService.log("%c[WB] Calling FUNCTION: initializeSignedInUser","color: green;");try{let r=new wo;r.userSnippylyId=e.uid,r.type="signedIn",this.mergeUserWithProvidedUserData(r,i)}catch(r){this.loggingService.catch("Error in initializeSignedInUser: ",r)}}mergeUserWithProvidedUserData(e,i){return Q(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: mergeUserWithProvidedUserData","color: green;");try{e.userId=this.providedUser?.userId||e.userId;let r=null;if(this.usersService?.userDataProviderAvailable()){let a=yield this.usersService.resolveUsers({userIds:[e.userId]});a&&a[e.userId]&&(r=JSON.parse(JSON.stringify(a[e.userId]||{}))),e=I(I({},e),r||{})}e.name=r?r?.name:this.providedUser?.name||e.name,e.clientUserName=r?r?.clientUserName:this.providedUser?.clientUserName||e.clientUserName,e.photoUrl=r?r?.photoUrl:this.providedUser?.photoUrl||e.photoUrl,e?.photoUrl===void 0&&(e.photoUrl=null),e.email=r?r?.email:this.providedUser?.email||e.email,e.color=r?r?.color:this.providedUser?.color||this.avatarService.generateUserColor(yn(e.userId)),e.textColor=r?r?.textColor:this.providedUser?.textColor||"#FFFFFF",e.initial=r?r?.initial:this.providedUser?.initial||e.initial||e.name?.charAt(0).toUpperCase()||e.email?.charAt(0).toUpperCase(),e.contacts=this.providedUser?.contacts||e.contacts,e.plan=this.providedUser?.plan||e.plan,e.groupId=this.providedUser?.groupId||e.groupId,e.clientGroupId=this.providedUser?.clientGroupId||e.clientGroupId,e.clientOrganizationId=this.providedUser?.clientOrganizationId||e.clientOrganizationId,e.organizationId=this.providedUser?.organizationId||e.organizationId,e.isAdmin=this.providedUser?.isAdmin,e.isReadOnly=this.providedUser?.isReadOnly,e.isAnonymous=this.providedUser?.isAnonymous,e.isGuest=this.providedUser?.isGuest,this.updateUserInternally(e)}catch(r){this.loggingService.catch("Error in mergeUserWithProvidedUserData: ",r)}})}updateUserInternally(e){return Q(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: updateUserInternally","color: green;");try{let i=Object.assign({},e);delete i.contacts,this.analyticsService.identifyUser(e.userSnippylyId,i,{forceReset:this.userOptions$.value?.forceReset}),this.getPlanDetailsCalled||(yield this.getPlanDetailsFromDb()),this.afAuth.currentUser&&(this.user$.next(e),this.updateUserToFirebase(e))}catch(i){this.loggingService.catch("Error in updateUserInternally: ",i)}})}updateUserToFirebase(e){this.loggingService.log("%c[WB] Calling FUNCTION: updateUserToFirebase","color: green;");try{let i=JSON.parse(JSON.stringify(e)),r=T(I({},i),{lastUpdated:new Date})}catch(i){this.loggingService.catch("Error in updateUserToFirebase: ",i)}}getPlanDetailsFromDb(){return Q(this,null,function*(){try{this.getPlanDetailsCalled=!0;let i=yield yr(this.functions,br({url:Xn.cloudFunction.getPlanDetails,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:20*60*1e3})({apiKey:this.configService.getApiKey(),sdkVersion:ga(),sdkType:this.configService.getSdkType()});return i?.data?.isPlanExpired&&(this.analyticsService.trackEvent(X.Events.Core.SDK_PLAN_EXPIRED),this.configService.getSF()||console.warn("Velt SDK plan has expired.")),this.planDetails$.next(i?.data||{planInfo:null,isPlanExpired:!1}),i}catch(e){return this.loggingService.catch("Error in getPlanDetailsFromDb: ",e),this.planDetails$.next({planInfo:null,isPlanExpired:!1}),Promise.resolve(null)}})}isPlanExpired$(){return this.planDetails$.pipe(Fe(e=>!!e),ce(e=>!!e?.isPlanExpired))}isPlanExpired(){return this.planDetails$.getValue()?.isPlanExpired}addPreSignOutFuction(e,i){try{this.preSignOutFunctions.set(e,i)}catch(r){this.loggingService.catch("Error in addPreSignOutFuction: ",r)}}setUserOrganization(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setUserOrganization","color: green;");let i=JSON.parse(JSON.stringify(this.userOrganization$.value||{}));this.getUser()?.organizationId===e?.organizationId?(i.metadata=e,this.userOrganization$.next(i)):this.userOrganization$.next(null)}catch(i){this.loggingService.catch("Error in setUserOrganization: ",i)}}setOrganizationUserGroups(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setUserOrganizationGroups","color: green;");let i=JSON.parse(JSON.stringify(this.userOrganization$.value||{}));this.getUser()?.organizationId===i?.metadata?.organizationId&&(i.groups=e,this.userOrganization$.next(i))}catch(i){this.loggingService.catch("Error in setUserOrganizationGroups: ",i)}}getUserOrganization$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUserOrganization$","color: green;"),this.getUser$().pipe(he(e=>e?this.userOrganization$.asObservable().pipe(ce(i=>i?.metadata?.organizationId===e.organizationId?i:null)):se(null)))}signOutUser(e="internal"){return Q(this,null,function*(){try{yield this.analyticsService.trackEvent(X.Events.Core.SDK_USER_SIGN_OUT,{apiKey:this.apiKey,clientUserId:this.user$?.value?.userId,snippylyUserId:this.user$?.value?.userSnippylyId,message:e==="external"?"User Sign out":"System Sign out",user:this.user$?.value?this.getUserWithoutContacts(this.user$?.value):null,forceReset:this.userOptions$.value?.forceReset,source:e});let i=yield qn(this.afAuth).pipe(tt(1)).toPromise().catch(r=>null);if(i){this.user$.next(null);for(let[r,a]of this.preSignOutFunctions)try{yield a(i)}catch(s){this.loggingService.catch(`Error in signOutUser ${r} function: `,s)}return this.resetServicesCache(),this.user$.next(null),IJ(this.afAuth).catch(r=>{this.loggingService.catch("Error in signOutUser:",r)})}else return Promise.resolve()}catch(i){this.loggingService.catch("Error in signOutUser: ",i)}})}isFeatureAllowed(e){return eo(this.config,this.user$.value,e)}getUserWithoutContacts(e){try{if(e){let i=JSON.parse(JSON.stringify(e));return delete i.contacts,i}else return null}catch(i){return this.loggingService.catch("Error in getUserWithoutContacts: ",i),null}}getUserForClient(e){try{return ha(e)}catch(i){return this.loggingService.catch("Error in getUserForClient: ",i),null}}};o.\u0275fac=function(i){return new(i||o)(J(bi),J(jt),J(Dm),J(wm),J(Ne),J(jo),J(Ze),J(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Om=class{constructor({apiKey:o,documentId:t,organizationId:e,clientDocumentId:i,clientOrganizationId:r}){this.paths={},this.apiKey=o,this.documentId=t,this.organizationId=e,this.clientDocumentId=i,this.clientOrganizationId=r,i&&(this.documentId=Cc(i)),r&&(this.organizationId=_c(r)),this.generateDocumentPaths()}generateDocumentPaths(){try{if(this.paths.clientDocumentId=this.clientDocumentId,this.paths.documentId=this.documentId,this.organizationId&&(this.paths.organizationId=this.organizationId,this.paths.clientOrganizationId=this.clientOrganizationId),this.apiKey){let o=`${this.apiKey}`;this.organizationId&&(o=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.paths.organizationId}`),this.documentId&&(this.paths.docs=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/`,this.paths.presence=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_PRESENCE}/`,this.paths.cursor=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_CURSOR}/`,this.paths.comment=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_COMMENT}/`,this.paths.multiThread=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_MULTI_THREAD}/`,this.paths.tag=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_TAG}/`,this.paths.area=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_AREA}/`,this.paths.arrow=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_ARROW}/`,this.paths.selection=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_SELECTION}/`,this.paths.audioHuddle=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_AUDIO_HUDDLE}/`,this.paths.huddle=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_HUDDLE}/`,this.paths.recorder=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_RECORDER}/`,this.paths.flock=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_FOLLOW_ALONG}/`,this.paths.syncVideoPlayer=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_SYNC_VIDEO_PLAYER}/`,this.paths.liveState=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_LIVE_STATE}/`,this.paths.liveStateSingleEditorMode=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_LIVE_STATE}/default/singleEditorMode`,this.paths.reaction=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_REACTION}/`,this.paths.views=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_VIEWS}/`,this.paths.notifications=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATIONS}/`,this.paths.metadata=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_METADATA}/`,this.paths.users=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_USERS}/`,this.paths.documentIam=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_IAM}/`,this.paths.userConfig=`${o}/${j.FIREBASE_PARTIAL_PATH_USERS}`),this.paths.customerMetadata=`${o}/${j.FIREBASE_PARTIAL_PATH_CUSTOMER_METADATA}/`,this.paths.groupContacts=`${o}/${j.FIREBASE_PARTIAL_PATH_CONTACTS}/${j.FIREBASE_PARTIAL_PATH_GROUPS}/`,this.paths.globalContacts=`${o}/${j.FIREBASE_PARTIAL_PATH_CONTACTS}/${j.FIREBASE_PARTIAL_PATH_GLOBAL}/`,this.paths.logins=`${o}/${j.FIREBASE_PARTIAL_PATH_CONTACTS}/${j.FIREBASE_PARTIAL_PATH_LOGINS}/`,this.paths.userFeedback=`${o}/${j.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${j.FIREBASE_PARTIAL_PATH_FEEDBACK}/`,this.paths.userReportBugs=`${o}/${j.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${j.FIREBASE_PARTIAL_PATH_BUGS}/`,this.paths.userContactUs=`${o}/${j.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${j.FIREBASE_PARTIAL_PATH_CONTACT_US}/`,this.organizationId&&(this.paths.organizationMetadata=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_METADATA}/`,this.paths.organizationIam=`${o}/${j.FIREBASE_PARTIAL_PATH_IAM}/`,this.paths.organizationGroups=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_GROUPS}/`,this.paths.organizationNotifications=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/`,this.documentId&&(this.paths.organizationNotificationsWithDocumentId=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/`),this.paths.organizationNotificationsLastNotificationTimestamp=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${j.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}/${j.FIREBASE_PARTIAL_PATH_DOCS}/`,this.paths.organizationNotificationsUsers=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${j.FIREBASE_PARTIAL_PATH_USERS}/`),this.paths.workspaceIam=`${this.apiKey}/${j.FIREBASE_PARTIAL_PATH_IAM}/`}}catch{}}get userConfig(){return this.paths.userConfig?this.paths.userConfig:this.throwError("User config path is not available.")}get workspaceIam(){return this.paths.workspaceIam?this.paths.workspaceIam:this.throwError("Workspace IAM path is not available.")}get docs(){return this.paths.docs?this.paths.docs:this.throwError("Docs path is not available.")}get presence(){return this.paths.presence?this.paths.presence:this.throwError("Presence path is not available.")}get cursor(){return this.paths.cursor?this.paths.cursor:this.throwError("Cursor path is not available.")}get area(){return this.paths.area?this.paths.area:this.throwError("Area path is not available.")}get arrow(){return this.paths.arrow?this.paths.arrow:this.throwError("Arrow path is not available.")}get comment(){return this.paths.comment?this.paths.comment:this.throwError("Comment path is not available.")}get multiThread(){return this.paths.multiThread?this.paths.multiThread:this.throwError("Multi thread path is not available.")}get tag(){return this.paths.tag?this.paths.tag:this.throwError("Tag path is not available.")}get selection(){return this.paths.selection?this.paths.selection:this.throwError("Selection path is not available.")}get audioHuddle(){return this.paths.audioHuddle?this.paths.audioHuddle:this.throwError("Audio huddle path is not available.")}get huddle(){return this.paths.huddle?this.paths.huddle:this.throwError("Huddle path is not available.")}get recorder(){return this.paths.recorder?this.paths.recorder:this.throwError("Recorder path is not available.")}get flock(){return this.paths.flock?this.paths.flock:this.throwError("Flock path is not available.")}get syncVideoPlayer(){return this.paths.syncVideoPlayer?this.paths.syncVideoPlayer:this.throwError("Sync video player path is not available.")}get liveState(){return this.paths.liveState?this.paths.liveState:this.throwError("Live state path is not available.")}get liveStateSingleEditorMode(){return this.paths.liveStateSingleEditorMode?this.paths.liveStateSingleEditorMode:this.throwError("Live state single editor mode path is not available.")}get reaction(){return this.paths.reaction?this.paths.reaction:this.throwError("Reaction path is not available.")}get views(){return this.paths.views?this.paths.views:this.throwError("Views path is not available.")}get notifications(){return this.paths.notifications?this.paths.notifications:this.throwError("Notifications path is not available.")}get metadata(){return this.paths.metadata?this.paths.metadata:this.throwError("Metadata path is not available.")}get users(){return this.paths.users?this.paths.users:this.throwError("Users path is not available.")}get documentIam(){return this.paths.documentIam?this.paths.documentIam:this.throwError("Document IAM path is not available.")}get organizationMetadata(){return this.paths.organizationMetadata?this.paths.organizationMetadata:this.throwError("Organization metadata path is not available.")}get organizationIam(){return this.paths.organizationIam?this.paths.organizationIam:this.throwError("Organization IAM path is not available.")}get customerMetadata(){return this.paths.customerMetadata?this.paths.customerMetadata:this.throwError("Customer metadata path is not available.")}get groupContacts(){return this.paths.groupContacts?this.paths.groupContacts:this.throwError("Group contacts path is not available.")}get globalContacts(){return this.paths.globalContacts?this.paths.globalContacts:this.throwError("Global contacts path is not available.")}get logins(){return this.paths.logins?this.paths.logins:this.throwError("Logins path is not available.")}get userFeedback(){return this.paths.userFeedback?this.paths.userFeedback:this.throwError("User feedback path is not available.")}get userReportBugs(){return this.paths.userReportBugs?this.paths.userReportBugs:this.throwError("User report bugs path is not available.")}get userContactUs(){return this.paths.userContactUs?this.paths.userContactUs:this.throwError("User contact us path is not available.")}get organizationGroups(){return this.paths.organizationGroups?this.paths.organizationGroups:this.throwError("Organization groups path is not available.")}get organizationNotifications(){return this.paths.organizationNotifications?this.paths.organizationNotifications:this.throwError("Organization notifications path is not available.")}get organizationNotificationsWithDocumentId(){return this.paths.organizationNotificationsWithDocumentId?this.paths.organizationNotificationsWithDocumentId:this.throwError("Organization notifications with document id path is not available.")}get organizationNotificationsUsers(){return this.paths.organizationNotificationsUsers?this.paths.organizationNotificationsUsers:this.throwError("Organization notifications users path is not available.")}get organizationNotificationsLastNotificationTimestamp(){return this.paths.organizationNotificationsLastNotificationTimestamp?this.paths.organizationNotificationsLastNotificationTimestamp:this.throwError("Organization notifications last notification timestamp path is not available.")}throwError(o){throw{type:"DocumentPaths",message:o,metadata:{apiKey:this.apiKey,documentId:this.documentId,organizationId:this.organizationId}}}};var IM=class{constructor({apiKey:o,documentId:t,organizationId:e,clientDocumentId:i,clientOrganizationId:r,folderId:a,veltFolderId:s}){this.paths={},this.apiKey=o,this.documentId=t,this.organizationId=e,this.veltFolderId=s,i&&(this.documentId=Cc(i)),r&&(this.organizationId=_c(r)),a&&(this.folderId=a,this.veltFolderId=Tl(a)),this.generateDocumentPaths()}generateDocumentPaths(){try{if(this.paths.clientDocumentId=this.clientDocumentId,this.paths.documentId=this.documentId,this.organizationId&&(this.paths.organizationId=this.organizationId,this.paths.clientOrganizationId=this.clientOrganizationId),this.veltFolderId&&(this.paths.folderId=this.folderId,this.paths.veltFolderId=this.veltFolderId),this.apiKey){let o=`apiKey/${this.apiKey}`;this.organizationId&&(o=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.paths.organizationId}`,this.paths.organization=o,this.paths.folder=`${o}/${j.FIREBASE_PARTIAL_PATH_FOLDERS}`,this.paths.organizationUsers=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_USERS}`,this.paths.notificationDocs=`${o}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATION_DOCS}`,this.paths.notificationUsers=`${o}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATION_USERS}`,this.paths.organizationGroups=`${o}/${j.FIREBASE_PARTIAL_PATH_GROUPS}`,this.paths.lastNotificationTimestamp=`${o}/${j.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}`,this.paths.userConfig=`${o}/${j.FIREBASE_PARTIAL_PATH_USERS}`),this.veltFolderId&&(this.paths.folderUsers=`${o}/${j.FIREBASE_PARTIAL_PATH_FOLDERS}/${this.veltFolderId}/${j.FIREBASE_PARTIAL_PATH_FOLDER_USERS}`),this.documentId&&(this.paths.document=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}`,this.paths.comment=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_COMMENT}`,this.paths.location=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_LOCATION}`,this.paths.multiThread=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_MULTI_THREAD}`,this.paths.area=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_AREA}`,this.paths.recorder=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_RECORDER}`,this.paths.reaction=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_REACTION}`,this.paths.commentViews=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_COMMENT_VIEWS}`,this.paths.notificationViews=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATION_VIEWS}`,this.paths.documentViews=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS}`,this.paths.locationViews=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS}`,this.paths.documentUsers=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS}`,this.paths.docNotification=`${this.paths.notificationDocs}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_DOC_NOTIFICATION}`)}}catch{}}get userConfig(){return this.paths.userConfig?this.paths.userConfig:this.throwError("UserConfig path is not available.")}get folder(){return this.paths.folder?this.paths.folder:this.throwError("Folder path is not available.")}get lastNotificationTimestamp(){return this.paths.lastNotificationTimestamp?this.paths.lastNotificationTimestamp:this.throwError("LastNotificationTimestamp path is not available.")}get organizationGroups(){return this.paths.organizationGroups?this.paths.organizationGroups:this.throwError("organizationGroups path is not available.")}get docNotification(){return this.paths.docNotification?this.paths.docNotification:this.throwError("DocNotification path is not available.")}get organization(){return this.paths.organization?this.paths.organization:this.throwError("Organization path is not available.")}get document(){return this.paths.document?this.paths.document:this.throwError("Document path is not available.")}get location(){return this.paths.location?this.paths.location:this.throwError("Location path is not available.")}get area(){return this.paths.area?this.paths.area:this.throwError("Area path is not available.")}get comment(){return this.paths.comment?this.paths.comment:this.throwError("Comment path is not available.")}get commentViews(){return this.paths.commentViews?this.paths.commentViews:this.throwError("CommentViews path is not available.")}get documentViews(){return this.paths.documentViews?this.paths.documentViews:this.throwError("DocumentViews path is not available.")}get locationViews(){return this.paths.locationViews?this.paths.locationViews:this.throwError("LocationViews path is not available.")}get notificationViews(){return this.paths.notificationViews?this.paths.notificationViews:this.throwError("NotificationViews path is not available.")}get documentUsers(){return this.paths.documentUsers?this.paths.documentUsers:this.throwError("DocumentUsers path is not available.")}get folderUsers(){return this.paths.folderUsers?this.paths.folderUsers:this.throwError("FolderUsers path is not available.")}get organizationUsers(){return this.paths.organizationUsers?this.paths.organizationUsers:this.throwError("OrganizationUsers path is not available.")}get notificationDocs(){return this.paths.notificationDocs?this.paths.notificationDocs:this.throwError("NotificationDocs path is not available.")}get notificationUsers(){return this.paths.notificationUsers?this.paths.notificationUsers:this.throwError("NotificationUsers path is not available.")}get multiThread(){return this.paths.multiThread?this.paths.multiThread:this.throwError("Multi thread path is not available.")}get recorder(){return this.paths.recorder?this.paths.recorder:this.throwError("Recorder path is not available.")}get reaction(){return this.paths.reaction?this.paths.reaction:this.throwError("Reaction path is not available.")}throwError(o){throw{type:"DocumentPaths",message:o,metadata:{apiKey:this.apiKey,documentId:this.documentId,organizationId:this.organizationId}}}};var EM=class{};var hn=(()=>{let o=class o{constructor(e,i){this.authService=e,this.loggingService=i,this.db$=new Ce(null);try{this.authService.getFirebaseConfig$().subscribe(r=>{r&&this.db$.next(jf(void 0,r.firebaseOptions.databaseURL))},r=>{this.loggingService.catch("Error in DatabaseService constructor: ",r)})}catch(r){this.loggingService.catch("Error in DatabaseService constructor:",r)}}getDb(){return this.db$.asObservable()}};o.\u0275fac=function(i){return new(i||o)(J(He),J(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var xs=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.analyticsService=i,this.resolveTimeout=1*60*1e3,this.retrySaveConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryDeleteConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryGetConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.commentAnnotationDataProvider$=new Ce(null),this.commentAnnotationById$=new Ce({}),this.getCommentAnnotationById=r=>{try{return this.commentAnnotationDataProviderAvailable()?this.commentAnnotationById$.value?.[r]:void 0}catch(a){this.loggingService.catch("Error in CommentAnnotationsResolverService getCommentAnnotationById:",a);return}};try{this.loggingService.log("CommentAnnotationsResolverService initialized"),this.commentAnnotationDataProvider$.subscribe(r=>{r&&(r.config?.resolveTimeout&&(this.resolveTimeout=r.config.resolveTimeout),r.config?.saveRetryConfig&&(this.retrySaveConfig=r.config.saveRetryConfig),r.config?.deleteRetryConfig&&(this.retryDeleteConfig=r.config.deleteRetryConfig),r.config?.getRetryConfig&&(this.retryGetConfig=r.config.getRetryConfig))})}catch(r){this.loggingService.catch("Error in CommentAnnotationsResolverService constructor:",r)}}getProvider(){try{let e=this.commentAnnotationDataProvider$.getValue();return e||void 0}catch(e){this.loggingService.catch("Error in CommentAnnotationsResolverService getProvider:",e);return}}ngOnDestroy(){try{this.commentAnnotationById$.next({})}catch(e){this.loggingService.catch("Error in CommentAnnotationsResolverService ngOnDestroy:",e)}}resolveCommentAnnotations(e){return Q(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: resolveCommentAnnotations","color: green;"),!this.commentAnnotationDataProviderAvailable())return{};let i,r=!1,a=!1,s=()=>{i&&(clearTimeout(i),i=void 0,a=!0)};return new Promise((m,p)=>{i=setTimeout(()=>{a||(r=!0,s(),p(new Error("Comment annotation resolution timeout")))},this.commentAnnotationDataProvider$.value?.config?.resolveTimeout||this.resolveTimeout);let h=this.getProvider();if(!h)return s(),m({});let _={},E=[...new Set(e.commentAnnotationIds||[])],D=T(I({},e),{commentAnnotationIds:E});Q(this,null,function*(){try{if(E.length>0||e.documentIds?.length||e.folderId){let H=Sc(()=>h?.get(D)||Promise.resolve(void 0),"getCommentAnnotations",this.retryGetConfig).then(K=>r?{}:(s(),K&&K.statusCode!==200?(this.loggingService.catch(K?.message??"Error in CommentAnnotationsResolverService resolveCommentAnnotations:"),{}):K?.data)).catch(K=>{throw s(),K});try{_=(yield H)||{},this.analyticsService.trackEvent(X.Events.Resolver.COMMENT_RESOLVER_GET,{sourceMethod:"resolveCommentAnnotations",source:"sdk",commentAnnotationIds:E});let K={};Object.entries(_).forEach(([oe,ue])=>{let be=this.commentAnnotationById$.value?.[oe];be?be&&JSON.stringify(be)!==JSON.stringify(ue)&&(K[oe]=ue):K[oe]=ue}),Object.keys(K).length>0&&this.commentAnnotationById$.next(I(I({},this.commentAnnotationById$.getValue()),K)),m(K)}catch(K){r||p(K),m(_)}}else s(),m({})}catch(H){s(),p(H)}})})}catch(i){return this.loggingService.catch("Error in CommentAnnotationsResolverService resolveCommentAnnotations:",i),{}}})}saveCommentAnnotation(e){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: saveCommentAnnotation","color: green;");let i=this.getProvider();if(!this.commentAnnotationDataProviderAvailable())throw new Error("Comment annotation save data provider not available");let r=JSON.parse(JSON.stringify(this.commentAnnotationById$.getValue()));this.commentAnnotationById$._value=I(I({},r),e.commentAnnotation);let a=yield Sc(()=>i?.save({commentAnnotation:e.commentAnnotation,event:e.eventType,commentId:e.commentId,metadata:Object.values(e.commentAnnotation??{})?.[0]?.metadata})||Promise.resolve(void 0),"saveCommentAnnotation",this.retrySaveConfig);return a&&a.statusCode!==200?(this.retrySaveConfig.revertOnFailure&&(this.commentAnnotationById$._value=r),this.loggingService.catch(a?.message??"Error in CommentAnnotationsResolverService saveCommentAnnotation:"),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(X.Events.Resolver.COMMENT_RESOLVER_SAVE,{sourceMethod:"saveCommentAnnotation",source:"sdk",commentAnnotationIds:Object.keys(e.commentAnnotation),eventType:e.eventType,commentId:e.commentId}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0})}catch(i){return this.loggingService.warn("Error in CommentAnnotationsResolverService saveCommentAnnotation:",i),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0}}})}deleteCommentAnnotation(e,i){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: deleteCommentAnnotation","color: green;");let r=this.getProvider();if(!this.commentAnnotationDataProviderAvailable())throw new Error("Comment annotation delete data provider not available");let a=this.commentAnnotationById$.getValue(),s=I({},a);delete s?.[e],this.commentAnnotationById$._value=s;let m=yield Sc(()=>r?.delete({commentAnnotationId:e.toString(),metadata:i,event:Ya.COMMENT_ANNOTATION_DELETE})||Promise.resolve(void 0),"deleteCommentAnnotation",this.retryDeleteConfig);return m&&m.statusCode!==200?(this.retryDeleteConfig.revertOnFailure&&(this.commentAnnotationById$._value=a),this.loggingService.catch(m?.message??"Error in CommentAnnotationsResolverService deleteCommentAnnotation:"),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(X.Events.Resolver.COMMENT_RESOLVER_DELETE,{sourceMethod:"deleteCommentAnnotation",source:"sdk",commentAnnotationId:e.toString()}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(r){return this.loggingService.warn("Error in CommentAnnotationsResolverService deleteCommentAnnotation:",r),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0}}})}getCommentAnnotationsById$(){try{return this.commentAnnotationDataProviderAvailable()?(this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: getCommentAnnotationsById$","color: green;"),this.commentAnnotationById$.asObservable()):se(void 0)}catch(e){return this.loggingService.catch("Error in CommentAnnotationsResolverService getCommentAnnotationsById$:",e),se(void 0)}}getAnnotationById(e){try{return this.commentAnnotationDataProviderAvailable()?this.commentAnnotationById$.getValue()?.[e]:void 0}catch(i){this.loggingService.catch("Error in CommentAnnotationsResolverService getAnnotationById:",i);return}}setCommentAnnotationDataProvider(e){try{if(e){this.loggingService.log("Setting comment annotation data provider");let r=["get","save","delete"].filter(a=>!(a in e)||typeof e[a]!="function");if(r.length>0){let a=`DataProviders.comment is invalid. The following methods are missing or are not functions: ${r.join(", ")}.`;this.loggingService.catch(a);return}else this.commentAnnotationDataProvider$.next(e)}}catch(i){this.loggingService.catch("Error in CommentAnnotationsResolverService setCommentAnnotationDataProvider:",i)}}commentAnnotationDataProviderAvailable(){try{return!!this.commentAnnotationDataProvider$.getValue()}catch(e){return this.loggingService.catch("Error in CommentAnnotationsResolverService commentAnnotationDataProviderAvailable:",e),!1}}};o.\u0275fac=function(i){return new(i||o)(J(y),J(Ze))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Am=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.analyticsService=i,this.resolveTimeout=1*60*1e3,this.retrySaveConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryDeleteConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryGetConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.reactionAnnotationDataProvider$=new Ce(null),this.reactionAnnotationById$=new Ce({}),this.getReactionAnnotationById=r=>{try{return this.reactionAnnotationDataProviderAvailable()?this.reactionAnnotationById$.value?.[r]:void 0}catch(a){this.loggingService.catch("Error in ReactionAnnotationsResolverService getReactionAnnotationById:",a);return}};try{this.loggingService.log("ReactionAnnotationsResolverService initialized"),this.reactionAnnotationDataProvider$.subscribe(r=>{r&&(r.config?.resolveTimeout&&(this.resolveTimeout=r.config.resolveTimeout),r.config?.saveRetryConfig&&(this.retrySaveConfig=r.config.saveRetryConfig),r.config?.deleteRetryConfig&&(this.retryDeleteConfig=r.config.deleteRetryConfig),r.config?.getRetryConfig&&(this.retryGetConfig=r.config.getRetryConfig))})}catch(r){this.loggingService.catch("Error in ReactionAnnotationsResolverService constructor:",r)}}getProvider(){try{let e=this.reactionAnnotationDataProvider$.getValue();return e||void 0}catch(e){this.loggingService.catch("Error in ReactionAnnotationsResolverService getProvider:",e);return}}ngOnDestroy(){try{this.reactionAnnotationById$.next({})}catch(e){this.loggingService.catch("Error in ReactionAnnotationsResolverService ngOnDestroy:",e)}}resolveReactionAnnotations(e){return Q(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: resolveReactionAnnotations","color: green;"),!this.reactionAnnotationDataProviderAvailable())return{};let i,r=!1,a=!1,s=()=>{i&&(clearTimeout(i),i=void 0,a=!0)};return new Promise((m,p)=>{i=setTimeout(()=>{a||(r=!0,s(),p(new Error("Reaction annotation resolution timeout")))},this.reactionAnnotationDataProvider$.value?.config?.resolveTimeout||this.resolveTimeout);let h=this.getProvider();if(!h)return s(),m({});let _={},E=[...new Set(e.reactionAnnotationIds||[])],D=T(I({},e),{reactionAnnotationIds:E});Q(this,null,function*(){try{if(E.length>0||e.documentIds?.length||e.folderId){let H=Sc(()=>h?.get(D)||Promise.resolve(void 0),"getReactionAnnotations",this.retryGetConfig).then(K=>r?{}:(s(),K&&K.statusCode!==200?(this.loggingService.catch(K?.message??"Error in ReactionAnnotationsResolverService resolveReactionAnnotations:"),{}):K?.data)).catch(K=>{throw s(),K});try{_=(yield H)||{},this.analyticsService.trackEvent(X.Events.Resolver.REACTION_RESOLVER_GET,{sourceMethod:"resolveReactionAnnotations",source:"sdk",reactionAnnotationIds:E});let K={};Object.entries(_).forEach(([oe,ue])=>{let be=this.reactionAnnotationById$.value?.[oe];be?be&&JSON.stringify(be)!==JSON.stringify(ue)&&(K[oe]=ue):K[oe]=ue}),Object.keys(K).length>0&&this.reactionAnnotationById$.next(I(I({},this.reactionAnnotationById$.getValue()),K)),m(K)}catch(K){r||p(K),m(_)}}else s(),m({})}catch(H){s(),p(H)}})})}catch(i){return this.loggingService.catch("Error in ReactionAnnotationsResolverService resolveReactionAnnotations:",i),{}}})}saveReactionAnnotation(e){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: saveReactionAnnotation","color: green;");let i=this.getProvider();if(!this.reactionAnnotationDataProviderAvailable())throw new Error("Reaction annotation save data provider not available");let r=JSON.parse(JSON.stringify(this.reactionAnnotationById$.getValue()));this.reactionAnnotationById$._value=I(I({},r),e);let a={reactionAnnotation:e,event:Ya.REACTION_ADD,metadata:Object.values(e??{})?.[0]?.metadata},s=yield Sc(()=>i?.save(a)||Promise.resolve(void 0),"saveReactionAnnotation",this.retrySaveConfig);return s&&s.statusCode!==200?(this.retrySaveConfig.revertOnFailure&&(this.reactionAnnotationById$._value=r),this.loggingService.catch(s?.message??"Error in ReactionAnnotationsResolverService saveReactionAnnotation:"),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(X.Events.Resolver.REACTION_RESOLVER_SAVE,{sourceMethod:"saveReactionAnnotation",source:"sdk",reactionAnnotationIds:Object.keys(e),eventType:a.event}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0})}catch(i){return this.loggingService.warn("Error in ReactionAnnotationsResolverService saveReactionAnnotation:",i),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0}}})}deleteReactionAnnotation(e,i){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: deleteReactionAnnotation","color: green;");let r=this.getProvider();if(!this.reactionAnnotationDataProviderAvailable())throw new Error("Reaction annotation delete data provider not available");let a=JSON.parse(JSON.stringify(this.reactionAnnotationById$.getValue())),s=I({},a);delete s?.[e],this.reactionAnnotationById$._value=s;let m=yield Sc(()=>r?.delete({reactionAnnotationId:e.toString(),metadata:i,event:Ya.REACTION_DELETE})||Promise.resolve(void 0),"deleteReactionAnnotation",this.retryDeleteConfig);return m&&m.statusCode!==200?(this.retryDeleteConfig.revertOnFailure&&(this.reactionAnnotationById$._value=a),this.loggingService.catch(m?.message??"Error in ReactionAnnotationsResolverService deleteReactionAnnotation:"),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(X.Events.Resolver.REACTION_RESOLVER_DELETE,{sourceMethod:"deleteReactionAnnotation",source:"sdk",reactionAnnotationId:e.toString()}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(r){return this.loggingService.warn("Error in ReactionAnnotationsResolverService deleteReactionAnnotation:",r),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0}}})}getReactionAnnotationsById$(){try{return this.reactionAnnotationDataProviderAvailable()?(this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: getReactionAnnotationsById$","color: green;"),this.reactionAnnotationById$.asObservable()):se(void 0)}catch(e){return this.loggingService.catch("Error in ReactionAnnotationsResolverService getReactionAnnotationsById$:",e),se(void 0)}}getAnnotationById(e){try{return this.reactionAnnotationDataProviderAvailable()?this.reactionAnnotationById$.getValue()?.[e]:void 0}catch(i){this.loggingService.catch("Error in ReactionAnnotationsResolverService getAnnotationById:",i);return}}setReactionAnnotationDataProvider(e){try{if(e){this.loggingService.log("Setting reaction annotation data provider");let r=["get","save","delete"].filter(a=>!(a in e)||typeof e[a]!="function");if(r.length>0){let a=`DataProviders.reaction is invalid. The following methods are missing or are not functions: ${r.join(", ")}.`;this.loggingService.catch(a);return}else this.reactionAnnotationDataProvider$.next(e)}}catch(i){this.loggingService.catch("Error in ReactionAnnotationsResolverService setReactionAnnotationDataProvider:",i)}}reactionAnnotationDataProviderAvailable(){try{return!!this.reactionAnnotationDataProvider$.getValue()}catch(e){return this.loggingService.catch("Error in ReactionAnnotationsResolverService reactionAnnotationDataProviderAvailable:",e),!1}}};o.\u0275fac=function(i){return new(i||o)(J(y),J(Ze))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var lt=(()=>{let o=class o{constructor(e,i,r,a,s,m,p,h,_){this.analyticsService=e,this.authService=i,this.databaseService=r,this.domService=a,this.configService=s,this.loggingService=m,this.commentResolverService=p,this.reactionResolverService=h,this.coreActionsService=_,this.documentPaths$=new Ce(null),this.documentIds$=new Ce([]),this.organizationConfig$=new Ce(null),this.firestorePaths$=new Ce(null),this.location$=new Ce(null),this.excludedLocationIds$=new Ce([]),this.organizationMetadata$=new Ce(null),this.documentMetadata$=new Ce(null),this.locationMetadata$=new Ce(null),this.customerMetadata$=new Ce(null),this.currentDocumentId=null,this.isCustomDocId=!1,this.locations$=new Ce({}),this.preDocumentIdChangeFunctions=new Map,this.draftDocuments=[],this.clientDocumentMetadataMap={},this.uiState=new Ce({}),this.lastSetDocumentIdExecutionTime=0,this.lastSetDocumentIdCallTime=0,this.setDocumentIdSubject=new Ke,this.DEBOUNCE_TIME=5e3,this.MAX_QUEUE_SIZE=100,this.queueSize=0,this.isDocumentIdInDebounceQueue=!1,this.draftLocationMap={locations:[],options:void 0};try{this.loggingService.log("%c[WB] Creating CLASS: DocService","color: blue;"),this.domService.setDocService(this),this.authService.setDocService(this),this.setDocumentIdSubject.pipe(rr(this.DEBOUNCE_TIME)).subscribe({next:E=>Q(this,null,function*(){try{yield this.setDocumentIdImpl(E.documentId,E.clientOrganizationId,E.options),this.lastSetDocumentIdExecutionTime=Date.now(),this.isDocumentIdInDebounceQueue=!1,this.draftLocationMap.locations.length&&(yield this.setLocations({locations:this.draftLocationMap.locations,options:this.draftLocationMap.options,source:"internal"})),this.draftLocationMap={locations:[],options:void 0}}finally{this.queueSize--}}),error:E=>{this.loggingService.catch("Error in setDocumentId subscription:",E),this.queueSize--}}),this.databaseService.getDb().pipe(Fe(E=>!!E),tt(1)).subscribe(E=>{E&&(this.db=E)}),this.configService.getApiKey$().subscribe(E=>{if(this.apiKey=E,this.apiKey){if(!this.isCustomDocId){let D=G6(window.location.href);this.currentUrl=D}this.analyticsService.updateDefaultProperties({apiKey:E})}}),this.authService.getUser$().subscribe(E=>Q(this,null,function*(){E&&(this.analyticsService.updateDefaultProperties({organizationId:E?.organizationId,clientOrganizationId:E?.clientOrganizationId}),this.draftDocuments?.length?(yield this.setDocuments({documents:this.draftDocuments,options:this.draftOptions??void 0,source:"internal"}),this.draftDocuments=[],this.draftOptions=void 0,this.draftLocationMap.locations.length&&(yield this.setLocations({locations:this.draftLocationMap.locations,options:this.draftLocationMap.options,source:"internal"}).then(()=>this.draftLocationMap={locations:[],options:void 0}))):this.documentPaths$?.value&&E?.organizationId&&this.documentPaths$.value?.organizationId!==E?.organizationId&&(yield this.setDocuments({documents:this.documentIds$.value.length?this.documentIds$.value.map(D=>({id:D.clientDocumentId})):[{id:this.documentPaths$.value?.clientDocumentId}],options:void 0,source:"internal"})),setTimeout(()=>{this.documentPaths$.value||this.loggingService.catch("Error in DocService constructor:","Please set document id to continue.")},1e4),E?.organizationId&&E?.clientOrganizationId&&(this.organizationConfig$.next({organizationId:E?.organizationId,clientOrganizationId:E?.clientOrganizationId}),yield this.updateOrganizationMetadata()))})),this.documentPaths$.subscribe(E=>{let D={documentId:E?.documentId,clientDocumentId:E?.clientDocumentId,folderId:E?.folderId,allDocuments:E?.allDocuments,veltFolderId:E?.veltFolderId};E?.organizationId&&(D.organizationId=E.organizationId,D.clientOrganizationId=E.clientOrganizationId),this.analyticsService.updateDefaultProperties(D),this.domService.resetSelectedAnnotationsMap()}),this.location$.subscribe(E=>{this.analyticsService.updateDefaultProperties({clientLocation:E?.location,locationId:E?.locationId})}),this.organizationMetadata$.subscribe(E=>{this.authService.setUserOrganization(E?.[this.documentPaths$.value?.organizationId])}),this.documentPaths$.pipe(Fe(E=>!!E),tt(1)).subscribe(()=>{try{this.subscribeToCustomerMetadata()}catch(E){this.loggingService.catch("Error in DocService subscribeToCustomerMetadata:",E)}},E=>{this.loggingService.catch("Error in DocService subscribeToCustomerMetadata:",E)}),this.loggingService.log("%c[WB] Creating CLASS: DocService 2","color: blue;"),this.onWindowPopstate(),this.onWindowClick()}catch(E){this.loggingService.catch("Error in DocService constructor:",E)}}getOptionsFromDocumentPaths(){try{return this.documentPaths$.value?{folderId:this.documentPaths$.value?.folderId,allDocuments:this.documentPaths$.value?.allDocuments,locationId:this.documentPaths$.value?.locationId,organizationId:this.documentPaths$.value?.clientOrganizationId}:null}catch(e){return this.loggingService.catch("Error in getOptionsFromDocumentPaths:",e),null}}clearCacheOnUserCascade(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCacheOnUserCascade in DocService","color: green;");try{this.organizationConfig$.next(null),this.organizationMetadata$.next(null),this.customerMetadata$.next(null),this.customerMetadataSubscription?.unsubscribe(),this.documentPaths$.value&&(this.draftOptions=this.getOptionsFromDocumentPaths(),this.draftLocationMap={locations:[this.location$.value?.location??null,...Object.values(this.locations$.value||{}).map(e=>e.location)].filter(e=>e!==null),options:{rootLocationId:this.location$.value?.location?.id}},this.currentDocumentId=null,this.documentPaths$.next(null),this.firestorePaths$.next(null)),this.unsetDocuments({source:"internal"})}catch(e){this.loggingService.catch("Error in DocService clearCacheOnUserCascade: ",e)}}setCommonDbService(e){try{this.commonDbService=e}catch(i){this.loggingService.catch("Error in setCommonDbService:",i)}}setCommentService(e){try{this.commentService=e}catch(i){this.loggingService.catch("Error in setCommentService:",i)}}onWindowPopstate(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowPopstate","color: green;");try{this.domService.onWindowPopState$().subscribe(()=>{this.loggingService.log("location",location.href);let e=G6(location.href);this.currentUrl!==e&&(this.currentUrl=e,!this.isCustomDocId&&this.apiKey&&this.loggingService.log("current url in doc service",this.currentUrl))},e=>{this.loggingService.catch("Error in DocService onWindowPopstate subscription: ",e)})}catch(e){this.loggingService.catch("Error in onWindowPopstate: ",e)}}onWindowClick(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowClick","color: green;");try{this.domService.onWindowClick$().subscribe(()=>{let e=G6(location.href);this.currentUrl!==e&&(this.currentUrl=e,this.isCustomDocId||this.loggingService.log("current url in doc service",this.currentUrl))},e=>{this.loggingService.catch("Error in DocService onWindowClick subscription: ",e)})}catch(e){this.loggingService.catch("Error in onWindowClick: ",e)}}setDocument(s){return Q(this,arguments,function*({documentId:e,documentMetadata:i,options:r,source:a="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocument","color: green;"),this.coreActionsService.triggerAction(Xi.INIT_UPDATE,{event:X.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:"setDocument",source:a,payload:{documentId:e,documentMetadata:i,options:r}}),yield this.setDocumentsImpl({documents:[{id:e,metadata:i}],options:I({organizationId:i?.organizationId},r??{}),source:a})}catch(m){this.loggingService.catch("Error in DocService setDocument:",m)}})}shouldSetDocumentsAgain(e,i={}){try{this.loggingService.log("%c[WB] Calling FUNCTION: shouldSetDocumentsAgain","color: green;");let r=this.documentPaths$.value?.clientDocumentId,a=i?.rootDocumentId??e[0]?.id,s=this.documentIds$.value.map(h=>h.clientDocumentId),m=EU(this.getOptionsFromDocumentPaths()??{})??{};return!e.every(h=>s.includes(h.id))||!uo(m,i)||r!==a}catch(r){return this.loggingService.catch("Error in DocService shouldSetDocumentsAgain:",r),!0}}getDocumentIdsFromDocuments({documents:e,setClientDocumentMetadataMap:i=!1}){try{let r=[];return e.forEach(a=>{let s=a.id,m=`${yn(s)}`;i&&a?.metadata&&typeof a.metadata=="object"&&(this.clientDocumentMetadataMap[s]=a.metadata),r.push({documentId:m,clientDocumentId:s})}),r}catch(r){return this.loggingService.catch("Error in DocService getDocumentIdsFromDocuments:",r),[]}}setDocuments(a){return Q(this,arguments,function*({documents:e,options:i,source:r="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocuments","color: green;"),this.coreActionsService.triggerAction(Xi.INIT_UPDATE,{event:X.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:"setDocuments",source:r,payload:{documents:e,options:i}}),yield this.setDocumentsImpl({documents:e,options:i??{},source:r})}catch(s){this.loggingService.catch("Error in DocService setDocuments:",s)}})}setRootDocument(r){return Q(this,arguments,function*({document:e,source:i="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setRootDocument","color: green;"),this.coreActionsService.triggerAction(Xi.INIT_UPDATE,{event:X.Events.Core.SET_ROOT_DOCUMENT_TRIGGERED,methodName:"setRootDocument",source:i,payload:{document:e}});let a=this.getOptionsFromDocumentPaths()??{},s=this.documentIds$.value.map(m=>m.clientDocumentId);if(!s.includes(e.id)){let m=[...s.map(h=>({id:h})),{id:e.id}],p=this.getDocumentIdsFromDocuments({documents:m,setClientDocumentMetadataMap:!0});this.documentIds$.next(p)}yield this.setDocumentIdImpl(e.id,this.documentPaths$.value?.clientOrganizationId,a)}catch(a){this.loggingService.catch("Error in DocService setRootDocument:",a)}})}setDocumentsImpl(a){return Q(this,arguments,function*({documents:e,options:i,source:r}){try{let s=i?.organizationId??this.documentPaths$.value?.clientOrganizationId;if(!this.shouldSetDocumentsAgain(e,EU(T(I({},i),{organizationId:s})))){r==="external"&&this.loggingService.catch("setDocuments called with previous request");return}this.documentPaths$.value?.organizationId&&i?.organizationId&&this.documentPaths$.value?.organizationId!==i?.organizationId?this.authService.resetServicesCache():this.unsetDocuments({source:"internal",unsetDocumentPaths:!1});let m=this.getDocumentIdsFromDocuments({documents:e,setClientDocumentMetadataMap:!0});if(m?.length===0){this.loggingService.warn("Minimum one document must be set in setDocuments");return}if(this.draftDocuments=e,this.draftOptions=i,this.documentIds$.next(m),e?.length){let p=e[0]?.id;i?.rootDocumentId&&e.find(h=>h.id===i?.rootDocumentId)&&(p=i?.rootDocumentId),yield this.debounceSetDocuments({documentId:p,clientOrganizationId:i?.organizationId,options:i})}return}catch(s){this.loggingService.catch("Error in DocService setDocumentsImpl:",s)}})}setDocumentId(a){return Q(this,arguments,function*({documentId:e,clientOrganizationId:i,source:r="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocumentId","color: green;"),this.coreActionsService.triggerAction(Xi.INIT_UPDATE,{event:X.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:"setDocumentId",source:r,payload:{documentId:e,clientOrganizationId:i}}),yield this.setDocumentsImpl({documents:[{id:e}],options:{organizationId:i},source:r})}catch(s){this.loggingService.catch("Error in setDocumentId:",s);return}})}debounceSetDocuments(a){return Q(this,arguments,function*({documentId:e,clientOrganizationId:i,options:r}){try{this.loggingService.log("%c[WB] Calling FUNCTION: debounceSetDocuments","color: green;");let s=Date.now(),m=s-this.lastSetDocumentIdCallTime,p=s-this.lastSetDocumentIdExecutionTime;if(this.lastSetDocumentIdCallTime=s,this.queueSize>=this.MAX_QUEUE_SIZE){this.loggingService.warn("SetDocumentId queue size exceeded limit");return}if(!this.documentPaths$.value&&!this.isDocumentIdInDebounceQueue||m>this.DEBOUNCE_TIME&&p>this.DEBOUNCE_TIME){yield this.setDocumentIdImpl(e,i,r),this.lastSetDocumentIdExecutionTime=s;return}this.documentPaths$.next(null),this.isDocumentIdInDebounceQueue=!0,this.draftLocationMap={locations:[],options:void 0},this.queueSize++,this.setDocumentIdSubject.next({documentId:e,clientOrganizationId:i,options:r??void 0});return}catch(s){this.loggingService.catch("Error in debounceSetDocuments:",s)}})}setDocumentIdImpl(e,i,r){return Q(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: setDocumentIdImpl","color: green;");try{let a=this.authService.getUser();if(!a)return;this.currentDocumentId&&this.documentPaths$.value&&(yield this.callPreDocumentIdChangeFunctions(this.documentPaths$.value));let s=this.currentDocumentId;if(this.apiKey){let m=`${yn(e)}`,p=r?.folderId,h=r?.folderId?Tl(r?.folderId):void 0,_=r?.locationId,E=r?.allDocuments,D=a?.organizationId?i?Pt(i):a?.organizationId:void 0;if(yield Promise.allSettled([this.commentResolverService.resolveCommentAnnotations({documentIds:this.documentIds$.value.map(L=>L.clientDocumentId),organizationId:i??a?.clientOrganizationId??""}),this.reactionResolverService.resolveReactionAnnotations({documentIds:this.documentIds$.value.map(L=>L.clientDocumentId),organizationId:i??a?.clientOrganizationId??""})]),this.currentDocumentId!==m||this.documentPaths$.value?.organizationId!==D){this.loggingService.log("setting new docid"),this.currentDocumentId=m;let L=new aM,H=new EM;L.clientDocumentId=e,H.clientDocumentId=e,L.folderId=p,H.folderId=p,L.locationId=_,H.locationId=_,L.allDocuments=E,H.allDocuments=E,L.veltFolderId=h,H.veltFolderId=h,L.documentId=m,H.documentId=m,D&&(L.organizationId=D,L.clientOrganizationId=i??a?.clientOrganizationId,H.organizationId=D,H.clientOrganizationId=i??a?.clientOrganizationId);let K=`${this.apiKey}`,oe=`apiKey/${this.apiKey}`;D&&(K=`${K}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${L.organizationId}`,oe=`${oe}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${L.organizationId}`),H.organization=`apiKey/${this.apiKey}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}`,H.document=`${oe}/${j.FIREBASE_PARTIAL_PATH_DOCS}`,L.presence=`${K}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_PRESENCE}/`,L.cursor=`${K}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_CURSOR}/`,L.comment=`${K}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_COMMENT}/`,H.comment=`${oe}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_COMMENT}`,L.multiThread=`${K}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_MULTI_THREAD}/`,H.multiThread=`${oe}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_MULTI_THREAD}`,L.tag=`${K}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_TAG}/`,L.area=`${K}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_AREA}/`,H.area=`${oe}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_AREA}`,L.arrow=`${K}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_ARROW}/`,L.selection=`${K}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_SELECTION}/`,L.audioHuddle=`${K}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_AUDIO_HUDDLE}/`,L.huddle=`${K}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_HUDDLE}/`,L.recorder=`${K}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_RECORDER}/`,H.recorder=`${oe}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_RECORDER}`,L.flock=`${K}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_FOLLOW_ALONG}/`,L.syncVideoPlayer=`${K}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_SYNC_VIDEO_PLAYER}/`,L.liveState=`${K}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_LIVE_STATE}/`,L.liveStateSingleEditorMode=`${K}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_LIVE_STATE}/default/singleEditorMode`,L.reaction=`${K}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_REACTION}/`,H.reaction=`${oe}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_REACTION}`,L.customerMetadata=`${this.apiKey}/${j.FIREBASE_PARTIAL_PATH_CUSTOMER_METADATA}/`,L.views=`${K}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_VIEWS}/`,H.commentViews=`${oe}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_COMMENT_VIEWS}`,H.notificationViews=`${oe}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATION_VIEWS}`,H.documentViews=`${oe}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS}`,H.locationViews=`${oe}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS}`,L.notifications=`${K}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATIONS}/`,L.metadata=`${K}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_METADATA}/`,L.users=`${K}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_USERS}/`,L.documentIam=`${K}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_IAM}/`,L.workspaceIam=`${this.apiKey}/${j.FIREBASE_PARTIAL_PATH_IAM}/`,L.groupContacts=`${K}/${j.FIREBASE_PARTIAL_PATH_CONTACTS}/${j.FIREBASE_PARTIAL_PATH_GROUPS}/`,L.globalContacts=`${K}/${j.FIREBASE_PARTIAL_PATH_CONTACTS}/${j.FIREBASE_PARTIAL_PATH_GLOBAL}/`,L.logins=`${K}/${j.FIREBASE_PARTIAL_PATH_CONTACTS}/${j.FIREBASE_PARTIAL_PATH_LOGINS}/`,L.userFeedback=`${K}/${j.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${j.FIREBASE_PARTIAL_PATH_FEEDBACK}/`,L.userReportBugs=`${K}/${j.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${j.FIREBASE_PARTIAL_PATH_BUGS}/`,L.userContactUs=`${K}/${j.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${j.FIREBASE_PARTIAL_PATH_CONTACT_US}/`,D&&(L.organizationMetadata=`${K}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_METADATA}/`,L.organizationIam=`${K}/${j.FIREBASE_PARTIAL_PATH_IAM}/`,L.organizationGroups=`${K}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_GROUPS}/`,L.organizationNotifications=`${K}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/`,m&&(L.organizationNotificationsWithDocumentId=`${K}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/`),L.organizationNotificationsLastNotificationTimestamp=`${K}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${j.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}/${j.FIREBASE_PARTIAL_PATH_DOCS}/`,L.organizationNotificationsUsers=`${K}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${j.FIREBASE_PARTIAL_PATH_USERS}/`),H.organizationUsers=`${oe}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_USERS}`,H.documentUsers=`${oe}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS}`,H.notificationDocs=`${oe}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATION_DOCS}`,H.notificationUsers=`${oe}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATION_USERS}`,this.documentPaths$.next(L),this.firestorePaths$.next(H),L?.clientOrganizationId&&L?.organizationId&&!(L?.clientOrganizationId===this.organizationConfig$?.value?.clientOrganizationId&&L?.organizationId===this.organizationConfig$?.value?.organizationId)&&this.organizationConfig$.next({organizationId:L?.organizationId,clientOrganizationId:L?.clientOrganizationId}),yield Promise.allSettled([this.updateFolderMetadata(),this.updateDocumentMetadata(),this.fetchLocationMetadata(),this.updateOrganizationMetadata()]),s&&this.location$.value&&this.removeLocation({}),this.coreActionsService.triggerAction(Xi.INIT_UPDATE,{event:X.Events.Doc.SET_DOCUMENTS_SUCCESS,payload:{documentId:m,clientDocumentId:e}}),this.analyticsService.trackEvent(X.Events.Doc.SET_DOCUMENTS_SUCCESS,{documentId:m,clientDocumentId:e},!0,this.getUserIdForAnalytics())}}else this.loggingService.catch("Error in setDocumentIdImpl: API key is not provided.")}catch(a){this.loggingService.catch("Error in setDocumentIdImpl: ",a)}})}unsetDocumentId({source:e,unsetDocumentPaths:i}){this.loggingService.log("%c[WB] Calling FUNCTION: unsetDocumentId","color: green;");try{this.coreActionsService.triggerAction(Xi.INIT_UPDATE,{event:X.Events.Doc.UNSET_DOCUMENTS_TRIGGERED,methodName:"unsetDocumentId",source:e}),this.unsetDocumentImpl({source:e,unsetDocumentPaths:i})}catch(r){this.loggingService.catch("Error in unsetDocumentId: ",r)}}unsetDocumentImpl({source:e,unsetDocumentPaths:i}){this.loggingService.log("%c[WB] Calling FUNCTION: unsetDocumentImpl","color: green;");try{this.currentDocumentId&&this.documentPaths$.value&&this.callPreDocumentIdChangeFunctions(this.documentPaths$.value),i&&(this.documentPaths$.next(null),this.firestorePaths$.next(null)),this.currentDocumentId=null,this.location$.next(null),this.excludedLocationIds$.next([]),this.documentMetadata$.next(null),this.locationMetadata$.next(null),this.clientDocumentMetadata=void 0,this.clientDocumentMetadataMap={},this.locations$.next({}),this.documentIds$.next([]),this.coreActionsService.triggerAction(Xi.INIT_UPDATE,{event:X.Events.Doc.UNSET_DOCUMENTS_SUCCESS,source:e}),this.analyticsService.trackEvent(X.Events.Doc.UNSET_DOCUMENTS_SUCCESS,{documentId:this.currentDocumentId,documentMetadata:this.documentMetadata$.value?.[this.currentDocumentId??""],message:e==="external"?"User unset document id":"System unset document id",source:e},!0,this.getUserIdForAnalytics())}catch(r){this.loggingService.catch("Error in unsetDocumentImpl: ",r)}}unsetDocuments({source:e,unsetDocumentPaths:i=!0}){this.loggingService.log("%c[WB] Calling FUNCTION: unsetDocuments","color: green;");try{this.coreActionsService.triggerAction(Xi.INIT_UPDATE,{event:X.Events.Doc.UNSET_DOCUMENTS_TRIGGERED,source:e,methodName:"unsetDocuments"}),this.unsetDocumentImpl({source:e,unsetDocumentPaths:i})}catch(r){this.loggingService.catch("Error in unsetDocuments: ",r)}}addPreDocumentIdChangeFunction(e,i){try{this.loggingService.log("%c[WB] Calling FUNCTION: addPreDocumentIdChangeFunction","color: green;"),this.preDocumentIdChangeFunctions.set(e,i)}catch(r){this.loggingService.catch("Error in addPreDocumentIdChangeFunction: ",r)}}callPreDocumentIdChangeFunctions(e){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: callPreDocumentIdChangeFunctions","color: green;");for(let[i,r]of this.preDocumentIdChangeFunctions)try{yield r(e)}catch(a){this.loggingService.catch("Error in callPreDocumentIdChangeFunctions: ",a)}}catch(i){this.loggingService.catch("Error in callPreDocumentIdChangeFunctions: ",i)}})}fetchOrganizationMetadata(){return Q(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: fetchOrganizationMetadata","color: green;");try{if(this.db&&this.organizationConfig$.value?.organizationId){let e=this.organizationConfig$.value?.organizationId;yield this.commonDbService?.getData({feature:"organizationMetadata",properties:{apiKey:this.apiKey??"",organizationId:e,field:"metadata"}}).then(i=>{i&&this.organizationMetadata$.next(T(I({},this.organizationMetadata$.value),{[e]:i}))}).catch(i=>{this.loggingService.catch("Error in fetchOrganizationMetadata: ",i)})}}catch(e){this.loggingService.catch("Error in fetchOrganizationMetadata: ",e)}})}fetchDocumentMetadata(e){return Q(this,null,function*(){try{if(this.db&&this.authService.getUser()){let i=this.documentPaths$.value,r=this.documentMetadata$.value;if(e=e.filter(a=>!r?.[a.documentId]),e?.some(a=>!a?.documentId||!a?.clientDocumentId)||!i)return;if(this.commonDbService?.shouldUseFirestore()){let a=i?.folderId,s=i?.allDocuments,m=[],p={organizationId:i?.clientOrganizationId,folderId:a,allDocuments:s};if(a&&s)m.push(this.fetchDocuments(p));else{let _=[];for(let D=0;D<e.length;D+=20)_.push(e.slice(D,D+20));_.forEach(D=>{let L=JSON.parse(JSON.stringify(p));L.documentIds=D.map(H=>H.clientDocumentId),m.push(this.fetchDocuments(L))})}let h={};m.length>0&&(yield Promise.all(m).then(_=>{_?.forEach(E=>{E?.forEach(D=>{D?.metadata?.documentId&&(h[D.metadata.documentId]=D.metadata)})}),this.documentMetadata$.next(I(I({},this.documentMetadata$.value),h))}).catch(_=>{this.loggingService.catch("Error in fetchDocumentMetadata: ",_)}))}else r?.[i?.documentId??e?.[0]?.documentId]||this.commonDbService?.queryData({feature:"allDocuments",properties:{apiKey:this.apiKey??"",organizationId:i?.organizationId,documentId:i?.documentId??e?.[0]?.documentId,skipObjectValues:!0}}).then(a=>{a?.documentId&&this.documentMetadata$.next({[a.documentId]:a})}).catch(a=>{this.loggingService.catch("Error in fetchDocumentMetadata: ",a)})}}catch(i){this.loggingService.catch("Error in fetchDocumentMetadata: ",i)}})}fetchLocationMetadata(){return Q(this,null,function*(){try{if(this.db&&this.authService.getUser()){let e=this.documentPaths$.value,i=this.documentIds$.value,r=e?.folderId,a=e?.allDocuments,s=[],m={organizationId:e?.clientOrganizationId,folderId:r,allDocuments:a};if(r&&a)s.push(this.fetchLocations(m));else{let h=[];for(let E=0;E<i.length;E+=20)h.push(i.slice(E,E+20));h.forEach(E=>{let D=JSON.parse(JSON.stringify(m));D.documentIds=E.map(L=>L.clientDocumentId),s.push(this.fetchLocations(D))})}let p=this.locationMetadata$.value??{};s.length>0&&Promise.all(s).then(h=>{h?.forEach(_=>{_?.forEach(E=>{E?.metadata?.documentId&&(p[E.metadata.documentId]=T(I({},p?.[E.metadata.documentId]??{}),{[E.location.id]:E}))})}),Object.keys(p||{}).length>0&&this.locationMetadata$.next(p)}).catch(h=>{this.loggingService.catch("Error in fetchLocationMetadata: ",h)})}}catch(e){this.loggingService.catch("Error in fetchLocationMetadata: ",e)}})}getLocationMetadatas(){return this.locationMetadata$.value}subscribeToCustomerMetadata(){this.loggingService.log("%c[WB] Calling FUNCTION: subscribeToCustomerMetadata","color: green;");try{if(this.customerMetadataSubscription)return;this.db&&this.authService.getUser()&&this.documentPaths$.value&&(this.customerMetadataSubscription=this.commonDbService?.dbListener({feature:"customerMetadata",properties:{skipFirestore:!0}}).pipe(jn(i=>se(null))).subscribe(i=>{this.customerMetadata$.next(i?.data)}))}catch(e){this.loggingService.catch("Error in subscribeToCustomerMetadata: ",e)}}getDocumentId(){return this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentId","color: green;"),this.documentPaths$.value?.documentId}getClientDocumentId(){return this.loggingService.log("%c[WB] Calling FUNCTION: getClientDocumentId","color: green;"),this.documentPaths$.value?.clientDocumentId}getDocumentIds$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentIds$","color: green;"),this.documentIds$.asObservable().pipe(ce(e=>e?.slice()))}getDocumentIds(){return this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentIds","color: green;"),this.documentIds$.value?.slice()}getLocationMetadata$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getLocationMetadata$","color: green;"),this.locationMetadata$.asObservable().pipe()}getDocumentPaths$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentPaths$","color: green;"),this.documentPaths$.asObservable()}getFirestorePaths$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getFirestorePaths$","color: green;"),this.firestorePaths$.asObservable()}getDocumentPaths(){return this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentPaths","color: green;"),this.documentPaths$.value}generateDocumentId(e){try{return`${yn(e)}`}catch(i){return this.loggingService.catch("Error in generateDocumentId: ",i),""}}generateOrganizationId(e){try{return`${Pt(e)}`}catch(i){return this.loggingService.catch("Error in generateOrganizationId: ",i),""}}getFirestorePaths(){return this.loggingService.log("%c[WB] Calling FUNCTION: getFirestorePaths","color: green;"),this.firestorePaths$.value}setLocation(r){return Q(this,arguments,function*({location:e,source:i="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setLocation","color: green;"),this.coreActionsService.triggerAction(Xi.INIT_UPDATE,{event:X.Events.Core.SET_LOCATIONS_TRIGGERED,source:i,methodName:"setLocation",payload:{locations:[e],options:void 0}}),yield this.setLocationsImpl({locations:[e]})}catch(a){this.loggingService.catch("Error in setLocation: ",a)}})}setLocations(a){return Q(this,arguments,function*({locations:e,options:i,source:r="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setLocations","color: green;"),this.coreActionsService.triggerAction(Xi.INIT_UPDATE,{event:X.Events.Core.SET_LOCATIONS_TRIGGERED,methodName:"setLocations",source:r,payload:{locations:e,options:i}}),yield this.setLocationsImpl({locations:e,options:i})}catch(s){this.loggingService.catch("Error in setLocations: ",s)}})}getValidLocations(e){try{let i=[];return e&&Array.isArray(e)&&e.forEach(r=>{if(r&&typeof r=="object"){let a=!0;r?.version&&(!r?.version?.id||!r?.version?.name)&&(this.loggingService.catch(`Error in setting location for locationId: ${r?.id}, If you're setting version then add id and name fields to version object.`),a=!1),a&&i.push(r)}}),i}catch(i){this.loggingService.catch("Error in getValidLocations: ",i)}return e}setRootLocation(r){return Q(this,arguments,function*({location:e,source:i="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setRootLocation","color: green;"),this.coreActionsService.triggerAction(Xi.INIT_UPDATE,{event:X.Events.Core.SET_ROOT_LOCATION_TRIGGERED,methodName:"setRootLocation",source:i,payload:{location:e}});let a=Object.values(this.locations$.value).map(s=>s.location).filter(s=>String(s.id)!==String(e.id));yield this.setLocationsImpl({locations:[e,...a],options:{rootLocationId:e.id}})}catch(a){this.loggingService.catch("Error in DocService setRootLocation:",a)}})}setLocationsImpl(r){return Q(this,arguments,function*({locations:e,options:i}){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: setLocationsImpl","color: green;"),e.length===0)return;this.draftLocationMap.locations=[...this.draftLocationMap.locations,...e],this.draftLocationMap.options=i;let a=this.getValidLocations(e),s=[],m=[];this.location$.value?.location.id&&m.push(this.location$.value?.location.id),m=[...m,...Object.values(this.locations$.value).map(_=>_.location.id)].filter(_=>_!==void 0);let p;if(i?.rootLocationId&&i?.rootLocationId!==this.location$.value?.location.id&&(p=a.find(_=>_.id===i?.rootLocationId),!p)){this.loggingService.catch(`Error in setting locations, rootLocationId: ${i?.rootLocationId} not found in locations.`);return}if(!i?.appendLocation){p||(p=a[0]);let _=Jo(p),E=yn(JSON.stringify(_));_.id&&!m.includes(_.id)&&s.push({locationId:E,location:_}),this.location$.next({locationId:E,location:_})}let h=[];return a.slice(i?.appendLocation?0:1).forEach(_=>{let E=I({},_),D=this.locations$.value;_?.id&&Object.keys(D).forEach(oe=>{let ue=D[oe];ue.location?.id===_.id&&(E=I(I({},ue.location),_),delete D?.[oe])});let L=this.genarateLocationId(E),H={locationId:L,location:E};E.id&&!m.includes(E.id)&&s.push({locationId:L,location:E}),h.push(H);let K=T(I({},D),{[L]:H});this.locations$.next(K)}),yield this.updateDocumentLocationMetadata(s),this.coreActionsService.triggerAction(Xi.INIT_UPDATE,{event:X.Events.Doc.SET_LOCATIONS_SUCCESS,methodName:"setLocations",payload:{locations:a,options:i}}),this.analyticsService.trackEvent(X.Events.Doc.SET_LOCATIONS_SUCCESS,{locations:a,options:i},!0,this.getUserIdForAnalytics()),h}catch(a){this.loggingService.catch("Error in setLocationImpl: ",a);return}})}addLocation(r){return Q(this,arguments,function*({location:e,source:i="internal"}){try{return this.loggingService.log("%c[WB] Calling FUNCTION: addLocation","color: green;"),this.coreActionsService.triggerAction(Xi.INIT_UPDATE,{event:X.Events.Core.SET_LOCATIONS_TRIGGERED,methodName:"addLocation",source:i,payload:{locations:[e],options:{appendLocation:!0}}}),yield this.setLocationsImpl({locations:[e],options:{appendLocation:!0}})}catch(a){this.loggingService.catch("Error in DocService addLocation:",a);return}})}removeLocation({location:e,source:i="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeLocation","color: green;"),this.coreActionsService.triggerAction(Xi.INIT_UPDATE,{event:X.Events.Core.REMOVE_LOCATIONS_TRIGGERED,source:i,methodName:"removeLocation",payload:{locations:[e]}}),e&&this.removeLocationsImpl([e],i)}catch(r){this.loggingService.catch("Error in removeLocation: ",r)}}removeLocations({locations:e,source:i="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeLocations","color: green;"),this.coreActionsService.triggerAction(Xi.INIT_UPDATE,{event:X.Events.Core.REMOVE_LOCATIONS_TRIGGERED,methodName:"removeLocations",source:i,payload:{locations:e}}),this.removeLocationsImpl(e,i)}catch(r){this.loggingService.catch("Error in removeLocations: ",r)}}removeLocationsImpl(e,i="internal"){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeLocations","color: green;"),i==="internal"&&this.analyticsService.trackEvent(X.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{locations:e},methodName:"removeLocations",message:"System removed locations",source:i},!0,this.getUserIdForAnalytics()),e?e.forEach(r=>{let a=this.genarateLocationId(r);this.getLocation()?.locationId===a&&(this.location$.next(null),i!=="internal"&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(s=>s.id!==r.id))),this.removeCustomLocation(r)}):(this.location$.next(null),this.locations$.next({}),i!=="internal"&&(this.draftLocationMap.options=void 0,this.draftLocationMap.locations=[])),this.analyticsService.trackEvent(X.Events.Doc.REMOVE_LOCATIONS_SUCCESS,{payload:{locations:e},source:i},!0,this.getUserIdForAnalytics())}catch(r){this.loggingService.catch("Error in removeLocation: ",r)}}unsetLocationIds(e,i="internal"){try{this.loggingService.log("%c[WB] Calling FUNCTION: unsetLocationIds","color: green;"),this.coreActionsService.triggerAction(Xi.INIT_UPDATE,{event:X.Events.Core.UNSET_LOCATIONS_TRIGGERED,methodName:"unsetLocationIds",source:i,payload:{locationIds:e}}),i==="internal"&&this.analyticsService.trackEvent(X.Events.Core.UNSET_LOCATIONS_TRIGGERED,{payload:{locationIds:e},methodName:"unsetLocationIds",message:"System unset location ids",source:i},!0,this.getUserIdForAnalytics()),e?.length?e.forEach(r=>{this.getLocation()?.location.id===r&&(this.location$.next(null),i!=="internal"&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(a=>a.id!==r))),this.removeCustomLocationId(r)}):(this.location$.next(null),this.locations$.next({}),i!=="internal"&&(this.draftLocationMap.options=void 0,this.draftLocationMap.locations=[])),this.analyticsService.trackEvent(X.Events.Doc.REMOVE_LOCATIONS_SUCCESS,{payload:{locationIds:e},source:i},!0,this.getUserIdForAnalytics())}catch(r){this.loggingService.catch("Error in unsetLocationIds: ",r)}}getLocation$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getLocation$","color: green;"),this.location$.asObservable()}getLocation(){return this.loggingService.log("%c[WB] Calling FUNCTION: getLocation$","color: green;"),this.location$.value?JSON.parse(JSON.stringify(this.location$.value)):null}excludeLocationIds(e){try{this.excludedLocationIds$.next([...e])}catch(i){this.loggingService.catch("Error in excludeLocationIds: ",i)}}getExcludedLocationIds$(){try{return this.excludedLocationIds$.asObservable()}catch(e){return this.loggingService.catch("Error in getExcludedLocationIds$: ",e),se([])}}updateOrganizationMetadata(){return Q(this,null,function*(){try{let e=this.organizationConfig$.value?.organizationId,i=this.documentPaths$.value;if(this.db&&e&&i?.documentId){if(this.organizationMetadata$.value?.[e])return;let a=new CM;a.apiKey=this.configService?.getApiKey()??"",a.organizationId=e,a.clientOrganizationId=this.organizationConfig$.value?.clientOrganizationId,yield this.commonDbService?.updateData({feature:"organizationMetadata",data:JSON.parse(JSON.stringify(a)),properties:{organizationId:e,documentId:i?.documentId??""}}),yield this.fetchOrganizationMetadata()}}catch(e){this.loggingService.catch("Error in updateOrganizationMetadata: ",e)}})}updateFolderMetadata(){return Q(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: updateFolderMetadata","color: green;"),this.db&&this.authService.getUser()&&this.documentPaths$.value?.folderId){let e=this.documentPaths$.value;if(!e?.veltFolderId||!e?.organizationId)return;if(!(yield this.commonDbService?.getData({feature:"folderMetadata",properties:{organizationId:e?.organizationId??"",folderId:e?.veltFolderId??""}}))?.metadata){let r={folderId:this.documentPaths$.value?.folderId,veltFolderId:this.documentPaths$.value?.veltFolderId,apiKey:this.configService?.getApiKey()??"",organizationId:e?.organizationId,clientOrganizationId:e?.clientOrganizationId,createdAt:Date.now(),lastUpdated:Date.now(),parentFolderId:"root",veltParentFolderId:"root"};this.commonDbService?.updateData({feature:"folderMetadata",data:JSON.parse(JSON.stringify({metadata:r})),properties:{organizationId:e?.organizationId??"",folderId:this.documentPaths$.value?.veltFolderId??""}})}}}catch(e){this.loggingService.catch("Error in updateFolderMetadata: ",e)}})}updateDocumentMetadata(){return Q(this,null,function*(){try{if(this.db&&this.authService.getUser()){let e=this.documentPaths$.value;if(e){let i=this.getDocumentIds();i.find(a=>a.documentId===e.documentId)||i.push({documentId:e.documentId??"",clientDocumentId:e.clientDocumentId??""});let r=i.map(a=>Q(this,null,function*(){let s=new rM;this.clientDocumentMetadata&&(this.clientDocumentMetadata?.clientDocumentId===e.clientDocumentId&&this.clientDocumentMetadata?.documentMetadata&&(s=I(I({},this.clientDocumentMetadata.documentMetadata),s)),this.clientDocumentMetadata=void 0),this.clientDocumentMetadataMap?.[a.clientDocumentId]&&(s=I(I({},this.clientDocumentMetadataMap[a.clientDocumentId]),s)),s.apiKey=this.configService?.getApiKey()??"",s.documentId=a.documentId,s.clientDocumentId=a.clientDocumentId,s.organizationId=e.organizationId,s.clientOrganizationId=e.clientOrganizationId,s.pageInfo=Ei();let m=e?.folderId,p=e?.veltFolderId;s?.pageInfo?.deviceInfo&&delete s?.pageInfo?.deviceInfo;let h=!0,_=this.documentMetadata$.value?.[a.documentId];if(m&&p){let E=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:a?.documentId??"",organizationId:e?.organizationId??"",field:"metadata"}});E?.clientDocumentId?E?.folderId&&(E?.folderId!==m||E?.veltFolderId!==p)?(this.loggingService.catch(`Folder id mismatch for document ${a?.clientDocumentId??""}`),h=!1):E?.folderId===m?(m&&(s.folderId=m),p&&(s.veltFolderId=p)):(this.loggingService.catch(`Document ${a?.clientDocumentId??""} is not in the folder ${m??""}`),h=!1):(m&&(s.folderId=m),p&&(s.veltFolderId=p))}if(_){let E={};Object.entries(s).forEach(([D,L])=>{E[D]=L}),uo(E,_)&&(h=!1)}h&&(yield this.commonDbService?.updateData({feature:"documentMetadata",data:JSON.parse(JSON.stringify(s)),properties:{organizationId:e?.organizationId??"",documentId:a?.documentId??""}}))}));yield Promise.allSettled(r),yield this.fetchDocumentMetadata(i)}}}catch(e){this.loggingService.catch("Error in updateDocumentMetadata: ",e)}})}updateDocumentLocationMetadata(e){return Q(this,null,function*(){try{if(this.db&&this.authService.getUser()){let i=this.documentPaths$.value;if(i){let r=this.getDocumentIds();r.find(a=>a.documentId===i.documentId)||r.push({documentId:i.documentId??"",clientDocumentId:i.clientDocumentId??""});for(let a of r){let s=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:a?.documentId??"",organizationId:i?.organizationId??"",field:"metadata"}}),m=[];for(let p of e){let h=new mM;h.locationId=p?.locationId,h.veltLocationId=yU(p?.location?.id??""),h.location=p?.location,h.pageInfo=Ei(),h?.pageInfo?.deviceInfo&&delete h?.pageInfo?.deviceInfo;let _=T(I({},s),{[j.FIREBASE_PARTIAL_PATH_LOCATIONS]:T(I({},s[j.FIREBASE_PARTIAL_PATH_LOCATIONS]??{}),{[p?.locationId]:h})});this.commonDbService?.shouldUseFirestore()||m.push(this.commonDbService?.updateData({feature:"documentMetadata",data:JSON.parse(JSON.stringify(_)),properties:{documentId:a?.documentId??"",organizationId:i?.organizationId??""}}));let E=this.locationMetadata$.value;if(E||(E={}),p?.location?.id){let D=E?.[a.documentId],L=D?.[p?.location?.id??""];E&&(D||(E[a.documentId]={}),L||(E[a.documentId][p?.location?.id??""]={}),E[a.documentId][p?.location?.id??""]=T(I({},L),{location:p?.location})),Object.keys(E||{}).length>0&&this.locationMetadata$.next(E)}}yield Promise.allSettled(m)}}}}catch(i){this.loggingService.catch("Error in updateDocumentLocationMetadata: ",i)}})}genarateLocationId(e){try{return e&&typeof e=="object"?yn(JSON.stringify(Jo(e))):0}catch(i){return this.loggingService.catch("Error in genarateLocationId: ",i),0}}removeCustomLocation(e,i="internal"){try{let r=this.genarateLocationId(e),a=this.locations$.value;a[r]&&(delete a[r],this.locations$.next(I({},a)),i!=="internal"&&this.isDocumentIdInDebounceQueue&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(s=>s.id!==e.id)))}catch(r){this.loggingService.catch("Error in DocService removeLocation:",r)}}removeCustomLocationId(e,i="internal"){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeCustomLocationId","color: green;");let r=this.locations$.value;Object.entries(r).forEach(([a,s])=>{s.location.id===e&&(delete r[a],this.locations$.next(I({},r)),i!=="internal"&&this.isDocumentIdInDebounceQueue&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(m=>m.id!==e)))})}catch(r){this.loggingService.catch("Error in DocService removeCustomLocationId:",r)}}getLocationByClientLocationId(e){try{let i=this.getLocation()?.location;if(i?.id===e)return i;{let r=this.getLocations();Object.keys(r).forEach(a=>{let s=r[a];s.location?.id===e&&(i=s.location)})}return i}catch(i){this.loggingService.catch("Error in DocService getLocationByClientLocationId:",i);return}}removeLocationIfNotInDom(){try{let e=this.locations$.value,i=document.querySelectorAll(`[${j.ATTRIBUTES.VELT_LOCATION}]`),r=[];i.forEach(a=>{let s=a.getAttribute(j.ATTRIBUTES.VELT_LOCATION);if(s){let m=JSON.parse(s),p=this.genarateLocationId(m);r.push(p)}}),Object.keys(e).forEach(a=>{let s=e[a];r.includes(s.locationId)||delete e[a]}),this.locations$.next(I({},e))}catch(e){this.loggingService.catch("Error in DocService removeLocationIfNotInDom:",e)}}getLocations$(){try{return this.locations$.asObservable()}catch(e){return this.loggingService.catch("Error in DocService getLocations$:",e),se({})}}getLocations(){try{return this.locations$.value}catch(e){return this.loggingService.catch("Error in DocService getLocations:",e),{}}}getLocationFromElement(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: getLocationFromElement","color: green;");let i=null;if(e?.getAttribute(j.ATTRIBUTES.VELT_LOCATION)?i=e:i=e.closest(`[${j.ATTRIBUTES.VELT_LOCATION}]`),i){let r=i?.getAttribute(j.ATTRIBUTES.VELT_LOCATION);if(r){let a=JSON.parse(r);return{locationId:this.genarateLocationId(a),location:a}}}return null}catch(i){return this.loggingService.catch("Error in DocService getLocationFromElement:",i),null}}getElementMapWithLocation(){try{this.loggingService.log("%c[WB] Calling FUNCTION: getElementMapWithLocation","color: green;");let e={};return document.querySelectorAll(`[${j.ATTRIBUTES.VELT_LOCATION}], [${j.ATTRIBUTES.VELT_LOCATION_ID}]`).forEach(r=>{if(r.getAttribute(j.ATTRIBUTES.VELT_LOCATION)){let a=this.getLocationFromElement(r);a?.locationId&&(e[a.locationId]={element:r,location:a})}else if(r.getAttribute(j.ATTRIBUTES.VELT_LOCATION_ID)){let a=r.getAttribute(j.ATTRIBUTES.VELT_LOCATION_ID);if(a){let s=this.getLocationByClientLocationId(a);s?.locationId&&(e[s.locationId]={element:r,location:s});let m={id:a},p=this.genarateLocationId(m);e[a]={element:r,location:{locationId:p,location:m}}}}}),e}catch(e){return this.loggingService.catch("Error in DocService getElementMapWithLocation:",e),{}}}getAdditionLocationFromElement(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: getAdditionLocationFromElement","color: green;");let i;if(i=e?.closest(`[${j.ATTRIBUTES.VELT_LOCATION}], [${j.ATTRIBUTES.VELT_LOCATION_ID}]`),i){if(i?.getAttribute(j.ATTRIBUTES.VELT_LOCATION)){let r=i?.getAttribute(j.ATTRIBUTES.VELT_LOCATION);if(r)return JSON.parse(r)}else if(i?.getAttribute(j.ATTRIBUTES.VELT_LOCATION_ID)){let r=i?.getAttribute(j.ATTRIBUTES.VELT_LOCATION_ID);if(r)return{id:r}}}return null}catch(i){return this.loggingService.catch("Error in DocService getAdditionLocationFromElement:",i),null}}getAdditionalDocumentIdFromElement(e){try{return e?.closest(`[${j.ATTRIBUTES.VELT_DOCUMENT_ID}]`)?.getAttribute(j.ATTRIBUTES.VELT_DOCUMENT_ID)||null}catch(i){return this.loggingService.catch("Error in DocService getAdditionalDocumentIdFromElement:",i),null}}getDocumentMetadata(e){try{return e?this.documentMetadata$.value?.[e]||null:this.documentMetadata$.value?.[this.documentPaths$.value?.documentId??""]||null}catch(i){return this.loggingService.catch("Error in DocService getDocumentMetadata:",i),null}}getAllDocumentMetadata(){try{return Object.values(this.documentMetadata$.value||{})}catch(e){return this.loggingService.catch("Error in DocService getAllDocumentMetadata:",e),[]}}getDocumentMetadataOfAvailableDocuments(){try{this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentMetadataOfAvailableDocuments","color: green;");let e=this.documentMetadata$.value||{},i={},r=this.documentPaths$.value?.veltFolderId,a=this.documentPaths$.value?.allDocuments;if(r&&a)Object.values(e).forEach(s=>{s?.documentId&&s?.veltFolderId===r&&(i[s.documentId]=s)});else{let s=this.documentIds$.value;if(s?.length)s.forEach(m=>{let p=e?.[m.documentId];p&&(i[m.documentId]=p)});else if(this.documentPaths$.value?.documentId){let m=e?.[this.documentPaths$.value?.documentId];m&&(i[this.documentPaths$.value?.documentId]=m)}}return Object.values(i)}catch(e){return this.loggingService.catch("Error in DocService getDocumentMetadataOfAvailableDocuments:",e),[]}}getDocumentMetadata$(e){return this.documentMetadata$.asObservable().pipe(ce(i=>i?.[e??this.documentPaths$.value?.documentId??""]||null))}getOrganizationMetadata(e){return this.organizationMetadata$.value?.[e]||null}getOrganizationMetadata$(e){return this.organizationMetadata$.asObservable().pipe(ce(i=>i?.[e]||null))}getCustomerMetadata(){return this.customerMetadata$.value}getCustomerMetadata$(){return this.customerMetadata$.asObservable()}getOrganizationConfig$(){return this.organizationConfig$.asObservable()}getOrganizationConfig(){return this.organizationConfig$.value}getMetadataFromType(e,i){try{switch(e){case"area":return;case"comment":return i?.multiThreadAnnotationId?this.commentService?.getMultiThreadAnnotationById(i.multiThreadAnnotationId)?.metadata:void 0;case"reaction":case"recorder":return i?.commentAnnotationId?this.commentService?.getAnnotationById(i.commentAnnotationId)?.metadata:void 0;default:return}}catch(r){this.loggingService.catch("Error in DocService getMetadataFromType:",r);return}}getDefaultMetadata({clientDocumentId:e,documentId:i}){try{let r=this.documentPaths$.value;if(!r)return;let a=e||r.clientDocumentId,s=i||r.documentId,m=this.getDocumentMetadata(s);if(!m)return;let p=m?.folderId,h=m?.veltFolderId;return I(I({apiKey:this.configService.getApiKey()??void 0,clientDocumentId:a,clientOrganizationId:r.clientOrganizationId,documentId:s,organizationId:r.organizationId},p?{folderId:p}:{}),h?{veltFolderId:h}:{})}catch(r){this.loggingService.catch("Error in DocService getDefaultMetadata:",r);return}}getBaseMetadata(e,i){try{let r,a;i?.element?r=this.getAdditionalDocumentIdFromElement(i.element)||void 0:i?.clientDocumentId&&(r=i.clientDocumentId),r&&(a=this.generateDocumentId(r));let s=this.getMetadataFromType(e,i),m=this.getDefaultMetadata({clientDocumentId:r,documentId:a});return s||m||{}}catch(r){return this.loggingService.catch("Error in DocService getBaseMetadata:",r),{}}}getServerId({documentId:e,organizationId:i}){try{return e&&(e=this.generateDocumentId(e)),i&&(i=this.generateOrganizationId(i)),{documentId:e,organizationId:i}}catch(r){return this.loggingService.catch("Error in DocService getServerId:",r),null}}fetchDocuments(e){return Q(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let r=[];if(!e?.organizationId)return this.loggingService.catch("Error in fetchDocuments: organizationId is required"),[];if(e?.folderId){let s=Tl(e?.folderId);r.push(gt("metadata.veltFolderId","==",s))}return e?.documentIds?.length&&!e?.allDocuments&&r.push(gt("metadata.documentId","in",e?.documentIds?.map(s=>this.generateDocumentId(s)).slice(0,30))),yield this.commonDbService?.queryData({feature:"allDocuments",properties:{firestoreQuery:r,apiKey:this.apiKey??"",organizationId:this.generateOrganizationId(e?.organizationId)??this.documentPaths$.value?.organizationId,documentId:this.documentPaths$.value?.documentId}})}catch(i){return this.loggingService.catch("Error in DocService fetchDocuments:",i),[]}})}fetchLocations(e){return Q(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let r=[];if(!e?.organizationId)return this.commonDbService?.shouldUseFirestore()&&this.loggingService.catch("Error in fetchLocations: organizationId is required"),[];if(e?.folderId){let s=Tl(e?.folderId);r.push(gt("metadata.veltFolderId","==",s))}return e?.documentIds?.length&&!e?.allDocuments&&r.push(gt("metadata.documentId","in",e?.documentIds?.map(s=>this.generateDocumentId(s)).slice(0,30))),yield this.commonDbService?.queryData({feature:"allLocations",properties:{firestoreQuery:r,apiKey:this.apiKey??"",organizationId:this.generateOrganizationId(e?.organizationId)??this.documentPaths$.value?.organizationId,documentId:this.documentPaths$.value?.documentId}})}catch(i){return this.loggingService.catch("Error in DocService fetchLocations:",i),[]}})}updateDocuments(e){return Q(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let{organizationId:r,documents:a}=e;if(!r&&(r=this.documentPaths$.value?.clientOrganizationId,!r))return this.loggingService.catch("Error in updateDocuments: organizationId is required"),[];if(!a||a.length===0)return this.loggingService.catch("Error in updateDocuments: documents is required"),[];let s=[],m=this.documentMetadata$.value;a.forEach(p=>{delete p?.organizationId,delete p?.clientDocumentId,delete p?.clientOrganizationId,delete p?.apiKey;let h=Cc(p.documentId);p.documentId=h;let _=m?.[h];_&&(m[h]=I(I({},_),p)),p&&this.commonDbService&&s.push(this.commonDbService.updateData({feature:"documentMetadata",data:JSON.parse(JSON.stringify(p)),properties:{organizationId:_c(r),documentId:h}}))}),yield Promise.all(s),this.documentMetadata$.next(m)}catch(i){return this.loggingService.catch("Error in DocService updateDocuments:",i),[]}})}updateLocations(e){return Q(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let{organizationId:r,locations:a,documentIds:s}=e;if((!s||s.length===0)&&(s=this.documentIds$.value.map(_=>_.clientDocumentId)??[],s.length===0))return this.loggingService.catch("Error in updateLocations: documentId is required"),[];if(!r&&(r=this.documentPaths$.value?.clientOrganizationId,!r))return this.loggingService.catch("Error in updateLocations: organizationId is required"),[];if(!a||a.length===0)return this.loggingService.catch("Error in updateLocations: locations is required"),[];let m=s.map(_=>Cc(_)),p=[],h=this.locationMetadata$.value;h||(h={}),m.forEach(_=>{a.forEach(E=>{let D=this.location$.value;if(E?.id===D?.location?.id&&this.location$.next({locationId:D?.locationId,location:E}),E?.id){delete E?.metadata;let L=yU(E.id),H=h?.[_],K=H?.[E.id];h&&(H||(h[_]={}),K||(h[_][E.id]={}),h[_][E.id]=T(I({},K),{location:E})),E&&this.commonDbService&&p.push(this.commonDbService.updateData({feature:"locationMetadata",data:JSON.parse(JSON.stringify({location:E})),properties:{organizationId:_c(r),documentId:_,id:L}}))}})}),yield Promise.all(p),Object.keys(h||{}).length>0&&this.locationMetadata$.next(h)}catch(i){return this.loggingService.catch("Error in DocService updateLocations:",i),[]}})}fetchFolders(e){return Q(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let r=[];if(!e?.organizationId)return this.loggingService.catch("Error in fetchFolders: organizationId is required"),{data:[],parentFolders:[]};let a=[],s=this.generateOrganizationId(e?.organizationId);if(e?.folderId){let m=Tl(e?.folderId);r=yield this.commonDbService?.getData({feature:"folder",properties:{folderId:m,apiKey:this.apiKey??"",organizationId:s,documentId:this.documentPaths$.value?.documentId}}),r&&(r=[r]),a=yield this.commonDbService?.queryData({feature:"allFolders",properties:{firestoreQuery:[gt("metadata.veltParentFolderId","==",m)],folderId:m,apiKey:this.apiKey??"",organizationId:s,documentId:this.documentPaths$.value?.documentId}})}else r=yield this.commonDbService?.queryData({feature:"allFolders",properties:{apiKey:this.apiKey??"",organizationId:s,documentId:this.documentPaths$.value?.documentId}});return{data:r,parentFolders:a}}catch(i){return this.loggingService.catch("Error in DocService getFoldersRequest:",i),{data:[],parentFolders:[]}}})}getDocumentIam$(){return this.authService.getUser$().pipe(he(e=>e?this.documentPaths$.pipe(he(i=>i?.documentIam?this.commonDbService?.dbListener({feature:"documentIam",properties:{documentId:i.documentId,organizationId:i.organizationId,isCollection:!1}}).pipe(ce(r=>r?.data?.docIamConfig??r?.data),qt((r,a)=>JSON.stringify(r??{})===JSON.stringify(a??{}))):se(null))):se(null)))}getDocumentAccessType(e){try{return e&&e.features&&e.features.all?e.features.all.restricted?pi.RESTRICTED:pi.PUBLIC:e&&e.documentAccessType?e.documentAccessType:pi.PUBLIC}catch(i){return this.loggingService.catch("Error in DocService getDocumentAccessType:",i),pi.PUBLIC}}changeDocumentAccessType(e){return Q(this,null,function*(){try{let i=this.documentPaths$.value;if(i){let r=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:i?.documentId??"",organizationId:i?.organizationId??"",field:"docIamConfig"}});switch(delete r.documentAccessType,r.features||(r.features={}),r.features.all||(r.features.all={}),e){case pi.PUBLIC:r.features.all.restricted=!1;break;case pi.RESTRICTED:r.features.all.restricted=!0,r.features.all.guestMode=!1;break;default:break}this.commonDbService?.updateData({feature:"documentAccessType",data:JSON.parse(JSON.stringify(r)),properties:{documentId:i?.documentId??"",organizationId:i?.organizationId??""}})}}catch(i){this.loggingService.catch("Error in DocService changeDocumentAccessType:",i)}})}getUserIdForAnalytics(){try{return this.authService?.getAuthUser()?.uid||""}catch(e){return this.loggingService.catch("Error in DocService getUserIdForAnalytics:",e),""}}setUIState(e){try{this.uiState.next(I(I({},this.uiState.value),e))}catch(i){this.loggingService.catch("Error in DocService setUIState:",i)}}getUIState$(){return this.uiState.asObservable()}};o.\u0275fac=function(i){return new(i||o)(J(Ze),J(He),J(hn),J(Ne),J(jt),J(y),J(xs),J(Am),J(wm))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Gn=(()=>{let o=class o{constructor(e,i,r,a){this.analyticsService=e,this.authService=i,this.docService=r,this.loggingService=a,this.defaultUserDataProvider={get:s=>Q(this,null,function*(){return{}})},this.resolveOrganizationUsers=!0,this.resolveFolderUsers=!0,this.resolveDocumentUsers=!0,this.resolveTimeout=1*60*1e3,this.maxResolveAttempts=1,this.resolveAttempts=new Map,this.subscriptions=new mn,this.userDataProvider$=new Ce(null),this.userById$=new Ce({}),this.userByIdCalled$=new Ce({}),this.pendingResolutions=new Set,this.getUserById=s=>{try{return this.userById$.value?.[s]}catch(m){this.loggingService.catch("Error in UsersService getUserById:",m);return}};try{this.analyticsService.setUserService(this),this.authService.setUsersService(this)}catch(s){this.loggingService.catch("Error in UsersService constructor:",s)}}ngOnDestroy(){try{this.subscriptions.unsubscribe(),this.pendingResolutions.clear(),this.resolveAttempts.clear()}catch(e){this.loggingService.catch("Error in UsersService ngOnDestroy:",e)}}isResolverForFeatureDisabled(e){try{switch(e){case"allOrganizationUsers":return!this.resolveOrganizationUsers;case"allFolderUsers":return!this.resolveFolderUsers;case"allDocumentUsers":return!this.resolveDocumentUsers;default:return!1}}catch(i){return this.loggingService.catch("Error in UsersService isResolverForFeatureDisabled:",i),!1}}resolveUsers(a){return Q(this,arguments,function*({userIds:e,forceResolve:i,feature:r}){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: resolveUsers","color: green;");let s=!1;if(r&&(s=this.isResolverForFeatureDisabled(r)),this.userDataProvider$.getValue()&&!s){let m={},p=[],h={};if(e?.forEach(_=>{let E=this.getUserById(_);E?m[_]=E:this.userByIdCalled$.getValue()[_]?i&&p.push(_):(p.push(_),this.userByIdCalled$.next(T(I({},this.userByIdCalled$.getValue()),{[_]:!0})))}),p.length>0){let _=this.userDataProvider$.getValue();if(_){let E={};try{let D,L=new Promise((H,K)=>{D=setTimeout(()=>{K(new Error("User resolution timeout"))},this.userDataProvider$.getValue()?.config?.resolveTimeout||this.userDataProvider$.getValue()?.resolveTimeout||this.resolveTimeout)});E=yield Promise.race([_.get(p).finally(()=>{clearTimeout(D)}),L]),this.analyticsService.trackEvent(X.Events.Resolver.USER_RESOLVER_GET,{sourceMethod:"resolveUsers",source:"sdk",userIds:p})}catch(D){this.loggingService.catch("Error in UsersService resolveUsers getUsers:",D,{userIds:p})}finally{p?.forEach(D=>{E[D]||(E[D]={userId:D,name:`User ${D}`})})}Object.entries(E).forEach(([D,L])=>{L&&(m[D]=E?.[D],h[D]=E?.[D])})}}return Object.keys(h).length>0&&this.userById$.next(I(I({},this.userById$.getValue()),h)),m}else return{}}catch(s){return this.loggingService.catch("Error in UsersService resolveUsers:",s),{}}})}subscribeToDocuments(){return this.docService.getDocumentIds$().pipe(gn(e=>Q(this,null,function*(){let i=yield this.getUsersFromCentralDb({documentIds:e?.map(r=>r.documentId)});this.resolveUsers({userIds:i})})))}getUsersFromCentralDb(i){return Q(this,arguments,function*({documentIds:e}){try{return new Promise(r=>{r(["customuser1","customuser2","customuser3"])})}catch{return[]}})}getUserById$(){try{return this.loggingService.log("%c[WB] Calling UsersService FUNCTION: getUserById$","color: green;"),this.userById$.asObservable()}catch(e){return this.loggingService.catch("Error in UsersService getUserById$:",e),se({})}}setUserDataProvider(e){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setUserDataProvider","color: green;"),this.userDataProvider$.next(e),e.config?.resolveUsersConfig?.organization===!1?this.resolveOrganizationUsers=!1:this.resolveOrganizationUsers=!0,e.config?.resolveUsersConfig?.folder===!1?this.resolveFolderUsers=!1:this.resolveFolderUsers=!0,e.config?.resolveUsersConfig?.document===!1?this.resolveDocumentUsers=!1:this.resolveDocumentUsers=!0}catch(i){this.loggingService.catch("Error in UsersService setUserDataProvider:",i)}}userDataProviderAvailable(){try{return this.loggingService.log("%c[WB] Calling UsersService FUNCTION: userDataProviderAvailable","color: green;"),!!this.userDataProvider$.getValue()}catch(e){return this.loggingService.catch("Error in UsersService userDataProviderAvailable:",e),!1}}};o.\u0275fac=function(i){return new(i||o)(J(Ze),J(He),J(lt),J(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var ble=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.usersService=i}getUserIdsToResolveFromAreaAnnotations(e){try{this.loggingService.log("%c[WB] Calling AreaUtilsService FUNCTION: getUserIdsToResolveFromAreaAnnotations","color: green;");let i=new Set;for(let r of e)r?.from?.userId&&i.add(r?.from?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in AreaUtilsService getUserIdsToResolveFromAreaAnnotations:",i),[]}}mergeAreaWithUser(e){try{if(this.loggingService.log("%c[WB] Calling AreaUtilsService FUNCTION: mergeAreaWithUser","color: green;"),e?.from?.userId){let i=this.usersService.getUserById(e?.from?.userId);i&&(e.from=i)}return e}catch(i){return this.loggingService.catch("Error in AreaUtilsService mergeAreaWithUser:",i),e}}formatAreaData(e){try{return this.loggingService.log("%c[WB] Calling AreaUtilsService FUNCTION: formatAreaData","color: green;"),this.usersService.userDataProviderAvailable()&&e?.from?.userId&&(e.from={userId:e.from.userId}),e}catch(i){return this.loggingService.catch("Error in AreaUtilsService formatAreaData:",i),e}}};o.\u0275fac=function(i){return new(i||o)(J(y),J(Gn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Ile=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.usersService=i}getUserIdsToResolveFromArrowAnnotations(e){try{this.loggingService.log("%c[WB] Calling ArrowUtilsService FUNCTION: getUserIdsToResolveFromArrowAnnotations","color: green;");let i=new Set;for(let r of e)r?.from?.userId&&i.add(r?.from?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in ArrowUtilsService getUserIdsToResolveFromArrowAnnotations:",i),[]}}mergeArrowWithUser(e){try{if(this.loggingService.log("%c[WB] Calling ArrowUtilsService FUNCTION: mergeArrowWithUser","color: green;"),e?.from?.userId){let i=this.usersService.getUserById(e?.from?.userId);i&&(e.from=i)}return e}catch(i){return this.loggingService.catch("Error in ArrowUtilsService mergeArrowWithUser:",i),e}}formatArrowData(e){try{return this.loggingService.log("%c[WB] Calling ArrowUtilsService FUNCTION: formatArrowData","color: green;"),this.usersService.userDataProviderAvailable()&&e?.from?.userId&&(e.from={userId:e.from.userId}),e}catch(i){return this.loggingService.catch("Error in ArrowUtilsService formatArrowData:",i),e}}};o.\u0275fac=function(i){return new(i||o)(J(y),J(Gn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var qp=class{static getFirestoreProdDbName(o,t){return t?.storeDbId??(this.isTestingDb(t?.databaseURL??"")?"sdktest":`apikey${o.toLowerCase()}`)}static isTestingDb(o){try{return o.includes("-test")}catch(t){return dt.error("Error in isTestingDb:",t),!1}}};var Yp=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.analyticsService=i,this.retrySaveConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryDeleteConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.attachmentDataProvider$=new Ce(null);try{this.loggingService.log("AttachmentResolverService initialized"),this.attachmentDataProvider$.subscribe(r=>{r&&(r.config?.saveRetryConfig&&(this.retrySaveConfig=r.config.saveRetryConfig),r.config?.deleteRetryConfig&&(this.retryDeleteConfig=r.config.deleteRetryConfig))})}catch(r){this.loggingService.catch("Error in AttachmentResolverService constructor:",r)}}getProvider(){try{let e=this.attachmentDataProvider$.getValue();return e||void 0}catch(e){this.loggingService.catch("Error in AttachmentResolverService getProvider:",e);return}}saveAttachment(e){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling AttachmentResolverService FUNCTION: saveAttachment","color: green;");let i=this.getProvider();if(!this.attachmentDataProviderAvailable())throw new Error("Attachment save data provider not available");let r=yield Sc(()=>i?.save({attachment:e.attachment,event:e.eventType,metadata:e.attachment.metadata})||Promise.resolve(void 0),"saveAttachment",this.retrySaveConfig);if(r?.statusCode!==200){this.loggingService.catch(r?.message??"Error in AttachmentResolverService saveAttachment:");return}return this.analyticsService.trackEvent(X.Events.Resolver.ATTACHMENT_RESOLVER_SAVE,{sourceMethod:"saveAttachment",source:"sdk",attachmentId:e.attachment.attachmentId,eventType:e.eventType}),r}catch(i){this.loggingService.warn("Error in AttachmentResolverService saveAttachment:",i);return}})}deleteAttachment(r){return Q(this,arguments,function*({attachmentId:e,metadata:i}){try{this.loggingService.log("%c[WB] Calling AttachmentResolverService FUNCTION: deleteAttachment","color: green;");let a=this.getProvider();if(!this.attachmentDataProviderAvailable())throw new Error("Attachment delete data provider not available");let s=yield Sc(()=>a?.delete({attachmentId:e,metadata:i,event:Ya.ATTACHMENT_DELETE})||Promise.resolve(void 0),"deleteAttachment",this.retryDeleteConfig);return s?.statusCode!==200?(this.loggingService.catch(s?.message??"Error in AttachmentResolverService deleteAttachment:"),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(X.Events.Resolver.ATTACHMENT_RESOLVER_DELETE,{sourceMethod:"deleteAttachment",source:"sdk",attachmentId:e}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(a){return this.loggingService.warn("Error in AttachmentResolverService deleteAttachment:",a),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0}}})}setAttachmentDataProvider(e){try{if(e){this.loggingService.log("Setting attachment data provider");let r=["save","delete"].filter(a=>!(a in e)||typeof e[a]!="function");if(r.length>0){let a=`DataProviders.attachment is invalid. The following methods are missing or are not functions: ${r.join(", ")}.`;this.loggingService.catch(a);return}else this.attachmentDataProvider$.next(e)}}catch(i){this.loggingService.catch("Error in AttachmentResolverService setAttachmentDataProvider:",i)}}attachmentDataProviderAvailable(){try{return!!this.attachmentDataProvider$.getValue()}catch(e){return this.loggingService.catch("Error in AttachmentResolverService attachmentDataProviderAvailable:",e),!1}}};o.\u0275fac=function(i){return new(i||o)(J(y),J(Ze))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Jv=(()=>{let o=class o{constructor(e,i,r,a,s,m,p){this.loggingService=e,this.usersService=i,this.authService=r,this.functions=a,this.configService=s,this.commentAnnotationsResolverService=m,this.attachmentResolverService=p,this.notificationActionTypeMap={[Ut.NEWLY_ADDED]:Ya.COMMENT_ANNOTATION_ADD,[Ut.ADDED]:Ya.COMMENT_ADD,[Ut.UPDATED]:Ya.COMMENT_UPDATE,[Ut.DELETED]:Ya.COMMENT_DELETE}}setNotificationService(e){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: setNotificationService","color: green;"),this.notificationService=e}catch(i){this.loggingService.catch("Error in CommentUtilsService setNotificationService: ",i)}}getUserIdsToResolveFromComments(e){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: getUserIdsToResolveFromComments","color: green;");let i=new Set;for(let r of e){if(r?.from?.userId&&i.add(r?.from?.userId),r?.comments)for(let a of r?.comments){if(a?.from?.userId&&i.add(a?.from?.userId),a?.to)for(let s of a?.to)s?.userId&&i.add(s?.userId);if(a?.taggedUserContacts)for(let s of a?.taggedUserContacts)s?.userId&&i.add(s?.userId)}if(r?.assignedTo?.userId&&i.add(r?.assignedTo?.userId),r?.subscribedUsers)for(let a of Object.values(r?.subscribedUsers))a.user.userId&&i.add(a.user.userId);if(r?.unsubscribedUsers)for(let a of Object.values(r?.unsubscribedUsers))a.user.userId&&i.add(a.user.userId)}return Array.from(i)}catch(i){return this.loggingService.catch("Error in CommentUtilsService getUserIdsToResolveFromComments:",i),[]}}mergeCommentWithUser(e){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: mergeCommentWithUser","color: green;"),e?.from?.userId){let i=this.usersService.getUserById(e?.from?.userId);i&&(e.from=i)}if(e?.comments)for(let i of e?.comments){if(i?.from?.userId){let a=this.usersService.getUserById(i?.from?.userId);a&&(i.from=a)}i?.to&&(i.to=i?.to?.map(a=>{if(a?.userId){let s=this.usersService.getUserById(a?.userId);if(s)return I(I({},a),s)}return a})),i?.taggedUserContacts&&(i.taggedUserContacts=i?.taggedUserContacts?.map(a=>{if(a?.contact){let s=this.usersService.getUserById(a?.contact?.userId);s&&(a.contact=s,(s?.name||s?.email)&&(a.text=`@${s?.name||s?.email}`))}return a})),(i?.taggedUserContacts?.filter((a,s,m)=>m.findIndex(p=>p.text===a.text)===s)||[]).forEach(a=>{if(a?.text){let s=new RegExp(Cm(`{{${a.userId}}}`),"g");i.commentText=i.commentText?.replaceAll(s,a.text),i.commentHtml=i.commentHtml?.replaceAll(s,a.text)}})}if(e?.assignedTo?.userId){let i=this.usersService.getUserById(e?.assignedTo?.userId);i&&(e.assignedTo=i)}if(e?.subscribedUsers)for(let i of Object.values(e?.subscribedUsers)){let r=this.usersService.getUserById(i.user.userId);r&&e?.subscribedUsers?.id?.user&&(e.subscribedUsers.id.user=r)}if(e?.unsubscribedUsers)for(let i of Object.values(e?.unsubscribedUsers)){let r=this.usersService.getUserById(i.user.userId);r&&e?.unsubscribedUsers?.id?.user&&(e.unsubscribedUsers.id.user=r)}return e}catch(i){return this.loggingService.catch("Error in CommentUtilsService mergeCommentWithUser:",i),e}}formatCommentData(e){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: formatCommentData","color: green;"),e?.comments?.forEach(i=>{i?.commentText&&i?.commentText?.length>0&&(i.isCommentTextAvailable=!0)}),this.usersService.userDataProviderAvailable()){if(e?.from?.userId&&(e.from={userId:e.from.userId}),e?.assignedTo?.userId&&(e.assignedTo={userId:e.assignedTo.userId}),e?.subscribedUsers)for(let i of Object.keys(e?.subscribedUsers))e.subscribedUsers[i].user={userId:e?.subscribedUsers[i].user.userId};if(e?.unsubscribedUsers)for(let i of Object.keys(e?.unsubscribedUsers))e.unsubscribedUsers[i].user={userId:e?.unsubscribedUsers[i].user.userId}}return e?.comments&&(e.comments=e?.comments?.map(i=>this.formatCommentThreadData(i))),e}catch(i){return this.loggingService.catch("Error in CommentUtilsService formatCommentData:",i),e}}mergeStrippedDataWithCommentAnnotations(e){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: mergeStrippedDataWithCommentAnnotations","color: green;"),!this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable())return e;let i=this.commentAnnotationsResolverService.getAnnotationById(e?.annotationId),r=this.attachmentResolverService.attachmentDataProviderAvailable();return i&&e?.comments?.forEach(a=>{let s=i?.comments?.[a?.commentId];if(s){a.commentHtml=s?.commentHtml,a.commentText=s?.commentText;let m=s?.attachments;r&&m&&a.attachments?.forEach(p=>{let h=p?.attachmentId;m?.[h]&&(p.name=m?.[h]?.name,p.url=m?.[h]?.url)})}}),e}catch(i){return this.loggingService.catch("Error in CommentUtilsService mergeStrippedDataWithCommentAnnotations:",i),e}}mergeLocationWithCommentAnnotations(e,i){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: mergeLocationWithCommentAnnotations","color: green;");let r=e?.location?.id,a=e?.metadata?.documentId;if(!r||!a)return e;let s=i?.[a]?.[r];return s&&(e.location=s?.location),e}catch(r){return this.loggingService.catch("Error in CommentUtilsService mergeLocationWithCommentAnnotations:",r),e}}isCommentsDataChanged(e,i){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: isCommentsDataChanged","color: green;");let r=this.commentAnnotationsResolverService.getCommentAnnotationById(i);return r?!uo(e,r):!0}catch(r){return this.loggingService.catch("Error in CommentUtilsService isCommentsDataChanged:",r),!0}}stripCommentAnnotationData({data:e,actionType:i}){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: stripCommentAnnotationData","color: green;"),!this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable()||!i)return{originalData:e,strippedData:null};let r=this.attachmentResolverService.attachmentDataProviderAvailable(),a=this.notificationActionTypeMap?.[i];if(!a)return{originalData:e,strippedData:null};let s={},m=null;if(e&&e.annotationId){let p=e.annotationId;if(s[p]={annotationId:p,metadata:_v(e.metadata??{}),comments:{}},e.comments?.forEach(E=>{if(E.commentId){let D;r&&(D={},E.attachments?.forEach(L=>{D[L.attachmentId]={attachmentId:L.attachmentId,name:L.name,url:L.url}})),s[p].comments[E.commentId]=I(I(I({commentId:E.commentId},E?.commentHtml&&{commentHtml:E?.commentHtml}),E?.commentText&&{commentText:E?.commentText}),D&&{attachments:D})}}),!this.isCommentsDataChanged(s[p],p))return{strippedData:null,originalData:e};let _=new Ro;Object.assign(_,e),_.comments=e.comments?.map(E=>{let D=new xc;if(Object.assign(D,E),D.isCommentResolverUsed=!0,r){let L=D.attachments?.map(H=>(H.isAttachmentResolverUsed=!0,delete H?.name,delete H?.url,H));D.attachments=L}return delete D?.commentHtml,delete D?.commentText,D})||[],m=_}return{strippedData:s,originalData:m,eventType:a}}catch(r){return this.loggingService.catch("Error in CommentAnnotationsResolverService stripCommentAnnotationData:",r),{strippedData:null,originalData:null}}}formatCommentThreadData(e){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: formatCommentThreadData","color: green;"),this.usersService.userDataProviderAvailable()){e?.from?.userId&&(e.from={userId:e.from.userId}),e?.to&&(e.to=e?.to?.map(r=>r?.userId?{userId:r.userId}:r)),e?.taggedUserContacts&&(e.taggedUserContacts=e?.taggedUserContacts?.map(r=>r?.contact?T(I({},r),{contact:{userId:r.userId}}):r));let i=e?.taggedUserContacts?.filter((r,a,s)=>s.findIndex(m=>m.text===r.text)===a)||[];i.forEach(r=>{if(r?.text){let a=new RegExp(Cm(r.text),"g");e.commentText=e.commentText?.replaceAll(a,s=>`{{${r.userId}}}`),e.commentHtml=e.commentHtml?.replaceAll(a,s=>`{{${r.userId}}}`)}}),i.forEach(r=>{r?.text&&(r.text="")})}return e}catch(i){return this.loggingService.catch("Error in CommentUtilsService formatCommentThreadData:",i),e}}handleCommentEncryption(s){return Q(this,arguments,function*({data:e,firestorePath:i,extraData:r,eventType:a}){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: handleCommentEncryption","color: green;");let m=U6(this.authService.getFirebaseConfig()?.firebaseOptions),p=yr(this.functions,br({url:Xn.cloudFunction?.[m]?.setEncryptedData,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:20*60*1e3});if(r){r=this.notificationService?.processNotificationData(r),r.annotationData=e;let D=r?.targetAnnotationData?.commentId;if(D){let L=e?.comments?.find(H=>H?.commentId===D);L&&(r.targetAnnotationData=L)}}let h=qp.getFirestoreProdDbName(this.configService.getApiKey()??"",this.authService.getFirebaseConfig()?.firebaseOptions),_={path:i??"",data:e??{},dbId:h??"",notificationData:r||void 0,notificationURL:Xn.firebaseNotificationsDatabaseURL,feature:"comment",eventType:a??"PATCH",sdkVersion:ga()},E=yield kp(_,this.authService.getUser()?.userId??"");yield p({veltData:E})}catch(m){this.loggingService.catch("Error in CommentUtilsService handleCommentEncryption:",m)}})}};o.\u0275fac=function(i){return new(i||o)(J(y),J(Gn),J(He),J(jo),J(jt),J(xs),J(Yp))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Ele=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.usersService=i}getUserIdsToResolveFromUserIamData(e){try{this.loggingService.log("%c[WB] Calling ContactUtilsService FUNCTION: getUserIdsToResolveFromUserIamData","color: green;");let i=new Set;if(e?.length)for(let r of e)r?.user?.userId&&i.add(r?.user?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in ContactUtilsService getUserIdsToResolveFromUserIamData: ",i),[]}}mergeUserIamWithUser(e){try{if(this.loggingService.log("%c[WB] Calling ContactUtilsService FUNCTION: mergeUserIamWithUser","color: green;"),e?.user?.userId){let i=this.usersService.getUserById(e?.user?.userId);i&&(e=T(I({},e),{user:i}))}return e}catch(i){return this.loggingService.catch("Error in ContactUtilsService mergeUserIamWithUser: ",i),e}}};o.\u0275fac=function(i){return new(i||o)(J(y),J(Gn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var xle=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.usersService=i}getUserIdsToResolveFromCursorUsers(e){try{this.loggingService.log("%c[WB] Calling CursorUtilsService FUNCTION: getUserIdsToResolveFromCursorUsers","color: green;");let i=new Set;for(let r of e)r?.userId&&i.add(r?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in CursorUtilsService getUserIdsToResolveFromCursorUsers:",i),[]}}mergeCursorUserWithUser(e){try{if(this.loggingService.log("%c[WB] Calling CursorUtilsService FUNCTION: mergeCursorUserWithUser","color: green;"),this.usersService.userDataProviderAvailable()&&e?.userId){let i=this.usersService.getUserById(e?.userId);i&&(e=I(I({},e),i))}return e}catch(i){return this.loggingService.catch("Error in CursorUtilsService mergeCursorUserWithUser:",i),e}}formatCursorUserData(e){try{if(this.loggingService.log("%c[WB] Calling CursorUtilsService FUNCTION: formatCursorUserData","color: green;"),this.usersService.userDataProviderAvailable()){let i=["userId","comment","positionX","positionY","screenWidth","screenHeight","screenScrollHeight","onlineStatus","userSnippylyId","color","textColor","timestamp","type","selections","documentParamsId","documentParams","locationId","location","targetElement","position","isReadOnly","isAnonymous","pageInfo"];Object.keys(e).forEach(r=>{i.includes(r)||(e[r]=null)})}return e}catch(i){return this.loggingService.catch("Error in CursorUtilsService formatCursorUserData:",i),e}}};o.\u0275fac=function(i){return new(i||o)(J(y),J(Gn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var TM=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.usersService=i}getUserIdsToResolveFromHuddleAttendees(e){try{this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: getUserIdsToResolveFromHuddleAttendees","color: green;");let i=new Set;for(let r of e)r?.userId&&i.add(r?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in HuddleUtilsService getUserIdsToResolveFromHuddleAttendees:",i),[]}}mergeHuddleAttendeeWithUser(e){try{if(this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: mergeHuddleAttendeeWithUser","color: green;"),e?.userId){let i=this.usersService.getUserById(e?.userId);i&&(e=I(I({},e),i))}return e}catch(i){return this.loggingService.catch("Error in HuddleUtilsService mergeHuddleAttendeeWithUser:",i),e}}formatHuddleAttendeeData(e){try{if(this.usersService.userDataProviderAvailable()){let i=["userId","userSnippylyId","state","timestamp","initialHuddleMode","streamMetadata","initialHuddleType","huddleOnCursorMode"];Object.keys(e).forEach(r=>{i.includes(r)||(e[r]=null)})}return e}catch(i){return this.loggingService.catch("Error in HuddleUtilsService formatHuddleAttendeeData:",i),e}}getUserIdsToResolveFromHuddleMessages(e){try{this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: getUserIdsToResolveFromHuddleMessages","color: green;");let i=new Set;for(let r of e)r?.from?.userId&&i.add(r?.from?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in HuddleUtilsService getUserIdsToResolveFromHuddleMessages:",i),[]}}mergeHuddleMessageWithUser(e){try{if(this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: mergeHuddleMessageWithUser","color: green;"),e?.from?.userId){let i=this.usersService.getUserById(e?.from?.userId);i&&(e.from=i)}return e}catch(i){return this.loggingService.catch("Error in HuddleUtilsService mergeHuddleMessageWithUser:",i),e}}resolveUsersFromHuddleMessages(e){return Q(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: resolveUsersFromHuddleMessages","color: green;"),this.usersService.userDataProviderAvailable()){let i=this.getUserIdsToResolveFromHuddleMessages(e),r=yield this.usersService.resolveUsers({userIds:i});for(let a of e)a?.from?.userId&&r[a.from.userId]&&(a.from=r[a.from.userId])}return e}catch(i){return this.loggingService.catch("Error in HuddleUtilsService resolveUsersFromHuddleMessages:",i),e}})}formatHuddleMessageData(e){try{return this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: formatHuddleMessageData","color: green;"),this.usersService.userDataProviderAvailable()&&e?.from?.userId&&(e.from={userId:e.from.userId}),e}catch(i){return this.loggingService.catch("Error in HuddleUtilsService formatHuddleMessageData:",i),e}}};o.\u0275fac=function(i){return new(i||o)(J(y),J(Gn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Dle=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.usersService=i}getUserIdsToResolveFromLiveStateCustom(e){try{let i=new Set;return e?.updatedBy&&i.add(e?.updatedBy?.userId),Array.from(i)}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService getUserIdsToResolveFromLiveStateCustom:",i),[]}}mergeLiveStateCustomWithUser(e){try{if(e?.updatedBy?.userId){let i=this.usersService.getUserById(e?.updatedBy?.userId);i&&(e.updatedBy=i)}return e}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService mergeLiveStateCustomWithUser:",i),e}}formatLiveStateCustomData(e){try{return this.usersService.userDataProviderAvailable()&&e?.updatedBy&&(e.updatedBy={userId:e.updatedBy.userId}),e}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService formatLiveStateCustomData:",i),e}}getUserIdsToResolveFromLiveStateCustoms(e){try{let i=new Set;for(let r of e)r?.updatedBy?.userId&&i.add(r?.updatedBy?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService getUserIdsToResolveFromLiveStateCustoms:",i),[]}}getUserIdsToResolveFromLiveStates(e){try{let i=new Set;return e?.default?.singleEditorMode?.editor?.userId&&i.add(e?.default?.singleEditorMode?.editor?.userId),Array.from(i)}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService getUserIdsToResolveFromLiveStates:",i),[]}}mergeLiveStateWithUser(e){try{if(e?.default?.singleEditorMode?.editor?.userId){let i=this.usersService.getUserById(e?.default?.singleEditorMode?.editor?.userId);i&&(e.default.singleEditorMode.editor=i)}if(e?.default?.singleEditorMode?.requestEditorAccess?.user?.userId){let i=this.usersService.getUserById(e?.default?.singleEditorMode?.requestEditorAccess?.user?.userId);i&&(e.default.singleEditorMode.requestEditorAccess.user=i)}return e}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService mergeLiveStateWithUser:",i),e}}formatLiveStateSingleEditorModeData(e){try{return this.usersService.userDataProviderAvailable()&&(e?.editor?.userId&&(e.editor={userId:e.editor.userId}),e?.requestEditorAccess?.user?.userId&&(e.requestEditorAccess.user={userId:e.requestEditorAccess.user.userId})),e}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService formatLiveStateSingleEditorModeData:",i),e}}mergeLiveStateCustomsWithUsers(e){try{for(let i of e)if(i?.updatedBy?.userId){let r=this.usersService.getUserById(i?.updatedBy?.userId);r&&(i.updatedBy=r)}return e}catch(i){return this.loggingService.catch("Error in mergeLiveStateCustomsWithUsers:",i),e}}};o.\u0275fac=function(i){return new(i||o)(J(y),J(Gn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var wle=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.usersService=i}getUserIdsToResolveFromMultiThreads(e){try{let i=new Set;for(let r of e)r?.from?.userId&&i.add(r?.from?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in MultiThreadUtilsService getUserIdsToResolveFromMultiThreads:",i),[]}}mergeMultiThreadWithUser(e){try{if(e?.from?.userId){let i=this.usersService.getUserById(e?.from?.userId);i&&(e.from=i)}return e}catch(i){return this.loggingService.catch("Error in MultiThreadUtilsService mergeMultiThreadWithUser:",i),e}}formatMultiThreadData(e){try{return this.usersService.userDataProviderAvailable()&&(e?.from?.userId&&(e.from={userId:e.from.userId}),e?.commentAnnotationsMap&&(e.commentAnnotationsMap=null)),e}catch(i){return this.loggingService.catch("Error in MultiThreadUtilsService formatMultiThreadData:",i),e}}};o.\u0275fac=function(i){return new(i||o)(J(y),J(Gn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var e0=(()=>{let o=class o{constructor(e,i,r){this.authService=e,this.loggingService=i,this.usersService=r}getUserIdsToResolveFromRecorders(e){try{let i=new Set;for(let r of e)r?.from?.userId&&i.add(r?.from?.userId),r?.transcription?.from?.userId&&i.add(r?.transcription?.from?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in RecorderUtilsService getUserIdsToResolveFromRecorders:",i),[]}}mergeRecorderWithUser(e){try{if(e?.from?.userId){let i=this.usersService.getUserById(e?.from?.userId);i&&(e.from=i)}if(e?.transcription?.from?.userId){let i=this.usersService.getUserById(e?.transcription?.from?.userId);i&&(e.transcription.from=i)}return e}catch(i){return this.loggingService.catch("Error in RecorderUtilsService mergeRecorderWithUser:",i),e}}formatRecorderData(e,i){try{return e.transcription=e?.transcription?T(I({},e.transcription),{lastUpdated:i}):void 0,this.usersService.userDataProviderAvailable()&&(e?.from?.userId&&(e.from={userId:e.from.userId}),e?.transcription?.from?.userId&&(e.transcription.from={userId:e.transcription.from.userId})),e}catch(r){return this.loggingService.catch("Error in RecorderUtilsService formatRecorderData:",r),e}}formatRecorderDataForWhisperTranscription(e){try{return this.usersService.userDataProviderAvailable()&&e?.fromUser?.userId&&(e.fromUser={userId:e.fromUser?.userId}),e}catch(i){return this.loggingService.catch("Error in RecorderUtilsService formatRecorderDataForWhisperTranscription:",i),e}}encryptRecorderAnnotation(e){return Q(this,null,function*(){try{return yield kp(e,this.authService.getUser()?.userId??"")}catch(i){this.loggingService.catch("Error in RecorderUtilsService encryptRecorderAnnotation:",i);return}})}};o.\u0275fac=function(i){return new(i||o)(J(He),J(y),J(Gn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var DM=(()=>{let o=class o{constructor(e,i,r,a,s,m){this.commentUtilsService=e,this.recorderUtilsService=i,this.loggingService=r,this.usersService=a,this.authService=s,this.commentAnnotationsResolverService=m}getUserIdsToResolveFromNotifications(e){try{let i=new Set;for(let r of e){let{notification:a}=r;switch(a?.actionUser?.userId&&i.add(a?.actionUser?.userId),a?.displayHeadlineMessageTemplateData?.actionUser?.userId&&i.add(a?.displayHeadlineMessageTemplateData?.actionUser?.userId),a?.displayHeadlineMessageTemplateData?.recipientUser?.userId&&i.add(a?.displayHeadlineMessageTemplateData?.recipientUser?.userId),a?.notificationSource){case"comment":if(a?.notificationSourceData){let s=this.commentUtilsService.getUserIdsToResolveFromComments([a?.notificationSourceData]);for(let m of s)i.add(m)}break}}return Array.from(i)}catch(i){return this.loggingService.catch("Error in ReactionUtilsService getUserIdsToResolveFromRecorders:",i),[]}}mergeStrippedDataWithNotification(e){try{if(this.loggingService.log("%c[WB] Calling NotificationUtilsService FUNCTION: mergeStrippedDataWithNotification","color: green;"),!this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable())return e;let i=this.commentAnnotationsResolverService.getAnnotationById(e?.notification?.targetAnnotationId),r=e?.raw?.targetAnnotationData?.commentId,a=i?.comments?.[r]?.commentText,s=i?.comments?.[r]?.commentHtml;return a&&s&&e?.raw?.notificationSource==="comment"&&(e.notification.displayBodyMessageTemplate=a,e.raw.targetAnnotationData.commentText=a,e.raw.targetAnnotationData.commentHtml=s),e}catch(i){return this.loggingService.catch("Error in NotificationUtilsService mergeStrippedDataWithNotification:",i),e}}mergeLocationWithNotification(e,i){try{this.loggingService.log("%c[WB] Calling NotificationUtilsService FUNCTION: mergeLocationWithNotification","color: green;");let r=e?.notification?.notificationSourceData?.location?.id,a=e?.notification?.notificationSourceData?.metadata?.documentId;if(!r||!a)return e;let s=i?.[a]?.[r];return s&&(e.notification.notificationSourceData.location=s?.location,e?.raw?.annotationData?.location&&(e.raw.annotationData.location=s?.location)),e}catch(r){return this.loggingService.catch("Error in NotificationUtilsService mergeLocationWithNotification:",r),e}}mergeNotificationWithUser(e){try{this.loggingService.log("%c[WB] Calling NotificationUtilsService FUNCTION: mergeNotificationWithUser","color: green;");let{notification:i}=e;if(i?.actionUser?.userId){let r=this.usersService.getUserById(i?.actionUser?.userId);r&&(i.actionUser=r)}if(i?.displayHeadlineMessageTemplateData?.actionUser?.userId){let r=this.usersService.getUserById(i?.displayHeadlineMessageTemplateData?.actionUser?.userId);r&&(i.displayHeadlineMessageTemplateData.actionUser=r)}if(i?.displayHeadlineMessageTemplateData?.recipientUser?.userId){let r=this.usersService.getUserById(i?.displayHeadlineMessageTemplateData?.recipientUser?.userId);r&&(i.displayHeadlineMessageTemplateData.recipientUser=r)}switch(i?.notificationSource){case"comment":i?.notificationSourceData&&this.commentUtilsService.mergeCommentWithUser(i?.notificationSourceData);break}return e}catch(i){return this.loggingService.catch("Error in NotificationUtilsService mergeNotificationWithUser:",i),e}}formatNotification(e,i){try{switch(typeof e=="object"&&(e=JSON.parse(JSON.stringify(e))),this.usersService.userDataProviderAvailable()&&e?.actionUser&&(e.actionUser={userId:e.actionUser.userId}),e.notificationSource){case"comment":this.commentUtilsService.formatCommentData(e.annotationData),this.commentUtilsService.formatCommentThreadData(e.targetAnnotationData);break;case"recorder":this.recorderUtilsService.formatRecorderData(e.annotationData,i);break}return e}catch(r){return this.loggingService.catch("Error in NotificationUtilsService formatNotification: ",r),e}}getTargetAnnotationIdsFromNotifications(e){try{this.loggingService.log("%c[WB] Calling NotificationUtilsService FUNCTION: getTargetAnnotationIdsFromNotifications","color: green;");let i=[];return Object.values(e).forEach(r=>{r?.notification?.targetAnnotationId&&r?.raw?.notificationSource==="comment"&&i.push(r.notification.targetAnnotationId)}),i}catch(i){return this.loggingService.catch("Error in NotificationUtilsService getTargetAnnotationIdsFromNotifications:",i),[]}}handleNotificationEncryption(i){return Q(this,arguments,function*({data:e}){try{this.loggingService.log("%c[WB] Calling NotificationUtilsService FUNCTION: handleNotificationEncryption","color: green;");let r="notificationwithdocumentidstoencryptanddecryptonsdk"+(this.authService.getUser()?.userId??"");return yield kp(e,r)}catch(r){return this.loggingService.catch("Error in NotificationUtilsService handleNotificationEncryption:",r),e}})}};o.\u0275fac=function(i){return new(i||o)(J(Jv),J(e0),J(y),J(Gn),J(He),J(xs))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Ale=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.usersService=i}getUserIdsToResolveFromPresenceUsers(e){try{let i=new Set;for(let r of e)r?.userId&&i.add(r?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in PresenceUtilsService getUserIdsToResolveFromPresenceUsers:",i),[]}}mergePresenceUserWithUser(e){try{if(this.usersService.userDataProviderAvailable()&&e?.userId){let i=this.usersService.getUserById(e?.userId);i&&(e=I(I({},e),i))}return e}catch(i){return this.loggingService.catch("Error in PresenceUtilsService mergePresenceUserWithUser:",i),e}}formatPresenceUserData(e){try{if(this.usersService.userDataProviderAvailable()){let i=["userId","onlineStatus","userSnippylyId","color","textColor","timestamp","type","selections","documentParamsId","documentParams","locationId","location","isReadOnly","isAnonymous","pageInfo"];Object.keys(e).forEach(r=>{i.includes(r)||(e[r]=null)})}return e}catch(i){return this.loggingService.catch("Error in PresenceUtilsService formatPresenceUserData:",i),e}}};o.\u0275fac=function(i){return new(i||o)(J(y),J(Gn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Ple=(()=>{let o=class o{constructor(e,i,r,a,s,m){this.loggingService=e,this.usersService=i,this.authService=r,this.functions=a,this.configService=s,this.reactionAnnotationsResolverService=m}getUserIdsToResolveFromReactions(e){try{let i=new Set;for(let r of e)if(r?.from?.userId&&i.add(r?.from?.userId),r?.reactions?.length)for(let a of r?.reactions)a?.from?.userId&&i.add(a?.from?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in ReactionUtilsService getUserIdsToResolveFromRecorders:",i),[]}}handleReactionEncryption(a){return Q(this,arguments,function*({data:e,firestorePath:i,eventType:r}){try{let s=U6(this.authService.getFirebaseConfig()?.firebaseOptions),m=yr(this.functions,br({url:Xn.cloudFunction?.[s]?.setEncryptedData,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:20*60*1e3}),p=qp.getFirestoreProdDbName(this.configService.getApiKey()??"",this.authService.getFirebaseConfig()?.firebaseOptions),h=this.authService.getUser()?.userId??"",_={path:i??"",data:e??{},dbId:p??"",feature:"reaction",eventType:r??"PATCH",sdkVersion:ga()},E=yield kp(_,h);yield m({veltData:E})}catch(s){this.loggingService.catch("Error in handleReactionEncryption:",s)}})}mergeReactionWithUser(e){try{if(this.usersService.userDataProviderAvailable()){if(e?.from?.userId){let i=this.usersService.getUserById(e?.from?.userId);i&&(e.from=i)}if(e?.reactions?.length){for(let i of e?.reactions)if(i?.from?.userId){let r=this.usersService.getUserById(i?.from?.userId);r&&(i.from=r)}}}return e}catch(i){return this.loggingService.catch("Error in ReactionUtilsService mergeReactionWithUser:",i),e}}formatReactionData(e){try{return this.usersService.userDataProviderAvailable()&&e?.from?.userId&&(e.from={userId:e.from.userId}),e.reactions=e?.reactions?.map(i=>(this.usersService.userDataProviderAvailable()&&i?.from?.userId&&(i.from={userId:i.from.userId}),i)),e}catch(i){return this.loggingService.catch("Error in ReactionUtilsService formatReactionData:",i),e}}isReactionDataChanged(e,i){try{this.loggingService.log("%c[WB] Calling ReactionUtilsService FUNCTION: isReactionDataChanged","color: green;");let r=this.reactionAnnotationsResolverService.getReactionAnnotationById(i);return r?!uo(e,r):!0}catch(r){return this.loggingService.catch("Error in ReactionUtilsService isReactionDataChanged:",r),!0}}stripReactionAnnotationData(e){try{if(this.loggingService.log("%c[WB] Calling ReactionUtilsService FUNCTION: stripReactionAnnotationData","color: green;"),!this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable())return{originalData:e,strippedData:null};let i={};if(e&&e.annotationId){let r=e.annotationId;if(i[r]={annotationId:r,metadata:_v(e.metadata??{}),icon:e.icon},!this.isReactionDataChanged(i[r],r))return{strippedData:null,originalData:e};delete e?.icon,e.isReactionResolverUsed=!0}return{strippedData:i,originalData:e}}catch(i){return this.loggingService.catch("Error in ReactionUtilsService stripReactionAnnotationData:",i),{strippedData:null,originalData:null}}}mergeStrippedDataWithReactionAnnotations(e){try{if(this.loggingService.log("%c[WB] Calling ReactionUtilsService FUNCTION: mergeStrippedDataWithReactionAnnotations","color: green;"),!this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable())return e;let i=this.reactionAnnotationsResolverService.getReactionAnnotationById(e?.annotationId);return i&&i.icon&&(e.icon=i.icon),e}catch(i){return this.loggingService.catch("Error in ReactionUtilsService mergeStrippedDataWithReactionAnnotations:",i),e}}};o.\u0275fac=function(i){return new(i||o)(J(y),J(Gn),J(He),J(jo),J(jt),J(Am))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Mle=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.usersService=i}getUserIdsToResolveFromSelections(e){try{let i=new Set;for(let r of e)r?.user?.userId&&i.add(r.user.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in SelectionUtilsService getUserIdsToResolveFromSelections:",i),[]}}mergeSelectionWithUser(e){try{if(e?.user?.userId){let i=this.usersService.getUserById(e?.user?.userId);i&&(e.user=i)}return e}catch(i){return this.loggingService.catch("Error in SelectionUtilsService mergeSelectionWithUser:",i),e}}formatSelectionData(e){try{return this.usersService.userDataProviderAvailable()&&e?.user?.userId&&(e.user={userId:e.user.userId}),e}catch(i){return this.loggingService.catch("Error in SelectionUtilsService formatSelectionData:",i),e}}};o.\u0275fac=function(i){return new(i||o)(J(y),J(Gn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var kle=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.usersService=i}getUserIdsToResolveFromTags(e){try{let i=new Set;for(let r of e)if(r?.from?.userId&&i.add(r.from.userId),r?.to?.length)for(let a of r.to)a?.userId&&i.add(a.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in TagUtilsService getUserIdsToResolveFromTags:",i),[]}}mergeTagWithUser(e){try{if(e?.from?.userId){let i=this.usersService.getUserById(e?.from?.userId);i&&(e.from=i)}return e?.to?.length&&(e.to=e.to.map(i=>{if(i?.userId){let r=this.usersService.getUserById(i?.userId);r&&(i=r)}return i})),e}catch(i){return this.loggingService.catch("Error in TagUtilsService mergeTagWithUser:",i),e}}formatTagData(e){try{return this.usersService.userDataProviderAvailable()&&(e?.from?.userId&&(e.from={userId:e.from.userId}),e?.to?.length&&(e.to=e.to.map(i=>(i?.userId&&(i={userId:i.userId}),i)))),e}catch(i){return this.loggingService.catch("Error in TagUtilsService formatTagData:",i),e}}};o.\u0275fac=function(i){return new(i||o)(J(y),J(Gn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var t0=(()=>{let o=class o{constructor(e,i,r,a,s,m,p,h,_,E,D,L,H,K,oe,ue,be,Le,qe){this.areaUtilsService=e,this.arrowUtilsService=i,this.commentUtilsService=r,this.contactUtilsService=a,this.cursorUtilsService=s,this.huddleUtilsService=m,this.liveStateUtilsService=p,this.loggingService=h,this.multiThreadUtilsService=_,this.notificationUtilsService=E,this.presenceUtilsService=D,this.reactionUtilsService=L,this.recorderUtilsService=H,this.selectionUtilsService=K,this.tagUtilsService=oe,this.usersService=ue,this.docService=be,this.commentAnnotationsResolverService=Le,this.reactionAnnotationsResolverService=qe}getFirestorePath({feature:e,properties:i,documentPaths:r,apiKey:a}){try{if(!a)return;let{documentId:s,organizationId:m,folderId:p}=i;m||(m=r?.organizationId);let h=new IM({apiKey:a,documentId:s?`${s}`:"",organizationId:m?`${m}`:"",veltFolderId:p?`${p}`:void 0});switch(e){case"userConfig":return i?.userId&&i?.documentId&&h?.userConfig?`${h?.userConfig}/${i?.userId}/${j.FIREBASE_PARTIAL_PATH_DOCUMENT_CONFIGURATIONS}/${i?.documentId}`:void 0;case"comment":return i?.documentId&&i?.id&&h?.comment?`${h?.comment}/${i?.id}`:void 0;case"allComments":return i?.documentId&&h?.comment?`${h?.comment}`:void 0;case"multiThread":return i?.documentId&&i?.id&&h?.multiThread?`${h?.multiThread}/${i?.id}`:void 0;case"allMultiThreads":return i?.documentId&&h?.multiThread?`${h?.multiThread}`:void 0;case"allLastNotificationTimestamp":return h?.lastNotificationTimestamp?`${h?.lastNotificationTimestamp}`:void 0;case"lastNotificationTimestamp":return i?.id&&h?.lastNotificationTimestamp?`${h?.lastNotificationTimestamp}/${i?.id}`:void 0;case"area":return i?.documentId&&i?.id&&h?.area?`${h?.area}/${i?.id}`:void 0;case"allAreas":return i?.documentId&&h?.area?`${h?.area}`:void 0;case"allDocuments":return h?.document?`${h?.document}`:void 0;case"allLocations":return h?.location?`${h?.location}`:void 0;case"allFolders":return h?.folder?`${h?.folder}`:void 0;case"folder":return h?.folder&&i.folderId?`${h?.folder}/${i.folderId}`:void 0;case"documentUserAccess":return i?.documentId&&i?.id&&h?.documentUsers?`${h?.documentUsers}/${i?.id}`:void 0;case"reaction":return i?.documentId&&i?.id&&h?.reaction?`${h?.reaction}/${i?.id}`:void 0;case"allReactions":return i?.documentId&&h?.reaction?`${h?.reaction}`:void 0;case"recorder":return i?.documentId&&i?.id&&h?.recorder?`${h?.recorder}/${i?.id}`:void 0;case"allRecorders":return i?.documentId&&h?.recorder?`${h?.recorder}`:void 0;case"documentAccessType":return i?.documentId&&h?.document?`${h?.document}/${i?.documentId}`:void 0;case"organizationMetadata":return h?.organization?`${h?.organization}`:void 0;case"documentIam":case"documentMetadata":return i?.documentId&&h?.document?`${h?.document}/${i?.documentId}`:void 0;case"folderMetadata":return i?.folderId&&h?.folder?`${h?.folder}/${i?.folderId}`:void 0;case"locationMetadata":return i?.documentId&&h?.location&&i?.id?`${h?.location}/${i?.id}`:void 0;case"documentUser":return i?.documentId&&i?.id&&h?.documentUsers?`${h?.documentUsers}/${i?.id}`:void 0;case"allDocumentUsers":return i?.documentId&&h?.documentUsers?`${h?.documentUsers}`:void 0;case"allFolderUsers":return i?.folderId&&h?.folderUsers?`${h?.folderUsers}`:void 0;case"allOrganizationGroups":return h?.organizationGroups?`${h?.organizationGroups}`:void 0;case"allOrganizationUsers":return h?.organizationUsers?`${h?.organizationUsers}`:void 0;case"commentViews":return i?.documentId&&i?.id&&h?.commentViews?`${h?.commentViews}/${i?.id}`:void 0;case"allCommentViews":return i?.documentId&&h?.commentViews?`${h?.commentViews}`:void 0;case"notificationViewsTimestamp":return i?.documentId&&i?.id&&h?.notificationViews?`${h?.notificationViews}/${i?.id}`:void 0;case"allDocumentViews":return i?.documentId&&h?.documentViews?`${h?.documentViews}`:void 0;case"documentViews":case"documentMetadataViews":case"documentDayViews":case"documentUsersViews":return i?.documentId&&i?.id&&h?.documentViews?`${h?.documentViews}/${i?.id}`:void 0;case"locationDayViews":case"locationUsersViews":case"locationViews":case"locationMetadataViews":case"location":return i?.documentId&&i?.id&&h?.locationViews?`${h?.locationViews}/${i?.id}`:void 0;case"allLocationViews":return i?.documentId&&h?.locationViews?`${h?.locationViews}`:void 0;case"allDocNotifications":return i?.documentId&&h?.docNotification?`${h?.docNotification}`:void 0;case"docNotificationViews":case"docNotification":return i?.documentId&&i?.id&&h?.docNotification?`${h?.docNotification}/${i?.id}`:void 0;case"userNotificationViews":case"userNotification":return i?.userId&&i?.id&&h?.notificationUsers?`${h?.notificationUsers}/${i?.userId}/${j.FIREBASE_PARTIAL_PATH_USER_NOTIFICATION}/${i?.id}`:void 0;case"allDocNotifications":return i?.documentId&&h?.docNotification?`${h?.docNotification}`:void 0;case"allUserNotifications":return i?.userId&&h?.notificationUsers?`${h?.notificationUsers}/${i?.userId}/${j.FIREBASE_PARTIAL_PATH_USER_NOTIFICATION}`:void 0;default:throw new Error(`Unknown feature: ${e}`)}}catch(s){this.loggingService.catch("Error in CommonDbUtilsService getFirestorePath:",s);return}}getFirestoreCollectionGroupPath(e){try{switch(e){case"allComments":return j.FIREBASE_PARTIAL_PATH_COMMENT;case"allDocuments":return j.FIREBASE_PARTIAL_PATH_DOCS;case"allLocations":return j.FIREBASE_PARTIAL_PATH_LOCATION;case"allMultiThreads":return j.FIREBASE_PARTIAL_PATH_MULTI_THREAD;case"allAreas":return j.FIREBASE_PARTIAL_PATH_AREA;case"allReactions":return j.FIREBASE_PARTIAL_PATH_REACTION;case"allRecorders":return j.FIREBASE_PARTIAL_PATH_RECORDER;case"allDocumentViews":return j.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS;case"allCommentViews":return j.FIREBASE_PARTIAL_PATH_COMMENT_VIEWS;case"allLocationViews":return j.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS;case"allDocumentUsers":return j.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS;case"allFolderUsers":return j.FIREBASE_PARTIAL_PATH_FOLDER_USERS;default:throw new Error(`Unknown feature: ${e}`)}}catch(i){this.loggingService.catch("Error in CommonDbUtilsService getFirestoreCollectionGroupPath:",i);return}}getDocumentPath({feature:e,properties:i,defaultDocumentPaths:r,apiKey:a,useFirestore:s}){try{if(!a)return;let{documentId:m,organizationId:p}=i;p||(p=r?.organizationId);let h=new Om({apiKey:a,documentId:m?`${m}`:"",organizationId:p?`${p}`:""});switch(e){case"userConfig":return i?.userId&&i?.documentId&&h?.userConfig?`${h?.userConfig}/${i?.userId}/${j.FIREBASE_PARTIAL_PATH_DOCUMENT_CONFIGURATIONS}/${i?.documentId}`:void 0;case"allComments":return!s&&i?.documentId&&h?.comment?`${h?.comment}`:void 0;case"allGlobalContacts":return i?.documentId&&h?.globalContacts?`${h?.globalContacts}`:void 0;case"globalContacts":return i?.documentId&&i?.userId&&h?.globalContacts?`${h?.globalContacts}${i?.userId}`:void 0;case"groupContacts":return i?.documentId&&i?.groupId&&h?.groupContacts?`${h?.groupContacts}${i?.groupId}`:void 0;case"groupContactsUser":return i?.documentId&&i?.groupId&&i?.userId&&h?.groupContacts?`${h?.groupContacts}${i?.groupId}/${i?.userId}`:void 0;case"allLoginContacts":return i?.documentId&&i?.userId&&h?.logins?`${h?.logins}${i?.userId}/contacts`:void 0;case"allLogins":return i?.documentId&&h?.logins?`${h?.logins}`:void 0;case"logins":return i?.documentId&&i?.userId&&h?.logins?`${h?.logins}${i?.userId}`:void 0;case"customerMetadata":return h?.customerMetadata?`${h?.customerMetadata}`:void 0;case"allArrows":return i?.documentId&&h?.arrow?`${h?.arrow}`:void 0;case"arrow":return i?.documentId&&h?.arrow&&i.id?`${h?.arrow}${i.id}`:void 0;case"allCursors":return i?.documentId&&h?.cursor?`${h?.cursor}`:void 0;case"cursor":return i?.documentId&&h?.cursor&&i.id?`${h?.cursor}${i.id}`:void 0;case"flockUser":return i?.documentId&&h?.flock&&i.id?`${h?.flock}users/${i.id}`:void 0;case"flockSession":return i?.documentId&&h?.flock&&i.id?`${h?.flock}sessions/${i.id}`:void 0;case"allHuddleAttendees":return i?.documentId&&h?.huddle?`${h?.huddle}attendees`:void 0;case"huddleAttendee":return i?.documentId&&h?.huddle&&i.id?`${h?.huddle}attendees/${i.id}`:void 0;case"huddleAttendeeState":return i?.documentId&&h?.huddle&&i.id?`${h?.huddle}attendees/${i.id}/state`:void 0;case"allHuddleInvitees":return i?.documentId&&h?.huddle?`${h?.huddle}invitees`:void 0;case"huddleConnection":return i?.documentId&&h?.huddle&&i.id?`${h?.huddle}connections/${i.id}`:void 0;case"huddleIceCandidate":return i?.documentId&&h?.huddle&&i.id?`${h?.huddle}iceCandidates/${i.id}`:void 0;case"allHuddleIceCandidates":return i?.documentId&&h?.huddle?`${h?.huddle}iceCandidates`:void 0;case"allHuddleMessages":return i?.documentId&&h?.huddle?`${h?.huddle}messages`:void 0;case"huddleMessage":return i?.documentId&&h?.huddle&&i.id?`${h?.huddle}messages/${i.id}`:void 0;case"allLiveStates":return i?.documentId&&h?.liveState?`${h?.liveState}`:void 0;case"allLiveStateCustoms":return i?.documentId&&h?.liveState?`${h?.liveState}custom`:void 0;case"liveStateCustom":return i?.documentId&&h?.liveState&&i?.id?`${h?.liveState}custom/${i.id}`:void 0;case"liveStateSingleEditorMode":return i?.documentId&&h?.liveStateSingleEditorMode?`${h?.liveStateSingleEditorMode}`:void 0;case"liveStateAutoSyncStateCurrent":return i?.documentId&&h?.liveState?`${h?.liveState}default/autoSyncState/current`:void 0;case"liveStateAutoSyncStateHistoryId":return i?.documentId&&h?.liveState&&i?.id?`${h?.liveState}default/autoSyncState/history/${i.id}`:void 0;case"presence":return i?.documentId&&h?.presence&&i?.userId?`${h?.presence}${i?.userId}`:void 0;case"allPresence":return i?.documentId&&h?.presence?`${h?.presence}`:void 0;case"workspaceIam":return h?.workspaceIam?`${h?.workspaceIam}`:void 0;case"selection":return i?.documentId&&h?.selection&&i?.userId?`${h?.selection}${i?.userId}`:void 0;case"allSelections":return i?.documentId&&h?.selection?`${h?.selection}`:void 0;case"syncVideoPlayer":return i?.documentId&&h?.syncVideoPlayer?`${h?.syncVideoPlayer}`:void 0;case"allTags":return i?.documentId&&h?.tag?`${h?.tag}`:void 0;case"tag":return i?.documentId&&h?.tag&&i?.id?`${h?.tag}${i?.id}`:void 0;case"userContactUs":return i?.documentId&&h?.userContactUs?`${h?.userContactUs}`:void 0;case"userFeedback":return i?.documentId&&h?.userFeedback?`${h?.userFeedback}`:void 0;case"userReportBug":return i?.documentId&&h?.userReportBugs?`${h?.userReportBugs}`:void 0;case"comment":return!s&&i?.documentId&&i?.id&&h?.comment?`${h?.comment}${i?.id}`:void 0;case"allMultiThreads":return!s&&i?.documentId&&h?.multiThread?`${h?.multiThread}`:void 0;case"multiThread":return!s&&i?.documentId&&i?.id&&h?.multiThread?`${h?.multiThread}${i?.id}`:void 0;case"allLastNotificationTimestamp":return!s&&h?.organizationNotificationsLastNotificationTimestamp?`${h?.organizationNotificationsLastNotificationTimestamp}`:void 0;case"lastNotificationTimestamp":return!s&&i?.id&&h?.organizationNotificationsLastNotificationTimestamp?`${h?.organizationNotificationsLastNotificationTimestamp}${i?.id}`:void 0;case"documentIam":return!s&&i?.documentId&&h?.documentIam?`${h?.documentIam}`:void 0;case"documentMetadata":return!s&&i?.documentId&&h?.metadata?`${h?.metadata}`:void 0;case"allDocuments":return!s&&h?.docs&&i?.documentId?`${h?.docs}/${i?.documentId}/${j.FIREBASE_PARTIAL_PATH_METADATA}`:void 0;case"allAreas":return!s&&i?.documentId&&h?.area?`${h?.area}`:void 0;case"area":return!s&&i?.id&&h?.area?`${h?.area}${i?.id}`:void 0;case"documentUserAccess":return!s&&i?.id&&h?.documentIam?`${h?.documentIam}users/${i?.id}`:void 0;case"documentUser":return!s&&i?.documentId&&i?.id&&h?.documentIam?`${h?.documentIam}users/${i?.id}`:void 0;case"allDocumentUsers":return!s&&i?.documentId&&h?.documentIam?`${h?.documentIam}users/`:void 0;case"allOrganizationGroups":return!s&&h?.organizationGroups?`${h?.organizationGroups}`:void 0;case"allOrganizationUsers":return!s&&h?.organizationIam?`${h?.organizationIam}users/`:void 0;case"reaction":return!s&&i?.id&&h?.reaction?`${h?.reaction}${i?.id}`:void 0;case"allReactions":return!s&&i?.documentId&&h?.reaction?`${h?.reaction}`:void 0;case"recorder":return!s&&i?.documentId&&i?.id&&h?.recorder?`${h?.recorder}${i?.id}`:void 0;case"allRecorders":return!s&&i?.documentId&&h?.recorder?`${h?.recorder}`:void 0;case"organizationMetadata":return!s&&h?.organizationMetadata?`${h?.organizationMetadata}`:void 0;case"documentAccessType":return!s&&h?.documentIam?`${h?.documentIam}`:void 0;case"documentIam":return!s&&h?.documentIam?`${h?.documentIam}`:void 0;case"documentMetadata":return!s&&i?.documentId&&h?.metadata?`${h?.metadata}`:void 0;case"commentViews":return!s&&i?.documentId&&i?.id&&h?.views?`${h?.views}comment/${i?.id}`:void 0;case"allDocumentViews":return!s&&i?.documentId&&h?.views?`${h?.views}documentViews/`:void 0;case"documentViews":return!s&&i?.documentId&&i?.id&&h?.views?`${h?.views}documentViews/${i?.id}`:void 0;case"allCommentViews":return!s&&i?.documentId&&h?.views?`${h?.views}comment/`:void 0;case"allLocationViews":return!s&&i?.documentId&&h?.views?`${h?.views}locationViews/`:void 0;case"notificationViewsTimestamp":return!s&&i?.id&&i?.user&&h?.views?`${h?.views}notification/${i?.id}/views/${i?.user}`:void 0;case"documentUsersViews":return!s&&i?.id&&i?.user&&i?.date&&h?.views?`${h?.views}documentViews/${i?.id}/users/${i?.user}/${i?.date}`:void 0;case"documentMetadataViews":return!s&&i?.id&&h?.views?`${h?.views}documentViews/${i?.id}/metadata`:void 0;case"documentDayViews":return!s&&i?.id&&i?.date&&i?.user&&h?.views?`${h?.views}documentViews/${i?.id}/day/${i?.date}/${i?.user}`:void 0;case"locationViews":return!s&&i?.id&&h?.views?`${h?.views}locationViews/${i?.id}/location`:void 0;case"location":return!s&&i?.id&&h?.views?`${h?.views}locationViews/${i?.id}`:void 0;case"locationUsersViews":return!s&&i?.id&&i?.user&&i?.date&&h?.views?`${h?.views}locationViews/${i?.id}/users/${i?.user}/${i?.date}`:void 0;case"locationMetadataViews":return!s&&i?.id&&h?.views?`${h?.views}locationViews/${i?.id}/metadata`:void 0;case"locationDayViews":return!s&&i?.id&&i?.date&&i?.user&&h?.views?`${h?.views}locationViews/${i?.id}/day/${i?.date}/${i?.user}`:void 0;case"docNotificationViews":case"docNotification":return i?.documentId&&i?.id&&h?.organizationNotificationsWithDocumentId?`${h?.organizationNotificationsWithDocumentId}${i?.id}`:void 0;case"allDocNotifications":return i?.documentId&&h?.organizationNotificationsWithDocumentId?`${h?.organizationNotificationsWithDocumentId}`:void 0;case"allUserNotifications":return i?.userId&&h?.organizationNotificationsUsers?`${h?.organizationNotificationsUsers}${i?.userId}`:void 0;case"userNotificationViews":case"userNotification":return i?.userId&&i?.id&&h?.organizationNotificationsUsers?`${h?.organizationNotificationsUsers}${i?.userId}/${i?.id}`:void 0;case"locationMetadata":return;case"allLocations":return;case"folderMetadata":return;default:throw new Error(`Unknown feature: ${e}`)}}catch(m){this.loggingService.catch("Error in CommonDbUtilsService getDocumentPath:",m);return}}resolveAnnotations(r){return Q(this,arguments,function*({data:e,feature:i}){try{if(e&&e?.length>0)switch(i){case"allComments":{this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable()&&this.commentAnnotationsResolverService.resolveCommentAnnotations({commentAnnotationIds:e,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""});break}case"allReactions":{this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable()&&this.reactionAnnotationsResolverService.resolveReactionAnnotations({reactionAnnotationIds:e,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""});break}default:break}}catch(a){this.loggingService.catch(`Error in CommonDbUtilsService resolveAnnotations: ${i}`,a)}})}formatResponse(m){return Q(this,arguments,function*({feature:e,data:i,shouldAwait:r=!1,forceResolve:a=!1,shouldCommentAnnotationsResolverAwait:s=!1}){try{if(this.usersService.userDataProviderAvailable()){let p=[];switch(e){case"allAreas":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.areaUtilsService.getUserIdsToResolveFromAreaAnnotations(Object.values(i)));break}case"allArrows":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.arrowUtilsService.getUserIdsToResolveFromArrowAnnotations(Object.values(i)));break}case"allCursors":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.cursorUtilsService.getUserIdsToResolveFromCursorUsers(Object.values(i)));break}case"allComments":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.commentUtilsService.getUserIdsToResolveFromComments(Object.values(i)));break}case"allDocumentUsers":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.contactUtilsService.getUserIdsToResolveFromUserIamData(Object.values(i)));break}case"allFolderUsers":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.contactUtilsService.getUserIdsToResolveFromUserIamData(Object.values(i)));break}case"allOrganizationUsers":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.contactUtilsService.getUserIdsToResolveFromUserIamData(Object.values(i)));break}case"allMultiThreads":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.multiThreadUtilsService.getUserIdsToResolveFromMultiThreads(Object.values(i)));break}case"allDocNotifications":{i&&typeof i=="object"&&(p=this.notificationUtilsService.getUserIdsToResolveFromNotifications(Array.isArray(i)?i:Object.values(i)));break}case"allUserNotifications":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.notificationUtilsService.getUserIdsToResolveFromNotifications(Object.values(i)));break}case"allPresence":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.presenceUtilsService.getUserIdsToResolveFromPresenceUsers(Object.values(i)));break}case"allRecorders":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.recorderUtilsService.getUserIdsToResolveFromRecorders(Object.values(i)));break}case"allReactions":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.reactionUtilsService.getUserIdsToResolveFromReactions(Object.values(i)));break}case"allTags":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.tagUtilsService.getUserIdsToResolveFromTags(Object.values(i)));break}case"allHuddleAttendees":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.huddleUtilsService.getUserIdsToResolveFromHuddleAttendees(Object.values(i)));break}case"liveStateCustom":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.liveStateUtilsService.getUserIdsToResolveFromLiveStateCustom(i));break}case"allLiveStateCustoms":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.liveStateUtilsService.getUserIdsToResolveFromLiveStateCustoms(Object.values(i)));break}case"allLiveStates":{i&&typeof i=="object"&&(p=this.liveStateUtilsService.getUserIdsToResolveFromLiveStates(i));break}case"allSelections":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.selectionUtilsService.getUserIdsToResolveFromSelections(Object.values(i)));break}default:p=[]}p?.length&&(r?yield this.usersService.resolveUsers({userIds:p,forceResolve:a,feature:e}):this.usersService.resolveUsers({userIds:p,forceResolve:a,feature:e}))}if(this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable()){let p=[];switch(e){case"allDocNotifications":{if(i&&typeof i=="object"){let h=this.notificationUtilsService.getTargetAnnotationIdsFromNotifications(i);p=[...p,...h],p=p.filter(_=>!this.commentAnnotationsResolverService.getCommentAnnotationById(_))}break}case"allUserNotifications":{if(i&&typeof i=="object"&&!Array.isArray(i)){let h=this.notificationUtilsService.getTargetAnnotationIdsFromNotifications(i);p=[...p,...h],p=p.filter(_=>!this.commentAnnotationsResolverService.getCommentAnnotationById(_))}break}default:p=[]}p?.length&&(s?yield this.commentAnnotationsResolverService.resolveCommentAnnotations({commentAnnotationIds:p,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""}):this.commentAnnotationsResolverService.resolveCommentAnnotations({commentAnnotationIds:p,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""}))}return i}catch(p){return this.loggingService.catch("Error in CommonDbUtilsService formatResponse:",p),i}})}mergeCommentAnnotationsWithData({data:e,feature:i}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeCommentAnnotationsWithData","color: green;"),this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable())switch(i){case"allComments":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((r,[a,s])=>(r[a]=this.commentUtilsService.mergeStrippedDataWithCommentAnnotations(s),r),{}):e;case"allDocNotifications":case"allUserNotifications":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((r,[a,s])=>(r[a]=this.notificationUtilsService.mergeStrippedDataWithNotification(s),r),{}):e;default:return e}return e}catch(r){return this.loggingService.catch("Error in CommonDbUtilsService mergeCommentAnnotationsWithData:",r),e}}mergeReactionAnnotationsWithData({data:e,feature:i}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeReactionAnnotationsWithData","color: green;"),this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable())switch(i){case"allReactions":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((r,[a,s])=>(r[a]=this.reactionUtilsService.mergeStrippedDataWithReactionAnnotations(s),r),{}):e;default:return e}return e}catch(r){return this.loggingService.catch("Error in CommonDbUtilsService mergeReactionAnnotationsWithData:",r),e}}mergeLocationMetadataWithData({data:e,feature:i,locationMetadata:r}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeLocationMetadataWithData","color: green;"),r&&typeof r=="object"&&!Array.isArray(r))switch(i){case"allComments":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((a,[s,m])=>(a[s]=this.commentUtilsService.mergeLocationWithCommentAnnotations(m,r),a),{}):e;case"allDocNotifications":case"allUserNotifications":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((a,[s,m])=>(a[s]=this.notificationUtilsService.mergeLocationWithNotification(m,r),a),{}):e;default:return e}return e}catch(a){return this.loggingService.catch("Error in CommonDbUtilsService mergeLocationMetadataWithData:",a),e}}mergeUsersWithData({feature:e,data:i}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeUsersWithData","color: green;"),this.usersService.userDataProviderAvailable())switch(e){case"allAreas":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.areaUtilsService.mergeAreaWithUser(s),r),{}):i;case"allArrows":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.arrowUtilsService.mergeArrowWithUser(s),r),{}):i;case"allCursors":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.cursorUtilsService.mergeCursorUserWithUser(s),r),{}):i;case"allComments":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.commentUtilsService.mergeCommentWithUser(s),r),{}):i;case"allDocumentUsers":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.contactUtilsService.mergeUserIamWithUser(s),r),{}):i;case"allFolderUsers":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.contactUtilsService.mergeUserIamWithUser(s),r),{}):i;case"allOrganizationUsers":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.contactUtilsService.mergeUserIamWithUser(s),r),{}):i;case"allMultiThreads":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.multiThreadUtilsService.mergeMultiThreadWithUser(s),r),{}):i;case"allDocNotifications":return i&&typeof i=="object"?i?.map(r=>this.notificationUtilsService.mergeNotificationWithUser(r)):i;case"allUserNotifications":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.notificationUtilsService.mergeNotificationWithUser(s),r),{}):i;case"allPresence":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.presenceUtilsService.mergePresenceUserWithUser(s),r),{}):i;case"allRecorders":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.recorderUtilsService.mergeRecorderWithUser(s),r),{}):i;case"allReactions":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.reactionUtilsService.mergeReactionWithUser(s),r),{}):i;case"allTags":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.tagUtilsService.mergeTagWithUser(s),r),{}):i;case"allHuddleAttendees":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.huddleUtilsService.mergeHuddleAttendeeWithUser(s),r),{}):i;case"liveStateCustom":return i&&typeof i=="object"&&!Array.isArray(i)?this.liveStateUtilsService.mergeLiveStateCustomWithUser(i):i;case"allLiveStateCustoms":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.liveStateUtilsService.mergeLiveStateCustomWithUser(s),r),{}):i;case"allLiveStates":return i&&typeof i=="object"?this.liveStateUtilsService.mergeLiveStateWithUser(i):i;case"allSelections":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.selectionUtilsService.mergeSelectionWithUser(s),r),{}):i;default:return i}return i}catch(r){return this.loggingService.catch("Error in CommonDbUtilsService mergeUsersWithData:",r),i}}mergeCommentAnnotationsWithData$({data:e,feature:i}){try{return this.commentAnnotationsResolverService.getCommentAnnotationsById$().pipe(ce(()=>{let r=this.mergeCommentAnnotationsWithData({data:e?.data??{},feature:i}),a=this.mergeUsersWithData({feature:i,data:r??{}});return typeof a=="object"?{data:JSON.parse(JSON.stringify(a)),operation:e?.operation??null}:{data:a,operation:e?.operation??null}}),qt(Vi))}catch(r){return this.loggingService.catch("Error in mergeCommentAnnotationsWithData:",r),se(e)}}mergeReactionAnnotationsWithData$({data:e,feature:i}){try{return this.reactionAnnotationsResolverService.getReactionAnnotationsById$().pipe(ce(()=>{let r=this.mergeReactionAnnotationsWithData({data:e?.data??{},feature:i}),a=this.mergeUsersWithData({feature:i,data:r??{}});return typeof a=="object"?{data:JSON.parse(JSON.stringify(a)),operation:e?.operation??null}:{data:a,operation:e?.operation??null}}),qt(Vi))}catch(r){return this.loggingService.catch("Error in mergeReactionAnnotationsWithData:",r),se(e)}}mergeUsersWithData$({feature:e,data:i}){try{return this.usersService.getUserById$().pipe(ce(()=>{let r=this.mergeUsersWithData({feature:e,data:i?.data??{}});return typeof r=="object"?{data:JSON.parse(JSON.stringify(r)),operation:i?.operation??null}:{data:r,operation:i?.operation??null}}),qt(Vi))}catch(r){return this.loggingService.catch(`Error in mergeUsersWithData for ${e}:`,r),se(i)}}mergeLocationMetadataWithData$({data:e,feature:i}){try{return this.docService.getLocationMetadata$().pipe(ce(r=>{let a=this.mergeLocationMetadataWithData({data:e?.data??{},feature:i,locationMetadata:r});return typeof a=="object"?{data:JSON.parse(JSON.stringify(a)),operation:e?.operation??null}:{data:a,operation:e?.operation??null}}),qt(Vi))}catch(r){return this.loggingService.catch(`Error in mergeLocationMetadataWithData for ${i}:`,r),se(e)}}handleDataStripping({feature:e,data:i,actionType:r}){try{switch(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: handleDataStripping","color: green;"),e){case"comment":return this.commentUtilsService.stripCommentAnnotationData({data:i,actionType:r});case"reaction":return this.reactionUtilsService.stripReactionAnnotationData(i);default:return{originalData:i,strippedData:null}}}catch(a){return this.loggingService.catch("Error in CommonDbUtilsService handleDataStripping:",a),{originalData:i,strippedData:null}}}formatData({feature:e,data:i,properties:r,offset:a,isRealtimeDb:s}){try{this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: formatData","color: green;"),typeof i=="object"&&(i=JSON.parse(JSON.stringify(i)));let m=new Date().getTime()+a;switch(e){case"documentAccessType":return delete i?.users,{docIamConfig:i};case"organizationMetadata":case"documentMetadata":return s?i:{metadata:i};case"cursor":return this.cursorUtilsService.formatCursorUserData(i);case"comment":return this.commentUtilsService.formatCommentData(i);case"area":return this.areaUtilsService.formatAreaData(i);case"arrow":return this.arrowUtilsService.formatArrowData(i);case"liveStateCustom":return this.liveStateUtilsService.formatLiveStateCustomData(i);case"liveStateSingleEditorMode":return this.liveStateUtilsService.formatLiveStateSingleEditorModeData(i);case"multiThread":return this.multiThreadUtilsService.formatMultiThreadData(i);case"reaction":return this.reactionUtilsService.formatReactionData(i);case"recorder":return this.recorderUtilsService.formatRecorderData(i,m);case"notificationViewsTimestamp":return{views:{[r.user??""]:i}};case"documentUsersViews":return s?i:{users:{[r.user??""]:{[r.date??""]:i}}};case"documentDayViews":return s?i:{day:{[r.date??""]:{[r.user??""]:i}}};case"documentMetadataViews":return s?i:{metadata:i};case"huddleMessage":return this.huddleUtilsService.formatHuddleMessageData(i);case"locationMetadataViews":return s?i:{metadata:i};case"locationUsersViews":return s?i:{users:{[r.user??""]:{[r.date??""]:i}}};case"locationDayViews":return s?i:{day:{[r.date??""]:{[r.user??""]:i}}};case"locationViews":return s?i:{location:i};case"docNotificationViews":return s?i:{views:i.views};case"userNotificationViews":return s?i:{views:i.views};case"presence":return this.presenceUtilsService.formatPresenceUserData(i);case"selection":return this.selectionUtilsService.formatSelectionData(i);case"tag":return this.tagUtilsService.formatTagData(i);default:return i}}catch(m){return this.loggingService.catch("Error in CommonDbUtilsService formatData:",m),i}}modifyAndSetData(s){return Q(this,arguments,function*({feature:e,data:i,subscriber:r,operation:a=null}){try{let m=yield this.modifyData({feature:e,data:i});r.next({data:m,operation:a})}catch(m){this.loggingService.catch("Error in CommonDbUtilsService modifyAndSetData:",m)}})}isDataAlreadyProcessedInLocalCache({feature:e,change:i,cache:r}){try{if(e==="allReactions"||e==="allComments"){if(i.type==="removed")return!Object.keys(r??{}).includes(i.doc.id);if(r?.[i.doc.id]){let a=i.doc.data(),s=r?.[i.doc.id];return a?.lastUpdated===s?.lastUpdated}}return!1}catch(a){return this.loggingService.catch("Error in CommonDbUtilsService isDataAlreadyProcessedInLocalCache:",a),!1}}modifyData(r){return Q(this,arguments,function*({feature:e,data:i}){try{return yield this.formatResponse({feature:e,data:i})}catch(a){return this.loggingService.catch("Error in CommonDbUtilsService modifyData:",a),i}})}addMetadata(e,i){try{return e&&typeof e=="object"&&!Array.isArray(e)?T(I({},e),{metadata:e?.metadata??{documentId:i?.documentId,organizationId:i?.organizationId,apiKey:i?.apiKey}}):e}catch(r){return this.loggingService.catch("Error in CommonDbUtilsService addMetadata:",r),e}}setDataInLocal(p){return Q(this,arguments,function*({feature:e,data:i,observablesCache:r,eventType:a,id:s,operation:m=null}){try{let _={comment:"allComments",reaction:"allReactions"}[e];if(!_)return null;let E=i?.metadata?.documentId,D=i?.metadata?.veltFolderId;return Object.keys(r).filter(L=>L.includes(_)&&(!E||L.includes(E)||D&&L.includes(D))).forEach(L=>{let H=r[L]?.subject?.getValue()??{};a==="DELETE"?s&&H?.data?.[s]&&(delete H?.data?.[s],r[L]?.subject&&r[L].subject.next({data:H?.data,operation:m})):r[L]?.subject?.next({data:T(I({},H?.data),{[i?.annotationId]:i}),operation:m})}),null}catch(h){return this.loggingService.catch("Error in CommonDbUtilsService setDataInLocal:",h),null}})}handleCommentEncryption(s){return Q(this,arguments,function*({data:e,firestorePath:i,extraData:r,eventType:a}){try{return yield this.commentUtilsService.handleCommentEncryption({data:e,firestorePath:i,extraData:r,eventType:a})}catch(m){return this.loggingService.catch("Error in CommonDbUtilsService handleCommentEncryption:",m),e}})}handleReactionEncryption(a){return Q(this,arguments,function*({data:e,firestorePath:i,eventType:r}){try{return yield this.reactionUtilsService.handleReactionEncryption({data:e,firestorePath:i,eventType:r})}catch(s){return this.loggingService.catch("Error in CommonDbUtilsService handleReactionEncryption:",s),e}})}};o.\u0275fac=function(i){return new(i||o)(J(ble),J(Ile),J(Jv),J(Ele),J(xle),J(TM),J(Dle),J(y),J(wle),J(DM),J(Ale),J(Ple),J(e0),J(Mle),J(kle),J(Gn),J(lt),J(xs),J(Am))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Rle=(()=>{let o=class o{constructor(e,i,r){this.configService=e,this.authService=i,this.loggingService=r,this.firestore$=new Ce(null);try{Rn([this.authService.getFirebaseConfig$(),this.configService.getApiKey$()]).pipe(Fe(([a,s])=>!!a&&!!s),tt(1)).subscribe(([a,s])=>{a&&s&&a?.firebaseOptions?.storeDbId&&this.firestore$.next(XP(qp.getFirestoreProdDbName(s,a.firebaseOptions)))},a=>{})}catch{}}getFirestore(){return this.firestore$.asObservable()}getFirestoreValue(){return this.firestore$.value}generateFirestoreDocumentId(){try{let e=this.getFirestoreValue()||XP("DocumentIdDb");if(e){let i=nb(e,"generateDocumentId");return Wv(i).id}return}catch(e){this.loggingService.catch("Error in FirestoreService generateFirestoreDocumentId: ",e);return}}};o.\u0275fac=function(i){return new(i||o)(J(jt),J(He),J(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Tn=(()=>{let o=class o{constructor(e,i,r,a,s,m,p,h,_,E){this.authService=e,this.commonDbUtilsService=i,this.loggingService=r,this.firestoreService=a,this.databaseService=s,this.configService=m,this.docService=p,this.usersService=h,this.commentAnnotationsResolverService=_,this.reactionAnnotationsResolverService=E,this.offset=0,this.db=null,this.firestore=null,this.subscriptions=[],this.offsetListener=null,this.observablesCache={},this.firestoreSubscriptions={},this.loggingService.log("%c[WB] Creating CLASS: CommonDbService","color: blue;"),this.docService.setCommonDbService(this),this.authService.setCommonDbService(this),this.subscriptions.push(this.databaseService.getDb().subscribe(D=>{if(D){this.db=D;let L=rn(D,".info/serverTimeOffset");this.offsetListener=Eu(L,H=>{let K=H.val();this.offset=K})}})),this.subscriptions.push(this.firestoreService.getFirestore().subscribe(D=>{D&&(this.firestore=D)}))}unsubscribeFromObservables(){try{Object.values(this.firestoreSubscriptions??{}).forEach(e=>{e?.unsubscribe()}),Object.entries(this.observablesCache??{}).forEach(([e,i])=>{i?.subject?.complete(),i?.subject?.unsubscribe()}),this.observablesCache={},this.firestoreSubscriptions={}}catch(e){this.loggingService.catch("Error in unsubscribeFromObservables:",e)}}ngOnDestroy(){this.subscriptions.forEach(e=>e.unsubscribe()),this.offsetListener&&this.offsetListener(),this.unsubscribeFromObservables()}getOffset(){return this.offset}getServerTimestamp(){return new Date().getTime()+this.getOffset()}subscribeToServices(e){Rn([this.databaseService.getDb(),this.firestoreService.getFirestore()]).pipe(Fe(([i,r])=>!!i),tt(1),gn(([i,r])=>{e({db:i,firestore:r})})).subscribe({error:i=>{this.loggingService.catch("Error in CommonDbService subscription: ",i)}})}performDatabaseOperation(e,i,r,a,s,m){return Q(this,null,function*(){try{if(!i){this.loggingService.warn(`%c[WB] No properties found for ${e}`,"color: red;");return}return this.subscribeToServices(_=>Q(this,[_],function*({db:p,firestore:h}){let E;i?.skipFirestore||(E=this.commonDbUtilsService.getFirestorePath({feature:e,properties:i,documentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()}));let D=this.commonDbUtilsService.getDocumentPath({feature:e,properties:i,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey(),useFirestore:this.shouldUseFirestore()});if(!p){this.loggingService.warn(`%c[WB] No database or firestore found for ${e}`,"color: red;");return}try{let L,H;try{D&&(L=rn(p,`${D}`))}catch{this.loggingService.catch("Error in dbRef")}try{E?.includes("/organizations")&&h&&E&&(H=Wv(h,`${E}`))}catch{this.loggingService.catch("Error in docRef")}yield r({dbRef:L,firestoreRef:H,data:a,firestorePath:E}),m&&m({firestoreAvailable:!!h})}catch(L){this.loggingService.catch(`Error in ${e} operation: `,L),s&&s(L)}}))}catch(p){this.loggingService.catch("Error in performDatabaseOperation:",p)}})}setData(p){return Q(this,arguments,function*({feature:e,data:i,properties:r,callback:a,errorCallback:s,extraData:m}){try{return this.loggingService.log(`%c[WB] Calling FUNCTION: setData for ${e}`,"color: green;"),this.shouldUseFirestore()&&i?.metadata&&!i?.metadata?.apiKey?void 0:(this.commonDbUtilsService.setDataInLocal({feature:e,data:i,observablesCache:this.observablesCache,operation:null}),this.performDatabaseOperation(e,r,h=>Q(this,null,function*(){if(h.dbRef){let _=this.commonDbUtilsService.formatData({feature:e,data:h.data,properties:r,offset:this.getOffset(),isRealtimeDb:!0});yield Hf(h.dbRef,JSON.parse(JSON.stringify(_)))}try{if(h.firestoreRef&&h.data&&!r?.skipFirestore){let _=this.commonDbUtilsService.formatData({feature:e,data:h.data,properties:r,offset:this.getOffset()});typeof _=="object"&&(_=JSON.parse(JSON.stringify(_)));let{strippedData:E,originalData:D,eventType:L}=this.commonDbUtilsService.handleDataStripping({feature:e,data:_,actionType:m?.actionType});if(e==="comment"){let H=null;E&&(H=yield this.commentAnnotationsResolverService.saveCommentAnnotation({commentAnnotation:E,eventType:L,commentId:m?.targetAnnotationData?.commentId})),D&&(H?.isSuccess||H===null)&&(yield this.commonDbUtilsService.handleCommentEncryption({data:D,firestorePath:h.firestorePath??"",extraData:m}))}else if(e==="reaction"){let H=null;E&&(H=yield this.reactionAnnotationsResolverService.saveReactionAnnotation(E)),D&&(H?.isSuccess||H===null)&&(yield this.commonDbUtilsService.handleReactionEncryption({data:D,firestorePath:h.firestorePath??""}))}else e==="recorder"?this.firestore&&(yield ile(this.firestore,H=>Q(this,null,function*(){H.set(h.firestoreRef,_)}))):yield sH(h.firestoreRef,_)}}catch(_){this.loggingService.catch(`Error in setData for ${e}`,_)}}),i,s,a))}catch(h){this.loggingService.catch(`Error in setData for ${e}`,h)}})}updateData(p){return Q(this,arguments,function*({feature:e,data:i,properties:r,callback:a,errorCallback:s,extraData:m}){try{return this.loggingService.log(`%c[WB] Calling FUNCTION: updateData for ${e}`,"color: green;"),this.shouldUseFirestore()&&i?.metadata&&!i?.metadata?.apiKey?void 0:(this.commonDbUtilsService.setDataInLocal({feature:e,data:i,observablesCache:this.observablesCache,operation:null}),this.performDatabaseOperation(e,r,h=>Q(this,null,function*(){if(h.dbRef&&!r?.skipRtdb){let _=this.commonDbUtilsService.formatData({feature:e,data:h.data,properties:r,offset:this.getOffset(),isRealtimeDb:!0});yield V5(h.dbRef,JSON.parse(JSON.stringify(_)))}try{if(h.firestoreRef&&h.data&&!r?.skipFirestore){let _=this.commonDbUtilsService.formatData({feature:e,data:h.data,properties:r,offset:this.getOffset()});typeof _=="object"&&(_=JSON.parse(JSON.stringify(_)));let{strippedData:E,originalData:D,eventType:L}=this.commonDbUtilsService.handleDataStripping({feature:e,data:_,actionType:m?.actionType});if(e==="comment"){let H=null;E&&(H=yield this.commentAnnotationsResolverService.saveCommentAnnotation({commentAnnotation:E,eventType:L,commentId:m?.targetAnnotationData?.commentId})),D&&(H?.isSuccess||H===null)&&(yield this.commonDbUtilsService.handleCommentEncryption({data:D,firestorePath:h.firestorePath??"",extraData:m}))}else if(e==="reaction"){let H=null;E&&(H=yield this.reactionAnnotationsResolverService.saveReactionAnnotation(E)),D&&(H?.isSuccess||H===null)&&(yield this.commonDbUtilsService.handleReactionEncryption({data:D,firestorePath:h.firestorePath??""}))}else yield sH(h.firestoreRef,_,{merge:!0})}}catch(_){this.loggingService.catch(`Error in updateDoc for ${e}`,_)}}),i,s,a))}catch(h){this.loggingService.catch(`Error in updateData for ${e}`,h)}})}deleteData(s){return Q(this,arguments,function*({feature:e,properties:i,callback:r,errorCallback:a}){try{return this.loggingService.log(`%c[WB] Calling FUNCTION: deleteData for ${e}`,"color: green;"),this.commonDbUtilsService.setDataInLocal({feature:e,observablesCache:this.observablesCache,eventType:"DELETE",id:i?.id,operation:{type:"removed",ids:[i?.id]}}),this.performDatabaseOperation(e,i,m=>Q(this,null,function*(){m.dbRef&&(yield L5(m.dbRef));try{if(m.firestoreRef&&!i?.skipFirestore)if(e==="comment"){let p=null;p=yield this.commentAnnotationsResolverService.deleteCommentAnnotation(i?.id??""),(p?.isSuccess||p===null)&&(yield this.commonDbUtilsService.handleCommentEncryption({firestorePath:m.firestorePath??"",eventType:"DELETE"}))}else if(e==="reaction"){let p=null;p=yield this.reactionAnnotationsResolverService.deleteReactionAnnotation(i?.id??""),(p?.isSuccess||p===null)&&(yield this.commonDbUtilsService.handleReactionEncryption({firestorePath:m.firestorePath??"",eventType:"DELETE"}))}else yield Qse(m.firestoreRef)}catch(p){this.loggingService.catch(`Error in deleteData for ${e}`,p)}}),void 0,a,r)}catch(m){this.loggingService.catch(`Error in deleteData for ${e}`,m)}})}shouldUseFirestore(){try{return this.authService.getAdvancedQueriesEnabled()}catch(e){return this.loggingService.catch("Error in shouldUseFirestore:",e),!1}}generateDocumentId(){try{let e=this.firestoreService.generateFirestoreDocumentId();return e||(e=Pn()),e||"noDocumentId"}catch(e){return this.loggingService.catch("Error in generateFirestoreDocumentId:",e),Pn()||"noDocumentId"}}queryData(r){return Q(this,arguments,function*({feature:e,properties:i}){try{let a=this.shouldUseFirestore();return!e||!i?(this.loggingService.warn("[WB] Missing required parameters in queryData"),[]):a?yield this.handleFirestoreQuery(e,i):yield this.handleRtdbQuery(e,i)}catch(a){return this.loggingService.catch(`Error in queryData for ${e}`,a),[]}})}handleFirestoreQuery(e,i){return Q(this,null,function*(){try{if(!this.firestore)return this.loggingService.warn("[WB] Firestore not initialized"),[];let r=i?.useCollectionGroup?this.commonDbUtilsService.getFirestoreCollectionGroupPath(e):this.commonDbUtilsService.getFirestorePath({feature:e,properties:i,documentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()});if(!r)return this.loggingService.warn(`[WB] No firestore path found for ${e}`),[];try{let a=nb(this.firestore,r);i?.useCollectionGroup&&(a=oH(this.firestore,r));let s=i?.firestoreQuery??[],m=aH(a,...s);if(i?.getCount){let p=yield ele(m).catch(h=>(this.loggingService.catch(`Error in getCountFromServer for ${e}`,h),null));return p?p.data().count:0}else{let p=yield nle(m).catch(E=>(this.loggingService.catch(`Error in getDocs for ${e}`,E),null));if(!p)return[];let h=p.docs.map(E=>E.data());return yield this.commonDbUtilsService.modifyData({feature:e,data:h})}}catch(a){return this.loggingService.catch(`Error in Firestore query for ${e}:`,a),[]}}catch(r){return this.loggingService.catch(`Error in Firestore query for ${e}:`,r),[]}})}handleRtdbQuery(e,i){return Q(this,null,function*(){if(!this.db)return this.loggingService.warn("[WB] Realtime Database not initialized"),[];let r=this.commonDbUtilsService.getDocumentPath({feature:e,properties:i,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()});if(!r)return this.loggingService.warn(`[WB] No database path found for ${e}`),[];try{let a=rn(this.db,r),s=i?.rtdbQuery??[],m=OB(a,...s),p=yield TB(m).catch(_=>(this.loggingService.catch(`Error in get for ${e}`,_),null));if(!p)return[];let h=p.val();return h?i?.skipObjectValues?h:Object.values(h??{}):[]}catch(a){return this.loggingService.catch(`Error in RTDB query for ${e}:`,a),[]}})}getData(r){return Q(this,arguments,function*({feature:e,properties:i}){try{let a=this.shouldUseFirestore();if(i?.skipFirestore&&(a=!1),!e||!i)return this.loggingService.warn("[WB] Missing required parameters in getData"),{};if(a&&this.firestore){let s=this.commonDbUtilsService.getFirestorePath({feature:e,properties:i,documentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()});if(!s)return this.loggingService.warn(`[WB] No firestore path found for ${e}`),{};try{let m=yield tle(Wv(this.firestore,s)).catch(h=>(this.loggingService.catch(`Error in getDoc for ${e}`,h),null));if(!m)return this.loggingService.warn(`[WB] No document found at ${s}`),{};let p=m.data();return i?.field?p?.[i.field]??{}:p??{}}catch(m){return this.loggingService.catch(`Error fetching Firestore data for ${e}:`,m),{}}}if(this.db){let s=this.commonDbUtilsService.getDocumentPath({feature:e,properties:i,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()});if(!s)return this.loggingService.warn(`[WB] No database path found for ${e}`),{};try{let m=yield TB(rn(this.db,s)).catch(h=>(this.loggingService.catch(`Error in get for ${e}`,h),null));if(!m)return this.loggingService.warn(`[WB] No data found at ${s}`),{};let p=m.val();return i?.field?p?.[i.field]??{}:p??{}}catch(m){return this.loggingService.catch(`Error fetching RTDB data for ${e}:`,m),{}}}return this.loggingService.warn("[WB] No database connection available"),{}}catch(a){return this.loggingService.catch("Unexpected error in getData:",a),{}}})}dbListener({feature:e,properties:i}){let r=this.shouldUseFirestore();i?.skipFirestore&&(r=!1);let a=`${e}-${JSON.stringify(i)}`;return Rn([this.databaseService.getDb(),this.firestoreService.getFirestore()]).pipe(Fe(([s,m])=>s?r&&!m?(this.loggingService.warn(`[WB] Firestore requested but not available for ${e}`),!1):!0:(this.loggingService.warn(`[WB] No database found for ${e}`),!1)),he(([s,m])=>{try{if(r&&m){if(!!!this.observablesCache[a]){this.observablesCache[a]={subject:new Ce({}),count:0};let _=this.handleFirestoreListener(e,i,m).subscribe(E=>{this.observablesCache[a]?.subject?.next(E)},E=>this.observablesCache[a]?.subject?.error(E));this.firestoreSubscriptions[a]=_}return new Lt(h=>{let _=this.observablesCache[a]?.subject?.subscribe(E=>h.next(E),E=>h.error(E),()=>h.complete());return this.observablesCache[a].count+=1,()=>{_?.unsubscribe(),this.observablesCache[a]&&(this.observablesCache[a].count-=1,this.observablesCache[a].count<=0&&(this.firestoreSubscriptions[a]?.unsubscribe(),delete this.firestoreSubscriptions[a],this.observablesCache[a]?.subject?.complete(),delete this.observablesCache[a]))}})}else if(s)return this.handleRealtimeDbListener(e,i,s);return se({})}catch(p){return this.loggingService.catch(`Error setting up listener for ${e}:`,p),se({})}}),Ng(()=>{this.loggingService.log(`[WB] Cleaning up listener for ${e} and key ${a}`)}))}handleFirestoreListener(e,i,r){let a=i?.useCollectionGroup?this.commonDbUtilsService.getFirestoreCollectionGroupPath(e):this.commonDbUtilsService.getFirestorePath({feature:e,properties:i,documentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()}),s=`${e}-${JSON.stringify(i)}`;return a?new Lt(m=>{let p=i.isCollection?this.setupCollectionListener(r,a,e,m,i):this.setupDocumentListener(r,a,e,m,i);return()=>{m.complete(),m.unsubscribe(),p(),this.observablesCache[s]?.subject?.complete(),this.observablesCache[s]?.subject?.unsubscribe(),delete this.observablesCache[s]}}).pipe(he(m=>this.commonDbUtilsService.mergeUsersWithData$({feature:e,data:m})),he(m=>["allComments","allUserNotifications"].includes(e)?this.commonDbUtilsService.mergeCommentAnnotationsWithData$({data:m,feature:e}):se(m)),he(m=>["allReactions"].includes(e)?this.commonDbUtilsService.mergeReactionAnnotationsWithData$({data:m,feature:e}):se(m)),qt(Vi)):(this.loggingService.warn(`[WB] No firestore path found for ${e} and key ${s}`),se({}))}setupCollectionListener(e,i,r,a,s){let m=`${r}-${JSON.stringify(s)}`,p=nb(e,i);if(s?.useCollectionGroup&&(p=oH(e,i)),s?.useQuery&&s?.firestoreQuery){let E=s?.firestoreQuery??[];p=aH(p,...E)}let h=!0,_=[];return rH(p,E=>{try{let D=JSON.parse(JSON.stringify(this.observablesCache[m]?.subject?.getValue()?.data??{})),L=null,H=!1;E?.docChanges()?.length?E.docChanges().forEach(K=>{["allComments","allReactions"].includes(r)&&!h&&K.type!=="removed"&&_.push(K.doc.id),this.commonDbUtilsService.isDataAlreadyProcessedInLocalCache({feature:r,change:K,cache:this.observablesCache[m]?.subject?.getValue()?.data??{}})||(H=!0,Object.assign(D,this.handleCollectionChange(K,D)),K.type==="removed"&&(L||(L={type:K.type,ids:[]}),L.ids.push(K.doc.id)))}):H=!0,H&&(["allComments","allReactions"].includes(r)&&_?.length&&(this.commonDbUtilsService.resolveAnnotations({data:_,feature:r}),_=[]),this.commonDbUtilsService.modifyAndSetData({feature:r,data:D,subscriber:a,operation:L})),h=!1}catch(D){this.handleListenerError(D,r,a)}},E=>this.handleListenerError(E,r,a))}handleCollectionChange(e,i){switch(e.type){case"added":case"modified":i[e.doc.id]=e.doc.data();break;case"removed":delete i?.[e.doc.id];break}return i}setupDocumentListener(e,i,r,a,s){let m=Wv(e,i);return rH(m,p=>{try{let h=p.data()||{};s?.field&&(h=h?.[s?.field]??{}),this.commonDbUtilsService.modifyAndSetData({feature:r,data:h,subscriber:a,operation:null})}catch(h){this.handleListenerError(h,r,a)}},p=>this.handleListenerError(p,r,a))}handleListenerError(e,i,r){this.loggingService.catch(`Firestore listener error for ${i}:`,e),r.error(e)}handleRealtimeDbListener(e,i,r){let a=this.commonDbUtilsService.getDocumentPath({feature:e,properties:i,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()});if(!a)return this.loggingService.warn(`[WB] No database path found for ${e}`),se({});let s=rn(r,a);if(i?.useQuery&&i?.rtdbQuery){let m=i?.rtdbQuery??[];s=OB(s,...m)}return $f(s).pipe(jn(m=>(this.loggingService.catch(`RTDB listener error for ${e}:`,m),se({}))),ce(m=>(m===null&&(m={}),m&&typeof m=="object"?Object.entries(m??{}).reduce((h,[_,E])=>(h[_]=this.commonDbUtilsService.addMetadata(E,i),h),{}):this.commonDbUtilsService.addMetadata(m,i))),he(m=>this.commonDbUtilsService.modifyData({feature:e,data:m})),he(m=>this.usersService.getUserById$().pipe(ce(()=>({data:this.commonDbUtilsService.mergeUsersWithData({feature:e,data:m}),operation:null})))))}};o.\u0275fac=function(i){return new(i||o)(J(He),J(t0),J(y),J(Rle),J(hn),J(jt),J(lt),J(Gn),J(xs),J(Am))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Ci=(()=>{let o=class o{constructor(e,i,r,a,s,m,p,h){this.analyticsService=e,this.authService=i,this.configService=r,this.databaseService=a,this.docService=s,this.loggingService=m,this.commonDbService=p,this.usersService=h,this.db=Ii(),this.internalUserContacts$=new Ce([]),this.userGlobalContact$=new Ce(!1),this.userGroupContact$=new Ce(null),this.users$=new Ce([]),this.userPersonalContacts=[],this.userGroupContacts=[],this.userGlobalContacts=[],this.users=[],this.documentPaths=null,this.userOrganizationContacts$=new Ce([]),this.userFolderContacts$=new Ce([]),this.userDocumentContacts$=new Ce([]),this.userOrganizationGroups$=new Ce([]),this.onContactSelectedSubject$=new Ke,this.documentAccessType=null,this.atHereEnabled$=new Ce(!1),this.atHereLabel$=new Ce("here"),this.atHereDescription$=new Ce(null),this.contactListScopeForOrganizationUsers$=new Ce([ki.ALL]),this.customUserContacts$=new Ce(null),this.customUserContactsConfig$=new Ce({merge:!1}),this.currentOrganizationUserIAM$=new Ce(null),this.userContacts$=new Ce([]),this.userSnippylyIdContacts$=new Ce(null),this.usersByOrganizationId$=new Ce({}),this.usersByOrganizationIdAndDocumentId$=new Ce({}),this.usersByOrganizationIdAndFolderId$=new Ce({}),this.userById$=new Ce({}),this.authService.setContactService(this),this.authService.getUser$().pipe(he(_=>this.docService.getDocumentPaths$().pipe(gn(E=>{this.documentPaths=E}),ce(()=>_)))).subscribe(_=>Q(this,null,function*(){this.user=_,_&&this.documentPaths?_?.organizationId?(this.getOrganizationContactsFromDb$(),this.getFolderContactsFromDb$(),this.getDocumentContactsFromDb$(),this.getOrganizationGroupsFromDb$()):(this.getLoggedInUsers$().subscribe(),this.getUserContactsFromDb$(),yield this.migrateLoggedInUserFromEmailToUserIdPath(_),this.setLoggedInUser(_),yield this.moveGlobalContactUserFromEmailToUserIdPath(_),this.updateUserInGlobalContactsIfAvailable(_),_?.groupId&&(yield this.migrateGroupContactsFromEmailToUserIdPath(_?.groupId)),this.checkToSetLoggedInUserInGroupContacts()):(this.getUserContactSubscription?.unsubscribe(),this.getUserContactSubscription=void 0,this.getLoggedInUsersSubscription?.unsubscribe(),this.getLoggedInUsersSubscription=void 0,this.getOrganizationContactsSubscription?.unsubscribe(),this.getOrganizationContactsSubscription=void 0,this.getFolderContactsSubscription?.unsubscribe(),this.getFolderContactsSubscription=void 0,this.getDocumentContactsSubscription?.unsubscribe(),this.getDocumentContactsSubscription=void 0,this.getOrganizationGroupsSubscription?.unsubscribe(),this.getOrganizationGroupsSubscription=void 0)}),_=>{this.loggingService.catch("Error in ContactService constructor getUser$: ",_)}),this.databaseService.getDb().pipe(Fe(_=>!!_),tt(1)).subscribe(_=>{_&&(this.db=_)},_=>{this.loggingService.catch("Error in ContactService constructor getDb: ",_)}),this.getOrganizationGroups$().subscribe(_=>{this.authService.setOrganizationUserGroups(_)}),Rn([this.getInternalUserContacts$(),this.getCustomUserContacts$(),this.getCustomUserContactsConfig$()]).subscribe(([_,E,D])=>{E?D?.merge?this.userContacts$.next([..._||[],...E||[]]):this.userContacts$.next(E||[]):this.userContacts$.next(_||[])}),this.getUserContacts$().subscribe(_=>{try{_?.forEach(E=>{let D=E?.userSnippylyId||ym(this.configService.getApiKey(),E.userId);D&&this.userSnippylyIdContacts$.next(T(I({},this.userSnippylyIdContacts$.value),{[D]:E}))})}catch{}})}clearCache(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCache in ContactService","color: green;");try{this.documentPaths=null,this.usersByOrganizationId$.next({}),this.usersByOrganizationIdAndFolderId$.next({}),this.usersByOrganizationIdAndDocumentId$.next({}),this.userById$.next({}),this.userOrganizationContacts$.next([]),this.userFolderContacts$.next([]),this.userDocumentContacts$.next([]),this.userOrganizationGroups$.next([]),this.userContacts$.next([]),this.userSnippylyIdContacts$.next(null),this.userGlobalContact$.next(!1),this.userGroupContact$.next(null),this.users$.next([]),this.userPersonalContacts=[],this.userGroupContacts=[],this.userGlobalContacts=[],this.users=[]}catch(e){this.loggingService.catch("Error in ContactService clearCache: ",e)}}setDocumentAccessType(e){try{this.documentAccessType=e}catch(i){this.loggingService.catch("Error in ContactService setDocumentAccessType: ",i)}}checkIfUserGlobalContact(e){return Q(this,null,function*(){try{if(e?.userId&&this.documentPaths?.globalContacts){let i=yield this.commonDbService?.getData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Pt(e?.userId),skipFirestore:!0}});if(Object.keys(i??{}).length>0)return!0}if(e?.email&&this.documentPaths?.globalContacts){let i=yield this.commonDbService?.getData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Pt(e?.email),skipFirestore:!0}});if(Object.keys(i??{}).length>0)return!0}return!1}catch(i){return this.loggingService.catch("Error in ContactService isUserGlobalContact: ",i),!1}})}setLoggedInUser(e){try{e?.userId&&this.documentPaths?.logins&&(this.commonDbService.updateData({feature:"logins",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Pt(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(T(I({},e),{contacts:void 0})))}),this.setLoggedInUserPrivateContacts(e,e?.contacts))}catch(i){this.loggingService.catch("Error in ContactService setLoggedInUser: ",i)}}migrateLoggedInUserFromEmailToUserIdPath(e){return Q(this,null,function*(){try{if(e?.email&&this.documentPaths?.logins){let i=yield this.commonDbService?.getData({feature:"logins",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Pt(e?.email),skipFirestore:!0}});if(Object.keys(i??{}).length>0){let r=i;if(r){if(r?.contacts){let a={};Object.keys(r?.contacts??{})?.forEach(s=>{let m=r.contacts[s];if(m?.userId){let p=Pt(m?.userId);a[p]=m}}),r.contacts=a}yield this.commonDbService.updateData({feature:"logins",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Pt(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(r))}),yield this.commonDbService.deleteData({feature:"logins",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Pt(e?.email),skipFirestore:!0}})}}}}catch(i){this.loggingService.catch("Error in ContactService migrateLoggedInUserFromEmailToUserIdPath: ",i)}})}addGlobalContact(e){try{e?.userId&&this.documentPaths?.globalContacts&&this.commonDbService.updateData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Pt(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(e))})}catch(i){this.loggingService.catch("Error in ContactService addGlobalContact: ",i)}}updateUserInGlobalContactsIfAvailable(e){return Q(this,null,function*(){try{if(e?.userId&&this.documentPaths?.globalContacts&&(yield this.checkIfUserGlobalContact(e))){let r=new wo;r.userId=e?.userId,r.userSnippylyId=e?.userSnippylyId,r.email=e?.email,r.name=e?.name,r.photoUrl=e?.photoUrl,this.commonDbService.updateData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Pt(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(r))})}}catch(i){this.loggingService.catch("Error in ContactService updateUserInGlobalContactsIfAvailable: ",i)}})}moveGlobalContactUserFromEmailToUserIdPath(e){return Q(this,null,function*(){try{if(e?.email&&e?.userId&&this.documentPaths?.globalContacts){let i=yield this.commonDbService?.getData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Pt(e?.email),skipFirestore:!0}});if(Object.keys(i??{}).length>0){let r=i;r&&(yield this.commonDbService.updateData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Pt(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(r))}),yield this.commonDbService.deleteData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Pt(e?.email),skipFirestore:!0}}))}}}catch(i){this.loggingService.catch("Error in ContactService removeUserFromGlobalContactsByEmail: ",i)}})}setLoggedInUserPrivateContacts(e,i){try{if(e?.userId&&this.documentPaths?.logins){let r,a=i?.filter(m=>m?.visibility!=="group"),s=!1;this.authService.getUserOptions()&&(s=!!this.authService.getUserOptions()?.replaceContacts||!!this.authService.getUserOptions()?.replacePrivateContacts),a?.length?(r={},a?.forEach(m=>{if(m?.userId){let p=Pt(m?.userId);r[p]=m}}),s?this.commonDbService.setData({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Pt(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(r))}):this.commonDbService.updateData({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Pt(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(r))})):s&&this.commonDbService.deleteData({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Pt(e?.userId),skipFirestore:!0}})}}catch(r){this.loggingService.catch("Error in ContactService setLoggedInUserPrivateContacts: ",r)}}migrateGroupContactsFromEmailToUserIdPath(e){return Q(this,null,function*(){try{if(this.documentPaths?.groupContacts&&e){let i=yield this.commonDbService?.getData({feature:"groupContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,skipFirestore:!0}});i&&Object.keys(i??{}).forEach(r=>Q(this,null,function*(){let a=i[r];a?.email&&a?.userId&&Pt(a?.email)===r&&(yield this.commonDbService.deleteData({feature:"groupContactsUser",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,userId:r,skipFirestore:!0}}),yield this.commonDbService.updateData({feature:"groupContactsUser",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,userId:Pt(a?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(a))}))}))}}catch(i){this.loggingService.catch("Error in ContactService migrateGroupContacts: ",i)}})}checkToSetLoggedInUserInGroupContacts(){return Q(this,null,function*(){try{this.user?.groupId&&this.user?.userId&&((yield this.checkIfUserGlobalContact(this.user))||this.docService.getDocumentIam$().pipe(tt(1)).subscribe(i=>Q(this,null,function*(){if(this.user?.groupId&&this.user?.userId){let r=!1,a=this.docService.getDocumentAccessType(i);if(!a||a===pi.PUBLIC)r=!0;else if(a===pi.RESTRICTED){let s=Pt(this.user?.userId);if(i?.users?.[s]&&(r=!0),this.user?.email){let m=Pt(this.user?.email);i?.users?.[m]&&(r=!0)}}if(r){let s=new Wp;s.email=this.user.email,s.visibility="group",s.name=this.user.name,s.photoUrl=this.user.photoUrl,s.userId=this.user.userId,(this.authService.getUserOptions()?.replaceContacts||this.authService.getUserOptions()?.replaceGroupContacts)&&(yield this.removeGroupContacts(this.user?.groupId)),this.setLoggedInUserGroupContacts(this.user?.groupId,[s]),this.user?.contacts&&this.user?.groupId&&this.setLoggedInUserGroupContacts(this.user?.groupId,this.user?.contacts)}}})))}catch(e){this.loggingService.catch("Error in ContactService checkToSetLoggedInUserInGroupContacts: ",e)}})}setLoggedInUserGroupContacts(e,i){try{let r=i?.filter(a=>a?.visibility==="group");r?.length&&r.forEach(a=>Q(this,null,function*(){if(a?.userId&&e&&this.documentPaths?.groupContacts){if(this.configService?.getSF()&&(yield this.checkIfUserGlobalContact(a)))return;yield this.commonDbService.updateData({feature:"groupContactsUser",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,userId:Pt(a?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(a))}),a?.email&&(yield this.commonDbService.deleteData({feature:"groupContactsUser",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,userId:Pt(a?.email),skipFirestore:!0}}))}}))}catch(r){this.loggingService.catch("Error in ContactService setLoggedInUserGroupContacts: ",r)}}removeGroupContacts(e){return Q(this,null,function*(){try{if(this.documentPaths?.groupContacts&&e)return this.commonDbService.deleteData({feature:"groupContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,skipFirestore:!0}})}catch(i){this.loggingService.catch("Error in ContactService removeGroupContacts: ",i)}})}mergeUserContacts(){try{let e=[];this.userPersonalContacts&&e.push(...this.userPersonalContacts),this.userGroupContacts&&e.push(...this.userGroupContacts),this.userGlobalContacts&&e.push(...this.userGlobalContacts);let i={};e.forEach(r=>{r?.userId?(!r?.email||!i[r.email])&&(i[r.userId]=r):r?.email&&(!r?.userId||!i[r.userId])&&(i[r.email]=r)}),e=Object.values(i??{}),this.internalUserContacts$.next(e)}catch(e){this.loggingService.catch("Error in ContactService mergeUserContacts: ",e)}}getInternalUserContacts(){return this.internalUserContacts$.value}getInternalUserContacts$(){return this.internalUserContacts$.asObservable()}getUserContacts$(e){try{let{organizationId:i,documentId:r,veltFolderId:a}=e||{};return i&&r?Rn([this.usersByOrganizationId$,this.usersByOrganizationIdAndFolderId$,this.usersByOrganizationIdAndDocumentId$,this.userById$,this.customUserContacts$,this.customUserContactsConfig$,this.getContactListScopeForOrganizationUsers$()]).pipe(ce(([s,m,p,h,_,E,D])=>{let L={},H=!1;E&&!E?.merge&&(H=!0);let K=qe=>D.some(Re=>qe.includes(Re)),oe=K([ki.ALL,ki.ORGANIZATION])?Object.keys(s?.[i]||{}):[],ue=a?K([ki.ALL,ki.FOLDER])?Object.keys(m?.[i]?.[a]||{}):[]:[],be=K([ki.ALL,ki.DOCUMENT])?Object.keys(p?.[i]?.[r]||{}):[];if([...oe,...ue||[],...be].forEach(qe=>{let Re=h?.[qe];Re&&(L[qe]=Re)}),_){let{merge:qe,options:Re}=E||{},{organizationId:_e,documentId:Ee,folderId:Oe}=Re||{},ye=Oe?Tl(Oe):void 0;(!_e||_e===i)&&(!Ee||Ee===r)&&(!ye||ye===a)&&(qe||(L={}),_.forEach(fe=>{fe?.userId&&(L[fe.userId]=fe)}))}return Object.values(L??{})})):this.userContacts$.asObservable().pipe(ce(s=>s))}catch(i){return this.loggingService.catch("Error in ContactService getUserContacts$ metadata: ",i),se([])}}getUserContactsBySnippylyId$(){return this.userSnippylyIdContacts$.asObservable()}getAtHereLabel(){return this.atHereLabel$.asObservable()}getAtHereDescription(){return this.atHereDescription$.asObservable()}getUserContactsFromDb$(){this.getUserContactSubscription||(this.getUserContactSubscription=this.authService.getUser$().pipe(Fe(e=>!!e),he(e=>this.docService.getDocumentPaths$().pipe(Fe(i=>!!i),gn(i=>{this.documentPaths=i}),ce(()=>e))),he(e=>{if(this.userGroupContacts=[],this.userPersonalContacts=[],!e)return se();if(!this.documentPaths)return se();let i=[];return i.push(this.commonDbService.dbListener({feature:"allGlobalContacts",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(ce(r=>r?.data),gn(r=>{r?(this.userGlobalContacts=Object.values(r??{}),this.userGlobalContacts?.find(a=>a.userId===this.user?.userId)?this.userGlobalContact$.next(!0):this.userGlobalContact$.next(!1)):(this.userGlobalContacts=[],this.userGlobalContact$.next(!1))}))),i.push(this.commonDbService.dbListener({feature:"groupContacts",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0,groupId:e?.groupId}}).pipe(ce(r=>r?.data),gn(r=>{r?(this.userGroupContacts=Object.values(r??{}),this.userGroupContacts?.find(a=>a?.userId===this.user?.userId)?this.userGroupContact$.next(!0):this.userGroupContact$.next(!1)):(this.userGroupContacts=[],this.userGroupContact$.next(!1))}))),i.push(this.commonDbService.dbListener({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0,userId:Pt(e?.userId)}}).pipe(ce(r=>r?.data),gn(r=>{r?this.userPersonalContacts=Object.values(r??{}):this.userPersonalContacts=[]}))),ro(...i).pipe(ao(this.authService.getUser$().pipe(Fe(r=>!r))))})).subscribe(()=>{this.mergeUserContacts()},e=>{this.loggingService.catch("Error in ContactService getUserContacts$ subscription: ",e)}))}addUserContact(e){try{this.user?.organizationId||this.user?.groupId&&(e.visibility="group",this.setLoggedInUserGroupContacts(this.user?.groupId,[e]))}catch(i){this.loggingService.catch("Error in ContactService addUserContact: ",i)}}isUserGlobalContact$(){return this.userGlobalContact$.asObservable()}isUserGlobalContact(){return this.userGlobalContact$.value}isUserGroupContact$(){return this.userGroupContact$.asObservable()}isUserGroupContact(){return this.userGroupContact$.value}getLoggedInUsers$(){return this.getLoggedInUsersSubscription||(this.getLoggedInUsersSubscription=this.authService.getUser$().pipe(he(e=>e?this.documentPaths?e?.userId&&this.documentPaths?.logins?this.commonDbService.dbListener({feature:"allLogins",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(ce(i=>i?.data),gn(i=>{i?this.users=Object.values(i??{}):this.users=[]})):(this.users=[],se()):se():se())).subscribe(()=>{this.users$.next(this.users)},e=>{this.loggingService.catch("Error in ContactService getLoggedInUsers$ subscription: ",e)})),this.users$.asObservable()}getUsersMap$(){return this.authService.getUser$().pipe(he(e=>e?.organizationId?this.userById$.pipe(ce(i=>{let r={};return Object.values(i||{}).forEach(a=>{a?.userSnippylyId&&(r[a?.userSnippylyId]=a)}),r})):this.users$.pipe(ce(i=>{let r={};return i.forEach(a=>{r[a.userSnippylyId]=a}),r}))))}getUserByEmail$(e){return this.users$.pipe(ce(i=>i.find(r=>r.email===e)))}getUserByEmail(e){return this.users?.find(i=>i.email===e)}getContactByEmail(e){return this.getInternalUserContacts().find(i=>i.email===e)}getUserByUserId$(e){return this.users$.pipe(ce(i=>i.find(r=>r.userId===e)))}getUserGroupContacts(){return this.userGroupContacts}getOrganizationContactsFromDb$(){try{this.getOrganizationContactsSubscription||(this.getOrganizationContactsSubscription=this.authService.getUser$().pipe(he(e=>e?.organizationId?se(e).pipe(he(i=>this.docService.getOrganizationConfig$().pipe(Fe(r=>!!r),ce(()=>i))),he(i=>{let r=this.docService.getOrganizationConfig()?.organizationId;return this.setUserOrganizationContacts([],r),i?r?this.commonDbService.dbListener({feature:"allOrganizationUsers",properties:{organizationId:r,isCollection:!0}}).pipe(ce(a=>a?.data),ce(a=>{if(a){typeof a=="object"&&(a?.undefined&&delete a.undefined,a?.null&&delete a.null);let s=Object.values(a??{});this.setUserOrganizationContacts(s,r)}else this.setUserOrganizationContacts([],r)})):se():se()}),he(()=>this.getContactListScopeForOrganizationUsers$())):(this.setUserOrganizationContacts([]),se()))).subscribe(()=>{this.mergeOrganizationAndDocumentContacts()},e=>{this.loggingService.catch("Error in ContactService getOrganizationContactsFromDb$ subscription: ",e)}))}catch{}}getFolderContactsFromDb$(){try{this.getFolderContactsSubscription||(this.getFolderContactsSubscription=this.authService.getUser$().pipe(he(e=>e?se(e).pipe(he(i=>this.docService.getOrganizationConfig$().pipe(Fe(r=>!!r),ce(()=>i))),he(i=>{let r=this.docService.getOrganizationConfig()?.organizationId;if(this.setUserFolderContacts([]),!i)return se();if(!this.commonDbService.shouldUseFirestore())return se();if(!this.documentPaths?.veltFolderId)return se();let a=se([]);return a=this.commonDbService.dbListener({feature:"allFolderUsers",properties:{organizationId:r,folderId:this.documentPaths?.veltFolderId,isCollection:!0}}).pipe(ce(s=>s?.data)),a.pipe(ce(s=>{if(s){typeof s=="object"&&(s?.undefined&&delete s.undefined,s?.null&&delete s.null);let m=Object.values(s??{});this.setUserFolderContacts(m)}else this.setUserFolderContacts([])}))}),he(()=>this.getContactListScopeForOrganizationUsers$())):(this.setUserFolderContacts([]),se()))).subscribe(()=>{this.mergeOrganizationAndDocumentContacts()},e=>{this.loggingService.catch("Error in ContactService getFolderContactsFromDb$ subscription: ",e)}))}catch{}}getDocumentContactsFromDb$(){try{this.getDocumentContactsSubscription||(this.getDocumentContactsSubscription=this.authService.getUser$().pipe(he(e=>e?se(e).pipe(he(i=>this.docService.getDocumentPaths$().pipe(Fe(r=>!!r),gn(r=>{this.documentPaths=r}),ce(()=>i))),he(i=>(this.setUserDocumentContacts([]),i?this.documentPaths?this.docService.getDocumentIds$().pipe(he(r=>{let a=r?.length>0?r.map(p=>p.documentId):[this.documentPaths?.documentId??""];if(a.some(p=>!p)||!this.documentPaths)return se();let s=se([]),m={useCollectionGroup:!0,isCollection:!0,useQuery:!0};if(this.commonDbService.shouldUseFirestore()||(m.documentId=a?.length?a[0]:void 0,m.organizationId=this.documentPaths?.organizationId),this.documentPaths?.veltFolderId&&this.documentPaths?.allDocuments)s=this.commonDbService.dbListener({feature:"allDocumentUsers",properties:T(I({},m),{firestoreQuery:[Ui(gt("metadata.apiKey","==",this.configService?.getApiKey()),gt("metadata.veltFolderId","==",this.documentPaths?.veltFolderId),gt("metadata.organizationId","==",this.documentPaths?.organizationId))]})}).pipe(ce(p=>p?.data));else{let p=[];for(let h=0;h<a.length;h+=j.LISTENER_BATCH_SIZE)p.push(a.slice(h,h+j.LISTENER_BATCH_SIZE));s=Rn(p.map(h=>this.commonDbService.dbListener({feature:"allDocumentUsers",properties:T(I({},m),{firestoreQuery:[Ui(gt("metadata.apiKey","==",this.configService?.getApiKey()),gt("metadata.documentId","in",h),gt("metadata.organizationId","==",this.documentPaths?.organizationId),...this.documentPaths?.veltFolderId?[gt("metadata.veltFolderId","==",this.documentPaths?.veltFolderId)]:[])]})}).pipe(Gr()))).pipe(ce(h=>ua(h)?.data))}return s.pipe(ce(p=>{if(p){typeof p=="object"&&(p?.undefined&&delete p.undefined,p?.null&&delete p.null);let h=Object.values(p??{});this.setUserDocumentContacts(h)}else this.setUserDocumentContacts([])}))})):se():se())),he(()=>this.getContactListScopeForOrganizationUsers$())):(this.setUserDocumentContacts([]),se()))).subscribe(()=>{this.mergeOrganizationAndDocumentContacts()},e=>{this.loggingService.catch("Error in ContactService getDocumentContactsFromDb$ subscription: ",e)}))}catch{}}setUserOrganizationContacts(e,i){try{let r=e.find(s=>s.user.userId===this.user?.userId);r?this.currentOrganizationUserIAM$.next(r):this.currentOrganizationUserIAM$.next(null);let a=e.map(s=>s.user);if(this.userOrganizationContacts$.next(a),i){let s={};s[i]={},e.forEach(m=>{s[i][m.user.userId]=m,this.userById$.next(T(I({},this.userById$.value),{[m.user.userId]:m.user}))}),this.usersByOrganizationId$.next(T(I({},this.usersByOrganizationId$.value),{[i]:s[i]}))}else this.usersByOrganizationId$.next({})}catch(r){this.loggingService.catch("Error in ContactService setUserOrganizationContacts: ",r)}}getUserOrganizationContacts$(){return this.getContactListScopeForOrganizationUsers$().pipe(he(()=>this.checkContactListScopeForOrganizationUsers([ki.ALL,ki.ORGANIZATION])?this.userOrganizationContacts$.asObservable():se([])))}getUserOrganizationContacts(){return this.checkContactListScopeForOrganizationUsers([ki.ALL,ki.ORGANIZATION])?this.userOrganizationContacts$.value:[]}setUserFolderContacts(e){try{this.userFolderContacts$.next(e?.map(r=>r?.user));let i={};e?.forEach(r=>{let{organizationId:a,veltFolderId:s}=r?.metadata||{};a&&s&&(i[a]||(i[a]={}),i[a][s]||(i[a][s]={}),i[a][s][r.user.userId]=r,this.userById$.next(T(I({},this.userById$.value),{[r.user.userId]:r.user})))}),this.usersByOrganizationIdAndFolderId$.next(i)}catch(i){this.loggingService.catch("Error in ContactService updateUserFolderContacts: ",i)}}getUserFolderContacts$(){return this.getContactListScopeForOrganizationUsers$().pipe(he(()=>this.checkContactListScopeForOrganizationUsers([ki.ALL,ki.FOLDER])?this.userFolderContacts$.asObservable():se([])))}getUserFolderContacts(){return this.checkContactListScopeForOrganizationUsers([ki.ALL,ki.FOLDER])?this.userFolderContacts$.value:[]}setUserDocumentContacts(e){try{this.userDocumentContacts$.next(e?.map(r=>r?.user));let i={};e?.forEach(r=>{let{organizationId:a,documentId:s}=r?.metadata||{};a&&s&&(i[a]||(i[a]={}),i[a][s]||(i[a][s]={}),i[a][s][r.user.userId]=r,this.userById$.next(T(I({},this.userById$.value),{[r.user.userId]:r.user})))}),this.usersByOrganizationIdAndDocumentId$.next(i)}catch(i){this.loggingService.catch("Error in ContactService updateUserDocumentContacts: ",i)}}getUserDocumentContacts$(){return this.getContactListScopeForOrganizationUsers$().pipe(he(()=>this.checkContactListScopeForOrganizationUsers([ki.ALL,ki.DOCUMENT])?this.userDocumentContacts$.asObservable():se([])))}getUserDocumentContacts(){return this.checkContactListScopeForOrganizationUsers([ki.ALL,ki.DOCUMENT])?this.userDocumentContacts$.value:[]}getCurrentOrganizationUserIAM$(){return this.currentOrganizationUserIAM$.asObservable()}getCurrentOrganizationUserIAM(){return this.currentOrganizationUserIAM$.value}mergeOrganizationAndDocumentContacts(){try{let e=[];this.getContactListScopeForOrganizationUsers().includes(ki.ALL)?e=[...this.getUserOrganizationContacts(),...this.getUserFolderContacts(),...this.getUserDocumentContacts()]:this.getContactListScopeForOrganizationUsers().includes(ki.ORGANIZATION)?e=[...this.getUserOrganizationContacts()]:this.getContactListScopeForOrganizationUsers().includes(ki.FOLDER)?e=[...this.getUserFolderContacts()]:this.getContactListScopeForOrganizationUsers().includes(ki.DOCUMENT)&&(e=[...this.getUserDocumentContacts()]);let i=[...new Map(e.filter(r=>r?.userId).map(r=>[r.userId,r])).values()];this.internalUserContacts$.next(i)}catch(e){this.loggingService.catch("Error in ContactService mergeOrganizationAndDocumentContacts: ",e)}}getOrganizationGroupsFromDb$(){try{this.getOrganizationGroupsSubscription||(this.getOrganizationGroupsSubscription=this.authService.getUser$().pipe(he(e=>e?.organizationId?se(e).pipe(he(i=>this.docService.getOrganizationConfig$().pipe(Fe(r=>!!r),ce(()=>i))),he(i=>{if(this.setUserOrganizationGroups([]),!i)return se();let r=this.docService.getOrganizationConfig()?.organizationId;return r?this.commonDbService.dbListener({feature:"allOrganizationGroups",properties:{organizationId:r,isCollection:!0}}).pipe(ce(a=>a?.data),ce(a=>{a?(typeof a=="object"&&(a?.undefined&&delete a.undefined,a?.null&&delete a.null),this.setUserOrganizationGroups(Object.values(a??{}))):this.setUserOrganizationGroups([])})):se()})):(this.setUserOrganizationGroups([]),se()))).subscribe(()=>{},e=>{this.loggingService.catch("Error in ContactService getOrganizationGroupsFromDb$ subscription: ",e)}))}catch{}}setUserOrganizationGroups(e){try{this.userOrganizationGroups$.next(e)}catch(i){this.loggingService.catch("Error in ContactService setUserOrganizationGroups: ",i)}}onContactSelected(e){try{if(e?.userId){let i=!!this.getUserDocumentContacts().find(a=>a.userId===e.userId),r=!!this.getUserOrganizationContacts().find(a=>a.userId===e.userId);switch(this.documentAccessType){case pi.RESTRICTED:if(!i){let a={contact:e,isOrganizationContact:r,isDocumentContact:i,documentAccessType:this.documentAccessType};this.onContactSelectedSubject$.next(a)}break}}else{let i={contact:e,isOrganizationContact:!1,isDocumentContact:!1,documentAccessType:this.documentAccessType};this.onContactSelectedSubject$.next(i)}}catch(i){this.loggingService.catch("Error in ContactService onContactSelected: ",i)}}onContactSelected$(){return this.onContactSelectedSubject$.asObservable()}getOrganizationGroups$(){return this.getContactListScopeForOrganizationUsers$().pipe(he(()=>this.checkContactListScopeForOrganizationUsers([ki.ALL,ki.ORGANIZATION_USER_GROUP])?this.userOrganizationGroups$.asObservable():se([])))}enableAtHere(){try{if(this.analyticsService.setFeatureConfig({feature:ke.COMMENT,config:{atHereEnabled:!0}}),this.atHereEnabled$.value===!0)return;this.atHereEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in ContactService enableAtHere: ",e)}}setAtHereLabel(e){try{this.analyticsService.setFeatureConfig({feature:ke.COMMENT,config:{atHereLabel:e}}),e&&this.atHereLabel$.next(e)}catch(i){this.loggingService.catch("Error in ContactService setAtHereLabel: ",i)}}setAtHereDescription(e){try{this.analyticsService.setFeatureConfig({feature:ke.COMMENT,config:{atHereDescription:e}}),e&&this.atHereDescription$.next(e)}catch(i){this.loggingService.catch("Error in ContactService setAtHereDescription: ",i)}}disableAtHere(){try{if(this.analyticsService.setFeatureConfig({feature:ke.COMMENT,config:{atHereEnabled:!1}}),this.atHereEnabled$.value===!1)return;this.atHereEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in ContactService disableAtHere: ",e)}}getAtHereEnabled$(){return this.getContactListScopeForOrganizationUsers$().pipe(he(()=>this.checkContactListScopeForOrganizationUsers([ki.ALL,ki.DOCUMENT])?this.atHereEnabled$.asObservable():se(!1)))}getAtHereEnabled(){return this.checkContactListScopeForOrganizationUsers([ki.ALL,ki.DOCUMENT])?this.atHereEnabled$.value:!1}updateContactListScopeForOrganizationUsers(e){try{this.contactListScopeForOrganizationUsers$.next(e)}catch(i){this.loggingService.catch("Error in ContactService updateContactListScopeForOrganizationUsers: ",i)}}getContactListScopeForOrganizationUsers$(){return this.contactListScopeForOrganizationUsers$.asObservable()}getContactListScopeForOrganizationUsers(){return this.contactListScopeForOrganizationUsers$.value}checkContactListScopeForOrganizationUsers(e){return this.getContactListScopeForOrganizationUsers().some(i=>e.includes(i))}updateContactList(e,i){return Q(this,null,function*(){try{if(this.analyticsService.trackEvent(X.Events.Contact.UPDATE_CONTACT_LIST_TRIGGERED,{contactsCount:e?.length,config:i}),this.usersService?.userDataProviderAvailable()){let r=e.map(s=>s?.userId).filter(s=>s);yield this.usersService.resolveUsers({userIds:r});let a=r.map(s=>this.usersService.getUserById(s)).filter(s=>!!s);this.customUserContacts$.next(a)}else this.customUserContacts$.next(e);this.customUserContactsConfig$.next(i)}catch(r){this.loggingService.catch("Error in CommentService updateContactList: ",r)}})}convert(e){try{if(e?.options){let{documentId:i,organizationId:r}=this.docService.getServerId(e?.options);e.options=T(I({},e?.options),{documentId:i,organizationId:r})}return this}catch(i){return this.loggingService.catch("Error in ContactService convert: ",i),this}}getContactList$(){try{return this.authService.getUser$().pipe(he(e=>e?Rn([this.userOrganizationContacts$.asObservable(),this.userFolderContacts$.asObservable(),this.userDocumentContacts$.asObservable(),this.userOrganizationGroups$.asObservable(),this.customUserContacts$.asObservable()]).pipe(ce(([i,r,a,s,m])=>{let p={};p.organizationUsers=i?.map(_=>this.convertToClientUser(_)),p.folderUsers=r?.map(_=>this.convertToClientUser(_)),p.documentUsers=a?.map(_=>this.convertToClientUser(_)),p.updatedContactList=m?.map(_=>this.convertToClientUser(_));let h=[];return s?.forEach(_=>{let E=this.convertToClientUserGroup(_,p.organizationUsers||[]);E&&h.push(E)}),p.userGroups=h,p}),qt(Vi)):se(null)),jn(e=>(this.loggingService.catch("Error in ContactService getContactList$: ",e),se(null))))}catch(e){return this.loggingService.catch("Error in ContactService getContactList$: ",e),se(null)}}convertToClientUserGroup(e,i){try{let r={groupId:e?.metadata?.clientGroupId,groupName:e?.metadata?.groupName,users:[]},a={};return i?.forEach(s=>{if(s?.userId){let m=Pt(s.userId);a[m]=s}}),Object.keys(e?.users??{}).forEach(s=>{a[s]&&r.users?.push(a[s])}),r}catch(r){return this.loggingService.catch("Error in ContactService convertToClientUserGroup: ",r),null}}convertToClientUser(e){try{return e&&(e=JSON.parse(JSON.stringify(e)),e?.clientGroupId&&(e.groupId=e.clientGroupId,delete e.clientGroupId),e?.clientOrganizationId&&(e.organizationId=e.clientOrganizationId,delete e.clientOrganizationId),e?.userSnippylyId&&delete e.userSnippylyId),e}catch(i){return this.loggingService.catch("Error in ContactService convertToClientUser: ",i),e}}getCustomUserContacts(){return this.customUserContacts$.value}getCustomUserContacts$(){return this.customUserContacts$.asObservable()}getCustomUserContactsConfig(){return this.customUserContactsConfig$.value}getCustomUserContactsConfig$(){return this.customUserContactsConfig$.asObservable()}};o.\u0275fac=function(i){return new(i||o)(J(Ze),J(He),J(jt),J(hn),J(lt),J(y),J(Tn),J(Gn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Nle=n=>{try{return n.name.split(".").slice(0,-1).join(".")}catch(o){dt.catch("Error in File utils getFileName: ",o);return}},yH=n=>{try{return/(?:\.([^.]+))?$/.exec(n?.name)[1]}catch(o){dt.catch("Error in File utils getFileExtension: ",o);return}},Fle=(n,o)=>{try{let t=n.slice(0,-1,n.type);return new File([t],o+"."+yH(n),{type:n.type})}catch(t){dt.catch("Error in File utils updateFile: ",t);return}},Lle=n=>new Promise((o,t)=>{let e=new FileReader;e.readAsDataURL(n),e.onload=()=>{o(e.result)},e.onerror=i=>{t(i)}}),Ble={mp4:"video/mp4",mov:"video/quicktime",avi:"video/x-msvideo",wmv:"video/x-ms-wmv",flv:"video/x-flv",mp3:"audio/mpeg",wav:"audio/wav",ogg:"audio/ogg",webm:"video/webm",mkv:"video/x-matroska",m4v:"video/x-m4v",m4a:"audio/x-m4a",aac:"audio/aac","3gp":"video/3gpp","3g2":"video/3gpp2",jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",gif:"image/gif",bmp:"image/bmp",svg:"image/svg+xml",webp:"image/webp",pdf:"application/pdf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",xls:"application/vnd.ms-excel",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",ppt:"application/vnd.ms-powerpoint",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",odt:"application/vnd.oasis.opendocument.text",ods:"application/vnd.oasis.opendocument.spreadsheet",zip:"application/zip",rar:"application/x-rar-compressed",txt:"text/plain",rtf:"application/rtf",html:"text/html",htm:"text/html",csv:"text/csv",ics:"text/calendar",vcf:"text/x-vcard",js:"application/javascript",css:"text/css",json:"application/json",xml:"application/xml",swf:"application/x-shockwave-flash"};var Kp=(()=>{let o=class o{constructor(e,i,r,a){this.authService=e,this.configService=i,this.loggingService=r,this.attachmentResolverService=a,this.storage=qy();try{this.configService.getApiKey$().subscribe(s=>{this.apiKey=s}),this.authService.getFirebaseConfig$().subscribe(s=>{s&&s.firebaseOptions?.storageBucket&&(this.storage=qy(void 0,s?.firebaseOptions?.storageBucket))},s=>{this.loggingService.catch("Error in StorageService constructor: ",s)})}catch(s){this.loggingService.catch("Error in StorageService constructor:",s)}}createAttachment({path:e,file:i}){try{let r=new Yv;r.name=i.name;let a=Fle(i,`${r.attachmentId}_${Nle(i)}`),s=`${this.apiKey}/${e}/${a?.name}`;return r.bucketPath=s,r.size=i.size,r.type=yH(i),r?.type&&(r.mimeType=Ble[r?.type]),r}catch(r){return this.loggingService.catch("Error in StorageService createAttachment: ",r),null}}uploadAttachmentToStorage({attachment:e,file:i,resolve:r,reject:a}){try{let s=Yy(this.storage,e.bucketPath),m=nV(s,i,{cacheControl:"public,max-age=3600"});m.on("state_changed",p=>{let h=p.bytesTransferred/p.totalBytes*100},p=>{a(p)},()=>{tV(m.snapshot.ref).then(p=>{e.url=p,r(e)})})}catch(s){this.loggingService.catch("Error in StorageService uploadAttachmentToStorage: ",s),a(s)}}uploadToResolver(m){return Q(this,arguments,function*({file:e,attachment:i,metadata:r,resolve:a,reject:s}){try{r.attachmentId=i.attachmentId;let p={attachmentId:i.attachmentId,name:i.name,file:e,metadata:r,mimeType:i.mimeType},h=yield this.attachmentResolverService.saveAttachment({attachment:p,eventType:Ya.ATTACHMENT_ADD});h&&h.data?.url?(i.url=h.data?.url,a(i)):s(new Error("Failed to upload attachment to resolver"))}catch(p){this.loggingService.catch("Error in StorageService uploadToResolver: ",p),s(p)}})}uploadFile({path:e,file:i,useAttachmentResolver:r,metadata:a}){return new Promise((s,m)=>{try{if(!this.apiKey)throw new Error("API key not configured");let p=this.createAttachment({path:e,file:i});if(!p)throw new Error("Attachment not created");r?this.uploadToResolver({file:i,attachment:p,metadata:a,resolve:s,reject:m}):this.uploadAttachmentToStorage({attachment:p,file:i,resolve:s,reject:m})}catch(p){this.loggingService.catch("Error in StorageService uploadFile:",p),m(p)}})}uploadChunk(e,i,r){return new Promise((a,s)=>{try{if(this.apiKey){let m=`${this.apiKey}/${e}/${i.name}`,p=Yy(this.storage,m),h=nV(p,i,{cacheControl:"public,max-age=3600"});h.on("state_changed",_=>{let E=_.bytesTransferred/_.totalBytes*100},_=>{s(_)},()=>{tV(h.snapshot.ref).then(_=>{a(_)}).catch(_=>{this.loggingService.catch(`[uploadChunk] Error getting download URL for chunk ${r}:`,_),s(_)})})}else{let m=new Error("API key not available");this.loggingService.catch("[uploadChunk] API key not available",m),s(m)}}catch(m){this.loggingService.catch(`[uploadChunk] Error in StorageService uploadChunk for chunk ${r}: `,m),s(m)}})}downloadAttachment(e){try{if(e.url){let i=new XMLHttpRequest;i.responseType="blob",i.onload=()=>{let r=i.response,a=document.createElement("a"),s=window.URL.createObjectURL(r);a.setAttribute("type","hidden"),a.setAttribute(j.ATTRIBUTES.VELT_DOWNLOAD_BUTTON,"true"),a.classList.add("snippyly-overlay-panel"),a.href=s,e?.name&&(a.download=e?.name),document.body.appendChild(a);let m=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!1});a.dispatchEvent(m),window.URL.revokeObjectURL(s),a.remove()},i.onerror=()=>{window.open(e.url,"_blank")},i.open("GET",e.url),i.send()}}catch(i){this.loggingService.catch("Error in StorageService downloadAttachment: ",i)}}deleteAttachment({attachment:e,metadata:i,useAttachmentResolver:r}){return new Promise((a,s)=>{if(r)this.attachmentResolverService.deleteAttachment({attachmentId:e.attachmentId,metadata:i}).then(()=>{a(null)}).catch(m=>{s(m)});else{let m=Yy(this.storage,e.bucketPath);eV(m).then(()=>{a(null)}).catch(p=>{a(null)})}})}deleteFileFromPath(e){return new Promise((i,r)=>{let a=Yy(this.storage,e);eV(a).then(()=>{i(null)}).catch(s=>{r(s)})})}};o.\u0275fac=function(i){return new(i||o)(J(He),J(jt),J(y),J(Yp))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var fn=(()=>{let o=class o{constructor(e,i,r,a,s,m,p,h){this.analyticsService=e,this.authService=i,this.contactService=r,this.databaseService=a,this.docService=s,this.configService=m,this.loggingService=p,this.commonDbService=h,this.documentIAM$=new Ce(null),this.workspaceIAM$=new Ce(null),this.roles$=new Ce([]),this.getDocumentIamSubscription=null,this.getOrganizationIamSubscription=null,this.getWorkspaceIamSubscription=null;try{this.authService.setIamService(this),this.databaseService.getDb().pipe(Fe(_=>!!_),tt(1)).subscribe(_=>{_&&(this.db=_,this.getUser(),this.getDocumentPaths())},_=>{this.loggingService.catch("Error in CommentService getDb subscription: ",_)}),this.getRole$().pipe(tt(1)).subscribe(_=>{this.authService?.getUser()&&!_&&this.analyticsService.trackEvent(X.Events.Iam.USER_ACCESS_DENIED)}),this.documentIAM$.subscribe(_=>{_?.accessType&&this.contactService.setDocumentAccessType(_.accessType)})}catch(_){this.loggingService.catch("Error in IamService constructor: ",_)}}clearCache(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCache in IamService","color: green;");try{this.documentIAM$.next(null),this.workspaceIAM$.next(null),this.roles$.next([]),this.documentPaths=null}catch(e){this.loggingService.catch("Error in IamService clearCache: ",e)}}getUser(){try{this.authService.getUser$().pipe(Fe(e=>!!e)).subscribe(e=>{this.user=e,this.user?this.getDocumentIam():(this.getDocumentIamSubscription?.unsubscribe(),this.getOrganizationIamSubscription?.unsubscribe(),this.getWorkspaceIamSubscription?.unsubscribe())},e=>{this.loggingService.catch("Error in IamService getUser$ subscription: ",e)})}catch(e){this.loggingService.catch("Error in IamService getUser: ",e)}}getDocumentPaths(){try{this.docService.getDocumentPaths$().pipe(Fe(e=>!!e)).subscribe(e=>{this.documentPaths=e,this.getDocumentIam(),this.getWorkspaceIam()},e=>{this.loggingService.catch("Error in IamService getDocumentPaths$ subscription: ",e)})}catch(e){this.loggingService.catch("Error in IamService getDocumentPaths: ",e)}}getDocumentIam(){try{this.getDocumentIamSubscription&&(this.getDocumentIamSubscription.unsubscribe(),this.getDocumentIamSubscription=null),this.user?this.getDocumentIamSubscription=this.docService.getDocumentIam$().subscribe(e=>{let i=e||new oM;this.documentIAM$.next(i)},e=>{this.loggingService.catch("Error in IamService getDocumentIam$ subscription: ",e)}):this.documentIAM$.next(null)}catch(e){this.loggingService.catch("Error in IamService getDocumentIam: ",e)}}getWorkspaceIam(){try{this.getWorkspaceIamSubscription||(this.getWorkspaceIamSubscription=this.commonDbService.dbListener({feature:"workspaceIam",properties:{skipFirestore:!0}}).pipe(jn(e=>se(null))).subscribe(e=>{this.workspaceIAM$.next(e?.data),this.roles$.next(e?.data?.roles||[])}))}catch(e){this.loggingService.catch("Error in IamService getWorkspaceIam: ",e)}}isUserAllowed$(){return this.getRole$().pipe(ce(e=>!!e),qt())}getDocumentIAM$(){return this.documentIAM$.asObservable()}getRoles$(){return this.roles$.asObservable().pipe(ce(e=>e?.length?e:j.WorkspaceRoles))}getFeaturesAccessLevel$(){return this.documentIAM$.asObservable().pipe(ce(e=>e?.features),he(e=>this.getRole$().pipe(ce(i=>(i===go.ADMIN&&(e=e&&JSON.parse(JSON.stringify(e||{})),e?.all?.disabled&&(e.all.disabled=!1)),e)))))}hasRole(e){try{return e===this.getRole()}catch(i){return this.loggingService.catch("Error in IamService hasRole: ",i),!1}}hasRoleAny(e=[]){try{return e?.includes(this.getRole()||"")}catch(i){return this.loggingService.catch("Error in IamService hasRoleAny: ",i),!1}}hasRole$(e){try{return this.authService.getUser$().pipe(he(()=>this.documentIAM$.pipe(Fe(i=>!!i),he(()=>this.workspaceIAM$.pipe(ce(()=>e===this.getRole()))))))}catch(i){return this.loggingService.catch("Error in IamService hasRole$: ",i),se(!1)}}getRole$(){try{return this.authService.getUser$().pipe(he(()=>this.configService.getSF$()),he(()=>this.configService.getSF()?this.contactService.isUserGlobalContact$():se(null)),he(()=>this.documentIAM$.pipe(Fe(e=>!!e))),he(()=>this.workspaceIAM$),ce(()=>this.getRole()))}catch(e){return this.loggingService.catch("Error in IamService getRole$: ",e),se(null)}}getRole(){try{let e=this.configService.getSF();if(e&&this.contactService.isUserGlobalContact())return go.ADMIN;if(!e&&this.user?.isAdmin)return go.ADMIN;let i=null,r;if(this.user)switch((this.documentIAM$.value?this.documentIAM$.value?.features?.all?.restricted:!1)?pi.RESTRICTED:this.documentIAM$.value?this.documentIAM$.value?.documentAccessType||pi.PUBLIC:null){case pi.PUBLIC:r=this.getUserFromDocumentIAM(this.user?.email,this.user?.userId),r||(r=this.getUserFromWorkspaceIAM(this.user?.email,this.user?.userId)),i=r?.role?.name||go.COMMENTER;break;case pi.RESTRICTED:r=this.getUserFromDocumentIAM(this.user?.email,this.user?.userId),r||(r=this.getUserFromWorkspaceIAM(this.user?.email,this.user?.userId)),i=r?.role?.name||null;break;default:break}return i}catch(e){this.loggingService.catch("Error in IamService getRole: ",e)}return null}isUserAdmin$(){return this.getRole$().pipe(ce(e=>e===go.ADMIN),qt())}isUserAdmin(){try{return this.getRole()===go.ADMIN}catch(e){return this.loggingService.catch("Error in IamService isUserAdmin: ",e),!1}}getUserFromDocumentIAM(e,i){try{if(e||i){let r;return e&&(r=this.documentIAM$.value?.users?.[Pt(e)]),!r&&i&&(r=this.documentIAM$.value?.users?.[Pt(i)]),r}else return}catch(r){this.loggingService.catch("Error in IamService getUserFromDocumentIAM: ",r)}}getUserFromWorkspaceIAM(e,i){try{if(e||i){let r;return e&&(r=this.workspaceIAM$.value?.users?.[Pt(e)]),!r&&i&&(r=this.workspaceIAM$.value?.users?.[Pt(i)]),r}else return}catch(r){this.loggingService.catch("Error in IamService getUserFromWorkspaceIAM: ",r)}}};o.\u0275fac=function(i){return new(i||o)(J(Ze),J(He),J(Ci),J(hn),J(lt),J(jt),J(y),J(Tn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var vn=(()=>{let o=class o{constructor(e,i,r,a,s,m,p,h,_,E,D,L,H,K,oe,ue){this.afAuth=e,this.analyticsService=i,this.authService=r,this.configService=a,this.commonDbService=s,this.commonDbUtilsService=m,this.commentUtilsService=p,this.commentAnnotationsResolverService=h,this.databaseService=_,this.docService=E,this.domService=D,this.iamService=L,this.loggingService=H,this.notificationUtilsService=K,this.usersService=oe,this.functions=ue,this.db=Ii(),this.notificationsDb=Ii(void 0,Xn.firebaseNotificationsDatabaseURL),this.documentPaths=null,this.notifications$=new Ce([]),this.rawNotificationsByIdMap$=new Ce(new Map),this.processedNotifications$=new Ce([]),this.readNotificationsOnForYouTab$=new Ce(!1),this.notificationViews$=new Ce({}),this.notificationsByIdMap$=new Ce(new Map),this.historyPanelVisible$=new Ce(!1),this.notificationsForYou$=new Ce(null),this.notificationsByDocumentIdMap$=new Ce(null),this.notificationsByDocumentIdSubscription={},this.allowedDocumentMetadataMap$=new Ce(null),this.maxNotificationDays$=new Ce(15),this.tabConfig$=new Ce({people:{enable:!1}}),this.settingsConfig$=new Ce({inbox:"ALL",email:"MINE"}),this.muteAllNotifications$=new Ce(!1),this.enableSettings$=new Ce(!1),this.settingsInitialConfig$=new Ce([{name:"Inbox",id:"inbox",default:"ALL",enable:!0,values:[{name:"All",id:"ALL"},{name:"Only Involved",id:"MINE"},{name:"None",id:"NONE"}]},{name:"Email",id:"email",default:"MINE",enable:!0,values:[{name:"All",id:"ALL"},{name:"Only Involved",id:"MINE"},{name:"None",id:"NONE"}]}]);try{this.subscribeNotificationsData().subscribe(),this.commentUtilsService.setNotificationService(this),this.databaseService.getDb().pipe(Fe(be=>!!be),tt(1)).subscribe(be=>{be&&(this.db=be,this.getDocumentIds(),this.subscribeGetNotificationsForYou())},be=>{this.loggingService.catch("Error in NotificationService getDb subscription: ",be)}),this.authService.getUser$().subscribe(be=>{be?(this.setSettingsInitialConfig(this.settingsInitialConfig$.getValue()),this.subscribeGetNotificationsForYou(),this.getDocumentIds(),this.subscribeToUserSettings()):(Object.keys(this.notificationsByDocumentIdSubscription).forEach(Le=>{this.notificationsByDocumentIdSubscription[Le]?.unsubscribe()}),this.notificationForYouSubscription?.unsubscribe(),this.documentIdsSubscription?.unsubscribe(),this.resetCacheData())}),this.docService.getLocationMetadata$().subscribe(be=>{if(be){let Le=this.notificationsByDocumentIdMap$.getValue()?JSON.parse(JSON.stringify(this.notificationsByDocumentIdMap$.getValue())):null;Object.keys(be||{}).forEach(qe=>{let Re=Le?.[qe]?.notifications;Re?.length&&Re.forEach(_e=>{this.notificationUtilsService.mergeLocationWithNotification({notification:_e},be)?.notification})}),this.notificationsByDocumentIdMap$.next(Le)}})}catch(be){this.loggingService.catch("Error in NotificationService constructor: ",be)}}setDBConfigDataToInitialConfig(e){try{let i=JSON.parse(JSON.stringify(this.settingsConfig$.getValue()??{}));Object.entries(e||{}).forEach(([r,a])=>{i[r]=a}),this.settingsConfig$.next(i)}catch(i){this.loggingService.catch("Error in NotificationService setDBConfigDataToInitialConfig: ",i)}}getInitialConfigFromDB(e){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling NotificationService FUNCTION: getInitialConfigFromDB","color: green;");let i=Pt(this.authService.getUser()?.userId??""),r=yield this.commonDbService.getData({feature:"userConfig",properties:{useCollectionGroup:!1,isCollection:!1,documentId:e?.documentId,userId:i}});r?.notificationsConfig&&this.setDBConfigDataToInitialConfig(r?.notificationsConfig),yield this.updateSettingsConfigToDb()}catch(i){this.loggingService.catch("Error in NotificationService getInitialConfigFromDB: ",i)}})}subscribeToUserSettings(){try{this.loggingService.log("%c[WB] Calling NotificationService FUNCTION: subscribeToUserSettings","color: green;"),this.userSettingsSubscription&&this.userSettingsSubscription.unsubscribe();let e=Pt(this.authService.getUser()?.userId??"");this.userSettingsSubscription=this.enableSettings$.pipe(Fe(i=>i===!0),he(()=>this.docService.getDocumentPaths$().pipe(Fe(i=>!!i),he(i=>_o(this.getInitialConfigFromDB(i)).pipe(he(()=>this.commonDbService.dbListener({feature:"userConfig",properties:{useCollectionGroup:!1,isCollection:!1,documentId:i?.documentId,userId:e}}).pipe(ce(r=>{r?.data?.notificationsConfig&&this.setDBConfigDataToInitialConfig(r?.data?.notificationsConfig)})))))))).subscribe()}catch(e){this.loggingService.catch("Error in NotificationService subscribeToUserSettings: ",e)}}resetCacheData(){try{this.loggingService.log("%c[WB] Calling NotificationService FUNCTION: resetCacheData","color: green;"),this.notificationsByDocumentIdMap$.next(null),this.notificationsForYou$.next(null),this.settingsConfig$.next({})}catch(e){this.loggingService.catch("Error in NotificationService resetCacheData: ",e)}}subscribeGetNotificationsForYou(){try{this.notificationForYouSubscription&&this.notificationForYouSubscription.unsubscribe(),this.notificationForYouSubscription=this.getNotificationsForYou().subscribe(()=>{},e=>{this.loggingService.catch("Error in NotificationService getNotificationsForYou subscription: ",e)})}catch(e){this.loggingService.catch("Error in NotificationService subscriveGetNotificationsForYou: ",e)}}setCommentService(e){try{this.commentService=e}catch(i){this.loggingService.catch("Error in NotificationService setCommentService: ",i)}}getDocumentIds(){try{this.documentIdsSubscription&&this.documentIdsSubscription.unsubscribe(),this.documentIdsSubscription=this.getDocumentIdsByLastNotificationTimestamp().pipe(Pi(),ce(([e,i])=>{let r=e?.map(h=>h.documentId),a=i?.map(h=>h.documentId),s=r?.filter(h=>!a?.includes(h)),m=a?.map(h=>({documentId:h,timestamp:i?.find(_=>_.documentId===h)?.timestamp})).filter(h=>!r?.includes(h.documentId)),p=a?.map(h=>{let _=i?.find(E=>E.documentId===h)?.timestamp;return{documentId:h,timestamp:_}}).filter(h=>{let _=e?.find(E=>E.documentId===h.documentId)?.timestamp;return _&&h.timestamp&&_!==h.timestamp});m?.length&&this.fetchNotificationsForDocumentIds(m),p?.length&&this.fetchNotificationsForDocumentIds(p,1),s?.forEach(h=>{this.removeNotificationsForDocumentId(h)}),i&&!i?.length&&!this.notificationsByDocumentIdMap$.getValue()&&this.notificationsByDocumentIdMap$.next({})})).subscribe(()=>{},e=>{this.loggingService.catch("Error in NotificationService getDocumentIds subscription: ",e)})}catch(e){this.loggingService.catch("Error in NotificationService getDocumentIds: ",e)}}getDocumentIdsByLastNotificationTimestamp(e=15){try{return this.authService.getUser$().pipe(he(i=>this.docService.getOrganizationConfig$().pipe(ce(r=>{let a=null,s=this.configService.getApiKey(),m=r?.organizationId||i?.organizationId;return s&&m&&(a=new Om({apiKey:s,organizationId:m})),{user:i,documentPaths:a}}))),he(i=>{let{user:r,documentPaths:a}=i;if(r&&a?.organizationNotificationsLastNotificationTimestamp){let s=new Date,m=this.maxNotificationDays$.getValue()>0?this.maxNotificationDays$.getValue():15;s.setDate(s.getDate()-m);let p=s.getTime();return this.commonDbService.dbListener({feature:"allLastNotificationTimestamp",properties:{organizationId:a?.organizationId,isCollection:!0,useQuery:!0,firestoreQuery:[Ui(gt("timestamp",">=",p)),Ka("timestamp","desc"),qv(e)]}}).pipe(ce(h=>h?.data),ce(h=>{let _=[];return Object.keys(h||{}).forEach(E=>{let D=this.commonDbService.shouldUseFirestore()?h[E]?.timestamp??0:h[E],L=this.commonDbService.shouldUseFirestore()?h[E]?.deletedNotification??!1:!1;if(L&&L.id&&L?.timestamp===D){let H=L.id,K=h[E]?.metadata?.documentId,oe=JSON.parse(JSON.stringify(this.notificationsByDocumentIdMap$.getValue()??{})),ue=oe?.[K]??{documentMetadata:null,notifications:[]},be=ue.notifications??[],Le=be?.findIndex(qe=>qe.id===H);Le!==-1&&(be.splice(Le,1),this.notificationsByDocumentIdMap$.next(T(I({},oe),{[K]:T(I({},ue),{notifications:be})})))}_.push({documentId:E,timestamp:D})}),_}),jn(h=>(this.loggingService.catch("Error in NotificationService getDocumentIdsByLastNotificationTimestamp: ",h),se([]))))}return se(null)}))}catch(i){return this.loggingService.catch("Error in NotificationService getDocumentIdsByLastNotificationTimestamp: ",i),se([])}}fetchNotificationsForDocumentIds(e,i=15){return Q(this,null,function*(){try{if(e?.length){let r=yr(this.functions,br({url:Xn.cloudFunction.getNotificationsForDocuments,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:12e5}),a=this.docService.getOrganizationConfig()?.organizationId??"",s=this.getStartAtTimestamp(),m={};e.forEach(L=>{if(L?.documentId){let H=this.getAllowedDocumentMetadataByDocumentId(L.documentId);H&&(m[L.documentId]=H)}});let p={organizationId:a,documentIds:e,timestamp:s,limitToLast:i,documentMetadataByDocumentId:m},h=yield this.notificationUtilsService.handleNotificationEncryption({data:p}),_=(yield r({veltData:h}))?.data?.data?.veltData||{},E="notificationwithdocumentidstoencryptanddecryptonsdk"+(this.authService.getUser()?.userId??""),D=yield $oe(_,E);if(D&&typeof D=="object"){let L=this.usersService.userDataProviderAvailable(),H=this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable(),K=[],oe=[];Object.keys(D).forEach((ue,be)=>{let Le=D[ue].documentMetadata;if(Le){let Re=this.allowedDocumentMetadataMap$.value||{};(!Re?.[ue]||!uo(Re?.[ue],Le))&&this.allowedDocumentMetadataMap$.next(T(I({},Re),{[ue]:Le}))}let qe=D[ue].notifications||[];qe.forEach(Re=>{Re.notification=this.getClientNotificationObject(Re)}),this.setNotificationForDocumentIdInCache(ue,Le,qe),L&&K.push(this.commonDbUtilsService.formatResponse({feature:"allDocNotifications",data:qe,shouldAwait:!0,forceResolve:!0})),H&&oe.push(this.commonDbUtilsService.formatResponse({feature:"allDocNotifications",data:qe,shouldCommentAnnotationsResolverAwait:!0}))}),L&&Promise.all(K).then(()=>{Object.keys(D).forEach(ue=>{let be=D?.[ue]?.documentMetadata||{},Le=this.commonDbUtilsService.mergeUsersWithData({feature:"allDocNotifications",data:D?.[ue]?.notifications||[]});Le.forEach(qe=>{qe.notification=this.getClientNotificationObject(qe)}),this.setNotificationForDocumentIdInCache(ue,be,Le)})}),H&&Promise.all(oe).then(()=>{Object.keys(D).forEach(ue=>{let be=D?.[ue]?.documentMetadata||{},Le=D?.[ue]?.notifications?.reduce((qe,Re)=>(qe[Re.notificationId]=Re,qe),{});Le=this.commonDbUtilsService.mergeCommentAnnotationsWithData({feature:"allDocNotifications",data:Le}),Le=Object.values(Le??{}),Le.forEach(qe=>{qe.notification=this.getClientNotificationObject(qe)}),this.setNotificationForDocumentIdInCache(ue,be,Le)})})}}}catch(r){return this.loggingService.catch("Error in NotificationService fetchNotificationsForDocumentIds: ",r),[]}})}setNotificationForDocumentIdInCache(e,i,r,a){try{let s=this.docService.getOrganizationConfig()?.organizationId??"",m=this.docService.getOrganizationMetadata(s);i||(i=JSON.parse(JSON.stringify(this.docService.getDocumentMetadata()||{}))),m||(m=JSON.parse(JSON.stringify(this.docService.getOrganizationMetadata(s)||{})));let p=this.notificationsByDocumentIdMap$.getValue(),h=p?.[e]?.notifications||[],_=this.docService.getLocationMetadatas(),E=r?.map(H=>{let K=H.notification;return K.metadata&&(K.metadata.documentName=i?.documentName||K.metadata.documentName,K.metadata.organizationMetadata=m||K.metadata.organizationMetadata,K.metadata.documentMetadata=i||K.metadata.documentMetadata),_&&(K=this.notificationUtilsService.mergeLocationWithNotification({notification:K},_)?.notification),K})?.filter(H=>!!H)||[],D=new Map(h.map(H=>[H.id,H]));E.forEach(H=>{D.set(H.id,H)});let L=Array.from(D.values()).sort((H,K)=>(K.timestamp||0)-(H.timestamp||0));this.notificationsByDocumentIdMap$.next(T(I({},p),{[e]:{notifications:L,documentMetadata:i}}))}catch(s){this.loggingService.catch("Error in NotificationService setNotificationForDocumentIdInCache: ",s)}}removeNotificationsForDocumentId(e){try{this.notificationsByDocumentIdSubscription[e]&&this.notificationsByDocumentIdSubscription[e].unsubscribe();let i=this.notificationsByDocumentIdMap$.getValue();delete i?.[e],this.notificationsByDocumentIdMap$.next(i)}catch(i){this.loggingService.catch("Error in NotificationService removeNotificationsForDocumentId: ",i)}}getNotificationsForDocumentId$(e,i=50){try{return this.authService.getUser$().pipe(ce(r=>({user:r})),he(r=>this.maxNotificationDays$.pipe(ce(()=>r))),he(r=>{let{user:a}=r,s=this.configService.getApiKey();if(a&&s){let m=new Date,p=this.maxNotificationDays$.getValue()>0?this.maxNotificationDays$.getValue():15;m.setDate(m.getDate()-p);let h=m.getTime();return _o(this.commonDbService.queryData({feature:"allDocNotifications",properties:{rtdbQuery:[wB("timestamp"),AB(h),DB(i)],firestoreQuery:[Ka("timestamp","desc"),gt("timestamp",">=",h),gt("notification.actionUser.userId","!=",a.userId),qv(i)],apiKey:s,organizationId:this.docService?.getDocumentPaths()?.organizationId||a?.organizationId,documentId:e}})).pipe(he(_=>this.commonDbUtilsService.mergeUsersWithData$({feature:"allDocNotifications",data:{data:_,operation:null}})),ce(_=>_?.data??[]),ce(_=>(_.sort((E,D)=>D.timestamp-E.timestamp),_)),jn(_=>(this.loggingService.catch("Error in NotificationService getNotificationsForDocumentId: ",_),se([]))),ce(_=>(_.forEach(E=>{E.notification=this.getClientNotificationObject(E)}),_)))}return se([])}))}catch(r){return this.loggingService.catch("Error in NotificationService getNotificationsForDocumentId: ",r),se([])}}getStartAtTimestamp(){try{let e=new Date,i=this.maxNotificationDays$.getValue()>0?this.maxNotificationDays$.getValue():15;return e.setDate(e.getDate()-i),e.getTime()}catch(e){return this.loggingService.catch("Error in NotificationService getStartAtTimestamp: ",e),0}}getNotificationsForYou(){try{return this.databaseService.getDb().pipe(he(e=>this.authService.getUser$().pipe(ce(i=>({db:e,user:i})))),he(e=>this.maxNotificationDays$.pipe(ce(()=>e))),he(e=>{let{db:i,user:r}=e,a=this.configService.getApiKey();if(i&&r?.organizationId&&a){let s=Pt(r?.userId),m=new Date,p=this.maxNotificationDays$.getValue()>0?this.maxNotificationDays$.getValue():15;m.setDate(m.getDate()-p);let h=m.getTime();return this.commonDbService.dbListener({feature:"allUserNotifications",properties:{useQuery:!0,isCollection:!0,rtdbQuery:[wB("timestamp"),AB(h),DB(50)],firestoreQuery:[Ka("timestamp","desc"),gt("timestamp",">=",h),gt("notification.actionUser.userId","!=",r.userId),qv(50)],apiKey:a,organizationId:this.docService?.getDocumentPaths()?.organizationId||r?.organizationId,documentId:this.docService.getDocumentPaths()?.documentId,userId:s}}).pipe(he(_=>_?.data?se(_).pipe(ce(E=>E?.data),ce(E=>{let D=Object.values(E||{});return D.forEach(H=>{H.notification=this.getClientNotificationObject(H)}),D.sort((H,K)=>K.timestamp-H.timestamp),D.map(H=>H.notification).filter(H=>!!H)}),he(E=>{let D={data:E?.reduce((L,H)=>(L[H.id]={notification:H},L),{}),operation:null};return this.commonDbUtilsService.mergeLocationMetadataWithData$({data:D,feature:"allUserNotifications"}).pipe(ce(L=>Object.values(L?.data||{}).map(H=>H?.notification)))})):se(null)))}return se(null)}),he(e=>{let i=this.docService.getOrganizationConfig()?.organizationId??"";return this.docService.getOrganizationMetadata$(i).pipe(ce(()=>e))}),he(e=>this.allowedDocumentMetadataMap$.pipe(ce(()=>e))),ce(e=>(e?.length&&(e=e.map(i=>{if(i?.metadata){let r=this.docService.getOrganizationConfig()?.organizationId??"",a=this.getAllowedDocumentMetadataByDocumentId(i.metadata.documentId),s=this.docService.getOrganizationMetadata(r);a||(a=JSON.parse(JSON.stringify(this.docService.getDocumentMetadata()||{}))),s||(s=JSON.parse(JSON.stringify(this.docService.getOrganizationMetadata(r)||{}))),i.metadata.documentName=a?.documentName||i.metadata.documentName,i.metadata.organizationMetadata=s||i.metadata.organizationMetadata,i.metadata.documentMetadata=a||i.metadata.documentMetadata}return i})),e===null?this.notificationsForYou$.next(null):e?.length?this.notificationsForYou$.next(e):this.notificationsForYou$.next([]),se(e))))}catch(e){return this.loggingService.catch("Error in NotificationService getNotificationsForYou: ",e),se({})}}subscribeNotificationsData(e,i){this.loggingService.log("%c[WB] Calling FUNCTION: subscribeViewsData","color: green;");let r,a;try{if(e&&(a=yn(e)),i&&typeof i=="object"){let s=Jo(i);r=yn(JSON.stringify(s))}}catch(s){this.loggingService.catch("Error in ViewsService subscribeViewsData: ",s)}return qn(this.afAuth).pipe(Fe(s=>!!s),he(s=>this.isFeatureAllowed({firebaseUser:s})),he(s=>s.featureAllowed?this.iamService.isUserAllowed$().pipe(ce(m=>(s.featureAllowed=m,s))):se(s)),he(s=>!s.featureAllowed||s?.user?.organizationId?(this.notifications$.next([]),this.rawNotificationsByIdMap$.next(new Map),this.processedNotifications$.next([]),this.notificationsByIdMap$.next(new Map),this.notificationViews$.next({}),this.setNotificationsByIdMap(),se([])):se(s).pipe(he(m=>this.docService.getDocumentPaths$().pipe(ce(p=>(this.documentPaths=p,m.documentPaths=p,m)))),he(m=>this.getDataFromDocumentId(a)))))}isFeatureAllowed(e){return this.configService.getConfig$().pipe(Fe(i=>!!i),ce(i=>T(I({},e),{config:i})),he(i=>this.authService.getUser$().pipe(ce(r=>T(I({},i),{user:r})))),he(i=>eo(i.config,i.user,ke.NOTIFICATION)?se(T(I({},i),{featureAllowed:!0})):(this.loggingService.warn("Notification feature is not allowed."),se(T(I({},i),{featureAllowed:!1})))))}getDataFromDocumentId(e){return this.databaseService.getDb().pipe(Fe(i=>!!i),he(i=>{if(this.db=i,this.loggingService.log(this.db),this.configService?.getApiKey()&&this.documentPaths?.views){let r=`${this.configService.getApiKey()}`;this.documentPaths?.organizationId&&(r+=`/${j.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.documentPaths.organizationId}`);let a=rn(this.db,`${e?r+"/"+j.FIREBASE_PARTIAL_PATH_DOCS+"/"+e+"/"+j.FIREBASE_PARTIAL_PATH_VIEWS+"/":this.documentPaths?.notifications}`);return $f(a).pipe(jn(s=>(this.loggingService.catch("Error in NotificationService getDataFromDocumentId: ",s),se(null))),ce(s=>{let m=[],p=new Map;s?.raw&&(Object.keys(s?.raw||{}).forEach(_=>{let E=s?.raw[_];E?.id&&m.push(E)}),m.forEach(_=>{_.id&&p.set(_.id,_)})),this.notifications$.next(m),this.rawNotificationsByIdMap$.next(p);let h=[];s?.processed&&Object.keys(s?.processed||{}).forEach(_=>{let E=s?.processed[_];E?.id&&h.push(E)}),this.processedNotifications$.next(h),this.setNotificationsByIdMap()}))}else return se(null)}))}setNotificationsByIdMap(){try{let e=this.authService.getUser();if(e){let i=this.notificationViews$.getValue(),r;e?.email&&(r=Pt(e?.email));let a;e?.userId&&(a=Pt(e?.userId));let s=new Map;this.processedNotifications$.getValue().forEach(p=>{if(p.id&&p?.displayHeadlineMessageTemplate){let h=!1;(r&&p.notifyUsers?.[r]||a&&p.notifyUsers?.[a])&&(h=!0);let _={id:p.id,notificationSource:p.notificationSource,actionType:p.actionType,actionUser:p.actionUser,timestamp:p.timestamp,targetAnnotationId:p.targetAnnotationId,displayHeadlineMessage:this.getNotificationHeadlineMessage(p),displayBodyMessage:this.getNotificationBodyMessage(p),forYou:h,notificationSourceData:p.notificationSourceData},E=this.getRawNotificationById(_.id);if(E?.metadata&&(_.metadata={apiKey:E.metadata.apiKey,organizationId:E.metadata.organizationId,clientOrganizationId:E.metadata.clientOrganizationId,documentId:E.metadata.documentId,clientDocumentId:E.metadata.clientDocumentId,location:E?.location,locationId:E?.locationId}),_?.notificationSource==="comment"&&_?.targetAnnotationId){let D=this.commentService?.getAnnotationById(_.targetAnnotationId);D||E?.annotationData&&(D=E.annotationData),D&&(_.notificationSourceData=zn(D))}s.set(p.id,_)}}),s.forEach((p,h)=>{p.isUnread=p?.actionUser?.userSnippylyId!==e?.userSnippylyId&&!i?.notification?.[h]?.views?.[e?.userSnippylyId],s.set(h,p)}),this.notificationsByIdMap$.next(s)}}catch(e){this.loggingService.catch("Error in NotificationService setNotificationsByIdMap: ",e)}}getClientNotificationObject({processed:e,raw:i,metadata:r,views:a,notification:s}){try{let m=this.authService.getUser(),p=s||e;if(p.id&&p?.displayHeadlineMessageTemplate&&m){let h=null;m?.email&&(h=Pt(m?.email));let _=null;m?.userId&&(_=Pt(m?.userId));let E=!1,D=!0;(h&&p.notifyUsers?.[h]||_&&p.notifyUsersByUserId?.[_])&&(E=!0),_&&a?.[_]&&(D=!1);let L={id:p.id};if(s?L=T(I(I({},L),s),{displayHeadlineMessage:this.getNotificationHeadlineMessage(s),displayBodyMessage:this.getNotificationBodyMessage(s),forYou:E,isUnread:D}):L={id:e.id,notificationSource:e.notificationSource,actionType:e.actionType,actionUser:e.actionUser,timestamp:e.timestamp,targetAnnotationId:e.targetAnnotationId,displayHeadlineMessage:this.getNotificationHeadlineMessage(e),displayBodyMessage:this.getNotificationBodyMessage(e),forYou:E,isUnread:D,metadata:r},L?.notificationSource==="comment"&&L?.targetAnnotationId){let H=this.commentService?.getAnnotationById(L.targetAnnotationId);H||s?.notificationSourceData&&(H=s?.notificationSourceData),H||i?.annotationData&&(H=i.annotationData),H&&(L.notificationSourceData=zn(H))}return i?.targetAnnotationData?.isCommentResolverUsed&&(L.isCommentResolverUsed=i?.targetAnnotationData?.isCommentResolverUsed),L}return}catch(m){this.loggingService.catch("Error in NotificationService getClientNotificationObject: ",m);return}}getNotificationsForYou$(){return this.notificationsForYou$.asObservable()}getNotificationsByDocumentId$(){return this.notificationsByDocumentIdMap$.asObservable().pipe(ce(e=>e?Object.keys(e??{}).map(i=>{let r=e[i].notifications||[],a=r.filter(m=>m.isUnread).length,s=r.length>0&&r[0]?.timestamp||0;return{documentId:i,notifications:e[i]?.notifications,unreadNotificationsCount:a,latestNotificationTimestamp:s,documentMetadata:e[i]?.documentMetadata}}).filter(i=>i.notifications?.length>0).sort((i,r)=>r.latestNotificationTimestamp-i.latestNotificationTimestamp):null))}getAllNotifications$(){return this.getNotificationsByDocumentId$().pipe(ce(e=>{let i=null;return e?(i=[],e.forEach(r=>{r.notifications.forEach(a=>{i?.push(a)})}),i?.sort((r,a)=>a.timestamp-r.timestamp)):null}))}processNotificationData(e){try{let i=e?.annotationData?.metadata,r=this.docService.getOrganizationConfig()?.organizationId;e.metadata=JSON.parse(JSON.stringify(this.docService.getDocumentMetadata(i?.documentId)||{})),e.metadata||(e.metadata={},this.loggingService.catch("Warning in NotificationService updateNotificationDatabase: ","Document metadata not found")),delete e.metadata.locations,e.metadata.documentMetadata=JSON.parse(JSON.stringify(this.docService.getDocumentMetadata(i?.documentId)||{})),e?.metadata?.documentMetadata?.clientDocumentId&&e?.metadata?.documentMetadata?.documentId&&(e.metadata.documentMetadata.documentId=e?.metadata?.documentMetadata?.clientDocumentId),delete e.metadata.documentMetadata.locations,e.metadata.organizationMetadata=JSON.parse(JSON.stringify(r?this.docService.getOrganizationMetadata(r)||{}:{})),e?.metadata?.organizationMetadata?.clientOrganizationId&&e?.metadata?.organizationMetadata?.organizationId&&(e.metadata.organizationMetadata.organizationId=e?.metadata?.organizationMetadata?.clientOrganizationId);let a=this.configService.getApiKey();e.metadata.apiKey=a,e.platform=this.configService.getSF()?"sf":"sdk",e.actionUser=this.authService.getUser();let s=i?.documentId?new Om({apiKey:a,documentId:i.documentId,organizationId:i?.organizationId}):this.docService.getDocumentPaths();e?.actionUser?.organizationId&&(e.metadata.organizationId=s?.organizationId||e.actionUser.organizationId,e.metadata.clientOrganizationId=s?.clientOrganizationId||e.actionUser.clientOrganizationId);let m=this.docService.getLocation();m&&(e.location=m?.location,e.locationId=m?.locationId),this.loggingService.log(`[NOTIFICATION] ${e?.notificationSource} ${e?.actionType}`,e);let p=this.commonDbService.getServerTimestamp(),h=this.notificationUtilsService.formatNotification(e,p);return JSON.parse(JSON.stringify(h))}catch(i){return this.loggingService.catch("Error in NotificationService processNotificationData: ",i),null}}updateNotificationDatabase(e){try{let i=rn(this.notificationsDb),r=this.processNotificationData(e);M5(i,JSON.parse(JSON.stringify(r)))}catch(i){this.loggingService.catch("Error in NotificationService updateNotificationDatabase: ",i)}}getRawNotifications$(){return this.notifications$.asObservable()}getProcessedNotifications$(){return this.processedNotifications$.asObservable()}getNotifications$(){return this.authService.getUser$().pipe(he(e=>e?e.organizationId?this.getAllNotifications$().pipe(he(i=>this.notificationsForYou$.pipe(ce(r=>{let a=new Map;return(i||[]).forEach(s=>{s.id&&a.set(s.id,s)}),(r||[]).forEach(s=>{s.id&&!a.has(s.id)&&a.set(s.id,s)}),Array.from(a.values()).sort((s,m)=>(m.timestamp||0)-(s.timestamp||0))})))):this.notificationsByIdMap$.asObservable().pipe(ce(i=>Array.from(i.values())),ce(i=>i.sort((r,a)=>a.timestamp-r.timestamp)),Fg()):se(null)))}getRawNotificationById(e){try{return this.rawNotificationsByIdMap$.getValue()?.get(e)}catch(i){this.loggingService.catch("Error in NotificationService getRawNotificationById: ",i);return}}setNotificationViews(e){try{this.notificationViews$.next(e),this.setNotificationsByIdMap()}catch(i){this.loggingService.catch("Error in NotificationService setNotificationViews: ",i)}}getNotificationHeadlineMessage(e){try{let i=this.authService.getUser();if(e?.displayHeadlineMessageTemplate&&e?.displayHeadlineMessageTemplateData){let r=e.displayHeadlineMessageTemplate,a=e.displayHeadlineMessageTemplateData,s=/\{(\w+)\}/g,m=r.replace(s,(p,h)=>(h==="actionUser"||h==="recipientUser")&&a[h]?i?.email&&a[h].email===i?.email||i?.userId&&a[h]?.userId===i?.userId?"You":a[h].name||a[h].email||' <velt-skeleton-loader width="50px" height="20px" border-radius="4px"></velt-skeleton-loader> ':a[h]?a[h]:p);return this.domService.sanitizeHtml(m)}return this.domService.sanitizeHtml(e.displayHeadlineMessageTemplate||"")}catch(i){return this.loggingService.catch("Error in NotificationService getNotificationHeadlineMessage: ",i),""}}getNotificationBodyMessage(e){try{if(e?.displayBodyMessageTemplate&&e?.displayBodyMessageTemplateData){let i=e?.displayBodyMessageTemplate;return e?.displayBodyMessageTemplateData&&e?.displayBodyMessageTemplateData?.users?.forEach(r=>{if(r?.userId){let a=this.usersService.getUserById(r?.userId);i=i?.replaceAll(`{{${r.userId}}}`,a?.name||a?.email||'<velt-skeleton-loader width="50px" height="20px" border-radius="4px"></velt-skeleton-loader>')}}),this.domService.sanitizeHtml(i)}return this.domService.sanitizeHtml(e.displayBodyMessage||"")}catch(i){return this.loggingService.catch("Error in NotificationService getNotificationBodyMessage: ",i),""}}setHistoryPanelVisibility(e,i=!1,r=!1){try{e?document.querySelector(j.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL)?this.historyPanelVisible$.next(e):this.loggingService.catch("Error in NotificationService setHistoryPanelVisibility: ",`<${j.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`):this.historyPanelVisible$.next(e),e?this.analyticsService.trackEvent(X.Events.Notifications.NOTIFICATION_HISTORY_PANEL_OPENED):this.analyticsService.trackEvent(X.Events.Notifications.NOTIFICATION_HISTORY_PANEL_CLOSED)}catch{this.loggingService.catch("Error in NotificationService setHistoryPanelVisibility: ",`<${j.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`)}}toggleHistoryPanelVisibility(e=!1,i=!1){try{this.historyPanelVisible$.value?this.historyPanelVisible$.next(!this.historyPanelVisible$.value):document.querySelector(j.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL)?(this.historyPanelVisible$.next(!this.historyPanelVisible$.value),this.historyPanelVisible$.value?this.analyticsService.trackEvent(X.Events.Notifications.NOTIFICATION_HISTORY_PANEL_TOGGLED,{action:"closed"}):this.analyticsService.trackEvent(X.Events.Notifications.NOTIFICATION_HISTORY_PANEL_TOGGLED,{action:"opened"})):this.loggingService.catch("Error in NotificationService toggleHistoryPanelVisibility: ",`<${j.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`)}catch{this.loggingService.catch("Error in NotificationService toggleHistoryPanelVisibility: ",`<${j.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`)}}getHistoryPanelVisibility$(){return this.historyPanelVisible$.asObservable()}setNotificationsAsRead(e){return Q(this,null,function*(){try{if(e?.length){for(let a=0;a<e.length;a+=50){let m=e.slice(a,a+50).filter(p=>p?.id).map(p=>this.setNotificationAsRead(p));yield Promise.all(m)}let r=JSON.parse(JSON.stringify(this.notificationsByDocumentIdMap$.getValue()||{}));e.forEach(a=>{let s=a.metadata?.documentId;if(s&&r?.[s]){let m=r?.[s]?.notifications||[],p=m.find(h=>h.id===a.id);p&&(p.isUnread=!1),r[s].notifications=m}}),this.notificationsByDocumentIdMap$.next(r)}}catch(i){this.loggingService.catch("Error in NotificationService setNotificationsAsRead: ",i)}})}setAllNotificationsAsRead(e){return Q(this,null,function*(){try{if(e?.tabId==="for-you"){let i=this.notificationsForYou$.value||[];this.setNotificationsAsRead(i)}else this.getNotifications$().pipe(tt(1)).subscribe(i=>{i&&this.setNotificationsAsRead(i)})}catch(i){this.loggingService.catch("Error in NotificationService setAllNotificationsAsRead: ",i)}})}getUnreadNotificationsCount$(){try{return this.notificationsForYou$.pipe(ce(e=>e?.filter(r=>r?.isUnread)?.length??null),he(e=>this.getNotifications$().pipe(ce(i=>{let r=i?.filter(a=>a?.isUnread)?.length??null;return{forYou:e,all:r}}))))}catch(e){return this.loggingService.catch("Error in NotificationService getUnreadNotificationsCount$: ",e),se({forYou:null,all:null})}}setNotificationAsRead(e){return Q(this,null,function*(){try{let i=this.authService.getUser();if(i&&e?.id){let r=Pt(i?.userId),{metadata:a}=e;if(a){let{apiKey:s,organizationId:m,documentId:p}=a;if(s&&m&&p&&r){let h=yield this.commonDbService.getData({feature:"docNotification",properties:{id:e.id,organizationId:m,documentId:p,apiKey:s}});h?.notificationId&&(h?.views?.[r]||(h.views||(h.views={}),h.views[r]={timestamp:Date.now()},this.commonDbService.updateData({feature:"docNotificationViews",properties:{id:e.id,organizationId:m,documentId:p,apiKey:s},data:h})));let _=yield this.commonDbService.getData({feature:"userNotification",properties:{id:e.id,userId:r,documentId:p,organizationId:m}});_?.notificationId&&(this.getReadNotificationsOnForYouTab()?_?.views?.[r]||(_.views||(_.views={}),_.views[r]={timestamp:Date.now()},this.commonDbService.updateData({feature:"userNotificationViews",properties:{id:e.id,userId:r,documentId:p,organizationId:m},data:_})):yield this.commonDbService.deleteData({feature:"userNotification",properties:{id:e.id,userId:r,documentId:p,organizationId:m}}))}}}}catch(i){this.loggingService.catch("Error in NotificationService setNotificationAsRead: ",i)}})}setMaxDays(e){try{e>0?this.maxNotificationDays$.next(e):this.maxNotificationDays$.next(15)}catch(i){this.loggingService.catch("Error in NotificationService setMaxDays: ",i)}}setTabConfig(e){try{e&&this.tabConfig$.next(e)}catch(i){this.loggingService.catch("Error in NotificationService setTabConfig: ",i)}}getTabConfig$(){return this.tabConfig$.asObservable()}getTabConfig(){return this.tabConfig$.value}enableReadNotificationsOnForYouTab(){this.readNotificationsOnForYouTab$.next(!0)}disableReadNotificationsOnForYouTab(){this.readNotificationsOnForYouTab$.next(!1)}getReadNotificationsOnForYouTab$(){return this.readNotificationsOnForYouTab$.asObservable()}getReadNotificationsOnForYouTab(){return this.readNotificationsOnForYouTab$.value}markNotificationAsReadById(e){return Q(this,null,function*(){try{this.getNotifications$().pipe(tt(1)).subscribe(i=>{if(i){let r=i.filter(a=>a.id===e);this.setNotificationsAsRead(r)}})}catch(i){this.loggingService.catch("Error in NotificationService markNotificationAsReadById: ",i)}})}getAllowedDocumentMetadataByDocumentId(e){try{return this.allowedDocumentMetadataMap$.value?.[e]||null}catch(i){return this.loggingService.catch("Error in NotificationService getAllowedDocumentMetadataByDocumentId: ",i),null}}setSettingsConfig(e){try{this.settingsConfig$.next(e)}catch(i){this.loggingService.catch("Error in NotificationService setSettingsConfig: ",i)}}setSettingsConfigWithDB(e){try{this.settingsConfig$.next(e),this.updateSettingsConfigToDb()}catch(i){this.loggingService.catch("Error in NotificationService setSettingsConfigWithDB: ",i)}}getSettingsConfig$(){return this.settingsConfig$.asObservable()}getSettingsConfig(){return this.settingsConfig$.value}setMuteAllNotifications(){try{this.muteAllNotifications$.value!==!0&&this.muteAllNotifications$.next(!0)}catch(e){this.loggingService.catch("Error in NotificationService setSettingsMuteAll: ",e)}}getMuteAllNotifications$(){return this.muteAllNotifications$.asObservable()}getMuteAllNotifications(){return this.muteAllNotifications$.value}enableSettings(){try{this.enableSettings$.value!==!0&&this.enableSettings$.next(!0)}catch(e){this.loggingService.catch("Error in NotificationService enableSettings: ",e)}}disableSettings(){try{this.enableSettings$.value!==!1&&this.enableSettings$.next(!1)}catch(e){this.loggingService.catch("Error in NotificationService disableSettings: ",e)}}getEnableSettings$(){return this.enableSettings$.asObservable()}getEnableSettings(){return this.enableSettings$.value}setSettingsInitialConfig(e){try{let i=!1;if(e.forEach(s=>{["email","inbox"].includes(s.id)&&(i=!s.values?.every(m=>["ALL","NONE","MINE"].includes(m.id)))}),i){this.loggingService.catch("Invalid config values for email or inbox, It should have only ALL, NONE, MINE values");return}this.settingsInitialConfig$.next(e);let r={};e.forEach(s=>{if(s.enable){let m=s?.values?.find(p=>p.id===s.default);r[s.id]=m||s?.values?.[0]||{id:"NONE",name:"None"}}});let a={};Object.keys(r).forEach(s=>{a[s]=r[s].id}),this.setSettingsConfig(a)}catch(i){this.loggingService.catch("Error in NotificationService setSettingsInitialConfig: ",i)}}getSettingsInitialConfig$(){return this.settingsInitialConfig$.asObservable()}getSettingsInitialConfig(){return this.settingsInitialConfig$.value}updateSettingsConfigToDb(e){return Q(this,null,function*(){try{let i=Pt(this.authService.getUser()?.userId??""),r=this.docService.getDocumentPaths(),a={apiKey:this.configService.getApiKey(),organizationId:r?.organizationId,documentId:r?.documentId,clientOrganizationId:r?.clientOrganizationId,clientDocumentId:r?.clientDocumentId,userId:i,clientUserId:this.authService.getUser()?.userId};i&&r?.documentId&&this.getEnableSettings()&&(yield this.commonDbService.updateData({feature:"userConfig",properties:{documentId:r.documentId,userId:i},data:{id:r.documentId,notificationsConfig:e||this.settingsConfig$.getValue(),metadata:a}}))}catch(i){this.loggingService.catch("Error in NotificationService updateSettingsConfigToDb: ",i)}})}};o.\u0275fac=function(i){return new(i||o)(J(bi),J(Ze),J(He),J(jt),J(Tn),J(t0),J(Jv),J(xs),J(hn),J(lt),J(Ne),J(fn),J(y),J(DM),J(Gn),J(jo))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var zo=(()=>{let o=class o{constructor(e){this.loggingService=e,this._customStatusMap=new Ce(j.CommentAnnotationStatusMap),this._customPriorityMap=new Ce(j.CommentAnnotationPriorityMap),this._customCategoryMap=new Ce(j.CommentCategoryMap);try{let i=sessionStorage.getItem(j.SESSION_STORAGE.VELT_CUSTOM_PRIORITY_MAP);i&&this._customPriorityMap.next(JSON.parse(i));let r=sessionStorage.getItem(j.SESSION_STORAGE.VELT_CUSTOM_STATUS_MAP);r&&this._customStatusMap.next(JSON.parse(r));let a=sessionStorage.getItem(j.SESSION_STORAGE.VELT_CUSTOM_CATEGORY_MAP);a&&this._customCategoryMap.next(JSON.parse(a))}catch(i){this.loggingService.catch("Error in CustomFilterService constructor: ",i)}}setCustomStatusFilters(e){try{if(e.length<2){this._customStatusMap.next(j.CommentAnnotationStatusMap),sessionStorage.setItem(j.SESSION_STORAGE.VELT_CUSTOM_STATUS_MAP,JSON.stringify(j.CommentAnnotationStatusMap)),this.loggingService.catch("Custom status filters must have at least 2 filters");return}let i={};e.forEach(r=>{i[r.id]=r,r.type||(r.type="ongoing")}),this._customStatusMap.next(i),sessionStorage.setItem(j.SESSION_STORAGE.VELT_CUSTOM_STATUS_MAP,JSON.stringify(i))}catch(i){this.loggingService.catch("Error in CustomFilterService setCustomStatusFilters: ",i)}}setCustomPriorityFilters(e){try{if(e.length<2){this._customPriorityMap.next(j.CommentAnnotationPriorityMap),sessionStorage.setItem(j.SESSION_STORAGE.VELT_CUSTOM_PRIORITY_MAP,JSON.stringify(j.CommentAnnotationPriorityMap)),this.loggingService.catch("Custom priority filters must have at least 2 filters");return}let i={};e.forEach(r=>{i[r.id]=r}),this._customPriorityMap.next(i),sessionStorage.setItem(j.SESSION_STORAGE.VELT_CUSTOM_PRIORITY_MAP,JSON.stringify(i))}catch(i){this.loggingService.catch("Error in CustomFilterService setCustomPriorityFilters: ",i)}}setCustomCategories(e){try{let i={};e.forEach(r=>{i[r.id]=r}),this._customCategoryMap.next(i),sessionStorage.setItem(j.SESSION_STORAGE.VELT_CUSTOM_CATEGORY_MAP,JSON.stringify(i))}catch(i){this.loggingService.catch("Error in CustomFilterService setCustomCategories: ",i)}}get customStatusMap$(){return this._customStatusMap.asObservable()}get customPriorityMap$(){return this._customPriorityMap.asObservable()}get customCategoryMap$(){return this._customCategoryMap.asObservable()}get defaultStatus(){try{let i=Object.entries(this._customStatusMap.value).find(([r,a])=>a.type==="default");if(i)return i[1]}catch(e){this.loggingService.catch("Error in CustomFilterService defaultStatus: ",e)}return j.CommentAnnotationStatusMap.OPEN}get resolvedStatus(){try{let i=Object.entries(this._customStatusMap.value).find(([r,a])=>a.type==="terminal");if(i)return i[1]}catch(e){this.loggingService.catch("Error in CustomFilterService resolvedStatus: ",e)}return j.CommentAnnotationStatusMap.OPEN}get ongoingStatuses(){try{let i=Object.entries(this._customStatusMap.value).filter(([r,a])=>a.type==="ongoing");if(i)return i.map(r=>r[1])}catch(e){this.loggingService.catch("Error in CustomFilterService ongoingStatuses: ",e)}return[j.CommentAnnotationStatusMap.IN_PROGRESS]}convertLegacyAnnotationStatus(e){try{if(typeof e.status=="string"||e.status===void 0){let i=Object.entries(this._customStatusMap.value),r=i.find(([a,s])=>s.type==="default");switch(e.status){case"open":r&&(e.status=r[1]);break;case"inProgress":let a=i.find(([m,p])=>p.type==="ongoing");a&&(e.status=a[1]);break;case"resolved":let s=i.find(([m,p])=>p.type==="terminal");s&&(e.status=s[1]);break;default:r&&(e.status=r[1]);break}}return e}catch(i){return this.loggingService.catch("Error in CustomFilterService convertLegacyAnnotation: ",i),e}}convertLegacyPriority(e){try{typeof e.priority=="string"&&(e.priority=j.CommentAnnotationPriorityMap[e.priority])}catch(i){this.loggingService.catch("Error in CustomFilterService convertLegacyPriority: ",i)}return e}convertLegacyCategory(e){try{if(e.commentCategories===void 0||e.commentCategories===null||!Array.isArray(e.commentCategories)||e.commentCategories.length===0)return e;typeof e.commentCategories[0]=="string"&&(e.commentCategories=e.commentCategories.map(i=>j.CommentCategoryMap[i]))}catch(i){this.loggingService.catch("Error in CustomFilterService convertLegacyCategory: ",i)}return e}};o.\u0275fac=function(i){return new(i||o)(J(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var wc=(()=>{let o=class o{constructor(e,i,r){this.domService=e,this.loggingService=i,this.sanitizer=r,this.emojis={};try{this.loggingService.log("%c[WB] Creating CLASS: EmojiService","color: blue;"),Object.keys(o.Icons).forEach(a=>{let s=o.Icons[a];this.emojis[a]=this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeSvg(s))}),Object.keys(o.GIF_PATHS).forEach(a=>{let s=`<img src="${o.GIF_PATHS[a]}" alt="${a}" />`;this.emojis[a]=this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeHtml(s))})}catch(a){this.loggingService.catch("Error in EmojiService constructor: ",a)}}getEmoji(e){try{return this.emojis[e]}catch{return""}}getEmojiFromIconUrl(e){try{return this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeHtml(`<img src="${e}" alt="emoji" />`))}catch{return""}}getEmojiFromIconEmoji(e,i){try{let r=`<span class="velt-emoji-icon velt-emoji-icon--emoji">${e}</span>`;return i&&(r=`<span class="velt-emoji-icon velt-emoji-icon--emoji" emoji-id=${i}>${e}</span>`),this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeHtml(r))}catch{return""}}setEmojiList(e){try{this.emojis={},Object.keys(e).forEach(i=>{let r=e[i];if(r.svg)this.emojis[i]=this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeSvg(r.svg));else if(r.url){let a=`<img src="${r.url}" alt="${i}" />`;this.emojis[i]=this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeHtml(a))}else r.emoji&&(this.emojis[i]=this.getEmojiFromIconEmoji(this.domService.sanitizeHtml(r.emoji)))})}catch(i){this.loggingService.catch("Error in EmojiService setEmojiList: ",i)}}};o.Icons={RAISED_HANDS:`<svg width="58" height="57" viewBox="0 0 58 57" fill="none" xmlns="http://www.w3.org/2000/svg">
195
+ `+Pr),kc&&yM([Be,xe,wn],Os=>{Pr=mb(Pr,Os," ")}),Le&&Cg?Le.createHTML(Pr):Pr},o.setConfig=function(){let Yt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Km(Yt),vg=!0},o.clearConfig=function(){Ym=null,vg=!1},o.isValidAttribute=function(Yt,Ve,It){Ym||Km({});let Gt=Co(Yt),io=Co(Ve);return S_(Gt,io,It)},o.addHook=function(Yt,Ve){typeof Ve=="function"&&cb(fe[Yt],Ve)},o.removeHook=function(Yt,Ve){if(Ve!==void 0){let It=C7e(fe[Yt],Ve);return It===-1?void 0:_7e(fe[Yt],It,1)[0]}return lle(fe[Yt])},o.removeHooks=function(Yt){fe[Yt]=[]},o.removeAllHooks=function(){fe=hle()},o}var hH=yle();var Sle={ADD_TAGS:["velt-skeleton-loader"],ADD_ATTR:["border-radius"]},Ne=(()=>{let o=class o{constructor(e,i,r){this.rendererFactory2=e,this.loggingService=i,this.sanitizer=r,this.isVideoEditorHandlingDelete=!1,this.pageScrollHeight=0,this.enableRectSelectionSubject$=new Ce(!1),this.enableRectSelection$=this.enableRectSelectionSubject$.asObservable(),this.scrollableElementsIds$=new Ce([]),this.mousedown=!1,this.windowMouseDown$=new Ke,this.windowPointerMove$=new Ce(null),this.windowPointerUp$=new Ce(null),this.documentSelectionChange$=new Ce(null),this.windowClick$=new Ce(null),this.windowScroll$=new Ce(null),this.windowResize$=new Ce(null),this.windowKeyupBackspace$=new Ce(null),this.windowKeyupDelete$=new Ce(null),this.windowKeyupEsc$=new Ce(null),this.windowPopState$=new Ce(null),this.documentClick$=new Ce(null),this.documentClickSubject$=new Ke,this.documentFocus$=new Ce(null),this.windowKeydownShift$=new Ce(null),this.windowKeyupShift$=new Ce(null),this.mutation$=new Ce(null),this.childListMutation$=new Ce(null),this.networkStatus$=new Ce(!1),this.xpathCache=new Map,this.xpathCacheId=new Map,this.selectedAnnotationsMap$=new Ce({}),this.selectedAnnotationsLocationMap$=new Ce({}),this.recordingInProgress$=new Ce({}),this.deleteAnnotations$=new Ce([]),this.pinHighlighterClass$=new Ce(null),this.dialogOpenedInSidebar$=new Ce(!1),this.textHighlighterClass$=new Ce(null),this.commentPinHighlighter$=new Ce(!1),this.deviceInfo$=new Ce(new ei),this.customCss$=new Ce(null),this.mutationObserver=null,this.previousMousePosition={pageX:0,pageY:0,clientX:0,clientY:0},this.currentMousePosition={pageX:0,pageY:0,clientX:0,clientY:0,element:{xpath:"",topPercentage:0,leftPercentage:0}},this.nodeMap={},this.unlistenElementScroll={},this.filterSnippylyNodes=a=>{try{let s=[];return a.forEach(m=>{if(!zi(m))if(m instanceof HTMLElement){if(m.className.includes("cdk-overlay-container")||m.className.includes("cdk-overlay-connected-position-bounding-box"))return;if(m.className.includes("cdk-overlay")){let p=!1;m.childNodes.forEach(h=>{zi(h)&&(p=!0)}),p||s.push(m)}else s.push(m)}else s.push(m)}),s}catch(s){return this.loggingService.catch("Error in DomService filterSnippylyNodes: ",s),[]}},this.loggingService.log("%c[WB] Creating CLASS: DomService","color: blue;");try{this.renderer=this.rendererFactory2.createRenderer(null,null);let a=this.calculateScreenSize();this.currentScreenSize$=new Ce(a),this.currentMousePosition$=new Ce(this.currentMousePosition),this.detectNetworkStatusChange(),this.getScrollableElementsIds$().pipe(Pi(),gn(([s,m])=>{try{let p=m.filter(_=>!s.includes(_)),h=s.filter(_=>!m.includes(_));h.length&&h.map(E=>document.getElementById(E)).filter(E=>E).forEach(E=>{this.unlistenElementScroll&&this.unlistenElementScroll[E.id]&&this.unlistenElementScroll[E.id]()}),p.length&&p.map(E=>document.getElementById(E)).filter(E=>E).forEach(E=>{this.unlistenElementScroll[E.id]=this.renderer.listen(E,"scroll",D=>{let L=this.calculateScreenSize();this.currentScreenSize$.next(L)})})}catch(p){this.loggingService.catch("Error in DomService getScrollableElementsIds subscription: ",p)}})).subscribe(()=>{},s=>{this.loggingService.catch("Error in DomService getScrollableElementsIds subscription: ",s)}),this.getSelectedAnnotationsMap$().subscribe(s=>{Object.keys(s||{})?.length?Joe("snippylyUserScalableNo","viewport","width=device-width, user-scalable=no"):ere("snippylyUserScalableNo")},s=>{this.loggingService.catch("Error in DomService getSelectedAnnotationsMap$ subscription: ",s)})}catch(a){this.loggingService.catch("Error in DomService constructor: ",a)}}setDocService(e){try{this.docService=e,this.subscribeToDomEvents()}catch(i){this.loggingService.catch("Error in DomService setDocService: ",i)}}subscribeToDomEvents(){try{this.docService?.getDocumentPaths$().pipe(ce(e=>{e?(this.onWindowResize(),this.onWindowScroll(),this.onPointerDown(),this.onWindowClick(),this.onWindowKeyupBackspace(),this.onWindowKeyupDelete(),this.onWindowKeyupEsc(),this.onWindowPopState(),this.onWindowKeydownShift(),this.onWindowKeyupShift(),this.addPointerMoveListener(),this.addPointerUpListener(),this.addSelectionChangeListener(),this.onDocumentClick(),this.onDocumentFocus()):(this.unsubscribeFromWindowResize(),this.unsubscribeFromWindowScroll(),this.unsubscribeFromPointerDown(),this.unsubscribeFromWindowClick(),this.unsubscribeFromWindowKeyupBackspace(),this.unsubscribeFromWindowKeyupDelete(),this.unsubscribeFromWindowKeyupEsc(),this.unsubscribeFromWindowPopState(),this.unsubscribeFromWindowKeydownShift(),this.unsubscribeFromWindowKeyupShift(),this.unsubscribeFromPointerMoveListener(),this.unsubscribeFromPointerUpListener(),this.unsubscribeFromSelectionChangeListener(),this.unsubscribeFromDocumentClick(),this.unsubscribeFromDocumentFocus(),this.unsetMutationObserver())})).subscribe()}catch(e){this.loggingService.catch("Error in DomService subscribeToDomEvents: ",e)}}setScrollableElementsIds(e){try{e&&e.length&&this.scrollableElementsIds$.next(Array.from(new Set(e)))}catch(i){this.loggingService.catch("Error in DomService setScrollableElementsIds: ",i)}}getScrollableElementsIds$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getScrollableElementsIds$","color: green;"),this.scrollableElementsIds$.asObservable()}removeScrollableElementsIds(){this.scrollableElementsIds$.next([])}setMutationObserver(e){try{this.mutationObserver||(this.loggingService.log("%c[WB] Calling DomService FUNCTION: setMutationObserver","color: green;"),this.loggingService.log("%c[WB] setMutationObserver from: "+e,"color: green;"),this.mutationObserver=new MutationObserver(i=>{try{if(i?.find(a=>a?.attributeName===j.VELT_IGNORE_CHANGE_DETECTION))return;let r=i.filter(a=>a.type==="childList").filter(a=>{let s=a.target;return a.removedNodes.forEach(m=>{let p=m;if(typeof p.getAttribute=="function"){let h=p.getAttribute(j.ATTRIBUTES.VELT_ELEMENT_CACHE_ID);if(h!==null&&h!==""){let _=this.xpathCacheId.get(h);_!==void 0&&(this.xpathCacheId.delete(h),this.xpathCache.delete(_))}}}),zi(s)?!1:!!(this.filterSnippylyNodes(a.addedNodes).length||this.filterSnippylyNodes(a.removedNodes).length)});this.childListMutation$.next(r),r.push(...i.filter(a=>a.type==="attributes").filter(a=>!zi(a.target)).filter(a=>this.filterSnippylyNodes([a.target]).length).filter(a=>{if(a){let s=a.target;return s?.classList?.contains("snippyly-sidebar-panel")?!1:s?!s.getAttribute(j.VELT_IGNORE_CHANGE_DETECTION):!0}return!0})),r=r.filter(a=>{let s=!0;return Object.keys(j.INGNORE_MUTATION_OBSERVER_CHANGE_TAGS).forEach(m=>{a.target?.closest(m)&&(s=!1)}),s}),r=r.filter(a=>a.target&&Do(a.target)),r.length&&this.mutation$.next(r)}catch(r){this.loggingService.catch("Error in DomService change detection: ",r)}}),this.mutationObserver.observe(document.body,{childList:!0,subtree:!0,attributes:!0}))}catch(i){this.loggingService.catch("Error in DomService change detection: ",i)}}unsetMutationObserver(){try{this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=null)}catch(e){this.loggingService.catch("Error in DomService unsetMutationObserver: ",e)}}detectNetworkStatusChange(){this.loggingService.log("%c[WB] Calling FUNCTION: detectNetworkStatusChange","color: green;");try{ro(ri(window,"offline").pipe(ce(()=>!1)),ri(window,"online").pipe(ce(()=>!0)),new Lt(e=>{e.next(navigator.onLine),e.complete()})).subscribe(e=>{this.networkStatus$.next(e)})}catch(e){this.loggingService.catch("Error in DomService detectNetworkStatusChange: ",e)}}onWindowResize(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowResize","color: green;");try{this.unsubscribeFromWindowResize(),this.unlistenWindowResize=this.renderer.listen("window","resize",e=>{this.windowResize$.next(e);let i=this.calculateScreenSize();this.deviceInfo$.next(new ei),this.currentScreenSize$.next(i)})}catch(e){this.loggingService.catch("Error in DomService onWindowResize: ",e)}}unsubscribeFromWindowResize(){try{this.unlistenWindowResize&&typeof this.unlistenWindowResize=="function"&&(this.unlistenWindowResize(),this.unlistenWindowResize=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowResize: ",e)}}onWindowScroll(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowScroll","color: green;");try{this.unsubscribeFromWindowScroll(),this.unlistenWindowScroll=this.renderer.listen("window","scroll",e=>{this.windowScroll$.next(e);let i=this.calculateScreenSize();this.currentScreenSize$.next(i)})}catch(e){this.loggingService.catch("Error in DomService onWindowScroll: ",e)}}unsubscribeFromWindowScroll(){try{this.unlistenWindowScroll&&typeof this.unlistenWindowScroll=="function"&&(this.unlistenWindowScroll(),this.unlistenWindowScroll=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowScroll: ",e)}}onPointerDown(){this.loggingService.log("%c[WB] Calling FUNCTION: onPointerDown","color: green;");try{this.unsubscribeFromPointerDown(),this.unlistenPointerDown=this.renderer.listen("window","pointerdown",e=>{this.mousedown=!0,this.windowMouseDown$.next(e),this.setPointerPosition(e)})}catch(e){this.loggingService.catch("Error in DomService onPointerDown: ",e)}}unsubscribeFromPointerDown(){try{this.unlistenPointerDown&&typeof this.unlistenPointerDown=="function"&&(this.unlistenPointerDown(),this.unlistenPointerDown=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromPointerDown: ",e)}}onWindowClick(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeyupBackspace","color: green;");try{this.unsubscribeFromWindowClick(),this.unlistenWindowClick=this.renderer.listen("window","click",e=>{this.windowClick$.next(e)})}catch(e){this.loggingService.catch("Error in DomService onWindowClick: ",e)}}unsubscribeFromWindowClick(){try{this.unlistenWindowClick&&typeof this.unlistenWindowClick=="function"&&(this.unlistenWindowClick(),this.unlistenWindowClick=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowClick: ",e)}}onWindowKeyupBackspace(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeyupBackspace","color: green;");try{this.unsubscribeFromWindowKeyupBackspace(),this.unlistenWindowKeyupBackspace=this.renderer.listen("window","keyup.backspace",e=>{this.isVideoEditorHandlingDelete||this.windowKeyupBackspace$.next(e)})}catch(e){this.loggingService.catch("Error in DomService onWindowKeyupBackspace: ",e)}}unsubscribeFromWindowKeyupBackspace(){try{this.unlistenWindowKeyupBackspace&&typeof this.unlistenWindowKeyupBackspace=="function"&&(this.unlistenWindowKeyupBackspace(),this.unlistenWindowKeyupBackspace=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeyupBackspace: ",e)}}onWindowKeyupDelete(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeyupDelete","color: green;");try{this.unsubscribeFromWindowKeyupDelete(),this.unlistenWindowKeyupDelete=this.renderer.listen("window","keyup.delete",e=>{this.isVideoEditorHandlingDelete||this.windowKeyupDelete$.next(e)})}catch(e){this.loggingService.catch("Error in DomService onWindowKeyupDelete: ",e)}}unsubscribeFromWindowKeyupDelete(){try{this.unlistenWindowKeyupDelete&&typeof this.unlistenWindowKeyupDelete=="function"&&(this.unlistenWindowKeyupDelete(),this.unlistenWindowKeyupDelete=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeyupDelete: ",e)}}onWindowKeyupEsc(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeyupEsc","color: green;");try{this.unsubscribeFromWindowKeyupEsc(),this.unlistenWindowKeyupEsc=this.renderer.listen("window","keyup.esc",e=>{this.windowKeyupEsc$.next(e)})}catch(e){this.loggingService.catch("Error in DomService onWindowKeyupEsc: ",e)}}unsubscribeFromWindowKeyupEsc(){try{this.unlistenWindowKeyupEsc&&typeof this.unlistenWindowKeyupEsc=="function"&&(this.unlistenWindowKeyupEsc(),this.unlistenWindowKeyupEsc=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeyupEsc: ",e)}}onWindowPopState(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowPopState","color: green;");try{this.unsubscribeFromWindowPopState(),this.unlistenWindowPopState=this.renderer.listen("window","popstate",e=>{this.windowPopState$.next(e)})}catch(e){this.loggingService.catch("Error in DomService onWindowPopState: ",e)}}unsubscribeFromWindowPopState(){try{this.unlistenWindowPopState&&typeof this.unlistenWindowPopState=="function"&&(this.unlistenWindowPopState(),this.unlistenWindowPopState=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowPopState: ",e)}}onDocumentClick(){this.loggingService.log("%c[WB] Calling FUNCTION: onDocumentClick","color: green;");try{this.unsubscribeFromDocumentClick(),this.documentClickListener=e=>{e?.target?.tagName?.toLowerCase()!==j.TAGS.SUPERFLOW_TOOLBAR&&(this.documentClick$.next(e),this.documentClickSubject$.next(e))},document.addEventListener("click",this.documentClickListener,!0)}catch(e){this.loggingService.catch("Error in DomService onDocumentClick: ",e)}}unsubscribeFromDocumentClick(){try{this.documentClickListener&&typeof this.documentClickListener=="function"&&(document.removeEventListener("click",this.documentClickListener,!0),this.documentClickListener=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromDocumentClick: ",e)}}onDocumentFocus(){this.loggingService.log("%c[WB] Calling FUNCTION: onDocumentFocus","color: green;");try{this.unsubscribeFromDocumentFocus(),this.documentFocusListener=e=>{this.documentFocus$.next(e)},document.addEventListener("focus",this.documentFocusListener,!0)}catch(e){this.loggingService.catch("Error in DomService onDocumentFocus: ",e)}}unsubscribeFromDocumentFocus(){try{this.documentFocusListener&&typeof this.documentFocusListener=="function"&&(document.removeEventListener("focus",this.documentFocusListener,!0),this.documentFocusListener=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromDocumentFocus: ",e)}}onWindowKeydownShift(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeydownShift","color: green;");try{this.unsubscribeFromWindowKeydownShift(),this.unlistenWindowKeydownShift=this.renderer.listen("window","keydown.shift",e=>{this.windowKeydownShift$.next(e),this.windowKeyupShift$.next(null)})}catch(e){this.loggingService.catch("Error in DomService onWindowKeydownShift: ",e)}}unsubscribeFromWindowKeydownShift(){try{this.unlistenWindowKeydownShift&&typeof this.unlistenWindowKeydownShift=="function"&&(this.unlistenWindowKeydownShift(),this.unlistenWindowKeydownShift=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeydownShift: ",e)}}onWindowKeyupShift(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeyupShift","color: green;");try{this.unsubscribeFromWindowKeyupShift(),this.unlistenWindowKeyupShift=this.renderer.listen("window","keyup.shift",e=>{this.windowKeyupShift$.next(e),this.windowKeydownShift$.next(null)})}catch(e){this.loggingService.catch("Error in DomService onWindowKeyupShift: ",e)}}unsubscribeFromWindowKeyupShift(){try{this.unlistenWindowKeyupShift&&typeof this.unlistenWindowKeyupShift=="function"&&(this.unlistenWindowKeyupShift(),this.unlistenWindowKeyupShift=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeyupShift: ",e)}}onWindowKeydown$(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeydown$","color: green;");try{return ri(window,"keydown")}catch(e){return this.loggingService.catch("Error in DomService onWindowKeydown$: ",e),Pg}}addPointerMoveListener(){this.loggingService.log("%c[WB] Calling FUNCTION: addPointerMoveListener","color: green;");try{this.unsubscribeFromPointerMoveListener(),this.unlistenPointerMoveListener=this.renderer.listen("document","pointermove",e=>{this.windowPointerMove$.next(e),this.mouseMoveEvent=e})}catch(e){this.loggingService.catch("Error in DomService addPointerMoveListener: ",e)}}unsubscribeFromPointerMoveListener(){try{this.unlistenPointerMoveListener&&typeof this.unlistenPointerMoveListener=="function"&&(this.unlistenPointerMoveListener(),this.unlistenPointerMoveListener=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromPointerMoveListener: ",e)}}addPointerUpListener(){this.loggingService.log("%c[WB] Calling FUNCTION: addPointerUpListener","color: green;");try{this.unsubscribeFromPointerUpListener(),this.unlistenPointerUpListener=this.renderer.listen("document","pointerup",e=>{this.windowPointerUp$.next(e)})}catch(e){this.loggingService.catch("Error in DomService addPointerUpListener: ",e)}}unsubscribeFromPointerUpListener(){try{this.unlistenPointerUpListener&&typeof this.unlistenPointerUpListener=="function"&&(this.unlistenPointerUpListener(),this.unlistenPointerUpListener=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromPointerUpListener: ",e)}}addSelectionChangeListener(){this.loggingService.log("%c[WB] Calling FUNCTION: addPointerUpListener","color: green;");try{this.unsubscribeFromSelectionChangeListener(),this.unlistenSelectionChangeListener=this.renderer.listen("document","selectionchange",e=>{this.documentSelectionChange$.next(e)})}catch(e){this.loggingService.catch("Error in DomService addPointerUpListener: ",e)}}unsubscribeFromSelectionChangeListener(){try{this.unlistenSelectionChangeListener&&typeof this.unlistenSelectionChangeListener=="function"&&(this.unlistenSelectionChangeListener(),this.unlistenSelectionChangeListener=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromSelectionChangeListener: ",e)}}updateCurrentMousePosition(e){try{if(this.currentMousePosition.pageX=e.pageX,this.currentMousePosition.pageY=e.pageY,this.currentMousePosition.clientX=e.clientX,this.currentMousePosition.clientY=e.clientY,e.target){let i=this.getXPath(e.target),r=e.target;if(i?.includes("name()='svg'")){let _=this.getXPath(i);_&&(r=_.iterateNext()||e.target)}let a=r.getBoundingClientRect(),s=e.clientX-a.x,m=e.clientY-a.y,p=s*100/(a.width||1),h=m*100/(a.height||1);this.currentMousePosition.element={xpath:i,topPercentage:h,leftPercentage:p}}else this.currentMousePosition.element=null;this.currentMousePosition$.next(this.currentMousePosition)}catch(i){this.loggingService.catch("Error in DomService updateCurrentMousePosition: ",i)}}getTargetElementForCursorPosition(e,i=!0,r=!1,a=!0,s){try{let m=e,p=m?.touches?.length?m.touches[0]?.clientX:m.clientX,h=m?.touches?.length?m.touches[0]?.clientY:m.clientY,_=this.getBackgroundElement(p,h,i,r);if(_&&s&&typeof s=="function"&&(_=s(_)),_){let E=this.getXPath(_),D=this.getXPath(_,!0),L=_.getBoundingClientRect(),H=p-L.x,K=h-L.y,oe=H*100/(L.width||1),ue=K*100/(L.height||1),be={xpath:E,fXpath:D,leftPercentage:oe,topPercentage:ue};if(a){let Le=this.getXPath(_,!0,!0);be.cfXpath=Le}return be}else return null}catch(m){return this.loggingService.catch("Error in DomService getTargetElementForCommentPinAnnotation: ",m),null}}getBackgroundElement(e,i,r=!0,a=!1){try{let s=document.elementsFromPoint(e,i),m=[];s.forEach(h=>{zi(h)?m=[]:Do(h)&&m.push(h)}),a&&(m=m.filter(h=>this.isElementVisibleOnScreen(h)));let p=0;return r||m?.forEach((h,_)=>{h.tagName.toLowerCase()==="svg"&&(p=_)}),m[p]}catch(s){return this.loggingService.catch("Error in DomService getBackgroundElement: ",s),null}}getBackgroundVeltElement(e,i){try{let r=document.elementsFromPoint(e,i),a=[];return r.forEach(s=>{zi(s)&&Do(s)&&a.push(s)}),a[0]}catch(r){return this.loggingService.catch("Error in DomService getBackgroundSnippylyElement: ",r),null}}setPointerPosition(e){this.loggingService.log("%c[WB] Calling FUNCTION: setPointerPosition","color: green;");try{this.previousMousePosition.pageX=e.pageX,this.previousMousePosition.pageY=e.pageY,this.currentMousePosition.pageX=e.pageX,this.currentMousePosition.pageY=e.pageY}catch(i){this.loggingService.catch("Error in DomService setPointerPosition: ",i)}}getCurrentWindowSize$(e){return this.loggingService.log("%c[WB] Calling FUNCTION: getCurrentWindowSize","color: green;"),this.currentScreenSize$.asObservable()}getCurrentMousePosition$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getCurrentMousePosition","color: green;"),this.currentMousePosition$.asObservable()}getCurrentWindowSizeValue(){return this.loggingService.log("%c[WB] Calling FUNCTION: getCurrentWindowSizeValue","color: green;"),this.currentScreenSize$.value}getTopLeftPosition(){this.loggingService.log("%c[WB] Calling FUNCTION: getTopLeftPosition","color: green;");try{let e=document?.body?.getBoundingClientRect()||document?.documentElement?.getBoundingClientRect(),i=this.currentMousePosition?.pageX||e.x+200,r=Math.min(i,e.width/2),a=Math.abs(e.y),s=e.y-20;return a>50&&(s=Math.abs(e.y)+180),this.loggingService.log(e),this.loggingService.log(r),this.loggingService.log(s),{topPositionX:r,topPositionY:s}}catch(e){return this.loggingService.catch("Error in DomService getTopLeftPosition: ",e),{topPositionX:0,topPositionY:0}}}toggleSelection(){this.enableRectSelectionSubject$.next(!this.enableRectSelectionSubject$.value)}enableSelection(){this.enableRectSelectionSubject$.next(!0)}disableSelection(){this.enableRectSelectionSubject$.next(!1)}setPinHighlighterClass(e){this.pinHighlighterClass$.next(e)}setTextHighlighterClass(e){this.textHighlighterClass$.next(e)}getTextHighlighterClass(){return this.textHighlighterClass$.asObservable()}enableCommentPinHighlighter(){this.commentPinHighlighter$.next(!0)}disableCommentPinHighlighter(){this.commentPinHighlighter$.next(!1)}getCommentPinHighlighter$(){return this.commentPinHighlighter$.asObservable()}getCommentPinHighlighter(){return this.commentPinHighlighter$?.value}highlightElement(e,i,r){if(e){if(!r&&this.getCommentPinHighlighter()&&(this.pinHighlighterClass$.value?this.addClassToElement(e,this.pinHighlighterClass$.value):this.addClassToElement(e,j.SNIPPYLY_HIGHLIGHT)),i&&!e.hasAttribute(j.ATTRIBUTES.DEFAULT_CURSOR)){let a=e.style.getPropertyValue("cursor"),s=e.style.getPropertyPriority("cursor"),m=a?{defaultCursorValue:a,defaultCursorPriority:s}:"";e.setAttribute(j.ATTRIBUTES.DEFAULT_CURSOR,m?JSON.stringify(m):""),e.style.setProperty("cursor",i,"important")}e.setAttribute(j.SNIPPYLY_HIGHLIGHT,"true"),e.setAttribute(j.VELT_IGNORE_CHANGE_DETECTION,"true")}}removeHighlightFromElement(e){if(e&&(this.pinHighlighterClass$.value&&this.removeClassFromElement(e,this.pinHighlighterClass$.value),this.removeClassFromElement(e,j.SNIPPYLY_HIGHLIGHT),e.removeAttribute(j.SNIPPYLY_HIGHLIGHT),e.removeAttribute(j.VELT_IGNORE_CHANGE_DETECTION),e.hasAttribute(j.ATTRIBUTES.DEFAULT_CURSOR))){try{if(e.style.removeProperty("cursor"),e.getAttribute(j.ATTRIBUTES.DEFAULT_CURSOR)){let i=JSON.parse(e.getAttribute(j.ATTRIBUTES.DEFAULT_CURSOR));e.style.setProperty("cursor",i.defaultCursorValue,i.defaultCursorPriority)}}catch{}e.removeAttribute(j.ATTRIBUTES.DEFAULT_CURSOR)}}highlightUserElement(e,i,r,a=!1){try{e&&(this.addClassToElement(e,j.VELT_LIVE_SELECTION_ON_ELEMENT),a&&this.addClassToElement(e,j.VELT_LIVE_SELECTION_ON_ELEMENT_DEFAULT),e.setAttribute(j.SNIPPYLY_HIGHLIGHT,"true"),e.setAttribute(j.VELT_IGNORE_CHANGE_DETECTION,"true"),i&&!e.style.getPropertyValue(j.VELT_SELECTION_COLOR)&&e.style.setProperty(j.VELT_SELECTION_COLOR,i),r&&e.setAttribute(j.SNIPPYLY_HIGHLIGHT_USER_NAME,r))}catch(s){this.loggingService.catch("Error in DomService highlightUserElement: ",s)}}removeHighlightUserFromElement(e){try{e&&(this.removeClassFromElement(e,j.VELT_LIVE_SELECTION_ON_ELEMENT),this.removeClassFromElement(e,j.VELT_LIVE_SELECTION_ON_ELEMENT_DEFAULT),e.removeAttribute(j.SNIPPYLY_HIGHLIGHT),e.removeAttribute(j.VELT_IGNORE_CHANGE_DETECTION),e.removeAttribute(j.VELT_SELECTION_COLOR),e.removeAttribute(j.SNIPPYLY_HIGHLIGHT_USER_NAME),e.style.removeProperty(j.VELT_SELECTION_COLOR))}catch(i){this.loggingService.catch("Error in DomService removeHighlightUserFromElement: ",i)}}previewHighlightElement(e){e&&e.setAttribute(j.SNIPPYLY_HIGHLIGHT_PREVIEW,"true")}removePreviewHighlightFromElement(e){e&&e.removeAttribute(j.SNIPPYLY_HIGHLIGHT_PREVIEW)}getXPath(e,i=!1,r=!1,a){try{let s=this.calculateXPath(e,i,r,a);if(s&&typeof s=="string"&&s.includes("/svg")){let m=s.split("/"),p=!1;m.forEach((h,_)=>{h.includes("svg")&&(p=!0),p&&(m[_]="svg:"+h)}),s=m.join("/")}return s}catch(s){this.loggingService.catch("Error in DomService getXPath:",s)}}namespaceResolver(e){return e==="svg"?"http://www.w3.org/2000/svg":null}calculateXPath(e,i,r,a){try{if(e){if(typeof e=="string")return document.evaluate(e,a||document,this.namespaceResolver,XPathResult.ANY_TYPE,null);if(!e||e.nodeType!=1)return"";if(e.id&&document.querySelectorAll(`[id='${e.id}']`)?.length===1&&!i)return"//*[@id='"+e.id+"']";if(r&&e.className&&e.className.split){let m=e.className?.split(" ")?.filter(p=>!p?.includes("snippyly")&&!p?.includes("velt")&&!["show-pin-cursor"].includes(p))[0];if(m){let p=this.calculateXPath(e.parentNode,i,r,a)+"/"+e.tagName.toLowerCase(),h=Array.from(e.parentNode?.children||[]).filter(_=>_.nodeType===1&&_.tagName===e.tagName?_.className?.split(" ")?.filter(D=>D?.includes("snippyly")||D?.includes("velt")||["show-pin-cursor"].includes(D))[0]===m:!1);if(h.length>1){let _=h.indexOf(e)+1;p+=`[contains(concat(' ', normalize-space(@class), ' '), ' ${m} ')][${_}]`}else p+=`[contains(concat(' ', normalize-space(@class), ' '), ' ${m} ')]`;return p}}let s=[].filter.call(e.parentNode?.children?e.parentNode?.children:[],function(m){return m.tagName==e.tagName});return this.calculateXPath(e.parentNode,i,r)+"/"+e.tagName.toLowerCase()+(s.length>1?"["+([].indexOf.call(s,e)+1)+"]":"")}}catch(s){this.loggingService.catch("Error in DomService calculateXPath:",s)}}getElementFromXPath(e,i=document){try{if(this.xpathCache.has(e)){let a=this.xpathCache.get(e);if(a!==void 0&&document.contains(a))return a;this.xpathCache.delete(e)}let r=this.getXPath(e,!1,!1,i);if(r){let a=r?.iterateNext();if(a!==null&&typeof a.setAttribute=="function"){let s=Pn();a.setAttribute(j.ATTRIBUTES.VELT_ELEMENT_CACHE_ID,s),this.xpathCacheId.set(s,e)}return this.xpathCache.set(e,a),a}return null}catch(r){return this.loggingService.catch("Error in DomService getElementFromXPath:",r),null}}calculateScreenSize(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowResize","color: green;");try{let e=[document?.body?.clientHeight||0,document?.documentElement?.clientHeight||0,window?.innerHeight||0],i=[document?.body?.clientWidth||0,document?.documentElement?.clientWidth||0,window?.innerWidth||0];this.calculatePageScrollHeight(),this.loggingService.log(this.pageScrollHeight),this.loggingService.log(this.nodeMap),this.highestNode=this.nodeMap[this.pageScrollHeight];let r=new ob;return r.screenWidth=Math.max(...i),r.screenHeight=Math.max(...e),r.screenScrollHeight=this.pageScrollHeight,r}catch(e){return this.loggingService.catch("Error in DomService calculateScreenSize:",e),new ob}}calculatePageScrollHeight(){this.loggingService.log("%c[WB] Calling FUNCTION: calculatePageScrollHeight","color: green;");try{this.pageScrollHeight=0,this.findLongestNode(document?.documentElement?.childNodes)}catch(e){this.loggingService.catch("Error in DomService calculatePageScrollHeight: ",e)}}removeSnippylyContent(e){this.loggingService.log("%c[WB] Calling FUNCTION: removeSnippylyContent","color: green;");try{let r=new DOMParser().parseFromString(e,"text/html");r.querySelectorAll("[data-snippyly-cache-id]").forEach(E=>{E.removeAttribute("data-snippyly-cache-id")}),r.querySelectorAll("[data-velt-cache-id]").forEach(E=>{E.removeAttribute("data-velt-cache-id")}),r.querySelectorAll(".comment-text-highlight").forEach(E=>{E?.parentNode?.insertBefore(document.createTextNode(E?.textContent),E),E.remove()});let p=document.createNodeIterator(r,NodeFilter.SHOW_COMMENT),h;for(;h=p.nextNode();)h?.remove();return this.mergeAdjacentTextNodes(r.body),this.sanitizeHtml(r.body.innerHTML)}catch(i){return this.loggingService.catch("Error in DomService removeSnippylyContent: ",i),e}}mergeAdjacentTextNodes(e){try{let i=e.firstChild;for(;i;){if(i.nodeType===Node.TEXT_NODE){let r=i.nextSibling;for(;r&&r.nodeType===Node.TEXT_NODE;)i.textContent+=r.textContent,r.remove(),r=i.nextSibling}i=i.nextSibling}}catch(i){this.loggingService.catch("Error in DomService mergeAdjacentTextNodes: ",i)}}findLongestNode(e){try{for(let i=e.length-1;i>=0;i--){if(e[i]?.scrollHeight&&e[i]?.clientHeight){let r=Math.max(e[i]?.scrollHeight,e[i]?.clientHeight);this.pageScrollHeight=Math.max(r,this.pageScrollHeight),this.nodeMap[r]=e[i]}e[i]?.childNodes?.length&&this.findLongestNode(e[i]?.childNodes)}}catch(i){this.loggingService.catch("Error in DomService findLongestNode: ",i)}}resetSelectedAnnotationsMap(e=!0,i){try{let r=Array.from(document.querySelectorAll(`[${j.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`)),a=this.getDraftCommentAnnotationDialogs()||[];r.push(...a),r=Array.from(new Set(r));let s=r.map(_=>_.classList.contains("velt-annotation-draft-checked")?(_.classList.remove("velt-annotation-draft-checked"),null):(this.removeClassFromElement(_,"velt-comment-dialog-shake"),setTimeout(()=>{this.addClassToElement(_,"velt-comment-dialog-shake"),_.getAttribute(j.ATTRIBUTES.VELT_ANNOTATION_EDIT_COMMENT)||_.classList.contains("velt-annotation-draft-checked")||this.addClassToElement(_,"velt-annotation-draft-checked")},100),_.getAttribute(j.ATTRIBUTES.VELT_ANNOTATION_DRAFT))).filter(_=>_),m=Object.keys(this.getRecordingInProgress()||{});s=[...s,...m];let p=this.selectedAnnotationsMap$.value;if(e&&this.selectedAnnotationsMap$.value&&Object.keys(this.selectedAnnotationsMap$.value).length){let _=[];Object.keys(p).forEach(E=>{if(p[E]?.type==="tag"){let D=p[E];D?.to?.length||s.includes(E)||_.push(D)}else p[E]?.comments?.length||s.includes(E)||_.push(p[E])}),this.deleteAnnotations$.next(_),this.deleteAnnotations$.next([])}let h={};Object.keys(p).forEach(_=>{if(s.includes(_)&&(h[_]=p[_]),i)switch(i){case"comment":["comment","videoPin"].includes(p[_]?.type)||(h[_]=p[_]);break;default:p[_]?.type!==i&&(h[_]=p[_]);break}}),Object.keys(h).forEach(_=>{let E=h[_]?.multiThreadAnnotationId;E&&!h[E]&&(h[E]={annotationId:E,type:"multiThread"})}),JSON.stringify(this.selectedAnnotationsMap$.value)!==JSON.stringify(h)&&this.selectedAnnotationsMap$.next(h),this.setDialogOpenedInSidebar(!1)}catch(r){this.loggingService.catch("Error in DomService resetSelectedAnnotationsMap: ",r)}}setRecordingInProgress(e,i){try{if(i)this.recordingInProgress$.next(T(I({},this.recordingInProgress$.value),{[e]:i}));else{let r=this.recordingInProgress$.value;delete r[e],this.recordingInProgress$.next(r)}}catch(r){this.loggingService.catch("Error in DomService setRecordingInProgress: ",r)}}resetRecordingInProgress(){try{this.recordingInProgress$.next({})}catch(e){this.loggingService.catch("Error in DomService resetRecordingInProgress: ",e)}}getRecordingInProgress(){try{return this.recordingInProgress$.value}catch(e){return this.loggingService.catch("Error in DomService getRecordingInProgress: ",e),{}}}getDraftCommentAnnotationDialogs(){try{let e=[];return Array.from(document.querySelectorAll(`${j.TAGS.SNIPPYLY_COMMENT_DIALOG}`)).forEach(r=>{if(r?.shadowRoot){let a=r.shadowRoot.querySelector(`[${j.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);a&&e.push(a)}else{let a=r.querySelector(`${j.TAGS.VELT_SHADOW_DOM_INTERNAL}`);if(a?.shadowRoot){let s=a.shadowRoot?.querySelector(`[${j.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);s&&e.push(s)}else{let s=r.querySelector(`[${j.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);s&&e.push(s)}}}),e}catch(e){return this.loggingService.catch("Error in DomService getDraftCommentAnnotationDialogs: ",e),[]}}getSelectedAnnotationsMap(e){try{let i=this.selectedAnnotationsMap$.value;if(e){let r={};return Object.keys(i).forEach(a=>{switch(e){case"comment":["comment","videoPin"].includes(i[a].type)&&(r[a]=i[a]);break;default:i[a].type===e&&(r[a]=i[a]);break}}),r}else return i}catch(i){return this.loggingService.catch("Error in DomService getSelectedAnnotationsMap: ",i),{}}}getSelectedAnnotationsMap$(e){return this.selectedAnnotationsMap$.asObservable().pipe(ce(i=>{if(e){let r={};return Object.keys(i).forEach(a=>{i[a].type===e&&(r[a]=i[a])}),r}else return i}))}getSelectedComments$(){return this.selectedAnnotationsMap$.asObservable().pipe(ce(e=>Object.values(e)))}getSelectedAnnotationsLocationMap(){try{return this.selectedAnnotationsLocationMap$.value}catch(e){return this.loggingService.catch("Error in DomService getSelectedAnnotationsLocationMap: ",e),{}}}getSelectedAnnotationsLocationMap$(){return this.selectedAnnotationsLocationMap$.asObservable()}toggleAnnotationSelection(e,i,r,a=!1){try{r==="sidebarShowReplies"?this.setDialogOpenedInSidebar(!0):this.setDialogOpenedInSidebar(!1);let s=JSON.parse(JSON.stringify(this.selectedAnnotationsMap$.value||{})),m=JSON.parse(JSON.stringify(this.selectedAnnotationsLocationMap$.value||{}));if(s[e.annotationId]&&!a)delete s[e.annotationId];else{(!this.windowKeydownShift$.value||a)&&(s={}),s[e.annotationId]=e,m[e.annotationId]=i;let p=e?.multiThreadAnnotationId;p&&(s[p]={annotationId:p,type:"multiThread"},m[p]=i)}this.selectedAnnotationsMap$.next(s),Object.keys(m).forEach(p=>{s[p]||delete m[p]}),this.selectedAnnotationsLocationMap$.next(m)}catch(s){this.loggingService.catch("Error in DomService toggleAnnotationSelection: ",s)}}setSelectedAnnotationLocation(e,i){try{let r=JSON.parse(JSON.stringify(this.getSelectedAnnotationsLocationMap()||{}));r?.[e]!==i&&(r[e]=i,this.selectedAnnotationsLocationMap$.next(r))}catch(r){this.loggingService.catch("Error in DomService setSelectedAnnotationLocation: ",r)}}updateSelectedAnnotationInMap(e){try{let i=this.selectedAnnotationsMap$.value;e.forEach(r=>{i[r.annotationId]&&(i[r.annotationId]=r)}),this.selectedAnnotationsMap$.next(i)}catch(i){this.loggingService.catch("Error in DomService updateSelectedAnnotationInMap: ",i)}}getDeleteCommmentAnnotations$(){try{return this.deleteAnnotations$.asObservable()}catch(e){return this.loggingService.catch("Error in DomService getDeleteCommmentAnnotations$: ",e),se([])}}getHighestNode(){return this.loggingService.log("%c[WB] Calling FUNCTION: getHighestNode","color: green;"),this.highestNode}onWindowMouseDown$(){return this.windowMouseDown$.asObservable()}onWindowPointerMove$(){return this.windowPointerMove$.asObservable()}onWindowPointerMove(){return this.windowPointerMove$.value}onWindowPointerUp$(){return this.windowPointerUp$.asObservable()}onSelectionChange$(){return this.documentSelectionChange$.asObservable()}onWindowClick$(){return this.windowClick$.asObservable()}onWindowScroll$(){return this.windowScroll$.asObservable()}onWindowResize$(){return this.windowResize$.asObservable()}onWindowKeyupBackspace$(){return this.windowKeyupBackspace$.asObservable()}onWindowKeyupDelete$(){return this.windowKeyupDelete$.asObservable()}onWindowKeyupEsc$(){return this.windowKeyupEsc$.asObservable()}onWindowPopState$(){return this.windowPopState$.asObservable()}onDocumentClick$(){return this.documentClick$.asObservable()}getLastDocumentClick(){return this.documentClick$.value}onDocumentClickSubject$(){return this.documentClickSubject$.asObservable()}onDocumentFocus$(){return this.documentFocus$.asObservable()}onDomChange$(e){try{return this.mutationObserver||this.setMutationObserver(e),this.mutation$.asObservable()}catch(i){return this.loggingService.catch("Error in DomService onDomChange$: ",i),se([])}}getChildListMutation$(){return this.childListMutation$.asObservable()}onNetworkStatusChange$(){return this.networkStatus$.asObservable()}getElementOffset(e,i){try{let r={offsetTop:0,offsetLeft:0},a=e;if(a===i){let s=window.getComputedStyle(e);s.position==="static"&&s.transformStyle!="preserve-3d"&&s.transform=="none"&&(r.offsetLeft=e?.offsetLeft||0,r.offsetTop=e?.offsetTop||0)}if(a!==i)if(e?.closest("svg"))for(;a&&a!==i;){let m=window.getComputedStyle(a);if(a.tagName.toLowerCase()==="svg"||a instanceof SVGElement){let p=a.parentElement;if(p){let h=p.getBoundingClientRect(),_=a.getBoundingClientRect();r.offsetLeft+=_.left-h.left,r.offsetTop+=_.top-h.top}}else m.position==="static"?m.transformStyle!="preserve-3d"&&m.transform=="none"&&(r.offsetLeft+=a?.offsetLeft||0,r.offsetTop+=a?.offsetTop||0):(r.offsetLeft+=a.offsetLeft,r.offsetTop+=a.offsetTop);if(a=a.parentElement,e instanceof SVGElement&&a===i){let p=window.getComputedStyle(a);p.position==="static"&&p.transformStyle!="preserve-3d"&&p.transform=="none"&&(r.offsetLeft+=a?.offsetLeft||0,r.offsetTop+=a?.offsetTop||0)}}else{let m=window.getComputedStyle(a);m.position==="static"?m.transformStyle!="preserve-3d"&&m.transform=="none"&&(r.offsetLeft+=a?.offsetLeft||0,r.offsetTop+=a?.offsetTop||0):(r.offsetLeft+=a.offsetLeft,r.offsetTop+=a.offsetTop)}return r}catch(r){return this.loggingService.catch("Error in DomService getElementOffset: ",r),{offsetTop:0,offsetLeft:0}}}isElementVisible(e){try{if(typeof e?.getBoundingClientRect=="function"){let{width:i,height:r,top:a,bottom:s}=e?.getBoundingClientRect();return i>0||r>0||a<window.innerHeight&&s>0}else return!1}catch(i){return this.loggingService.catch("Error in DomService isElementVisible: ",i),!1}}isElementVisibleOnScreen(e){try{if(e){if(!(e instanceof Element))return!1;let i=e,r=window.getComputedStyle(i);return!(r.display==="none"||r.visibility==="hidden"||parseFloat(r.opacity)===0)}return!1}catch(i){return this.loggingService.catch("Error in DomService isElementVisibleOnScreen: ",i),!1}}getClickAndDragPointsObservable(){return new Lt(e=>{let i=ri(document,"mousedown").pipe(ce(p=>({type:p.type,x:p.clientX+window.scrollX,y:p.clientY+window.scrollY,event:p}))),r=ri(document,"mousemove").pipe(ce(p=>({type:p.type,x:p.clientX+window.scrollX,y:p.clientY+window.scrollY,event:p}))),a=ri(document,"mouseup").pipe(ce(p=>({type:p.type,x:p.clientX+window.scrollX,y:p.clientY+window.scrollY,event:p}))),m=i.pipe(he(p=>r.pipe(Pi(),ce(([h,_])=>({startPoint:p,prevPoint:h,curPoint:_})),ao(a)))).subscribe(e);return()=>m.unsubscribe()})}drawRectangle(e,i){let r=document.querySelector(".rectangle");r||(r=document.createElement("div"),this.addClassToElement(r,"rectangle"),r.setAttribute(j.ATTRIBUTES.VELT_COMMENT_DISABLED,"true"),r.setAttribute(j.VELT_IGNORE_CHANGE_DETECTION,"true"),document.body.appendChild(r));let a=Math.abs(i.x-e.x),s=Math.abs(i.y-e.y),m=Math.min(e.x,i.x),p=Math.min(e.y,i.y);return r.style.width=`${a}px`,r.style.height=`${s}px`,r.style.left=`${m}px`,r.style.top=`${p}px`,r.style.position="absolute",r.style.border="2px dashed #f00",r.style.pointerEvents="none",r.style.zIndex="2147483577",r}getRange(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: getRange","color: green;"),window.getSelection()?.toString()){let e=window.getSelection();if(e?.rangeCount)return e.getRangeAt(0)}return null}catch(e){return this.loggingService.catch("Error in DomService getRange: ",e),null}}clearTextSelection(){try{this.loggingService.log("%c[WB] Calling FUNCTION: clearTextSelection","color: green;"),window.getSelection&&(window.getSelection()?.empty?window.getSelection()?.empty():window.getSelection()?.removeAllRanges&&window.getSelection()?.removeAllRanges())}catch(e){this.loggingService.catch("Error in DomService clearTextSelection: ",e)}}getTargetTextRangeFromSelectionRange(e){try{let i={},r=e.commonAncestorContainer;r?.nodeType===Node.TEXT_NODE&&(r=r.parentElement);let a=document.body;if(r){let m=this.getTextXPath(r);this.isXpathWithId(m)&&(a=r)}let s=this.getAdditionalLocationContainer(r);if(s&&(a=s),i.commonAncestorContainer=this.getTextXPath(a),i.commonAncestorContainer){let m=this.getElementFromXPath(i.commonAncestorContainer);m&&(i.commonAncestorContainerFXpath=this.getXPath(m,!0),i.commonAncestorContainerCFXpath=this.getXPath(m,!0,!0))}return i.text=e.toString(),i.occurrence=ju(a,0,e.startContainer,e.startOffset,e.toString())+1,i}catch(i){this.loggingService.catch("Error in DomService getTargetTextRangeFromSelectionRange: ",i);return}}getTextXPath(e){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: getTextXPath","color: green;"),e.nodeType===Node.TEXT_NODE){let i=1,r=e.previousSibling;for(;r;)r.nodeType===Node.TEXT_NODE&&i++,r=r.previousSibling;return this.getXPath(e.parentElement)}else return this.getXPath(e)}catch(i){this.loggingService.catch("Error in DomService getTextXPath: ",i);return}}getHostElement(e){try{if(j.NON_NESTABLE_ELEMENTS[e?.tagName?.toLowerCase()]){let r=e?.closest("picture");return r?r?.parentElement:e.parentElement}let i=e.closest("svg");return i?i?.parentElement:e}catch(i){return this.loggingService.catch("Error in DomService getHostElement: ",i),e}}isElementInsideAdditionalLocationContainer(e){try{return!!e?.closest(`[${j.ATTRIBUTES.VELT_LOCATION}], [${j.ATTRIBUTES.VELT_LOCATION_ID}]`)}catch(i){return this.loggingService.catch("Error in DomService isElementInsideAdditionalLocationContainer: ",i),!1}}getAdditionalLocationContainer(e){try{return e?.closest(`[${j.ATTRIBUTES.VELT_LOCATION}], [${j.ATTRIBUTES.VELT_LOCATION_ID}]`)||null}catch(i){return this.loggingService.catch("Error in DomService getAdditionalLocationContainer: ",i),null}}isXpathWithId(e){try{return typeof e=="string"?!!e?.includes("[@id="):!1}catch(i){return this.loggingService.catch("Error in DomService isXpathWithId: ",i),!1}}getListedElements({elementIds:e,elementClassNames:i,elementQuerySelectors:r}){try{let a=[];if(e?.length)for(let s=0;s<e.length;s++){let m=document.getElementById(e[s]);m&&a.push(m)}if(i?.length)for(let s=0;s<i.length;s++){let m=document.getElementsByClassName(i[s]);for(let p=0;p<m.length;p++){let h=m[p];h&&h instanceof HTMLElement&&a.push(h)}}if(r?.length)for(let s=0;s<r.length;s++){let m=document.querySelectorAll(r[s]);for(let p=0;p<m.length;p++){let h=m[p];h&&h instanceof HTMLElement&&a.push(h)}}return a}catch(a){return this.loggingService.catch("Error in DomService getListedElements: ",a),[]}}isElementInsideListedElementIds(e,i){try{if(i?.length){for(let r=0;r<i.length;r++){let a=document.getElementById(i[r]);if(a&&a.contains(e))return!0}return!1}return!0}catch(r){return this.loggingService.catch("Error in DomService isElementInsideListedElementIds: ",r),!1}}isElementInsideListedElementClassNames(e,i){try{if(i?.length){for(let r=0;r<i.length;r++){let a=document.getElementsByClassName(i[r]);for(let s=0;s<a.length;s++)if(a[s].contains(e))return!0}return!1}return!0}catch(r){return this.loggingService.catch("Error in DomService isElementInsideListedElementClassNames: ",r),!1}}isElementInsideListedElementQuerySelectors(e,i){try{if(i?.length){for(let r=0;r<i.length;r++){let a=document.querySelectorAll(i[r]);for(let s=0;s<a.length;s++)if(a[s].contains(e))return!0}return!1}return!0}catch(r){return this.loggingService.catch("Error in DomService isElementInsideListedElementQuerySelectors: ",r),!1}}addClassToElement(e,i){try{this.loggingService.log("%c[WB] Calling FUNCTION: addClassToElement","color: green;"),e&&(e.classList?.contains(i)||e.classList?.add(i))}catch(r){this.loggingService.catch("Error in DomService addClassToElement: ",r)}}removeClassFromElement(e,i){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeClassFromElement","color: green;"),e&&e.classList?.contains(i)&&e.classList?.remove(i)}catch(r){this.loggingService.catch("Error in DomService removeClassFromElement: ",r)}}isElementInsideParentWithAttribute(e,i,r){try{let a=e;for(;a&&a!==document.body;){if(a?.getAttribute&&a?.getAttribute(i)===r)return!0;a=a.parentElement}return!1}catch(a){return this.loggingService.catch("Error in DomService isElementInsideParentWithAttribute: ",a),!1}}setVideoEditorHandlingDelete(e){try{this.isVideoEditorHandlingDelete=e}catch(i){this.loggingService.catch("Error in DomService setVideoEditorHandlingDelete: ",i)}}isVideoEditorHandlingDeleteKey(){try{return this.isVideoEditorHandlingDelete}catch(e){return this.loggingService.catch("Error in DomService isVideoEditorHandlingDeleteKey: ",e),!1}}setCustomCss(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setCustomCss","color: green;"),this.customCss$.next(e)}catch(i){this.loggingService.catch("Error in DomService setCustomCss: ",i)}}getCustomCss$(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getCustomCss$","color: green;"),this.customCss$.asObservable()}catch(e){return this.loggingService.catch("Error in DomService getCustomCss$: ",e),se(null)}}injectCustomCss(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: injectCustomCss","color: green;");let i=this.customCss$.value;if(i){let r=e?.shadowRoot?.querySelector(`[${j.VELT_CUSTOM_CSS}]`);if(r&&r.remove(),i?.type==="link"){let a=document.createElement("link");a.href=i?.value,a.rel="stylesheet",a.setAttribute(j.VELT_CUSTOM_CSS,"true"),e?.shadowRoot?.appendChild(a)}else{let a=document.createElement("style");a.innerHTML=this.sanitizeHtml(i?.value),a.setAttribute(j.VELT_CUSTOM_CSS,"true"),e?.shadowRoot?.appendChild(a)}}}catch(i){this.loggingService.catch("Error in DomService injectCustomCss: ",i)}}trimCommentHtml(e){try{let i=document.createElement("div");i.innerHTML=e,this.removeEmptyElements(i);let r=i.innerHTML;return r=r.replace(o.MULTIPLE_NBSP_REGEX," ").replace(o.TRIM_NBSP_REGEX,"").trim(),r}catch(i){return this.loggingService.catch("Error in DomService trimCommentHtml: ",i),e}}removeEmptyElements(e){try{let a=function(s){return r.test(s.innerHTML)};var i=a;let r=/^\s*(<br\s*\/?>)?\s*$/;for(;e.firstChild&&a(e.firstChild);)e.removeChild(e.firstChild);for(;e.lastChild&&a(e.lastChild);)e.removeChild(e.lastChild)}catch(r){this.loggingService.catch("Error in DomService removeEmptyElements: ",r)}}normalizeWhitespace(e){try{e.childNodes.forEach(i=>{i.nodeType===Node.TEXT_NODE?i.nodeValue=i.nodeValue?.replace(/\s+/g," ").trim()??"":i.nodeType===Node.ELEMENT_NODE&&this.normalizeWhitespace(i)})}catch(i){this.loggingService.catch("Error in DomService normalizeWhitespace: ",i)}}sanitizeHtml(e){try{return this.loggingService.log("%c[WB] Calling FUNCTION: sanitizeHtml","color: green;"),hH.sanitize(e,Sle)}catch(i){return this.loggingService.catch("Error in DomService sanitizeHtml: ",i),""}}sanitizeSvg(e){try{return hH.sanitize(e,Sle)}catch(i){return this.loggingService.catch("Error in DomService sanitizeSvg: ",i),e}}setDeviceInfo(){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDeviceInfo","color: green;");let e=new ei;this.deviceInfo$.next(e)}catch(e){this.loggingService.catch("Error in DomService setDeviceInfo: ",e)}}getDeviceInfo$(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getDeviceInfo$","color: green;"),this.deviceInfo$.asObservable()}catch(e){return this.loggingService.catch("Error in DomService getDeviceInfo$: ",e),se(new ei)}}getTabId(){try{let e=sessionStorage.getItem(j.SESSION_STORAGE.VELT_TAB_ID),i=this.getTabIdFromWindowName();return(!e||e!==i)&&(e=Pn(),sessionStorage.setItem(j.SESSION_STORAGE.VELT_TAB_ID,e),this.setTabIdToWindowName(e)),e}catch(e){return this.loggingService.catch("Error in DomService getTabId: ",e),null}}getTabIdFromWindowName(){try{return window.name}catch(e){return this.loggingService.catch("Error in DomService getTabIdFromWindowName: ",e),null}}setTabIdToWindowName(e){try{window.name=e}catch(i){this.loggingService.catch("Error in DomService setTabIdToWindowName: ",i)}}getDeviceInfo(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getDeviceInfo","color: green;"),this.deviceInfo$.value}catch(e){return this.loggingService.catch("Error in DomService getDeviceInfo: ",e),new ei}}isMobileDevice(){try{return new ei().getDeviceType()===Qo.MOBILE}catch(e){return this.loggingService.catch("Error in DomService isMobileDevice: ",e),!1}}isTabletDevice(){try{return new ei().getDeviceType()===Qo.TABLET}catch(e){return this.loggingService.catch("Error in DomService isTabletDevice: ",e),!1}}isDesktopDevice(){try{return new ei().getDeviceType()===Qo.DESKTOP}catch(e){return this.loggingService.catch("Error in DomService isDesktopDevice: ",e),!1}}deepCloneElement(e){try{var i=document.createElement(e?.tagName);return Array.from(e.attributes).forEach(r=>{i.setAttribute(r.nodeName,r.nodeValue)}),e.childNodes.forEach(r=>{r.nodeType===Node.ELEMENT_NODE?i.appendChild(this.deepCloneElement(r)):r.nodeType===Node.TEXT_NODE&&i.appendChild(document.createTextNode(r.nodeValue))}),i}catch(r){return this.loggingService.catch("Error in DomService deepCloneElement: ",r),e}}setRandomNumberToElementRecursive(e){try{if(!e)return;let i=Math.random().toString(36).substring(7);e&&e.setAttribute&&typeof e.setAttribute=="function"&&(e.getAttribute("velt-wireframe-id")||e.setAttribute("velt-wireframe-id",i)),Array.from(e.children).forEach(a=>{this.setRandomNumberToElementRecursive(a)})}catch(i){this.loggingService.catch("Error in DomService setRandomNumberToElementRecursive: ",i)}}setDialogOpenedInSidebar(e){this.dialogOpenedInSidebar$.next(e)}getDialogOpenedInSidebar(){return this.dialogOpenedInSidebar$.asObservable()}removeWireframeSuffixFromTags(e){if(!e)return;Array.from(e.children).forEach(r=>{if(this.removeWireframeSuffixFromTags(r),r.tagName.toLowerCase().endsWith("-wireframe")){let a=r.tagName.toLowerCase().replace("-wireframe",""),s=document.createElement(a);for(Array.from(r.attributes).forEach(m=>{s.setAttribute(m.name,m.value)});r.firstChild;)s.appendChild(r.firstChild);r.parentNode.replaceChild(s,r)}})}isMonitorDevice(){try{return new ei().getDeviceType()===Qo.MONITOR}catch(e){return this.loggingService.catch("Error in DomService isMonitorDevice: ",e),!1}}};o.MULTIPLE_NBSP_REGEX=/(?:&nbsp;\s*){2,}/g,o.TRIM_NBSP_REGEX=/^(?:&nbsp;\s*)+|(?:&nbsp;\s*)+$/g,o.\u0275fac=function(i){return new(i||o)(J(Ko),J(y),J(Ls))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var He=(()=>{let o=class o{constructor(e,i,r,a,s,m,p,h){this.afAuth=e,this.configService=i,this.avatarService=r,this.coreActionsService=a,this.domService=s,this.functions=m,this.analyticsService=p,this.loggingService=h,this.user$=new Ce(null),this.userOptions$=new Ce(null),this.userContacts$=new Ce(null),this.userOrganization$=new Ce(null),this.providedUser=new wo,this.firebaseConfig$=new Ce(null),this.advancedQueries$=new Ce(null),this.planDetails$=new Ce(null),this.signOutPreviousUser$=new Ce(null),this.preSignOutFunctions=new Map,this.autoLoginCalled=!1,this.autoLoginRequired=!0,this.config=null,this.getPlanDetailsCalled=!1,this.forceReLoggedIn=!1,this.lastLoggedInUserData=null,this.sessionReLoginCount=0,this.SESSION_RE_LOGIN_COUNT_LIMIT=10,this.sessionReLoginSubscription=null,this.TOKEN_EXPIRED_ERROR_COUNT_LIMIT=3,this.tokenExpiredErrorCount=0,this.loggingService.log("%c[WB] Creating CLASS: AuthService","color: blue;");try{this.analyticsService.setAuthService(this),this.configService.getConfig$().subscribe(_=>{this.config=_}),this.forceReLoggedIn=localStorage.getItem(j.LOCAL_STORAGE.VELT_USER_FORCE_RE_LOGGED_IN)==="true",this.sessionReLoginSubscription=qn(this.afAuth).pipe(qo(this.afAuth.currentUser),Pi(),he(([_,E])=>this.domService.onNetworkStatusChange$().pipe(Fe(D=>D),tt(1),ce(()=>({previousUser:_,currentUser:E}))))).subscribe(D=>Q(this,[D],function*({previousUser:_,currentUser:E}){if(!E&&_){let L=_?.stsTokenManager?.expirationTime,H=new Date().getTime(),K=L-H;H>L&&(this.analyticsService.trackEvent(X.Events.Core.SDK_SESSION_TOKEN_EXPIRED,{apiKey:this.apiKey,user:this.user$.value,lastLoggedInUserData:this.lastLoggedInUserData,timeLeft:K,forceReset:this.userOptions$.value?.forceReset,sessionReLoginCount:this.sessionReLoginCount},!0,this.user$.value?.userSnippylyId),this.user$.value&&_?.uid===this.user$.value?.userSnippylyId&&this.lastLoggedInUserData?.user?.userSnippylyId===this.user$.value?.userSnippylyId&&(this.sessionReLoginCount>this.SESSION_RE_LOGIN_COUNT_LIMIT?(this.analyticsService.trackEvent(X.Events.Core.SDK_SESSION_RE_LOGIN_COUNT_EXCEEDED,{apiKey:this.apiKey,clientUserId:this.lastLoggedInUserData.user.userId,snippylyUserId:this.lastLoggedInUserData.user.userSnippylyId,timeLeft:K,forceReset:this.userOptions$.value?.forceReset,sessionReLoginCount:this.sessionReLoginCount},!0,this.user$.value?.userSnippylyId),this.sessionReLoginSubscription?.unsubscribe()):(this.sessionReLoginCount++,this.analyticsService.trackEvent(X.Events.Core.SDK_SESSION_RE_LOGIN_TRIGGERED,{apiKey:this.apiKey,clientUserId:this.lastLoggedInUserData.user.userId,snippylyUserId:this.lastLoggedInUserData.user.userSnippylyId,user:this.getUserWithoutContacts(this.lastLoggedInUserData.user),timeLeft:K,forceReset:this.userOptions$.value?.forceReset,sessionReLoginCount:this.sessionReLoginCount},!0,this.lastLoggedInUserData.user.userSnippylyId),this.initializeClient(this.lastLoggedInUserData.user,this.lastLoggedInUserData.userOptions,this.lastLoggedInUserData.initializeClientToken,this.lastLoggedInUserData.autoLogin,"internal-sessionReLogin"))))}}),_=>{this.loggingService.catch("Error in AuthService sessionReLoginSubscription: ",_)}),this.getUser$().pipe(qt(Vi)).subscribe(_=>{let E=ha(_);this.coreActionsService.triggerAction(Xi.USER_UPDATE,E),this.coreActionsService.triggerAction(Xi.INIT_UPDATE,{event:Xi.USER_UPDATE,payload:{user:E}})})}catch(_){this.loggingService.catch("Error in AuthService constructor: ",_)}}setApiKey(e,i){this.loggingService.log("%c[WB] Calling FUNCTION: setApiKey","color: green;",e);try{if(this.apiKey){this.loggingService.log("API key is already set");return}this.apiKey=e,this.configService.setApiKey(this.apiKey),i||(i=new iM),this.configService.initConfig(i),i.debugMode?sessionStorage.setItem("debugMode","true"):sessionStorage.removeItem("debugMode"),this.autoLoginCalled||qn(this.afAuth).pipe(tt(1)).subscribe(r=>Q(this,null,function*(){if(this.autoLoginCalled=!0,r){let a=yield Sd(r,!0).catch(s=>null);if(a){let{user:s}=a?.claims;this.autoLoginRequired&&this.initializeClient(s,this.userOptions$?.value?T(I({},this.userOptions$?.value),{replaceContacts:!1,replaceGroupContacts:!1,replacePrivateContacts:!1}):{},new Date().getTime(),!0,"internal-autoLogin")}}}))}catch(r){this.loggingService.catch("Error in setApiKey: ",r)}}setUsersService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setUsersService","color: green;"),this.usersService=e}catch(i){this.loggingService.catch("Error in setUsersService: ",i)}}setDocService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocService","color: green;"),this.docService=e}catch(i){this.loggingService.catch("Error in setDocService: ",i)}}setContactService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setContactService","color: green;"),this.contactService=e}catch(i){this.loggingService.catch("Error in setContactService: ",i)}}setIamService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setIamService","color: green;"),this.iamService=e}catch(i){this.loggingService.catch("Error in setIamService: ",i)}}setAreaService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setAreaService","color: green;"),this.areaService=e}catch(i){this.loggingService.catch("Error in setAreaService: ",i)}}setCommentService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setCommentService","color: green;"),this.commentService=e}catch(i){this.loggingService.catch("Error in setCommentService: ",i)}}setReactionService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setReactionService","color: green;"),this.reactionService=e}catch(i){this.loggingService.catch("Error in setReactionService: ",i)}}setRecorderAnnotationService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setRecorderAnnotationService","color: green;"),this.recorderAnnotationService=e}catch(i){this.loggingService.catch("Error in setRecorderAnnotationService: ",i)}}setViewsService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setViewsService","color: green;"),this.viewsService=e}catch(i){this.loggingService.catch("Error in setViewsService: ",i)}}setCommonDbService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setCommonDbService","color: green;"),this.commonDbService=e}catch(i){this.loggingService.catch("Error in setCommonDbService: ",i)}}validateOrganizationId(e){if(this.isVersionGreaterThanOrEqualTo4()&&!e?.organizationId)if(this.analyticsService.trackEvent(X.Events.Core.SDK_VALIDATE_CLIENT_FAILED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,message:"Organization Id is not set",forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e)},!0,e.userSnippylyId),this.configService.getSF())this.loggingService.catch("OrganizationId is not set in Identify method",void 0,void 0,!0);else throw new Error("OrganizationId is not set in Identify method")}initializeClient(e,i,r,a,s){return Q(this,null,function*(){try{if(this.autoLoginRequired=!1,this.userOptions$.next(i),this.initializeClientToken)this.pendingUserLogin=e,this.pendingUserLoginSource=s;else{e.userSnippylyId=ym(this.configService.getApiKey(),e.userId),this.pendingUserLogin=void 0,this.pendingUserLoginSource=void 0,this.initializeClientToken=r;let m=yield qn(this.afAuth).pipe(tt(1)).toPromise().catch(h=>null),p=!0;if(this.providedUser=JSON.parse(JSON.stringify(e)),m){let h=yield Sd(m,!0).catch(D=>null);if(!h)return;let{user:_,firebaseConfig:E}=h.claims;if(m?.uid!==e?.userSnippylyId||e?.groupId!==_?.groupId||e?.organizationId!==_?.organizationId||i?.forceReset||!a&&e?.organizationId&&!this.forceReLoggedIn||this.forceReLoginRequiredForAdvancedQueries(e)||this.forceReLoginRequiredForRegion(e,E))localStorage.setItem(j.LOCAL_STORAGE.VELT_USER_FORCE_RE_LOGGED_IN,"true"),this.forceReLoggedIn=!0,yield this.signOutUser("internal");else{this.loggingService.log("%c[WB] Calling FUNCTION: reinitializeCurrentUser","color: green;"),this.loggingService.log("Keeping user");let D=yield Sd(m,!0).catch(oe=>null);if(!D)return;let{firebaseConfig:L,user:H,advancedQueries:K}=D.claims;this.validateOrganizationId(e),this.setFirebaseConfig(L),this.setAdvancedQueries(K),H&&(this.providedUser.isAdmin=!!H.isAdmin),this.initializeSignedInUser(m,a),p=!1,this.analyticsService.trackEvent(X.Events.Core.SDK_USER_AUTH_SUCCESS,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,authType:"auto",forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e),source:s})}}if(p){this.analyticsService.trackEvent(X.Events.Core.SDK_VALIDATE_CLIENT_TRIGGERED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e),source:s},!0,e.userSnippylyId,e.userId);let h=yr(this.functions,br({url:Xn.cloudFunction.validateClient,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:20*60*1e3}),_=ga(),E=(yield h({apiKey:this.apiKey,user:e,version:_,authToken:i?.authToken}))?.data;if(E.error){if(this.analyticsService.trackEvent(X.Events.Core.SDK_VALIDATE_CLIENT_FAILED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,message:E.error,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e),source:s},!0,e.userSnippylyId,e.userId),E.error&&typeof E.error=="string"&&E.error?.toLowerCase()?.includes("token expired"))if(this.tokenExpiredErrorCount++,this.tokenExpiredErrorCount<=this.TOKEN_EXPIRED_ERROR_COUNT_LIMIT){let D={code:"token_expired",message:"Token expired"};this.coreActionsService.triggerAction(Xi.ERROR,D)}else{let D={code:"too_many_retries",message:"Token expired. Too many retries."};this.coreActionsService.triggerAction(Xi.ERROR,D),this.analyticsService.trackEvent(X.Events.Core.SDK_JWT_EXPIRED_RETRY_EXCEEDED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,forceReset:this.userOptions$.value?.forceReset,source:s},!0,e.userSnippylyId,e.userId)}throw E.error}else this.tokenExpiredErrorCount=0;if(this.analyticsService.trackEvent(X.Events.Core.SDK_VALIDATE_CLIENT_SUCCESS,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e),source:s},!0,e.userSnippylyId,e.userId),this.validateOrganizationId(e),E.firebaseConfig){this.setFirebaseConfig(E.firebaseConfig),yield this.signInWithCustomToken(e,E.token),this.loggingService.log("new signed in user",this.afAuth.currentUser);let D=yield Sd(this.afAuth.currentUser,!0).catch(K=>null);if(!D)return;let{user:L,advancedQueries:H}=D.claims;this.setAdvancedQueries(H),this.providedUser.isAdmin=!!L?.isAdmin,this.initializeSignedInUser(this.afAuth.currentUser,a)}}this.initializeClientToken=0,this.lastLoggedInUserData={user:e,userOptions:i,initializeClientToken:r,autoLogin:a},this.checkForPendingLogin()}return e}catch(m){return this.initializeClientToken=0,this.checkForPendingLogin(),this.loggingService.catch("Error in initializeClient: ",m),Promise.resolve(null)}})}isVersionGreaterThanOrEqualTo4(){try{let e=ga();return(e?parseInt(e.split(".")?.[0]||"0"):0)>=4}catch(e){return this.loggingService.catch("Error in isVersionGreaterThanOrEqualTo4: ",e),!1}}forceReLoginRequiredForAdvancedQueries(e){try{let i=this.isVersionGreaterThanOrEqualTo4(),r=!1;try{let a=localStorage.getItem(j.LOCAL_STORAGE.VELT_ADVANCED_QUERIES);a&&(r=JSON.parse(a)?.advancedQueriesEnabled)}catch(a){this.loggingService.catch("Error in forceReLoginRequiredForAdvancedQueries: ",a)}return!!(i&&e.organizationId&&!r)}catch(i){return this.loggingService.catch("Error in forceReLoginRequiredForAdvancedQueries: ",i),!1}}forceReLoginRequiredForRegion(e,i){try{return!!(this.isVersionGreaterThanOrEqualTo4()&&e.organizationId&&!i?.region)}catch(r){return this.loggingService.catch("Error in forceReLoginRequiredForRegion: ",r),!1}}checkForPendingLogin(){this.pendingUserLogin&&this.initializeClient(this.pendingUserLogin,this.userOptions$?.value||{},new Date().getTime(),void 0,this.pendingUserLoginSource)}setFirebaseConfig(e){this.loggingService.log("%c[WB] Calling FUNCTION: setFirebaseConfig","color: green;");try{this.firebaseConfig$.value||this.firebaseConfig$.next({firebaseOptions:I(I({},Xn.firebaseConfig),e)})}catch(i){this.loggingService.catch("Error in setFirebaseConfig: ",i)}}getFirebaseConfig$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getFirebaseConfig","color: green;"),this.firebaseConfig$.asObservable()}getFirebaseConfig(){return this.loggingService.log("%c[WB] Calling FUNCTION: getFirebaseConfig","color: green;"),this.firebaseConfig$.value}setAdvancedQueries(e){this.loggingService.log("%c[WB] Calling FUNCTION: setAdvancedQueries","color: green;");try{e&&typeof e=="object"&&localStorage.setItem(j.LOCAL_STORAGE.VELT_ADVANCED_QUERIES,JSON.stringify(e)),this.advancedQueries$.next(e)}catch(i){this.loggingService.catch("Error in setAdvancedQueries: ",i)}}getAdvancedQueries$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getAdvancedQueries$","color: green;"),this.advancedQueries$.asObservable()}getAdvancedQueries(){return this.loggingService.log("%c[WB] Calling FUNCTION: getAdvancedQueries","color: green;"),this.advancedQueries$.value}getAdvancedQueriesEnabled$(){return Rn([this.configService.getConfig$(),this.getAdvancedQueries$()]).pipe(ce(()=>this.getAdvancedQueriesEnabled()),jn(()=>se(!1)))}getAdvancedQueriesEnabled(){try{return!this.configService.getConfig()?.advancedQueriesDisabled&&!!this.getAdvancedQueries()?.advancedQueriesEnabled}catch(e){return this.loggingService.catch("Error in getAdvancedQueriesEnabled: ",e),!1}}signOutPreviousUser(){return this.signOutPreviousUser$.asObservable()}getUser(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUser","color: green;"),this.afAuth?.currentUser?this.user$.value:null}getUser$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUser$","color: green;"),qn(this.afAuth).pipe(he(e=>e?this.user$.asObservable():se(null)))}getAuthUser(){return this.loggingService.log("%c[WB] Calling FUNCTION: getAuthUser","color: green;"),this.afAuth?.currentUser}getUserOptions(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUserOptions","color: green;"),this.userOptions$.value}getUserOptions$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUserOptions$","color: green;"),this.userOptions$.asObservable()}updateUser(e){this.loggingService.log("%c[WB] Calling FUNCTION: updateUser","color: green;");try{let i=this.user$.value;if(e.userId&&e.userId!==i?.userId||e?.groupId&&e?.groupId!==i?.groupId||e?.organizationId&&e?.organizationId!==i?.organizationId)this.providedUser=e,this.initializeClient(e,this.userOptions$?.value||{},new Date().getTime(),void 0,"internal-updateUser");else if(this.providedUser=I(I({},this.providedUser),e),i){let r=I(I({},i),e);this.updateUserInternally(r)}}catch(i){this.loggingService.catch("Error in updateUser: ",i)}}signInWithCustomToken(e,i,r="manual"){this.loggingService.log("%c[WB] Calling FUNCTION: signInWithCustomToken","color: green;");try{return bJ(this.afAuth,i).then(a=>(this.analyticsService.trackEvent(X.Events.Core.SDK_USER_AUTH_SUCCESS,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,authType:r,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e)}),a)).catch(a=>(this.analyticsService.trackEvent(X.Events.Core.SDK_USER_AUTH_FAILED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,authType:r,forceReset:this.userOptions$.value?.forceReset,message:a.message,user:this.getUserWithoutContacts(e)}),a))}catch(a){return this.loggingService.catch("Error in signInWithCustomToken: ",a),Promise.reject(a)}}resetServicesCache(){this.loggingService.log("%c[WB] Calling FUNCTION: resetServicesCache in AuthService","color: green;");try{this.commonDbService?.unsubscribeFromObservables(),this.docService?.clearCacheOnUserCascade(),this.contactService?.clearCache(),this.iamService?.clearCache(),this.areaService?.clearCache(),this.commentService?.clearCache(),this.reactionService?.clearCache(),this.recorderAnnotationService?.clearCache(),this.viewsService?.clearCache()}catch(e){this.loggingService.catch("Error in resetServicesCache: ",e)}}initializeSignedInUser(e,i){this.loggingService.log("%c[WB] Calling FUNCTION: initializeSignedInUser","color: green;");try{let r=new wo;r.userSnippylyId=e.uid,r.type="signedIn",this.mergeUserWithProvidedUserData(r,i)}catch(r){this.loggingService.catch("Error in initializeSignedInUser: ",r)}}mergeUserWithProvidedUserData(e,i){return Q(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: mergeUserWithProvidedUserData","color: green;");try{e.userId=this.providedUser?.userId||e.userId;let r=null;if(this.usersService?.userDataProviderAvailable()){let a=yield this.usersService.resolveUsers({userIds:[e.userId]});a&&a[e.userId]&&(r=JSON.parse(JSON.stringify(a[e.userId]||{}))),e=I(I({},e),r||{})}e.name=r?r?.name:this.providedUser?.name||e.name,e.clientUserName=r?r?.clientUserName:this.providedUser?.clientUserName||e.clientUserName,e.photoUrl=r?r?.photoUrl:this.providedUser?.photoUrl||e.photoUrl,e?.photoUrl===void 0&&(e.photoUrl=null),e.email=r?r?.email:this.providedUser?.email||e.email,e.color=r?r?.color:this.providedUser?.color||this.avatarService.generateUserColor(yn(e.userId)),e.textColor=r?r?.textColor:this.providedUser?.textColor||"#FFFFFF",e.initial=r?r?.initial:this.providedUser?.initial||e.initial||e.name?.charAt(0).toUpperCase()||e.email?.charAt(0).toUpperCase(),e.contacts=this.providedUser?.contacts||e.contacts,e.plan=this.providedUser?.plan||e.plan,e.groupId=this.providedUser?.groupId||e.groupId,e.clientGroupId=this.providedUser?.clientGroupId||e.clientGroupId,e.clientOrganizationId=this.providedUser?.clientOrganizationId||e.clientOrganizationId,e.organizationId=this.providedUser?.organizationId||e.organizationId,e.isAdmin=this.providedUser?.isAdmin,e.isReadOnly=this.providedUser?.isReadOnly,e.isAnonymous=this.providedUser?.isAnonymous,e.isGuest=this.providedUser?.isGuest,this.updateUserInternally(e)}catch(r){this.loggingService.catch("Error in mergeUserWithProvidedUserData: ",r)}})}updateUserInternally(e){return Q(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: updateUserInternally","color: green;");try{let i=Object.assign({},e);delete i.contacts,this.analyticsService.identifyUser(e.userSnippylyId,i,{forceReset:this.userOptions$.value?.forceReset}),this.getPlanDetailsCalled||(yield this.getPlanDetailsFromDb()),this.afAuth.currentUser&&(this.user$.next(e),this.updateUserToFirebase(e))}catch(i){this.loggingService.catch("Error in updateUserInternally: ",i)}})}updateUserToFirebase(e){this.loggingService.log("%c[WB] Calling FUNCTION: updateUserToFirebase","color: green;");try{let i=JSON.parse(JSON.stringify(e)),r=T(I({},i),{lastUpdated:new Date})}catch(i){this.loggingService.catch("Error in updateUserToFirebase: ",i)}}getPlanDetailsFromDb(){return Q(this,null,function*(){try{this.getPlanDetailsCalled=!0;let i=yield yr(this.functions,br({url:Xn.cloudFunction.getPlanDetails,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:20*60*1e3})({apiKey:this.configService.getApiKey(),sdkVersion:ga(),sdkType:this.configService.getSdkType()});return i?.data?.isPlanExpired&&(this.analyticsService.trackEvent(X.Events.Core.SDK_PLAN_EXPIRED),this.configService.getSF()||console.warn("Velt SDK plan has expired.")),this.planDetails$.next(i?.data||{planInfo:null,isPlanExpired:!1}),i}catch(e){return this.loggingService.catch("Error in getPlanDetailsFromDb: ",e),this.planDetails$.next({planInfo:null,isPlanExpired:!1}),Promise.resolve(null)}})}isPlanExpired$(){return this.planDetails$.pipe(Fe(e=>!!e),ce(e=>!!e?.isPlanExpired))}isPlanExpired(){return this.planDetails$.getValue()?.isPlanExpired}addPreSignOutFuction(e,i){try{this.preSignOutFunctions.set(e,i)}catch(r){this.loggingService.catch("Error in addPreSignOutFuction: ",r)}}setUserOrganization(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setUserOrganization","color: green;");let i=JSON.parse(JSON.stringify(this.userOrganization$.value||{}));this.getUser()?.organizationId===e?.organizationId?(i.metadata=e,this.userOrganization$.next(i)):this.userOrganization$.next(null)}catch(i){this.loggingService.catch("Error in setUserOrganization: ",i)}}setOrganizationUserGroups(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setUserOrganizationGroups","color: green;");let i=JSON.parse(JSON.stringify(this.userOrganization$.value||{}));this.getUser()?.organizationId===i?.metadata?.organizationId&&(i.groups=e,this.userOrganization$.next(i))}catch(i){this.loggingService.catch("Error in setUserOrganizationGroups: ",i)}}getUserOrganization$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUserOrganization$","color: green;"),this.getUser$().pipe(he(e=>e?this.userOrganization$.asObservable().pipe(ce(i=>i?.metadata?.organizationId===e.organizationId?i:null)):se(null)))}signOutUser(e="internal"){return Q(this,null,function*(){try{yield this.analyticsService.trackEvent(X.Events.Core.SDK_USER_SIGN_OUT,{apiKey:this.apiKey,clientUserId:this.user$?.value?.userId,snippylyUserId:this.user$?.value?.userSnippylyId,message:e==="external"?"User Sign out":"System Sign out",user:this.user$?.value?this.getUserWithoutContacts(this.user$?.value):null,forceReset:this.userOptions$.value?.forceReset,source:e});let i=yield qn(this.afAuth).pipe(tt(1)).toPromise().catch(r=>null);if(i){this.user$.next(null);for(let[r,a]of this.preSignOutFunctions)try{yield a(i)}catch(s){this.loggingService.catch(`Error in signOutUser ${r} function: `,s)}return this.resetServicesCache(),this.user$.next(null),IJ(this.afAuth).catch(r=>{this.loggingService.catch("Error in signOutUser:",r)})}else return Promise.resolve()}catch(i){this.loggingService.catch("Error in signOutUser: ",i)}})}isFeatureAllowed(e){return eo(this.config,this.user$.value,e)}getUserWithoutContacts(e){try{if(e){let i=JSON.parse(JSON.stringify(e));return delete i.contacts,i}else return null}catch(i){return this.loggingService.catch("Error in getUserWithoutContacts: ",i),null}}getUserForClient(e){try{return ha(e)}catch(i){return this.loggingService.catch("Error in getUserForClient: ",i),null}}};o.\u0275fac=function(i){return new(i||o)(J(bi),J(jt),J(Dm),J(wm),J(Ne),J(jo),J(Ze),J(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Om=class{constructor({apiKey:o,documentId:t,organizationId:e,clientDocumentId:i,clientOrganizationId:r}){this.paths={},this.apiKey=o,this.documentId=t,this.organizationId=e,this.clientDocumentId=i,this.clientOrganizationId=r,i&&(this.documentId=Cc(i)),r&&(this.organizationId=_c(r)),this.generateDocumentPaths()}generateDocumentPaths(){try{if(this.paths.clientDocumentId=this.clientDocumentId,this.paths.documentId=this.documentId,this.organizationId&&(this.paths.organizationId=this.organizationId,this.paths.clientOrganizationId=this.clientOrganizationId),this.apiKey){let o=`${this.apiKey}`;this.organizationId&&(o=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.paths.organizationId}`),this.documentId&&(this.paths.docs=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/`,this.paths.presence=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_PRESENCE}/`,this.paths.cursor=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_CURSOR}/`,this.paths.comment=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_COMMENT}/`,this.paths.multiThread=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_MULTI_THREAD}/`,this.paths.tag=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_TAG}/`,this.paths.area=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_AREA}/`,this.paths.arrow=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_ARROW}/`,this.paths.selection=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_SELECTION}/`,this.paths.audioHuddle=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_AUDIO_HUDDLE}/`,this.paths.huddle=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_HUDDLE}/`,this.paths.recorder=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_RECORDER}/`,this.paths.flock=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_FOLLOW_ALONG}/`,this.paths.syncVideoPlayer=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_SYNC_VIDEO_PLAYER}/`,this.paths.liveState=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_LIVE_STATE}/`,this.paths.liveStateSingleEditorMode=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_LIVE_STATE}/default/singleEditorMode`,this.paths.reaction=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_REACTION}/`,this.paths.views=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_VIEWS}/`,this.paths.notifications=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATIONS}/`,this.paths.metadata=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_METADATA}/`,this.paths.users=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_USERS}/`,this.paths.documentIam=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_IAM}/`,this.paths.userConfig=`${o}/${j.FIREBASE_PARTIAL_PATH_USERS}`),this.paths.customerMetadata=`${o}/${j.FIREBASE_PARTIAL_PATH_CUSTOMER_METADATA}/`,this.paths.groupContacts=`${o}/${j.FIREBASE_PARTIAL_PATH_CONTACTS}/${j.FIREBASE_PARTIAL_PATH_GROUPS}/`,this.paths.globalContacts=`${o}/${j.FIREBASE_PARTIAL_PATH_CONTACTS}/${j.FIREBASE_PARTIAL_PATH_GLOBAL}/`,this.paths.logins=`${o}/${j.FIREBASE_PARTIAL_PATH_CONTACTS}/${j.FIREBASE_PARTIAL_PATH_LOGINS}/`,this.paths.userFeedback=`${o}/${j.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${j.FIREBASE_PARTIAL_PATH_FEEDBACK}/`,this.paths.userReportBugs=`${o}/${j.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${j.FIREBASE_PARTIAL_PATH_BUGS}/`,this.paths.userContactUs=`${o}/${j.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${j.FIREBASE_PARTIAL_PATH_CONTACT_US}/`,this.organizationId&&(this.paths.organizationMetadata=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_METADATA}/`,this.paths.organizationIam=`${o}/${j.FIREBASE_PARTIAL_PATH_IAM}/`,this.paths.organizationGroups=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_GROUPS}/`,this.paths.organizationNotifications=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/`,this.documentId&&(this.paths.organizationNotificationsWithDocumentId=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/`),this.paths.organizationNotificationsLastNotificationTimestamp=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${j.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}/${j.FIREBASE_PARTIAL_PATH_DOCS}/`,this.paths.organizationNotificationsUsers=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${j.FIREBASE_PARTIAL_PATH_USERS}/`),this.paths.workspaceIam=`${this.apiKey}/${j.FIREBASE_PARTIAL_PATH_IAM}/`}}catch{}}get userConfig(){return this.paths.userConfig?this.paths.userConfig:this.throwError("User config path is not available.")}get workspaceIam(){return this.paths.workspaceIam?this.paths.workspaceIam:this.throwError("Workspace IAM path is not available.")}get docs(){return this.paths.docs?this.paths.docs:this.throwError("Docs path is not available.")}get presence(){return this.paths.presence?this.paths.presence:this.throwError("Presence path is not available.")}get cursor(){return this.paths.cursor?this.paths.cursor:this.throwError("Cursor path is not available.")}get area(){return this.paths.area?this.paths.area:this.throwError("Area path is not available.")}get arrow(){return this.paths.arrow?this.paths.arrow:this.throwError("Arrow path is not available.")}get comment(){return this.paths.comment?this.paths.comment:this.throwError("Comment path is not available.")}get multiThread(){return this.paths.multiThread?this.paths.multiThread:this.throwError("Multi thread path is not available.")}get tag(){return this.paths.tag?this.paths.tag:this.throwError("Tag path is not available.")}get selection(){return this.paths.selection?this.paths.selection:this.throwError("Selection path is not available.")}get audioHuddle(){return this.paths.audioHuddle?this.paths.audioHuddle:this.throwError("Audio huddle path is not available.")}get huddle(){return this.paths.huddle?this.paths.huddle:this.throwError("Huddle path is not available.")}get recorder(){return this.paths.recorder?this.paths.recorder:this.throwError("Recorder path is not available.")}get flock(){return this.paths.flock?this.paths.flock:this.throwError("Flock path is not available.")}get syncVideoPlayer(){return this.paths.syncVideoPlayer?this.paths.syncVideoPlayer:this.throwError("Sync video player path is not available.")}get liveState(){return this.paths.liveState?this.paths.liveState:this.throwError("Live state path is not available.")}get liveStateSingleEditorMode(){return this.paths.liveStateSingleEditorMode?this.paths.liveStateSingleEditorMode:this.throwError("Live state single editor mode path is not available.")}get reaction(){return this.paths.reaction?this.paths.reaction:this.throwError("Reaction path is not available.")}get views(){return this.paths.views?this.paths.views:this.throwError("Views path is not available.")}get notifications(){return this.paths.notifications?this.paths.notifications:this.throwError("Notifications path is not available.")}get metadata(){return this.paths.metadata?this.paths.metadata:this.throwError("Metadata path is not available.")}get users(){return this.paths.users?this.paths.users:this.throwError("Users path is not available.")}get documentIam(){return this.paths.documentIam?this.paths.documentIam:this.throwError("Document IAM path is not available.")}get organizationMetadata(){return this.paths.organizationMetadata?this.paths.organizationMetadata:this.throwError("Organization metadata path is not available.")}get organizationIam(){return this.paths.organizationIam?this.paths.organizationIam:this.throwError("Organization IAM path is not available.")}get customerMetadata(){return this.paths.customerMetadata?this.paths.customerMetadata:this.throwError("Customer metadata path is not available.")}get groupContacts(){return this.paths.groupContacts?this.paths.groupContacts:this.throwError("Group contacts path is not available.")}get globalContacts(){return this.paths.globalContacts?this.paths.globalContacts:this.throwError("Global contacts path is not available.")}get logins(){return this.paths.logins?this.paths.logins:this.throwError("Logins path is not available.")}get userFeedback(){return this.paths.userFeedback?this.paths.userFeedback:this.throwError("User feedback path is not available.")}get userReportBugs(){return this.paths.userReportBugs?this.paths.userReportBugs:this.throwError("User report bugs path is not available.")}get userContactUs(){return this.paths.userContactUs?this.paths.userContactUs:this.throwError("User contact us path is not available.")}get organizationGroups(){return this.paths.organizationGroups?this.paths.organizationGroups:this.throwError("Organization groups path is not available.")}get organizationNotifications(){return this.paths.organizationNotifications?this.paths.organizationNotifications:this.throwError("Organization notifications path is not available.")}get organizationNotificationsWithDocumentId(){return this.paths.organizationNotificationsWithDocumentId?this.paths.organizationNotificationsWithDocumentId:this.throwError("Organization notifications with document id path is not available.")}get organizationNotificationsUsers(){return this.paths.organizationNotificationsUsers?this.paths.organizationNotificationsUsers:this.throwError("Organization notifications users path is not available.")}get organizationNotificationsLastNotificationTimestamp(){return this.paths.organizationNotificationsLastNotificationTimestamp?this.paths.organizationNotificationsLastNotificationTimestamp:this.throwError("Organization notifications last notification timestamp path is not available.")}throwError(o){throw{type:"DocumentPaths",message:o,metadata:{apiKey:this.apiKey,documentId:this.documentId,organizationId:this.organizationId}}}};var IM=class{constructor({apiKey:o,documentId:t,organizationId:e,clientDocumentId:i,clientOrganizationId:r,folderId:a,veltFolderId:s}){this.paths={},this.apiKey=o,this.documentId=t,this.organizationId=e,this.veltFolderId=s,i&&(this.documentId=Cc(i)),r&&(this.organizationId=_c(r)),a&&(this.folderId=a,this.veltFolderId=Tl(a)),this.generateDocumentPaths()}generateDocumentPaths(){try{if(this.paths.clientDocumentId=this.clientDocumentId,this.paths.documentId=this.documentId,this.organizationId&&(this.paths.organizationId=this.organizationId,this.paths.clientOrganizationId=this.clientOrganizationId),this.veltFolderId&&(this.paths.folderId=this.folderId,this.paths.veltFolderId=this.veltFolderId),this.apiKey){let o=`apiKey/${this.apiKey}`;this.organizationId&&(o=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.paths.organizationId}`,this.paths.organization=o,this.paths.folder=`${o}/${j.FIREBASE_PARTIAL_PATH_FOLDERS}`,this.paths.organizationUsers=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_USERS}`,this.paths.notificationDocs=`${o}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATION_DOCS}`,this.paths.notificationUsers=`${o}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATION_USERS}`,this.paths.organizationGroups=`${o}/${j.FIREBASE_PARTIAL_PATH_GROUPS}`,this.paths.lastNotificationTimestamp=`${o}/${j.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}`,this.paths.userConfig=`${o}/${j.FIREBASE_PARTIAL_PATH_USERS}`),this.veltFolderId&&(this.paths.folderUsers=`${o}/${j.FIREBASE_PARTIAL_PATH_FOLDERS}/${this.veltFolderId}/${j.FIREBASE_PARTIAL_PATH_FOLDER_USERS}`),this.documentId&&(this.paths.document=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}`,this.paths.comment=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_COMMENT}`,this.paths.location=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_LOCATION}`,this.paths.multiThread=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_MULTI_THREAD}`,this.paths.area=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_AREA}`,this.paths.recorder=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_RECORDER}`,this.paths.reaction=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_REACTION}`,this.paths.commentViews=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_COMMENT_VIEWS}`,this.paths.notificationViews=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATION_VIEWS}`,this.paths.documentViews=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS}`,this.paths.locationViews=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS}`,this.paths.documentUsers=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS}`,this.paths.docNotification=`${this.paths.notificationDocs}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_DOC_NOTIFICATION}`)}}catch{}}get userConfig(){return this.paths.userConfig?this.paths.userConfig:this.throwError("UserConfig path is not available.")}get folder(){return this.paths.folder?this.paths.folder:this.throwError("Folder path is not available.")}get lastNotificationTimestamp(){return this.paths.lastNotificationTimestamp?this.paths.lastNotificationTimestamp:this.throwError("LastNotificationTimestamp path is not available.")}get organizationGroups(){return this.paths.organizationGroups?this.paths.organizationGroups:this.throwError("organizationGroups path is not available.")}get docNotification(){return this.paths.docNotification?this.paths.docNotification:this.throwError("DocNotification path is not available.")}get organization(){return this.paths.organization?this.paths.organization:this.throwError("Organization path is not available.")}get document(){return this.paths.document?this.paths.document:this.throwError("Document path is not available.")}get location(){return this.paths.location?this.paths.location:this.throwError("Location path is not available.")}get area(){return this.paths.area?this.paths.area:this.throwError("Area path is not available.")}get comment(){return this.paths.comment?this.paths.comment:this.throwError("Comment path is not available.")}get commentViews(){return this.paths.commentViews?this.paths.commentViews:this.throwError("CommentViews path is not available.")}get documentViews(){return this.paths.documentViews?this.paths.documentViews:this.throwError("DocumentViews path is not available.")}get locationViews(){return this.paths.locationViews?this.paths.locationViews:this.throwError("LocationViews path is not available.")}get notificationViews(){return this.paths.notificationViews?this.paths.notificationViews:this.throwError("NotificationViews path is not available.")}get documentUsers(){return this.paths.documentUsers?this.paths.documentUsers:this.throwError("DocumentUsers path is not available.")}get folderUsers(){return this.paths.folderUsers?this.paths.folderUsers:this.throwError("FolderUsers path is not available.")}get organizationUsers(){return this.paths.organizationUsers?this.paths.organizationUsers:this.throwError("OrganizationUsers path is not available.")}get notificationDocs(){return this.paths.notificationDocs?this.paths.notificationDocs:this.throwError("NotificationDocs path is not available.")}get notificationUsers(){return this.paths.notificationUsers?this.paths.notificationUsers:this.throwError("NotificationUsers path is not available.")}get multiThread(){return this.paths.multiThread?this.paths.multiThread:this.throwError("Multi thread path is not available.")}get recorder(){return this.paths.recorder?this.paths.recorder:this.throwError("Recorder path is not available.")}get reaction(){return this.paths.reaction?this.paths.reaction:this.throwError("Reaction path is not available.")}throwError(o){throw{type:"DocumentPaths",message:o,metadata:{apiKey:this.apiKey,documentId:this.documentId,organizationId:this.organizationId}}}};var EM=class{};var hn=(()=>{let o=class o{constructor(e,i){this.authService=e,this.loggingService=i,this.db$=new Ce(null);try{this.authService.getFirebaseConfig$().subscribe(r=>{r&&this.db$.next(jf(void 0,r.firebaseOptions.databaseURL))},r=>{this.loggingService.catch("Error in DatabaseService constructor: ",r)})}catch(r){this.loggingService.catch("Error in DatabaseService constructor:",r)}}getDb(){return this.db$.asObservable()}};o.\u0275fac=function(i){return new(i||o)(J(He),J(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var xs=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.analyticsService=i,this.resolveTimeout=1*60*1e3,this.retrySaveConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryDeleteConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryGetConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.commentAnnotationDataProvider$=new Ce(null),this.commentAnnotationById$=new Ce({}),this.getCommentAnnotationById=r=>{try{return this.commentAnnotationDataProviderAvailable()?this.commentAnnotationById$.value?.[r]:void 0}catch(a){this.loggingService.catch("Error in CommentAnnotationsResolverService getCommentAnnotationById:",a);return}};try{this.loggingService.log("CommentAnnotationsResolverService initialized"),this.commentAnnotationDataProvider$.subscribe(r=>{r&&(r.config?.resolveTimeout&&(this.resolveTimeout=r.config.resolveTimeout),r.config?.saveRetryConfig&&(this.retrySaveConfig=r.config.saveRetryConfig),r.config?.deleteRetryConfig&&(this.retryDeleteConfig=r.config.deleteRetryConfig),r.config?.getRetryConfig&&(this.retryGetConfig=r.config.getRetryConfig))})}catch(r){this.loggingService.catch("Error in CommentAnnotationsResolverService constructor:",r)}}getProvider(){try{let e=this.commentAnnotationDataProvider$.getValue();return e||void 0}catch(e){this.loggingService.catch("Error in CommentAnnotationsResolverService getProvider:",e);return}}ngOnDestroy(){try{this.commentAnnotationById$.next({})}catch(e){this.loggingService.catch("Error in CommentAnnotationsResolverService ngOnDestroy:",e)}}resolveCommentAnnotations(e){return Q(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: resolveCommentAnnotations","color: green;"),!this.commentAnnotationDataProviderAvailable())return{};let i,r=!1,a=!1,s=()=>{i&&(clearTimeout(i),i=void 0,a=!0)};return new Promise((m,p)=>{i=setTimeout(()=>{a||(r=!0,s(),p(new Error("Comment annotation resolution timeout")))},this.commentAnnotationDataProvider$.value?.config?.resolveTimeout||this.resolveTimeout);let h=this.getProvider();if(!h)return s(),m({});let _={},E=[...new Set(e.commentAnnotationIds||[])],D=T(I({},e),{commentAnnotationIds:E});Q(this,null,function*(){try{if(E.length>0||e.documentIds?.length||e.folderId){let H=Sc(()=>h?.get(D)||Promise.resolve(void 0),"getCommentAnnotations",this.retryGetConfig).then(K=>r?{}:(s(),K&&K.statusCode!==200?(this.loggingService.catch(K?.message??"Error in CommentAnnotationsResolverService resolveCommentAnnotations:"),{}):K?.data)).catch(K=>{throw s(),K});try{_=(yield H)||{},this.analyticsService.trackEvent(X.Events.Resolver.COMMENT_RESOLVER_GET,{sourceMethod:"resolveCommentAnnotations",source:"sdk",commentAnnotationIds:E});let K={};Object.entries(_).forEach(([oe,ue])=>{let be=this.commentAnnotationById$.value?.[oe];be?be&&JSON.stringify(be)!==JSON.stringify(ue)&&(K[oe]=ue):K[oe]=ue}),Object.keys(K).length>0&&this.commentAnnotationById$.next(I(I({},this.commentAnnotationById$.getValue()),K)),m(K)}catch(K){r||p(K),m(_)}}else s(),m({})}catch(H){s(),p(H)}})})}catch(i){return this.loggingService.catch("Error in CommentAnnotationsResolverService resolveCommentAnnotations:",i),{}}})}saveCommentAnnotation(e){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: saveCommentAnnotation","color: green;");let i=this.getProvider();if(!this.commentAnnotationDataProviderAvailable())throw new Error("Comment annotation save data provider not available");let r=JSON.parse(JSON.stringify(this.commentAnnotationById$.getValue()));this.commentAnnotationById$._value=I(I({},r),e.commentAnnotation);let a=yield Sc(()=>i?.save({commentAnnotation:e.commentAnnotation,event:e.eventType,commentId:e.commentId,metadata:Object.values(e.commentAnnotation??{})?.[0]?.metadata})||Promise.resolve(void 0),"saveCommentAnnotation",this.retrySaveConfig);return a&&a.statusCode!==200?(this.retrySaveConfig.revertOnFailure&&(this.commentAnnotationById$._value=r),this.loggingService.catch(a?.message??"Error in CommentAnnotationsResolverService saveCommentAnnotation:"),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(X.Events.Resolver.COMMENT_RESOLVER_SAVE,{sourceMethod:"saveCommentAnnotation",source:"sdk",commentAnnotationIds:Object.keys(e.commentAnnotation),eventType:e.eventType,commentId:e.commentId}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0})}catch(i){return this.loggingService.warn("Error in CommentAnnotationsResolverService saveCommentAnnotation:",i),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0}}})}deleteCommentAnnotation(e,i){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: deleteCommentAnnotation","color: green;");let r=this.getProvider();if(!this.commentAnnotationDataProviderAvailable())throw new Error("Comment annotation delete data provider not available");let a=this.commentAnnotationById$.getValue(),s=I({},a);delete s?.[e],this.commentAnnotationById$._value=s;let m=yield Sc(()=>r?.delete({commentAnnotationId:e.toString(),metadata:i,event:Ya.COMMENT_ANNOTATION_DELETE})||Promise.resolve(void 0),"deleteCommentAnnotation",this.retryDeleteConfig);return m&&m.statusCode!==200?(this.retryDeleteConfig.revertOnFailure&&(this.commentAnnotationById$._value=a),this.loggingService.catch(m?.message??"Error in CommentAnnotationsResolverService deleteCommentAnnotation:"),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(X.Events.Resolver.COMMENT_RESOLVER_DELETE,{sourceMethod:"deleteCommentAnnotation",source:"sdk",commentAnnotationId:e.toString()}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(r){return this.loggingService.warn("Error in CommentAnnotationsResolverService deleteCommentAnnotation:",r),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0}}})}getCommentAnnotationsById$(){try{return this.commentAnnotationDataProviderAvailable()?(this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: getCommentAnnotationsById$","color: green;"),this.commentAnnotationById$.asObservable()):se(void 0)}catch(e){return this.loggingService.catch("Error in CommentAnnotationsResolverService getCommentAnnotationsById$:",e),se(void 0)}}getAnnotationById(e){try{return this.commentAnnotationDataProviderAvailable()?this.commentAnnotationById$.getValue()?.[e]:void 0}catch(i){this.loggingService.catch("Error in CommentAnnotationsResolverService getAnnotationById:",i);return}}setCommentAnnotationDataProvider(e){try{if(e){this.loggingService.log("Setting comment annotation data provider");let r=["get","save","delete"].filter(a=>!(a in e)||typeof e[a]!="function");if(r.length>0){let a=`DataProviders.comment is invalid. The following methods are missing or are not functions: ${r.join(", ")}.`;this.loggingService.catch(a);return}else this.commentAnnotationDataProvider$.next(e)}}catch(i){this.loggingService.catch("Error in CommentAnnotationsResolverService setCommentAnnotationDataProvider:",i)}}commentAnnotationDataProviderAvailable(){try{return!!this.commentAnnotationDataProvider$.getValue()}catch(e){return this.loggingService.catch("Error in CommentAnnotationsResolverService commentAnnotationDataProviderAvailable:",e),!1}}};o.\u0275fac=function(i){return new(i||o)(J(y),J(Ze))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Am=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.analyticsService=i,this.resolveTimeout=1*60*1e3,this.retrySaveConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryDeleteConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryGetConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.reactionAnnotationDataProvider$=new Ce(null),this.reactionAnnotationById$=new Ce({}),this.getReactionAnnotationById=r=>{try{return this.reactionAnnotationDataProviderAvailable()?this.reactionAnnotationById$.value?.[r]:void 0}catch(a){this.loggingService.catch("Error in ReactionAnnotationsResolverService getReactionAnnotationById:",a);return}};try{this.loggingService.log("ReactionAnnotationsResolverService initialized"),this.reactionAnnotationDataProvider$.subscribe(r=>{r&&(r.config?.resolveTimeout&&(this.resolveTimeout=r.config.resolveTimeout),r.config?.saveRetryConfig&&(this.retrySaveConfig=r.config.saveRetryConfig),r.config?.deleteRetryConfig&&(this.retryDeleteConfig=r.config.deleteRetryConfig),r.config?.getRetryConfig&&(this.retryGetConfig=r.config.getRetryConfig))})}catch(r){this.loggingService.catch("Error in ReactionAnnotationsResolverService constructor:",r)}}getProvider(){try{let e=this.reactionAnnotationDataProvider$.getValue();return e||void 0}catch(e){this.loggingService.catch("Error in ReactionAnnotationsResolverService getProvider:",e);return}}ngOnDestroy(){try{this.reactionAnnotationById$.next({})}catch(e){this.loggingService.catch("Error in ReactionAnnotationsResolverService ngOnDestroy:",e)}}resolveReactionAnnotations(e){return Q(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: resolveReactionAnnotations","color: green;"),!this.reactionAnnotationDataProviderAvailable())return{};let i,r=!1,a=!1,s=()=>{i&&(clearTimeout(i),i=void 0,a=!0)};return new Promise((m,p)=>{i=setTimeout(()=>{a||(r=!0,s(),p(new Error("Reaction annotation resolution timeout")))},this.reactionAnnotationDataProvider$.value?.config?.resolveTimeout||this.resolveTimeout);let h=this.getProvider();if(!h)return s(),m({});let _={},E=[...new Set(e.reactionAnnotationIds||[])],D=T(I({},e),{reactionAnnotationIds:E});Q(this,null,function*(){try{if(E.length>0||e.documentIds?.length||e.folderId){let H=Sc(()=>h?.get(D)||Promise.resolve(void 0),"getReactionAnnotations",this.retryGetConfig).then(K=>r?{}:(s(),K&&K.statusCode!==200?(this.loggingService.catch(K?.message??"Error in ReactionAnnotationsResolverService resolveReactionAnnotations:"),{}):K?.data)).catch(K=>{throw s(),K});try{_=(yield H)||{},this.analyticsService.trackEvent(X.Events.Resolver.REACTION_RESOLVER_GET,{sourceMethod:"resolveReactionAnnotations",source:"sdk",reactionAnnotationIds:E});let K={};Object.entries(_).forEach(([oe,ue])=>{let be=this.reactionAnnotationById$.value?.[oe];be?be&&JSON.stringify(be)!==JSON.stringify(ue)&&(K[oe]=ue):K[oe]=ue}),Object.keys(K).length>0&&this.reactionAnnotationById$.next(I(I({},this.reactionAnnotationById$.getValue()),K)),m(K)}catch(K){r||p(K),m(_)}}else s(),m({})}catch(H){s(),p(H)}})})}catch(i){return this.loggingService.catch("Error in ReactionAnnotationsResolverService resolveReactionAnnotations:",i),{}}})}saveReactionAnnotation(e){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: saveReactionAnnotation","color: green;");let i=this.getProvider();if(!this.reactionAnnotationDataProviderAvailable())throw new Error("Reaction annotation save data provider not available");let r=JSON.parse(JSON.stringify(this.reactionAnnotationById$.getValue()));this.reactionAnnotationById$._value=I(I({},r),e);let a={reactionAnnotation:e,event:Ya.REACTION_ADD,metadata:Object.values(e??{})?.[0]?.metadata},s=yield Sc(()=>i?.save(a)||Promise.resolve(void 0),"saveReactionAnnotation",this.retrySaveConfig);return s&&s.statusCode!==200?(this.retrySaveConfig.revertOnFailure&&(this.reactionAnnotationById$._value=r),this.loggingService.catch(s?.message??"Error in ReactionAnnotationsResolverService saveReactionAnnotation:"),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(X.Events.Resolver.REACTION_RESOLVER_SAVE,{sourceMethod:"saveReactionAnnotation",source:"sdk",reactionAnnotationIds:Object.keys(e),eventType:a.event}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0})}catch(i){return this.loggingService.warn("Error in ReactionAnnotationsResolverService saveReactionAnnotation:",i),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0}}})}deleteReactionAnnotation(e,i){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: deleteReactionAnnotation","color: green;");let r=this.getProvider();if(!this.reactionAnnotationDataProviderAvailable())throw new Error("Reaction annotation delete data provider not available");let a=JSON.parse(JSON.stringify(this.reactionAnnotationById$.getValue())),s=I({},a);delete s?.[e],this.reactionAnnotationById$._value=s;let m=yield Sc(()=>r?.delete({reactionAnnotationId:e.toString(),metadata:i,event:Ya.REACTION_DELETE})||Promise.resolve(void 0),"deleteReactionAnnotation",this.retryDeleteConfig);return m&&m.statusCode!==200?(this.retryDeleteConfig.revertOnFailure&&(this.reactionAnnotationById$._value=a),this.loggingService.catch(m?.message??"Error in ReactionAnnotationsResolverService deleteReactionAnnotation:"),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(X.Events.Resolver.REACTION_RESOLVER_DELETE,{sourceMethod:"deleteReactionAnnotation",source:"sdk",reactionAnnotationId:e.toString()}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(r){return this.loggingService.warn("Error in ReactionAnnotationsResolverService deleteReactionAnnotation:",r),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0}}})}getReactionAnnotationsById$(){try{return this.reactionAnnotationDataProviderAvailable()?(this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: getReactionAnnotationsById$","color: green;"),this.reactionAnnotationById$.asObservable()):se(void 0)}catch(e){return this.loggingService.catch("Error in ReactionAnnotationsResolverService getReactionAnnotationsById$:",e),se(void 0)}}getAnnotationById(e){try{return this.reactionAnnotationDataProviderAvailable()?this.reactionAnnotationById$.getValue()?.[e]:void 0}catch(i){this.loggingService.catch("Error in ReactionAnnotationsResolverService getAnnotationById:",i);return}}setReactionAnnotationDataProvider(e){try{if(e){this.loggingService.log("Setting reaction annotation data provider");let r=["get","save","delete"].filter(a=>!(a in e)||typeof e[a]!="function");if(r.length>0){let a=`DataProviders.reaction is invalid. The following methods are missing or are not functions: ${r.join(", ")}.`;this.loggingService.catch(a);return}else this.reactionAnnotationDataProvider$.next(e)}}catch(i){this.loggingService.catch("Error in ReactionAnnotationsResolverService setReactionAnnotationDataProvider:",i)}}reactionAnnotationDataProviderAvailable(){try{return!!this.reactionAnnotationDataProvider$.getValue()}catch(e){return this.loggingService.catch("Error in ReactionAnnotationsResolverService reactionAnnotationDataProviderAvailable:",e),!1}}};o.\u0275fac=function(i){return new(i||o)(J(y),J(Ze))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var lt=(()=>{let o=class o{constructor(e,i,r,a,s,m,p,h,_){this.analyticsService=e,this.authService=i,this.databaseService=r,this.domService=a,this.configService=s,this.loggingService=m,this.commentResolverService=p,this.reactionResolverService=h,this.coreActionsService=_,this.documentPaths$=new Ce(null),this.documentIds$=new Ce([]),this.organizationConfig$=new Ce(null),this.firestorePaths$=new Ce(null),this.location$=new Ce(null),this.excludedLocationIds$=new Ce([]),this.organizationMetadata$=new Ce(null),this.documentMetadata$=new Ce(null),this.locationMetadata$=new Ce(null),this.customerMetadata$=new Ce(null),this.currentDocumentId=null,this.isCustomDocId=!1,this.locations$=new Ce({}),this.preDocumentIdChangeFunctions=new Map,this.draftDocuments=[],this.clientDocumentMetadataMap={},this.uiState=new Ce({}),this.lastSetDocumentIdExecutionTime=0,this.lastSetDocumentIdCallTime=0,this.setDocumentIdSubject=new Ke,this.DEBOUNCE_TIME=5e3,this.MAX_QUEUE_SIZE=100,this.queueSize=0,this.isDocumentIdInDebounceQueue=!1,this.draftLocationMap={locations:[],options:void 0};try{this.loggingService.log("%c[WB] Creating CLASS: DocService","color: blue;"),this.domService.setDocService(this),this.authService.setDocService(this),this.setDocumentIdSubject.pipe(rr(this.DEBOUNCE_TIME)).subscribe({next:E=>Q(this,null,function*(){try{yield this.setDocumentIdImpl(E.documentId,E.clientOrganizationId,E.options),this.lastSetDocumentIdExecutionTime=Date.now(),this.isDocumentIdInDebounceQueue=!1,this.draftLocationMap.locations.length&&(yield this.setLocations({locations:this.draftLocationMap.locations,options:this.draftLocationMap.options,source:"internal"})),this.draftLocationMap={locations:[],options:void 0}}finally{this.queueSize--}}),error:E=>{this.loggingService.catch("Error in setDocumentId subscription:",E),this.queueSize--}}),this.databaseService.getDb().pipe(Fe(E=>!!E),tt(1)).subscribe(E=>{E&&(this.db=E)}),this.configService.getApiKey$().subscribe(E=>{if(this.apiKey=E,this.apiKey){if(!this.isCustomDocId){let D=G6(window.location.href);this.currentUrl=D}this.analyticsService.updateDefaultProperties({apiKey:E})}}),this.authService.getUser$().subscribe(E=>Q(this,null,function*(){E&&(this.analyticsService.updateDefaultProperties({organizationId:E?.organizationId,clientOrganizationId:E?.clientOrganizationId}),this.draftDocuments?.length?(yield this.setDocuments({documents:this.draftDocuments,options:this.draftOptions??void 0,source:"internal"}),this.draftDocuments=[],this.draftOptions=void 0,this.draftLocationMap.locations.length&&(yield this.setLocations({locations:this.draftLocationMap.locations,options:this.draftLocationMap.options,source:"internal"}).then(()=>this.draftLocationMap={locations:[],options:void 0}))):this.documentPaths$?.value&&E?.organizationId&&this.documentPaths$.value?.organizationId!==E?.organizationId&&(yield this.setDocuments({documents:this.documentIds$.value.length?this.documentIds$.value.map(D=>({id:D.clientDocumentId})):[{id:this.documentPaths$.value?.clientDocumentId}],options:void 0,source:"internal"})),setTimeout(()=>{this.documentPaths$.value||this.loggingService.catch("Error in DocService constructor:","Please set document id to continue.")},1e4),E?.organizationId&&E?.clientOrganizationId&&(this.organizationConfig$.next({organizationId:E?.organizationId,clientOrganizationId:E?.clientOrganizationId}),yield this.updateOrganizationMetadata()))})),this.documentPaths$.subscribe(E=>{let D={documentId:E?.documentId,clientDocumentId:E?.clientDocumentId,folderId:E?.folderId,allDocuments:E?.allDocuments,veltFolderId:E?.veltFolderId};E?.organizationId&&(D.organizationId=E.organizationId,D.clientOrganizationId=E.clientOrganizationId),this.analyticsService.updateDefaultProperties(D),this.domService.resetSelectedAnnotationsMap()}),this.location$.subscribe(E=>{this.analyticsService.updateDefaultProperties({clientLocation:E?.location,locationId:E?.locationId})}),this.organizationMetadata$.subscribe(E=>{this.authService.setUserOrganization(E?.[this.documentPaths$.value?.organizationId])}),this.documentPaths$.pipe(Fe(E=>!!E),tt(1)).subscribe(()=>{try{this.subscribeToCustomerMetadata()}catch(E){this.loggingService.catch("Error in DocService subscribeToCustomerMetadata:",E)}},E=>{this.loggingService.catch("Error in DocService subscribeToCustomerMetadata:",E)}),this.loggingService.log("%c[WB] Creating CLASS: DocService 2","color: blue;"),this.onWindowPopstate(),this.onWindowClick()}catch(E){this.loggingService.catch("Error in DocService constructor:",E)}}getOptionsFromDocumentPaths(){try{return this.documentPaths$.value?{folderId:this.documentPaths$.value?.folderId,allDocuments:this.documentPaths$.value?.allDocuments,locationId:this.documentPaths$.value?.locationId,organizationId:this.documentPaths$.value?.clientOrganizationId}:null}catch(e){return this.loggingService.catch("Error in getOptionsFromDocumentPaths:",e),null}}clearCacheOnUserCascade(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCacheOnUserCascade in DocService","color: green;");try{this.organizationConfig$.next(null),this.organizationMetadata$.next(null),this.customerMetadata$.next(null),this.customerMetadataSubscription?.unsubscribe(),this.documentPaths$.value&&(this.draftOptions=this.getOptionsFromDocumentPaths(),this.draftLocationMap={locations:[this.location$.value?.location??null,...Object.values(this.locations$.value||{}).map(e=>e.location)].filter(e=>e!==null),options:{rootLocationId:this.location$.value?.location?.id}},this.currentDocumentId=null,this.documentPaths$.next(null),this.firestorePaths$.next(null)),this.unsetDocuments({source:"internal"})}catch(e){this.loggingService.catch("Error in DocService clearCacheOnUserCascade: ",e)}}setCommonDbService(e){try{this.commonDbService=e}catch(i){this.loggingService.catch("Error in setCommonDbService:",i)}}setCommentService(e){try{this.commentService=e}catch(i){this.loggingService.catch("Error in setCommentService:",i)}}onWindowPopstate(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowPopstate","color: green;");try{this.domService.onWindowPopState$().subscribe(()=>{this.loggingService.log("location",location.href);let e=G6(location.href);this.currentUrl!==e&&(this.currentUrl=e,!this.isCustomDocId&&this.apiKey&&this.loggingService.log("current url in doc service",this.currentUrl))},e=>{this.loggingService.catch("Error in DocService onWindowPopstate subscription: ",e)})}catch(e){this.loggingService.catch("Error in onWindowPopstate: ",e)}}onWindowClick(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowClick","color: green;");try{this.domService.onWindowClick$().subscribe(()=>{let e=G6(location.href);this.currentUrl!==e&&(this.currentUrl=e,this.isCustomDocId||this.loggingService.log("current url in doc service",this.currentUrl))},e=>{this.loggingService.catch("Error in DocService onWindowClick subscription: ",e)})}catch(e){this.loggingService.catch("Error in onWindowClick: ",e)}}setDocument(s){return Q(this,arguments,function*({documentId:e,documentMetadata:i,options:r,source:a="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocument","color: green;"),this.coreActionsService.triggerAction(Xi.INIT_UPDATE,{event:X.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:"setDocument",source:a,payload:{documentId:e,documentMetadata:i,options:r}}),yield this.setDocumentsImpl({documents:[{id:e,metadata:i}],options:I({organizationId:i?.organizationId},r??{}),source:a})}catch(m){this.loggingService.catch("Error in DocService setDocument:",m)}})}shouldSetDocumentsAgain(e,i={}){try{this.loggingService.log("%c[WB] Calling FUNCTION: shouldSetDocumentsAgain","color: green;");let r=this.documentPaths$.value?.clientDocumentId,a=i?.rootDocumentId??e[0]?.id,s=this.documentIds$.value.map(h=>h.clientDocumentId),m=EU(this.getOptionsFromDocumentPaths()??{})??{};return!e.every(h=>s.includes(h.id))||!uo(m,i)||r!==a}catch(r){return this.loggingService.catch("Error in DocService shouldSetDocumentsAgain:",r),!0}}getDocumentIdsFromDocuments({documents:e,setClientDocumentMetadataMap:i=!1}){try{let r=[];return e.forEach(a=>{let s=a.id,m=`${yn(s)}`;i&&a?.metadata&&typeof a.metadata=="object"&&(this.clientDocumentMetadataMap[s]=a.metadata),r.push({documentId:m,clientDocumentId:s})}),r}catch(r){return this.loggingService.catch("Error in DocService getDocumentIdsFromDocuments:",r),[]}}setDocuments(a){return Q(this,arguments,function*({documents:e,options:i,source:r="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocuments","color: green;"),this.coreActionsService.triggerAction(Xi.INIT_UPDATE,{event:X.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:"setDocuments",source:r,payload:{documents:e,options:i}}),yield this.setDocumentsImpl({documents:e,options:i??{},source:r})}catch(s){this.loggingService.catch("Error in DocService setDocuments:",s)}})}setRootDocument(r){return Q(this,arguments,function*({document:e,source:i="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setRootDocument","color: green;"),this.coreActionsService.triggerAction(Xi.INIT_UPDATE,{event:X.Events.Core.SET_ROOT_DOCUMENT_TRIGGERED,methodName:"setRootDocument",source:i,payload:{document:e}});let a=this.getOptionsFromDocumentPaths()??{},s=this.documentIds$.value.map(m=>m.clientDocumentId);if(!s.includes(e.id)){let m=[...s.map(h=>({id:h})),{id:e.id}],p=this.getDocumentIdsFromDocuments({documents:m,setClientDocumentMetadataMap:!0});this.documentIds$.next(p)}yield this.setDocumentIdImpl(e.id,this.documentPaths$.value?.clientOrganizationId,a)}catch(a){this.loggingService.catch("Error in DocService setRootDocument:",a)}})}setDocumentsImpl(a){return Q(this,arguments,function*({documents:e,options:i,source:r}){try{let s=i?.organizationId??this.documentPaths$.value?.clientOrganizationId;if(!this.shouldSetDocumentsAgain(e,EU(T(I({},i),{organizationId:s})))){r==="external"&&this.loggingService.catch("setDocuments called with previous request");return}this.documentPaths$.value?.organizationId&&i?.organizationId&&this.documentPaths$.value?.organizationId!==i?.organizationId?this.authService.resetServicesCache():this.unsetDocuments({source:"internal",unsetDocumentPaths:!1});let m=this.getDocumentIdsFromDocuments({documents:e,setClientDocumentMetadataMap:!0});if(m?.length===0){this.loggingService.warn("Minimum one document must be set in setDocuments");return}if(this.draftDocuments=e,this.draftOptions=i,this.documentIds$.next(m),e?.length){let p=e[0]?.id;i?.rootDocumentId&&e.find(h=>h.id===i?.rootDocumentId)&&(p=i?.rootDocumentId),yield this.debounceSetDocuments({documentId:p,clientOrganizationId:i?.organizationId,options:i})}return}catch(s){this.loggingService.catch("Error in DocService setDocumentsImpl:",s)}})}setDocumentId(a){return Q(this,arguments,function*({documentId:e,clientOrganizationId:i,source:r="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocumentId","color: green;"),this.coreActionsService.triggerAction(Xi.INIT_UPDATE,{event:X.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:"setDocumentId",source:r,payload:{documentId:e,clientOrganizationId:i}}),yield this.setDocumentsImpl({documents:[{id:e}],options:{organizationId:i},source:r})}catch(s){this.loggingService.catch("Error in setDocumentId:",s);return}})}debounceSetDocuments(a){return Q(this,arguments,function*({documentId:e,clientOrganizationId:i,options:r}){try{this.loggingService.log("%c[WB] Calling FUNCTION: debounceSetDocuments","color: green;");let s=Date.now(),m=s-this.lastSetDocumentIdCallTime,p=s-this.lastSetDocumentIdExecutionTime;if(this.lastSetDocumentIdCallTime=s,this.queueSize>=this.MAX_QUEUE_SIZE){this.loggingService.warn("SetDocumentId queue size exceeded limit");return}if(!this.documentPaths$.value&&!this.isDocumentIdInDebounceQueue||m>this.DEBOUNCE_TIME&&p>this.DEBOUNCE_TIME){yield this.setDocumentIdImpl(e,i,r),this.lastSetDocumentIdExecutionTime=s;return}this.documentPaths$.next(null),this.isDocumentIdInDebounceQueue=!0,this.draftLocationMap={locations:[],options:void 0},this.queueSize++,this.setDocumentIdSubject.next({documentId:e,clientOrganizationId:i,options:r??void 0});return}catch(s){this.loggingService.catch("Error in debounceSetDocuments:",s)}})}setDocumentIdImpl(e,i,r){return Q(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: setDocumentIdImpl","color: green;");try{let a=this.authService.getUser();if(!a)return;this.currentDocumentId&&this.documentPaths$.value&&(yield this.callPreDocumentIdChangeFunctions(this.documentPaths$.value));let s=this.currentDocumentId;if(this.apiKey){let m=`${yn(e)}`,p=r?.folderId,h=r?.folderId?Tl(r?.folderId):void 0,_=r?.locationId,E=r?.allDocuments,D=a?.organizationId?i?Pt(i):a?.organizationId:void 0;if(yield Promise.allSettled([this.commentResolverService.resolveCommentAnnotations({documentIds:this.documentIds$.value.map(L=>L.clientDocumentId),organizationId:i??a?.clientOrganizationId??""}),this.reactionResolverService.resolveReactionAnnotations({documentIds:this.documentIds$.value.map(L=>L.clientDocumentId),organizationId:i??a?.clientOrganizationId??""})]),this.currentDocumentId!==m||this.documentPaths$.value?.organizationId!==D){this.loggingService.log("setting new docid"),this.currentDocumentId=m;let L=new aM,H=new EM;L.clientDocumentId=e,H.clientDocumentId=e,L.folderId=p,H.folderId=p,L.locationId=_,H.locationId=_,L.allDocuments=E,H.allDocuments=E,L.veltFolderId=h,H.veltFolderId=h,L.documentId=m,H.documentId=m,D&&(L.organizationId=D,L.clientOrganizationId=i??a?.clientOrganizationId,H.organizationId=D,H.clientOrganizationId=i??a?.clientOrganizationId);let K=`${this.apiKey}`,oe=`apiKey/${this.apiKey}`;D&&(K=`${K}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${L.organizationId}`,oe=`${oe}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${L.organizationId}`),H.organization=`apiKey/${this.apiKey}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}`,H.document=`${oe}/${j.FIREBASE_PARTIAL_PATH_DOCS}`,L.presence=`${K}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_PRESENCE}/`,L.cursor=`${K}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_CURSOR}/`,L.comment=`${K}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_COMMENT}/`,H.comment=`${oe}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_COMMENT}`,L.multiThread=`${K}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_MULTI_THREAD}/`,H.multiThread=`${oe}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_MULTI_THREAD}`,L.tag=`${K}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_TAG}/`,L.area=`${K}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_AREA}/`,H.area=`${oe}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_AREA}`,L.arrow=`${K}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_ARROW}/`,L.selection=`${K}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_SELECTION}/`,L.audioHuddle=`${K}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_AUDIO_HUDDLE}/`,L.huddle=`${K}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_HUDDLE}/`,L.recorder=`${K}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_RECORDER}/`,H.recorder=`${oe}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_RECORDER}`,L.flock=`${K}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_FOLLOW_ALONG}/`,L.syncVideoPlayer=`${K}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_SYNC_VIDEO_PLAYER}/`,L.liveState=`${K}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_LIVE_STATE}/`,L.liveStateSingleEditorMode=`${K}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_LIVE_STATE}/default/singleEditorMode`,L.reaction=`${K}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_REACTION}/`,H.reaction=`${oe}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_REACTION}`,L.customerMetadata=`${this.apiKey}/${j.FIREBASE_PARTIAL_PATH_CUSTOMER_METADATA}/`,L.views=`${K}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_VIEWS}/`,H.commentViews=`${oe}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_COMMENT_VIEWS}`,H.notificationViews=`${oe}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATION_VIEWS}`,H.documentViews=`${oe}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS}`,H.locationViews=`${oe}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS}`,L.notifications=`${K}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATIONS}/`,L.metadata=`${K}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_METADATA}/`,L.users=`${K}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_USERS}/`,L.documentIam=`${K}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_IAM}/`,L.workspaceIam=`${this.apiKey}/${j.FIREBASE_PARTIAL_PATH_IAM}/`,L.groupContacts=`${K}/${j.FIREBASE_PARTIAL_PATH_CONTACTS}/${j.FIREBASE_PARTIAL_PATH_GROUPS}/`,L.globalContacts=`${K}/${j.FIREBASE_PARTIAL_PATH_CONTACTS}/${j.FIREBASE_PARTIAL_PATH_GLOBAL}/`,L.logins=`${K}/${j.FIREBASE_PARTIAL_PATH_CONTACTS}/${j.FIREBASE_PARTIAL_PATH_LOGINS}/`,L.userFeedback=`${K}/${j.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${j.FIREBASE_PARTIAL_PATH_FEEDBACK}/`,L.userReportBugs=`${K}/${j.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${j.FIREBASE_PARTIAL_PATH_BUGS}/`,L.userContactUs=`${K}/${j.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${j.FIREBASE_PARTIAL_PATH_CONTACT_US}/`,D&&(L.organizationMetadata=`${K}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_METADATA}/`,L.organizationIam=`${K}/${j.FIREBASE_PARTIAL_PATH_IAM}/`,L.organizationGroups=`${K}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_GROUPS}/`,L.organizationNotifications=`${K}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/`,m&&(L.organizationNotificationsWithDocumentId=`${K}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/`),L.organizationNotificationsLastNotificationTimestamp=`${K}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${j.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}/${j.FIREBASE_PARTIAL_PATH_DOCS}/`,L.organizationNotificationsUsers=`${K}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${j.FIREBASE_PARTIAL_PATH_USERS}/`),H.organizationUsers=`${oe}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_USERS}`,H.documentUsers=`${oe}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${m}/${j.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS}`,H.notificationDocs=`${oe}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATION_DOCS}`,H.notificationUsers=`${oe}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATION_USERS}`,this.documentPaths$.next(L),this.firestorePaths$.next(H),L?.clientOrganizationId&&L?.organizationId&&!(L?.clientOrganizationId===this.organizationConfig$?.value?.clientOrganizationId&&L?.organizationId===this.organizationConfig$?.value?.organizationId)&&this.organizationConfig$.next({organizationId:L?.organizationId,clientOrganizationId:L?.clientOrganizationId}),yield Promise.allSettled([this.updateFolderMetadata(),this.updateDocumentMetadata(),this.fetchLocationMetadata(),this.updateOrganizationMetadata()]),s&&this.location$.value&&this.removeLocation({}),this.coreActionsService.triggerAction(Xi.INIT_UPDATE,{event:X.Events.Doc.SET_DOCUMENTS_SUCCESS,payload:{documentId:m,clientDocumentId:e}}),this.analyticsService.trackEvent(X.Events.Doc.SET_DOCUMENTS_SUCCESS,{documentId:m,clientDocumentId:e},!0,this.getUserIdForAnalytics())}}else this.loggingService.catch("Error in setDocumentIdImpl: API key is not provided.")}catch(a){this.loggingService.catch("Error in setDocumentIdImpl: ",a)}})}unsetDocumentId({source:e,unsetDocumentPaths:i}){this.loggingService.log("%c[WB] Calling FUNCTION: unsetDocumentId","color: green;");try{this.coreActionsService.triggerAction(Xi.INIT_UPDATE,{event:X.Events.Doc.UNSET_DOCUMENTS_TRIGGERED,methodName:"unsetDocumentId",source:e}),this.unsetDocumentImpl({source:e,unsetDocumentPaths:i})}catch(r){this.loggingService.catch("Error in unsetDocumentId: ",r)}}unsetDocumentImpl({source:e,unsetDocumentPaths:i}){this.loggingService.log("%c[WB] Calling FUNCTION: unsetDocumentImpl","color: green;");try{this.currentDocumentId&&this.documentPaths$.value&&this.callPreDocumentIdChangeFunctions(this.documentPaths$.value),i&&(this.documentPaths$.next(null),this.firestorePaths$.next(null)),this.currentDocumentId=null,this.location$.next(null),this.excludedLocationIds$.next([]),this.documentMetadata$.next(null),this.locationMetadata$.next(null),this.clientDocumentMetadata=void 0,this.clientDocumentMetadataMap={},this.locations$.next({}),this.documentIds$.next([]),this.coreActionsService.triggerAction(Xi.INIT_UPDATE,{event:X.Events.Doc.UNSET_DOCUMENTS_SUCCESS,source:e}),this.analyticsService.trackEvent(X.Events.Doc.UNSET_DOCUMENTS_SUCCESS,{documentId:this.currentDocumentId,documentMetadata:this.documentMetadata$.value?.[this.currentDocumentId??""],message:e==="external"?"User unset document id":"System unset document id",source:e},!0,this.getUserIdForAnalytics())}catch(r){this.loggingService.catch("Error in unsetDocumentImpl: ",r)}}unsetDocuments({source:e,unsetDocumentPaths:i=!0}){this.loggingService.log("%c[WB] Calling FUNCTION: unsetDocuments","color: green;");try{this.coreActionsService.triggerAction(Xi.INIT_UPDATE,{event:X.Events.Doc.UNSET_DOCUMENTS_TRIGGERED,source:e,methodName:"unsetDocuments"}),this.unsetDocumentImpl({source:e,unsetDocumentPaths:i})}catch(r){this.loggingService.catch("Error in unsetDocuments: ",r)}}addPreDocumentIdChangeFunction(e,i){try{this.loggingService.log("%c[WB] Calling FUNCTION: addPreDocumentIdChangeFunction","color: green;"),this.preDocumentIdChangeFunctions.set(e,i)}catch(r){this.loggingService.catch("Error in addPreDocumentIdChangeFunction: ",r)}}callPreDocumentIdChangeFunctions(e){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: callPreDocumentIdChangeFunctions","color: green;");for(let[i,r]of this.preDocumentIdChangeFunctions)try{yield r(e)}catch(a){this.loggingService.catch("Error in callPreDocumentIdChangeFunctions: ",a)}}catch(i){this.loggingService.catch("Error in callPreDocumentIdChangeFunctions: ",i)}})}fetchOrganizationMetadata(){return Q(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: fetchOrganizationMetadata","color: green;");try{if(this.db&&this.organizationConfig$.value?.organizationId){let e=this.organizationConfig$.value?.organizationId;yield this.commonDbService?.getData({feature:"organizationMetadata",properties:{apiKey:this.apiKey??"",organizationId:e,field:"metadata"}}).then(i=>{i&&this.organizationMetadata$.next(T(I({},this.organizationMetadata$.value),{[e]:i}))}).catch(i=>{this.loggingService.catch("Error in fetchOrganizationMetadata: ",i)})}}catch(e){this.loggingService.catch("Error in fetchOrganizationMetadata: ",e)}})}fetchDocumentMetadata(e){return Q(this,null,function*(){try{if(this.db&&this.authService.getUser()){let i=this.documentPaths$.value,r=this.documentMetadata$.value;if(e=e.filter(a=>!r?.[a.documentId]),e?.some(a=>!a?.documentId||!a?.clientDocumentId)||!i)return;if(this.commonDbService?.shouldUseFirestore()){let a=i?.folderId,s=i?.allDocuments,m=[],p={organizationId:i?.clientOrganizationId,folderId:a,allDocuments:s};if(a&&s)m.push(this.fetchDocuments(p));else{let _=[];for(let D=0;D<e.length;D+=20)_.push(e.slice(D,D+20));_.forEach(D=>{let L=JSON.parse(JSON.stringify(p));L.documentIds=D.map(H=>H.clientDocumentId),m.push(this.fetchDocuments(L))})}let h={};m.length>0&&(yield Promise.all(m).then(_=>{_?.forEach(E=>{E?.forEach(D=>{D?.metadata?.documentId&&(h[D.metadata.documentId]=D.metadata)})}),this.documentMetadata$.next(I(I({},this.documentMetadata$.value),h))}).catch(_=>{this.loggingService.catch("Error in fetchDocumentMetadata: ",_)}))}else r?.[i?.documentId??e?.[0]?.documentId]||this.commonDbService?.queryData({feature:"allDocuments",properties:{apiKey:this.apiKey??"",organizationId:i?.organizationId,documentId:i?.documentId??e?.[0]?.documentId,skipObjectValues:!0}}).then(a=>{a?.documentId&&this.documentMetadata$.next({[a.documentId]:a})}).catch(a=>{this.loggingService.catch("Error in fetchDocumentMetadata: ",a)})}}catch(i){this.loggingService.catch("Error in fetchDocumentMetadata: ",i)}})}fetchLocationMetadata(){return Q(this,null,function*(){try{if(this.db&&this.authService.getUser()){let e=this.documentPaths$.value,i=this.documentIds$.value,r=e?.folderId,a=e?.allDocuments,s=[],m={organizationId:e?.clientOrganizationId,folderId:r,allDocuments:a};if(r&&a)s.push(this.fetchLocations(m));else{let h=[];for(let E=0;E<i.length;E+=20)h.push(i.slice(E,E+20));h.forEach(E=>{let D=JSON.parse(JSON.stringify(m));D.documentIds=E.map(L=>L.clientDocumentId),s.push(this.fetchLocations(D))})}let p=this.locationMetadata$.value??{};s.length>0&&Promise.all(s).then(h=>{h?.forEach(_=>{_?.forEach(E=>{E?.metadata?.documentId&&(p[E.metadata.documentId]=T(I({},p?.[E.metadata.documentId]??{}),{[E.location.id]:E}))})}),Object.keys(p||{}).length>0&&this.locationMetadata$.next(p)}).catch(h=>{this.loggingService.catch("Error in fetchLocationMetadata: ",h)})}}catch(e){this.loggingService.catch("Error in fetchLocationMetadata: ",e)}})}getLocationMetadatas(){return this.locationMetadata$.value}subscribeToCustomerMetadata(){this.loggingService.log("%c[WB] Calling FUNCTION: subscribeToCustomerMetadata","color: green;");try{if(this.customerMetadataSubscription)return;this.db&&this.authService.getUser()&&this.documentPaths$.value&&(this.customerMetadataSubscription=this.commonDbService?.dbListener({feature:"customerMetadata",properties:{skipFirestore:!0}}).pipe(jn(i=>se(null))).subscribe(i=>{this.customerMetadata$.next(i?.data)}))}catch(e){this.loggingService.catch("Error in subscribeToCustomerMetadata: ",e)}}getDocumentId(){return this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentId","color: green;"),this.documentPaths$.value?.documentId}getClientDocumentId(){return this.loggingService.log("%c[WB] Calling FUNCTION: getClientDocumentId","color: green;"),this.documentPaths$.value?.clientDocumentId}getDocumentIds$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentIds$","color: green;"),this.documentIds$.asObservable().pipe(ce(e=>e?.slice()))}getDocumentIds(){return this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentIds","color: green;"),this.documentIds$.value?.slice()}getLocationMetadata$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getLocationMetadata$","color: green;"),this.locationMetadata$.asObservable().pipe()}getDocumentPaths$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentPaths$","color: green;"),this.documentPaths$.asObservable()}getFirestorePaths$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getFirestorePaths$","color: green;"),this.firestorePaths$.asObservable()}getDocumentPaths(){return this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentPaths","color: green;"),this.documentPaths$.value}generateDocumentId(e){try{return`${yn(e)}`}catch(i){return this.loggingService.catch("Error in generateDocumentId: ",i),""}}generateOrganizationId(e){try{return`${Pt(e)}`}catch(i){return this.loggingService.catch("Error in generateOrganizationId: ",i),""}}getFirestorePaths(){return this.loggingService.log("%c[WB] Calling FUNCTION: getFirestorePaths","color: green;"),this.firestorePaths$.value}setLocation(r){return Q(this,arguments,function*({location:e,source:i="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setLocation","color: green;"),this.coreActionsService.triggerAction(Xi.INIT_UPDATE,{event:X.Events.Core.SET_LOCATIONS_TRIGGERED,source:i,methodName:"setLocation",payload:{locations:[e],options:void 0}}),yield this.setLocationsImpl({locations:[e]})}catch(a){this.loggingService.catch("Error in setLocation: ",a)}})}setLocations(a){return Q(this,arguments,function*({locations:e,options:i,source:r="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setLocations","color: green;"),this.coreActionsService.triggerAction(Xi.INIT_UPDATE,{event:X.Events.Core.SET_LOCATIONS_TRIGGERED,methodName:"setLocations",source:r,payload:{locations:e,options:i}}),yield this.setLocationsImpl({locations:e,options:i})}catch(s){this.loggingService.catch("Error in setLocations: ",s)}})}getValidLocations(e){try{let i=[];return e&&Array.isArray(e)&&e.forEach(r=>{if(r&&typeof r=="object"){let a=!0;r?.version&&(!r?.version?.id||!r?.version?.name)&&(this.loggingService.catch(`Error in setting location for locationId: ${r?.id}, If you're setting version then add id and name fields to version object.`),a=!1),a&&i.push(r)}}),i}catch(i){this.loggingService.catch("Error in getValidLocations: ",i)}return e}setRootLocation(r){return Q(this,arguments,function*({location:e,source:i="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setRootLocation","color: green;"),this.coreActionsService.triggerAction(Xi.INIT_UPDATE,{event:X.Events.Core.SET_ROOT_LOCATION_TRIGGERED,methodName:"setRootLocation",source:i,payload:{location:e}});let a=Object.values(this.locations$.value).map(s=>s.location).filter(s=>String(s.id)!==String(e.id));yield this.setLocationsImpl({locations:[e,...a],options:{rootLocationId:e.id}})}catch(a){this.loggingService.catch("Error in DocService setRootLocation:",a)}})}setLocationsImpl(r){return Q(this,arguments,function*({locations:e,options:i}){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: setLocationsImpl","color: green;"),e.length===0)return;this.draftLocationMap.locations=[...this.draftLocationMap.locations,...e],this.draftLocationMap.options=i;let a=this.getValidLocations(e),s=[],m=[];this.location$.value?.location.id&&m.push(this.location$.value?.location.id),m=[...m,...Object.values(this.locations$.value).map(_=>_.location.id)].filter(_=>_!==void 0);let p;if(i?.rootLocationId&&i?.rootLocationId!==this.location$.value?.location.id&&(p=a.find(_=>_.id===i?.rootLocationId),!p)){this.loggingService.catch(`Error in setting locations, rootLocationId: ${i?.rootLocationId} not found in locations.`);return}if(!i?.appendLocation){p||(p=a[0]);let _=Jo(p),E=yn(JSON.stringify(_));_.id&&!m.includes(_.id)&&s.push({locationId:E,location:_}),this.location$.next({locationId:E,location:_})}let h=[];return a.slice(i?.appendLocation?0:1).forEach(_=>{let E=I({},_),D=this.locations$.value;_?.id&&Object.keys(D).forEach(oe=>{let ue=D[oe];ue.location?.id===_.id&&(E=I(I({},ue.location),_),delete D?.[oe])});let L=this.genarateLocationId(E),H={locationId:L,location:E};E.id&&!m.includes(E.id)&&s.push({locationId:L,location:E}),h.push(H);let K=T(I({},D),{[L]:H});this.locations$.next(K)}),yield this.updateDocumentLocationMetadata(s),this.coreActionsService.triggerAction(Xi.INIT_UPDATE,{event:X.Events.Doc.SET_LOCATIONS_SUCCESS,methodName:"setLocations",payload:{locations:a,options:i}}),this.analyticsService.trackEvent(X.Events.Doc.SET_LOCATIONS_SUCCESS,{locations:a,options:i},!0,this.getUserIdForAnalytics()),h}catch(a){this.loggingService.catch("Error in setLocationImpl: ",a);return}})}addLocation(r){return Q(this,arguments,function*({location:e,source:i="internal"}){try{return this.loggingService.log("%c[WB] Calling FUNCTION: addLocation","color: green;"),this.coreActionsService.triggerAction(Xi.INIT_UPDATE,{event:X.Events.Core.SET_LOCATIONS_TRIGGERED,methodName:"addLocation",source:i,payload:{locations:[e],options:{appendLocation:!0}}}),yield this.setLocationsImpl({locations:[e],options:{appendLocation:!0}})}catch(a){this.loggingService.catch("Error in DocService addLocation:",a);return}})}removeLocation({location:e,source:i="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeLocation","color: green;"),this.coreActionsService.triggerAction(Xi.INIT_UPDATE,{event:X.Events.Core.REMOVE_LOCATIONS_TRIGGERED,source:i,methodName:"removeLocation",payload:{locations:[e]}}),e&&this.removeLocationsImpl([e],i)}catch(r){this.loggingService.catch("Error in removeLocation: ",r)}}removeLocations({locations:e,source:i="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeLocations","color: green;"),this.coreActionsService.triggerAction(Xi.INIT_UPDATE,{event:X.Events.Core.REMOVE_LOCATIONS_TRIGGERED,methodName:"removeLocations",source:i,payload:{locations:e}}),this.removeLocationsImpl(e,i)}catch(r){this.loggingService.catch("Error in removeLocations: ",r)}}removeLocationsImpl(e,i="internal"){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeLocations","color: green;"),i==="internal"&&this.analyticsService.trackEvent(X.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{locations:e},methodName:"removeLocations",message:"System removed locations",source:i},!0,this.getUserIdForAnalytics()),e?e.forEach(r=>{let a=this.genarateLocationId(r);this.getLocation()?.locationId===a&&(this.location$.next(null),i!=="internal"&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(s=>s.id!==r.id))),this.removeCustomLocation(r)}):(this.location$.next(null),this.locations$.next({}),i!=="internal"&&(this.draftLocationMap.options=void 0,this.draftLocationMap.locations=[])),this.analyticsService.trackEvent(X.Events.Doc.REMOVE_LOCATIONS_SUCCESS,{payload:{locations:e},source:i},!0,this.getUserIdForAnalytics())}catch(r){this.loggingService.catch("Error in removeLocation: ",r)}}unsetLocationIds(e,i="internal"){try{this.loggingService.log("%c[WB] Calling FUNCTION: unsetLocationIds","color: green;"),this.coreActionsService.triggerAction(Xi.INIT_UPDATE,{event:X.Events.Core.UNSET_LOCATIONS_TRIGGERED,methodName:"unsetLocationIds",source:i,payload:{locationIds:e}}),i==="internal"&&this.analyticsService.trackEvent(X.Events.Core.UNSET_LOCATIONS_TRIGGERED,{payload:{locationIds:e},methodName:"unsetLocationIds",message:"System unset location ids",source:i},!0,this.getUserIdForAnalytics()),e?.length?e.forEach(r=>{this.getLocation()?.location.id===r&&(this.location$.next(null),i!=="internal"&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(a=>a.id!==r))),this.removeCustomLocationId(r)}):(this.location$.next(null),this.locations$.next({}),i!=="internal"&&(this.draftLocationMap.options=void 0,this.draftLocationMap.locations=[])),this.analyticsService.trackEvent(X.Events.Doc.REMOVE_LOCATIONS_SUCCESS,{payload:{locationIds:e},source:i},!0,this.getUserIdForAnalytics())}catch(r){this.loggingService.catch("Error in unsetLocationIds: ",r)}}getLocation$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getLocation$","color: green;"),this.location$.asObservable()}getLocation(){return this.loggingService.log("%c[WB] Calling FUNCTION: getLocation$","color: green;"),this.location$.value?JSON.parse(JSON.stringify(this.location$.value)):null}excludeLocationIds(e){try{this.excludedLocationIds$.next([...e])}catch(i){this.loggingService.catch("Error in excludeLocationIds: ",i)}}getExcludedLocationIds$(){try{return this.excludedLocationIds$.asObservable()}catch(e){return this.loggingService.catch("Error in getExcludedLocationIds$: ",e),se([])}}updateOrganizationMetadata(){return Q(this,null,function*(){try{let e=this.organizationConfig$.value?.organizationId,i=this.documentPaths$.value;if(this.db&&e&&i?.documentId){if(this.organizationMetadata$.value?.[e])return;let a=new CM;a.apiKey=this.configService?.getApiKey()??"",a.organizationId=e,a.clientOrganizationId=this.organizationConfig$.value?.clientOrganizationId,yield this.commonDbService?.updateData({feature:"organizationMetadata",data:JSON.parse(JSON.stringify(a)),properties:{organizationId:e,documentId:i?.documentId??""}}),yield this.fetchOrganizationMetadata()}}catch(e){this.loggingService.catch("Error in updateOrganizationMetadata: ",e)}})}updateFolderMetadata(){return Q(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: updateFolderMetadata","color: green;"),this.db&&this.authService.getUser()&&this.documentPaths$.value?.folderId){let e=this.documentPaths$.value;if(!e?.veltFolderId||!e?.organizationId)return;if(!(yield this.commonDbService?.getData({feature:"folderMetadata",properties:{organizationId:e?.organizationId??"",folderId:e?.veltFolderId??""}}))?.metadata){let r={folderId:this.documentPaths$.value?.folderId,veltFolderId:this.documentPaths$.value?.veltFolderId,apiKey:this.configService?.getApiKey()??"",organizationId:e?.organizationId,clientOrganizationId:e?.clientOrganizationId,createdAt:Date.now(),lastUpdated:Date.now(),parentFolderId:"root",veltParentFolderId:"root"};this.commonDbService?.updateData({feature:"folderMetadata",data:JSON.parse(JSON.stringify({metadata:r})),properties:{organizationId:e?.organizationId??"",folderId:this.documentPaths$.value?.veltFolderId??""}})}}}catch(e){this.loggingService.catch("Error in updateFolderMetadata: ",e)}})}updateDocumentMetadata(){return Q(this,null,function*(){try{if(this.db&&this.authService.getUser()){let e=this.documentPaths$.value;if(e){let i=this.getDocumentIds();i.find(a=>a.documentId===e.documentId)||i.push({documentId:e.documentId??"",clientDocumentId:e.clientDocumentId??""});let r=i.map(a=>Q(this,null,function*(){let s=new rM;this.clientDocumentMetadata&&(this.clientDocumentMetadata?.clientDocumentId===e.clientDocumentId&&this.clientDocumentMetadata?.documentMetadata&&(s=I(I({},this.clientDocumentMetadata.documentMetadata),s)),this.clientDocumentMetadata=void 0),this.clientDocumentMetadataMap?.[a.clientDocumentId]&&(s=I(I({},this.clientDocumentMetadataMap[a.clientDocumentId]),s)),s.apiKey=this.configService?.getApiKey()??"",s.documentId=a.documentId,s.clientDocumentId=a.clientDocumentId,s.organizationId=e.organizationId,s.clientOrganizationId=e.clientOrganizationId,s.pageInfo=Ei();let m=e?.folderId,p=e?.veltFolderId;s?.pageInfo?.deviceInfo&&delete s?.pageInfo?.deviceInfo;let h=!0,_=this.documentMetadata$.value?.[a.documentId];if(m&&p){let E=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:a?.documentId??"",organizationId:e?.organizationId??"",field:"metadata"}});E?.clientDocumentId?E?.folderId&&(E?.folderId!==m||E?.veltFolderId!==p)?(this.loggingService.catch(`Folder id mismatch for document ${a?.clientDocumentId??""}`),h=!1):E?.folderId===m?(m&&(s.folderId=m),p&&(s.veltFolderId=p)):(this.loggingService.catch(`Document ${a?.clientDocumentId??""} is not in the folder ${m??""}`),h=!1):(m&&(s.folderId=m),p&&(s.veltFolderId=p))}if(_){let E={};Object.entries(s).forEach(([D,L])=>{E[D]=L}),uo(E,_)&&(h=!1)}h&&(yield this.commonDbService?.updateData({feature:"documentMetadata",data:JSON.parse(JSON.stringify(s)),properties:{organizationId:e?.organizationId??"",documentId:a?.documentId??""}}))}));yield Promise.allSettled(r),yield this.fetchDocumentMetadata(i)}}}catch(e){this.loggingService.catch("Error in updateDocumentMetadata: ",e)}})}updateDocumentLocationMetadata(e){return Q(this,null,function*(){try{if(this.db&&this.authService.getUser()){let i=this.documentPaths$.value;if(i){let r=this.getDocumentIds();r.find(a=>a.documentId===i.documentId)||r.push({documentId:i.documentId??"",clientDocumentId:i.clientDocumentId??""});for(let a of r){let s=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:a?.documentId??"",organizationId:i?.organizationId??"",field:"metadata"}}),m=[];for(let p of e){let h=new mM;h.locationId=p?.locationId,h.veltLocationId=yU(p?.location?.id??""),h.location=p?.location,h.pageInfo=Ei(),h?.pageInfo?.deviceInfo&&delete h?.pageInfo?.deviceInfo;let _=T(I({},s),{[j.FIREBASE_PARTIAL_PATH_LOCATIONS]:T(I({},s[j.FIREBASE_PARTIAL_PATH_LOCATIONS]??{}),{[p?.locationId]:h})});this.commonDbService?.shouldUseFirestore()||m.push(this.commonDbService?.updateData({feature:"documentMetadata",data:JSON.parse(JSON.stringify(_)),properties:{documentId:a?.documentId??"",organizationId:i?.organizationId??""}}));let E=this.locationMetadata$.value;if(E||(E={}),p?.location?.id){let D=E?.[a.documentId],L=D?.[p?.location?.id??""];E&&(D||(E[a.documentId]={}),L||(E[a.documentId][p?.location?.id??""]={}),E[a.documentId][p?.location?.id??""]=T(I({},L),{location:p?.location})),Object.keys(E||{}).length>0&&this.locationMetadata$.next(E)}}yield Promise.allSettled(m)}}}}catch(i){this.loggingService.catch("Error in updateDocumentLocationMetadata: ",i)}})}genarateLocationId(e){try{return e&&typeof e=="object"?yn(JSON.stringify(Jo(e))):0}catch(i){return this.loggingService.catch("Error in genarateLocationId: ",i),0}}removeCustomLocation(e,i="internal"){try{let r=this.genarateLocationId(e),a=this.locations$.value;a[r]&&(delete a[r],this.locations$.next(I({},a)),i!=="internal"&&this.isDocumentIdInDebounceQueue&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(s=>s.id!==e.id)))}catch(r){this.loggingService.catch("Error in DocService removeLocation:",r)}}removeCustomLocationId(e,i="internal"){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeCustomLocationId","color: green;");let r=this.locations$.value;Object.entries(r).forEach(([a,s])=>{s.location.id===e&&(delete r[a],this.locations$.next(I({},r)),i!=="internal"&&this.isDocumentIdInDebounceQueue&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(m=>m.id!==e)))})}catch(r){this.loggingService.catch("Error in DocService removeCustomLocationId:",r)}}getLocationByClientLocationId(e){try{let i=this.getLocation()?.location;if(i?.id===e)return i;{let r=this.getLocations();Object.keys(r).forEach(a=>{let s=r[a];s.location?.id===e&&(i=s.location)})}return i}catch(i){this.loggingService.catch("Error in DocService getLocationByClientLocationId:",i);return}}removeLocationIfNotInDom(){try{let e=this.locations$.value,i=document.querySelectorAll(`[${j.ATTRIBUTES.VELT_LOCATION}]`),r=[];i.forEach(a=>{let s=a.getAttribute(j.ATTRIBUTES.VELT_LOCATION);if(s){let m=JSON.parse(s),p=this.genarateLocationId(m);r.push(p)}}),Object.keys(e).forEach(a=>{let s=e[a];r.includes(s.locationId)||delete e[a]}),this.locations$.next(I({},e))}catch(e){this.loggingService.catch("Error in DocService removeLocationIfNotInDom:",e)}}getLocations$(){try{return this.locations$.asObservable()}catch(e){return this.loggingService.catch("Error in DocService getLocations$:",e),se({})}}getLocations(){try{return this.locations$.value}catch(e){return this.loggingService.catch("Error in DocService getLocations:",e),{}}}getLocationFromElement(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: getLocationFromElement","color: green;");let i=null;if(e?.getAttribute(j.ATTRIBUTES.VELT_LOCATION)?i=e:i=e.closest(`[${j.ATTRIBUTES.VELT_LOCATION}]`),i){let r=i?.getAttribute(j.ATTRIBUTES.VELT_LOCATION);if(r){let a=JSON.parse(r);return{locationId:this.genarateLocationId(a),location:a}}}return null}catch(i){return this.loggingService.catch("Error in DocService getLocationFromElement:",i),null}}getElementMapWithLocation(){try{this.loggingService.log("%c[WB] Calling FUNCTION: getElementMapWithLocation","color: green;");let e={};return document.querySelectorAll(`[${j.ATTRIBUTES.VELT_LOCATION}], [${j.ATTRIBUTES.VELT_LOCATION_ID}]`).forEach(r=>{if(r.getAttribute(j.ATTRIBUTES.VELT_LOCATION)){let a=this.getLocationFromElement(r);a?.locationId&&(e[a.locationId]={element:r,location:a})}else if(r.getAttribute(j.ATTRIBUTES.VELT_LOCATION_ID)){let a=r.getAttribute(j.ATTRIBUTES.VELT_LOCATION_ID);if(a){let s=this.getLocationByClientLocationId(a);s?.locationId&&(e[s.locationId]={element:r,location:s});let m={id:a},p=this.genarateLocationId(m);e[a]={element:r,location:{locationId:p,location:m}}}}}),e}catch(e){return this.loggingService.catch("Error in DocService getElementMapWithLocation:",e),{}}}getAdditionLocationFromElement(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: getAdditionLocationFromElement","color: green;");let i;if(i=e?.closest(`[${j.ATTRIBUTES.VELT_LOCATION}], [${j.ATTRIBUTES.VELT_LOCATION_ID}]`),i){if(i?.getAttribute(j.ATTRIBUTES.VELT_LOCATION)){let r=i?.getAttribute(j.ATTRIBUTES.VELT_LOCATION);if(r)return JSON.parse(r)}else if(i?.getAttribute(j.ATTRIBUTES.VELT_LOCATION_ID)){let r=i?.getAttribute(j.ATTRIBUTES.VELT_LOCATION_ID);if(r)return{id:r}}}return null}catch(i){return this.loggingService.catch("Error in DocService getAdditionLocationFromElement:",i),null}}getAdditionalDocumentIdFromElement(e){try{return e?.closest(`[${j.ATTRIBUTES.VELT_DOCUMENT_ID}]`)?.getAttribute(j.ATTRIBUTES.VELT_DOCUMENT_ID)||null}catch(i){return this.loggingService.catch("Error in DocService getAdditionalDocumentIdFromElement:",i),null}}getDocumentMetadata(e){try{return e?this.documentMetadata$.value?.[e]||null:this.documentMetadata$.value?.[this.documentPaths$.value?.documentId??""]||null}catch(i){return this.loggingService.catch("Error in DocService getDocumentMetadata:",i),null}}getAllDocumentMetadata(){try{return Object.values(this.documentMetadata$.value||{})}catch(e){return this.loggingService.catch("Error in DocService getAllDocumentMetadata:",e),[]}}getDocumentMetadataOfAvailableDocuments(){try{this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentMetadataOfAvailableDocuments","color: green;");let e=this.documentMetadata$.value||{},i={},r=this.documentPaths$.value?.veltFolderId,a=this.documentPaths$.value?.allDocuments;if(r&&a)Object.values(e).forEach(s=>{s?.documentId&&s?.veltFolderId===r&&(i[s.documentId]=s)});else{let s=this.documentIds$.value;if(s?.length)s.forEach(m=>{let p=e?.[m.documentId];p&&(i[m.documentId]=p)});else if(this.documentPaths$.value?.documentId){let m=e?.[this.documentPaths$.value?.documentId];m&&(i[this.documentPaths$.value?.documentId]=m)}}return Object.values(i)}catch(e){return this.loggingService.catch("Error in DocService getDocumentMetadataOfAvailableDocuments:",e),[]}}getDocumentMetadata$(e){return this.documentMetadata$.asObservable().pipe(ce(i=>i?.[e??this.documentPaths$.value?.documentId??""]||null))}getOrganizationMetadata(e){return this.organizationMetadata$.value?.[e]||null}getOrganizationMetadata$(e){return this.organizationMetadata$.asObservable().pipe(ce(i=>i?.[e]||null))}getCustomerMetadata(){return this.customerMetadata$.value}getCustomerMetadata$(){return this.customerMetadata$.asObservable()}getOrganizationConfig$(){return this.organizationConfig$.asObservable()}getOrganizationConfig(){return this.organizationConfig$.value}getMetadataFromType(e,i){try{switch(e){case"area":return;case"comment":return i?.multiThreadAnnotationId?this.commentService?.getMultiThreadAnnotationById(i.multiThreadAnnotationId)?.metadata:void 0;case"reaction":case"recorder":return i?.commentAnnotationId?this.commentService?.getAnnotationById(i.commentAnnotationId)?.metadata:void 0;default:return}}catch(r){this.loggingService.catch("Error in DocService getMetadataFromType:",r);return}}getDefaultMetadata({clientDocumentId:e,documentId:i}){try{let r=this.documentPaths$.value;if(!r)return;let a=e||r.clientDocumentId,s=i||r.documentId,m=this.getDocumentMetadata(s);if(!m)return;let p=m?.folderId,h=m?.veltFolderId;return I(I({apiKey:this.configService.getApiKey()??void 0,clientDocumentId:a,clientOrganizationId:r.clientOrganizationId,documentId:s,organizationId:r.organizationId},p?{folderId:p}:{}),h?{veltFolderId:h}:{})}catch(r){this.loggingService.catch("Error in DocService getDefaultMetadata:",r);return}}getBaseMetadata(e,i){try{let r,a;i?.element?r=this.getAdditionalDocumentIdFromElement(i.element)||void 0:i?.clientDocumentId&&(r=i.clientDocumentId),r&&(a=this.generateDocumentId(r));let s=this.getMetadataFromType(e,i),m=this.getDefaultMetadata({clientDocumentId:r,documentId:a});return s||m||{}}catch(r){return this.loggingService.catch("Error in DocService getBaseMetadata:",r),{}}}getServerId({documentId:e,organizationId:i}){try{return e&&(e=this.generateDocumentId(e)),i&&(i=this.generateOrganizationId(i)),{documentId:e,organizationId:i}}catch(r){return this.loggingService.catch("Error in DocService getServerId:",r),null}}fetchDocuments(e){return Q(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let r=[];if(!e?.organizationId)return this.loggingService.catch("Error in fetchDocuments: organizationId is required"),[];if(e?.folderId){let s=Tl(e?.folderId);r.push(gt("metadata.veltFolderId","==",s))}return e?.documentIds?.length&&!e?.allDocuments&&r.push(gt("metadata.documentId","in",e?.documentIds?.map(s=>this.generateDocumentId(s)).slice(0,30))),yield this.commonDbService?.queryData({feature:"allDocuments",properties:{firestoreQuery:r,apiKey:this.apiKey??"",organizationId:this.generateOrganizationId(e?.organizationId)??this.documentPaths$.value?.organizationId,documentId:this.documentPaths$.value?.documentId}})}catch(i){return this.loggingService.catch("Error in DocService fetchDocuments:",i),[]}})}fetchLocations(e){return Q(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let r=[];if(!e?.organizationId)return this.commonDbService?.shouldUseFirestore()&&this.loggingService.catch("Error in fetchLocations: organizationId is required"),[];if(e?.folderId){let s=Tl(e?.folderId);r.push(gt("metadata.veltFolderId","==",s))}return e?.documentIds?.length&&!e?.allDocuments&&r.push(gt("metadata.documentId","in",e?.documentIds?.map(s=>this.generateDocumentId(s)).slice(0,30))),yield this.commonDbService?.queryData({feature:"allLocations",properties:{firestoreQuery:r,apiKey:this.apiKey??"",organizationId:this.generateOrganizationId(e?.organizationId)??this.documentPaths$.value?.organizationId,documentId:this.documentPaths$.value?.documentId}})}catch(i){return this.loggingService.catch("Error in DocService fetchLocations:",i),[]}})}updateDocuments(e){return Q(this,null,function*(){try{if(typeof e=="object"&&(e=JSON.parse(JSON.stringify(e??{}))),!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let{organizationId:r,documents:a}=e;if(!r&&(r=this.documentPaths$.value?.clientOrganizationId,!r))return this.loggingService.catch("Error in updateDocuments: organizationId is required"),[];if(!a||a.length===0)return this.loggingService.catch("Error in updateDocuments: documents is required"),[];let s=[],m=this.documentMetadata$.value;a.forEach(p=>{delete p?.organizationId,delete p?.clientDocumentId,delete p?.clientOrganizationId,delete p?.apiKey;let h=Cc(p.documentId);p.documentId=h;let _=m?.[h];_&&(m[h]=I(I({},_),p)),p&&this.commonDbService&&s.push(this.commonDbService.updateData({feature:"documentMetadata",data:JSON.parse(JSON.stringify(p)),properties:{organizationId:_c(r),documentId:h}}))}),yield Promise.all(s),this.documentMetadata$.next(m)}catch(i){return this.loggingService.catch("Error in DocService updateDocuments:",i),[]}})}updateLocations(e){return Q(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let{organizationId:r,locations:a,documentIds:s}=e;if((!s||s.length===0)&&(s=this.documentIds$.value.map(_=>_.clientDocumentId)??[],s.length===0))return this.loggingService.catch("Error in updateLocations: documentId is required"),[];if(!r&&(r=this.documentPaths$.value?.clientOrganizationId,!r))return this.loggingService.catch("Error in updateLocations: organizationId is required"),[];if(!a||a.length===0)return this.loggingService.catch("Error in updateLocations: locations is required"),[];let m=s.map(_=>Cc(_)),p=[],h=this.locationMetadata$.value;h||(h={}),m.forEach(_=>{a.forEach(E=>{let D=this.location$.value;if(E?.id===D?.location?.id&&this.location$.next({locationId:D?.locationId,location:E}),E?.id){delete E?.metadata;let L=yU(E.id),H=h?.[_],K=H?.[E.id];h&&(H||(h[_]={}),K||(h[_][E.id]={}),h[_][E.id]=T(I({},K),{location:E})),E&&this.commonDbService&&p.push(this.commonDbService.updateData({feature:"locationMetadata",data:JSON.parse(JSON.stringify({location:E})),properties:{organizationId:_c(r),documentId:_,id:L}}))}})}),yield Promise.all(p),Object.keys(h||{}).length>0&&this.locationMetadata$.next(h)}catch(i){return this.loggingService.catch("Error in DocService updateLocations:",i),[]}})}fetchFolders(e){return Q(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let r=[];if(!e?.organizationId)return this.loggingService.catch("Error in fetchFolders: organizationId is required"),{data:[],parentFolders:[]};let a=[],s=this.generateOrganizationId(e?.organizationId);if(e?.folderId){let m=Tl(e?.folderId);r=yield this.commonDbService?.getData({feature:"folder",properties:{folderId:m,apiKey:this.apiKey??"",organizationId:s,documentId:this.documentPaths$.value?.documentId}}),r&&(r=[r]),a=yield this.commonDbService?.queryData({feature:"allFolders",properties:{firestoreQuery:[gt("metadata.veltParentFolderId","==",m)],folderId:m,apiKey:this.apiKey??"",organizationId:s,documentId:this.documentPaths$.value?.documentId}})}else r=yield this.commonDbService?.queryData({feature:"allFolders",properties:{apiKey:this.apiKey??"",organizationId:s,documentId:this.documentPaths$.value?.documentId}});return{data:r,parentFolders:a}}catch(i){return this.loggingService.catch("Error in DocService getFoldersRequest:",i),{data:[],parentFolders:[]}}})}getDocumentIam$(){return this.authService.getUser$().pipe(he(e=>e?this.documentPaths$.pipe(he(i=>i?.documentIam?this.commonDbService?.dbListener({feature:"documentIam",properties:{documentId:i.documentId,organizationId:i.organizationId,isCollection:!1}}).pipe(ce(r=>r?.data?.docIamConfig??r?.data),qt((r,a)=>JSON.stringify(r??{})===JSON.stringify(a??{}))):se(null))):se(null)))}getDocumentAccessType(e){try{return e&&e.features&&e.features.all?e.features.all.restricted?pi.RESTRICTED:pi.PUBLIC:e&&e.documentAccessType?e.documentAccessType:pi.PUBLIC}catch(i){return this.loggingService.catch("Error in DocService getDocumentAccessType:",i),pi.PUBLIC}}changeDocumentAccessType(e){return Q(this,null,function*(){try{let i=this.documentPaths$.value;if(i){let r=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:i?.documentId??"",organizationId:i?.organizationId??"",field:"docIamConfig"}});switch(delete r.documentAccessType,r.features||(r.features={}),r.features.all||(r.features.all={}),e){case pi.PUBLIC:r.features.all.restricted=!1;break;case pi.RESTRICTED:r.features.all.restricted=!0,r.features.all.guestMode=!1;break;default:break}this.commonDbService?.updateData({feature:"documentAccessType",data:JSON.parse(JSON.stringify(r)),properties:{documentId:i?.documentId??"",organizationId:i?.organizationId??""}})}}catch(i){this.loggingService.catch("Error in DocService changeDocumentAccessType:",i)}})}getUserIdForAnalytics(){try{return this.authService?.getAuthUser()?.uid||""}catch(e){return this.loggingService.catch("Error in DocService getUserIdForAnalytics:",e),""}}setUIState(e){try{this.uiState.next(I(I({},this.uiState.value),e))}catch(i){this.loggingService.catch("Error in DocService setUIState:",i)}}getUIState$(){return this.uiState.asObservable()}};o.\u0275fac=function(i){return new(i||o)(J(Ze),J(He),J(hn),J(Ne),J(jt),J(y),J(xs),J(Am),J(wm))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Gn=(()=>{let o=class o{constructor(e,i,r,a){this.analyticsService=e,this.authService=i,this.docService=r,this.loggingService=a,this.defaultUserDataProvider={get:s=>Q(this,null,function*(){return{}})},this.resolveOrganizationUsers=!0,this.resolveFolderUsers=!0,this.resolveDocumentUsers=!0,this.resolveTimeout=1*60*1e3,this.maxResolveAttempts=1,this.resolveAttempts=new Map,this.subscriptions=new mn,this.userDataProvider$=new Ce(null),this.userById$=new Ce({}),this.userByIdCalled$=new Ce({}),this.pendingResolutions=new Set,this.getUserById=s=>{try{return this.userById$.value?.[s]}catch(m){this.loggingService.catch("Error in UsersService getUserById:",m);return}};try{this.analyticsService.setUserService(this),this.authService.setUsersService(this)}catch(s){this.loggingService.catch("Error in UsersService constructor:",s)}}ngOnDestroy(){try{this.subscriptions.unsubscribe(),this.pendingResolutions.clear(),this.resolveAttempts.clear()}catch(e){this.loggingService.catch("Error in UsersService ngOnDestroy:",e)}}isResolverForFeatureDisabled(e){try{switch(e){case"allOrganizationUsers":return!this.resolveOrganizationUsers;case"allFolderUsers":return!this.resolveFolderUsers;case"allDocumentUsers":return!this.resolveDocumentUsers;default:return!1}}catch(i){return this.loggingService.catch("Error in UsersService isResolverForFeatureDisabled:",i),!1}}resolveUsers(a){return Q(this,arguments,function*({userIds:e,forceResolve:i,feature:r}){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: resolveUsers","color: green;");let s=!1;if(r&&(s=this.isResolverForFeatureDisabled(r)),this.userDataProvider$.getValue()&&!s){let m={},p=[],h={};if(e?.forEach(_=>{let E=this.getUserById(_);E?m[_]=E:this.userByIdCalled$.getValue()[_]?i&&p.push(_):(p.push(_),this.userByIdCalled$.next(T(I({},this.userByIdCalled$.getValue()),{[_]:!0})))}),p.length>0){let _=this.userDataProvider$.getValue();if(_){let E={};try{let D,L=new Promise((H,K)=>{D=setTimeout(()=>{K(new Error("User resolution timeout"))},this.userDataProvider$.getValue()?.config?.resolveTimeout||this.userDataProvider$.getValue()?.resolveTimeout||this.resolveTimeout)});E=yield Promise.race([_.get(p).finally(()=>{clearTimeout(D)}),L]),this.analyticsService.trackEvent(X.Events.Resolver.USER_RESOLVER_GET,{sourceMethod:"resolveUsers",source:"sdk",userIds:p})}catch(D){this.loggingService.catch("Error in UsersService resolveUsers getUsers:",D,{userIds:p})}finally{p?.forEach(D=>{E[D]||(E[D]={userId:D,name:`User ${D}`})})}Object.entries(E).forEach(([D,L])=>{L&&(m[D]=E?.[D],h[D]=E?.[D])})}}return Object.keys(h).length>0&&this.userById$.next(I(I({},this.userById$.getValue()),h)),m}else return{}}catch(s){return this.loggingService.catch("Error in UsersService resolveUsers:",s),{}}})}subscribeToDocuments(){return this.docService.getDocumentIds$().pipe(gn(e=>Q(this,null,function*(){let i=yield this.getUsersFromCentralDb({documentIds:e?.map(r=>r.documentId)});this.resolveUsers({userIds:i})})))}getUsersFromCentralDb(i){return Q(this,arguments,function*({documentIds:e}){try{return new Promise(r=>{r(["customuser1","customuser2","customuser3"])})}catch{return[]}})}getUserById$(){try{return this.loggingService.log("%c[WB] Calling UsersService FUNCTION: getUserById$","color: green;"),this.userById$.asObservable()}catch(e){return this.loggingService.catch("Error in UsersService getUserById$:",e),se({})}}setUserDataProvider(e){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setUserDataProvider","color: green;"),this.userDataProvider$.next(e),e.config?.resolveUsersConfig?.organization===!1?this.resolveOrganizationUsers=!1:this.resolveOrganizationUsers=!0,e.config?.resolveUsersConfig?.folder===!1?this.resolveFolderUsers=!1:this.resolveFolderUsers=!0,e.config?.resolveUsersConfig?.document===!1?this.resolveDocumentUsers=!1:this.resolveDocumentUsers=!0}catch(i){this.loggingService.catch("Error in UsersService setUserDataProvider:",i)}}userDataProviderAvailable(){try{return this.loggingService.log("%c[WB] Calling UsersService FUNCTION: userDataProviderAvailable","color: green;"),!!this.userDataProvider$.getValue()}catch(e){return this.loggingService.catch("Error in UsersService userDataProviderAvailable:",e),!1}}};o.\u0275fac=function(i){return new(i||o)(J(Ze),J(He),J(lt),J(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var ble=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.usersService=i}getUserIdsToResolveFromAreaAnnotations(e){try{this.loggingService.log("%c[WB] Calling AreaUtilsService FUNCTION: getUserIdsToResolveFromAreaAnnotations","color: green;");let i=new Set;for(let r of e)r?.from?.userId&&i.add(r?.from?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in AreaUtilsService getUserIdsToResolveFromAreaAnnotations:",i),[]}}mergeAreaWithUser(e){try{if(this.loggingService.log("%c[WB] Calling AreaUtilsService FUNCTION: mergeAreaWithUser","color: green;"),e?.from?.userId){let i=this.usersService.getUserById(e?.from?.userId);i&&(e.from=i)}return e}catch(i){return this.loggingService.catch("Error in AreaUtilsService mergeAreaWithUser:",i),e}}formatAreaData(e){try{return this.loggingService.log("%c[WB] Calling AreaUtilsService FUNCTION: formatAreaData","color: green;"),this.usersService.userDataProviderAvailable()&&e?.from?.userId&&(e.from={userId:e.from.userId}),e}catch(i){return this.loggingService.catch("Error in AreaUtilsService formatAreaData:",i),e}}};o.\u0275fac=function(i){return new(i||o)(J(y),J(Gn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Ile=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.usersService=i}getUserIdsToResolveFromArrowAnnotations(e){try{this.loggingService.log("%c[WB] Calling ArrowUtilsService FUNCTION: getUserIdsToResolveFromArrowAnnotations","color: green;");let i=new Set;for(let r of e)r?.from?.userId&&i.add(r?.from?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in ArrowUtilsService getUserIdsToResolveFromArrowAnnotations:",i),[]}}mergeArrowWithUser(e){try{if(this.loggingService.log("%c[WB] Calling ArrowUtilsService FUNCTION: mergeArrowWithUser","color: green;"),e?.from?.userId){let i=this.usersService.getUserById(e?.from?.userId);i&&(e.from=i)}return e}catch(i){return this.loggingService.catch("Error in ArrowUtilsService mergeArrowWithUser:",i),e}}formatArrowData(e){try{return this.loggingService.log("%c[WB] Calling ArrowUtilsService FUNCTION: formatArrowData","color: green;"),this.usersService.userDataProviderAvailable()&&e?.from?.userId&&(e.from={userId:e.from.userId}),e}catch(i){return this.loggingService.catch("Error in ArrowUtilsService formatArrowData:",i),e}}};o.\u0275fac=function(i){return new(i||o)(J(y),J(Gn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var qp=class{static getFirestoreProdDbName(o,t){return t?.storeDbId??(this.isTestingDb(t?.databaseURL??"")?"sdktest":`apikey${o.toLowerCase()}`)}static isTestingDb(o){try{return o.includes("-test")}catch(t){return dt.error("Error in isTestingDb:",t),!1}}};var Yp=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.analyticsService=i,this.retrySaveConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryDeleteConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.attachmentDataProvider$=new Ce(null);try{this.loggingService.log("AttachmentResolverService initialized"),this.attachmentDataProvider$.subscribe(r=>{r&&(r.config?.saveRetryConfig&&(this.retrySaveConfig=r.config.saveRetryConfig),r.config?.deleteRetryConfig&&(this.retryDeleteConfig=r.config.deleteRetryConfig))})}catch(r){this.loggingService.catch("Error in AttachmentResolverService constructor:",r)}}getProvider(){try{let e=this.attachmentDataProvider$.getValue();return e||void 0}catch(e){this.loggingService.catch("Error in AttachmentResolverService getProvider:",e);return}}saveAttachment(e){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling AttachmentResolverService FUNCTION: saveAttachment","color: green;");let i=this.getProvider();if(!this.attachmentDataProviderAvailable())throw new Error("Attachment save data provider not available");let r=yield Sc(()=>i?.save({attachment:e.attachment,event:e.eventType,metadata:e.attachment.metadata})||Promise.resolve(void 0),"saveAttachment",this.retrySaveConfig);if(r?.statusCode!==200){this.loggingService.catch(r?.message??"Error in AttachmentResolverService saveAttachment:");return}return this.analyticsService.trackEvent(X.Events.Resolver.ATTACHMENT_RESOLVER_SAVE,{sourceMethod:"saveAttachment",source:"sdk",attachmentId:e.attachment.attachmentId,eventType:e.eventType}),r}catch(i){this.loggingService.warn("Error in AttachmentResolverService saveAttachment:",i);return}})}deleteAttachment(r){return Q(this,arguments,function*({attachmentId:e,metadata:i}){try{this.loggingService.log("%c[WB] Calling AttachmentResolverService FUNCTION: deleteAttachment","color: green;");let a=this.getProvider();if(!this.attachmentDataProviderAvailable())throw new Error("Attachment delete data provider not available");let s=yield Sc(()=>a?.delete({attachmentId:e,metadata:i,event:Ya.ATTACHMENT_DELETE})||Promise.resolve(void 0),"deleteAttachment",this.retryDeleteConfig);return s?.statusCode!==200?(this.loggingService.catch(s?.message??"Error in AttachmentResolverService deleteAttachment:"),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(X.Events.Resolver.ATTACHMENT_RESOLVER_DELETE,{sourceMethod:"deleteAttachment",source:"sdk",attachmentId:e}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(a){return this.loggingService.warn("Error in AttachmentResolverService deleteAttachment:",a),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0}}})}setAttachmentDataProvider(e){try{if(e){this.loggingService.log("Setting attachment data provider");let r=["save","delete"].filter(a=>!(a in e)||typeof e[a]!="function");if(r.length>0){let a=`DataProviders.attachment is invalid. The following methods are missing or are not functions: ${r.join(", ")}.`;this.loggingService.catch(a);return}else this.attachmentDataProvider$.next(e)}}catch(i){this.loggingService.catch("Error in AttachmentResolverService setAttachmentDataProvider:",i)}}attachmentDataProviderAvailable(){try{return!!this.attachmentDataProvider$.getValue()}catch(e){return this.loggingService.catch("Error in AttachmentResolverService attachmentDataProviderAvailable:",e),!1}}};o.\u0275fac=function(i){return new(i||o)(J(y),J(Ze))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Jv=(()=>{let o=class o{constructor(e,i,r,a,s,m,p){this.loggingService=e,this.usersService=i,this.authService=r,this.functions=a,this.configService=s,this.commentAnnotationsResolverService=m,this.attachmentResolverService=p,this.notificationActionTypeMap={[Ut.NEWLY_ADDED]:Ya.COMMENT_ANNOTATION_ADD,[Ut.ADDED]:Ya.COMMENT_ADD,[Ut.UPDATED]:Ya.COMMENT_UPDATE,[Ut.DELETED]:Ya.COMMENT_DELETE}}setNotificationService(e){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: setNotificationService","color: green;"),this.notificationService=e}catch(i){this.loggingService.catch("Error in CommentUtilsService setNotificationService: ",i)}}getUserIdsToResolveFromComments(e){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: getUserIdsToResolveFromComments","color: green;");let i=new Set;for(let r of e){if(r?.from?.userId&&i.add(r?.from?.userId),r?.comments)for(let a of r?.comments){if(a?.from?.userId&&i.add(a?.from?.userId),a?.to)for(let s of a?.to)s?.userId&&i.add(s?.userId);if(a?.taggedUserContacts)for(let s of a?.taggedUserContacts)s?.userId&&i.add(s?.userId)}if(r?.assignedTo?.userId&&i.add(r?.assignedTo?.userId),r?.subscribedUsers)for(let a of Object.values(r?.subscribedUsers))a.user.userId&&i.add(a.user.userId);if(r?.unsubscribedUsers)for(let a of Object.values(r?.unsubscribedUsers))a.user.userId&&i.add(a.user.userId)}return Array.from(i)}catch(i){return this.loggingService.catch("Error in CommentUtilsService getUserIdsToResolveFromComments:",i),[]}}mergeCommentWithUser(e){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: mergeCommentWithUser","color: green;"),e?.from?.userId){let i=this.usersService.getUserById(e?.from?.userId);i&&(e.from=i)}if(e?.comments)for(let i of e?.comments){if(i?.from?.userId){let a=this.usersService.getUserById(i?.from?.userId);a&&(i.from=a)}i?.to&&(i.to=i?.to?.map(a=>{if(a?.userId){let s=this.usersService.getUserById(a?.userId);if(s)return I(I({},a),s)}return a})),i?.taggedUserContacts&&(i.taggedUserContacts=i?.taggedUserContacts?.map(a=>{if(a?.contact){let s=this.usersService.getUserById(a?.contact?.userId);s&&(a.contact=s,(s?.name||s?.email)&&(a.text=`@${s?.name||s?.email}`))}return a})),(i?.taggedUserContacts?.filter((a,s,m)=>m.findIndex(p=>p.text===a.text)===s)||[]).forEach(a=>{if(a?.text){let s=new RegExp(Cm(`{{${a.userId}}}`),"g");i.commentText=i.commentText?.replaceAll(s,a.text),i.commentHtml=i.commentHtml?.replaceAll(s,a.text)}})}if(e?.assignedTo?.userId){let i=this.usersService.getUserById(e?.assignedTo?.userId);i&&(e.assignedTo=i)}if(e?.subscribedUsers)for(let i of Object.values(e?.subscribedUsers)){let r=this.usersService.getUserById(i.user.userId);r&&e?.subscribedUsers?.id?.user&&(e.subscribedUsers.id.user=r)}if(e?.unsubscribedUsers)for(let i of Object.values(e?.unsubscribedUsers)){let r=this.usersService.getUserById(i.user.userId);r&&e?.unsubscribedUsers?.id?.user&&(e.unsubscribedUsers.id.user=r)}return e}catch(i){return this.loggingService.catch("Error in CommentUtilsService mergeCommentWithUser:",i),e}}formatCommentData(e){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: formatCommentData","color: green;"),e?.comments?.forEach(i=>{i?.commentText&&i?.commentText?.length>0&&(i.isCommentTextAvailable=!0)}),this.usersService.userDataProviderAvailable()){if(e?.from?.userId&&(e.from={userId:e.from.userId}),e?.assignedTo?.userId&&(e.assignedTo={userId:e.assignedTo.userId}),e?.subscribedUsers)for(let i of Object.keys(e?.subscribedUsers))e.subscribedUsers[i].user={userId:e?.subscribedUsers[i].user.userId};if(e?.unsubscribedUsers)for(let i of Object.keys(e?.unsubscribedUsers))e.unsubscribedUsers[i].user={userId:e?.unsubscribedUsers[i].user.userId}}return e?.comments&&(e.comments=e?.comments?.map(i=>this.formatCommentThreadData(i))),e}catch(i){return this.loggingService.catch("Error in CommentUtilsService formatCommentData:",i),e}}mergeStrippedDataWithCommentAnnotations(e){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: mergeStrippedDataWithCommentAnnotations","color: green;"),!this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable())return e;let i=this.commentAnnotationsResolverService.getAnnotationById(e?.annotationId),r=this.attachmentResolverService.attachmentDataProviderAvailable();return i&&e?.comments?.forEach(a=>{let s=i?.comments?.[a?.commentId];if(s){a.commentHtml=s?.commentHtml,a.commentText=s?.commentText;let m=s?.attachments;r&&m&&a.attachments?.forEach(p=>{let h=p?.attachmentId;m?.[h]&&(p.name=m?.[h]?.name,p.url=m?.[h]?.url)})}}),e}catch(i){return this.loggingService.catch("Error in CommentUtilsService mergeStrippedDataWithCommentAnnotations:",i),e}}mergeLocationWithCommentAnnotations(e,i){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: mergeLocationWithCommentAnnotations","color: green;");let r=e?.location?.id,a=e?.metadata?.documentId;if(!r||!a)return e;let s=i?.[a]?.[r];return s&&(e.location=s?.location),e}catch(r){return this.loggingService.catch("Error in CommentUtilsService mergeLocationWithCommentAnnotations:",r),e}}isCommentsDataChanged(e,i){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: isCommentsDataChanged","color: green;");let r=this.commentAnnotationsResolverService.getCommentAnnotationById(i);return r?!uo(e,r):!0}catch(r){return this.loggingService.catch("Error in CommentUtilsService isCommentsDataChanged:",r),!0}}stripCommentAnnotationData({data:e,actionType:i}){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: stripCommentAnnotationData","color: green;"),!this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable()||!i)return{originalData:e,strippedData:null};let r=this.attachmentResolverService.attachmentDataProviderAvailable(),a=this.notificationActionTypeMap?.[i];if(!a)return{originalData:e,strippedData:null};let s={},m=null;if(e&&e.annotationId){let p=e.annotationId;if(s[p]={annotationId:p,metadata:_v(e.metadata??{}),comments:{}},e.comments?.forEach(E=>{if(E.commentId){let D;r&&(D={},E.attachments?.forEach(L=>{D[L.attachmentId]={attachmentId:L.attachmentId,name:L.name,url:L.url}})),s[p].comments[E.commentId]=I(I(I({commentId:E.commentId},E?.commentHtml&&{commentHtml:E?.commentHtml}),E?.commentText&&{commentText:E?.commentText}),D&&{attachments:D})}}),!this.isCommentsDataChanged(s[p],p))return{strippedData:null,originalData:e};let _=new Ro;Object.assign(_,e),_.comments=e.comments?.map(E=>{let D=new xc;if(Object.assign(D,E),D.isCommentResolverUsed=!0,r){let L=D.attachments?.map(H=>(H.isAttachmentResolverUsed=!0,delete H?.name,delete H?.url,H));D.attachments=L}return delete D?.commentHtml,delete D?.commentText,D})||[],m=_}return{strippedData:s,originalData:m,eventType:a}}catch(r){return this.loggingService.catch("Error in CommentAnnotationsResolverService stripCommentAnnotationData:",r),{strippedData:null,originalData:null}}}formatCommentThreadData(e){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: formatCommentThreadData","color: green;"),this.usersService.userDataProviderAvailable()){e?.from?.userId&&(e.from={userId:e.from.userId}),e?.to&&(e.to=e?.to?.map(r=>r?.userId?{userId:r.userId}:r)),e?.taggedUserContacts&&(e.taggedUserContacts=e?.taggedUserContacts?.map(r=>r?.contact?T(I({},r),{contact:{userId:r.userId}}):r));let i=e?.taggedUserContacts?.filter((r,a,s)=>s.findIndex(m=>m.text===r.text)===a)||[];i.forEach(r=>{if(r?.text){let a=new RegExp(Cm(r.text),"g");e.commentText=e.commentText?.replaceAll(a,s=>`{{${r.userId}}}`),e.commentHtml=e.commentHtml?.replaceAll(a,s=>`{{${r.userId}}}`)}}),i.forEach(r=>{r?.text&&(r.text="")})}return e}catch(i){return this.loggingService.catch("Error in CommentUtilsService formatCommentThreadData:",i),e}}handleCommentEncryption(s){return Q(this,arguments,function*({data:e,firestorePath:i,extraData:r,eventType:a}){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: handleCommentEncryption","color: green;");let m=U6(this.authService.getFirebaseConfig()?.firebaseOptions),p=yr(this.functions,br({url:Xn.cloudFunction?.[m]?.setEncryptedData,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:20*60*1e3});if(r){r=this.notificationService?.processNotificationData(r),r.annotationData=e;let D=r?.targetAnnotationData?.commentId;if(D){let L=e?.comments?.find(H=>H?.commentId===D);L&&(r.targetAnnotationData=L)}}let h=qp.getFirestoreProdDbName(this.configService.getApiKey()??"",this.authService.getFirebaseConfig()?.firebaseOptions),_={path:i??"",data:e??{},dbId:h??"",notificationData:r||void 0,notificationURL:Xn.firebaseNotificationsDatabaseURL,feature:"comment",eventType:a??"PATCH",sdkVersion:ga()},E=yield kp(_,this.authService.getUser()?.userId??"");yield p({veltData:E})}catch(m){this.loggingService.catch("Error in CommentUtilsService handleCommentEncryption:",m)}})}};o.\u0275fac=function(i){return new(i||o)(J(y),J(Gn),J(He),J(jo),J(jt),J(xs),J(Yp))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Ele=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.usersService=i}getUserIdsToResolveFromUserIamData(e){try{this.loggingService.log("%c[WB] Calling ContactUtilsService FUNCTION: getUserIdsToResolveFromUserIamData","color: green;");let i=new Set;if(e?.length)for(let r of e)r?.user?.userId&&i.add(r?.user?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in ContactUtilsService getUserIdsToResolveFromUserIamData: ",i),[]}}mergeUserIamWithUser(e){try{if(this.loggingService.log("%c[WB] Calling ContactUtilsService FUNCTION: mergeUserIamWithUser","color: green;"),e?.user?.userId){let i=this.usersService.getUserById(e?.user?.userId);i&&(e=T(I({},e),{user:i}))}return e}catch(i){return this.loggingService.catch("Error in ContactUtilsService mergeUserIamWithUser: ",i),e}}};o.\u0275fac=function(i){return new(i||o)(J(y),J(Gn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var xle=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.usersService=i}getUserIdsToResolveFromCursorUsers(e){try{this.loggingService.log("%c[WB] Calling CursorUtilsService FUNCTION: getUserIdsToResolveFromCursorUsers","color: green;");let i=new Set;for(let r of e)r?.userId&&i.add(r?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in CursorUtilsService getUserIdsToResolveFromCursorUsers:",i),[]}}mergeCursorUserWithUser(e){try{if(this.loggingService.log("%c[WB] Calling CursorUtilsService FUNCTION: mergeCursorUserWithUser","color: green;"),this.usersService.userDataProviderAvailable()&&e?.userId){let i=this.usersService.getUserById(e?.userId);i&&(e=I(I({},e),i))}return e}catch(i){return this.loggingService.catch("Error in CursorUtilsService mergeCursorUserWithUser:",i),e}}formatCursorUserData(e){try{if(this.loggingService.log("%c[WB] Calling CursorUtilsService FUNCTION: formatCursorUserData","color: green;"),this.usersService.userDataProviderAvailable()){let i=["userId","comment","positionX","positionY","screenWidth","screenHeight","screenScrollHeight","onlineStatus","userSnippylyId","color","textColor","timestamp","type","selections","documentParamsId","documentParams","locationId","location","targetElement","position","isReadOnly","isAnonymous","pageInfo"];Object.keys(e).forEach(r=>{i.includes(r)||(e[r]=null)})}return e}catch(i){return this.loggingService.catch("Error in CursorUtilsService formatCursorUserData:",i),e}}};o.\u0275fac=function(i){return new(i||o)(J(y),J(Gn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var TM=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.usersService=i}getUserIdsToResolveFromHuddleAttendees(e){try{this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: getUserIdsToResolveFromHuddleAttendees","color: green;");let i=new Set;for(let r of e)r?.userId&&i.add(r?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in HuddleUtilsService getUserIdsToResolveFromHuddleAttendees:",i),[]}}mergeHuddleAttendeeWithUser(e){try{if(this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: mergeHuddleAttendeeWithUser","color: green;"),e?.userId){let i=this.usersService.getUserById(e?.userId);i&&(e=I(I({},e),i))}return e}catch(i){return this.loggingService.catch("Error in HuddleUtilsService mergeHuddleAttendeeWithUser:",i),e}}formatHuddleAttendeeData(e){try{if(this.usersService.userDataProviderAvailable()){let i=["userId","userSnippylyId","state","timestamp","initialHuddleMode","streamMetadata","initialHuddleType","huddleOnCursorMode"];Object.keys(e).forEach(r=>{i.includes(r)||(e[r]=null)})}return e}catch(i){return this.loggingService.catch("Error in HuddleUtilsService formatHuddleAttendeeData:",i),e}}getUserIdsToResolveFromHuddleMessages(e){try{this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: getUserIdsToResolveFromHuddleMessages","color: green;");let i=new Set;for(let r of e)r?.from?.userId&&i.add(r?.from?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in HuddleUtilsService getUserIdsToResolveFromHuddleMessages:",i),[]}}mergeHuddleMessageWithUser(e){try{if(this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: mergeHuddleMessageWithUser","color: green;"),e?.from?.userId){let i=this.usersService.getUserById(e?.from?.userId);i&&(e.from=i)}return e}catch(i){return this.loggingService.catch("Error in HuddleUtilsService mergeHuddleMessageWithUser:",i),e}}resolveUsersFromHuddleMessages(e){return Q(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: resolveUsersFromHuddleMessages","color: green;"),this.usersService.userDataProviderAvailable()){let i=this.getUserIdsToResolveFromHuddleMessages(e),r=yield this.usersService.resolveUsers({userIds:i});for(let a of e)a?.from?.userId&&r[a.from.userId]&&(a.from=r[a.from.userId])}return e}catch(i){return this.loggingService.catch("Error in HuddleUtilsService resolveUsersFromHuddleMessages:",i),e}})}formatHuddleMessageData(e){try{return this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: formatHuddleMessageData","color: green;"),this.usersService.userDataProviderAvailable()&&e?.from?.userId&&(e.from={userId:e.from.userId}),e}catch(i){return this.loggingService.catch("Error in HuddleUtilsService formatHuddleMessageData:",i),e}}};o.\u0275fac=function(i){return new(i||o)(J(y),J(Gn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Dle=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.usersService=i}getUserIdsToResolveFromLiveStateCustom(e){try{let i=new Set;return e?.updatedBy&&i.add(e?.updatedBy?.userId),Array.from(i)}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService getUserIdsToResolveFromLiveStateCustom:",i),[]}}mergeLiveStateCustomWithUser(e){try{if(e?.updatedBy?.userId){let i=this.usersService.getUserById(e?.updatedBy?.userId);i&&(e.updatedBy=i)}return e}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService mergeLiveStateCustomWithUser:",i),e}}formatLiveStateCustomData(e){try{return this.usersService.userDataProviderAvailable()&&e?.updatedBy&&(e.updatedBy={userId:e.updatedBy.userId}),e}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService formatLiveStateCustomData:",i),e}}getUserIdsToResolveFromLiveStateCustoms(e){try{let i=new Set;for(let r of e)r?.updatedBy?.userId&&i.add(r?.updatedBy?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService getUserIdsToResolveFromLiveStateCustoms:",i),[]}}getUserIdsToResolveFromLiveStates(e){try{let i=new Set;return e?.default?.singleEditorMode?.editor?.userId&&i.add(e?.default?.singleEditorMode?.editor?.userId),Array.from(i)}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService getUserIdsToResolveFromLiveStates:",i),[]}}mergeLiveStateWithUser(e){try{if(e?.default?.singleEditorMode?.editor?.userId){let i=this.usersService.getUserById(e?.default?.singleEditorMode?.editor?.userId);i&&(e.default.singleEditorMode.editor=i)}if(e?.default?.singleEditorMode?.requestEditorAccess?.user?.userId){let i=this.usersService.getUserById(e?.default?.singleEditorMode?.requestEditorAccess?.user?.userId);i&&(e.default.singleEditorMode.requestEditorAccess.user=i)}return e}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService mergeLiveStateWithUser:",i),e}}formatLiveStateSingleEditorModeData(e){try{return this.usersService.userDataProviderAvailable()&&(e?.editor?.userId&&(e.editor={userId:e.editor.userId}),e?.requestEditorAccess?.user?.userId&&(e.requestEditorAccess.user={userId:e.requestEditorAccess.user.userId})),e}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService formatLiveStateSingleEditorModeData:",i),e}}mergeLiveStateCustomsWithUsers(e){try{for(let i of e)if(i?.updatedBy?.userId){let r=this.usersService.getUserById(i?.updatedBy?.userId);r&&(i.updatedBy=r)}return e}catch(i){return this.loggingService.catch("Error in mergeLiveStateCustomsWithUsers:",i),e}}};o.\u0275fac=function(i){return new(i||o)(J(y),J(Gn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var wle=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.usersService=i}getUserIdsToResolveFromMultiThreads(e){try{let i=new Set;for(let r of e)r?.from?.userId&&i.add(r?.from?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in MultiThreadUtilsService getUserIdsToResolveFromMultiThreads:",i),[]}}mergeMultiThreadWithUser(e){try{if(e?.from?.userId){let i=this.usersService.getUserById(e?.from?.userId);i&&(e.from=i)}return e}catch(i){return this.loggingService.catch("Error in MultiThreadUtilsService mergeMultiThreadWithUser:",i),e}}formatMultiThreadData(e){try{return this.usersService.userDataProviderAvailable()&&(e?.from?.userId&&(e.from={userId:e.from.userId}),e?.commentAnnotationsMap&&(e.commentAnnotationsMap=null)),e}catch(i){return this.loggingService.catch("Error in MultiThreadUtilsService formatMultiThreadData:",i),e}}};o.\u0275fac=function(i){return new(i||o)(J(y),J(Gn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var e0=(()=>{let o=class o{constructor(e,i,r){this.authService=e,this.loggingService=i,this.usersService=r}getUserIdsToResolveFromRecorders(e){try{let i=new Set;for(let r of e)r?.from?.userId&&i.add(r?.from?.userId),r?.transcription?.from?.userId&&i.add(r?.transcription?.from?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in RecorderUtilsService getUserIdsToResolveFromRecorders:",i),[]}}mergeRecorderWithUser(e){try{if(e?.from?.userId){let i=this.usersService.getUserById(e?.from?.userId);i&&(e.from=i)}if(e?.transcription?.from?.userId){let i=this.usersService.getUserById(e?.transcription?.from?.userId);i&&(e.transcription.from=i)}return e}catch(i){return this.loggingService.catch("Error in RecorderUtilsService mergeRecorderWithUser:",i),e}}formatRecorderData(e,i){try{return e.transcription=e?.transcription?T(I({},e.transcription),{lastUpdated:i}):void 0,this.usersService.userDataProviderAvailable()&&(e?.from?.userId&&(e.from={userId:e.from.userId}),e?.transcription?.from?.userId&&(e.transcription.from={userId:e.transcription.from.userId})),e}catch(r){return this.loggingService.catch("Error in RecorderUtilsService formatRecorderData:",r),e}}formatRecorderDataForWhisperTranscription(e){try{return this.usersService.userDataProviderAvailable()&&e?.fromUser?.userId&&(e.fromUser={userId:e.fromUser?.userId}),e}catch(i){return this.loggingService.catch("Error in RecorderUtilsService formatRecorderDataForWhisperTranscription:",i),e}}encryptRecorderAnnotation(e){return Q(this,null,function*(){try{return yield kp(e,this.authService.getUser()?.userId??"")}catch(i){this.loggingService.catch("Error in RecorderUtilsService encryptRecorderAnnotation:",i);return}})}};o.\u0275fac=function(i){return new(i||o)(J(He),J(y),J(Gn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var DM=(()=>{let o=class o{constructor(e,i,r,a,s,m){this.commentUtilsService=e,this.recorderUtilsService=i,this.loggingService=r,this.usersService=a,this.authService=s,this.commentAnnotationsResolverService=m}getUserIdsToResolveFromNotifications(e){try{let i=new Set;for(let r of e){let{notification:a}=r;switch(a?.actionUser?.userId&&i.add(a?.actionUser?.userId),a?.displayHeadlineMessageTemplateData?.actionUser?.userId&&i.add(a?.displayHeadlineMessageTemplateData?.actionUser?.userId),a?.displayHeadlineMessageTemplateData?.recipientUser?.userId&&i.add(a?.displayHeadlineMessageTemplateData?.recipientUser?.userId),a?.notificationSource){case"comment":if(a?.notificationSourceData){let s=this.commentUtilsService.getUserIdsToResolveFromComments([a?.notificationSourceData]);for(let m of s)i.add(m)}break}}return Array.from(i)}catch(i){return this.loggingService.catch("Error in ReactionUtilsService getUserIdsToResolveFromRecorders:",i),[]}}mergeStrippedDataWithNotification(e){try{if(this.loggingService.log("%c[WB] Calling NotificationUtilsService FUNCTION: mergeStrippedDataWithNotification","color: green;"),!this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable())return e;let i=this.commentAnnotationsResolverService.getAnnotationById(e?.notification?.targetAnnotationId),r=e?.raw?.targetAnnotationData?.commentId,a=i?.comments?.[r]?.commentText,s=i?.comments?.[r]?.commentHtml;return a&&s&&e?.raw?.notificationSource==="comment"&&(e.notification.displayBodyMessageTemplate=a,e.raw.targetAnnotationData.commentText=a,e.raw.targetAnnotationData.commentHtml=s),e}catch(i){return this.loggingService.catch("Error in NotificationUtilsService mergeStrippedDataWithNotification:",i),e}}mergeLocationWithNotification(e,i){try{this.loggingService.log("%c[WB] Calling NotificationUtilsService FUNCTION: mergeLocationWithNotification","color: green;");let r=e?.notification?.notificationSourceData?.location?.id,a=e?.notification?.notificationSourceData?.metadata?.documentId;if(!r||!a)return e;let s=i?.[a]?.[r];return s&&(e.notification.notificationSourceData.location=s?.location,e?.raw?.annotationData?.location&&(e.raw.annotationData.location=s?.location)),e}catch(r){return this.loggingService.catch("Error in NotificationUtilsService mergeLocationWithNotification:",r),e}}mergeNotificationWithUser(e){try{this.loggingService.log("%c[WB] Calling NotificationUtilsService FUNCTION: mergeNotificationWithUser","color: green;");let{notification:i}=e;if(i?.actionUser?.userId){let r=this.usersService.getUserById(i?.actionUser?.userId);r&&(i.actionUser=r)}if(i?.displayHeadlineMessageTemplateData?.actionUser?.userId){let r=this.usersService.getUserById(i?.displayHeadlineMessageTemplateData?.actionUser?.userId);r&&(i.displayHeadlineMessageTemplateData.actionUser=r)}if(i?.displayHeadlineMessageTemplateData?.recipientUser?.userId){let r=this.usersService.getUserById(i?.displayHeadlineMessageTemplateData?.recipientUser?.userId);r&&(i.displayHeadlineMessageTemplateData.recipientUser=r)}switch(i?.notificationSource){case"comment":i?.notificationSourceData&&this.commentUtilsService.mergeCommentWithUser(i?.notificationSourceData);break}return e}catch(i){return this.loggingService.catch("Error in NotificationUtilsService mergeNotificationWithUser:",i),e}}formatNotification(e,i){try{switch(typeof e=="object"&&(e=JSON.parse(JSON.stringify(e))),this.usersService.userDataProviderAvailable()&&e?.actionUser&&(e.actionUser={userId:e.actionUser.userId}),e.notificationSource){case"comment":this.commentUtilsService.formatCommentData(e.annotationData),this.commentUtilsService.formatCommentThreadData(e.targetAnnotationData);break;case"recorder":this.recorderUtilsService.formatRecorderData(e.annotationData,i);break}return e}catch(r){return this.loggingService.catch("Error in NotificationUtilsService formatNotification: ",r),e}}getTargetAnnotationIdsFromNotifications(e){try{this.loggingService.log("%c[WB] Calling NotificationUtilsService FUNCTION: getTargetAnnotationIdsFromNotifications","color: green;");let i=[];return Object.values(e).forEach(r=>{r?.notification?.targetAnnotationId&&r?.raw?.notificationSource==="comment"&&i.push(r.notification.targetAnnotationId)}),i}catch(i){return this.loggingService.catch("Error in NotificationUtilsService getTargetAnnotationIdsFromNotifications:",i),[]}}handleNotificationEncryption(i){return Q(this,arguments,function*({data:e}){try{this.loggingService.log("%c[WB] Calling NotificationUtilsService FUNCTION: handleNotificationEncryption","color: green;");let r="notificationwithdocumentidstoencryptanddecryptonsdk"+(this.authService.getUser()?.userId??"");return yield kp(e,r)}catch(r){return this.loggingService.catch("Error in NotificationUtilsService handleNotificationEncryption:",r),e}})}};o.\u0275fac=function(i){return new(i||o)(J(Jv),J(e0),J(y),J(Gn),J(He),J(xs))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Ale=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.usersService=i}getUserIdsToResolveFromPresenceUsers(e){try{let i=new Set;for(let r of e)r?.userId&&i.add(r?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in PresenceUtilsService getUserIdsToResolveFromPresenceUsers:",i),[]}}mergePresenceUserWithUser(e){try{if(this.usersService.userDataProviderAvailable()&&e?.userId){let i=this.usersService.getUserById(e?.userId);i&&(e=I(I({},e),i))}return e}catch(i){return this.loggingService.catch("Error in PresenceUtilsService mergePresenceUserWithUser:",i),e}}formatPresenceUserData(e){try{if(this.usersService.userDataProviderAvailable()){let i=["userId","onlineStatus","userSnippylyId","color","textColor","timestamp","type","selections","documentParamsId","documentParams","locationId","location","isReadOnly","isAnonymous","pageInfo"];Object.keys(e).forEach(r=>{i.includes(r)||(e[r]=null)})}return e}catch(i){return this.loggingService.catch("Error in PresenceUtilsService formatPresenceUserData:",i),e}}};o.\u0275fac=function(i){return new(i||o)(J(y),J(Gn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Ple=(()=>{let o=class o{constructor(e,i,r,a,s,m){this.loggingService=e,this.usersService=i,this.authService=r,this.functions=a,this.configService=s,this.reactionAnnotationsResolverService=m}getUserIdsToResolveFromReactions(e){try{let i=new Set;for(let r of e)if(r?.from?.userId&&i.add(r?.from?.userId),r?.reactions?.length)for(let a of r?.reactions)a?.from?.userId&&i.add(a?.from?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in ReactionUtilsService getUserIdsToResolveFromRecorders:",i),[]}}handleReactionEncryption(a){return Q(this,arguments,function*({data:e,firestorePath:i,eventType:r}){try{let s=U6(this.authService.getFirebaseConfig()?.firebaseOptions),m=yr(this.functions,br({url:Xn.cloudFunction?.[s]?.setEncryptedData,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:20*60*1e3}),p=qp.getFirestoreProdDbName(this.configService.getApiKey()??"",this.authService.getFirebaseConfig()?.firebaseOptions),h=this.authService.getUser()?.userId??"",_={path:i??"",data:e??{},dbId:p??"",feature:"reaction",eventType:r??"PATCH",sdkVersion:ga()},E=yield kp(_,h);yield m({veltData:E})}catch(s){this.loggingService.catch("Error in handleReactionEncryption:",s)}})}mergeReactionWithUser(e){try{if(this.usersService.userDataProviderAvailable()){if(e?.from?.userId){let i=this.usersService.getUserById(e?.from?.userId);i&&(e.from=i)}if(e?.reactions?.length){for(let i of e?.reactions)if(i?.from?.userId){let r=this.usersService.getUserById(i?.from?.userId);r&&(i.from=r)}}}return e}catch(i){return this.loggingService.catch("Error in ReactionUtilsService mergeReactionWithUser:",i),e}}formatReactionData(e){try{return this.usersService.userDataProviderAvailable()&&e?.from?.userId&&(e.from={userId:e.from.userId}),e.reactions=e?.reactions?.map(i=>(this.usersService.userDataProviderAvailable()&&i?.from?.userId&&(i.from={userId:i.from.userId}),i)),e}catch(i){return this.loggingService.catch("Error in ReactionUtilsService formatReactionData:",i),e}}isReactionDataChanged(e,i){try{this.loggingService.log("%c[WB] Calling ReactionUtilsService FUNCTION: isReactionDataChanged","color: green;");let r=this.reactionAnnotationsResolverService.getReactionAnnotationById(i);return r?!uo(e,r):!0}catch(r){return this.loggingService.catch("Error in ReactionUtilsService isReactionDataChanged:",r),!0}}stripReactionAnnotationData(e){try{if(this.loggingService.log("%c[WB] Calling ReactionUtilsService FUNCTION: stripReactionAnnotationData","color: green;"),!this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable())return{originalData:e,strippedData:null};let i={};if(e&&e.annotationId){let r=e.annotationId;if(i[r]={annotationId:r,metadata:_v(e.metadata??{}),icon:e.icon},!this.isReactionDataChanged(i[r],r))return{strippedData:null,originalData:e};delete e?.icon,e.isReactionResolverUsed=!0}return{strippedData:i,originalData:e}}catch(i){return this.loggingService.catch("Error in ReactionUtilsService stripReactionAnnotationData:",i),{strippedData:null,originalData:null}}}mergeStrippedDataWithReactionAnnotations(e){try{if(this.loggingService.log("%c[WB] Calling ReactionUtilsService FUNCTION: mergeStrippedDataWithReactionAnnotations","color: green;"),!this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable())return e;let i=this.reactionAnnotationsResolverService.getReactionAnnotationById(e?.annotationId);return i&&i.icon&&(e.icon=i.icon),e}catch(i){return this.loggingService.catch("Error in ReactionUtilsService mergeStrippedDataWithReactionAnnotations:",i),e}}};o.\u0275fac=function(i){return new(i||o)(J(y),J(Gn),J(He),J(jo),J(jt),J(Am))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Mle=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.usersService=i}getUserIdsToResolveFromSelections(e){try{let i=new Set;for(let r of e)r?.user?.userId&&i.add(r.user.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in SelectionUtilsService getUserIdsToResolveFromSelections:",i),[]}}mergeSelectionWithUser(e){try{if(e?.user?.userId){let i=this.usersService.getUserById(e?.user?.userId);i&&(e.user=i)}return e}catch(i){return this.loggingService.catch("Error in SelectionUtilsService mergeSelectionWithUser:",i),e}}formatSelectionData(e){try{return this.usersService.userDataProviderAvailable()&&e?.user?.userId&&(e.user={userId:e.user.userId}),e}catch(i){return this.loggingService.catch("Error in SelectionUtilsService formatSelectionData:",i),e}}};o.\u0275fac=function(i){return new(i||o)(J(y),J(Gn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var kle=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.usersService=i}getUserIdsToResolveFromTags(e){try{let i=new Set;for(let r of e)if(r?.from?.userId&&i.add(r.from.userId),r?.to?.length)for(let a of r.to)a?.userId&&i.add(a.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in TagUtilsService getUserIdsToResolveFromTags:",i),[]}}mergeTagWithUser(e){try{if(e?.from?.userId){let i=this.usersService.getUserById(e?.from?.userId);i&&(e.from=i)}return e?.to?.length&&(e.to=e.to.map(i=>{if(i?.userId){let r=this.usersService.getUserById(i?.userId);r&&(i=r)}return i})),e}catch(i){return this.loggingService.catch("Error in TagUtilsService mergeTagWithUser:",i),e}}formatTagData(e){try{return this.usersService.userDataProviderAvailable()&&(e?.from?.userId&&(e.from={userId:e.from.userId}),e?.to?.length&&(e.to=e.to.map(i=>(i?.userId&&(i={userId:i.userId}),i)))),e}catch(i){return this.loggingService.catch("Error in TagUtilsService formatTagData:",i),e}}};o.\u0275fac=function(i){return new(i||o)(J(y),J(Gn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var t0=(()=>{let o=class o{constructor(e,i,r,a,s,m,p,h,_,E,D,L,H,K,oe,ue,be,Le,qe){this.areaUtilsService=e,this.arrowUtilsService=i,this.commentUtilsService=r,this.contactUtilsService=a,this.cursorUtilsService=s,this.huddleUtilsService=m,this.liveStateUtilsService=p,this.loggingService=h,this.multiThreadUtilsService=_,this.notificationUtilsService=E,this.presenceUtilsService=D,this.reactionUtilsService=L,this.recorderUtilsService=H,this.selectionUtilsService=K,this.tagUtilsService=oe,this.usersService=ue,this.docService=be,this.commentAnnotationsResolverService=Le,this.reactionAnnotationsResolverService=qe}getFirestorePath({feature:e,properties:i,documentPaths:r,apiKey:a}){try{if(!a)return;let{documentId:s,organizationId:m,folderId:p}=i;m||(m=r?.organizationId);let h=new IM({apiKey:a,documentId:s?`${s}`:"",organizationId:m?`${m}`:"",veltFolderId:p?`${p}`:void 0});switch(e){case"userConfig":return i?.userId&&i?.documentId&&h?.userConfig?`${h?.userConfig}/${i?.userId}/${j.FIREBASE_PARTIAL_PATH_DOCUMENT_CONFIGURATIONS}/${i?.documentId}`:void 0;case"comment":return i?.documentId&&i?.id&&h?.comment?`${h?.comment}/${i?.id}`:void 0;case"allComments":return i?.documentId&&h?.comment?`${h?.comment}`:void 0;case"multiThread":return i?.documentId&&i?.id&&h?.multiThread?`${h?.multiThread}/${i?.id}`:void 0;case"allMultiThreads":return i?.documentId&&h?.multiThread?`${h?.multiThread}`:void 0;case"allLastNotificationTimestamp":return h?.lastNotificationTimestamp?`${h?.lastNotificationTimestamp}`:void 0;case"lastNotificationTimestamp":return i?.id&&h?.lastNotificationTimestamp?`${h?.lastNotificationTimestamp}/${i?.id}`:void 0;case"area":return i?.documentId&&i?.id&&h?.area?`${h?.area}/${i?.id}`:void 0;case"allAreas":return i?.documentId&&h?.area?`${h?.area}`:void 0;case"allDocuments":return h?.document?`${h?.document}`:void 0;case"allLocations":return h?.location?`${h?.location}`:void 0;case"allFolders":return h?.folder?`${h?.folder}`:void 0;case"folder":return h?.folder&&i.folderId?`${h?.folder}/${i.folderId}`:void 0;case"documentUserAccess":return i?.documentId&&i?.id&&h?.documentUsers?`${h?.documentUsers}/${i?.id}`:void 0;case"reaction":return i?.documentId&&i?.id&&h?.reaction?`${h?.reaction}/${i?.id}`:void 0;case"allReactions":return i?.documentId&&h?.reaction?`${h?.reaction}`:void 0;case"recorder":return i?.documentId&&i?.id&&h?.recorder?`${h?.recorder}/${i?.id}`:void 0;case"allRecorders":return i?.documentId&&h?.recorder?`${h?.recorder}`:void 0;case"documentAccessType":return i?.documentId&&h?.document?`${h?.document}/${i?.documentId}`:void 0;case"organizationMetadata":return h?.organization?`${h?.organization}`:void 0;case"documentIam":case"documentMetadata":return i?.documentId&&h?.document?`${h?.document}/${i?.documentId}`:void 0;case"folderMetadata":return i?.folderId&&h?.folder?`${h?.folder}/${i?.folderId}`:void 0;case"locationMetadata":return i?.documentId&&h?.location&&i?.id?`${h?.location}/${i?.id}`:void 0;case"documentUser":return i?.documentId&&i?.id&&h?.documentUsers?`${h?.documentUsers}/${i?.id}`:void 0;case"allDocumentUsers":return i?.documentId&&h?.documentUsers?`${h?.documentUsers}`:void 0;case"allFolderUsers":return i?.folderId&&h?.folderUsers?`${h?.folderUsers}`:void 0;case"allOrganizationGroups":return h?.organizationGroups?`${h?.organizationGroups}`:void 0;case"allOrganizationUsers":return h?.organizationUsers?`${h?.organizationUsers}`:void 0;case"commentViews":return i?.documentId&&i?.id&&h?.commentViews?`${h?.commentViews}/${i?.id}`:void 0;case"allCommentViews":return i?.documentId&&h?.commentViews?`${h?.commentViews}`:void 0;case"notificationViewsTimestamp":return i?.documentId&&i?.id&&h?.notificationViews?`${h?.notificationViews}/${i?.id}`:void 0;case"allDocumentViews":return i?.documentId&&h?.documentViews?`${h?.documentViews}`:void 0;case"documentViews":case"documentMetadataViews":case"documentDayViews":case"documentUsersViews":return i?.documentId&&i?.id&&h?.documentViews?`${h?.documentViews}/${i?.id}`:void 0;case"locationDayViews":case"locationUsersViews":case"locationViews":case"locationMetadataViews":case"location":return i?.documentId&&i?.id&&h?.locationViews?`${h?.locationViews}/${i?.id}`:void 0;case"allLocationViews":return i?.documentId&&h?.locationViews?`${h?.locationViews}`:void 0;case"allDocNotifications":return i?.documentId&&h?.docNotification?`${h?.docNotification}`:void 0;case"docNotificationViews":case"docNotification":return i?.documentId&&i?.id&&h?.docNotification?`${h?.docNotification}/${i?.id}`:void 0;case"userNotificationViews":case"userNotification":return i?.userId&&i?.id&&h?.notificationUsers?`${h?.notificationUsers}/${i?.userId}/${j.FIREBASE_PARTIAL_PATH_USER_NOTIFICATION}/${i?.id}`:void 0;case"allDocNotifications":return i?.documentId&&h?.docNotification?`${h?.docNotification}`:void 0;case"allUserNotifications":return i?.userId&&h?.notificationUsers?`${h?.notificationUsers}/${i?.userId}/${j.FIREBASE_PARTIAL_PATH_USER_NOTIFICATION}`:void 0;default:throw new Error(`Unknown feature: ${e}`)}}catch(s){this.loggingService.catch("Error in CommonDbUtilsService getFirestorePath:",s);return}}getFirestoreCollectionGroupPath(e){try{switch(e){case"allComments":return j.FIREBASE_PARTIAL_PATH_COMMENT;case"allDocuments":return j.FIREBASE_PARTIAL_PATH_DOCS;case"allLocations":return j.FIREBASE_PARTIAL_PATH_LOCATION;case"allMultiThreads":return j.FIREBASE_PARTIAL_PATH_MULTI_THREAD;case"allAreas":return j.FIREBASE_PARTIAL_PATH_AREA;case"allReactions":return j.FIREBASE_PARTIAL_PATH_REACTION;case"allRecorders":return j.FIREBASE_PARTIAL_PATH_RECORDER;case"allDocumentViews":return j.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS;case"allCommentViews":return j.FIREBASE_PARTIAL_PATH_COMMENT_VIEWS;case"allLocationViews":return j.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS;case"allDocumentUsers":return j.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS;case"allFolderUsers":return j.FIREBASE_PARTIAL_PATH_FOLDER_USERS;default:throw new Error(`Unknown feature: ${e}`)}}catch(i){this.loggingService.catch("Error in CommonDbUtilsService getFirestoreCollectionGroupPath:",i);return}}getDocumentPath({feature:e,properties:i,defaultDocumentPaths:r,apiKey:a,useFirestore:s}){try{if(!a)return;let{documentId:m,organizationId:p}=i;p||(p=r?.organizationId);let h=new Om({apiKey:a,documentId:m?`${m}`:"",organizationId:p?`${p}`:""});switch(e){case"userConfig":return i?.userId&&i?.documentId&&h?.userConfig?`${h?.userConfig}/${i?.userId}/${j.FIREBASE_PARTIAL_PATH_DOCUMENT_CONFIGURATIONS}/${i?.documentId}`:void 0;case"allComments":return!s&&i?.documentId&&h?.comment?`${h?.comment}`:void 0;case"allGlobalContacts":return i?.documentId&&h?.globalContacts?`${h?.globalContacts}`:void 0;case"globalContacts":return i?.documentId&&i?.userId&&h?.globalContacts?`${h?.globalContacts}${i?.userId}`:void 0;case"groupContacts":return i?.documentId&&i?.groupId&&h?.groupContacts?`${h?.groupContacts}${i?.groupId}`:void 0;case"groupContactsUser":return i?.documentId&&i?.groupId&&i?.userId&&h?.groupContacts?`${h?.groupContacts}${i?.groupId}/${i?.userId}`:void 0;case"allLoginContacts":return i?.documentId&&i?.userId&&h?.logins?`${h?.logins}${i?.userId}/contacts`:void 0;case"allLogins":return i?.documentId&&h?.logins?`${h?.logins}`:void 0;case"logins":return i?.documentId&&i?.userId&&h?.logins?`${h?.logins}${i?.userId}`:void 0;case"customerMetadata":return h?.customerMetadata?`${h?.customerMetadata}`:void 0;case"allArrows":return i?.documentId&&h?.arrow?`${h?.arrow}`:void 0;case"arrow":return i?.documentId&&h?.arrow&&i.id?`${h?.arrow}${i.id}`:void 0;case"allCursors":return i?.documentId&&h?.cursor?`${h?.cursor}`:void 0;case"cursor":return i?.documentId&&h?.cursor&&i.id?`${h?.cursor}${i.id}`:void 0;case"flockUser":return i?.documentId&&h?.flock&&i.id?`${h?.flock}users/${i.id}`:void 0;case"flockSession":return i?.documentId&&h?.flock&&i.id?`${h?.flock}sessions/${i.id}`:void 0;case"allHuddleAttendees":return i?.documentId&&h?.huddle?`${h?.huddle}attendees`:void 0;case"huddleAttendee":return i?.documentId&&h?.huddle&&i.id?`${h?.huddle}attendees/${i.id}`:void 0;case"huddleAttendeeState":return i?.documentId&&h?.huddle&&i.id?`${h?.huddle}attendees/${i.id}/state`:void 0;case"allHuddleInvitees":return i?.documentId&&h?.huddle?`${h?.huddle}invitees`:void 0;case"huddleConnection":return i?.documentId&&h?.huddle&&i.id?`${h?.huddle}connections/${i.id}`:void 0;case"huddleIceCandidate":return i?.documentId&&h?.huddle&&i.id?`${h?.huddle}iceCandidates/${i.id}`:void 0;case"allHuddleIceCandidates":return i?.documentId&&h?.huddle?`${h?.huddle}iceCandidates`:void 0;case"allHuddleMessages":return i?.documentId&&h?.huddle?`${h?.huddle}messages`:void 0;case"huddleMessage":return i?.documentId&&h?.huddle&&i.id?`${h?.huddle}messages/${i.id}`:void 0;case"allLiveStates":return i?.documentId&&h?.liveState?`${h?.liveState}`:void 0;case"allLiveStateCustoms":return i?.documentId&&h?.liveState?`${h?.liveState}custom`:void 0;case"liveStateCustom":return i?.documentId&&h?.liveState&&i?.id?`${h?.liveState}custom/${i.id}`:void 0;case"liveStateSingleEditorMode":return i?.documentId&&h?.liveStateSingleEditorMode?`${h?.liveStateSingleEditorMode}`:void 0;case"liveStateAutoSyncStateCurrent":return i?.documentId&&h?.liveState?`${h?.liveState}default/autoSyncState/current`:void 0;case"liveStateAutoSyncStateHistoryId":return i?.documentId&&h?.liveState&&i?.id?`${h?.liveState}default/autoSyncState/history/${i.id}`:void 0;case"presence":return i?.documentId&&h?.presence&&i?.userId?`${h?.presence}${i?.userId}`:void 0;case"allPresence":return i?.documentId&&h?.presence?`${h?.presence}`:void 0;case"workspaceIam":return h?.workspaceIam?`${h?.workspaceIam}`:void 0;case"selection":return i?.documentId&&h?.selection&&i?.userId?`${h?.selection}${i?.userId}`:void 0;case"allSelections":return i?.documentId&&h?.selection?`${h?.selection}`:void 0;case"syncVideoPlayer":return i?.documentId&&h?.syncVideoPlayer?`${h?.syncVideoPlayer}`:void 0;case"allTags":return i?.documentId&&h?.tag?`${h?.tag}`:void 0;case"tag":return i?.documentId&&h?.tag&&i?.id?`${h?.tag}${i?.id}`:void 0;case"userContactUs":return i?.documentId&&h?.userContactUs?`${h?.userContactUs}`:void 0;case"userFeedback":return i?.documentId&&h?.userFeedback?`${h?.userFeedback}`:void 0;case"userReportBug":return i?.documentId&&h?.userReportBugs?`${h?.userReportBugs}`:void 0;case"comment":return!s&&i?.documentId&&i?.id&&h?.comment?`${h?.comment}${i?.id}`:void 0;case"allMultiThreads":return!s&&i?.documentId&&h?.multiThread?`${h?.multiThread}`:void 0;case"multiThread":return!s&&i?.documentId&&i?.id&&h?.multiThread?`${h?.multiThread}${i?.id}`:void 0;case"allLastNotificationTimestamp":return!s&&h?.organizationNotificationsLastNotificationTimestamp?`${h?.organizationNotificationsLastNotificationTimestamp}`:void 0;case"lastNotificationTimestamp":return!s&&i?.id&&h?.organizationNotificationsLastNotificationTimestamp?`${h?.organizationNotificationsLastNotificationTimestamp}${i?.id}`:void 0;case"documentIam":return!s&&i?.documentId&&h?.documentIam?`${h?.documentIam}`:void 0;case"documentMetadata":return!s&&i?.documentId&&h?.metadata?`${h?.metadata}`:void 0;case"allDocuments":return!s&&h?.docs&&i?.documentId?`${h?.docs}/${i?.documentId}/${j.FIREBASE_PARTIAL_PATH_METADATA}`:void 0;case"allAreas":return!s&&i?.documentId&&h?.area?`${h?.area}`:void 0;case"area":return!s&&i?.id&&h?.area?`${h?.area}${i?.id}`:void 0;case"documentUserAccess":return!s&&i?.id&&h?.documentIam?`${h?.documentIam}users/${i?.id}`:void 0;case"documentUser":return!s&&i?.documentId&&i?.id&&h?.documentIam?`${h?.documentIam}users/${i?.id}`:void 0;case"allDocumentUsers":return!s&&i?.documentId&&h?.documentIam?`${h?.documentIam}users/`:void 0;case"allOrganizationGroups":return!s&&h?.organizationGroups?`${h?.organizationGroups}`:void 0;case"allOrganizationUsers":return!s&&h?.organizationIam?`${h?.organizationIam}users/`:void 0;case"reaction":return!s&&i?.id&&h?.reaction?`${h?.reaction}${i?.id}`:void 0;case"allReactions":return!s&&i?.documentId&&h?.reaction?`${h?.reaction}`:void 0;case"recorder":return!s&&i?.documentId&&i?.id&&h?.recorder?`${h?.recorder}${i?.id}`:void 0;case"allRecorders":return!s&&i?.documentId&&h?.recorder?`${h?.recorder}`:void 0;case"organizationMetadata":return!s&&h?.organizationMetadata?`${h?.organizationMetadata}`:void 0;case"documentAccessType":return!s&&h?.documentIam?`${h?.documentIam}`:void 0;case"documentIam":return!s&&h?.documentIam?`${h?.documentIam}`:void 0;case"documentMetadata":return!s&&i?.documentId&&h?.metadata?`${h?.metadata}`:void 0;case"commentViews":return!s&&i?.documentId&&i?.id&&h?.views?`${h?.views}comment/${i?.id}`:void 0;case"allDocumentViews":return!s&&i?.documentId&&h?.views?`${h?.views}documentViews/`:void 0;case"documentViews":return!s&&i?.documentId&&i?.id&&h?.views?`${h?.views}documentViews/${i?.id}`:void 0;case"allCommentViews":return!s&&i?.documentId&&h?.views?`${h?.views}comment/`:void 0;case"allLocationViews":return!s&&i?.documentId&&h?.views?`${h?.views}locationViews/`:void 0;case"notificationViewsTimestamp":return!s&&i?.id&&i?.user&&h?.views?`${h?.views}notification/${i?.id}/views/${i?.user}`:void 0;case"documentUsersViews":return!s&&i?.id&&i?.user&&i?.date&&h?.views?`${h?.views}documentViews/${i?.id}/users/${i?.user}/${i?.date}`:void 0;case"documentMetadataViews":return!s&&i?.id&&h?.views?`${h?.views}documentViews/${i?.id}/metadata`:void 0;case"documentDayViews":return!s&&i?.id&&i?.date&&i?.user&&h?.views?`${h?.views}documentViews/${i?.id}/day/${i?.date}/${i?.user}`:void 0;case"locationViews":return!s&&i?.id&&h?.views?`${h?.views}locationViews/${i?.id}/location`:void 0;case"location":return!s&&i?.id&&h?.views?`${h?.views}locationViews/${i?.id}`:void 0;case"locationUsersViews":return!s&&i?.id&&i?.user&&i?.date&&h?.views?`${h?.views}locationViews/${i?.id}/users/${i?.user}/${i?.date}`:void 0;case"locationMetadataViews":return!s&&i?.id&&h?.views?`${h?.views}locationViews/${i?.id}/metadata`:void 0;case"locationDayViews":return!s&&i?.id&&i?.date&&i?.user&&h?.views?`${h?.views}locationViews/${i?.id}/day/${i?.date}/${i?.user}`:void 0;case"docNotificationViews":case"docNotification":return i?.documentId&&i?.id&&h?.organizationNotificationsWithDocumentId?`${h?.organizationNotificationsWithDocumentId}${i?.id}`:void 0;case"allDocNotifications":return i?.documentId&&h?.organizationNotificationsWithDocumentId?`${h?.organizationNotificationsWithDocumentId}`:void 0;case"allUserNotifications":return i?.userId&&h?.organizationNotificationsUsers?`${h?.organizationNotificationsUsers}${i?.userId}`:void 0;case"userNotificationViews":case"userNotification":return i?.userId&&i?.id&&h?.organizationNotificationsUsers?`${h?.organizationNotificationsUsers}${i?.userId}/${i?.id}`:void 0;case"locationMetadata":return;case"allLocations":return;case"folderMetadata":return;default:throw new Error(`Unknown feature: ${e}`)}}catch(m){this.loggingService.catch("Error in CommonDbUtilsService getDocumentPath:",m);return}}resolveAnnotations(r){return Q(this,arguments,function*({data:e,feature:i}){try{if(e&&e?.length>0)switch(i){case"allComments":{this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable()&&this.commentAnnotationsResolverService.resolveCommentAnnotations({commentAnnotationIds:e,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""});break}case"allReactions":{this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable()&&this.reactionAnnotationsResolverService.resolveReactionAnnotations({reactionAnnotationIds:e,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""});break}default:break}}catch(a){this.loggingService.catch(`Error in CommonDbUtilsService resolveAnnotations: ${i}`,a)}})}formatResponse(m){return Q(this,arguments,function*({feature:e,data:i,shouldAwait:r=!1,forceResolve:a=!1,shouldCommentAnnotationsResolverAwait:s=!1}){try{if(this.usersService.userDataProviderAvailable()){let p=[];switch(e){case"allAreas":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.areaUtilsService.getUserIdsToResolveFromAreaAnnotations(Object.values(i)));break}case"allArrows":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.arrowUtilsService.getUserIdsToResolveFromArrowAnnotations(Object.values(i)));break}case"allCursors":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.cursorUtilsService.getUserIdsToResolveFromCursorUsers(Object.values(i)));break}case"allComments":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.commentUtilsService.getUserIdsToResolveFromComments(Object.values(i)));break}case"allDocumentUsers":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.contactUtilsService.getUserIdsToResolveFromUserIamData(Object.values(i)));break}case"allFolderUsers":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.contactUtilsService.getUserIdsToResolveFromUserIamData(Object.values(i)));break}case"allOrganizationUsers":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.contactUtilsService.getUserIdsToResolveFromUserIamData(Object.values(i)));break}case"allMultiThreads":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.multiThreadUtilsService.getUserIdsToResolveFromMultiThreads(Object.values(i)));break}case"allDocNotifications":{i&&typeof i=="object"&&(p=this.notificationUtilsService.getUserIdsToResolveFromNotifications(Array.isArray(i)?i:Object.values(i)));break}case"allUserNotifications":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.notificationUtilsService.getUserIdsToResolveFromNotifications(Object.values(i)));break}case"allPresence":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.presenceUtilsService.getUserIdsToResolveFromPresenceUsers(Object.values(i)));break}case"allRecorders":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.recorderUtilsService.getUserIdsToResolveFromRecorders(Object.values(i)));break}case"allReactions":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.reactionUtilsService.getUserIdsToResolveFromReactions(Object.values(i)));break}case"allTags":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.tagUtilsService.getUserIdsToResolveFromTags(Object.values(i)));break}case"allHuddleAttendees":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.huddleUtilsService.getUserIdsToResolveFromHuddleAttendees(Object.values(i)));break}case"liveStateCustom":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.liveStateUtilsService.getUserIdsToResolveFromLiveStateCustom(i));break}case"allLiveStateCustoms":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.liveStateUtilsService.getUserIdsToResolveFromLiveStateCustoms(Object.values(i)));break}case"allLiveStates":{i&&typeof i=="object"&&(p=this.liveStateUtilsService.getUserIdsToResolveFromLiveStates(i));break}case"allSelections":{i&&typeof i=="object"&&!Array.isArray(i)&&(p=this.selectionUtilsService.getUserIdsToResolveFromSelections(Object.values(i)));break}default:p=[]}p?.length&&(r?yield this.usersService.resolveUsers({userIds:p,forceResolve:a,feature:e}):this.usersService.resolveUsers({userIds:p,forceResolve:a,feature:e}))}if(this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable()){let p=[];switch(e){case"allDocNotifications":{if(i&&typeof i=="object"){let h=this.notificationUtilsService.getTargetAnnotationIdsFromNotifications(i);p=[...p,...h],p=p.filter(_=>!this.commentAnnotationsResolverService.getCommentAnnotationById(_))}break}case"allUserNotifications":{if(i&&typeof i=="object"&&!Array.isArray(i)){let h=this.notificationUtilsService.getTargetAnnotationIdsFromNotifications(i);p=[...p,...h],p=p.filter(_=>!this.commentAnnotationsResolverService.getCommentAnnotationById(_))}break}default:p=[]}p?.length&&(s?yield this.commentAnnotationsResolverService.resolveCommentAnnotations({commentAnnotationIds:p,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""}):this.commentAnnotationsResolverService.resolveCommentAnnotations({commentAnnotationIds:p,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""}))}return i}catch(p){return this.loggingService.catch("Error in CommonDbUtilsService formatResponse:",p),i}})}mergeCommentAnnotationsWithData({data:e,feature:i}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeCommentAnnotationsWithData","color: green;"),this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable())switch(i){case"allComments":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((r,[a,s])=>(r[a]=this.commentUtilsService.mergeStrippedDataWithCommentAnnotations(s),r),{}):e;case"allDocNotifications":case"allUserNotifications":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((r,[a,s])=>(r[a]=this.notificationUtilsService.mergeStrippedDataWithNotification(s),r),{}):e;default:return e}return e}catch(r){return this.loggingService.catch("Error in CommonDbUtilsService mergeCommentAnnotationsWithData:",r),e}}mergeReactionAnnotationsWithData({data:e,feature:i}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeReactionAnnotationsWithData","color: green;"),this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable())switch(i){case"allReactions":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((r,[a,s])=>(r[a]=this.reactionUtilsService.mergeStrippedDataWithReactionAnnotations(s),r),{}):e;default:return e}return e}catch(r){return this.loggingService.catch("Error in CommonDbUtilsService mergeReactionAnnotationsWithData:",r),e}}mergeLocationMetadataWithData({data:e,feature:i,locationMetadata:r}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeLocationMetadataWithData","color: green;"),r&&typeof r=="object"&&!Array.isArray(r))switch(i){case"allComments":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((a,[s,m])=>(a[s]=this.commentUtilsService.mergeLocationWithCommentAnnotations(m,r),a),{}):e;case"allDocNotifications":case"allUserNotifications":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((a,[s,m])=>(a[s]=this.notificationUtilsService.mergeLocationWithNotification(m,r),a),{}):e;default:return e}return e}catch(a){return this.loggingService.catch("Error in CommonDbUtilsService mergeLocationMetadataWithData:",a),e}}mergeUsersWithData({feature:e,data:i}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeUsersWithData","color: green;"),this.usersService.userDataProviderAvailable())switch(e){case"allAreas":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.areaUtilsService.mergeAreaWithUser(s),r),{}):i;case"allArrows":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.arrowUtilsService.mergeArrowWithUser(s),r),{}):i;case"allCursors":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.cursorUtilsService.mergeCursorUserWithUser(s),r),{}):i;case"allComments":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.commentUtilsService.mergeCommentWithUser(s),r),{}):i;case"allDocumentUsers":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.contactUtilsService.mergeUserIamWithUser(s),r),{}):i;case"allFolderUsers":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.contactUtilsService.mergeUserIamWithUser(s),r),{}):i;case"allOrganizationUsers":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.contactUtilsService.mergeUserIamWithUser(s),r),{}):i;case"allMultiThreads":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.multiThreadUtilsService.mergeMultiThreadWithUser(s),r),{}):i;case"allDocNotifications":return i&&typeof i=="object"?i?.map(r=>this.notificationUtilsService.mergeNotificationWithUser(r)):i;case"allUserNotifications":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.notificationUtilsService.mergeNotificationWithUser(s),r),{}):i;case"allPresence":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.presenceUtilsService.mergePresenceUserWithUser(s),r),{}):i;case"allRecorders":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.recorderUtilsService.mergeRecorderWithUser(s),r),{}):i;case"allReactions":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.reactionUtilsService.mergeReactionWithUser(s),r),{}):i;case"allTags":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.tagUtilsService.mergeTagWithUser(s),r),{}):i;case"allHuddleAttendees":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.huddleUtilsService.mergeHuddleAttendeeWithUser(s),r),{}):i;case"liveStateCustom":return i&&typeof i=="object"&&!Array.isArray(i)?this.liveStateUtilsService.mergeLiveStateCustomWithUser(i):i;case"allLiveStateCustoms":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.liveStateUtilsService.mergeLiveStateCustomWithUser(s),r),{}):i;case"allLiveStates":return i&&typeof i=="object"?this.liveStateUtilsService.mergeLiveStateWithUser(i):i;case"allSelections":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((r,[a,s])=>(r[a]=this.selectionUtilsService.mergeSelectionWithUser(s),r),{}):i;default:return i}return i}catch(r){return this.loggingService.catch("Error in CommonDbUtilsService mergeUsersWithData:",r),i}}mergeCommentAnnotationsWithData$({data:e,feature:i}){try{return this.commentAnnotationsResolverService.getCommentAnnotationsById$().pipe(ce(()=>{let r=this.mergeCommentAnnotationsWithData({data:e?.data??{},feature:i}),a=this.mergeUsersWithData({feature:i,data:r??{}});return typeof a=="object"?{data:JSON.parse(JSON.stringify(a)),operation:e?.operation??null}:{data:a,operation:e?.operation??null}}),qt(Vi))}catch(r){return this.loggingService.catch("Error in mergeCommentAnnotationsWithData:",r),se(e)}}mergeReactionAnnotationsWithData$({data:e,feature:i}){try{return this.reactionAnnotationsResolverService.getReactionAnnotationsById$().pipe(ce(()=>{let r=this.mergeReactionAnnotationsWithData({data:e?.data??{},feature:i}),a=this.mergeUsersWithData({feature:i,data:r??{}});return typeof a=="object"?{data:JSON.parse(JSON.stringify(a)),operation:e?.operation??null}:{data:a,operation:e?.operation??null}}),qt(Vi))}catch(r){return this.loggingService.catch("Error in mergeReactionAnnotationsWithData:",r),se(e)}}mergeUsersWithData$({feature:e,data:i}){try{return this.usersService.getUserById$().pipe(ce(()=>{let r=this.mergeUsersWithData({feature:e,data:i?.data??{}});return typeof r=="object"?{data:JSON.parse(JSON.stringify(r)),operation:i?.operation??null}:{data:r,operation:i?.operation??null}}),qt(Vi))}catch(r){return this.loggingService.catch(`Error in mergeUsersWithData for ${e}:`,r),se(i)}}mergeLocationMetadataWithData$({data:e,feature:i}){try{return this.docService.getLocationMetadata$().pipe(ce(r=>{let a=this.mergeLocationMetadataWithData({data:e?.data??{},feature:i,locationMetadata:r});return typeof a=="object"?{data:JSON.parse(JSON.stringify(a)),operation:e?.operation??null}:{data:a,operation:e?.operation??null}}),qt(Vi))}catch(r){return this.loggingService.catch(`Error in mergeLocationMetadataWithData for ${i}:`,r),se(e)}}handleDataStripping({feature:e,data:i,actionType:r}){try{switch(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: handleDataStripping","color: green;"),e){case"comment":return this.commentUtilsService.stripCommentAnnotationData({data:i,actionType:r});case"reaction":return this.reactionUtilsService.stripReactionAnnotationData(i);default:return{originalData:i,strippedData:null}}}catch(a){return this.loggingService.catch("Error in CommonDbUtilsService handleDataStripping:",a),{originalData:i,strippedData:null}}}formatData({feature:e,data:i,properties:r,offset:a,isRealtimeDb:s}){try{this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: formatData","color: green;"),typeof i=="object"&&(i=JSON.parse(JSON.stringify(i)));let m=new Date().getTime()+a;switch(e){case"documentAccessType":return delete i?.users,{docIamConfig:i};case"organizationMetadata":case"documentMetadata":return s?i:{metadata:i};case"cursor":return this.cursorUtilsService.formatCursorUserData(i);case"comment":return this.commentUtilsService.formatCommentData(i);case"area":return this.areaUtilsService.formatAreaData(i);case"arrow":return this.arrowUtilsService.formatArrowData(i);case"liveStateCustom":return this.liveStateUtilsService.formatLiveStateCustomData(i);case"liveStateSingleEditorMode":return this.liveStateUtilsService.formatLiveStateSingleEditorModeData(i);case"multiThread":return this.multiThreadUtilsService.formatMultiThreadData(i);case"reaction":return this.reactionUtilsService.formatReactionData(i);case"recorder":return this.recorderUtilsService.formatRecorderData(i,m);case"notificationViewsTimestamp":return{views:{[r.user??""]:i}};case"documentUsersViews":return s?i:{users:{[r.user??""]:{[r.date??""]:i}}};case"documentDayViews":return s?i:{day:{[r.date??""]:{[r.user??""]:i}}};case"documentMetadataViews":return s?i:{metadata:i};case"huddleMessage":return this.huddleUtilsService.formatHuddleMessageData(i);case"locationMetadataViews":return s?i:{metadata:i};case"locationUsersViews":return s?i:{users:{[r.user??""]:{[r.date??""]:i}}};case"locationDayViews":return s?i:{day:{[r.date??""]:{[r.user??""]:i}}};case"locationViews":return s?i:{location:i};case"docNotificationViews":return s?i:{views:i.views};case"userNotificationViews":return s?i:{views:i.views};case"presence":return this.presenceUtilsService.formatPresenceUserData(i);case"selection":return this.selectionUtilsService.formatSelectionData(i);case"tag":return this.tagUtilsService.formatTagData(i);default:return i}}catch(m){return this.loggingService.catch("Error in CommonDbUtilsService formatData:",m),i}}modifyAndSetData(s){return Q(this,arguments,function*({feature:e,data:i,subscriber:r,operation:a=null}){try{let m=yield this.modifyData({feature:e,data:i});r.next({data:m,operation:a})}catch(m){this.loggingService.catch("Error in CommonDbUtilsService modifyAndSetData:",m)}})}isDataAlreadyProcessedInLocalCache({feature:e,change:i,cache:r}){try{if(e==="allReactions"||e==="allComments"){if(i.type==="removed")return!Object.keys(r??{}).includes(i.doc.id);if(r?.[i.doc.id]){let a=i.doc.data(),s=r?.[i.doc.id];return a?.lastUpdated===s?.lastUpdated}}return!1}catch(a){return this.loggingService.catch("Error in CommonDbUtilsService isDataAlreadyProcessedInLocalCache:",a),!1}}modifyData(r){return Q(this,arguments,function*({feature:e,data:i}){try{return yield this.formatResponse({feature:e,data:i})}catch(a){return this.loggingService.catch("Error in CommonDbUtilsService modifyData:",a),i}})}addMetadata(e,i){try{return e&&typeof e=="object"&&!Array.isArray(e)?T(I({},e),{metadata:e?.metadata??{documentId:i?.documentId,organizationId:i?.organizationId,apiKey:i?.apiKey}}):e}catch(r){return this.loggingService.catch("Error in CommonDbUtilsService addMetadata:",r),e}}setDataInLocal(p){return Q(this,arguments,function*({feature:e,data:i,observablesCache:r,eventType:a,id:s,operation:m=null}){try{let _={comment:"allComments",reaction:"allReactions"}[e];if(!_)return null;let E=i?.metadata?.documentId,D=i?.metadata?.veltFolderId;return Object.keys(r).filter(L=>L.includes(_)&&(!E||L.includes(E)||D&&L.includes(D))).forEach(L=>{let H=r[L]?.subject?.getValue()??{};a==="DELETE"?s&&H?.data?.[s]&&(delete H?.data?.[s],r[L]?.subject&&r[L].subject.next({data:H?.data,operation:m})):r[L]?.subject?.next({data:T(I({},H?.data),{[i?.annotationId]:i}),operation:m})}),null}catch(h){return this.loggingService.catch("Error in CommonDbUtilsService setDataInLocal:",h),null}})}handleCommentEncryption(s){return Q(this,arguments,function*({data:e,firestorePath:i,extraData:r,eventType:a}){try{return yield this.commentUtilsService.handleCommentEncryption({data:e,firestorePath:i,extraData:r,eventType:a})}catch(m){return this.loggingService.catch("Error in CommonDbUtilsService handleCommentEncryption:",m),e}})}handleReactionEncryption(a){return Q(this,arguments,function*({data:e,firestorePath:i,eventType:r}){try{return yield this.reactionUtilsService.handleReactionEncryption({data:e,firestorePath:i,eventType:r})}catch(s){return this.loggingService.catch("Error in CommonDbUtilsService handleReactionEncryption:",s),e}})}};o.\u0275fac=function(i){return new(i||o)(J(ble),J(Ile),J(Jv),J(Ele),J(xle),J(TM),J(Dle),J(y),J(wle),J(DM),J(Ale),J(Ple),J(e0),J(Mle),J(kle),J(Gn),J(lt),J(xs),J(Am))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Rle=(()=>{let o=class o{constructor(e,i,r){this.configService=e,this.authService=i,this.loggingService=r,this.firestore$=new Ce(null);try{Rn([this.authService.getFirebaseConfig$(),this.configService.getApiKey$()]).pipe(Fe(([a,s])=>!!a&&!!s),tt(1)).subscribe(([a,s])=>{a&&s&&a?.firebaseOptions?.storeDbId&&this.firestore$.next(XP(qp.getFirestoreProdDbName(s,a.firebaseOptions)))},a=>{})}catch{}}getFirestore(){return this.firestore$.asObservable()}getFirestoreValue(){return this.firestore$.value}generateFirestoreDocumentId(){try{let e=this.getFirestoreValue()||XP("DocumentIdDb");if(e){let i=nb(e,"generateDocumentId");return Wv(i).id}return}catch(e){this.loggingService.catch("Error in FirestoreService generateFirestoreDocumentId: ",e);return}}};o.\u0275fac=function(i){return new(i||o)(J(jt),J(He),J(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Tn=(()=>{let o=class o{constructor(e,i,r,a,s,m,p,h,_,E){this.authService=e,this.commonDbUtilsService=i,this.loggingService=r,this.firestoreService=a,this.databaseService=s,this.configService=m,this.docService=p,this.usersService=h,this.commentAnnotationsResolverService=_,this.reactionAnnotationsResolverService=E,this.offset=0,this.db=null,this.firestore=null,this.subscriptions=[],this.offsetListener=null,this.observablesCache={},this.firestoreSubscriptions={},this.loggingService.log("%c[WB] Creating CLASS: CommonDbService","color: blue;"),this.docService.setCommonDbService(this),this.authService.setCommonDbService(this),this.subscriptions.push(this.databaseService.getDb().subscribe(D=>{if(D){this.db=D;let L=rn(D,".info/serverTimeOffset");this.offsetListener=Eu(L,H=>{let K=H.val();this.offset=K})}})),this.subscriptions.push(this.firestoreService.getFirestore().subscribe(D=>{D&&(this.firestore=D)}))}unsubscribeFromObservables(){try{Object.values(this.firestoreSubscriptions??{}).forEach(e=>{e?.unsubscribe()}),Object.entries(this.observablesCache??{}).forEach(([e,i])=>{i?.subject?.complete(),i?.subject?.unsubscribe()}),this.observablesCache={},this.firestoreSubscriptions={}}catch(e){this.loggingService.catch("Error in unsubscribeFromObservables:",e)}}ngOnDestroy(){this.subscriptions.forEach(e=>e.unsubscribe()),this.offsetListener&&this.offsetListener(),this.unsubscribeFromObservables()}getOffset(){return this.offset}getServerTimestamp(){return new Date().getTime()+this.getOffset()}subscribeToServices(e){Rn([this.databaseService.getDb(),this.firestoreService.getFirestore()]).pipe(Fe(([i,r])=>!!i),tt(1),gn(([i,r])=>{e({db:i,firestore:r})})).subscribe({error:i=>{this.loggingService.catch("Error in CommonDbService subscription: ",i)}})}performDatabaseOperation(e,i,r,a,s,m){return Q(this,null,function*(){try{if(!i){this.loggingService.warn(`%c[WB] No properties found for ${e}`,"color: red;");return}return this.subscribeToServices(_=>Q(this,[_],function*({db:p,firestore:h}){let E;i?.skipFirestore||(E=this.commonDbUtilsService.getFirestorePath({feature:e,properties:i,documentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()}));let D=this.commonDbUtilsService.getDocumentPath({feature:e,properties:i,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey(),useFirestore:this.shouldUseFirestore()});if(!p){this.loggingService.warn(`%c[WB] No database or firestore found for ${e}`,"color: red;");return}try{let L,H;try{D&&(L=rn(p,`${D}`))}catch{this.loggingService.catch("Error in dbRef")}try{E?.includes("/organizations")&&h&&E&&(H=Wv(h,`${E}`))}catch{this.loggingService.catch("Error in docRef")}yield r({dbRef:L,firestoreRef:H,data:a,firestorePath:E}),m&&m({firestoreAvailable:!!h})}catch(L){this.loggingService.catch(`Error in ${e} operation: `,L),s&&s(L)}}))}catch(p){this.loggingService.catch("Error in performDatabaseOperation:",p)}})}setData(p){return Q(this,arguments,function*({feature:e,data:i,properties:r,callback:a,errorCallback:s,extraData:m}){try{return this.loggingService.log(`%c[WB] Calling FUNCTION: setData for ${e}`,"color: green;"),this.shouldUseFirestore()&&i?.metadata&&!i?.metadata?.apiKey?void 0:(this.commonDbUtilsService.setDataInLocal({feature:e,data:i,observablesCache:this.observablesCache,operation:null}),this.performDatabaseOperation(e,r,h=>Q(this,null,function*(){if(h.dbRef){let _=this.commonDbUtilsService.formatData({feature:e,data:h.data,properties:r,offset:this.getOffset(),isRealtimeDb:!0});yield Hf(h.dbRef,JSON.parse(JSON.stringify(_)))}try{if(h.firestoreRef&&h.data&&!r?.skipFirestore){let _=this.commonDbUtilsService.formatData({feature:e,data:h.data,properties:r,offset:this.getOffset()});typeof _=="object"&&(_=JSON.parse(JSON.stringify(_)));let{strippedData:E,originalData:D,eventType:L}=this.commonDbUtilsService.handleDataStripping({feature:e,data:_,actionType:m?.actionType});if(e==="comment"){let H=null;E&&(H=yield this.commentAnnotationsResolverService.saveCommentAnnotation({commentAnnotation:E,eventType:L,commentId:m?.targetAnnotationData?.commentId})),D&&(H?.isSuccess||H===null)&&(yield this.commonDbUtilsService.handleCommentEncryption({data:D,firestorePath:h.firestorePath??"",extraData:m}))}else if(e==="reaction"){let H=null;E&&(H=yield this.reactionAnnotationsResolverService.saveReactionAnnotation(E)),D&&(H?.isSuccess||H===null)&&(yield this.commonDbUtilsService.handleReactionEncryption({data:D,firestorePath:h.firestorePath??""}))}else e==="recorder"?this.firestore&&(yield ile(this.firestore,H=>Q(this,null,function*(){H.set(h.firestoreRef,_)}))):yield sH(h.firestoreRef,_)}}catch(_){this.loggingService.catch(`Error in setData for ${e}`,_)}}),i,s,a))}catch(h){this.loggingService.catch(`Error in setData for ${e}`,h)}})}updateData(p){return Q(this,arguments,function*({feature:e,data:i,properties:r,callback:a,errorCallback:s,extraData:m}){try{return this.loggingService.log(`%c[WB] Calling FUNCTION: updateData for ${e}`,"color: green;"),this.shouldUseFirestore()&&i?.metadata&&!i?.metadata?.apiKey?void 0:(this.commonDbUtilsService.setDataInLocal({feature:e,data:i,observablesCache:this.observablesCache,operation:null}),this.performDatabaseOperation(e,r,h=>Q(this,null,function*(){if(h.dbRef&&!r?.skipRtdb){let _=this.commonDbUtilsService.formatData({feature:e,data:h.data,properties:r,offset:this.getOffset(),isRealtimeDb:!0});yield V5(h.dbRef,JSON.parse(JSON.stringify(_)))}try{if(h.firestoreRef&&h.data&&!r?.skipFirestore){let _=this.commonDbUtilsService.formatData({feature:e,data:h.data,properties:r,offset:this.getOffset()});typeof _=="object"&&(_=JSON.parse(JSON.stringify(_)));let{strippedData:E,originalData:D,eventType:L}=this.commonDbUtilsService.handleDataStripping({feature:e,data:_,actionType:m?.actionType});if(e==="comment"){let H=null;E&&(H=yield this.commentAnnotationsResolverService.saveCommentAnnotation({commentAnnotation:E,eventType:L,commentId:m?.targetAnnotationData?.commentId})),D&&(H?.isSuccess||H===null)&&(yield this.commonDbUtilsService.handleCommentEncryption({data:D,firestorePath:h.firestorePath??"",extraData:m}))}else if(e==="reaction"){let H=null;E&&(H=yield this.reactionAnnotationsResolverService.saveReactionAnnotation(E)),D&&(H?.isSuccess||H===null)&&(yield this.commonDbUtilsService.handleReactionEncryption({data:D,firestorePath:h.firestorePath??""}))}else yield sH(h.firestoreRef,_,{merge:!0})}}catch(_){this.loggingService.catch(`Error in updateDoc for ${e}`,_)}}),i,s,a))}catch(h){this.loggingService.catch(`Error in updateData for ${e}`,h)}})}deleteData(s){return Q(this,arguments,function*({feature:e,properties:i,callback:r,errorCallback:a}){try{return this.loggingService.log(`%c[WB] Calling FUNCTION: deleteData for ${e}`,"color: green;"),this.commonDbUtilsService.setDataInLocal({feature:e,observablesCache:this.observablesCache,eventType:"DELETE",id:i?.id,operation:{type:"removed",ids:[i?.id]}}),this.performDatabaseOperation(e,i,m=>Q(this,null,function*(){m.dbRef&&(yield L5(m.dbRef));try{if(m.firestoreRef&&!i?.skipFirestore)if(e==="comment"){let p=null;p=yield this.commentAnnotationsResolverService.deleteCommentAnnotation(i?.id??""),(p?.isSuccess||p===null)&&(yield this.commonDbUtilsService.handleCommentEncryption({firestorePath:m.firestorePath??"",eventType:"DELETE"}))}else if(e==="reaction"){let p=null;p=yield this.reactionAnnotationsResolverService.deleteReactionAnnotation(i?.id??""),(p?.isSuccess||p===null)&&(yield this.commonDbUtilsService.handleReactionEncryption({firestorePath:m.firestorePath??"",eventType:"DELETE"}))}else yield Qse(m.firestoreRef)}catch(p){this.loggingService.catch(`Error in deleteData for ${e}`,p)}}),void 0,a,r)}catch(m){this.loggingService.catch(`Error in deleteData for ${e}`,m)}})}shouldUseFirestore(){try{return this.authService.getAdvancedQueriesEnabled()}catch(e){return this.loggingService.catch("Error in shouldUseFirestore:",e),!1}}generateDocumentId(){try{let e=this.firestoreService.generateFirestoreDocumentId();return e||(e=Pn()),e||"noDocumentId"}catch(e){return this.loggingService.catch("Error in generateFirestoreDocumentId:",e),Pn()||"noDocumentId"}}queryData(r){return Q(this,arguments,function*({feature:e,properties:i}){try{let a=this.shouldUseFirestore();return!e||!i?(this.loggingService.warn("[WB] Missing required parameters in queryData"),[]):a?yield this.handleFirestoreQuery(e,i):yield this.handleRtdbQuery(e,i)}catch(a){return this.loggingService.catch(`Error in queryData for ${e}`,a),[]}})}handleFirestoreQuery(e,i){return Q(this,null,function*(){try{if(!this.firestore)return this.loggingService.warn("[WB] Firestore not initialized"),[];let r=i?.useCollectionGroup?this.commonDbUtilsService.getFirestoreCollectionGroupPath(e):this.commonDbUtilsService.getFirestorePath({feature:e,properties:i,documentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()});if(!r)return this.loggingService.warn(`[WB] No firestore path found for ${e}`),[];try{let a=nb(this.firestore,r);i?.useCollectionGroup&&(a=oH(this.firestore,r));let s=i?.firestoreQuery??[],m=aH(a,...s);if(i?.getCount){let p=yield ele(m).catch(h=>(this.loggingService.catch(`Error in getCountFromServer for ${e}`,h),null));return p?p.data().count:0}else{let p=yield nle(m).catch(E=>(this.loggingService.catch(`Error in getDocs for ${e}`,E),null));if(!p)return[];let h=p.docs.map(E=>E.data());return yield this.commonDbUtilsService.modifyData({feature:e,data:h})}}catch(a){return this.loggingService.catch(`Error in Firestore query for ${e}:`,a),[]}}catch(r){return this.loggingService.catch(`Error in Firestore query for ${e}:`,r),[]}})}handleRtdbQuery(e,i){return Q(this,null,function*(){if(!this.db)return this.loggingService.warn("[WB] Realtime Database not initialized"),[];let r=this.commonDbUtilsService.getDocumentPath({feature:e,properties:i,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()});if(!r)return this.loggingService.warn(`[WB] No database path found for ${e}`),[];try{let a=rn(this.db,r),s=i?.rtdbQuery??[],m=OB(a,...s),p=yield TB(m).catch(_=>(this.loggingService.catch(`Error in get for ${e}`,_),null));if(!p)return[];let h=p.val();return h?i?.skipObjectValues?h:Object.values(h??{}):[]}catch(a){return this.loggingService.catch(`Error in RTDB query for ${e}:`,a),[]}})}getData(r){return Q(this,arguments,function*({feature:e,properties:i}){try{let a=this.shouldUseFirestore();if(i?.skipFirestore&&(a=!1),!e||!i)return this.loggingService.warn("[WB] Missing required parameters in getData"),{};if(a&&this.firestore){let s=this.commonDbUtilsService.getFirestorePath({feature:e,properties:i,documentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()});if(!s)return this.loggingService.warn(`[WB] No firestore path found for ${e}`),{};try{let m=yield tle(Wv(this.firestore,s)).catch(h=>(this.loggingService.catch(`Error in getDoc for ${e}`,h),null));if(!m)return this.loggingService.warn(`[WB] No document found at ${s}`),{};let p=m.data();return i?.field?p?.[i.field]??{}:p??{}}catch(m){return this.loggingService.catch(`Error fetching Firestore data for ${e}:`,m),{}}}if(this.db){let s=this.commonDbUtilsService.getDocumentPath({feature:e,properties:i,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()});if(!s)return this.loggingService.warn(`[WB] No database path found for ${e}`),{};try{let m=yield TB(rn(this.db,s)).catch(h=>(this.loggingService.catch(`Error in get for ${e}`,h),null));if(!m)return this.loggingService.warn(`[WB] No data found at ${s}`),{};let p=m.val();return i?.field?p?.[i.field]??{}:p??{}}catch(m){return this.loggingService.catch(`Error fetching RTDB data for ${e}:`,m),{}}}return this.loggingService.warn("[WB] No database connection available"),{}}catch(a){return this.loggingService.catch("Unexpected error in getData:",a),{}}})}dbListener({feature:e,properties:i}){let r=this.shouldUseFirestore();i?.skipFirestore&&(r=!1);let a=`${e}-${JSON.stringify(i)}`;return Rn([this.databaseService.getDb(),this.firestoreService.getFirestore()]).pipe(Fe(([s,m])=>s?r&&!m?(this.loggingService.warn(`[WB] Firestore requested but not available for ${e}`),!1):!0:(this.loggingService.warn(`[WB] No database found for ${e}`),!1)),he(([s,m])=>{try{if(r&&m){if(!!!this.observablesCache[a]){this.observablesCache[a]={subject:new Ce({}),count:0};let _=this.handleFirestoreListener(e,i,m).subscribe(E=>{this.observablesCache[a]?.subject?.next(E)},E=>this.observablesCache[a]?.subject?.error(E));this.firestoreSubscriptions[a]=_}return new Lt(h=>{let _=this.observablesCache[a]?.subject?.subscribe(E=>h.next(E),E=>h.error(E),()=>h.complete());return this.observablesCache[a].count+=1,()=>{_?.unsubscribe(),this.observablesCache[a]&&(this.observablesCache[a].count-=1,this.observablesCache[a].count<=0&&(this.firestoreSubscriptions[a]?.unsubscribe(),delete this.firestoreSubscriptions[a],this.observablesCache[a]?.subject?.complete(),delete this.observablesCache[a]))}})}else if(s)return this.handleRealtimeDbListener(e,i,s);return se({})}catch(p){return this.loggingService.catch(`Error setting up listener for ${e}:`,p),se({})}}),Ng(()=>{this.loggingService.log(`[WB] Cleaning up listener for ${e} and key ${a}`)}))}handleFirestoreListener(e,i,r){let a=i?.useCollectionGroup?this.commonDbUtilsService.getFirestoreCollectionGroupPath(e):this.commonDbUtilsService.getFirestorePath({feature:e,properties:i,documentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()}),s=`${e}-${JSON.stringify(i)}`;return a?new Lt(m=>{let p=i.isCollection?this.setupCollectionListener(r,a,e,m,i):this.setupDocumentListener(r,a,e,m,i);return()=>{m.complete(),m.unsubscribe(),p(),this.observablesCache[s]?.subject?.complete(),this.observablesCache[s]?.subject?.unsubscribe(),delete this.observablesCache[s]}}).pipe(he(m=>this.commonDbUtilsService.mergeUsersWithData$({feature:e,data:m})),he(m=>["allComments","allUserNotifications"].includes(e)?this.commonDbUtilsService.mergeCommentAnnotationsWithData$({data:m,feature:e}):se(m)),he(m=>["allReactions"].includes(e)?this.commonDbUtilsService.mergeReactionAnnotationsWithData$({data:m,feature:e}):se(m)),qt(Vi)):(this.loggingService.warn(`[WB] No firestore path found for ${e} and key ${s}`),se({}))}setupCollectionListener(e,i,r,a,s){let m=`${r}-${JSON.stringify(s)}`,p=nb(e,i);if(s?.useCollectionGroup&&(p=oH(e,i)),s?.useQuery&&s?.firestoreQuery){let E=s?.firestoreQuery??[];p=aH(p,...E)}let h=!0,_=[];return rH(p,E=>{try{let D=JSON.parse(JSON.stringify(this.observablesCache[m]?.subject?.getValue()?.data??{})),L=null,H=!1;E?.docChanges()?.length?E.docChanges().forEach(K=>{["allComments","allReactions"].includes(r)&&!h&&K.type!=="removed"&&_.push(K.doc.id),this.commonDbUtilsService.isDataAlreadyProcessedInLocalCache({feature:r,change:K,cache:this.observablesCache[m]?.subject?.getValue()?.data??{}})||(H=!0,Object.assign(D,this.handleCollectionChange(K,D)),K.type==="removed"&&(L||(L={type:K.type,ids:[]}),L.ids.push(K.doc.id)))}):H=!0,H&&(["allComments","allReactions"].includes(r)&&_?.length&&(this.commonDbUtilsService.resolveAnnotations({data:_,feature:r}),_=[]),this.commonDbUtilsService.modifyAndSetData({feature:r,data:D,subscriber:a,operation:L})),h=!1}catch(D){this.handleListenerError(D,r,a)}},E=>this.handleListenerError(E,r,a))}handleCollectionChange(e,i){switch(e.type){case"added":case"modified":i[e.doc.id]=e.doc.data();break;case"removed":delete i?.[e.doc.id];break}return i}setupDocumentListener(e,i,r,a,s){let m=Wv(e,i);return rH(m,p=>{try{let h=p.data()||{};s?.field&&(h=h?.[s?.field]??{}),this.commonDbUtilsService.modifyAndSetData({feature:r,data:h,subscriber:a,operation:null})}catch(h){this.handleListenerError(h,r,a)}},p=>this.handleListenerError(p,r,a))}handleListenerError(e,i,r){this.loggingService.catch(`Firestore listener error for ${i}:`,e),r.error(e)}handleRealtimeDbListener(e,i,r){let a=this.commonDbUtilsService.getDocumentPath({feature:e,properties:i,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()});if(!a)return this.loggingService.warn(`[WB] No database path found for ${e}`),se({});let s=rn(r,a);if(i?.useQuery&&i?.rtdbQuery){let m=i?.rtdbQuery??[];s=OB(s,...m)}return $f(s).pipe(jn(m=>(this.loggingService.catch(`RTDB listener error for ${e}:`,m),se({}))),ce(m=>(m===null&&(m={}),m&&typeof m=="object"?Object.entries(m??{}).reduce((h,[_,E])=>(h[_]=this.commonDbUtilsService.addMetadata(E,i),h),{}):this.commonDbUtilsService.addMetadata(m,i))),he(m=>this.commonDbUtilsService.modifyData({feature:e,data:m})),he(m=>this.usersService.getUserById$().pipe(ce(()=>({data:this.commonDbUtilsService.mergeUsersWithData({feature:e,data:m}),operation:null})))))}};o.\u0275fac=function(i){return new(i||o)(J(He),J(t0),J(y),J(Rle),J(hn),J(jt),J(lt),J(Gn),J(xs),J(Am))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Ci=(()=>{let o=class o{constructor(e,i,r,a,s,m,p,h){this.analyticsService=e,this.authService=i,this.configService=r,this.databaseService=a,this.docService=s,this.loggingService=m,this.commonDbService=p,this.usersService=h,this.db=Ii(),this.internalUserContacts$=new Ce([]),this.userGlobalContact$=new Ce(!1),this.userGroupContact$=new Ce(null),this.users$=new Ce([]),this.userPersonalContacts=[],this.userGroupContacts=[],this.userGlobalContacts=[],this.users=[],this.documentPaths=null,this.userOrganizationContacts$=new Ce([]),this.userFolderContacts$=new Ce([]),this.userDocumentContacts$=new Ce([]),this.userOrganizationGroups$=new Ce([]),this.onContactSelectedSubject$=new Ke,this.documentAccessType=null,this.atHereEnabled$=new Ce(!1),this.atHereLabel$=new Ce("here"),this.atHereDescription$=new Ce(null),this.contactListScopeForOrganizationUsers$=new Ce([ki.ALL]),this.customUserContacts$=new Ce(null),this.customUserContactsConfig$=new Ce({merge:!1}),this.currentOrganizationUserIAM$=new Ce(null),this.userContacts$=new Ce([]),this.userSnippylyIdContacts$=new Ce(null),this.usersByOrganizationId$=new Ce({}),this.usersByOrganizationIdAndDocumentId$=new Ce({}),this.usersByOrganizationIdAndFolderId$=new Ce({}),this.userById$=new Ce({}),this.authService.setContactService(this),this.authService.getUser$().pipe(he(_=>this.docService.getDocumentPaths$().pipe(gn(E=>{this.documentPaths=E}),ce(()=>_)))).subscribe(_=>Q(this,null,function*(){this.user=_,_&&this.documentPaths?_?.organizationId?(this.getOrganizationContactsFromDb$(),this.getFolderContactsFromDb$(),this.getDocumentContactsFromDb$(),this.getOrganizationGroupsFromDb$()):(this.getLoggedInUsers$().subscribe(),this.getUserContactsFromDb$(),yield this.migrateLoggedInUserFromEmailToUserIdPath(_),this.setLoggedInUser(_),yield this.moveGlobalContactUserFromEmailToUserIdPath(_),this.updateUserInGlobalContactsIfAvailable(_),_?.groupId&&(yield this.migrateGroupContactsFromEmailToUserIdPath(_?.groupId)),this.checkToSetLoggedInUserInGroupContacts()):(this.getUserContactSubscription?.unsubscribe(),this.getUserContactSubscription=void 0,this.getLoggedInUsersSubscription?.unsubscribe(),this.getLoggedInUsersSubscription=void 0,this.getOrganizationContactsSubscription?.unsubscribe(),this.getOrganizationContactsSubscription=void 0,this.getFolderContactsSubscription?.unsubscribe(),this.getFolderContactsSubscription=void 0,this.getDocumentContactsSubscription?.unsubscribe(),this.getDocumentContactsSubscription=void 0,this.getOrganizationGroupsSubscription?.unsubscribe(),this.getOrganizationGroupsSubscription=void 0)}),_=>{this.loggingService.catch("Error in ContactService constructor getUser$: ",_)}),this.databaseService.getDb().pipe(Fe(_=>!!_),tt(1)).subscribe(_=>{_&&(this.db=_)},_=>{this.loggingService.catch("Error in ContactService constructor getDb: ",_)}),this.getOrganizationGroups$().subscribe(_=>{this.authService.setOrganizationUserGroups(_)}),Rn([this.getInternalUserContacts$(),this.getCustomUserContacts$(),this.getCustomUserContactsConfig$()]).subscribe(([_,E,D])=>{E?D?.merge?this.userContacts$.next([..._||[],...E||[]]):this.userContacts$.next(E||[]):this.userContacts$.next(_||[])}),this.getUserContacts$().subscribe(_=>{try{_?.forEach(E=>{let D=E?.userSnippylyId||ym(this.configService.getApiKey(),E.userId);D&&this.userSnippylyIdContacts$.next(T(I({},this.userSnippylyIdContacts$.value),{[D]:E}))})}catch{}})}clearCache(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCache in ContactService","color: green;");try{this.documentPaths=null,this.usersByOrganizationId$.next({}),this.usersByOrganizationIdAndFolderId$.next({}),this.usersByOrganizationIdAndDocumentId$.next({}),this.userById$.next({}),this.userOrganizationContacts$.next([]),this.userFolderContacts$.next([]),this.userDocumentContacts$.next([]),this.userOrganizationGroups$.next([]),this.userContacts$.next([]),this.userSnippylyIdContacts$.next(null),this.userGlobalContact$.next(!1),this.userGroupContact$.next(null),this.users$.next([]),this.userPersonalContacts=[],this.userGroupContacts=[],this.userGlobalContacts=[],this.users=[]}catch(e){this.loggingService.catch("Error in ContactService clearCache: ",e)}}setDocumentAccessType(e){try{this.documentAccessType=e}catch(i){this.loggingService.catch("Error in ContactService setDocumentAccessType: ",i)}}checkIfUserGlobalContact(e){return Q(this,null,function*(){try{if(e?.userId&&this.documentPaths?.globalContacts){let i=yield this.commonDbService?.getData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Pt(e?.userId),skipFirestore:!0}});if(Object.keys(i??{}).length>0)return!0}if(e?.email&&this.documentPaths?.globalContacts){let i=yield this.commonDbService?.getData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Pt(e?.email),skipFirestore:!0}});if(Object.keys(i??{}).length>0)return!0}return!1}catch(i){return this.loggingService.catch("Error in ContactService isUserGlobalContact: ",i),!1}})}setLoggedInUser(e){try{e?.userId&&this.documentPaths?.logins&&(this.commonDbService.updateData({feature:"logins",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Pt(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(T(I({},e),{contacts:void 0})))}),this.setLoggedInUserPrivateContacts(e,e?.contacts))}catch(i){this.loggingService.catch("Error in ContactService setLoggedInUser: ",i)}}migrateLoggedInUserFromEmailToUserIdPath(e){return Q(this,null,function*(){try{if(e?.email&&this.documentPaths?.logins){let i=yield this.commonDbService?.getData({feature:"logins",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Pt(e?.email),skipFirestore:!0}});if(Object.keys(i??{}).length>0){let r=i;if(r){if(r?.contacts){let a={};Object.keys(r?.contacts??{})?.forEach(s=>{let m=r.contacts[s];if(m?.userId){let p=Pt(m?.userId);a[p]=m}}),r.contacts=a}yield this.commonDbService.updateData({feature:"logins",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Pt(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(r))}),yield this.commonDbService.deleteData({feature:"logins",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Pt(e?.email),skipFirestore:!0}})}}}}catch(i){this.loggingService.catch("Error in ContactService migrateLoggedInUserFromEmailToUserIdPath: ",i)}})}addGlobalContact(e){try{e?.userId&&this.documentPaths?.globalContacts&&this.commonDbService.updateData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Pt(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(e))})}catch(i){this.loggingService.catch("Error in ContactService addGlobalContact: ",i)}}updateUserInGlobalContactsIfAvailable(e){return Q(this,null,function*(){try{if(e?.userId&&this.documentPaths?.globalContacts&&(yield this.checkIfUserGlobalContact(e))){let r=new wo;r.userId=e?.userId,r.userSnippylyId=e?.userSnippylyId,r.email=e?.email,r.name=e?.name,r.photoUrl=e?.photoUrl,this.commonDbService.updateData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Pt(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(r))})}}catch(i){this.loggingService.catch("Error in ContactService updateUserInGlobalContactsIfAvailable: ",i)}})}moveGlobalContactUserFromEmailToUserIdPath(e){return Q(this,null,function*(){try{if(e?.email&&e?.userId&&this.documentPaths?.globalContacts){let i=yield this.commonDbService?.getData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Pt(e?.email),skipFirestore:!0}});if(Object.keys(i??{}).length>0){let r=i;r&&(yield this.commonDbService.updateData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Pt(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(r))}),yield this.commonDbService.deleteData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Pt(e?.email),skipFirestore:!0}}))}}}catch(i){this.loggingService.catch("Error in ContactService removeUserFromGlobalContactsByEmail: ",i)}})}setLoggedInUserPrivateContacts(e,i){try{if(e?.userId&&this.documentPaths?.logins){let r,a=i?.filter(m=>m?.visibility!=="group"),s=!1;this.authService.getUserOptions()&&(s=!!this.authService.getUserOptions()?.replaceContacts||!!this.authService.getUserOptions()?.replacePrivateContacts),a?.length?(r={},a?.forEach(m=>{if(m?.userId){let p=Pt(m?.userId);r[p]=m}}),s?this.commonDbService.setData({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Pt(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(r))}):this.commonDbService.updateData({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Pt(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(r))})):s&&this.commonDbService.deleteData({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Pt(e?.userId),skipFirestore:!0}})}}catch(r){this.loggingService.catch("Error in ContactService setLoggedInUserPrivateContacts: ",r)}}migrateGroupContactsFromEmailToUserIdPath(e){return Q(this,null,function*(){try{if(this.documentPaths?.groupContacts&&e){let i=yield this.commonDbService?.getData({feature:"groupContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,skipFirestore:!0}});i&&Object.keys(i??{}).forEach(r=>Q(this,null,function*(){let a=i[r];a?.email&&a?.userId&&Pt(a?.email)===r&&(yield this.commonDbService.deleteData({feature:"groupContactsUser",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,userId:r,skipFirestore:!0}}),yield this.commonDbService.updateData({feature:"groupContactsUser",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,userId:Pt(a?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(a))}))}))}}catch(i){this.loggingService.catch("Error in ContactService migrateGroupContacts: ",i)}})}checkToSetLoggedInUserInGroupContacts(){return Q(this,null,function*(){try{this.user?.groupId&&this.user?.userId&&((yield this.checkIfUserGlobalContact(this.user))||this.docService.getDocumentIam$().pipe(tt(1)).subscribe(i=>Q(this,null,function*(){if(this.user?.groupId&&this.user?.userId){let r=!1,a=this.docService.getDocumentAccessType(i);if(!a||a===pi.PUBLIC)r=!0;else if(a===pi.RESTRICTED){let s=Pt(this.user?.userId);if(i?.users?.[s]&&(r=!0),this.user?.email){let m=Pt(this.user?.email);i?.users?.[m]&&(r=!0)}}if(r){let s=new Wp;s.email=this.user.email,s.visibility="group",s.name=this.user.name,s.photoUrl=this.user.photoUrl,s.userId=this.user.userId,(this.authService.getUserOptions()?.replaceContacts||this.authService.getUserOptions()?.replaceGroupContacts)&&(yield this.removeGroupContacts(this.user?.groupId)),this.setLoggedInUserGroupContacts(this.user?.groupId,[s]),this.user?.contacts&&this.user?.groupId&&this.setLoggedInUserGroupContacts(this.user?.groupId,this.user?.contacts)}}})))}catch(e){this.loggingService.catch("Error in ContactService checkToSetLoggedInUserInGroupContacts: ",e)}})}setLoggedInUserGroupContacts(e,i){try{let r=i?.filter(a=>a?.visibility==="group");r?.length&&r.forEach(a=>Q(this,null,function*(){if(a?.userId&&e&&this.documentPaths?.groupContacts){if(this.configService?.getSF()&&(yield this.checkIfUserGlobalContact(a)))return;yield this.commonDbService.updateData({feature:"groupContactsUser",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,userId:Pt(a?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(a))}),a?.email&&(yield this.commonDbService.deleteData({feature:"groupContactsUser",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,userId:Pt(a?.email),skipFirestore:!0}}))}}))}catch(r){this.loggingService.catch("Error in ContactService setLoggedInUserGroupContacts: ",r)}}removeGroupContacts(e){return Q(this,null,function*(){try{if(this.documentPaths?.groupContacts&&e)return this.commonDbService.deleteData({feature:"groupContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,skipFirestore:!0}})}catch(i){this.loggingService.catch("Error in ContactService removeGroupContacts: ",i)}})}mergeUserContacts(){try{let e=[];this.userPersonalContacts&&e.push(...this.userPersonalContacts),this.userGroupContacts&&e.push(...this.userGroupContacts),this.userGlobalContacts&&e.push(...this.userGlobalContacts);let i={};e.forEach(r=>{r?.userId?(!r?.email||!i[r.email])&&(i[r.userId]=r):r?.email&&(!r?.userId||!i[r.userId])&&(i[r.email]=r)}),e=Object.values(i??{}),this.internalUserContacts$.next(e)}catch(e){this.loggingService.catch("Error in ContactService mergeUserContacts: ",e)}}getInternalUserContacts(){return this.internalUserContacts$.value}getInternalUserContacts$(){return this.internalUserContacts$.asObservable()}getUserContacts$(e){try{let{organizationId:i,documentId:r,veltFolderId:a}=e||{};return i&&r?Rn([this.usersByOrganizationId$,this.usersByOrganizationIdAndFolderId$,this.usersByOrganizationIdAndDocumentId$,this.userById$,this.customUserContacts$,this.customUserContactsConfig$,this.getContactListScopeForOrganizationUsers$()]).pipe(ce(([s,m,p,h,_,E,D])=>{let L={},H=!1;E&&!E?.merge&&(H=!0);let K=qe=>D.some(Re=>qe.includes(Re)),oe=K([ki.ALL,ki.ORGANIZATION])?Object.keys(s?.[i]||{}):[],ue=a?K([ki.ALL,ki.FOLDER])?Object.keys(m?.[i]?.[a]||{}):[]:[],be=K([ki.ALL,ki.DOCUMENT])?Object.keys(p?.[i]?.[r]||{}):[];if([...oe,...ue||[],...be].forEach(qe=>{let Re=h?.[qe];Re&&(L[qe]=Re)}),_){let{merge:qe,options:Re}=E||{},{organizationId:_e,documentId:Ee,folderId:Oe}=Re||{},ye=Oe?Tl(Oe):void 0;(!_e||_e===i)&&(!Ee||Ee===r)&&(!ye||ye===a)&&(qe||(L={}),_.forEach(fe=>{fe?.userId&&(L[fe.userId]=fe)}))}return Object.values(L??{})})):this.userContacts$.asObservable().pipe(ce(s=>s))}catch(i){return this.loggingService.catch("Error in ContactService getUserContacts$ metadata: ",i),se([])}}getUserContactsBySnippylyId$(){return this.userSnippylyIdContacts$.asObservable()}getAtHereLabel(){return this.atHereLabel$.asObservable()}getAtHereDescription(){return this.atHereDescription$.asObservable()}getUserContactsFromDb$(){this.getUserContactSubscription||(this.getUserContactSubscription=this.authService.getUser$().pipe(Fe(e=>!!e),he(e=>this.docService.getDocumentPaths$().pipe(Fe(i=>!!i),gn(i=>{this.documentPaths=i}),ce(()=>e))),he(e=>{if(this.userGroupContacts=[],this.userPersonalContacts=[],!e)return se();if(!this.documentPaths)return se();let i=[];return i.push(this.commonDbService.dbListener({feature:"allGlobalContacts",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(ce(r=>r?.data),gn(r=>{r?(this.userGlobalContacts=Object.values(r??{}),this.userGlobalContacts?.find(a=>a.userId===this.user?.userId)?this.userGlobalContact$.next(!0):this.userGlobalContact$.next(!1)):(this.userGlobalContacts=[],this.userGlobalContact$.next(!1))}))),i.push(this.commonDbService.dbListener({feature:"groupContacts",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0,groupId:e?.groupId}}).pipe(ce(r=>r?.data),gn(r=>{r?(this.userGroupContacts=Object.values(r??{}),this.userGroupContacts?.find(a=>a?.userId===this.user?.userId)?this.userGroupContact$.next(!0):this.userGroupContact$.next(!1)):(this.userGroupContacts=[],this.userGroupContact$.next(!1))}))),i.push(this.commonDbService.dbListener({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0,userId:Pt(e?.userId)}}).pipe(ce(r=>r?.data),gn(r=>{r?this.userPersonalContacts=Object.values(r??{}):this.userPersonalContacts=[]}))),ro(...i).pipe(ao(this.authService.getUser$().pipe(Fe(r=>!r))))})).subscribe(()=>{this.mergeUserContacts()},e=>{this.loggingService.catch("Error in ContactService getUserContacts$ subscription: ",e)}))}addUserContact(e){try{this.user?.organizationId||this.user?.groupId&&(e.visibility="group",this.setLoggedInUserGroupContacts(this.user?.groupId,[e]))}catch(i){this.loggingService.catch("Error in ContactService addUserContact: ",i)}}isUserGlobalContact$(){return this.userGlobalContact$.asObservable()}isUserGlobalContact(){return this.userGlobalContact$.value}isUserGroupContact$(){return this.userGroupContact$.asObservable()}isUserGroupContact(){return this.userGroupContact$.value}getLoggedInUsers$(){return this.getLoggedInUsersSubscription||(this.getLoggedInUsersSubscription=this.authService.getUser$().pipe(he(e=>e?this.documentPaths?e?.userId&&this.documentPaths?.logins?this.commonDbService.dbListener({feature:"allLogins",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(ce(i=>i?.data),gn(i=>{i?this.users=Object.values(i??{}):this.users=[]})):(this.users=[],se()):se():se())).subscribe(()=>{this.users$.next(this.users)},e=>{this.loggingService.catch("Error in ContactService getLoggedInUsers$ subscription: ",e)})),this.users$.asObservable()}getUsersMap$(){return this.authService.getUser$().pipe(he(e=>e?.organizationId?this.userById$.pipe(ce(i=>{let r={};return Object.values(i||{}).forEach(a=>{a?.userSnippylyId&&(r[a?.userSnippylyId]=a)}),r})):this.users$.pipe(ce(i=>{let r={};return i.forEach(a=>{r[a.userSnippylyId]=a}),r}))))}getUserByEmail$(e){return this.users$.pipe(ce(i=>i.find(r=>r.email===e)))}getUserByEmail(e){return this.users?.find(i=>i.email===e)}getContactByEmail(e){return this.getInternalUserContacts().find(i=>i.email===e)}getUserByUserId$(e){return this.users$.pipe(ce(i=>i.find(r=>r.userId===e)))}getUserGroupContacts(){return this.userGroupContacts}getOrganizationContactsFromDb$(){try{this.getOrganizationContactsSubscription||(this.getOrganizationContactsSubscription=this.authService.getUser$().pipe(he(e=>e?.organizationId?se(e).pipe(he(i=>this.docService.getOrganizationConfig$().pipe(Fe(r=>!!r),ce(()=>i))),he(i=>{let r=this.docService.getOrganizationConfig()?.organizationId;return this.setUserOrganizationContacts([],r),i?r?this.commonDbService.dbListener({feature:"allOrganizationUsers",properties:{organizationId:r,isCollection:!0}}).pipe(ce(a=>a?.data),ce(a=>{if(a){typeof a=="object"&&(a?.undefined&&delete a.undefined,a?.null&&delete a.null);let s=Object.values(a??{});this.setUserOrganizationContacts(s,r)}else this.setUserOrganizationContacts([],r)})):se():se()}),he(()=>this.getContactListScopeForOrganizationUsers$())):(this.setUserOrganizationContacts([]),se()))).subscribe(()=>{this.mergeOrganizationAndDocumentContacts()},e=>{this.loggingService.catch("Error in ContactService getOrganizationContactsFromDb$ subscription: ",e)}))}catch{}}getFolderContactsFromDb$(){try{this.getFolderContactsSubscription||(this.getFolderContactsSubscription=this.authService.getUser$().pipe(he(e=>e?se(e).pipe(he(i=>this.docService.getOrganizationConfig$().pipe(Fe(r=>!!r),ce(()=>i))),he(i=>{let r=this.docService.getOrganizationConfig()?.organizationId;if(this.setUserFolderContacts([]),!i)return se();if(!this.commonDbService.shouldUseFirestore())return se();if(!this.documentPaths?.veltFolderId)return se();let a=se([]);return a=this.commonDbService.dbListener({feature:"allFolderUsers",properties:{organizationId:r,folderId:this.documentPaths?.veltFolderId,isCollection:!0}}).pipe(ce(s=>s?.data)),a.pipe(ce(s=>{if(s){typeof s=="object"&&(s?.undefined&&delete s.undefined,s?.null&&delete s.null);let m=Object.values(s??{});this.setUserFolderContacts(m)}else this.setUserFolderContacts([])}))}),he(()=>this.getContactListScopeForOrganizationUsers$())):(this.setUserFolderContacts([]),se()))).subscribe(()=>{this.mergeOrganizationAndDocumentContacts()},e=>{this.loggingService.catch("Error in ContactService getFolderContactsFromDb$ subscription: ",e)}))}catch{}}getDocumentContactsFromDb$(){try{this.getDocumentContactsSubscription||(this.getDocumentContactsSubscription=this.authService.getUser$().pipe(he(e=>e?se(e).pipe(he(i=>this.docService.getDocumentPaths$().pipe(Fe(r=>!!r),gn(r=>{this.documentPaths=r}),ce(()=>i))),he(i=>(this.setUserDocumentContacts([]),i?this.documentPaths?this.docService.getDocumentIds$().pipe(he(r=>{let a=r?.length>0?r.map(p=>p.documentId):[this.documentPaths?.documentId??""];if(a.some(p=>!p)||!this.documentPaths)return se();let s=se([]),m={useCollectionGroup:!0,isCollection:!0,useQuery:!0};if(this.commonDbService.shouldUseFirestore()||(m.documentId=a?.length?a[0]:void 0,m.organizationId=this.documentPaths?.organizationId),this.documentPaths?.veltFolderId&&this.documentPaths?.allDocuments)s=this.commonDbService.dbListener({feature:"allDocumentUsers",properties:T(I({},m),{firestoreQuery:[Ui(gt("metadata.apiKey","==",this.configService?.getApiKey()),gt("metadata.veltFolderId","==",this.documentPaths?.veltFolderId),gt("metadata.organizationId","==",this.documentPaths?.organizationId))]})}).pipe(ce(p=>p?.data));else{let p=[];for(let h=0;h<a.length;h+=j.LISTENER_BATCH_SIZE)p.push(a.slice(h,h+j.LISTENER_BATCH_SIZE));s=Rn(p.map(h=>this.commonDbService.dbListener({feature:"allDocumentUsers",properties:T(I({},m),{firestoreQuery:[Ui(gt("metadata.apiKey","==",this.configService?.getApiKey()),gt("metadata.documentId","in",h),gt("metadata.organizationId","==",this.documentPaths?.organizationId),...this.documentPaths?.veltFolderId?[gt("metadata.veltFolderId","==",this.documentPaths?.veltFolderId)]:[])]})}).pipe(Gr()))).pipe(ce(h=>ua(h)?.data))}return s.pipe(ce(p=>{if(p){typeof p=="object"&&(p?.undefined&&delete p.undefined,p?.null&&delete p.null);let h=Object.values(p??{});this.setUserDocumentContacts(h)}else this.setUserDocumentContacts([])}))})):se():se())),he(()=>this.getContactListScopeForOrganizationUsers$())):(this.setUserDocumentContacts([]),se()))).subscribe(()=>{this.mergeOrganizationAndDocumentContacts()},e=>{this.loggingService.catch("Error in ContactService getDocumentContactsFromDb$ subscription: ",e)}))}catch{}}setUserOrganizationContacts(e,i){try{let r=e.find(s=>s.user.userId===this.user?.userId);r?this.currentOrganizationUserIAM$.next(r):this.currentOrganizationUserIAM$.next(null);let a=e.map(s=>s.user);if(this.userOrganizationContacts$.next(a),i){let s={};s[i]={},e.forEach(m=>{s[i][m.user.userId]=m,this.userById$.next(T(I({},this.userById$.value),{[m.user.userId]:m.user}))}),this.usersByOrganizationId$.next(T(I({},this.usersByOrganizationId$.value),{[i]:s[i]}))}else this.usersByOrganizationId$.next({})}catch(r){this.loggingService.catch("Error in ContactService setUserOrganizationContacts: ",r)}}getUserOrganizationContacts$(){return this.getContactListScopeForOrganizationUsers$().pipe(he(()=>this.checkContactListScopeForOrganizationUsers([ki.ALL,ki.ORGANIZATION])?this.userOrganizationContacts$.asObservable():se([])))}getUserOrganizationContacts(){return this.checkContactListScopeForOrganizationUsers([ki.ALL,ki.ORGANIZATION])?this.userOrganizationContacts$.value:[]}setUserFolderContacts(e){try{this.userFolderContacts$.next(e?.map(r=>r?.user));let i={};e?.forEach(r=>{let{organizationId:a,veltFolderId:s}=r?.metadata||{};a&&s&&(i[a]||(i[a]={}),i[a][s]||(i[a][s]={}),i[a][s][r.user.userId]=r,this.userById$.next(T(I({},this.userById$.value),{[r.user.userId]:r.user})))}),this.usersByOrganizationIdAndFolderId$.next(i)}catch(i){this.loggingService.catch("Error in ContactService updateUserFolderContacts: ",i)}}getUserFolderContacts$(){return this.getContactListScopeForOrganizationUsers$().pipe(he(()=>this.checkContactListScopeForOrganizationUsers([ki.ALL,ki.FOLDER])?this.userFolderContacts$.asObservable():se([])))}getUserFolderContacts(){return this.checkContactListScopeForOrganizationUsers([ki.ALL,ki.FOLDER])?this.userFolderContacts$.value:[]}setUserDocumentContacts(e){try{this.userDocumentContacts$.next(e?.map(r=>r?.user));let i={};e?.forEach(r=>{let{organizationId:a,documentId:s}=r?.metadata||{};a&&s&&(i[a]||(i[a]={}),i[a][s]||(i[a][s]={}),i[a][s][r.user.userId]=r,this.userById$.next(T(I({},this.userById$.value),{[r.user.userId]:r.user})))}),this.usersByOrganizationIdAndDocumentId$.next(i)}catch(i){this.loggingService.catch("Error in ContactService updateUserDocumentContacts: ",i)}}getUserDocumentContacts$(){return this.getContactListScopeForOrganizationUsers$().pipe(he(()=>this.checkContactListScopeForOrganizationUsers([ki.ALL,ki.DOCUMENT])?this.userDocumentContacts$.asObservable():se([])))}getUserDocumentContacts(){return this.checkContactListScopeForOrganizationUsers([ki.ALL,ki.DOCUMENT])?this.userDocumentContacts$.value:[]}getCurrentOrganizationUserIAM$(){return this.currentOrganizationUserIAM$.asObservable()}getCurrentOrganizationUserIAM(){return this.currentOrganizationUserIAM$.value}mergeOrganizationAndDocumentContacts(){try{let e=[];this.getContactListScopeForOrganizationUsers().includes(ki.ALL)?e=[...this.getUserOrganizationContacts(),...this.getUserFolderContacts(),...this.getUserDocumentContacts()]:this.getContactListScopeForOrganizationUsers().includes(ki.ORGANIZATION)?e=[...this.getUserOrganizationContacts()]:this.getContactListScopeForOrganizationUsers().includes(ki.FOLDER)?e=[...this.getUserFolderContacts()]:this.getContactListScopeForOrganizationUsers().includes(ki.DOCUMENT)&&(e=[...this.getUserDocumentContacts()]);let i=[...new Map(e.filter(r=>r?.userId).map(r=>[r.userId,r])).values()];this.internalUserContacts$.next(i)}catch(e){this.loggingService.catch("Error in ContactService mergeOrganizationAndDocumentContacts: ",e)}}getOrganizationGroupsFromDb$(){try{this.getOrganizationGroupsSubscription||(this.getOrganizationGroupsSubscription=this.authService.getUser$().pipe(he(e=>e?.organizationId?se(e).pipe(he(i=>this.docService.getOrganizationConfig$().pipe(Fe(r=>!!r),ce(()=>i))),he(i=>{if(this.setUserOrganizationGroups([]),!i)return se();let r=this.docService.getOrganizationConfig()?.organizationId;return r?this.commonDbService.dbListener({feature:"allOrganizationGroups",properties:{organizationId:r,isCollection:!0}}).pipe(ce(a=>a?.data),ce(a=>{a?(typeof a=="object"&&(a?.undefined&&delete a.undefined,a?.null&&delete a.null),this.setUserOrganizationGroups(Object.values(a??{}))):this.setUserOrganizationGroups([])})):se()})):(this.setUserOrganizationGroups([]),se()))).subscribe(()=>{},e=>{this.loggingService.catch("Error in ContactService getOrganizationGroupsFromDb$ subscription: ",e)}))}catch{}}setUserOrganizationGroups(e){try{this.userOrganizationGroups$.next(e)}catch(i){this.loggingService.catch("Error in ContactService setUserOrganizationGroups: ",i)}}onContactSelected(e){try{if(e?.userId){let i=!!this.getUserDocumentContacts().find(a=>a.userId===e.userId),r=!!this.getUserOrganizationContacts().find(a=>a.userId===e.userId);switch(this.documentAccessType){case pi.RESTRICTED:if(!i){let a={contact:e,isOrganizationContact:r,isDocumentContact:i,documentAccessType:this.documentAccessType};this.onContactSelectedSubject$.next(a)}break}}else{let i={contact:e,isOrganizationContact:!1,isDocumentContact:!1,documentAccessType:this.documentAccessType};this.onContactSelectedSubject$.next(i)}}catch(i){this.loggingService.catch("Error in ContactService onContactSelected: ",i)}}onContactSelected$(){return this.onContactSelectedSubject$.asObservable()}getOrganizationGroups$(){return this.getContactListScopeForOrganizationUsers$().pipe(he(()=>this.checkContactListScopeForOrganizationUsers([ki.ALL,ki.ORGANIZATION_USER_GROUP])?this.userOrganizationGroups$.asObservable():se([])))}enableAtHere(){try{if(this.analyticsService.setFeatureConfig({feature:ke.COMMENT,config:{atHereEnabled:!0}}),this.atHereEnabled$.value===!0)return;this.atHereEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in ContactService enableAtHere: ",e)}}setAtHereLabel(e){try{this.analyticsService.setFeatureConfig({feature:ke.COMMENT,config:{atHereLabel:e}}),e&&this.atHereLabel$.next(e)}catch(i){this.loggingService.catch("Error in ContactService setAtHereLabel: ",i)}}setAtHereDescription(e){try{this.analyticsService.setFeatureConfig({feature:ke.COMMENT,config:{atHereDescription:e}}),e&&this.atHereDescription$.next(e)}catch(i){this.loggingService.catch("Error in ContactService setAtHereDescription: ",i)}}disableAtHere(){try{if(this.analyticsService.setFeatureConfig({feature:ke.COMMENT,config:{atHereEnabled:!1}}),this.atHereEnabled$.value===!1)return;this.atHereEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in ContactService disableAtHere: ",e)}}getAtHereEnabled$(){return this.getContactListScopeForOrganizationUsers$().pipe(he(()=>this.checkContactListScopeForOrganizationUsers([ki.ALL,ki.DOCUMENT])?this.atHereEnabled$.asObservable():se(!1)))}getAtHereEnabled(){return this.checkContactListScopeForOrganizationUsers([ki.ALL,ki.DOCUMENT])?this.atHereEnabled$.value:!1}updateContactListScopeForOrganizationUsers(e){try{this.contactListScopeForOrganizationUsers$.next(e)}catch(i){this.loggingService.catch("Error in ContactService updateContactListScopeForOrganizationUsers: ",i)}}getContactListScopeForOrganizationUsers$(){return this.contactListScopeForOrganizationUsers$.asObservable()}getContactListScopeForOrganizationUsers(){return this.contactListScopeForOrganizationUsers$.value}checkContactListScopeForOrganizationUsers(e){return this.getContactListScopeForOrganizationUsers().some(i=>e.includes(i))}updateContactList(e,i){return Q(this,null,function*(){try{if(this.analyticsService.trackEvent(X.Events.Contact.UPDATE_CONTACT_LIST_TRIGGERED,{contactsCount:e?.length,config:i}),this.usersService?.userDataProviderAvailable()){let r=e.map(s=>s?.userId).filter(s=>s);yield this.usersService.resolveUsers({userIds:r});let a=r.map(s=>this.usersService.getUserById(s)).filter(s=>!!s);this.customUserContacts$.next(a)}else this.customUserContacts$.next(e);this.customUserContactsConfig$.next(i)}catch(r){this.loggingService.catch("Error in CommentService updateContactList: ",r)}})}convert(e){try{if(e?.options){let{documentId:i,organizationId:r}=this.docService.getServerId(e?.options);e.options=T(I({},e?.options),{documentId:i,organizationId:r})}return this}catch(i){return this.loggingService.catch("Error in ContactService convert: ",i),this}}getContactList$(){try{return this.authService.getUser$().pipe(he(e=>e?Rn([this.userOrganizationContacts$.asObservable(),this.userFolderContacts$.asObservable(),this.userDocumentContacts$.asObservable(),this.userOrganizationGroups$.asObservable(),this.customUserContacts$.asObservable()]).pipe(ce(([i,r,a,s,m])=>{let p={};p.organizationUsers=i?.map(_=>this.convertToClientUser(_)),p.folderUsers=r?.map(_=>this.convertToClientUser(_)),p.documentUsers=a?.map(_=>this.convertToClientUser(_)),p.updatedContactList=m?.map(_=>this.convertToClientUser(_));let h=[];return s?.forEach(_=>{let E=this.convertToClientUserGroup(_,p.organizationUsers||[]);E&&h.push(E)}),p.userGroups=h,p}),qt(Vi)):se(null)),jn(e=>(this.loggingService.catch("Error in ContactService getContactList$: ",e),se(null))))}catch(e){return this.loggingService.catch("Error in ContactService getContactList$: ",e),se(null)}}convertToClientUserGroup(e,i){try{let r={groupId:e?.metadata?.clientGroupId,groupName:e?.metadata?.groupName,users:[]},a={};return i?.forEach(s=>{if(s?.userId){let m=Pt(s.userId);a[m]=s}}),Object.keys(e?.users??{}).forEach(s=>{a[s]&&r.users?.push(a[s])}),r}catch(r){return this.loggingService.catch("Error in ContactService convertToClientUserGroup: ",r),null}}convertToClientUser(e){try{return e&&(e=JSON.parse(JSON.stringify(e)),e?.clientGroupId&&(e.groupId=e.clientGroupId,delete e.clientGroupId),e?.clientOrganizationId&&(e.organizationId=e.clientOrganizationId,delete e.clientOrganizationId),e?.userSnippylyId&&delete e.userSnippylyId),e}catch(i){return this.loggingService.catch("Error in ContactService convertToClientUser: ",i),e}}getCustomUserContacts(){return this.customUserContacts$.value}getCustomUserContacts$(){return this.customUserContacts$.asObservable()}getCustomUserContactsConfig(){return this.customUserContactsConfig$.value}getCustomUserContactsConfig$(){return this.customUserContactsConfig$.asObservable()}};o.\u0275fac=function(i){return new(i||o)(J(Ze),J(He),J(jt),J(hn),J(lt),J(y),J(Tn),J(Gn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Nle=n=>{try{return n.name.split(".").slice(0,-1).join(".")}catch(o){dt.catch("Error in File utils getFileName: ",o);return}},yH=n=>{try{return/(?:\.([^.]+))?$/.exec(n?.name)[1]}catch(o){dt.catch("Error in File utils getFileExtension: ",o);return}},Fle=(n,o)=>{try{let t=n.slice(0,-1,n.type);return new File([t],o+"."+yH(n),{type:n.type})}catch(t){dt.catch("Error in File utils updateFile: ",t);return}},Lle=n=>new Promise((o,t)=>{let e=new FileReader;e.readAsDataURL(n),e.onload=()=>{o(e.result)},e.onerror=i=>{t(i)}}),Ble={mp4:"video/mp4",mov:"video/quicktime",avi:"video/x-msvideo",wmv:"video/x-ms-wmv",flv:"video/x-flv",mp3:"audio/mpeg",wav:"audio/wav",ogg:"audio/ogg",webm:"video/webm",mkv:"video/x-matroska",m4v:"video/x-m4v",m4a:"audio/x-m4a",aac:"audio/aac","3gp":"video/3gpp","3g2":"video/3gpp2",jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",gif:"image/gif",bmp:"image/bmp",svg:"image/svg+xml",webp:"image/webp",pdf:"application/pdf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",xls:"application/vnd.ms-excel",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",ppt:"application/vnd.ms-powerpoint",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",odt:"application/vnd.oasis.opendocument.text",ods:"application/vnd.oasis.opendocument.spreadsheet",zip:"application/zip",rar:"application/x-rar-compressed",txt:"text/plain",rtf:"application/rtf",html:"text/html",htm:"text/html",csv:"text/csv",ics:"text/calendar",vcf:"text/x-vcard",js:"application/javascript",css:"text/css",json:"application/json",xml:"application/xml",swf:"application/x-shockwave-flash"};var Kp=(()=>{let o=class o{constructor(e,i,r,a){this.authService=e,this.configService=i,this.loggingService=r,this.attachmentResolverService=a,this.storage=qy();try{this.configService.getApiKey$().subscribe(s=>{this.apiKey=s}),this.authService.getFirebaseConfig$().subscribe(s=>{s&&s.firebaseOptions?.storageBucket&&(this.storage=qy(void 0,s?.firebaseOptions?.storageBucket))},s=>{this.loggingService.catch("Error in StorageService constructor: ",s)})}catch(s){this.loggingService.catch("Error in StorageService constructor:",s)}}createAttachment({path:e,file:i}){try{let r=new Yv;r.name=i.name;let a=Fle(i,`${r.attachmentId}_${Nle(i)}`),s=`${this.apiKey}/${e}/${a?.name}`;return r.bucketPath=s,r.size=i.size,r.type=yH(i),r?.type&&(r.mimeType=Ble[r?.type]),r}catch(r){return this.loggingService.catch("Error in StorageService createAttachment: ",r),null}}uploadAttachmentToStorage({attachment:e,file:i,resolve:r,reject:a}){try{let s=Yy(this.storage,e.bucketPath),m=nV(s,i,{cacheControl:"public,max-age=3600"});m.on("state_changed",p=>{let h=p.bytesTransferred/p.totalBytes*100},p=>{a(p)},()=>{tV(m.snapshot.ref).then(p=>{e.url=p,r(e)})})}catch(s){this.loggingService.catch("Error in StorageService uploadAttachmentToStorage: ",s),a(s)}}uploadToResolver(m){return Q(this,arguments,function*({file:e,attachment:i,metadata:r,resolve:a,reject:s}){try{r.attachmentId=i.attachmentId;let p={attachmentId:i.attachmentId,name:i.name,file:e,metadata:r,mimeType:i.mimeType},h=yield this.attachmentResolverService.saveAttachment({attachment:p,eventType:Ya.ATTACHMENT_ADD});h&&h.data?.url?(i.url=h.data?.url,a(i)):s(new Error("Failed to upload attachment to resolver"))}catch(p){this.loggingService.catch("Error in StorageService uploadToResolver: ",p),s(p)}})}uploadFile({path:e,file:i,useAttachmentResolver:r,metadata:a}){return new Promise((s,m)=>{try{if(!this.apiKey)throw new Error("API key not configured");let p=this.createAttachment({path:e,file:i});if(!p)throw new Error("Attachment not created");r?this.uploadToResolver({file:i,attachment:p,metadata:a,resolve:s,reject:m}):this.uploadAttachmentToStorage({attachment:p,file:i,resolve:s,reject:m})}catch(p){this.loggingService.catch("Error in StorageService uploadFile:",p),m(p)}})}uploadChunk(e,i,r){return new Promise((a,s)=>{try{if(this.apiKey){let m=`${this.apiKey}/${e}/${i.name}`,p=Yy(this.storage,m),h=nV(p,i,{cacheControl:"public,max-age=3600"});h.on("state_changed",_=>{let E=_.bytesTransferred/_.totalBytes*100},_=>{s(_)},()=>{tV(h.snapshot.ref).then(_=>{a(_)}).catch(_=>{this.loggingService.catch(`[uploadChunk] Error getting download URL for chunk ${r}:`,_),s(_)})})}else{let m=new Error("API key not available");this.loggingService.catch("[uploadChunk] API key not available",m),s(m)}}catch(m){this.loggingService.catch(`[uploadChunk] Error in StorageService uploadChunk for chunk ${r}: `,m),s(m)}})}downloadAttachment(e){try{if(e.url){let i=new XMLHttpRequest;i.responseType="blob",i.onload=()=>{let r=i.response,a=document.createElement("a"),s=window.URL.createObjectURL(r);a.setAttribute("type","hidden"),a.setAttribute(j.ATTRIBUTES.VELT_DOWNLOAD_BUTTON,"true"),a.classList.add("snippyly-overlay-panel"),a.href=s,e?.name&&(a.download=e?.name),document.body.appendChild(a);let m=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!1});a.dispatchEvent(m),window.URL.revokeObjectURL(s),a.remove()},i.onerror=()=>{window.open(e.url,"_blank")},i.open("GET",e.url),i.send()}}catch(i){this.loggingService.catch("Error in StorageService downloadAttachment: ",i)}}deleteAttachment({attachment:e,metadata:i,useAttachmentResolver:r}){return new Promise((a,s)=>{if(r)this.attachmentResolverService.deleteAttachment({attachmentId:e.attachmentId,metadata:i}).then(()=>{a(null)}).catch(m=>{s(m)});else{let m=Yy(this.storage,e.bucketPath);eV(m).then(()=>{a(null)}).catch(p=>{a(null)})}})}deleteFileFromPath(e){return new Promise((i,r)=>{let a=Yy(this.storage,e);eV(a).then(()=>{i(null)}).catch(s=>{r(s)})})}};o.\u0275fac=function(i){return new(i||o)(J(He),J(jt),J(y),J(Yp))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var fn=(()=>{let o=class o{constructor(e,i,r,a,s,m,p,h){this.analyticsService=e,this.authService=i,this.contactService=r,this.databaseService=a,this.docService=s,this.configService=m,this.loggingService=p,this.commonDbService=h,this.documentIAM$=new Ce(null),this.workspaceIAM$=new Ce(null),this.roles$=new Ce([]),this.getDocumentIamSubscription=null,this.getOrganizationIamSubscription=null,this.getWorkspaceIamSubscription=null;try{this.authService.setIamService(this),this.databaseService.getDb().pipe(Fe(_=>!!_),tt(1)).subscribe(_=>{_&&(this.db=_,this.getUser(),this.getDocumentPaths())},_=>{this.loggingService.catch("Error in CommentService getDb subscription: ",_)}),this.getRole$().pipe(tt(1)).subscribe(_=>{this.authService?.getUser()&&!_&&this.analyticsService.trackEvent(X.Events.Iam.USER_ACCESS_DENIED)}),this.documentIAM$.subscribe(_=>{_?.accessType&&this.contactService.setDocumentAccessType(_.accessType)})}catch(_){this.loggingService.catch("Error in IamService constructor: ",_)}}clearCache(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCache in IamService","color: green;");try{this.documentIAM$.next(null),this.workspaceIAM$.next(null),this.roles$.next([]),this.documentPaths=null}catch(e){this.loggingService.catch("Error in IamService clearCache: ",e)}}getUser(){try{this.authService.getUser$().pipe(Fe(e=>!!e)).subscribe(e=>{this.user=e,this.user?this.getDocumentIam():(this.getDocumentIamSubscription?.unsubscribe(),this.getOrganizationIamSubscription?.unsubscribe(),this.getWorkspaceIamSubscription?.unsubscribe())},e=>{this.loggingService.catch("Error in IamService getUser$ subscription: ",e)})}catch(e){this.loggingService.catch("Error in IamService getUser: ",e)}}getDocumentPaths(){try{this.docService.getDocumentPaths$().pipe(Fe(e=>!!e)).subscribe(e=>{this.documentPaths=e,this.getDocumentIam(),this.getWorkspaceIam()},e=>{this.loggingService.catch("Error in IamService getDocumentPaths$ subscription: ",e)})}catch(e){this.loggingService.catch("Error in IamService getDocumentPaths: ",e)}}getDocumentIam(){try{this.getDocumentIamSubscription&&(this.getDocumentIamSubscription.unsubscribe(),this.getDocumentIamSubscription=null),this.user?this.getDocumentIamSubscription=this.docService.getDocumentIam$().subscribe(e=>{let i=e||new oM;this.documentIAM$.next(i)},e=>{this.loggingService.catch("Error in IamService getDocumentIam$ subscription: ",e)}):this.documentIAM$.next(null)}catch(e){this.loggingService.catch("Error in IamService getDocumentIam: ",e)}}getWorkspaceIam(){try{this.getWorkspaceIamSubscription||(this.getWorkspaceIamSubscription=this.commonDbService.dbListener({feature:"workspaceIam",properties:{skipFirestore:!0}}).pipe(jn(e=>se(null))).subscribe(e=>{this.workspaceIAM$.next(e?.data),this.roles$.next(e?.data?.roles||[])}))}catch(e){this.loggingService.catch("Error in IamService getWorkspaceIam: ",e)}}isUserAllowed$(){return this.getRole$().pipe(ce(e=>!!e),qt())}getDocumentIAM$(){return this.documentIAM$.asObservable()}getRoles$(){return this.roles$.asObservable().pipe(ce(e=>e?.length?e:j.WorkspaceRoles))}getFeaturesAccessLevel$(){return this.documentIAM$.asObservable().pipe(ce(e=>e?.features),he(e=>this.getRole$().pipe(ce(i=>(i===go.ADMIN&&(e=e&&JSON.parse(JSON.stringify(e||{})),e?.all?.disabled&&(e.all.disabled=!1)),e)))))}hasRole(e){try{return e===this.getRole()}catch(i){return this.loggingService.catch("Error in IamService hasRole: ",i),!1}}hasRoleAny(e=[]){try{return e?.includes(this.getRole()||"")}catch(i){return this.loggingService.catch("Error in IamService hasRoleAny: ",i),!1}}hasRole$(e){try{return this.authService.getUser$().pipe(he(()=>this.documentIAM$.pipe(Fe(i=>!!i),he(()=>this.workspaceIAM$.pipe(ce(()=>e===this.getRole()))))))}catch(i){return this.loggingService.catch("Error in IamService hasRole$: ",i),se(!1)}}getRole$(){try{return this.authService.getUser$().pipe(he(()=>this.configService.getSF$()),he(()=>this.configService.getSF()?this.contactService.isUserGlobalContact$():se(null)),he(()=>this.documentIAM$.pipe(Fe(e=>!!e))),he(()=>this.workspaceIAM$),ce(()=>this.getRole()))}catch(e){return this.loggingService.catch("Error in IamService getRole$: ",e),se(null)}}getRole(){try{let e=this.configService.getSF();if(e&&this.contactService.isUserGlobalContact())return go.ADMIN;if(!e&&this.user?.isAdmin)return go.ADMIN;let i=null,r;if(this.user)switch((this.documentIAM$.value?this.documentIAM$.value?.features?.all?.restricted:!1)?pi.RESTRICTED:this.documentIAM$.value?this.documentIAM$.value?.documentAccessType||pi.PUBLIC:null){case pi.PUBLIC:r=this.getUserFromDocumentIAM(this.user?.email,this.user?.userId),r||(r=this.getUserFromWorkspaceIAM(this.user?.email,this.user?.userId)),i=r?.role?.name||go.COMMENTER;break;case pi.RESTRICTED:r=this.getUserFromDocumentIAM(this.user?.email,this.user?.userId),r||(r=this.getUserFromWorkspaceIAM(this.user?.email,this.user?.userId)),i=r?.role?.name||null;break;default:break}return i}catch(e){this.loggingService.catch("Error in IamService getRole: ",e)}return null}isUserAdmin$(){return this.getRole$().pipe(ce(e=>e===go.ADMIN),qt())}isUserAdmin(){try{return this.getRole()===go.ADMIN}catch(e){return this.loggingService.catch("Error in IamService isUserAdmin: ",e),!1}}getUserFromDocumentIAM(e,i){try{if(e||i){let r;return e&&(r=this.documentIAM$.value?.users?.[Pt(e)]),!r&&i&&(r=this.documentIAM$.value?.users?.[Pt(i)]),r}else return}catch(r){this.loggingService.catch("Error in IamService getUserFromDocumentIAM: ",r)}}getUserFromWorkspaceIAM(e,i){try{if(e||i){let r;return e&&(r=this.workspaceIAM$.value?.users?.[Pt(e)]),!r&&i&&(r=this.workspaceIAM$.value?.users?.[Pt(i)]),r}else return}catch(r){this.loggingService.catch("Error in IamService getUserFromWorkspaceIAM: ",r)}}};o.\u0275fac=function(i){return new(i||o)(J(Ze),J(He),J(Ci),J(hn),J(lt),J(jt),J(y),J(Tn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var vn=(()=>{let o=class o{constructor(e,i,r,a,s,m,p,h,_,E,D,L,H,K,oe,ue){this.afAuth=e,this.analyticsService=i,this.authService=r,this.configService=a,this.commonDbService=s,this.commonDbUtilsService=m,this.commentUtilsService=p,this.commentAnnotationsResolverService=h,this.databaseService=_,this.docService=E,this.domService=D,this.iamService=L,this.loggingService=H,this.notificationUtilsService=K,this.usersService=oe,this.functions=ue,this.db=Ii(),this.notificationsDb=Ii(void 0,Xn.firebaseNotificationsDatabaseURL),this.documentPaths=null,this.notifications$=new Ce([]),this.rawNotificationsByIdMap$=new Ce(new Map),this.processedNotifications$=new Ce([]),this.readNotificationsOnForYouTab$=new Ce(!1),this.notificationViews$=new Ce({}),this.notificationsByIdMap$=new Ce(new Map),this.historyPanelVisible$=new Ce(!1),this.notificationsForYou$=new Ce(null),this.notificationsByDocumentIdMap$=new Ce(null),this.notificationsByDocumentIdSubscription={},this.allowedDocumentMetadataMap$=new Ce(null),this.maxNotificationDays$=new Ce(15),this.tabConfig$=new Ce({people:{enable:!1}}),this.settingsConfig$=new Ce({inbox:"ALL",email:"MINE"}),this.muteAllNotifications$=new Ce(!1),this.enableSettings$=new Ce(!1),this.settingsInitialConfig$=new Ce([{name:"Inbox",id:"inbox",default:"ALL",enable:!0,values:[{name:"All",id:"ALL"},{name:"Only Involved",id:"MINE"},{name:"None",id:"NONE"}]},{name:"Email",id:"email",default:"MINE",enable:!0,values:[{name:"All",id:"ALL"},{name:"Only Involved",id:"MINE"},{name:"None",id:"NONE"}]}]);try{this.subscribeNotificationsData().subscribe(),this.commentUtilsService.setNotificationService(this),this.databaseService.getDb().pipe(Fe(be=>!!be),tt(1)).subscribe(be=>{be&&(this.db=be,this.getDocumentIds(),this.subscribeGetNotificationsForYou())},be=>{this.loggingService.catch("Error in NotificationService getDb subscription: ",be)}),this.authService.getUser$().subscribe(be=>{be?(this.setSettingsInitialConfig(this.settingsInitialConfig$.getValue()),this.subscribeGetNotificationsForYou(),this.getDocumentIds(),this.subscribeToUserSettings()):(Object.keys(this.notificationsByDocumentIdSubscription).forEach(Le=>{this.notificationsByDocumentIdSubscription[Le]?.unsubscribe()}),this.notificationForYouSubscription?.unsubscribe(),this.documentIdsSubscription?.unsubscribe(),this.resetCacheData())}),this.docService.getLocationMetadata$().subscribe(be=>{if(be){let Le=this.notificationsByDocumentIdMap$.getValue()?JSON.parse(JSON.stringify(this.notificationsByDocumentIdMap$.getValue())):null;Object.keys(be||{}).forEach(qe=>{let Re=Le?.[qe]?.notifications;Re?.length&&Re.forEach(_e=>{this.notificationUtilsService.mergeLocationWithNotification({notification:_e},be)?.notification})}),this.notificationsByDocumentIdMap$.next(Le)}})}catch(be){this.loggingService.catch("Error in NotificationService constructor: ",be)}}setDBConfigDataToInitialConfig(e){try{let i=JSON.parse(JSON.stringify(this.settingsConfig$.getValue()??{}));Object.entries(e||{}).forEach(([r,a])=>{i[r]=a}),this.settingsConfig$.next(i)}catch(i){this.loggingService.catch("Error in NotificationService setDBConfigDataToInitialConfig: ",i)}}getInitialConfigFromDB(e){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling NotificationService FUNCTION: getInitialConfigFromDB","color: green;");let i=Pt(this.authService.getUser()?.userId??""),r=yield this.commonDbService.getData({feature:"userConfig",properties:{useCollectionGroup:!1,isCollection:!1,documentId:e?.documentId,userId:i}});r?.notificationsConfig&&this.setDBConfigDataToInitialConfig(r?.notificationsConfig),yield this.updateSettingsConfigToDb()}catch(i){this.loggingService.catch("Error in NotificationService getInitialConfigFromDB: ",i)}})}subscribeToUserSettings(){try{this.loggingService.log("%c[WB] Calling NotificationService FUNCTION: subscribeToUserSettings","color: green;"),this.userSettingsSubscription&&this.userSettingsSubscription.unsubscribe();let e=Pt(this.authService.getUser()?.userId??"");this.userSettingsSubscription=this.enableSettings$.pipe(Fe(i=>i===!0),he(()=>this.docService.getDocumentPaths$().pipe(Fe(i=>!!i),he(i=>_o(this.getInitialConfigFromDB(i)).pipe(he(()=>this.commonDbService.dbListener({feature:"userConfig",properties:{useCollectionGroup:!1,isCollection:!1,documentId:i?.documentId,userId:e}}).pipe(ce(r=>{r?.data?.notificationsConfig&&this.setDBConfigDataToInitialConfig(r?.data?.notificationsConfig)})))))))).subscribe()}catch(e){this.loggingService.catch("Error in NotificationService subscribeToUserSettings: ",e)}}resetCacheData(){try{this.loggingService.log("%c[WB] Calling NotificationService FUNCTION: resetCacheData","color: green;"),this.notificationsByDocumentIdMap$.next(null),this.notificationsForYou$.next(null),this.settingsConfig$.next({})}catch(e){this.loggingService.catch("Error in NotificationService resetCacheData: ",e)}}subscribeGetNotificationsForYou(){try{this.notificationForYouSubscription&&this.notificationForYouSubscription.unsubscribe(),this.notificationForYouSubscription=this.getNotificationsForYou().subscribe(()=>{},e=>{this.loggingService.catch("Error in NotificationService getNotificationsForYou subscription: ",e)})}catch(e){this.loggingService.catch("Error in NotificationService subscriveGetNotificationsForYou: ",e)}}setCommentService(e){try{this.commentService=e}catch(i){this.loggingService.catch("Error in NotificationService setCommentService: ",i)}}getDocumentIds(){try{this.documentIdsSubscription&&this.documentIdsSubscription.unsubscribe(),this.documentIdsSubscription=this.getDocumentIdsByLastNotificationTimestamp().pipe(Pi(),ce(([e,i])=>{let r=e?.map(h=>h.documentId),a=i?.map(h=>h.documentId),s=r?.filter(h=>!a?.includes(h)),m=a?.map(h=>({documentId:h,timestamp:i?.find(_=>_.documentId===h)?.timestamp})).filter(h=>!r?.includes(h.documentId)),p=a?.map(h=>{let _=i?.find(E=>E.documentId===h)?.timestamp;return{documentId:h,timestamp:_}}).filter(h=>{let _=e?.find(E=>E.documentId===h.documentId)?.timestamp;return _&&h.timestamp&&_!==h.timestamp});m?.length&&this.fetchNotificationsForDocumentIds(m),p?.length&&this.fetchNotificationsForDocumentIds(p,1),s?.forEach(h=>{this.removeNotificationsForDocumentId(h)}),i&&!i?.length&&!this.notificationsByDocumentIdMap$.getValue()&&this.notificationsByDocumentIdMap$.next({})})).subscribe(()=>{},e=>{this.loggingService.catch("Error in NotificationService getDocumentIds subscription: ",e)})}catch(e){this.loggingService.catch("Error in NotificationService getDocumentIds: ",e)}}getDocumentIdsByLastNotificationTimestamp(e=15){try{return this.authService.getUser$().pipe(he(i=>this.docService.getOrganizationConfig$().pipe(ce(r=>{let a=null,s=this.configService.getApiKey(),m=r?.organizationId||i?.organizationId;return s&&m&&(a=new Om({apiKey:s,organizationId:m})),{user:i,documentPaths:a}}))),he(i=>{let{user:r,documentPaths:a}=i;if(r&&a?.organizationNotificationsLastNotificationTimestamp){let s=new Date,m=this.maxNotificationDays$.getValue()>0?this.maxNotificationDays$.getValue():15;s.setDate(s.getDate()-m);let p=s.getTime();return this.commonDbService.dbListener({feature:"allLastNotificationTimestamp",properties:{organizationId:a?.organizationId,isCollection:!0,useQuery:!0,firestoreQuery:[Ui(gt("timestamp",">=",p)),Ka("timestamp","desc"),qv(e)]}}).pipe(ce(h=>h?.data),ce(h=>{let _=[];return Object.keys(h||{}).forEach(E=>{let D=this.commonDbService.shouldUseFirestore()?h[E]?.timestamp??0:h[E],L=this.commonDbService.shouldUseFirestore()?h[E]?.deletedNotification??!1:!1;if(L&&L.id&&L?.timestamp===D){let H=L.id,K=h[E]?.metadata?.documentId,oe=JSON.parse(JSON.stringify(this.notificationsByDocumentIdMap$.getValue()??{})),ue=oe?.[K]??{documentMetadata:null,notifications:[]},be=ue.notifications??[],Le=be?.findIndex(qe=>qe.id===H);Le!==-1&&(be.splice(Le,1),this.notificationsByDocumentIdMap$.next(T(I({},oe),{[K]:T(I({},ue),{notifications:be})})))}_.push({documentId:E,timestamp:D})}),_}),jn(h=>(this.loggingService.catch("Error in NotificationService getDocumentIdsByLastNotificationTimestamp: ",h),se([]))))}return se(null)}))}catch(i){return this.loggingService.catch("Error in NotificationService getDocumentIdsByLastNotificationTimestamp: ",i),se([])}}fetchNotificationsForDocumentIds(e,i=15){return Q(this,null,function*(){try{if(e?.length){let r=yr(this.functions,br({url:Xn.cloudFunction.getNotificationsForDocuments,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:12e5}),a=this.docService.getOrganizationConfig()?.organizationId??"",s=this.getStartAtTimestamp(),m={};e.forEach(L=>{if(L?.documentId){let H=this.getAllowedDocumentMetadataByDocumentId(L.documentId);H&&(m[L.documentId]=H)}});let p={organizationId:a,documentIds:e,timestamp:s,limitToLast:i,documentMetadataByDocumentId:m},h=yield this.notificationUtilsService.handleNotificationEncryption({data:p}),_=(yield r({veltData:h}))?.data?.data?.veltData||{},E="notificationwithdocumentidstoencryptanddecryptonsdk"+(this.authService.getUser()?.userId??""),D=yield $oe(_,E);if(D&&typeof D=="object"){let L=this.usersService.userDataProviderAvailable(),H=this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable(),K=[],oe=[];Object.keys(D).forEach((ue,be)=>{let Le=D[ue].documentMetadata;if(Le){let Re=this.allowedDocumentMetadataMap$.value||{};(!Re?.[ue]||!uo(Re?.[ue],Le))&&this.allowedDocumentMetadataMap$.next(T(I({},Re),{[ue]:Le}))}let qe=D[ue].notifications||[];qe.forEach(Re=>{Re.notification=this.getClientNotificationObject(Re)}),this.setNotificationForDocumentIdInCache(ue,Le,qe),L&&K.push(this.commonDbUtilsService.formatResponse({feature:"allDocNotifications",data:qe,shouldAwait:!0,forceResolve:!0})),H&&oe.push(this.commonDbUtilsService.formatResponse({feature:"allDocNotifications",data:qe,shouldCommentAnnotationsResolverAwait:!0}))}),L&&Promise.all(K).then(()=>{Object.keys(D).forEach(ue=>{let be=D?.[ue]?.documentMetadata||{},Le=this.commonDbUtilsService.mergeUsersWithData({feature:"allDocNotifications",data:D?.[ue]?.notifications||[]});Le.forEach(qe=>{qe.notification=this.getClientNotificationObject(qe)}),this.setNotificationForDocumentIdInCache(ue,be,Le)})}),H&&Promise.all(oe).then(()=>{Object.keys(D).forEach(ue=>{let be=D?.[ue]?.documentMetadata||{},Le=D?.[ue]?.notifications?.reduce((qe,Re)=>(qe[Re.notificationId]=Re,qe),{});Le=this.commonDbUtilsService.mergeCommentAnnotationsWithData({feature:"allDocNotifications",data:Le}),Le=Object.values(Le??{}),Le.forEach(qe=>{qe.notification=this.getClientNotificationObject(qe)}),this.setNotificationForDocumentIdInCache(ue,be,Le)})})}}}catch(r){return this.loggingService.catch("Error in NotificationService fetchNotificationsForDocumentIds: ",r),[]}})}setNotificationForDocumentIdInCache(e,i,r,a){try{let s=this.docService.getOrganizationConfig()?.organizationId??"",m=this.docService.getOrganizationMetadata(s);i||(i=JSON.parse(JSON.stringify(this.docService.getDocumentMetadata()||{}))),m||(m=JSON.parse(JSON.stringify(this.docService.getOrganizationMetadata(s)||{})));let p=this.notificationsByDocumentIdMap$.getValue(),h=p?.[e]?.notifications||[],_=this.docService.getLocationMetadatas(),E=r?.map(H=>{let K=H.notification;return K.metadata&&(K.metadata.documentName=i?.documentName||K.metadata.documentName,K.metadata.organizationMetadata=m||K.metadata.organizationMetadata,K.metadata.documentMetadata=i||K.metadata.documentMetadata),_&&(K=this.notificationUtilsService.mergeLocationWithNotification({notification:K},_)?.notification),K})?.filter(H=>!!H)||[],D=new Map(h.map(H=>[H.id,H]));E.forEach(H=>{D.set(H.id,H)});let L=Array.from(D.values()).sort((H,K)=>(K.timestamp||0)-(H.timestamp||0));this.notificationsByDocumentIdMap$.next(T(I({},p),{[e]:{notifications:L,documentMetadata:i}}))}catch(s){this.loggingService.catch("Error in NotificationService setNotificationForDocumentIdInCache: ",s)}}removeNotificationsForDocumentId(e){try{this.notificationsByDocumentIdSubscription[e]&&this.notificationsByDocumentIdSubscription[e].unsubscribe();let i=this.notificationsByDocumentIdMap$.getValue();delete i?.[e],this.notificationsByDocumentIdMap$.next(i)}catch(i){this.loggingService.catch("Error in NotificationService removeNotificationsForDocumentId: ",i)}}getNotificationsForDocumentId$(e,i=50){try{return this.authService.getUser$().pipe(ce(r=>({user:r})),he(r=>this.maxNotificationDays$.pipe(ce(()=>r))),he(r=>{let{user:a}=r,s=this.configService.getApiKey();if(a&&s){let m=new Date,p=this.maxNotificationDays$.getValue()>0?this.maxNotificationDays$.getValue():15;m.setDate(m.getDate()-p);let h=m.getTime();return _o(this.commonDbService.queryData({feature:"allDocNotifications",properties:{rtdbQuery:[wB("timestamp"),AB(h),DB(i)],firestoreQuery:[Ka("timestamp","desc"),gt("timestamp",">=",h),gt("notification.actionUser.userId","!=",a.userId),qv(i)],apiKey:s,organizationId:this.docService?.getDocumentPaths()?.organizationId||a?.organizationId,documentId:e}})).pipe(he(_=>this.commonDbUtilsService.mergeUsersWithData$({feature:"allDocNotifications",data:{data:_,operation:null}})),ce(_=>_?.data??[]),ce(_=>(_.sort((E,D)=>D.timestamp-E.timestamp),_)),jn(_=>(this.loggingService.catch("Error in NotificationService getNotificationsForDocumentId: ",_),se([]))),ce(_=>(_.forEach(E=>{E.notification=this.getClientNotificationObject(E)}),_)))}return se([])}))}catch(r){return this.loggingService.catch("Error in NotificationService getNotificationsForDocumentId: ",r),se([])}}getStartAtTimestamp(){try{let e=new Date,i=this.maxNotificationDays$.getValue()>0?this.maxNotificationDays$.getValue():15;return e.setDate(e.getDate()-i),e.getTime()}catch(e){return this.loggingService.catch("Error in NotificationService getStartAtTimestamp: ",e),0}}getNotificationsForYou(){try{return this.databaseService.getDb().pipe(he(e=>this.authService.getUser$().pipe(ce(i=>({db:e,user:i})))),he(e=>this.maxNotificationDays$.pipe(ce(()=>e))),he(e=>{let{db:i,user:r}=e,a=this.configService.getApiKey();if(i&&r?.organizationId&&a){let s=Pt(r?.userId),m=new Date,p=this.maxNotificationDays$.getValue()>0?this.maxNotificationDays$.getValue():15;m.setDate(m.getDate()-p);let h=m.getTime();return this.commonDbService.dbListener({feature:"allUserNotifications",properties:{useQuery:!0,isCollection:!0,rtdbQuery:[wB("timestamp"),AB(h),DB(50)],firestoreQuery:[Ka("timestamp","desc"),gt("timestamp",">=",h),gt("notification.actionUser.userId","!=",r.userId),qv(50)],apiKey:a,organizationId:this.docService?.getDocumentPaths()?.organizationId||r?.organizationId,documentId:this.docService.getDocumentPaths()?.documentId,userId:s}}).pipe(he(_=>_?.data?se(_).pipe(ce(E=>E?.data),ce(E=>{let D=Object.values(E||{});return D.forEach(H=>{H.notification=this.getClientNotificationObject(H)}),D.sort((H,K)=>K.timestamp-H.timestamp),D.map(H=>H.notification).filter(H=>!!H)}),he(E=>{let D={data:E?.reduce((L,H)=>(L[H.id]={notification:H},L),{}),operation:null};return this.commonDbUtilsService.mergeLocationMetadataWithData$({data:D,feature:"allUserNotifications"}).pipe(ce(L=>Object.values(L?.data||{}).map(H=>H?.notification)))})):se(null)))}return se(null)}),he(e=>{let i=this.docService.getOrganizationConfig()?.organizationId??"";return this.docService.getOrganizationMetadata$(i).pipe(ce(()=>e))}),he(e=>this.allowedDocumentMetadataMap$.pipe(ce(()=>e))),ce(e=>(e?.length&&(e=e.map(i=>{if(i?.metadata){let r=this.docService.getOrganizationConfig()?.organizationId??"",a=this.getAllowedDocumentMetadataByDocumentId(i.metadata.documentId),s=this.docService.getOrganizationMetadata(r);a||(a=JSON.parse(JSON.stringify(this.docService.getDocumentMetadata()||{}))),s||(s=JSON.parse(JSON.stringify(this.docService.getOrganizationMetadata(r)||{}))),i.metadata.documentName=a?.documentName||i.metadata.documentName,i.metadata.organizationMetadata=s||i.metadata.organizationMetadata,i.metadata.documentMetadata=a||i.metadata.documentMetadata}return i})),e===null?this.notificationsForYou$.next(null):e?.length?this.notificationsForYou$.next(e):this.notificationsForYou$.next([]),se(e))))}catch(e){return this.loggingService.catch("Error in NotificationService getNotificationsForYou: ",e),se({})}}subscribeNotificationsData(e,i){this.loggingService.log("%c[WB] Calling FUNCTION: subscribeViewsData","color: green;");let r,a;try{if(e&&(a=yn(e)),i&&typeof i=="object"){let s=Jo(i);r=yn(JSON.stringify(s))}}catch(s){this.loggingService.catch("Error in ViewsService subscribeViewsData: ",s)}return qn(this.afAuth).pipe(Fe(s=>!!s),he(s=>this.isFeatureAllowed({firebaseUser:s})),he(s=>s.featureAllowed?this.iamService.isUserAllowed$().pipe(ce(m=>(s.featureAllowed=m,s))):se(s)),he(s=>!s.featureAllowed||s?.user?.organizationId?(this.notifications$.next([]),this.rawNotificationsByIdMap$.next(new Map),this.processedNotifications$.next([]),this.notificationsByIdMap$.next(new Map),this.notificationViews$.next({}),this.setNotificationsByIdMap(),se([])):se(s).pipe(he(m=>this.docService.getDocumentPaths$().pipe(ce(p=>(this.documentPaths=p,m.documentPaths=p,m)))),he(m=>this.getDataFromDocumentId(a)))))}isFeatureAllowed(e){return this.configService.getConfig$().pipe(Fe(i=>!!i),ce(i=>T(I({},e),{config:i})),he(i=>this.authService.getUser$().pipe(ce(r=>T(I({},i),{user:r})))),he(i=>eo(i.config,i.user,ke.NOTIFICATION)?se(T(I({},i),{featureAllowed:!0})):(this.loggingService.warn("Notification feature is not allowed."),se(T(I({},i),{featureAllowed:!1})))))}getDataFromDocumentId(e){return this.databaseService.getDb().pipe(Fe(i=>!!i),he(i=>{if(this.db=i,this.loggingService.log(this.db),this.configService?.getApiKey()&&this.documentPaths?.views){let r=`${this.configService.getApiKey()}`;this.documentPaths?.organizationId&&(r+=`/${j.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.documentPaths.organizationId}`);let a=rn(this.db,`${e?r+"/"+j.FIREBASE_PARTIAL_PATH_DOCS+"/"+e+"/"+j.FIREBASE_PARTIAL_PATH_VIEWS+"/":this.documentPaths?.notifications}`);return $f(a).pipe(jn(s=>(this.loggingService.catch("Error in NotificationService getDataFromDocumentId: ",s),se(null))),ce(s=>{let m=[],p=new Map;s?.raw&&(Object.keys(s?.raw||{}).forEach(_=>{let E=s?.raw[_];E?.id&&m.push(E)}),m.forEach(_=>{_.id&&p.set(_.id,_)})),this.notifications$.next(m),this.rawNotificationsByIdMap$.next(p);let h=[];s?.processed&&Object.keys(s?.processed||{}).forEach(_=>{let E=s?.processed[_];E?.id&&h.push(E)}),this.processedNotifications$.next(h),this.setNotificationsByIdMap()}))}else return se(null)}))}setNotificationsByIdMap(){try{let e=this.authService.getUser();if(e){let i=this.notificationViews$.getValue(),r;e?.email&&(r=Pt(e?.email));let a;e?.userId&&(a=Pt(e?.userId));let s=new Map;this.processedNotifications$.getValue().forEach(p=>{if(p.id&&p?.displayHeadlineMessageTemplate){let h=!1;(r&&p.notifyUsers?.[r]||a&&p.notifyUsers?.[a])&&(h=!0);let _={id:p.id,notificationSource:p.notificationSource,actionType:p.actionType,actionUser:p.actionUser,timestamp:p.timestamp,targetAnnotationId:p.targetAnnotationId,displayHeadlineMessage:this.getNotificationHeadlineMessage(p),displayBodyMessage:this.getNotificationBodyMessage(p),forYou:h,notificationSourceData:p.notificationSourceData},E=this.getRawNotificationById(_.id);if(E?.metadata&&(_.metadata={apiKey:E.metadata.apiKey,organizationId:E.metadata.organizationId,clientOrganizationId:E.metadata.clientOrganizationId,documentId:E.metadata.documentId,clientDocumentId:E.metadata.clientDocumentId,location:E?.location,locationId:E?.locationId}),_?.notificationSource==="comment"&&_?.targetAnnotationId){let D=this.commentService?.getAnnotationById(_.targetAnnotationId);D||E?.annotationData&&(D=E.annotationData),D&&(_.notificationSourceData=zn(D))}s.set(p.id,_)}}),s.forEach((p,h)=>{p.isUnread=p?.actionUser?.userSnippylyId!==e?.userSnippylyId&&!i?.notification?.[h]?.views?.[e?.userSnippylyId],s.set(h,p)}),this.notificationsByIdMap$.next(s)}}catch(e){this.loggingService.catch("Error in NotificationService setNotificationsByIdMap: ",e)}}getClientNotificationObject({processed:e,raw:i,metadata:r,views:a,notification:s}){try{let m=this.authService.getUser(),p=s||e;if(p.id&&p?.displayHeadlineMessageTemplate&&m){let h=null;m?.email&&(h=Pt(m?.email));let _=null;m?.userId&&(_=Pt(m?.userId));let E=!1,D=!0;(h&&p.notifyUsers?.[h]||_&&p.notifyUsersByUserId?.[_])&&(E=!0),_&&a?.[_]&&(D=!1);let L={id:p.id};if(s?L=T(I(I({},L),s),{displayHeadlineMessage:this.getNotificationHeadlineMessage(s),displayBodyMessage:this.getNotificationBodyMessage(s),forYou:E,isUnread:D}):L={id:e.id,notificationSource:e.notificationSource,actionType:e.actionType,actionUser:e.actionUser,timestamp:e.timestamp,targetAnnotationId:e.targetAnnotationId,displayHeadlineMessage:this.getNotificationHeadlineMessage(e),displayBodyMessage:this.getNotificationBodyMessage(e),forYou:E,isUnread:D,metadata:r},L?.notificationSource==="comment"&&L?.targetAnnotationId){let H=this.commentService?.getAnnotationById(L.targetAnnotationId);H||s?.notificationSourceData&&(H=s?.notificationSourceData),H||i?.annotationData&&(H=i.annotationData),H&&(L.notificationSourceData=zn(H))}return i?.targetAnnotationData?.isCommentResolverUsed&&(L.isCommentResolverUsed=i?.targetAnnotationData?.isCommentResolverUsed),L}return}catch(m){this.loggingService.catch("Error in NotificationService getClientNotificationObject: ",m);return}}getNotificationsForYou$(){return this.notificationsForYou$.asObservable()}getNotificationsByDocumentId$(){return this.notificationsByDocumentIdMap$.asObservable().pipe(ce(e=>e?Object.keys(e??{}).map(i=>{let r=e[i].notifications||[],a=r.filter(m=>m.isUnread).length,s=r.length>0&&r[0]?.timestamp||0;return{documentId:i,notifications:e[i]?.notifications,unreadNotificationsCount:a,latestNotificationTimestamp:s,documentMetadata:e[i]?.documentMetadata}}).filter(i=>i.notifications?.length>0).sort((i,r)=>r.latestNotificationTimestamp-i.latestNotificationTimestamp):null))}getAllNotifications$(){return this.getNotificationsByDocumentId$().pipe(ce(e=>{let i=null;return e?(i=[],e.forEach(r=>{r.notifications.forEach(a=>{i?.push(a)})}),i?.sort((r,a)=>a.timestamp-r.timestamp)):null}))}processNotificationData(e){try{let i=e?.annotationData?.metadata,r=this.docService.getOrganizationConfig()?.organizationId;e.metadata=JSON.parse(JSON.stringify(this.docService.getDocumentMetadata(i?.documentId)||{})),e.metadata||(e.metadata={},this.loggingService.catch("Warning in NotificationService updateNotificationDatabase: ","Document metadata not found")),delete e.metadata.locations,e.metadata.documentMetadata=JSON.parse(JSON.stringify(this.docService.getDocumentMetadata(i?.documentId)||{})),e?.metadata?.documentMetadata?.clientDocumentId&&e?.metadata?.documentMetadata?.documentId&&(e.metadata.documentMetadata.documentId=e?.metadata?.documentMetadata?.clientDocumentId),delete e.metadata.documentMetadata.locations,e.metadata.organizationMetadata=JSON.parse(JSON.stringify(r?this.docService.getOrganizationMetadata(r)||{}:{})),e?.metadata?.organizationMetadata?.clientOrganizationId&&e?.metadata?.organizationMetadata?.organizationId&&(e.metadata.organizationMetadata.organizationId=e?.metadata?.organizationMetadata?.clientOrganizationId);let a=this.configService.getApiKey();e.metadata.apiKey=a,e.platform=this.configService.getSF()?"sf":"sdk",e.actionUser=this.authService.getUser();let s=i?.documentId?new Om({apiKey:a,documentId:i.documentId,organizationId:i?.organizationId}):this.docService.getDocumentPaths();e?.actionUser?.organizationId&&(e.metadata.organizationId=s?.organizationId||e.actionUser.organizationId,e.metadata.clientOrganizationId=s?.clientOrganizationId||e.actionUser.clientOrganizationId);let m=this.docService.getLocation();m&&(e.location=m?.location,e.locationId=m?.locationId),this.loggingService.log(`[NOTIFICATION] ${e?.notificationSource} ${e?.actionType}`,e);let p=this.commonDbService.getServerTimestamp(),h=this.notificationUtilsService.formatNotification(e,p);return JSON.parse(JSON.stringify(h))}catch(i){return this.loggingService.catch("Error in NotificationService processNotificationData: ",i),null}}updateNotificationDatabase(e){try{let i=rn(this.notificationsDb),r=this.processNotificationData(e);M5(i,JSON.parse(JSON.stringify(r)))}catch(i){this.loggingService.catch("Error in NotificationService updateNotificationDatabase: ",i)}}getRawNotifications$(){return this.notifications$.asObservable()}getProcessedNotifications$(){return this.processedNotifications$.asObservable()}getNotifications$(){return this.authService.getUser$().pipe(he(e=>e?e.organizationId?this.getAllNotifications$().pipe(he(i=>this.notificationsForYou$.pipe(ce(r=>{let a=new Map;return(i||[]).forEach(s=>{s.id&&a.set(s.id,s)}),(r||[]).forEach(s=>{s.id&&!a.has(s.id)&&a.set(s.id,s)}),Array.from(a.values()).sort((s,m)=>(m.timestamp||0)-(s.timestamp||0))})))):this.notificationsByIdMap$.asObservable().pipe(ce(i=>Array.from(i.values())),ce(i=>i.sort((r,a)=>a.timestamp-r.timestamp)),Fg()):se(null)))}getRawNotificationById(e){try{return this.rawNotificationsByIdMap$.getValue()?.get(e)}catch(i){this.loggingService.catch("Error in NotificationService getRawNotificationById: ",i);return}}setNotificationViews(e){try{this.notificationViews$.next(e),this.setNotificationsByIdMap()}catch(i){this.loggingService.catch("Error in NotificationService setNotificationViews: ",i)}}getNotificationHeadlineMessage(e){try{let i=this.authService.getUser();if(e?.displayHeadlineMessageTemplate&&e?.displayHeadlineMessageTemplateData){let r=e.displayHeadlineMessageTemplate,a=e.displayHeadlineMessageTemplateData,s=/\{(\w+)\}/g,m=r.replace(s,(p,h)=>(h==="actionUser"||h==="recipientUser")&&a[h]?i?.email&&a[h].email===i?.email||i?.userId&&a[h]?.userId===i?.userId?"You":a[h].name||a[h].email||' <velt-skeleton-loader width="50px" height="20px" border-radius="4px"></velt-skeleton-loader> ':a[h]?a[h]:p);return this.domService.sanitizeHtml(m)}return this.domService.sanitizeHtml(e.displayHeadlineMessageTemplate||"")}catch(i){return this.loggingService.catch("Error in NotificationService getNotificationHeadlineMessage: ",i),""}}getNotificationBodyMessage(e){try{if(e?.displayBodyMessageTemplate&&e?.displayBodyMessageTemplateData){let i=e?.displayBodyMessageTemplate;return e?.displayBodyMessageTemplateData&&e?.displayBodyMessageTemplateData?.users?.forEach(r=>{if(r?.userId){let a=this.usersService.getUserById(r?.userId);i=i?.replaceAll(`{{${r.userId}}}`,a?.name||a?.email||'<velt-skeleton-loader width="50px" height="20px" border-radius="4px"></velt-skeleton-loader>')}}),this.domService.sanitizeHtml(i)}return this.domService.sanitizeHtml(e.displayBodyMessage||"")}catch(i){return this.loggingService.catch("Error in NotificationService getNotificationBodyMessage: ",i),""}}setHistoryPanelVisibility(e,i=!1,r=!1){try{e?document.querySelector(j.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL)?this.historyPanelVisible$.next(e):this.loggingService.catch("Error in NotificationService setHistoryPanelVisibility: ",`<${j.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`):this.historyPanelVisible$.next(e),e?this.analyticsService.trackEvent(X.Events.Notifications.NOTIFICATION_HISTORY_PANEL_OPENED):this.analyticsService.trackEvent(X.Events.Notifications.NOTIFICATION_HISTORY_PANEL_CLOSED)}catch{this.loggingService.catch("Error in NotificationService setHistoryPanelVisibility: ",`<${j.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`)}}toggleHistoryPanelVisibility(e=!1,i=!1){try{this.historyPanelVisible$.value?this.historyPanelVisible$.next(!this.historyPanelVisible$.value):document.querySelector(j.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL)?(this.historyPanelVisible$.next(!this.historyPanelVisible$.value),this.historyPanelVisible$.value?this.analyticsService.trackEvent(X.Events.Notifications.NOTIFICATION_HISTORY_PANEL_TOGGLED,{action:"closed"}):this.analyticsService.trackEvent(X.Events.Notifications.NOTIFICATION_HISTORY_PANEL_TOGGLED,{action:"opened"})):this.loggingService.catch("Error in NotificationService toggleHistoryPanelVisibility: ",`<${j.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`)}catch{this.loggingService.catch("Error in NotificationService toggleHistoryPanelVisibility: ",`<${j.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`)}}getHistoryPanelVisibility$(){return this.historyPanelVisible$.asObservable()}setNotificationsAsRead(e){return Q(this,null,function*(){try{if(e?.length){for(let a=0;a<e.length;a+=50){let m=e.slice(a,a+50).filter(p=>p?.id).map(p=>this.setNotificationAsRead(p));yield Promise.all(m)}let r=JSON.parse(JSON.stringify(this.notificationsByDocumentIdMap$.getValue()||{}));e.forEach(a=>{let s=a.metadata?.documentId;if(s&&r?.[s]){let m=r?.[s]?.notifications||[],p=m.find(h=>h.id===a.id);p&&(p.isUnread=!1),r[s].notifications=m}}),this.notificationsByDocumentIdMap$.next(r)}}catch(i){this.loggingService.catch("Error in NotificationService setNotificationsAsRead: ",i)}})}setAllNotificationsAsRead(e){return Q(this,null,function*(){try{if(e?.tabId==="for-you"){let i=this.notificationsForYou$.value||[];this.setNotificationsAsRead(i)}else this.getNotifications$().pipe(tt(1)).subscribe(i=>{i&&this.setNotificationsAsRead(i)})}catch(i){this.loggingService.catch("Error in NotificationService setAllNotificationsAsRead: ",i)}})}getUnreadNotificationsCount$(){try{return this.notificationsForYou$.pipe(ce(e=>e?.filter(r=>r?.isUnread)?.length??null),he(e=>this.getNotifications$().pipe(ce(i=>{let r=i?.filter(a=>a?.isUnread)?.length??null;return{forYou:e,all:r}}))))}catch(e){return this.loggingService.catch("Error in NotificationService getUnreadNotificationsCount$: ",e),se({forYou:null,all:null})}}setNotificationAsRead(e){return Q(this,null,function*(){try{let i=this.authService.getUser();if(i&&e?.id){let r=Pt(i?.userId),{metadata:a}=e;if(a){let{apiKey:s,organizationId:m,documentId:p}=a;if(s&&m&&p&&r){let h=yield this.commonDbService.getData({feature:"docNotification",properties:{id:e.id,organizationId:m,documentId:p,apiKey:s}});h?.notificationId&&(h?.views?.[r]||(h.views||(h.views={}),h.views[r]={timestamp:Date.now()},this.commonDbService.updateData({feature:"docNotificationViews",properties:{id:e.id,organizationId:m,documentId:p,apiKey:s},data:h})));let _=yield this.commonDbService.getData({feature:"userNotification",properties:{id:e.id,userId:r,documentId:p,organizationId:m}});_?.notificationId&&(this.getReadNotificationsOnForYouTab()?_?.views?.[r]||(_.views||(_.views={}),_.views[r]={timestamp:Date.now()},this.commonDbService.updateData({feature:"userNotificationViews",properties:{id:e.id,userId:r,documentId:p,organizationId:m},data:_})):yield this.commonDbService.deleteData({feature:"userNotification",properties:{id:e.id,userId:r,documentId:p,organizationId:m}}))}}}}catch(i){this.loggingService.catch("Error in NotificationService setNotificationAsRead: ",i)}})}setMaxDays(e){try{e>0?this.maxNotificationDays$.next(e):this.maxNotificationDays$.next(15)}catch(i){this.loggingService.catch("Error in NotificationService setMaxDays: ",i)}}setTabConfig(e){try{e&&this.tabConfig$.next(e)}catch(i){this.loggingService.catch("Error in NotificationService setTabConfig: ",i)}}getTabConfig$(){return this.tabConfig$.asObservable()}getTabConfig(){return this.tabConfig$.value}enableReadNotificationsOnForYouTab(){this.readNotificationsOnForYouTab$.next(!0)}disableReadNotificationsOnForYouTab(){this.readNotificationsOnForYouTab$.next(!1)}getReadNotificationsOnForYouTab$(){return this.readNotificationsOnForYouTab$.asObservable()}getReadNotificationsOnForYouTab(){return this.readNotificationsOnForYouTab$.value}markNotificationAsReadById(e){return Q(this,null,function*(){try{this.getNotifications$().pipe(tt(1)).subscribe(i=>{if(i){let r=i.filter(a=>a.id===e);this.setNotificationsAsRead(r)}})}catch(i){this.loggingService.catch("Error in NotificationService markNotificationAsReadById: ",i)}})}getAllowedDocumentMetadataByDocumentId(e){try{return this.allowedDocumentMetadataMap$.value?.[e]||null}catch(i){return this.loggingService.catch("Error in NotificationService getAllowedDocumentMetadataByDocumentId: ",i),null}}setSettingsConfig(e){try{this.settingsConfig$.next(e)}catch(i){this.loggingService.catch("Error in NotificationService setSettingsConfig: ",i)}}setSettingsConfigWithDB(e){try{this.settingsConfig$.next(e),this.updateSettingsConfigToDb()}catch(i){this.loggingService.catch("Error in NotificationService setSettingsConfigWithDB: ",i)}}getSettingsConfig$(){return this.settingsConfig$.asObservable()}getSettingsConfig(){return this.settingsConfig$.value}setMuteAllNotifications(){try{this.muteAllNotifications$.value!==!0&&this.muteAllNotifications$.next(!0)}catch(e){this.loggingService.catch("Error in NotificationService setSettingsMuteAll: ",e)}}getMuteAllNotifications$(){return this.muteAllNotifications$.asObservable()}getMuteAllNotifications(){return this.muteAllNotifications$.value}enableSettings(){try{this.enableSettings$.value!==!0&&this.enableSettings$.next(!0)}catch(e){this.loggingService.catch("Error in NotificationService enableSettings: ",e)}}disableSettings(){try{this.enableSettings$.value!==!1&&this.enableSettings$.next(!1)}catch(e){this.loggingService.catch("Error in NotificationService disableSettings: ",e)}}getEnableSettings$(){return this.enableSettings$.asObservable()}getEnableSettings(){return this.enableSettings$.value}setSettingsInitialConfig(e){try{let i=!1;if(e.forEach(s=>{["email","inbox"].includes(s.id)&&(i=!s.values?.every(m=>["ALL","NONE","MINE"].includes(m.id)))}),i){this.loggingService.catch("Invalid config values for email or inbox, It should have only ALL, NONE, MINE values");return}this.settingsInitialConfig$.next(e);let r={};e.forEach(s=>{if(s.enable){let m=s?.values?.find(p=>p.id===s.default);r[s.id]=m||s?.values?.[0]||{id:"NONE",name:"None"}}});let a={};Object.keys(r).forEach(s=>{a[s]=r[s].id}),this.setSettingsConfig(a)}catch(i){this.loggingService.catch("Error in NotificationService setSettingsInitialConfig: ",i)}}getSettingsInitialConfig$(){return this.settingsInitialConfig$.asObservable()}getSettingsInitialConfig(){return this.settingsInitialConfig$.value}updateSettingsConfigToDb(e){return Q(this,null,function*(){try{let i=Pt(this.authService.getUser()?.userId??""),r=this.docService.getDocumentPaths(),a={apiKey:this.configService.getApiKey(),organizationId:r?.organizationId,documentId:r?.documentId,clientOrganizationId:r?.clientOrganizationId,clientDocumentId:r?.clientDocumentId,userId:i,clientUserId:this.authService.getUser()?.userId};i&&r?.documentId&&this.getEnableSettings()&&(yield this.commonDbService.updateData({feature:"userConfig",properties:{documentId:r.documentId,userId:i},data:{id:r.documentId,notificationsConfig:e||this.settingsConfig$.getValue(),metadata:a}}))}catch(i){this.loggingService.catch("Error in NotificationService updateSettingsConfigToDb: ",i)}})}};o.\u0275fac=function(i){return new(i||o)(J(bi),J(Ze),J(He),J(jt),J(Tn),J(t0),J(Jv),J(xs),J(hn),J(lt),J(Ne),J(fn),J(y),J(DM),J(Gn),J(jo))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var zo=(()=>{let o=class o{constructor(e){this.loggingService=e,this._customStatusMap=new Ce(j.CommentAnnotationStatusMap),this._customPriorityMap=new Ce(j.CommentAnnotationPriorityMap),this._customCategoryMap=new Ce(j.CommentCategoryMap);try{let i=sessionStorage.getItem(j.SESSION_STORAGE.VELT_CUSTOM_PRIORITY_MAP);i&&this._customPriorityMap.next(JSON.parse(i));let r=sessionStorage.getItem(j.SESSION_STORAGE.VELT_CUSTOM_STATUS_MAP);r&&this._customStatusMap.next(JSON.parse(r));let a=sessionStorage.getItem(j.SESSION_STORAGE.VELT_CUSTOM_CATEGORY_MAP);a&&this._customCategoryMap.next(JSON.parse(a))}catch(i){this.loggingService.catch("Error in CustomFilterService constructor: ",i)}}setCustomStatusFilters(e){try{if(e.length<2){this._customStatusMap.next(j.CommentAnnotationStatusMap),sessionStorage.setItem(j.SESSION_STORAGE.VELT_CUSTOM_STATUS_MAP,JSON.stringify(j.CommentAnnotationStatusMap)),this.loggingService.catch("Custom status filters must have at least 2 filters");return}let i={};e.forEach(r=>{i[r.id]=r,r.type||(r.type="ongoing")}),this._customStatusMap.next(i),sessionStorage.setItem(j.SESSION_STORAGE.VELT_CUSTOM_STATUS_MAP,JSON.stringify(i))}catch(i){this.loggingService.catch("Error in CustomFilterService setCustomStatusFilters: ",i)}}setCustomPriorityFilters(e){try{if(e.length<2){this._customPriorityMap.next(j.CommentAnnotationPriorityMap),sessionStorage.setItem(j.SESSION_STORAGE.VELT_CUSTOM_PRIORITY_MAP,JSON.stringify(j.CommentAnnotationPriorityMap)),this.loggingService.catch("Custom priority filters must have at least 2 filters");return}let i={};e.forEach(r=>{i[r.id]=r}),this._customPriorityMap.next(i),sessionStorage.setItem(j.SESSION_STORAGE.VELT_CUSTOM_PRIORITY_MAP,JSON.stringify(i))}catch(i){this.loggingService.catch("Error in CustomFilterService setCustomPriorityFilters: ",i)}}setCustomCategories(e){try{let i={};e.forEach(r=>{i[r.id]=r}),this._customCategoryMap.next(i),sessionStorage.setItem(j.SESSION_STORAGE.VELT_CUSTOM_CATEGORY_MAP,JSON.stringify(i))}catch(i){this.loggingService.catch("Error in CustomFilterService setCustomCategories: ",i)}}get customStatusMap$(){return this._customStatusMap.asObservable()}get customPriorityMap$(){return this._customPriorityMap.asObservable()}get customCategoryMap$(){return this._customCategoryMap.asObservable()}get defaultStatus(){try{let i=Object.entries(this._customStatusMap.value).find(([r,a])=>a.type==="default");if(i)return i[1]}catch(e){this.loggingService.catch("Error in CustomFilterService defaultStatus: ",e)}return j.CommentAnnotationStatusMap.OPEN}get resolvedStatus(){try{let i=Object.entries(this._customStatusMap.value).find(([r,a])=>a.type==="terminal");if(i)return i[1]}catch(e){this.loggingService.catch("Error in CustomFilterService resolvedStatus: ",e)}return j.CommentAnnotationStatusMap.OPEN}get ongoingStatuses(){try{let i=Object.entries(this._customStatusMap.value).filter(([r,a])=>a.type==="ongoing");if(i)return i.map(r=>r[1])}catch(e){this.loggingService.catch("Error in CustomFilterService ongoingStatuses: ",e)}return[j.CommentAnnotationStatusMap.IN_PROGRESS]}convertLegacyAnnotationStatus(e){try{if(typeof e.status=="string"||e.status===void 0){let i=Object.entries(this._customStatusMap.value),r=i.find(([a,s])=>s.type==="default");switch(e.status){case"open":r&&(e.status=r[1]);break;case"inProgress":let a=i.find(([m,p])=>p.type==="ongoing");a&&(e.status=a[1]);break;case"resolved":let s=i.find(([m,p])=>p.type==="terminal");s&&(e.status=s[1]);break;default:r&&(e.status=r[1]);break}}return e}catch(i){return this.loggingService.catch("Error in CustomFilterService convertLegacyAnnotation: ",i),e}}convertLegacyPriority(e){try{typeof e.priority=="string"&&(e.priority=j.CommentAnnotationPriorityMap[e.priority])}catch(i){this.loggingService.catch("Error in CustomFilterService convertLegacyPriority: ",i)}return e}convertLegacyCategory(e){try{if(e.commentCategories===void 0||e.commentCategories===null||!Array.isArray(e.commentCategories)||e.commentCategories.length===0)return e;typeof e.commentCategories[0]=="string"&&(e.commentCategories=e.commentCategories.map(i=>j.CommentCategoryMap[i]))}catch(i){this.loggingService.catch("Error in CustomFilterService convertLegacyCategory: ",i)}return e}};o.\u0275fac=function(i){return new(i||o)(J(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var wc=(()=>{let o=class o{constructor(e,i,r){this.domService=e,this.loggingService=i,this.sanitizer=r,this.emojis={};try{this.loggingService.log("%c[WB] Creating CLASS: EmojiService","color: blue;"),Object.keys(o.Icons).forEach(a=>{let s=o.Icons[a];this.emojis[a]=this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeSvg(s))}),Object.keys(o.GIF_PATHS).forEach(a=>{let s=`<img src="${o.GIF_PATHS[a]}" alt="${a}" />`;this.emojis[a]=this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeHtml(s))})}catch(a){this.loggingService.catch("Error in EmojiService constructor: ",a)}}getEmoji(e){try{return this.emojis[e]}catch{return""}}getEmojiFromIconUrl(e){try{return this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeHtml(`<img src="${e}" alt="emoji" />`))}catch{return""}}getEmojiFromIconEmoji(e,i){try{let r=`<span class="velt-emoji-icon velt-emoji-icon--emoji">${e}</span>`;return i&&(r=`<span class="velt-emoji-icon velt-emoji-icon--emoji" emoji-id=${i}>${e}</span>`),this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeHtml(r))}catch{return""}}setEmojiList(e){try{this.emojis={},Object.keys(e).forEach(i=>{let r=e[i];if(r.svg)this.emojis[i]=this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeSvg(r.svg));else if(r.url){let a=`<img src="${r.url}" alt="${i}" />`;this.emojis[i]=this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeHtml(a))}else r.emoji&&(this.emojis[i]=this.getEmojiFromIconEmoji(this.domService.sanitizeHtml(r.emoji)))})}catch(i){this.loggingService.catch("Error in EmojiService setEmojiList: ",i)}}};o.Icons={RAISED_HANDS:`<svg width="58" height="57" viewBox="0 0 58 57" fill="none" xmlns="http://www.w3.org/2000/svg">
196
196
  <path d="M35.8477 11.6603L40.4962 5.23427" stroke="#B0BEC5" stroke-width="1.92685" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
197
197
  <path d="M21.8298 11.617L17.4655 6.02428" stroke="#B0BEC5" stroke-width="1.92685" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
198
198
  <path d="M28.7568 9.77682L28.7761 1" stroke="#B0BEC5" stroke-width="1.92685" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
@@ -412,7 +412,7 @@ This typically indicates that your device does not have a healthy Internet conne
412
412
  `).replace(/&nbsp;/g," ");let a;if(this.componentConfigSignal().newCommentTextArea?a=this.componentConfigSignal().newCommentTextArea.nativeElement:this.componentConfigSignal().editCommentTextArea&&(a=this.componentConfigSignal().editCommentTextArea.nativeElement),a){let s=null;try{a.getRootNode()instanceof ShadowRoot&&(a.getRootNode().getSelection?s=a.getRootNode().getSelection():this.elementRef?.nativeElement?.shadowRoot?.getSelection&&(s=this.elementRef.nativeElement.shadowRoot.getSelection()))}catch{}if(s=s||window.getSelection(),s&&s.rangeCount>0){let m=s.getRangeAt(0);a.contains(m.commonAncestorContainer)||(m.selectNodeContents(a),m.collapse(!1)),m.deleteContents();let p=r.split(`
413
413
  `).map(h=>document.createTextNode(h));p.forEach((h,_)=>{m.insertNode(h),_<p.length-1&&m.insertNode(document.createElement("br")),m.collapse(!1)}),s.removeAllRanges(),s.addRange(m),this.componentConfigSignal.update(h=>(h=T(I({},h),{newCommentHTML:this.domService.sanitizeHtml(a.innerHTML),newComment:a.innerText}),h))}this.checkGetAnnotationDraftAttribute()}}}catch(i){this.loggingService.catch("Error in CommentDialogComponent onPaste: ",i)}}onPasteOld(e){this.loggingService.log("%c[WB] Calling FUNCTION: onPaste","color: green;");try{let i=(e.clipboardData||e?.originalEvent?.clipboardData).items,r=[];for(let m of i)if(m.type.indexOf("image")===0){let p=m.getAsFile(),h=Pn(),_=new File([p],`${h}.png`,p);r.push(_)}r?.length&&this.selectFiles(null,r);let s=e.clipboardData?.getData("text");if(s){s=this.domService.sanitizeHtml(s);let m;if(this.componentConfigSignal().newCommentTextArea?m=this.componentConfigSignal().newCommentTextArea.nativeElement:this.componentConfigSignal().editCommentTextArea&&(m=this.componentConfigSignal().editCommentTextArea.nativeElement),m){if(this.elementRef?.nativeElement?.shadowRoot?.getSelection){let p=this.elementRef.nativeElement.shadowRoot.getSelection();if(p.rangeCount){let h=p.getRangeAt(0);h.deleteContents();let _=document.createTextNode(s);h.insertNode(_),h.setStartAfter(_),h.setEndAfter(_),p.removeAllRanges(),p.addRange(h)}this.componentConfigSignal.update(h=>(h=T(I({},h),{newCommentHTML:this.domService.sanitizeHtml(m.innerHTML),newComment:m.innerText}),h))}else this.componentConfigSignal().newCommentTextArea?(this.componentConfigSignal.update(p=>(p=I({},p),p.newCommentTextArea.nativeElement.innerHTML=this.domService.sanitizeHtml(p.newCommentTextArea.nativeElement.innerHTML+"&nbsp;"+s),p.newCommentHTML=this.domService.sanitizeHtml(p.newCommentTextArea.nativeElement.innerHTML),p.newComment=p.newCommentTextArea.nativeElement.innerText,p)),this.setCursorToEndOfContenteditable(this.componentConfigSignal().newCommentTextArea?.nativeElement)):this.componentConfigSignal().editCommentTextArea&&(this.componentConfigSignal.update(p=>(p=I({},p),p.editCommentTextArea.nativeElement.innerHTML=this.domService.sanitizeHtml(p.editCommentTextArea.nativeElement.innerHTML+"&nbsp;"+s),p.newCommentHTML=this.domService.sanitizeHtml(p.editCommentTextArea.nativeElement.innerHTML),p.newComment=p.editCommentTextArea.nativeElement.innerText,p)),this.setCursorToEndOfContenteditable(this.componentConfigSignal().editCommentTextArea?.nativeElement));this.checkGetAnnotationDraftAttribute()}}}catch(i){this.catchError("Error in CommentDialogComponent onPaste: ",i)}}onDrop(e){this.loggingService.log("%c[WB] Calling FUNCTION: onDrop","color: green;");try{if(e?.dataTransfer?.files?.length){let i=[];for(let r=0;r<e?.dataTransfer?.items?.length;r++){let a=e?.dataTransfer?.items[r].getAsFile();if(a&&a.type.indexOf("image")===0){let s=Pn(),m=new File([a],`${s}.png`,a);i.push(m)}}i?.length&&this.selectFiles(null,i)}}catch(i){this.catchError("Error in CommentDialogComponent onDrop: ",i)}}onEscapeKeyPressed(e){return Q(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: onEscapeKeyPressed","color: green;");try{if(e.keyCode===27){this.loggingService.log("reached"),e?.stopPropagation();let i=new Date().getTime(),r=i-this.lastEscapePressed;if(this.lastEscapePressed&&r<500)clearTimeout(this.escapePressTimeout),this.componentConfigSignal.update(a=>(a=T(I({},a),{getAnnotationDraftAttribute:null}),a)),yield Rp(50),this.domService.resetSelectedAnnotationsMap();else{clearTimeout(this.escapePressTimeout);let a=500;this.componentConfigSignal().getAnnotationDraftAttribute||(a=0),this.escapePressTimeout=setTimeout(()=>{this.domService.resetSelectedAnnotationsMap()},a),this.lastEscapePressed=i}}}catch(i){this.catchError("Error in CommentDialogComponent onEscapeKeyPressed: ",i)}})}deleteCommentPinAnnotations(e){try{this.commentService.deleteCommentPinAnnotations(e)}catch(i){this.catchError("Error in CommentDialogComponent deleteCommentPinAnnotations: ",i)}}cancelUpdate(){this.loggingService.log("%c[WB] Calling FUNCTION: cancelUpdate","color: green;");try{this.componentConfigSignal.update(e=>(e=T(I({},e),{editComment:null,editCommentIndex:null,selectedFiles:[],invalidSelectedFiles:[],selectedAttachments:[],attachmentsToDelete:[],taggedUserContacts:[],toOrganizationUserGroup:[],customList:[],assignTo:void 0,selectedUserContacts:[],newComment:""}),e.editCommentTextArea?.nativeElement&&(e.editCommentTextArea.nativeElement.innerText=""),e)),this.checkGetAnnotationDraftAttribute()}catch(e){this.catchError("Error in CommentDialogComponent cancelUpdate: ",e)}}setMessageScrollOffset(e){let i=e.target;i&&(this.messageScrollOffset=i.scrollTop)}updateCommentReaction(e,i,r){return Q(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: updateCommentReaction","color: green;");try{if(this.componentConfigSignal().readOnly||this.componentConfigSignal().disabled||!this.componentConfigSignal().user?.userSnippylyId||this.componentConfigSignal().user?.isAnonymous||this.componentConfigSignal().isPlanExpired)return;this.commentActionsService.toggleReaction({annotationId:this.componentConfigSignal().annotation?.annotationId,commentId:i?.commentId,reaction:{reactionId:e}})}catch(a){this.catchError("Error in CommentDialogComponent updateCommentReaction: ",a)}})}onEditCommentClick(e){this.loggingService.log("%c[WB] Calling FUNCTION: onEditCommentClick","color: green;");try{this.componentConfigSignal().commentPinSelected||this.domService.toggleAnnotationSelection(this.componentConfigSignal().annotation,this.componentConfigSignal().containerComponentId),this.onClick(),this.componentConfigSignal.update(i=>(i=I({},i),i.editComment=JSON.parse(JSON.stringify(this.componentConfigSignal().annotation?.comments[e])),i.editCommentIndex=e,i.taggedUserContacts=i.editComment?.taggedUserContacts||[],i)),setTimeout(()=>{let i=this.elementRef.nativeElement.querySelector(".velt-comment-dialog-composer");i&&i.scrollIntoView({behavior:"smooth",block:"nearest"}),this.componentConfigSignal.update(r=>(r=I({},r),r.editCommentTextArea?.nativeElement&&(r.editCommentTextArea.nativeElement.innerHTML=this.domService.sanitizeHtml(r?.editComment?.commentHtml||"")),r)),this.componentConfigSignal().editCommentTextArea&&this.componentConfigSignal().editCommentTextArea.nativeElement&&this.setCursorToEndOfContenteditable(this.componentConfigSignal().editCommentTextArea?.nativeElement)},300),this.analyticsService.trackEvent(X.Events.Comments.COMMENT_EDIT_BUTTON_CLICKED,{annotationId:this.componentConfigSignal().annotation?.annotationId,commentThreadId:this.componentConfigSignal().editComment?.commentId,commentType:this.commentService.getCommentType(this.componentConfigSignal().annotation),uiLocation:this.componentConfigSignal().sidebarMode?"sidebar":"dialog",commentMode:this.commentService.getCommentMode()}),this.componentConfigSignal.update(i=>(i=T(I({},i),{newComment:i.editComment?.commentText,newCommentHTML:i.editComment?.commentHtml,composerInOpenState:!0}),i)),this.emailChipMigration(this.componentConfigSignal().newCommentHTML),this.extractContacts(this.componentConfigSignal().newComment),setTimeout(()=>{this.checkGetAnnotationDraftAttribute()},100)}catch(i){this.catchError("Error in CommentDialogComponent onEditCommentClick: ",i)}}setCursorToEndOfContenteditable(e){this.loggingService.log("%c[WB] Calling FUNCTION: setCursorToEndOfContenteditable","color: green;");try{let i,r;if(document.createRange){i=document.createRange(),i.selectNodeContents(e),i.collapse(!1);let a=this.elementRef.nativeElement.shadowRoot;r=a&&a.getSelection!==void 0?a.getSelection():window.getSelection(),r?.removeAllRanges(),r?.addRange(i)}}catch(i){this.catchError("Error in CommentDialogComponent setCursorToEndOfContenteditable: ",i)}}openAllComments(){this.bottomSheetContainerData&&this.bottomSheetContainerData?.dismiss(),this.commentService.onSidebarButtonOnCommentDialogClick(),(document.querySelector(j.TAGS.VELT_COMMENTS_SIDEBAR)||document.querySelector(j.TAGS.SNIPPYLY_COMMENTS_SIDEBAR))?.hasAttribute(j.ATTRIBUTES.EMBED_MODE)?(this.commentService.setSidebarVisibility(!0),this.commentService.openSidebar()):this.commentService.setSidebarVisibility(!0)}approveCommentPinAnnotation(){try{this.analyticsService.trackEvent(X.Events.Comments.COMMENT_APPROVE_BUTTON_CLICKED,{annotationId:this.componentConfigSignal().annotation?.annotationId,commentType:this.commentService.getCommentType(this.componentConfigSignal().annotation),uiLocation:this.componentConfigSignal().sidebarMode?"sidebar":"dialog",commentMode:this.commentService.getCommentMode()}),this.componentConfigSignal.update(e=>(e=T(I({},e),{annotation:T(I({},e.annotation),{approved:!0})}),e)),this.commentActionsService.approveCommentAnnotation({annotationId:this.componentConfigSignal().annotation?.annotationId})}catch(e){this.catchError("Error in CommentDialogComponent approveCommentPinAnnotation: ",e)}}acceptCommentPinAnnotation(){this.loggingService.log("%c[WB] Calling FUNCTION: acceptCommentPinAnnotation","color: green;");try{this.analyticsService.trackEvent(X.Events.Comments.COMMENT_ACCEPT_BUTTON_CLICKED,{annotationId:this.componentConfigSignal().annotation?.annotationId,commentType:this.commentService.getCommentType(this.componentConfigSignal().annotation),uiLocation:this.componentConfigSignal().sidebarMode?"sidebar":"dialog",commentMode:this.commentService.getCommentMode()}),this.commentTextPortalService.onAcceptComment(this.componentConfigSignal().annotation),this.commentActionsService.acceptCommentAnnotation({annotationId:this.componentConfigSignal().annotation?.annotationId})}catch(e){this.catchError("Error in CommentDialogComponent approveCommentPinAnnotation: ",e)}}rejectCommentPinAnnotation(){this.loggingService.log("%c[WB] Calling FUNCTION: rejectCommentPinAnnotation","color: green;");try{this.analyticsService.trackEvent(X.Events.Comments.COMMENT_REJECT_BUTTON_CLICKED,{annotationId:this.componentConfigSignal().annotation?.annotationId,commentType:this.commentService.getCommentType(this.componentConfigSignal().annotation),uiLocation:this.componentConfigSignal().sidebarMode?"sidebar":"dialog",commentMode:this.commentService.getCommentMode()}),this.commentActionsService.rejectCommentAnnotation({annotationId:this.componentConfigSignal().annotation?.annotationId})}catch(e){this.catchError("Error in CommentDialogComponent rejectCommentPinAnnotation: ",e)}}onSignInClick(){this.analyticsService.trackEvent(X.Events.Comments.COMMENT_SIGN_IN_BUTTON_CLICKED,{annotationId:this.componentConfigSignal().annotation?.annotationId,commentType:this.commentService.getCommentType(this.componentConfigSignal().annotation),uiLocation:this.componentConfigSignal().sidebarMode?"sidebar":"dialog",commentMode:this.commentService.getCommentMode()}),this.commentService.onSignInClick()}onUpgradeClick(){this.analyticsService.trackEvent(X.Events.Comments.COMMENT_UPGRADE_BUTTON_CLICKED,{annotationId:this.componentConfigSignal().annotation?.annotationId,commentType:this.commentService.getCommentType(this.componentConfigSignal().annotation),uiLocation:this.componentConfigSignal().sidebarMode?"sidebar":"dialog",commentMode:this.commentService.getCommentMode()}),this.commentService.onUpgradeClick()}toggleShowReplies(){try{this.analyticsService.trackEvent(X.Events.Comments.COMMENT_MORE_REPLY_OPTION_CLICKED,{annotationId:this.componentConfigSignal().annotation?.annotationId,commentType:this.commentService.getCommentType(this.componentConfigSignal().annotation),uiLocation:this.componentConfigSignal().sidebarMode?"sidebar":"dialog",commentMode:this.commentService.getCommentMode()}),this.componentConfigSignal.update(e=>(e=T(I({},e),{showReplies:!e.showReplies,composerInOpenState:!1}),e)),this.componentConfigSignal().commentPinSelected||(this.componentConfigSignal().sidebarMode?this.domService.toggleAnnotationSelection(this.componentConfigSignal().annotation,this.componentConfigSignal().containerComponentId,"sidebarShowReplies"):this.domService.toggleAnnotationSelection(this.componentConfigSignal().annotation,this.componentConfigSignal().containerComponentId))}catch(e){this.catchError("Error in CommentDialogComponent toggleShowReplies: ",e)}}toggleNotificationSubscription(){try{this.loggingService.log("%c[WB] Calling FUNCTION: toggleNotificationSubscription","color: green;"),this.componentConfigSignal()?.annotation&&this.commentActionsService.toggleNotificationSubscription({annotationId:this.componentConfigSignal().annotation?.annotationId})}catch(e){this.catchError("Error in CommentDialogComponent toggleNotificationSubscription: ",e)}}onAttachmentButtonClick(){try{this.analyticsService.trackEvent(X.Events.Comments.COMMENT_ATTACHMENT_BUTTON_CLICKED,{annotationId:this.componentConfigSignal().annotation?.annotationId,commentThreadId:this.componentConfigSignal().editComment?.commentId,commentType:this.commentService.getCommentType(this.componentConfigSignal().annotation),uiLocation:this.componentConfigSignal().sidebarMode?"sidebar":"dialog",commentMode:this.commentService.getCommentMode()})}catch(e){this.catchError("Error in CommentDialogComponent onAttachmentButtonClick: ",e)}}selectFiles(e,i){return Q(this,null,function*(){try{if(i=i||[],e?.target?.files?.length){for(let a=0;a<e.target.files.length;a++){let s=e.target.files[a];s&&i.push(s)}e.target.value=""}if(i.length)for(let a=0;a<i.length;a++){let s=i[a],m=yield Lle(s),p=this.domSanitizer.bypassSecurityTrustUrl(m),h=this.commentActionsService.validateFile(s);if(h.valid){let _=s?.type;this.componentConfigSignal.update(E=>(E=T(I({},E),{selectedFiles:[...E.selectedFiles,{file:s,url:s?.type?.includes("svg")?p:m,fileType:_}]}),E))}else this.componentConfigSignal.update(_=>(_=T(I({},_),{invalidSelectedFiles:[..._.invalidSelectedFiles,{file:s,url:m,errorMessage:h?.maxAllowedSizeInMB?`Size > ${h?.maxAllowedSizeInMB}MB`:"Size > 15MB"}]}),_)),this.analyticsService.trackEvent(X.Events.Comments.COMMENT_ATTACHMENT_SIZE_EXCEEDED,{annotationId:this.componentConfigSignal().annotation?.annotationId,commentThreadId:this.componentConfigSignal().editComment?.commentId,commentType:this.commentService.getCommentType(this.componentConfigSignal().annotation),uiLocation:this.componentConfigSignal().sidebarMode?"sidebar":"dialog",commentMode:this.commentService.getCommentMode(),attachmentSize:s.size,attachmentType:s.type})}this.componentConfigSignal.update(a=>(a=T(I({},a),{uploadingAttachments:!0}),a));let r=yield this.uploadFiles();this.componentConfigSignal.update(a=>(a=T(I({},a),{selectedAttachments:[...a.selectedAttachments,...r],uploadingAttachments:!1}),a)),this.updateOverlayPositionEmit(),this.checkGetAnnotationDraftAttribute()}catch(r){this.componentConfigSignal.update(a=>(a=T(I({},a),{uploadingAttachments:!1}),a)),this.catchError("Error in CommentDialogComponent selectFiles: ",r)}})}removeAttachmentFromComment(e){try{if(this.componentConfigSignal().editComment){let i=this.componentConfigSignal().editComment?.attachments?.splice(e,1);i?.length&&this.componentConfigSignal.update(r=>(r=T(I({},r),{attachmentsToDelete:[...r.attachmentsToDelete,...i]}),r))}this.checkGetAnnotationDraftAttribute()}catch(i){this.catchError("Error in CommentDialogComponent removeAttachmentFromComment: ",i)}}removeFile(e){return Q(this,null,function*(){try{this.componentConfigSignal.update(r=>(r=I({},r),r.selectedFiles.splice(e,1),r));let i=this.componentConfigSignal().selectedAttachments.splice(e,1);yield this.deleteAttachments(i),this.checkGetAnnotationDraftAttribute()}catch(i){this.catchError("Error in CommentDialogComponent removeFile: ",i)}})}removeInvalidFile(e){try{this.componentConfigSignal.update(i=>(i=I({},i),i.invalidSelectedFiles.splice(e,1),i))}catch(i){this.catchError("Error in CommentDialogComponent removeInvalidFile: ",i)}}uploadFiles(){return Q(this,null,function*(){try{let e=[];for(let i=0;i<this.componentConfigSignal().selectedFiles.length;i++){let r=this.componentConfigSignal().selectedFiles[i];if(!r.uploaded&&!r.uploading){r.uploading=!0;let a=r.file;try{let[s]=yield this.commentActionsService.addAttachment({annotationId:this.componentConfigSignal().annotation?.annotationId,files:[a]},"internal"),m=s?.attachment;m&&(this.analyticsService.trackEvent(X.Events.Comments.COMMENT_ATTACHMENT_ADDED,{annotationId:this.componentConfigSignal().annotation?.annotationId,commentThreadId:this.componentConfigSignal().editComment?.commentId,commentType:this.commentService.getCommentType(this.componentConfigSignal().annotation),uiLocation:this.componentConfigSignal().sidebarMode?"sidebar":"dialog",commentMode:this.commentService.getCommentMode(),attachmentId:m.attachmentId,attachmentSize:m.size,attachmentType:m.type}),e.push(m)),r.uploaded=!0,r.uploading=!1}catch(s){this.catchError("Error in CommentDialogComponent uploadFiles: ",s)}}}return e}catch(e){return this.catchError("Error in CommentDialogComponent uploadFiles: ",e),[]}})}downloadAttachment(e){this.commentService.downloadAttachment(e),this.analyticsService.trackEvent(X.Events.Comments.COMMENT_ATTACHMENT_DOWNLOADED,{annotationId:this.componentConfigSignal().annotation?.annotationId,commentThreadId:this.componentConfigSignal().editComment?.commentId,commentType:this.commentService.getCommentType(this.componentConfigSignal().annotation),uiLocation:this.componentConfigSignal().sidebarMode?"sidebar":"dialog",commentMode:this.commentService.getCommentMode(),attachmentId:e.attachmentId,attachmentSize:e.size,attachmentType:e.type})}removeAttachment(e,i){return Q(this,null,function*(){try{let r=[i.attachments?.[e]];r?.length&&r.forEach(a=>{a&&this.commentActionsService.deleteAttachment({annotationId:this.componentConfigSignal().annotation?.annotationId,commentId:i.commentId,attachmentId:a.attachmentId})})}catch(r){this.catchError("Error in CommentDialogComponent removeAttachment: ",r)}})}deleteAttachments(e){return Q(this,null,function*(){try{for(let i=0;i<e.length;i++){let r=e[i];yield this.commentService.deleteAttachment({attachment:r}),this.analyticsService.trackEvent(X.Events.Comments.COMMENT_ATTACHMENT_DELETED,{annotationId:this.componentConfigSignal().annotation?.annotationId,commentThreadId:this.componentConfigSignal().editComment?.commentId,commentType:this.commentService.getCommentType(this.componentConfigSignal().annotation),uiLocation:this.componentConfigSignal().sidebarMode?"sidebar":"dialog",commentMode:this.commentService.getCommentMode(),attachmentId:r.attachmentId,attachmentSize:r.size,attachmentType:r.type})}}catch(i){this.catchError("Error in CommentDialogComponent deleteAttachments: ",i)}})}updateOrDeleteComment(e,i){try{if(e?.commentText?.trim()||e?.attachments?.length||e?.recorders?.length){let r={annotation:this.componentConfigSignal().annotation,updatedComment:e,type:Ut.UPDATED};this.saveComment.emit(r)}else this.deleteComment(e,i)}catch(r){this.catchError("Error in CommentDialogComponent updateOrDeleteComment: ",r)}}onRecordedData(e){this.componentConfigSignal.update(i=>(i=T(I({},i),{localRecordedData:[...i.localRecordedData,e]}),i)),this.domService.setRecordingInProgress(this.componentConfigSignal().annotation?.annotationId,!1),this.checkGetAnnotationDraftAttribute()}initRecording(e){try{this.analyticsService.trackEvent(X.Events.Comments.COMMENT_RECORDING_TOOL_CLICKED,{annotationId:this.componentConfigSignal().annotation?.annotationId,commentThreadId:this.componentConfigSignal().editComment?.commentId,commentType:this.commentService.getCommentType(this.componentConfigSignal().annotation),uiLocation:this.componentConfigSignal().sidebarMode?"sidebar":"dialog",commentMode:this.commentService.getCommentMode(),recorderType:e});let i=this.componentConfigSignal()?.annotation?.metadata?.clientDocumentId;this.recorderService.initRecording(e,this.componentConfigSignal().commentDialogUniqueId,!0,this.componentConfigSignal().darkMode,this.componentConfigSignal().dialogShadowDOM,this.componentConfigSignal().annotation?.annotationId,i)}catch(i){this.catchError("Error in CommentDialogComponent initRecording: ",i)}}onDeleteRecorderAnnotation(e,i){try{this.componentConfigSignal.update(r=>(r=T(I({},r),{localRecordedData:r.localRecordedData.filter(a=>a.id!==e.annotationId)}),r)),this.analyticsService.trackEvent(X.Events.Comments.COMMENT_RECORDING_DELETED,{annotationId:this.componentConfigSignal().annotation?.annotationId,commentThreadId:this.componentConfigSignal().editComment?.commentId,commentType:this.commentService.getCommentType(this.componentConfigSignal().annotation),uiLocation:this.componentConfigSignal().sidebarMode?"sidebar":"dialog",commentMode:this.commentService.getCommentMode(),recorderId:e.annotationId,recorderType:e.recordingType,recorderSize:e?.attachments?.length?e?.attachments[0]?.size:e?.attachment?.size}),i?.commentId&&this.commentActionsService.deleteRecording({annotationId:this.componentConfigSignal().annotation?.annotationId,commentId:i.commentId,recorderId:e.annotationId}),this.checkGetAnnotationDraftAttribute()}catch(r){this.catchError("Error in CommentDialogComponent onDeleteRecorderAnnotation: ",r)}}playOrPauseVideo(e){try{e&&(e.duration>0&&!e.paused?e.pause():e.currentTime>0&&!e.paused&&!e.ended&&e.readyState>e.HAVE_CURRENT_DATA||e.play())}catch(i){this.catchError("Error in CommentDialogComponent playOrPauseVideo: ",i)}}changeStatus(e){try{this.commentActionsService.updateStatus({annotationId:this.componentConfigSignal().annotation?.annotationId,status:e.status})}catch(i){this.catchError("Error in CommentDialogComponent changeStatus: ",i)}}changePriorityLocally(e){try{e.priority!==void 0&&e.priority.id===this.componentConfigSignal().annotation?.priority?.id&&(e.priority=void 0),this.componentConfigSignal.update(i=>(i=T(I({},i),{annotation:T(I({},i.annotation),{priority:e.priority})}),i))}catch(i){this.catchError("Error in CommentDialogComponent changePriorityLocally: ",i)}}changePriority(e){try{this.commentActionsService.updatePriority({annotationId:this.componentConfigSignal().annotation?.annotationId,priority:e.priority})}catch(i){this.catchError("Error in CommentDialogComponent changePriority: ",i)}}onChipSelect(e){try{let i=this.componentConfigSignal().annotation?.customList||[],r=i.find(p=>p.id===e.id),a=[];this.componentConfigSignal().customChipData?.type==="single"?r?a=[]:a=[e]:r?a=i.filter(p=>p.id!==e.id):a=[...i,e],this.analyticsService.trackEvent(X.Events.Comments.COMMENT_CUSTOM_CHIPS_CHANGED,{annotationId:this.componentConfigSignal().annotation?.annotationId,commentType:this.commentService.getCommentType(this.componentConfigSignal().annotation),uiLocation:this.componentConfigSignal().sidebarMode?"sidebar":"dialog",oldCustomList:this.componentConfigSignal().annotation?.customList?.map(p=>p.id),newCustomList:a.map(p=>p.id),commentMode:this.commentService.getCommentMode(),customChipsMode:this.componentConfigSignal().customChipData?.type});let s=JSON.parse(JSON.stringify(this.componentConfigSignal().annotation||{}));this.componentConfigSignal.update(p=>(p=T(I({},p),{annotation:T(I({},p.annotation),{customList:a?.slice()})}),p));let m={annotation:this.componentConfigSignal().annotation,type:Ut.CUSTOM_LIST_CHANGED,oldCustomList:s.customList,newCustomList:a};this.updateSelectedCustomChipSet(),this.componentConfigSignal().annotation.annotationId&&this.saveComment.emit(m)}catch(i){this.catchError("Error in CommentDialogComponent onChipSelect: ",i)}}updateSelectedCustomChipSet(){try{this.componentConfigSignal.update(e=>(e=T(I({},e),{selectedCustomChipSet:new Set(e.annotation?.customList?.map(i=>i.id))}),e))}catch(e){this.catchError("Error in CommentDialogComponent updateSelectedCustomChipSet: ",e)}}onClick(){try{this.loggingService.log("%c[WB] Calling FUNCTION: onClick","color: green;");let e=this.domService.getSelectedAnnotationsMap();if(e&&!e[this.componentConfigSignal().annotation?.annotationId]){let i=this.componentConfigSignal().annotation?.multiThreadAnnotationId,r=!0;i&&(this.domService.toggleAnnotationSelection(this.componentConfigSignal().annotation,this.componentConfigSignal().containerComponentId),r=!1),r&&this.domService.resetSelectedAnnotationsMap()}this.componentConfigSignal.update(i=>(i=T(I({},i),{composerInOpenState:!1}),i))}catch(e){this.catchError("Error in CommentDialogComponent onClick: ",e)}}onPointerOutCommentDialog(e){try{this.componentConfigSignal().commentsContainer?.nativeElement?.contains(e?.relatedTarget)||this.pointerOutFromCommentDialog.next(e)}catch(i){this.catchError("Error in CommentDialogComponent onPointerOutCommentDialog: ",i)}}onPointerUp(){try{this.pointerUp.next()}catch(e){this.catchError("Error in CommentDialogComponent onPointerUp: ",e)}}onMoreRepliesClick(){try{this.analyticsService.trackEvent(X.Events.Comments.COMMENT_MORE_REPLY_OPTION_CLICKED,{annotationId:this.componentConfigSignal().annotation?.annotationId,commentType:this.commentService.getCommentType(this.componentConfigSignal().annotation),uiLocation:this.componentConfigSignal().sidebarMode?"sidebar":"dialog",commentMode:this.commentService.getCommentMode()}),this.componentConfigSignal.update(e=>(e=T(I({},e),{showAllComments:!e.showAllComments}),e))}catch(e){this.catchError("Error in CommentDialogComponent onMoreRepliesClick: ",e)}}checkCommentDialogSelected(){try{let e=this.componentConfigSignal().commentPinSelected,i=this.componentConfigSignal().fullExpanded,r=e||i;r!==this.componentConfigSignal().commentDialogSelected&&this.componentConfigSignal.update(a=>(a=T(I({},a),{commentDialogSelected:r}),a))}catch(e){this.catchError("Error in CommentDialogComponent checkCommentDialogSelected: ",e)}}checkIsKnownUser(){try{this.componentConfigSignal().user&&!this.componentConfigSignal().user?.isReadOnly&&!this.componentConfigSignal().user?.isAnonymous?this.componentConfigSignal.update(e=>(e=T(I({},e),{isKnownUser:!0}),e)):this.componentConfigSignal.update(e=>(e=T(I({},e),{isKnownUser:!1}),e))}catch(e){this.catchError("Error in CommentDialogComponent checkIsKnownUser: ",e)}}checkDialogSelectedByKnownUser(){try{this.componentConfigSignal().user&&this.componentConfigSignal().isKnownUser?this.componentConfigSignal.update(e=>(e=T(I({},e),{dialogSelectedByKnownUser:!0}),e)):this.componentConfigSignal.update(e=>(e=T(I({},e),{dialogSelectedByKnownUser:!1}),e))}catch(e){this.catchError("Error in CommentDialogComponent checkDialogSelectedByKnownUser: ",e)}}checkCanResolveAnnotation(){try{this.componentConfigSignal().annotation&&!this.componentConfigSignal().disabled&&this.componentConfigSignal().enableResolve&&this.componentConfigSignal().dialogSelectedByKnownUser&&this.componentConfigSignal().annotation?.status?.type!=="terminal"&&!this.componentConfigSignal().isPlanExpired?this.componentConfigSignal.update(e=>(e=T(I({},e),{canResolveAnnotation:!0}),e)):this.componentConfigSignal.update(e=>(e=T(I({},e),{canResolveAnnotation:!1}),e))}catch(e){this.catchError("Error in CommentDialogComponent checkCanResolveAnnotation: ",e)}}checkCanUnresolveAnnotation(){try{this.componentConfigSignal().annotation&&!this.componentConfigSignal().disabled&&this.componentConfigSignal().enableResolve&&this.componentConfigSignal().dialogSelectedByKnownUser&&this.componentConfigSignal().annotation?.status?.type==="terminal"&&!this.componentConfigSignal().isPlanExpired?this.componentConfigSignal.update(e=>(e=T(I({},e),{canUnresolveAnnotation:!0}),e)):this.componentConfigSignal.update(e=>(e=T(I({},e),{canUnresolveAnnotation:!1}),e))}catch(e){this.catchError("Error in CommentDialogComponent checkCanUnresolveAnnotation: ",e)}}checkGetAnnotationDraftAttribute(){try{this.componentConfigSignal().newCommentTextArea?.nativeElement?.innerText&&this.componentConfigSignal().newCommentTextArea?.nativeElement?.innerText!==`
414
414
  `||this.componentConfigSignal().editCommentTextArea?.nativeElement?.innerText&&this.componentConfigSignal().editCommentTextArea?.nativeElement?.innerText!==`
415
- `||this.componentConfigSignal().selectedAttachments?.length||this.componentConfigSignal().attachmentsToDelete?.length||this.componentConfigSignal().recorderInitConfig&&this.componentConfigSignal().recorderInitConfig?.panelId===this.componentConfigSignal().commentDialogUniqueId||this.componentConfigSignal().localRecordedData?.length?this.componentConfigSignal.update(e=>(e=T(I({},e),{getAnnotationDraftAttribute:e.annotation?.annotationId}),e)):this.componentConfigSignal.update(e=>(e=T(I({},e),{getAnnotationDraftAttribute:null}),e))}catch(e){this.catchError("Error in CommentDialogComponent checkGetAnnotationDraftAttribute: ",e)}}checkShowGhostCommentMessage(){try{this.componentConfigSignal().ghostComment&&this.componentConfigSignal().enableGhostCommentsMessage&&![this.componentConfigSignal().commentAcceptedStatus?.id,this.componentConfigSignal().commentRejectedStatus?.id].includes(this.componentConfigSignal().annotation?.status?.id)?this.componentConfigSignal.update(e=>(e=T(I({},e),{showGhostCommentMessage:!0}),e)):this.componentConfigSignal.update(e=>(e=T(I({},e),{showGhostCommentMessage:!1}),e))}catch(e){this.catchError("Error in CommentDialogComponent checkShowGhostCommentMessage: ",e)}}checkShowSuggestionModeActions(){try{this.componentConfigSignal().suggestionMode&&this.componentConfigSignal().dialogSelectedByKnownUser&&this.componentConfigSignal().annotation?.status?.type!=="terminal"&&this.componentConfigSignal().annotation?.comments?.length?this.componentConfigSignal.update(e=>(e=T(I({},e),{showSuggestionModeActions:!0}),e)):this.componentConfigSignal.update(e=>(e=T(I({},e),{showSuggestionModeActions:!1}),e))}catch(e){this.catchError("Error in CommentDialogComponent checkShowSuggestionModeActions: ",e)}}ngOnDestroy(){super.ngOnDestroy(),this.loggingService.log("%c[WB] Calling FUNCTION: unsubscribe","color: green;");try{this.veltDynamicComponents.forEach(e=>{e.destroy()}),this.subscriptions.map(e=>{e.unsubscribe()}),this.domService.setRecordingInProgress(this.componentConfigSignal().annotation?.annotationId,!1),this.subscriptions=[],this.componentConfigSignal().recorderInitConfig?.panelId===this.componentConfigSignal().commentDialogUniqueId&&this.recorderService.clearRecording(),this.resizeObserver&&this.componentConfigSignal().commentsContainer?.nativeElement&&this.resizeObserver.unobserve(this.componentConfigSignal().commentsContainer?.nativeElement),clearTimeout(this.escapePressTimeout),this.componentConfigSignal().getAnnotationDraftAttribute&&this.commentService.getDraftMode()&&!this.componentConfigSignal().editComment&&this.componentConfigSignal().getAnnotationDraftAttribute&&this.addComment(void 0,!0)}catch(e){this.catchError("Error in CommentDialogComponent unsubscribe: ",e)}}closeDialog(){try{this.domService.resetSelectedAnnotationsMap()}catch(e){this.catchError("Error in CommentDialogComponent closeDialog: ",e)}}openDropdownIndex(e){try{this.componentConfigSignal.update(i=>(i=T(I({},i),{openDropdownIndexValue:e}),i))}catch(i){this.catchError("Error in CommentDialogComponent openDropdownIndex: ",i)}}navigateToCommentEmit(){try{this.onCommentNavigationButtonClick.emit(this.componentConfigSignal().annotation)}catch(e){this.catchError("Error in CommentDialogComponent navigateToComment: ",e)}}moveCursorToEnd(e){try{if(!e?.isConnected)return;e.focus(),setTimeout(()=>{let i=document.createRange(),r=window.getSelection();i.selectNodeContents(e),i.collapse(!1),r?.removeAllRanges(),r?.addRange(i)},0)}catch(i){this.catchError("Error in CommentDialogComponent moveCursorToEnd: ",i)}}focusOnComposerInput(){try{this.onComposerClick();let e=dre();this.componentConfigSignal().newCommentTextArea?.nativeElement&&(this.componentConfigSignal().newCommentTextArea.nativeElement?.contains(e)||this.moveCursorToEnd(this.componentConfigSignal().newCommentTextArea.nativeElement)),this.componentConfigSignal().editCommentTextArea?.nativeElement&&(this.componentConfigSignal().editCommentTextArea.nativeElement?.contains(e)||this.moveCursorToEnd(this.componentConfigSignal().editCommentTextArea.nativeElement))}catch(e){this.catchError("Error in CommentDialogComponent focusOnComposerInput: ",e)}}onComposerClick(){try{this.commentActionsService?.onComposerClick({commentAnnotation:this.componentConfigSignal().annotation}),this.componentConfigSignal().commentPinSelected||(this.componentConfigSignal().sidebarMode?this.domService.toggleAnnotationSelection(this.componentConfigSignal().annotation,this.componentConfigSignal().containerComponentId,"sidebarShowReplies"):this.domService.toggleAnnotationSelection(this.componentConfigSignal().annotation,this.componentConfigSignal().containerComponentId))}catch(e){this.catchError("Error in CommentDialogComponent onComposerClick: ",e)}}getCurrentDialogView(){try{let e={};if(this.componentConfigSignal().annotation?.annotationId){let i=this.componentConfigSignal().commentViews?.[this.componentConfigSignal().annotation?.annotationId]?.comments;Object.keys(i||{}).forEach(r=>{let a=[],s=0;Object.keys(i[r]?.views||{}).forEach(m=>{let p={};p.user=this.componentConfigSignal().userContactsBySnippylyId?.[m],p.viewedAt=i[r]?.views?.[m]?.timestamp,p.user?.userId!==this.componentConfigSignal().user?.userId&&(a.push(p),(p.user?.email||p.user?.name)&&s++)}),e[r]={count:s,views:a}})}this.componentConfigSignal.update(i=>(i=T(I({},i),{currentDialogView:e}),i))}catch(e){this.catchError("Error in CommentDialogComponent getCurrentDialogView: ",e)}}catchError(e,i,r){try{this.loggingService.catch(e,i,T(I({},r||{}),{annotationId:this.componentConfigSignal()?.annotation?.annotationId}))}catch{}}};o.\u0275fac=function(i){return new(i||o)(u(Ze),u(He),u(we),u(ii),u(l9),u(Ci),u(Ne),u(ui),u(Ls),u(r_),u(y),u(zo),u(fn),u(nr),u(es),u(Ye),u(k),u(Wi),u(ze),u(lt),u(Tn),u(Kt),u(dc,8))},o.\u0275cmp=O({type:o,selectors:[["snippyly-comment-dialog"]],viewQuery:function(i,r){if(i&1&&(ot(njt,5),ot(ijt,5),ot(ojt,5),ot(Efe,7),ot(Efe,5,Si)),i&2){let a;Qe(a=Je())&&(r.commentsContainer=a.first),Qe(a=Je())&&(r.newCommentTextArea=a.first),Qe(a=Je())&&(r.editCommentTextArea=a.first),Qe(a=Je())&&(r.hostElement=a.first),Qe(a=Je())&&(r.hostViewContainer=a.first)}},hostVars:1,hostBindings:function(i,r){i&2&&x("data-velt-element",r.veltElement)},inputs:{snippylyReadId:"snippylyReadId",screenshotDomain:"screenshotDomain",annotationIndex:"annotationIndex",userContacts:"userContacts",annotation:"annotation",user:"user",dialogMode:"dialogMode",sidebarMode:"sidebarMode",fullExpanded:"fullExpanded",inboxMode:"inboxMode",multiThread:"multiThread",inlineCommentMode:"inlineCommentMode",inlineCommentSectionMode:"inlineCommentSectionMode",commentComposerMode:"commentComposerMode",isInsidePdfViewer:"isInsidePdfViewer",locationDisplayName:"locationDisplayName",locationVersion:"locationVersion",commentPinSelected:"commentPinSelected",variant:"variant",shadowDom:"shadowDom",commentPinType:"commentPinType",composerMode:"composerMode",containerComponentId:"containerComponentId",focusedThreadMode:"focusedThreadMode",isFocusedThreadEnabled:"isFocusedThreadEnabled",pageModeComposer:"pageModeComposer",composerPosition:"composerPosition",sortBy:"sortBy",sortOrder:"sortOrder",dialogTemplate:"dialogTemplate"},outputs:{deleteCommentThread:"deleteCommentThread",saveComment:"saveComment",afterViewInit:"afterViewInit",signInToAccessFeature:"signInToAccessFeature",pointerOutFromCommentDialog:"pointerOutFromCommentDialog",pointerUp:"pointerUp",updateOverlayPosition:"updateOverlayPosition",onCommentNavigationButtonClick:"onCommentNavigationButtonClick"},standalone:!1,features:[B,Xe],decls:4,vars:66,consts:[["host","","commentsContainer",""],["defaultDialogRef",""],["commentsContainer",""],[1,"modal-div","velt-comment-dialog",3,"click","pointerout","pointerdown","pointerup"],[4,"ngIf"],[4,"ngIf","ngIfElse"],[4,"ngTemplateOutlet"],["part","container","class","modal-div velt-comment-dialog",3,"dialog","velt-comment-dialog--dialog-mode","bottom-sheet","velt-comment-dialog--bottom-sheet","inbox","velt-comment-dialog--inbox-mode","readonly","velt-comment-dialog--readonly","no-comments","velt-comment-dialog--no-comments","selected","velt-comment-dialog--selected","screen-recording","velt-comment-dialog--screen-recording","s-ghost-comment-annotation","velt-comment-dialog--ghost-comment-annotation","inline-comment-mode","velt-comment-dialog--inline-comment-mode","velt-comment-dialog--multi-thread-mode","velt-comment-dialog--page-comment","velt-comment-dialog--inline-comment-section-mode","velt-comment-dialog--comment-composer-mode","velt-comment-dialog--focused-thread-mode","velt-comment-dialog--page-mode-composer","private-comment","velt-comment-dialog--private-comment","click","pointerout","pointerdown","pointerup",4,"ngIf"],["part","container","class","modal-div velt-comment-dialog",3,"dialog","velt-comment-dialog--dialog-mode","sidebar","velt-comment-dialog--sidebar-mode","bottom-sheet","velt-comment-dialog--bottom-sheet","readonly","velt-comment-dialog--readonly","no-comments","velt-comment-dialog--no-comments","selected","velt-comment-dialog--selected","screen-recording","velt-comment-dialog--screen-recording","s-ghost-comment-annotation","velt-comment-dialog--focused-thread-mode","velt-comment-dialog--ghost-comment-annotation","velt-comment-dialog--page-mode-composer","private-comment","velt-comment-dialog--private-comment","click","pointerout","pointerdown","pointerup",4,"ngIf"],["part","container","class","modal-div velt-comment-dialog",3,"dialog","velt-comment-dialog--dialog-mode","bottom-sheet","velt-comment-dialog--bottom-sheet","inbox","velt-comment-dialog--inbox-mode","readonly","velt-comment-dialog--readonly","no-comments","velt-comment-dialog--no-comments","selected","velt-comment-dialog--selected","screen-recording","velt-comment-dialog--screen-recording","s-ghost-comment-annotation","velt-comment-dialog--ghost-comment-annotation","inline-comment-mode","velt-comment-dialog--inline-comment-mode","velt-comment-dialog--multi-thread-mode","velt-comment-dialog--page-comment","velt-comment-dialog--focused-thread-mode","velt-comment-dialog--inline-comment-section-mode","velt-comment-dialog--comment-composer-mode","velt-comment-dialog--page-mode-composer","private-comment","velt-comment-dialog--private-comment","click","pointerout","pointerdown","pointerup",4,"ngIf"],["part","container",1,"modal-div","velt-comment-dialog",3,"click","pointerout","pointerdown","pointerup"],[3,"componentConfigSignal"],["class","line-div velt-comment-dialog--line-div",4,"ngIf"],["class","velt-action-bar velt-comment-dialog--action-bar",4,"ngIf"],[1,"line-div","velt-comment-dialog--line-div"],[1,"velt-action-bar","velt-comment-dialog--action-bar"],[3,"componentConfigSignal",4,"ngIf"],["class","velt-comment-dialog--action-bar-group",4,"ngIf"],[1,"velt-comment-dialog--action-bar-group"]],template:function(i,r){if(i&1){let a=q();C(0,"div",3,0),G("click",function(){return N(a),F(r.onClick())})("pointerout",function(m){return N(a),r.onPointerOutCommentDialog(m),F(m.stopPropagation())})("pointerdown",function(m){return N(a),F(m.stopPropagation())})("pointerup",function(m){return N(a),r.onPointerUp(),F(m.stopPropagation())}),S(),g(3,Ojt,4,1,"ng-container",4)}if(i&2){let a,s,m,p,h,_,E,D,L,H,K,oe,ue,be,Le,qe,Re,_e,Ee,Oe,ye,fe,Be,xe,wn,$t,ft,Ot,Mt,ln,no,oi,Ri,pn,_i;ge("sidebar",(a=r.componentConfigSignal())==null?null:a.sidebarMode)("velt-comment-dialog--sidebar-mode",(s=r.componentConfigSignal())==null?null:s.sidebarMode)("dialog",(m=r.componentConfigSignal())==null?null:m.dialogMode)("velt-comment-dialog--dialog-mode",(p=r.componentConfigSignal())==null?null:p.dialogMode)("hide",(h=r.componentConfigSignal())==null?null:h.showDefault)("velt-comment-dialog--hide",(_=r.componentConfigSignal())==null?null:_.showDefault)("bottom-sheet",(E=r.componentConfigSignal())==null?null:E.bottomSheetMode)("velt-comment-dialog--bottom-sheet",(D=r.componentConfigSignal())==null?null:D.bottomSheetMode)("inbox",(L=r.componentConfigSignal())==null?null:L.inboxMode)("velt-comment-dialog--inbox-mode",(H=r.componentConfigSignal())==null?null:H.inboxMode)("readonly",((K=r.componentConfigSignal())==null||K.user==null?null:K.user.isReadOnly)||((K=r.componentConfigSignal())==null||K.user==null?null:K.user.isAnonymous))("velt-comment-dialog--readonly",((oe=r.componentConfigSignal())==null||oe.user==null?null:oe.user.isReadOnly)||((oe=r.componentConfigSignal())==null||oe.user==null?null:oe.user.isAnonymous))("no-comments",!(!((ue=r.componentConfigSignal())==null||ue.annotation==null||ue.annotation.comments==null)&&ue.annotation.comments.length))("velt-comment-dialog--no-comments",!(!((be=r.componentConfigSignal())==null||be.annotation==null||be.annotation.comments==null)&&be.annotation.comments.length))("selected",(Le=r.componentConfigSignal())==null?null:Le.commentDialogSelected)("velt-comment-dialog--selected",(qe=r.componentConfigSignal())==null?null:qe.commentDialogSelected)("screen-recording",((Re=r.componentConfigSignal())==null||Re.recorderInitConfig==null?null:Re.recorderInitConfig.type)==="screen")("velt-comment-dialog--screen-recording",((_e=r.componentConfigSignal())==null||_e.recorderInitConfig==null?null:_e.recorderInitConfig.type)==="screen")("s-ghost-comment-annotation",(Ee=r.componentConfigSignal())==null?null:Ee.showGhostCommentMessage)("velt-comment-dialog--ghost-comment-annotation",(Oe=r.componentConfigSignal())==null?null:Oe.showGhostCommentMessage)("velt-comment-dialog--focused-thread-mode",(ye=r.componentConfigSignal())==null?null:ye.focusedThreadMode)("inline-comment-mode",((fe=r.componentConfigSignal())==null?null:fe.inlineCommentMode)&&!((fe=r.componentConfigSignal())!=null&&fe.isInsidePdfViewer))("velt-comment-dialog--page-comment",(Be=r.componentConfigSignal())==null||Be.annotation==null?null:Be.annotation.isPageAnnotation)("velt-comment-dialog--inline-comment-mode",((xe=r.componentConfigSignal())==null?null:xe.inlineCommentMode)&&!((xe=r.componentConfigSignal())!=null&&xe.isInsidePdfViewer))("velt-comment-dialog--multi-thread-mode",(wn=r.componentConfigSignal())==null?null:wn.multiThread)("velt-comment-dialog--comment-composer-mode",($t=r.componentConfigSignal())==null?null:$t.commentComposerMode)("velt-comment-dialog--page-mode-composer",(ft=r.componentConfigSignal())==null?null:ft.pageModeComposer)("private-comment",(Ot=r.componentConfigSignal())==null?null:Ot.isPrivateComment)("velt-comment-dialog--private-comment",(Mt=r.componentConfigSignal())==null?null:Mt.isPrivateComment),x("data-velt-annotation-draft",(ln=r.componentConfigSignal())==null?null:ln.getAnnotationDraftAttribute)("data-velt-annotation-edit-comment",(no=r.componentConfigSignal())!=null&&no.editComment?!0:void 0)("data-velt-comment-dialog-comments-count",((oi=r.componentConfigSignal())==null||oi.annotation==null||oi.annotation.comments==null?null:oi.annotation.comments.length)||"0")("data-velt-comment-dialog-comments-status",(Ri=r.componentConfigSignal())==null||Ri.annotation==null||Ri.annotation.status==null?null:Ri.annotation.status.id)("data-velt-comment-dialog-comments-status-type",(pn=r.componentConfigSignal())==null||pn.annotation==null||pn.annotation.status==null?null:pn.annotation.status.type)("data-velt-comment-dialog-comments-priority",(_i=r.componentConfigSignal())==null||_i.annotation==null||_i.annotation.priority==null?null:_i.annotation.priority.id)("data-testid",r.componentId+"-root"),d(3),c("ngIf",r.componentConfigSignal())}},dependencies:[Z,vt,N0,P0,F0,A0,R0,lh,w0,B0,O0,j0,V0,tn,GC],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}[_nghost-%COMP%]{--velt-green: var(--velt-light-mode-green);--velt-magenta: var(--velt-light-mode-magenta);--velt-amber: var(--velt-light-mode-amber);--velt-purple: var(--velt-light-mode-purple);--velt-cyan: var(--velt-light-mode-cyan);--velt-orange: var(--velt-light-mode-orange);--velt-black: var(--velt-light-mode-black);--velt-white: var(--velt-light-mode-white);--velt-gray: var(--velt-light-mode-gray);--velt-error: var(--velt-light-mode-error);--velt-error-hover: var(--velt-light-mode-error-hover);--velt-error-foreground: var(--velt-light-mode-error-foreground);--velt-error-light: var(--velt-light-mode-error-light);--velt-error-transparent: var(--velt-light-mode-error-transparent);--velt-warning: var(--velt-light-mode-warning);--velt-warning-hover: var(--velt-light-mode-warning-hover);--velt-warning-foreground: var(--velt-light-mode-warning-foreground);--velt-warning-light: var(--velt-light-mode-warning-light);--velt-warning-transparent: var(--velt-light-mode-warning-transparent);--velt-success: var(--velt-light-mode-success);--velt-success-hover: var(--velt-light-mode-success-hover);--velt-success-foreground: var(--velt-light-mode-success-foreground);--velt-success-light: var(--velt-light-mode-success-light);--velt-success-transparent: var(--velt-light-mode-success-transparent);--velt-accent: var(--velt-light-mode-accent);--velt-accent-text: var(--velt-light-mode-accent-text);--velt-accent-hover: var(--velt-light-mode-accent-hover);--velt-accent-foreground: var(--velt-light-mode-accent-foreground);--velt-accent-light: var(--velt-light-mode-accent-light);--velt-accent-transparent: var(--velt-light-mode-accent-transparent);--velt-text-0: var(--velt-light-mode-text-0);--velt-text-1: var(--velt-light-mode-text-1);--velt-text-2: var(--velt-light-mode-text-2);--velt-text-3: var(--velt-light-mode-text-3);--velt-text-4: var(--velt-light-mode-text-4);--velt-text-5: var(--velt-light-mode-text-5);--velt-text-6: var(--velt-light-mode-text-6);--velt-text-7: var(--velt-light-mode-text-7);--velt-text-8: var(--velt-light-mode-text-8);--velt-text-9: var(--velt-light-mode-text-9);--velt-text-10: var(--velt-light-mode-text-10);--velt-text-11: var(--velt-light-mode-text-11);--velt-text-12: var(--velt-light-mode-text-12);--velt-background-0: var(--velt-light-mode-background-0);--velt-background-1: var(--velt-light-mode-background-1);--velt-background-2: var(--velt-light-mode-background-2);--velt-background-3: var(--velt-light-mode-background-3);--velt-background-4: var(--velt-light-mode-background-4);--velt-background-5: var(--velt-light-mode-background-5);--velt-background-6: var(--velt-light-mode-background-6);--velt-background-7: var(--velt-light-mode-background-7);--velt-background-8: var(--velt-light-mode-background-8);--velt-background-9: var(--velt-light-mode-background-9);--velt-background-10: var(--velt-light-mode-background-10);--velt-border-0: var(--velt-light-mode-border-0);--velt-border-1: var(--velt-light-mode-border-1);--velt-border-2: var(--velt-light-mode-border-2);--velt-border-3: var(--velt-light-mode-border-3);--velt-border-4: var(--velt-light-mode-border-4);--velt-border-5: var(--velt-light-mode-border-5);--velt-border-6: var(--velt-light-mode-border-6);--velt-border-7: var(--velt-light-mode-border-7);--velt-border-8: var(--velt-light-mode-border-8);--velt-border-9: var(--velt-light-mode-border-9);--velt-border-10: var(--velt-light-mode-border-10);--velt-background-transparent: var(--velt-light-mode-background-transparent);--velt-border-transparent: var(--velt-light-mode-border-transparent);--velt-animation-transparent: var(--velt-light-mode-animation-transparent)}[dark][_nghost-%COMP%]{--velt-green: var(--velt-dark-mode-green);--velt-magenta: var(--velt-dark-mode-magenta);--velt-amber: var(--velt-dark-mode-amber);--velt-purple: var(--velt-dark-mode-purple);--velt-cyan: var(--velt-dark-mode-cyan);--velt-orange: var(--velt-dark-mode-orange);--velt-black: var(--velt-dark-mode-black);--velt-white: var(--velt-dark-mode-white);--velt-gray: var(--velt-dark-mode-gray);--velt-error: var(--velt-dark-mode-error);--velt-error-hover: var(--velt-dark-mode-error-hover);--velt-error-foreground: var(--velt-dark-mode-error-foreground);--velt-error-light: var(--velt-dark-mode-error-light);--velt-error-transparent: var(--velt-dark-mode-error-transparent);--velt-warning: var(--velt-dark-mode-warning);--velt-warning-hover: var(--velt-dark-mode-warning-hover);--velt-warning-foreground: var(--velt-dark-mode-warning-foreground);--velt-warning-light: var(--velt-dark-mode-warning-light);--velt-warning-transparent: var(--velt-dark-mode-warning-transparent);--velt-success: var(--velt-dark-mode-success);--velt-success-hover: var(--velt-dark-mode-success-hover);--velt-success-foreground: var(--velt-dark-mode-success-foreground);--velt-success-light: var(--velt-dark-mode-success-light);--velt-success-transparent: var(--velt-dark-mode-success-transparent);--velt-accent: var(--velt-dark-mode-accent);--velt-accent-text: var(--velt-dark-mode-accent-text);--velt-accent-hover: var(--velt-dark-mode-accent-hover);--velt-accent-foreground: var(--velt-dark-mode-accent-foreground);--velt-accent-light: var(--velt-dark-mode-accent-light);--velt-accent-transparent: var(--velt-dark-mode-accent-transparent);--velt-text-0: var(--velt-dark-mode-text-0);--velt-text-1: var(--velt-dark-mode-text-1);--velt-text-2: var(--velt-dark-mode-text-2);--velt-text-3: var(--velt-dark-mode-text-3);--velt-text-4: var(--velt-dark-mode-text-4);--velt-text-5: var(--velt-dark-mode-text-5);--velt-text-6: var(--velt-dark-mode-text-6);--velt-text-7: var(--velt-dark-mode-text-7);--velt-text-8: var(--velt-dark-mode-text-8);--velt-text-9: var(--velt-dark-mode-text-9);--velt-text-10: var(--velt-dark-mode-text-10);--velt-text-11: var(--velt-dark-mode-text-11);--velt-text-12: var(--velt-dark-mode-text-12);--velt-background-0: var(--velt-dark-mode-background-0);--velt-background-1: var(--velt-dark-mode-background-1);--velt-background-2: var(--velt-dark-mode-background-2);--velt-background-3: var(--velt-dark-mode-background-3);--velt-background-4: var(--velt-dark-mode-background-4);--velt-background-5: var(--velt-dark-mode-background-5);--velt-background-6: var(--velt-dark-mode-background-6);--velt-background-7: var(--velt-dark-mode-background-7);--velt-background-8: var(--velt-dark-mode-background-8);--velt-background-9: var(--velt-dark-mode-background-9);--velt-background-10: var(--velt-dark-mode-background-10);--velt-border-0: var(--velt-dark-mode-border-0);--velt-border-1: var(--velt-dark-mode-border-1);--velt-border-2: var(--velt-dark-mode-border-2);--velt-border-3: var(--velt-dark-mode-border-3);--velt-border-4: var(--velt-dark-mode-border-4);--velt-border-5: var(--velt-dark-mode-border-5);--velt-border-6: var(--velt-dark-mode-border-6);--velt-border-7: var(--velt-dark-mode-border-7);--velt-border-8: var(--velt-dark-mode-border-8);--velt-border-9: var(--velt-dark-mode-border-9);--velt-border-10: var(--velt-dark-mode-border-10);--velt-background-transparent: var(--velt-dark-mode-background-transparent);--velt-border-transparent: var(--velt-dark-mode-border-transparent);--velt-animation-transparent: var(--velt-dark-mode-animation-transparent)}[type=button][_ngcontent-%COMP%]:not(:disabled), [type=reset][_ngcontent-%COMP%]:not(:disabled), [type=submit][_ngcontent-%COMP%]:not(:disabled), button[_ngcontent-%COMP%]:not(:disabled){cursor:pointer}[_ngcontent-%COMP%]::-webkit-scrollbar{display:none;width:0;height:0}[_ngcontent-%COMP%]::-webkit-scrollbar{width:0;height:0}[_ngcontent-%COMP%]::-webkit-scrollbar-button{width:0;height:0} .velt-comment-dialog-thread-card-message--email-chip, .velt-autocomplete--contact-chip, .velt-autocomplete--group-chip{color:var(--velt-accent-text);background:var(--velt-accent-transparent);border-radius:var(--velt-border-radius-xs);padding:var(--velt-spacing-xs);word-break:break-word;font-size:var(--velt-font-size-sm);font-style:normal;font-weight:400;line-height:120%} .velt-comment-dialog-thread-card-message--email-chip.velt-autocomplete--contact-chip-current-user, .velt-autocomplete--contact-chip.velt-autocomplete--contact-chip-current-user, .velt-autocomplete--group-chip.velt-autocomplete--contact-chip-current-user{background-color:color-mix(in srgb,var(--velt-warning) 12%,transparent);color:color-mix(in srgb,var(--velt-warning) 32%,var(--velt-text-0))} velt-autocomplete-chip velt-skeleton-loader-internal{width:50px;border-radius:var(--velt-border-radius-xs);margin-block:6px} .velt-comment-dialog--here-chip{color:var(--velt-accent-text);background:var(--velt-accent-transparent);border-radius:var(--velt-border-radius-xs);padding:var(--velt-spacing-xs);word-break:break-word}.velt-comment-dialog--comment-link[_ngcontent-%COMP%]{color:var(--velt-accent);word-break:break-all;display:unset}.velt-comment-dialog-shake[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_shake .82s cubic-bezier(.36,.07,.19,.97) both}@keyframes _ngcontent-%COMP%_shake{10%,90%{transform:translate3d(-1px,0,0)}20%,80%{transform:translate3d(2px,0,0)}30%,50%,70%{transform:translate3d(-4px,0,0)}40%,60%{transform:translate3d(4px,0,0)}}.velt-comment-dialog[_ngcontent-%COMP%]{position:relative;display:flex;flex-direction:column;gap:var(--velt-spacing-lg);border-radius:var(--velt-border-radius-md);box-shadow:0 8px 16px -8px #0f0f0f1a;box-sizing:border-box;width:361px;text-align:left;font-size:var(--velt-font-size-sm);padding:var(--velt-spacing-lg);background-color:var(--velt-background-0);border:1px solid var(--velt-border-4);color:var(--velt-text-3)}.velt-comment-dialog[_ngcontent-%COMP%] .velt-comment-dialog--line-div[_ngcontent-%COMP%]{border-top:1px solid var(--velt-border-4);width:100%}.velt-comment-dialog.velt-comment-dialog--no-comments[_ngcontent-%COMP%]{padding:0;gap:0}.velt-comment-dialog.velt-comment-dialog--multi-thread-mode[_ngcontent-%COMP%]{box-shadow:none;border:0;background-color:transparent}.velt-comment-dialog.velt-comment-dialog--sidebar-mode[_ngcontent-%COMP%]{width:100%;min-width:100%;box-shadow:none;background:transparent;border-color:transparent}.velt-comment-dialog.velt-comment-dialog--sidebar-mode[_ngcontent-%COMP%]:hover, .velt-comment-dialog.velt-comment-dialog--sidebar-mode.velt-comment-dialog--selected[_ngcontent-%COMP%]{background-color:var(--velt-background-0);border-color:var(--velt-border-4)}.velt-comment-dialog.velt-comment-dialog--page-mode-composer[_ngcontent-%COMP%]{width:100%;padding-inline:var(--velt-spacing-lg);box-shadow:none;background:transparent;border-color:transparent}.velt-comment-dialog.velt-comment-dialog--inline-comment-mode[_ngcontent-%COMP%]{padding:0;box-shadow:none;border-color:transparent;background:transparent;width:100%}.velt-comment-dialog.velt-comment-dialog--inline-comment-section-mode[_ngcontent-%COMP%]{width:100%;box-shadow:none}.velt-comment-dialog.velt-comment-dialog--inline-comment-section-mode.no-comments[_ngcontent-%COMP%]{padding:var(--velt-spacing-md) var(--velt-spacing-sm) var(--velt-spacing-md) var(--velt-spacing-lg)}.velt-comment-dialog.velt-comment-dialog--bottom-sheet[_ngcontent-%COMP%]{width:100%;border-bottom-left-radius:0;border-bottom-right-radius:0} .snippyly-comment-rewriter-text{color:var(--velt-black);background-color:color-mix(in srgb,var(--velt-warning) 42%,var(--velt-white))}.velt-comment-dialog--hide[_ngcontent-%COMP%]{display:none}.velt-comment-dialog--action-bar[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:space-around;padding:var(--velt-spacing-lg);box-sizing:border-box;text-align:center;color:var(--velt-accent-text);gap:var(--velt-spacing-2xl)}.velt-comment-dialog--action-bar[_ngcontent-%COMP%]:empty{display:none}.velt-comment-dialog--action-bar[_ngcontent-%COMP%] .velt-comment-dialog--action-bar-group[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center;justify-content:space-around;width:100%;box-sizing:border-box}.velt-comment-dialog--focused-thread-mode[_ngcontent-%COMP%]{border:none;height:100%}.velt-comment-dialog--focused-thread-mode[_ngcontent-%COMP%] app-comment-dialog-body[_ngcontent-%COMP%]{display:flex;flex-grow:1;min-height:0;width:100%;overflow:scroll}"],changeDetection:0});let n=o;return n})();var $9=(()=>{let o=class o{constructor(e,i,r,a){this.bottomSheet=e,this.domService=i,this.loggingService=r,this.elementRef=a,this.user=new wo,this.isInsidePdfViewer=!1,this.bottomSheetData$=new Ce(null),this.saveComment=new Ae,this.veltElement=!0,this.subscriptions=[],this.componentId="velt-comment-bottom-sheet"}ngOnInit(){this.setupA11yAttributes()}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","dialog"),e.setAttribute("aria-label","Comment bottom sheet")}catch(e){this.loggingService.catch("Error in CommentBottomSheetComponent setupA11yAttributes:",e)}}ngAfterViewInit(){this.openBottomSheet(),this.setBottomSheetData()}ngOnChanges(e){try{e?.annotation&&this.setBottomSheetData()}catch(i){this.catchError("Error in CommentBottomSheetComponent ngOnChanges: ",i)}}setBottomSheetData(){try{this.bottomSheetData$.next({annotation:this.annotation,user:this.user,commentPinSelected:!0,isInsidePdfViewer:this.isInsidePdfViewer,multiThreadAnnotationId:this.annotation?.type==="multiThread"?this.annotation.annotationId:null,saveComment:e=>{this.saveComment.emit(e)},dismiss:()=>{this.closeBottomSheet()}})}catch(e){this.catchError("Error in CommentBottomSheetComponent setBottomSheetData: ",e)}}openBottomSheet(){return Q(this,null,function*(){try{this.annotation.type==="multiThread"?(this.bottomSheetRef=this.bottomSheet.open(rs,{data:this.bottomSheetData$.asObservable(),panelClass:"snippyly-comment-bottom-sheet-container"}),this.subscriptions.push(this.bottomSheetRef.backdropClick().subscribe(()=>{this.domService.resetSelectedAnnotationsMap()}))):(this.bottomSheetRef=this.bottomSheet.open(Go,{data:this.bottomSheetData$.asObservable(),panelClass:"snippyly-comment-bottom-sheet-container"}),this.subscriptions.push(this.bottomSheetRef.backdropClick().subscribe(()=>{this.domService.resetSelectedAnnotationsMap()})))}catch(e){this.catchError("Error in CommentBottomSheetComponent openBottomSheet: ",e)}})}closeBottomSheet(){try{this.bottomSheetRef&&this.bottomSheetRef.dismiss()}catch(e){this.catchError("Error in CommentBottomSheetComponent closeBottomSheet: ",e)}}ngOnDestroy(){this.closeBottomSheet(),this.subscriptions.forEach(e=>{e?.unsubscribe()})}catchError(e,i,r){try{this.loggingService.catch(e,i,T(I({},r||{}),{annotationId:this.annotation?.annotationId}))}catch{}}};o.\u0275fac=function(i){return new(i||o)(u(pc),u(Ne),u(y),u(k))},o.\u0275cmp=O({type:o,selectors:[["snippyly-comment-bottom-sheet"]],hostVars:1,hostBindings:function(i,r){i&2&&x("data-velt-element",r.veltElement)},inputs:{annotation:"annotation",user:"user",isInsidePdfViewer:"isInsidePdfViewer"},outputs:{saveComment:"saveComment"},standalone:!1,features:[Xe],decls:0,vars:0,template:function(i,r){},styles:[".snippyly-comment-bottom-sheet-container{padding:0!important} .snippyly-comment-bottom-sheet-container .mat-bottom-sheet-container{padding:0!important}"],changeDetection:0});let n=o;return n})();function Pjt(n,o){if(n&1){let t=q();C(0,"div",4),G("pointerup",function(i){return N(t),l(2).togglePinSelection(),F(i.stopPropagation())})("click",function(i){return N(t),F(i.stopPropagation())})("cdkDragStarted",function(){N(t);let i=l(2);return F(i.onPinDragStart())}),C(1,"snippyly-comment-pin",5),G("saveComment",function(i){N(t);let r=l(2);return F(r.saveComment(i))})("commentTargetElementClicked",function(){N(t);let i=l(2);return F(i.togglePinSelection())})("togglePinSelection",function(i){N(t);let r=l(2);return F(r.togglePinSelection(i))}),S()()}if(n&2){let t=l().ngIf,e=l();rt("top",(t.commentPinAnnotation==null||t.commentPinAnnotation.position==null?null:t.commentPinAnnotation.position.top)-0+t.offsetTop,"px")("left",(t.commentPinAnnotation==null||t.commentPinAnnotation.position==null?null:t.commentPinAnnotation.position.left)-10+t.offsetLeft,"px"),c("id","comment-pin-container-"+(t.commentPinAnnotation==null?null:t.commentPinAnnotation.annotationId)),x("data-testid",e.componentId+"-popover")("role","button")("aria-expanded",t.commentPinSelected),d(),c("annotation",t.commentPinAnnotation)("containerComponentId",t.componentId)("commentPinSelected",t.commentPinSelected&&!t.annotationDragging)("multipleCommentPinSelected",t.commentPinSelected&&e.objectKeys(t.selectedAnnotationsMap).length>1)("targetElement",t.targetElement)("user",t.user)}}function Mjt(n,o){if(n&1){let t=q();C(0,"div",7),G("pointerup",function(i){return N(t),l(3).togglePinSelection(),F(i.stopPropagation())})("touchend",function(i){return N(t),i.stopPropagation(),F(i.preventDefault())})("mousedown",function(i){return N(t),F(i.stopPropagation())})("touchstart",function(i){return N(t),F(i.stopPropagation())})("pointerdown",function(i){return N(t),F(i.stopPropagation())})("click",function(i){return N(t),F(i.stopPropagation())})("cdkDragStarted",function(){N(t);let i=l(3);return F(i.onPinDragStart())})("cdkDragMoved",function(i){N(t);let r=l(3);return F(r.onPinMove(i))})("cdkDragReleased",function(){N(t);let i=l(3);return F(i.onPinRelease())}),C(1,"snippyly-comment-pin",8,1),G("togglePinSelection",function(i){N(t);let r=l(3);return F(r.togglePinSelection(i))})("saveComment",function(i){N(t);let r=l(3);return F(r.saveComment(i))}),S()()}if(n&2){let t,e=pe(2),i=l(2).ngIf,r=l();rt("top",i.annotationDragging?(i.dragPosition==null?null:i.dragPosition.top)-((e==null?null:e.COMMENT_PIN_SIZE)||40):(i.commentPinAnnotation==null||i.commentPinAnnotation.position==null?null:i.commentPinAnnotation.position.top)-((e==null?null:e.COMMENT_PIN_SIZE)||40)+i.offsetTop,"px")("left",i.annotationDragging?i.dragPosition==null?null:i.dragPosition.left:(i.commentPinAnnotation==null||i.commentPinAnnotation.position==null?null:i.commentPinAnnotation.position.left)+i.offsetLeft,"px")("--velt-comment-pin-transform",i.annotationDragging?"none":(t=i.pinTransform)!==null&&t!==void 0?t:"none")("transform",!i.annotationDragging&&(!(i.commentPinAnnotation==null||i.commentPinAnnotation.position==null)&&i.commentPinAnnotation.position.parentScaleX)?"scale("+1/((i.commentPinAnnotation==null||i.commentPinAnnotation.position==null?null:i.commentPinAnnotation.position.parentScaleX)||1)+", "+1/((i.commentPinAnnotation==null||i.commentPinAnnotation.position==null?null:i.commentPinAnnotation.position.parentScaleY)||1)+")":""),ge("pin-dragging",i.annotationDragging),c("id","comment-pin-container-"+(i.commentPinAnnotation==null?null:i.commentPinAnnotation.annotationId))("cdkDragDisabled",(i.commentPinAnnotation==null||i.commentPinAnnotation.from==null?null:i.commentPinAnnotation.from.userId)!==(i.user==null?null:i.user.userId)),x("data-testid",r.componentId+"-default")("role","button")("aria-expanded",i.commentPinSelected)("aria-grabbed",i.annotationDragging)("data-transform-inside",i.transformContext?"true":"false"),d(),c("annotation",i.commentPinAnnotation)("annotationDragging",i.annotationDragging)("containerComponentId",i.componentId)("commentPinSelected",i.commentPinSelected&&!i.annotationDragging)("multipleCommentPinSelected",i.commentPinSelected&&r.objectKeys(i.selectedAnnotationsMap).length>1)("targetElement",i.targetElement)("user",i.user)}}function kjt(n,o){if(n&1&&g(0,Mjt,3,24,"div",6),n&2){let t=l().ngIf;c("ngIf",t.commentPinAnnotation==null?null:t.commentPinAnnotation.position)}}function Rjt(n,o){if(n&1&&(f(0),g(1,Pjt,2,14,"div",3)(2,kjt,1,1,"ng-template",null,0,De),v()),n&2){let t=o.ngIf,e=pe(3);d(),c("ngIf",t.popoverMode)("ngIfElse",e)}}var H9=(()=>{let o=class o{constructor(e,i,r,a,s,m,p){this.analyticsService=e,this.authService=i,this.docService=r,this.domService=a,this.commentService=s,this.loggingService=m,this.elementRef=p,this.multipleCommentPinsSelected=!1,this.avatarErrorImage="",this.objectKeys=Object.keys,this.selectedAnnotationsLocationMap={},this.subscriptions=[],this.componentConfigSignal=Te({popoverMode:!1,commentPinAnnotation:void 0,commentPinSelected:!1,offsetLeft:0,offsetTop:0,selectedAnnotationsMap:{},annotationDragging:!1,dragPosition:null,targetElement:void 0,user:void 0,componentId:`comment-pin-portal-${Pn()}`}),this.veltElement=!0,this.componentId="velt-comment-pin-portal",this.subscriptions.push(this.authService.getUser$().subscribe(h=>{this.componentConfigSignal.update(_=>(_=T(I({},_),{user:h}),_))},h=>{this.catchError("Error in CommentPinPortalComponent getUser$ subscription: ",h)})),this.subscriptions.push(this.domService.getSelectedAnnotationsMap$().subscribe(h=>{this.componentConfigSignal.update(_=>(_=T(I({},_),{selectedAnnotationsMap:h}),_)),this.checkCommentPinSelected()},h=>{this.catchError("Error in CommentPinPortalComponent getSelectedAnnotationsMap$ subscription: ",h)})),this.subscriptions.push(this.domService.getSelectedAnnotationsLocationMap$().subscribe(h=>{this.selectedAnnotationsLocationMap=h||{},this.checkCommentPinSelected()},h=>{this.catchError("Error in CommentPinPortalComponent getSelectedAnnotationsLocationMap$ subscription: ",h)})),this.subscriptions.push(this.commentService.getPopoverMode$().subscribe(h=>{this.componentConfigSignal.update(_=>(_=T(I({},_),{popoverMode:h}),_))},h=>{this.catchError("Error in CommentPinPortalComponent getPopoverMode subscription: ",h)}))}ngOnInit(){try{this.setupA11yAttributes(),this.subscriptions.push(this.commentService.getTransformContext$().subscribe(e=>{this.componentConfigSignal.update(i=>{if(i=T(I({},i),{transformContext:e}),e&&this.isElementInsideTransformContainer(this.elementRef?.nativeElement,e.containerSelector)){let r=e.transforms.scale?1/e.transforms.scale:1;i.pinTransform=`scale(${r})`}else i.pinTransform=void 0;return i})}))}catch(e){this.loggingService.catch("Error in CommentPinPortalComponent ngOnInit:",e)}}isElementInsideTransformContainer(e,i){try{return document.querySelector(i)?.contains(e)??!1}catch(r){return this.loggingService.catch("Error in CommentPinPortalComponent isElementInsideTransformContainer:",r),!1}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentPinPortalComponent setupA11yAttributes:",e)}}setCommentPinAnnotation(e){try{this.componentConfigSignal.update(i=>(i=T(I({},i),{commentPinAnnotation:e}),i)),this.id=this.componentConfigSignal().commentPinAnnotation?.annotationId,this.checkCommentPinSelected()}catch(i){this.catchError("Error in CommentPinPortalComponent setCommentPinAnnotation: ",i)}}setSourceId(e){try{this.componentConfigSignal.update(i=>(i=T(I({},i),{sourceId:e}),i)),this.checkCommentPinSelected()}catch(i){this.catchError("Error in CommentPinPortalComponent setSourceId: ",i)}}getMultiThreadCommentAnnotations(){}checkCommentPinSelected(){try{let e=this.componentConfigSignal().selectedAnnotationsMap,i=this.componentConfigSignal().commentPinAnnotation,r=this.componentConfigSignal().sourceId;if(i){let a=!!e[i.annotationId];if(a)if(i?.isDraft)i?.sourceId&&(a=i?.sourceId===r,a&&this.domService.setSelectedAnnotationLocation(i.annotationId,this.componentConfigSignal().componentId));else{let s=this.selectedAnnotationsLocationMap?.[i.annotationId];s&&(a=s===this.componentConfigSignal().componentId)}a!==this.componentConfigSignal().commentPinSelected&&this.componentConfigSignal.update(s=>(s=T(I({},s),{commentPinSelected:a}),s))}}catch(e){this.catchError("Error in CommentPinPortalComponent checkCommentPinSelected: ",e)}}setTargetElement(e){try{this.componentConfigSignal.update(i=>(i=T(I({},i),{targetElement:e}),i))}catch(i){this.catchError("Error in CommentPinPortalComponent setTargetElement: ",i)}}setOffsetLeft(e){try{this.componentConfigSignal.update(i=>(i=T(I({},i),{offsetLeft:e}),i))}catch(i){this.catchError("Error in CommentPinPortalComponent setOffsetLeft: ",i)}}setOffsetTop(e){try{this.componentConfigSignal.update(i=>(i=T(I({},i),{offsetTop:e}),i))}catch(i){this.catchError("Error in CommentPinPortalComponent setOffsetTop: ",i)}}togglePinSelection(e){try{let i=e||this.componentConfigSignal().commentPinAnnotation;if(this.componentConfigSignal().selectedAnnotationsMap[i?.annotationId]&&this.selectedAnnotationsLocationMap?.[i?.annotationId]===this.componentConfigSignal().componentId)i?.ghostComment?.type!==Ws.DIFFERENT_DEVICE&&document.querySelector(`[${j.ATTRIBUTES.VELT_ANNOTATION_DRAFT}="${i?.annotationId}"]`)&&this.domService.resetSelectedAnnotationsMap(!0,"comments");else{let a=document.querySelector(`[${j.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);if(a||(a=(this.domService.getDraftCommentAnnotationDialogs()||[])[0]),a){let s=a.getAttribute(j.ATTRIBUTES.VELT_ANNOTATION_DRAFT);if(s){let m=document.getElementById(`comment-pin-container-${s}`)||document.querySelector(`[data-velt-id='${s}']`);m&&(m.scrollIntoView({behavior:"auto",block:"center",inline:"center"}),this.domService.resetSelectedAnnotationsMap(!0,"comments"))}}else this.domService.resetSelectedAnnotationsMap(!0,"comments"),this.componentConfigSignal().targetElement&&this.domService.isElementVisibleOnScreen(this.componentConfigSignal().targetElement)&&(this.componentConfigSignal().annotationDragging||this.domService.toggleAnnotationSelection(i,this.componentConfigSignal().componentId,void 0,!0))}}catch(i){this.catchError("Error in CommentPinPortalComponent togglePinSelection: ",i)}}onPinDragStart(){try{this.componentConfigSignal().selectedAnnotationsMap[this.componentConfigSignal().commentPinAnnotation.annotationId]&&this.componentConfigSignal().commentPinAnnotation?.ghostComment?.type!==Ws.DIFFERENT_DEVICE&&this.domService.toggleAnnotationSelection(this.componentConfigSignal().commentPinAnnotation,this.componentConfigSignal().componentId);let e=document.getElementById(this.componentConfigSignal().commentPinAnnotation.annotationId);if(!e)return;this.parentElement=e.parentElement;let i=this.componentConfigSignal().commentPinAnnotation.position,r=this.componentConfigSignal().transformContext,a=this.parentElement.getBoundingClientRect(),s=a.left+i.left,m=a.top+i.top,p=r&&this.isElementInsideTransformContainer(e,r.containerSelector);this.componentConfigSignal.update(h=>(h=T(I({},h),{elementInTransformedContainer:p}),h)),e.style.width="20px",e.style.height="20px",e.style.margin="0",e.style.padding="0",e.style.display="block",e.style.visibility="visible",e.style.opacity="1",e.style.backgroundColor="var(--velt-comment-pin-background-color, #2d62ff)",e.style.borderRadius="50%",e.style.boxShadow="0 2px 4px rgba(0, 0, 0, 0.2)",e.style.pointerEvents="auto",e.offsetWidth,document.body.appendChild(e),e.style.position="fixed",e.style.top=`${m}px`,e.style.left=`${s}px`,e.style.zIndex="10000",e.style.transform="none",e.offsetWidth,this.componentConfigSignal.update(h=>(h=T(I({},h),{annotationDragging:!0}),h))}catch(e){this.catchError("Error in CommentPinPortalComponent onPinDragStart: ",e)}}onPinMove(e){try{this.updateCurrentPinPosition(e)}catch(i){this.catchError("Error in CommentPinPortalComponent onPinMove: ",i)}}updateCurrentPinPosition(e){try{this.domService.removeHighlightFromElement(this.componentConfigSignal().targetElement);let i=e.event,r=i?.touches?.length?i.touches[0]?.clientX:i.clientX,a=i?.touches?.length?i.touches[0]?.clientY:i.clientY,s=this.componentConfigSignal().transformContext,m=this.domService.getBackgroundElement(r,a);m&&this.commentService.isElementInsideAllowedElements(m)&&(this.componentConfigSignal.update(p=>(p=T(I({},p),{targetElement:m}),p)),this.domService.highlightElement(this.componentConfigSignal().targetElement),this.pointerMoveEvent=e.event,this.componentConfigSignal.update(p=>(p=T(I({},p),{dragPosition:{top:a,left:r}}),p)))}catch(i){this.catchError("Error in CommentPinPortalComponent updateCurrentPinPosition: ",i)}}onPinRelease(){try{let e=document.getElementById(this.componentConfigSignal().commentPinAnnotation.annotationId);if(!e||!this.parentElement)return;this.domService.removeHighlightFromElement(this.componentConfigSignal().targetElement);let i=this.domService.getElementFromXPath(this.componentConfigSignal().commentPinAnnotation.targetElement?.xpath),r=this.componentConfigSignal().commentPinAnnotation?.targetElement;if(this.pointerMoveEvent){let oe=this.domService.getTargetElementForCursorPosition(this.pointerMoveEvent,!0,!0,!0,ue=>{if(this.commentService.getSvgAsImg()){let be=ue?.closest(`[${j.ATTRIBUTES.VELT_COMMENT_CONTAINER}]`);be&&be instanceof HTMLElement&&(ue=be)}return ue});oe&&(r=oe)}let a=this.domService.getElementFromXPath(r?.xpath),s=this.componentConfigSignal().commentPinAnnotation.targetElement?.xpath,m=r?.xpath,p=s===m;if(!a)return;let h=this.componentConfigSignal().dragPosition,_=a.getBoundingClientRect(),E=50,D=50;if(h){let oe=h.left-_.left,ue=h.top-_.top;E=oe/_.width*100,D=ue/_.height*100,E=Math.max(0,Math.min(100,E)),D=Math.max(0,Math.min(100,D))}let L=I({},this.componentConfigSignal().commentPinAnnotation);L.targetElement=I({},r),L.targetElement.leftPercentage=E,L.targetElement.topPercentage=D,this.commentService.calculateCommentAnnotationPosition(L),this.componentConfigSignal.update(oe=>(oe=T(I({},oe),{commentPinAnnotation:L,targetElement:a}),oe));let H=this.domService.isElementInsideAdditionalLocationContainer(i)||this.domService.isElementInsideAdditionalLocationContainer(a),K=this.docService.getAdditionalDocumentIdFromElement(a)||this.docService.getDocumentPaths()?.clientDocumentId;if(!this.componentConfigSignal().commentPinAnnotation?.metadata?.clientDocumentId||this.componentConfigSignal().commentPinAnnotation?.metadata?.clientDocumentId==K?(this.componentConfigSignal.update(oe=>(oe=T(I({},oe),{commentPinAnnotation:T(I({},oe.commentPinAnnotation),{targetElement:r})}),oe)),this.commentService.updateComment(this.componentConfigSignal().commentPinAnnotation,H)):this.componentConfigSignal.update(oe=>(oe=T(I({},oe),{targetElement:i}),oe)),p){let oe=this.componentConfigSignal().transformContext,ue=this.componentConfigSignal().elementInTransformedContainer,be=oe&&this.isElementInsideTransformContainer(a,oe.containerSelector);this.componentConfigSignal.update(qe=>(qe=T(I({},qe),{elementInTransformedContainer:be}),qe));let Le=e.getBoundingClientRect();if(!ue&&be){e.style.transition="none";let qe=Le.top,Re=Le.left;this.parentElement.appendChild(e),e.style.position="fixed",e.style.top=`${qe}px`,e.style.left=`${Re}px`,e.offsetWidth,requestAnimationFrame(()=>{e.style.position="absolute",be&&L.position.transformContext?(e.style.top=`${L.position.top}px`,e.style.left=`${L.position.left}px`,L.position.transformContext.scale!==1&&(e.style.transform=`scale(${1/L.position.transformContext.scale})`)):(e.style.top=`${L.position.top}px`,e.style.left=`${L.position.left}px`)})}else e.style.transition="none",this.parentElement.appendChild(e),e.style.position="absolute",e.style.width="20px",e.style.height="20px",e.style.backgroundColor="var(--velt-comment-pin-background-color, #2d62ff)",e.style.borderRadius="50%",e.style.boxShadow="0 2px 4px rgba(0, 0, 0, 0.2)",e.style.visibility="visible",e.style.display="block",e.offsetWidth,be&&L.position.transformContext?(e.style.top=`${L.position.top}px`,e.style.left=`${L.position.left}px`):(e.style.top=`${L.position.top}px`,e.style.left=`${L.position.left}px`);e.offsetWidth,this.componentConfigSignal.update(qe=>(qe=T(I({},qe),{annotationDragging:!1,dragPosition:null}),qe))}this.analyticsService.trackEvent(X.Events.Comments.COMMENT_PIN_DRAGGED,{annotationId:this.componentConfigSignal().commentPinAnnotation.annotationId,commentMode:this.commentService.getCommentMode()})}catch(e){this.catchError("Error in CommentPinPortalComponent onPinRelease: ",e)}}saveComment(e){try{this.commentService.saveComment(this.componentConfigSignal().commentPinAnnotation,e)}catch(i){this.catchError("Error in CommentPinPortalComponent saveComment: ",i)}}ngOnDestroy(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnDestroy","color: green;");try{this.unsubscribe()}catch(e){this.catchError("Error in CommentPinPortalComponent ondestroy: ",e)}}unsubscribe(){this.loggingService.log("%c[WB] Calling FUNCTION: unsubscribe","color: green;");try{this.subscriptions.map(e=>{e.unsubscribe()}),this.subscriptions=[]}catch(e){this.catchError("Error in CommentPinPortalComponent unsubscribe: ",e)}}catchError(e,i,r){try{this.loggingService.catch(e,i,T(I({},r||{}),{annotationId:this.componentConfigSignal()?.commentPinAnnotation?.annotationId}))}catch{}}};o.\u0275fac=function(i){return new(i||o)(u(Ze),u(He),u(lt),u(Ne),u(we),u(y),u(k))},o.\u0275cmp=O({type:o,selectors:[["snippyly-comment-pin-portal"]],hostVars:2,hostBindings:function(i,r){i&2&&(xa("id",r.id),x("data-velt-element",r.veltElement))},inputs:{multipleCommentPinsSelected:"multipleCommentPinsSelected",avatarErrorImage:"avatarErrorImage"},standalone:!1,decls:1,vars:1,consts:[["defaultPinPortalRef",""],["commentPinRef",""],[4,"ngIf"],["class","comment-pin-portal",3,"id","top","left","pointerup","click","cdkDragStarted",4,"ngIf","ngIfElse"],[1,"comment-pin-portal",3,"pointerup","click","cdkDragStarted","id"],[3,"saveComment","commentTargetElementClicked","togglePinSelection","annotation","containerComponentId","commentPinSelected","multipleCommentPinSelected","targetElement","user"],["class","comment-pin-portal","cdkDrag","","cdkDragHandle","",3,"id","pin-dragging","top","left","--velt-comment-pin-transform","transform","cdkDragDisabled","pointerup","touchend","mousedown","touchstart","pointerdown","click","cdkDragStarted","cdkDragMoved","cdkDragReleased",4,"ngIf"],["cdkDrag","","cdkDragHandle","",1,"comment-pin-portal",3,"pointerup","touchend","mousedown","touchstart","pointerdown","click","cdkDragStarted","cdkDragMoved","cdkDragReleased","id","cdkDragDisabled"],[3,"togglePinSelection","saveComment","annotation","annotationDragging","containerComponentId","commentPinSelected","multipleCommentPinSelected","targetElement","user"]],template:function(i,r){i&1&&g(0,Rjt,4,2,"ng-container",2),i&2&&c("ngIf",r.componentConfigSignal())},styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}[_nghost-%COMP%]{position:absolute!important;top:0!important;left:0!important;box-sizing:border-box!important;-webkit-tap-highlight-color:rgba(255,255,255,0)!important;outline:none!important;margin:0!important;padding:0!important;height:unset!important;width:unset!important;text-align:left!important;z-index:var(--velt-comment-pin-z-index)!important}*[_ngcontent-%COMP%]{box-sizing:border-box;-webkit-tap-highlight-color:rgba(255,255,255,0)!important;outline:none!important;margin:0!important;padding:0!important;height:unset;width:unset;text-align:left!important;line-height:1.5!important;color:#000!important;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit));-webkit-text-fill-color:initial!important}*[_ngcontent-%COMP%]:empty{display:revert!important}.comment-pin-portal[_ngcontent-%COMP%]{position:absolute;transform:var(--velt-comment-pin-transform, none)!important;transform-origin:0 100%!important;transform-box:fill-box!important;top:0;left:0}.comment-pin-portal.pin-dragging[_ngcontent-%COMP%]{position:fixed;z-index:var(--velt-comment-pin-z-index)!important}"],changeDetection:0});let n=o;return n})();var z9=(()=>{let o=class o{constructor(e,i,r,a,s,m){this.commentService=e,this.domService=i,this.componentFactoryResolver=r,this.injector=a,this.appRef=s,this.loggingService=m,this.commentsPinById={},this.commentPinTemplate$=new Ce(null),this.customPinEvents$=new Ke}setCommentPin(e){try{if(!this.commentsPinById[e.annotationId])this.setPinPortal(e);else{let i=!1;if(e?.ghostComment?i=e?.ghostComment?.targetElement?.xpath!==this.commentsPinById[e.annotationId]?.[0]?.annotation?.ghostComment?.targetElement?.xpath:this.commentsPinById[e.annotationId]?.[0]?.annotation?.ghostComment?i=!0:i=e.targetElement?.xpath!==this.commentsPinById[e.annotationId]?.[0]?.annotation?.targetElement?.xpath,!i)this.commentsPinById[e.annotationId]?.forEach(r=>{let a=r.portalRef,s=r.userTargetElement,m=r.pinHostElement;if(document.body.contains(s)&&document.body.contains(m))a&&(a.instance.setCommentPinAnnotation(e),this.updateElementOffset(e));else{let p=r.pinHostDomPortalOutlet;p&&(this.removeCommentPinHostAttributes(e.annotationId,r.pinHostElement),this.removeCommentDisabledAttribute(m),p.detach(),delete this.commentsPinById[e.annotationId],e.ghostComment&&this.unselectCommentAnnotation(e),this.setPinPortal(e))}});else{let r=this.commentsPinById[e.annotationId]?.[0]?.pinHostDomPortalOutlet;r&&(this.removeCommentPinHostAttributes(e.annotationId,this.commentsPinById[e.annotationId]?.[0]?.pinHostElement),this.removeCommentDisabledAttribute(this.commentsPinById[e.annotationId]?.[0]?.pinHostElement),r.detach(),delete this.commentsPinById[e.annotationId],e.ghostComment&&this.unselectCommentAnnotation(e),this.setPinPortal(e))}}}catch(i){this.loggingService.catch("Error in CommentPinPortalService setCommentPin: ",i)}}unselectCommentAnnotation(e){try{this.loggingService.log("%c[WB] Calling CommentPinPortalService FUNCTION: unselectCommentAnnotation","color: green;"),this.domService.getSelectedAnnotationsMap()?.[e?.annotationId]&&this.domService.toggleAnnotationSelection(e)}catch(i){this.loggingService.catch("Error in CommentPinPortalService unselectCommentAnnotation: ",i)}}setPinPortal(e){try{let i=this.commentService.getElementFromComments(e);i.length>0&&(this.commentsPinById[e.annotationId]=[],i.forEach(r=>{if(r){let a=this.domService.getHostElement(r),s=new Lo(H9),m=new Bo(a,this.componentFactoryResolver,this.appRef,this.injector),p=m.attach(s);p.instance.setCommentPinAnnotation(e),p.instance.setTargetElement(r);let h=r?.getAttribute(j.ATTRIBUTES.VELT_SOURCE_ID);h&&p.instance.setSourceId(h),this.commentsPinById[e.annotationId].push({pinHostDomPortalOutlet:m,pinPortal:s,portalRef:p,annotation:JSON.parse(JSON.stringify(e)),userTargetElement:r,pinHostElement:a}),this.setCommentPinHostAttributes(e.annotationId,a),this.setCommentDisabledAttribute(a),this.updateElementOffset(e)}}))}catch(i){this.loggingService.catch("Error in CommentPinPortalService setPinPortal: ",i)}}setCommentPinHostAttributes(e,i){try{let r=i.getAttribute(j.ATTRIBUTES.VELT_COMMENT_PIN_HOST);if(r){let a=r.split(",");a.includes(e)||(a.push(e),i.setAttribute(j.ATTRIBUTES.VELT_COMMENT_PIN_HOST,a.join(",")))}else i.setAttribute(j.ATTRIBUTES.VELT_COMMENT_PIN_HOST,e);window.getComputedStyle(i).position==="static"&&(Sm(i)||i.setAttribute(j.ATTRIBUTES.VELT_COMMENT_PIN_HOST_STATIC,"true"))}catch(r){this.loggingService.catch("Error in CommentPinPortalService setCommentPinHostAttributes: ",r)}}removeCommentPinHostAttributes(e,i){try{let r=i.getAttribute(j.ATTRIBUTES.VELT_COMMENT_PIN_HOST);if(r){let a=r.split(","),s=a.indexOf(e);s>-1&&(a.splice(s,1),a.length>0?i.setAttribute(j.ATTRIBUTES.VELT_COMMENT_PIN_HOST,a.join(",")):i.removeAttribute(j.ATTRIBUTES.VELT_COMMENT_PIN_HOST))}i?.getAttribute(j.ATTRIBUTES.VELT_COMMENT_PIN_HOST)||i.removeAttribute(j.ATTRIBUTES.VELT_COMMENT_PIN_HOST_STATIC)}catch(r){this.loggingService.catch("Error in CommentPinPortalService removeCommentPinHostAttributes: ",r)}}setCommentDisabledAttribute(e){try{this.commentService.getPopoverMode()&&e.setAttribute(j.ATTRIBUTES.VELT_COMMENT_DISABLED,"auto")}catch(i){this.loggingService.catch("Error in CommentPinPortalService setCommentDisabledAttribute: ",i)}}removeCommentDisabledAttribute(e){try{e?.getAttribute(j.ATTRIBUTES.VELT_COMMENT_DISABLED)==="auto"&&e.removeAttribute(j.ATTRIBUTES.VELT_COMMENT_DISABLED)}catch(i){this.loggingService.catch("Error in CommentPinPortalService removeCommentDisabledAttribute: ",i)}}updateElementOffset(e){try{for(let i of this.commentsPinById[e.annotationId]){let{portalRef:r,userTargetElement:a,pinHostElement:s}=i,m=this.domService.getElementOffset(a,s);r.instance.setOffsetLeft(m.offsetLeft),r.instance.setOffsetTop(m.offsetTop)}}catch(i){this.loggingService.catch("Error in CommentPinPortalService updateElementOffset: ",i)}}checkPinsToRemove(e){try{let i=e.map(r=>r.annotationId);Object.keys(this.commentsPinById).forEach(r=>{i.includes(r)||(this.commentService.customPinsById.has(r)&&this.commentService.customPinsById.delete(r),this.commentsPinById[r].forEach(s=>{s.pinHostDomPortalOutlet.detach(),this.removeCommentPinHostAttributes(r,s.pinHostElement),this.removeCommentDisabledAttribute(s.pinHostElement),this.domService.removeHighlightFromElement(s.pinHostElement),s.userTargetElement&&this.domService.removeHighlightFromElement(s.userTargetElement)}),delete this.commentsPinById[r])})}catch(i){this.loggingService.catch("Error in CommentPinPortalService checkPinsToRemove: ",i)}}setCommentPinOverrideTemplate(e){this.commentPinTemplate$.next(e)}getCommentPinTemplate$(){return this.commentPinTemplate$}emitCustomPinEvent(e){try{let{element:i,annotation:r}=e;r&&this.commentService.customPinsById.set(r.annotationId,i),this.customPinEvents$.next(e)}catch(i){this.loggingService.catch("Error in CommentPinPortalService emitCustomPinEvent",i)}}getCustomPinEvents$(){return this.customPinEvents$}};o.\u0275fac=function(i){return new(i||o)(J(we),J(Ne),J(xo),J(xt),J(di),J(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var ne=(()=>{let o=class o{set veltDynamicTemplate({template:e,context:i,id:r,cloneTemplate:a,componentName:s,variant:m,suffix:p,setIfCondition:h,componentElementRef:_,replaceTemplate:E=!0}){try{if(p&&(s+=`--${p}`),m&&(s+=`---${m}`),s){let D=this.wireframeService.getConditionElement(s);if(!D&&e&&(D=e),D){let L=D?.getAttribute("velt-if");L&&h&&h(L),Array.from(D.attributes).forEach(H=>{_?.nativeElement.setAttribute(H.name,H.value)}),i?.componentConfigSignal?this.dynamicDataService.applyConditionalClasses(_?.nativeElement,i):this.dynamicDataService.applyConditionalClasses(_?.nativeElement)}}if(s&&!e){let D=this.wireframeService.getWireframe(s);if(D){let L=document.createElement(D.tagName);L.innerHTML=D.innerHTML,this.template=L}}else this.template=e;this.data=i,this.id=r,this.cloneTemplate=!!a,this.cloneTemplate&&e&&(this.template=this.domService.deepCloneElement(e)),this.checkToUpdateTemplate(E)}catch(D){this.loggingService.warn("Error in DynamicTemplateDirective veltDynamicTemplate: ",D)}}constructor(e,i,r,a,s,m,p,h){this.elementRef=e,this.templateRef=i,this.viewContainer=r,this.dynamicComponentService=a,this.loggingService=s,this.domService=m,this.wireframeService=p,this.dynamicDataService=h,this.directiveId=Math.random().toString(36).substring(7),this.isCustomTemplateMode=!1,this.isDefaultTemplateMode=!1,this.cloneTemplate=!1,this.injectedElements=[],this.componentRefs=[];try{this.loggingService.log("%c[WB] Creating CLASS: DynamicTemplateDirective","color: blue;")}catch(_){this.loggingService.catch("Error in DynamicTemplateDirective constructor: ",_)}}checkDataValue(e,i){let r=e.querySelectorAll("[data-velt]");function a(s,m){return m.split(".").reduce((p,h)=>p&&p[h],s)}r.forEach(s=>{let m=s.getAttribute("data-velt");if(m&&i){let p=a(i,m);s instanceof HTMLElement&&(s.innerText=JSON.stringify(p,null,2))}})}checkToUpdateTemplate(e){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: checkToUpdateTemplate","color: green;"),this.template&&e)if(this.isDefaultTemplateMode=!1,this.isCustomTemplateMode)this.updateDataOnComponentRefs(this.data);else{this.isCustomTemplateMode=!0,this.cleanUp();let i=document.createElement(this.template.tagName);i.innerHTML=this.template.innerHTML,this.injectElementNextToSibling(this.elementRef.nativeElement,i)}else this.isCustomTemplateMode=!1,this.isDefaultTemplateMode||(this.cleanUp(),this.viewContainer.createEmbeddedView(this.templateRef),this.isDefaultTemplateMode=!0)}catch(i){this.loggingService.catch("Error in DynamicTemplateDirective checkToUpdateTemplate: ",i)}}injectElementNextToSibling(e,i){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: injectElementNextToSibling","color: green;"),!i)return;this.cleanUp();let r=i;for(let s=0;s<r.children.length;s++){let m=r.children[s],p=this.dynamicComponentService.processAndReplaceVeltComponents(m,this.data,this.id?this.id:`from-directive-${this.directiveId}`,[],"from directive");p?.length&&this.componentRefs.push(...p)}r.setAttribute("data-velt-added-from-directive","true"),this.customTemplate=r;let a=Array.from(r.childNodes).reverse();e.nextSibling&&e.nextSibling&&e.nextSibling.getAttribute&&e.nextSibling.getAttribute("data-velt-added-from-directive")&&e.parentNode.removeChild(e.nextSibling),a.forEach(s=>{e.parentNode.insertBefore(s,e.nextSibling),s instanceof Element&&this.injectedElements.push(s)}),r.remove()}catch(r){this.loggingService.catch("Error in DynamicTemplateDirective injectElementNextToSibling: ",r)}}updateDataOnComponentRefs(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: updateDataOnComponentRefs","color: green;"),this.componentRefs.forEach(i=>{this.dynamicComponentService.setCommentRefData(e,i)})}catch(i){this.loggingService.catch("Error in DynamicTemplateDirective updateDataOnComponentRefs: ",i)}}ngOnDestroy(){try{this.cleanUp()}catch(e){this.loggingService.catch("Error in DynamicTemplateDirective ngOnDestroy: ",e)}}cleanUp(){try{this.componentRefs.forEach(e=>{e.destroy()}),this.injectedElements.forEach(e=>{e.remove()}),this.injectedElements=[],this.viewContainer.clear()}catch(e){this.loggingService.catch("Error in DynamicTemplateDirective cleanUp: ",e)}}};o.\u0275fac=function(i){return new(i||o)(u(k),u(So),u(Si),u(r_),u(y),u(Ne),u(ze),u(b))},o.\u0275dir=Bt({type:o,selectors:[["","veltDynamicTemplate",""]],inputs:{veltDynamicTemplate:"veltDynamicTemplate"},standalone:!1});let n=o;return n})();function Njt(n,o){if(n&1&&w(0,"div",7),n&2){let t=l(2);x("data-testid",t.componentId+"-unread-indicator")("aria-hidden","true")}}function Fjt(n,o){if(n&1&&(f(0),C(1,"div",1)(2,"div",2),le(),C(3,"svg",3),A(4,"translate"),w(5,"path",4),S(),g(6,Njt,1,2,"div",5),S(),mt(),C(7,"span",6),te(8),S()(),v()),n&2){let t=o.ngIf,e=l();d(),x("data-testid",e.componentId)("role","status"),d(),x("data-testid",e.componentId+"-unread-container")("aria-hidden",!(t!=null&&t.unreadAnnotationCount)),d(),x("role","img")("aria-label",P(4,11,"Comment icon"))("focusable","false"),d(3),c("ngIf",t==null?null:t.unreadAnnotationCount),d(),x("data-testid",e.componentId+"-count")("aria-hidden","true"),d(),je(t==null?null:t.count)}}var Tfe=(()=>{let o=class o extends nt{constructor(e,i,r,a,s){super(s,a,void 0,e),this.commentService=e,this.loggingService=i,this.customFilterService=r,this.themeService=a,this.elementRef=s,this.componentConfigSignal=Te({unreadCommentsMap:null,count:0}),this.subscription=[],this.componentId="velt-comment-pin-bubble";try{this.subscription.push(this.commentService.getUnreadCommentsMap$().subscribe(m=>{this.componentConfigSignal.update(p=>(p=I({},p),p.unreadCommentsMap=m,p))}))}catch(m){this.catchError("Error in CommentPinBubbleComponent constructor: ",m)}}ngOnInit(){try{this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentPinBubbleComponent ngOnInit:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentPinBubbleComponent setupA11yAttributes:",e)}}ngOnChanges(e){super.ngOnChanges(e);try{e&&Object.keys(e).forEach(i=>{this.componentConfigSignal.update(r=>{if(r=T(I({},r),{[i]:e[i].currentValue}),i==="annotation")if(r?.annotation?.type==="multiThread"){let a=Object.keys(r.unreadCommentsMap||{});r?.annotation?.commentAnnotationsMap&&(r.count=0,Object.values(r?.annotation?.commentAnnotationsMap||{}).forEach(s=>{s?.status?.id!==this.customFilterService.resolvedStatus?.id&&(r.count=(r?.count||0)+1),a.includes(s.annotationId)&&(r.unreadAnnotationCount=(r.unreadAnnotationCount||0)+1)}))}else r.count=r?.annotation?.comments?.length;return r})})}catch{}}ngOnDestroy(){super.ngOnDestroy();try{this.subscription.forEach(e=>e.unsubscribe())}catch(e){this.catchError("Error in CommentPinBubbleComponent ngOnDestroy: ",e)}}catchError(e,i,r){try{this.loggingService.catch(e,i,T(I({},r||{}),{annotationId:this.componentConfigSignal()?.annotation?.annotationId}))}catch{}}};o.\u0275fac=function(i){return new(i||o)(u(we),u(y),u(zo),u(Ye),u(k))},o.\u0275cmp=O({type:o,selectors:[["velt-comment-pin-bubble-internal"]],inputs:{annotation:"annotation"},standalone:!1,features:[B,Xe],decls:1,vars:1,consts:[[4,"ngIf"],[1,"velt-comment-pin-bubble-container"],[1,"velt-comment-pin-bubble--unread-indicator-container"],["width","16","height","16","viewBox","0 0 16 16","fill","none","xmlns","http://www.w3.org/2000/svg"],["d","M12.6666 1.33325H3.33325C2.80282 1.33325 2.29411 1.54397 1.91904 1.91904C1.54397 2.29411 1.33325 2.80282 1.33325 3.33325V9.99992C1.33325 10.5304 1.54397 11.0391 1.91904 11.4141C2.29411 11.7892 2.80282 11.9999 3.33325 11.9999H11.0599L13.5266 14.4733C13.5889 14.535 13.6628 14.5839 13.744 14.6171C13.8252 14.6503 13.9122 14.6671 13.9999 14.6666C14.0874 14.6688 14.1741 14.6506 14.2533 14.6133C14.375 14.5632 14.4792 14.4783 14.5528 14.3692C14.6263 14.26 14.6659 14.1315 14.6666 13.9999V3.33325C14.6666 2.80282 14.4559 2.29411 14.0808 1.91904C13.7057 1.54397 13.197 1.33325 12.6666 1.33325ZM13.3333 12.3933L11.8066 10.8599C11.7443 10.7981 11.6704 10.7492 11.5892 10.7161C11.508 10.6829 11.421 10.6661 11.3333 10.6666H3.33325C3.15644 10.6666 2.98687 10.5963 2.86185 10.4713C2.73682 10.3463 2.66659 10.1767 2.66659 9.99992V3.33325C2.66659 3.15644 2.73682 2.98687 2.86185 2.86185C2.98687 2.73682 3.15644 2.66659 3.33325 2.66659H12.6666C12.8434 2.66659 13.013 2.73682 13.138 2.86185C13.263 2.98687 13.3333 3.15644 13.3333 3.33325V12.3933Z","fill","currentColor"],["class","velt-comment-pin-bubble--unread-indicator",4,"ngIf"],[1,"velt-comment-pin-bubble--count"],[1,"velt-comment-pin-bubble--unread-indicator"]],template:function(i,r){i&1&&g(0,Fjt,9,13,"ng-container",0),i&2&&c("ngIf",r.componentConfigSignal())},dependencies:[Z,de],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}[_nghost-%COMP%]{--velt-green: var(--velt-light-mode-green);--velt-magenta: var(--velt-light-mode-magenta);--velt-amber: var(--velt-light-mode-amber);--velt-purple: var(--velt-light-mode-purple);--velt-cyan: var(--velt-light-mode-cyan);--velt-orange: var(--velt-light-mode-orange);--velt-black: var(--velt-light-mode-black);--velt-white: var(--velt-light-mode-white);--velt-gray: var(--velt-light-mode-gray);--velt-error: var(--velt-light-mode-error);--velt-error-hover: var(--velt-light-mode-error-hover);--velt-error-foreground: var(--velt-light-mode-error-foreground);--velt-error-light: var(--velt-light-mode-error-light);--velt-error-transparent: var(--velt-light-mode-error-transparent);--velt-warning: var(--velt-light-mode-warning);--velt-warning-hover: var(--velt-light-mode-warning-hover);--velt-warning-foreground: var(--velt-light-mode-warning-foreground);--velt-warning-light: var(--velt-light-mode-warning-light);--velt-warning-transparent: var(--velt-light-mode-warning-transparent);--velt-success: var(--velt-light-mode-success);--velt-success-hover: var(--velt-light-mode-success-hover);--velt-success-foreground: var(--velt-light-mode-success-foreground);--velt-success-light: var(--velt-light-mode-success-light);--velt-success-transparent: var(--velt-light-mode-success-transparent);--velt-accent: var(--velt-light-mode-accent);--velt-accent-text: var(--velt-light-mode-accent-text);--velt-accent-hover: var(--velt-light-mode-accent-hover);--velt-accent-foreground: var(--velt-light-mode-accent-foreground);--velt-accent-light: var(--velt-light-mode-accent-light);--velt-accent-transparent: var(--velt-light-mode-accent-transparent);--velt-text-0: var(--velt-light-mode-text-0);--velt-text-1: var(--velt-light-mode-text-1);--velt-text-2: var(--velt-light-mode-text-2);--velt-text-3: var(--velt-light-mode-text-3);--velt-text-4: var(--velt-light-mode-text-4);--velt-text-5: var(--velt-light-mode-text-5);--velt-text-6: var(--velt-light-mode-text-6);--velt-text-7: var(--velt-light-mode-text-7);--velt-text-8: var(--velt-light-mode-text-8);--velt-text-9: var(--velt-light-mode-text-9);--velt-text-10: var(--velt-light-mode-text-10);--velt-text-11: var(--velt-light-mode-text-11);--velt-text-12: var(--velt-light-mode-text-12);--velt-background-0: var(--velt-light-mode-background-0);--velt-background-1: var(--velt-light-mode-background-1);--velt-background-2: var(--velt-light-mode-background-2);--velt-background-3: var(--velt-light-mode-background-3);--velt-background-4: var(--velt-light-mode-background-4);--velt-background-5: var(--velt-light-mode-background-5);--velt-background-6: var(--velt-light-mode-background-6);--velt-background-7: var(--velt-light-mode-background-7);--velt-background-8: var(--velt-light-mode-background-8);--velt-background-9: var(--velt-light-mode-background-9);--velt-background-10: var(--velt-light-mode-background-10);--velt-border-0: var(--velt-light-mode-border-0);--velt-border-1: var(--velt-light-mode-border-1);--velt-border-2: var(--velt-light-mode-border-2);--velt-border-3: var(--velt-light-mode-border-3);--velt-border-4: var(--velt-light-mode-border-4);--velt-border-5: var(--velt-light-mode-border-5);--velt-border-6: var(--velt-light-mode-border-6);--velt-border-7: var(--velt-light-mode-border-7);--velt-border-8: var(--velt-light-mode-border-8);--velt-border-9: var(--velt-light-mode-border-9);--velt-border-10: var(--velt-light-mode-border-10);--velt-background-transparent: var(--velt-light-mode-background-transparent);--velt-border-transparent: var(--velt-light-mode-border-transparent);--velt-animation-transparent: var(--velt-light-mode-animation-transparent);display:flex;cursor:pointer}[dark][_nghost-%COMP%]{--velt-green: var(--velt-dark-mode-green);--velt-magenta: var(--velt-dark-mode-magenta);--velt-amber: var(--velt-dark-mode-amber);--velt-purple: var(--velt-dark-mode-purple);--velt-cyan: var(--velt-dark-mode-cyan);--velt-orange: var(--velt-dark-mode-orange);--velt-black: var(--velt-dark-mode-black);--velt-white: var(--velt-dark-mode-white);--velt-gray: var(--velt-dark-mode-gray);--velt-error: var(--velt-dark-mode-error);--velt-error-hover: var(--velt-dark-mode-error-hover);--velt-error-foreground: var(--velt-dark-mode-error-foreground);--velt-error-light: var(--velt-dark-mode-error-light);--velt-error-transparent: var(--velt-dark-mode-error-transparent);--velt-warning: var(--velt-dark-mode-warning);--velt-warning-hover: var(--velt-dark-mode-warning-hover);--velt-warning-foreground: var(--velt-dark-mode-warning-foreground);--velt-warning-light: var(--velt-dark-mode-warning-light);--velt-warning-transparent: var(--velt-dark-mode-warning-transparent);--velt-success: var(--velt-dark-mode-success);--velt-success-hover: var(--velt-dark-mode-success-hover);--velt-success-foreground: var(--velt-dark-mode-success-foreground);--velt-success-light: var(--velt-dark-mode-success-light);--velt-success-transparent: var(--velt-dark-mode-success-transparent);--velt-accent: var(--velt-dark-mode-accent);--velt-accent-text: var(--velt-dark-mode-accent-text);--velt-accent-hover: var(--velt-dark-mode-accent-hover);--velt-accent-foreground: var(--velt-dark-mode-accent-foreground);--velt-accent-light: var(--velt-dark-mode-accent-light);--velt-accent-transparent: var(--velt-dark-mode-accent-transparent);--velt-text-0: var(--velt-dark-mode-text-0);--velt-text-1: var(--velt-dark-mode-text-1);--velt-text-2: var(--velt-dark-mode-text-2);--velt-text-3: var(--velt-dark-mode-text-3);--velt-text-4: var(--velt-dark-mode-text-4);--velt-text-5: var(--velt-dark-mode-text-5);--velt-text-6: var(--velt-dark-mode-text-6);--velt-text-7: var(--velt-dark-mode-text-7);--velt-text-8: var(--velt-dark-mode-text-8);--velt-text-9: var(--velt-dark-mode-text-9);--velt-text-10: var(--velt-dark-mode-text-10);--velt-text-11: var(--velt-dark-mode-text-11);--velt-text-12: var(--velt-dark-mode-text-12);--velt-background-0: var(--velt-dark-mode-background-0);--velt-background-1: var(--velt-dark-mode-background-1);--velt-background-2: var(--velt-dark-mode-background-2);--velt-background-3: var(--velt-dark-mode-background-3);--velt-background-4: var(--velt-dark-mode-background-4);--velt-background-5: var(--velt-dark-mode-background-5);--velt-background-6: var(--velt-dark-mode-background-6);--velt-background-7: var(--velt-dark-mode-background-7);--velt-background-8: var(--velt-dark-mode-background-8);--velt-background-9: var(--velt-dark-mode-background-9);--velt-background-10: var(--velt-dark-mode-background-10);--velt-border-0: var(--velt-dark-mode-border-0);--velt-border-1: var(--velt-dark-mode-border-1);--velt-border-2: var(--velt-dark-mode-border-2);--velt-border-3: var(--velt-dark-mode-border-3);--velt-border-4: var(--velt-dark-mode-border-4);--velt-border-5: var(--velt-dark-mode-border-5);--velt-border-6: var(--velt-dark-mode-border-6);--velt-border-7: var(--velt-dark-mode-border-7);--velt-border-8: var(--velt-dark-mode-border-8);--velt-border-9: var(--velt-dark-mode-border-9);--velt-border-10: var(--velt-dark-mode-border-10);--velt-background-transparent: var(--velt-dark-mode-background-transparent);--velt-border-transparent: var(--velt-dark-mode-border-transparent);--velt-animation-transparent: var(--velt-dark-mode-animation-transparent)}.velt-comment-pin-bubble-container[_ngcontent-%COMP%]{display:flex;padding:var(--velt-spacing-xs);align-items:center;border-radius:var(--velt-border-radius-sm);box-shadow:0 0 1px #4551613d,0 2px 4px #45516124;color:var(--velt-accent-text);gap:var(--velt-spacing-xs);background-color:var(--velt-background-0);font-family:var(--velt-default-font-family)}.velt-comment-pin-bubble--unread-indicator-container[_ngcontent-%COMP%]{position:relative;display:flex}.velt-comment-pin-bubble--unread-indicator[_ngcontent-%COMP%]{position:absolute;top:-2px;right:-2px;display:block;width:8px;height:8px;margin-left:var(--velt-spacing-xs);border-radius:var(--velt-border-radius-full);background-color:var(--velt-error);color:var(--velt-error-foreground)}"],changeDetection:0});let n=o;return n})();var Bjt=["commentDialogOverlay"],Vjt=["commentPinBubbleOverlay"],Ujt=["*"],jjt=()=>["snippyly-overlay-panel","velt-comment-pin-bubble-overlay-panel"],Dfe=n=>({trigger:n}),$jt=()=>["snippyly-overlay-panel","velt-comment-dialog-overlay-panel"];function Hjt(n,o){n&1&&Ue(0)}function zjt(n,o){if(n&1&&(f(0),g(1,Hjt,1,0,"ng-container",13),v()),n&2){l();let t=pe(1);l(2);let e=pe(9);d(),c("ngTemplateOutlet",e)("ngTemplateOutletContext",M(2,Dfe,t))}}function Gjt(n,o){if(n&1){let t=q();C(0,"div",11,4),A(2,"translate"),G("click",function(i){return N(t),F(i.preventDefault())})("pointerenter",function(i){return N(t),l(3).onBubblePointerOver(i),F(i.stopPropagation())})("pointerleave",function(){N(t);let i=l(3);return F(i.onBubblePointerOut())})("pointerup",function(){N(t);let i=l(3);return F(i.onPointerUpOnBubble())}),C(3,"velt-comment-pin-bubble-internal",12),G("afterViewInit",function(){N(t);let i=l(3);return F(i.onBubbleAfterViewInit())})("onDestroy",function(){N(t);let i=l(3);return F(i.onBubbleOnDestroy())}),S()(),g(4,zjt,2,4,"ng-container",6)}if(n&2){let t=l(2).ngIf;x("role","button")("aria-expanded",t.commentBubbleHover)("aria-label",P(2,5,"Comment bubble")),d(3),c("annotation",t.annotation),d(),c("ngIf",t.isBubbleInitialized)}}function Wjt(n,o){if(n&1){let t=q();f(0),g(1,Gjt,5,7,"ng-template",10,3,De),G("positionChange",function(i){N(t);let r=l(2);return F(r.onCommentPinBubblePositionChange(i))}),v()}if(n&2){let t=l().ngIf,e=pe(2);d(),c("cdkConnectedOverlayOrigin",e)("cdkConnectedOverlayOpen",!t.annotationDragging&&!!(t!=null&&t.user)&&(t.bubbleOnPinHover&&t.commentPinHover||t.commentBubbleHover||t.commentPinSelected))("cdkConnectedOverlayPanelClass",Nt(10,jjt))("cdkConnectedOverlayOffsetY",t.popoverMode?0:t.commentPinBubbleOverlayOriginY==="top"?-8:2)("cdkConnectedOverlayOffsetX",t.popoverMode?t.commentPinBubbleOverlayOriginX==="end"?4:0:t.showCommentIndex&&t.commentPinBubbleOverlayOriginX==="end"?8:0)("cdkConnectedOverlayBackdropClass","velt-overlay-backdrop")("cdkConnectedOverlayLockPosition",!1)("cdkConnectedOverlayPositions",t.positions)("cdkConnectedOverlayGrowAfterOpen",!0)("cdkConnectedOverlayDisableClose",!0)}}function qjt(n,o){n&1&&Ue(0)}function Yjt(n,o){if(n&1&&g(0,qjt,1,0,"ng-container",13),n&2){l();let t=pe(2),e=pe(9);c("ngTemplateOutlet",e)("ngTemplateOutletContext",M(2,Dfe,t))}}function Kjt(n,o){if(n&1){let t=q();f(0),C(1,"velt-multi-thread-comment-dialog-internal",14),A(2,"translate"),G("saveComment",function(i){N(t);let r=l(4);return F(r.saveComment.emit(i))})("updateOverlayPosition",function(){N(t);let i=l(4);return F(i.updateOverlayPosition())})("pointerOutFromCommentDialog",function(i){N(t);let r=l(4);return F(r.onPointerOutFromCommentDialog(i))})("pointerUp",function(i){N(t);let r=l(4);return F(r.onPointerUpOnDialog(i))}),S(),v()}if(n&2){let t=l(3).ngIf;d(),c("multiThreadAnnotationId",t.annotation==null?null:t.annotation.annotationId)("annotation",t.annotation)("user",t.user)("commentPinSelected",t.commentPinSelected)("containerComponentId",t.containerComponentId)("commentPinType",t.commentPinType),x("role","dialog")("aria-label",P(2,8,"Multi-thread comment dialog"))}}function Zjt(n,o){if(n&1){let t=q();C(0,"snippyly-comment-dialog",15),A(1,"translate"),G("saveComment",function(i){N(t);let r=l(4);return F(r.saveComment.emit(i))})("updateOverlayPosition",function(){N(t);let i=l(4);return F(i.updateOverlayPosition())})("pointerOutFromCommentDialog",function(i){N(t);let r=l(4);return F(r.onPointerOutFromCommentDialog(i))})("pointerUp",function(){N(t);let i=l(4);return F(i.onPointerUpOnDialog())}),S()}if(n&2){let t=l(3).ngIf;c("annotation",t.annotation)("user",t.user)("commentPinSelected",t.commentPinSelected)("containerComponentId",t.containerComponentId)("commentPinType",t.commentPinType),x("role","dialog")("aria-label",P(1,7,"Comment dialog"))}}function Xjt(n,o){if(n&1&&g(0,Kjt,3,10,"ng-container",8)(1,Zjt,2,9,"ng-template",null,2,De),n&2){let t=pe(2),e=l(2).ngIf;c("ngIf",(e==null||e.annotation==null?null:e.annotation.type)==="multiThread")("ngIfElse",t)}}function Qjt(n,o){if(n&1){let t=q();g(0,Xjt,3,2,"ng-template",10,5,De),G("positionChange",function(i){N(t);let r=l(2);return F(r.onCommentDialogPositionChange(i))})}if(n&2){let t=o.trigger,e=l().ngIf;c("cdkConnectedOverlayOrigin",t)("cdkConnectedOverlayOpen",(!e.commentBubbleAvailable||e.commentPinType==="bubble")&&!!(e!=null&&e.user)&&!e.annotationDragging&&(!e.isPhone||!e.mobileMode)&&!e.dialogOpenedInSidebar&&!e.streamMode&&!e.inboxMode&&e.floatingCommentsEnabled&&(e.commentPinSelected||e.dialogOnHover&&(e.bubbleOnPin?e.commentBubbleHover:e.commentPinHover)||e.commentPinType==="bubble"&&e.commentBubbleTargetPinHover))("cdkConnectedOverlayPanelClass",Nt(10,$jt))("cdkConnectedOverlayOffsetY",e.popoverMode?0:e.commentDialogOverlayOriginY==="top"?-8:2)("cdkConnectedOverlayOffsetX",e.popoverMode?e.commentDialogOverlayOriginX==="end"?4:0:e.showCommentIndex&&e.commentDialogOverlayOriginX==="end"?8:0)("cdkConnectedOverlayBackdropClass","velt-overlay-backdrop")("cdkConnectedOverlayLockPosition",!1)("cdkConnectedOverlayPositions",e.positions)("cdkConnectedOverlayGrowAfterOpen",!0)("cdkConnectedOverlayDisableClose",!0)}}function Jjt(n,o){if(n&1){let t=q();C(0,"snippyly-comment-bottom-sheet",16),A(1,"translate"),G("saveComment",function(i){N(t);let r=l(2);return F(r.saveComment.emit(i))}),S()}if(n&2){let t=l().ngIf;c("annotation",t.annotation)("user",t.user),x("role","dialog")("aria-label",P(1,4,"Comment bottom sheet"))}}function e$t(n,o){if(n&1){let t=q();f(0),C(1,"div",7,0),A(3,"translate"),G("click",function(i){return N(t),F(i.preventDefault())})("pointerenter",function(i){return N(t),l().onPointerOver(i),F(i.stopPropagation())})("pointerleave",function(){N(t);let i=l();return F(i.onPointerOut())}),Rt(4),S(),g(5,Wjt,3,11,"ng-container",8)(6,Yjt,1,4,"ng-template",null,1,De)(8,Qjt,2,11,"ng-template",null,2,De)(10,Jjt,2,6,"snippyly-comment-bottom-sheet",9),v()}if(n&2){let t=o.ngIf,e=pe(7),i=l();d(),x("data-testid",i.componentId+"-trigger")("role","button")("aria-expanded",t.commentPinSelected)("aria-haspopup","dialog")("aria-label",P(3,8,"Comment pin")),d(4),c("ngIf",t.bubbleOnPin&&!t.commentBubbleAvailable&&!t.dialogOpenedInSidebar)("ngIfElse",e),d(5),c("ngIf",(t==null?null:t.user)&&t.mobileMode&&t.isPhone&&!t.sidebarVisible&&!t.dialogOpenedInSidebar&&!t.inboxMode&&!t.streamMode&&t.floatingCommentsEnabled&&t.commentPinSelected)}}var a_=(()=>{let o=class o{constructor(e,i,r,a,s){this.breakpointObserver=e,this.commentService=i,this.domService=r,this.loggingService=a,this.elementRef=s,this.commentPinSelected=!1,this.annotationDragging=!1,this.commentPinType="pin",this.commentBubbleTargetPinHover=!1,this.showBubbleOnHover=!1,this.bubbleOnPin=!1,this.bubbleOnPinHover=!1,this.saveComment=new Ae,this.togglePinSelection=new Ae,this.commentTargetElementClicked=new Ae,this.isDialogOnHoverEnabled=!1,this.isDialogOnTargetElementClickEnabled=!1,this.previouslySelectedAnnotations={},this.eventListenersSubscriptions=[],this.customScrollableParentEventsListenersSubscriptions=[],this.componentConfigSignal=Te({bubbleOnPin:!1,bubbleOnPinHover:!1,dialogOnHover:!1,commentBubbleAvailable:!1,commentPinHover:!1,commentBubbleHover:!1,commentPinSelected:!1,popoverMode:!1,showCommentIndex:!1,commentBubbleTargetPinHover:!1,isBubbleInitialized:!1,annotationDragging:!1,commentPinBubbleOverlayOriginX:"start",commentPinBubbleOverlayOriginY:"top",positions:[],annotation:void 0,commentPinType:"pin",isPhone:!1,mobileMode:!1,streamMode:!1,inboxMode:!1,floatingCommentsEnabled:!1,sidebarVisible:!1,dialogOpenedInSidebar:!1,commentDialogOverlayOriginX:"start",commentDialogOverlayOriginY:"top",user:void 0}),this.subscriptions=[],this.componentId="velt-comment-dialog-portal";try{this.loggingService.log("%c[WB] Creating COMPONENT CommentDialogPortalComponent","color: blue;"),this.subscriptions.push(this.breakpointObserver.observe(Oi.XSmall).subscribe(m=>{m.matches?this.componentConfigSignal.update(p=>(p=T(I({},p),{isPhone:!0}),p)):this.componentConfigSignal.update(p=>(p=T(I({},p),{isPhone:!1}),p))},m=>{this.catchError("Error in CommentDialogPortalComponent breakpointObserver subscription: ",m)})),this.subscriptions.push(this.commentService.getSidebarVisibility$().subscribe(m=>{this.componentConfigSignal.update(p=>(p=T(I({},p),{sidebarVisible:m}),p))},m=>{this.catchError("Error in CommentDialogPortalComponent getSidebarVisibility$ subscription: ",m)})),this.subscriptions.push(this.commentService.getMobileMode$().subscribe(m=>{this.componentConfigSignal.update(p=>(p=T(I({},p),{mobileMode:m}),p))},m=>{this.catchError("Error in CommentDialogPortalComponent getMobileMode$ subscription: ",m)})),this.subscriptions.push(this.commentService.getShowCommentIndex().subscribe(m=>{this.componentConfigSignal.update(p=>(p=T(I({},p),{showCommentIndex:m}),p))},m=>{this.catchError("Error in CommentDialogPortalComponent getShowCommentIndex subscription: ",m)})),this.subscriptions.push(this.commentService.getStreamMode$().subscribe(m=>{this.componentConfigSignal.update(p=>(p=T(I({},p),{streamMode:m}),p))},m=>{this.catchError("Error in CommentDialogPortalComponent getStreamMode$ subscription: ",m)})),this.subscriptions.push(this.commentService.getInboxMode$().subscribe(m=>{this.componentConfigSignal.update(p=>(p=T(I({},p),{inboxMode:m}),p))},m=>{this.catchError("Error in CommentDialogPortalComponent getInboxMode subscription: ",m)})),this.subscriptions.push(this.domService.getDialogOpenedInSidebar().subscribe(m=>{this.componentConfigSignal.update(p=>(p=T(I({},p),{dialogOpenedInSidebar:m}),p))},m=>{this.catchError("Error in CommentDialogPortalComponent getDialogOpenedInSidebar subscription: ",m)})),this.subscriptions.push(this.commentService.getPopoverMode$().subscribe(m=>{this.componentConfigSignal.update(p=>(p=T(I({},p),{popoverMode:m}),p)),this.componentConfigSignal().popoverMode?this.componentConfigSignal.update(p=>(p=T(I({},p),{positions:j.OVERLAY_POSITIONS_FOR_POPOVER_MODE.map(h=>new fi({originX:h.originX,originY:h.originY},{overlayX:h.overlayX,overlayY:h.overlayY}))}),p)):this.componentConfigSignal.update(p=>(p=T(I({},p),{positions:j.OVERLAY_POSITIONS.map(h=>new fi({originX:h.originX,originY:h.originY},{overlayX:h.overlayX,overlayY:h.overlayY}))}),p)),this.addEventListeners()},m=>{this.catchError("Error in CommentDialogPortalComponent getPopoverMode subscription: ",m)})),this.subscriptions.push(this.commentService.showFloatingComments$().subscribe(m=>{this.componentConfigSignal.update(p=>(p=T(I({},p),{floatingCommentsEnabled:m}),p))},m=>{this.catchError("Error in CommentDialogPortalComponent showFloatingComments$ subscription: ",m)})),this.subscriptions.push(this.commentService.getEnableDialogOnHover$().subscribe(m=>{this.isDialogOnHoverEnabled=m,this.componentConfigSignal.update(p=>(p=T(I({},p),{dialogOnHover:m}),p)),this.addEventListeners()},m=>{this.catchError("Error in CommentDialogPortalComponent getEnableDialogOnHover subscription: ",m)})),this.subscriptions.push(this.commentService.getEnableDialogOnTargetElementClick$().subscribe(m=>{this.isDialogOnTargetElementClickEnabled=m,this.addEventListeners()},m=>{this.catchError("Error in CommentDialogPortalComponent getEnableDialogOnTargetElementClick subscription: ",m)})),this.subscriptions.push(this.commentService.getBubbleCommentAnnotationIds$().subscribe(m=>{if(m.includes(this.componentConfigSignal().annotation?.annotationId)){this.commentBubbleElement=this.commentService.getCommentBubbleElement(this.componentConfigSignal().annotation);let p=this.commentBubbleElement?.getAttribute(j.ATTRIBUTES.VELT_ANNOTATION_ID)||"";this.commentBubbleElementAnnotationId!==p&&(this.commentBubbleElementAnnotationId=p,this.componentConfigSignal.update(h=>(h=T(I({},h),{commentBubbleAvailable:!0}),h)))}else this.componentConfigSignal().commentBubbleAvailable&&(this.commentBubbleElement=null,this.commentBubbleElementAnnotationId="",this.componentConfigSignal.update(p=>(p=T(I({},p),{commentBubbleAvailable:!1}),p)))},m=>{this.catchError("Error in CommentDialogPortalComponent getBubbleCommentAnnotationIds$ subscription: ",m)})),this.subscriptions.push(this.domService.getSelectedAnnotationsMap$().pipe(Pi()).subscribe(([m,p])=>{this.previouslySelectedAnnotations=m||{},p&&!p[this.componentConfigSignal().annotation?.annotationId]&&this.componentConfigSignal().commentPinHover&&this.setCommentPinHover(!1)},m=>{this.catchError("Error in CommentDialogPortalComponent getSelectedAnnotationsMap$ subscription: ",m)}))}catch(m){this.catchError("Error in CommentDialogPortalComponent constructor: ",m)}}ngOnInit(){try{this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogPortalComponent ngOnInit:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogPortalComponent setupA11yAttributes:",e)}}ngAfterViewInit(){try{this.updateHighlightOnElement(),this.updateCommentActiveAttributeOnElement()}catch(e){this.catchError("Error in CommentDialogPortalComponent AfterViewInit: ",e)}}ngOnChanges(e){try{e&&Object.keys(e).forEach(i=>{this.componentConfigSignal.update(r=>(r=T(I({},r),{[i]:e[i].currentValue}),r))}),e?.commentPinSelected&&(this.componentConfigSignal().commentPinSelected&&this.setCommentPinHover(!1),this.updateHighlightOnElement(),this.updateCommentActiveAttributeOnElement()),e?.targetElement&&(this.addEventListeners(),this.targetElement?this.setCustomScrollableParents(Pp(this.targetElement)):this.setCustomScrollableParents([]))}catch(i){this.catchError("Error in CommentDialogPortalComponent ngOnChanges: ",i)}}onBubbleAfterViewInit(){try{this.componentConfigSignal.update(e=>(e=T(I({},e),{isBubbleInitialized:!0}),e))}catch(e){this.catchError("Error in CommentDialogPortalComponent onBubbleAfterViewInit: ",e)}}onBubbleOnDestroy(){try{this.componentConfigSignal.update(e=>(e=T(I({},e),{isBubbleInitialized:!1}),e))}catch(e){this.catchError("Error in CommentDialogPortalComponent onBubbleOnDestroy: ",e)}}onCommentPinBubblePositionChange(e){try{this.componentConfigSignal.update(i=>(i=T(I({},i),{commentPinBubbleOverlayOriginX:e.connectionPair.originX,commentPinBubbleOverlayOriginY:e.connectionPair.originY}),i))}catch(i){this.catchError("Error in CommentDialogPortalComponent onCommentPinBubblePositionChange: ",i)}}onCommentDialogPositionChange(e){try{this.componentConfigSignal.update(i=>(i=T(I({},i),{commentDialogOverlayOriginX:e.connectionPair.originX,commentDialogOverlayOriginY:e.connectionPair.originY}),i))}catch(i){this.catchError("Error in CommentDialogPortalComponent onCommentDialogPositionChange: ",i)}}updateOverlayPosition(){try{this.loggingService.log("updateOverlayPosition",this.componentConfigSignal().annotation?.annotationId),this.commentPinBubbleOverlay&&this.commentPinBubbleOverlay?.overlayRef?.updatePosition(),this.commentDialogOverlay&&this.commentDialogOverlay?.overlayRef?.updatePosition()}catch{}}onPointerOutFromCommentDialog(e){try{!this.targetElement?.contains(e?.relatedTarget)&&!this.componentConfigSignal().commentPinSelected&&this.onPointerOut()}catch(i){this.catchError("Error in CommentDialogPortalComponent onPointerOutFromCommentDialog: ",i)}}onPointerOut(){try{this.componentConfigSignal().bubbleOnPin?setTimeout(()=>{this.setCommentPinHover(!1)},500):this.setCommentPinHover(!1)}catch(e){this.catchError("Error in CommentDialogPortalComponent onPointerOut: ",e)}}setCommentPinHover(e){try{e&&this.targetElement&&!this.domService.isElementVisibleOnScreen(this.targetElement)&&(e=!1),this.componentConfigSignal.update(i=>(i=T(I({},i),{commentPinHover:e}),i)),this.updateHighlightOnElement(),this.updateCommentActiveAttributeOnElement(),this.commentBubbleElement&&(this.componentConfigSignal().commentPinHover?this.commentBubbleElement.setAttribute("comment-bubble-target-pin-hover","true"):this.commentBubbleElement.removeAttribute("comment-bubble-target-pin-hover"))}catch(i){this.catchError("Error in CommentDialogPortalComponent setCommentPinHover: ",i)}}addEventListeners(){try{this.removeEventListeners(),this.componentConfigSignal().popoverMode&&this.targetElement&&this.isDialogOnTargetElementClickEnabled&&this.componentConfigSignal().commentPinType!=="bubble"&&(this.isDialogOnHoverEnabled&&(this.eventListenersSubscriptions.push(ri(this.targetElement,"pointerover").subscribe(e=>{this.onPointerOver(e),e.stopPropagation()},e=>{this.catchError("Error in CommentDialogPortalComponent addEventListeners pointerover subscription: ",e)})),this.eventListenersSubscriptions.push(ri(this.targetElement,"pointerout").subscribe(e=>{!this.targetElement?.contains(e?.relatedTarget)&&!e?.relatedTarget?.closest(j.TAGS.SNIPPYLY_COMMENT_DIALOG)&&this.onPointerOut()},e=>{this.catchError("Error in CommentDialogPortalComponent addEventListeners pointerout subscription: ",e)}))),this.eventListenersSubscriptions.push(ri(this.targetElement,"click").subscribe(e=>{this.previouslySelectedAnnotations[this.componentConfigSignal().annotation?.annotationId]||(this.commentTargetElementClicked.emit(),e.stopPropagation())},e=>{this.catchError("Error in CommentDialogPortalComponent addEventListeners click subscription: ",e)})))}catch(e){this.catchError("Error in CommentDialogPortalComponent addEventListeners: ",e)}}removeEventListeners(){try{this.eventListenersSubscriptions.map(e=>{e.unsubscribe()}),this.eventListenersSubscriptions=[]}catch(e){this.catchError("Error in CommentDialogPortalComponent removeEventListeners: ",e)}}updateHighlightOnElement(){try{this.targetElement&&(this.componentConfigSignal().commentPinSelected||this.componentConfigSignal().commentPinHover?this.domService.highlightElement(this.targetElement):this.domService.removeHighlightFromElement(this.targetElement))}catch(e){this.catchError("Error in CommentDialogPortalComponent updateHighlightOnElement: ",e)}}updateCommentActiveAttributeOnElement(){try{this.loggingService.log("%c[WB] Calling FUNCTION: updateCommentActiveAttributeOnElement","color: green;"),this.componentConfigSignal().commentPinSelected||this.componentConfigSignal().commentPinHover?this.targetElement&&(this.targetElement?.hasAttribute(j.ATTRIBUTES.VELT_COMMENT_PIN_ACTIVE)||this.targetElement?.setAttribute(j.ATTRIBUTES.VELT_COMMENT_PIN_ACTIVE,"true")):this.targetElement&&this.targetElement?.hasAttribute(j.ATTRIBUTES.VELT_COMMENT_PIN_ACTIVE)&&this.targetElement?.removeAttribute(j.ATTRIBUTES.VELT_COMMENT_PIN_ACTIVE)}catch(e){this.catchError("Error in CommentDialogPortalComponent onCommentFocusChange: ",e)}}onPointerUpOnDialog(e){try{(!this.componentConfigSignal().commentPinSelected||e)&&this.togglePinSelection.emit(e)}catch(i){this.catchError("Error in CommentDialogPortalComponent onPointerUpOnDialog: ",i)}}onPointerOver(e){try{if(this.componentConfigSignal().commentPinHover)return;e.buttons?this.componentConfigSignal().commentPinHover&&this.setCommentPinHover(!1):!this.componentConfigSignal().commentPinHover&&(this.componentConfigSignal().bubbleOnPin?this.componentConfigSignal().bubbleOnPinHover:this.isDialogOnHoverEnabled)&&this.setCommentPinHover(!0)}catch(i){this.catchError("Error in CommentDialogPortalComponent onPointerOver: ",i)}}setCustomScrollableParents(e){try{this.customScrollableParents=e,this.addCustomScrollableParentsEventListeners()}catch(i){this.catchError("Error in CommentDialogPortalComponent setCustomScrollableParents: ",i)}}addCustomScrollableParentsEventListeners(){try{this.removeCustomScrollableParentsEventListeners(),this.customScrollableParents?.length&&this.customScrollableParents?.forEach(e=>{this.customScrollableParentEventsListenersSubscriptions.push(ri(e,"scroll",{passive:!0}).subscribe(i=>{this.updateOverlayPosition()},i=>{this.catchError("Error in CommentDialogPortalComponent addCustomScrollableParentsEventListeners scroll subscription: ",i)}))})}catch(e){this.catchError("Error in CommentDialogPortalComponent addCustomScrollableParentsEventListeners: ",e)}}removeCustomScrollableParentsEventListeners(){try{this.customScrollableParentEventsListenersSubscriptions.map(e=>{e.unsubscribe()}),this.customScrollableParentEventsListenersSubscriptions=[]}catch(e){this.catchError("Error in CommentDialogPortalComponent removeCustomScrollableParentsEventListeners: ",e)}}onBubblePointerOver(e){try{if(this.componentConfigSignal().commentBubbleHover)return;e.buttons||this.componentConfigSignal.update(i=>(i=T(I({},i),{commentBubbleHover:!0}),i))}catch(i){this.catchError("Error in CommentDialogPortalComponent onBubblePointerOver: ",i)}}onBubblePointerOut(){try{this.componentConfigSignal.update(e=>(e=T(I({},e),{commentBubbleHover:!1}),e))}catch(e){this.catchError("Error in CommentDialogPortalComponent onBubblePointerOut: ",e)}}onPointerUpOnBubble(){try{this.componentConfigSignal().commentPinSelected||this.togglePinSelection.emit()}catch(e){this.catchError("Error in CommentDialogPortalComponent onPointerUpOnBubble: ",e)}}ngOnDestroy(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnDestroy","color: green;");try{this.unsubscribe()}catch(e){this.catchError("Error in CommentDialogPortalComponent ondestroy: ",e)}}unsubscribe(){this.loggingService.log("%c[WB] Calling FUNCTION: unsubscribe","color: green;");try{this.removeEventListeners(),this.removeCustomScrollableParentsEventListeners(),this.subscriptions.map(e=>{e.unsubscribe()}),this.subscriptions=[]}catch(e){this.catchError("Error in CommentDialogPortalComponent unsubscribe: ",e)}}catchError(e,i,r){try{this.loggingService.catch(e,i,T(I({},r||{}),{annotationId:this.componentConfigSignal()?.annotation?.annotationId}))}catch{}}};o.\u0275fac=function(i){return new(i||o)(u(po),u(we),u(Ne),u(y),u(k))},o.\u0275cmp=O({type:o,selectors:[["velt-comment-dialog-portal-internal"]],viewQuery:function(i,r){if(i&1&&(ot(Bjt,5),ot(Vjt,5)),i&2){let a;Qe(a=Je())&&(r.commentDialogOverlay=a.first),Qe(a=Je())&&(r.commentPinBubbleOverlay=a.first)}},inputs:{annotation:"annotation",commentPinSelected:"commentPinSelected",annotationDragging:"annotationDragging",commentPinType:"commentPinType",commentBubbleTargetPinHover:"commentBubbleTargetPinHover",user:"user",targetElement:"targetElement",showBubbleOnHover:"showBubbleOnHover",bubbleOnPin:"bubbleOnPin",bubbleOnPinHover:"bubbleOnPinHover",containerComponentId:"containerComponentId"},outputs:{saveComment:"saveComment",togglePinSelection:"togglePinSelection",commentTargetElementClicked:"commentTargetElementClicked"},standalone:!1,features:[Xe],ngContentSelectors:Ujt,decls:1,vars:1,consts:[["trigger","cdkOverlayOrigin"],["defaultDialogViewRef",""],["commentDialogRef",""],["commentPinBubbleOverlay","cdkConnectedOverlay"],["bubbleOnHoverTrigger","cdkOverlayOrigin"],["commentDialogOverlay","cdkConnectedOverlay"],[4,"ngIf"],["cdkOverlayOrigin","",3,"click","pointerenter","pointerleave"],[4,"ngIf","ngIfElse"],[3,"annotation","user","saveComment",4,"ngIf"],["cdkConnectedOverlay","",3,"positionChange","cdkConnectedOverlayOrigin","cdkConnectedOverlayOpen","cdkConnectedOverlayPanelClass","cdkConnectedOverlayOffsetY","cdkConnectedOverlayOffsetX","cdkConnectedOverlayBackdropClass","cdkConnectedOverlayLockPosition","cdkConnectedOverlayPositions","cdkConnectedOverlayGrowAfterOpen","cdkConnectedOverlayDisableClose"],["cdkOverlayOrigin","",3,"click","pointerenter","pointerleave","pointerup"],["veltAfterViewInit","",3,"afterViewInit","onDestroy","annotation"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[3,"saveComment","updateOverlayPosition","pointerOutFromCommentDialog","pointerUp","multiThreadAnnotationId","annotation","user","commentPinSelected","containerComponentId","commentPinType"],[3,"saveComment","updateOverlayPosition","pointerOutFromCommentDialog","pointerUp","annotation","user","commentPinSelected","containerComponentId","commentPinType"],[3,"saveComment","annotation","user"]],template:function(i,r){i&1&&(Vt(),g(0,e$t,11,10,"ng-container",6)),i&2&&c("ngIf",r.componentConfigSignal())},dependencies:[Z,vt,Vn,An,Go,$9,sg,Tfe,rs,de],encapsulation:2,changeDetection:0});let n=o;return n})();var t$t=["pinRef"],n$t=["commentDialogPortalRef"],i$t=["*"],Afe=n=>({componentConfigSignal:n}),o$t=(n,o)=>({condition:n,data:o}),Ofe=()=>["bubble","chart"],r$t=(n,o,t,e,i)=>({template:n,context:o,componentName:"velt-comment-pin-wireframe",variant:t,setIfCondition:e,componentElementRef:i}),a$t=(n,o,t)=>({"velt-comment-pin--status-default":n,"velt-comment-pin--status-ongoing":o,"velt-comment-pin--status-terminal":t});function s$t(n,o){n&1&&Ue(0)}function l$t(n,o){if(n&1&&(C(0,"velt-shadow-dom-internal"),g(1,s$t,1,0,"ng-container",11),S()),n&2){l();let t=pe(3),e=l(2);x("data-testid",e.componentId+"-shadow-dom"),d(),c("ngTemplateOutlet",t)}}function c$t(n,o){if(n&1){let t=q();f(0),C(1,"div",14),G("click",function(i){return N(t),F(i.preventDefault())}),Rt(2),S(),v()}n&2&&(d(),x("role","presentation"))}function m$t(n,o){if(n&1&&(f(0),w(1,"app-comment-pin-triangle",15),v()),n&2){let t=l(5);d(),c("componentConfigSignal",t.componentConfigSignal)("template",t.triangleTemplate)}}function d$t(n,o){n&1&&(le(),C(0,"svg",20),w(1,"path",21)(2,"path",22),S())}function p$t(n,o){n&1&&(le(),C(0,"svg",20),w(1,"path",23)(2,"path",24),S())}function g$t(n,o){n&1&&(le(),C(0,"svg",20),w(1,"path",25)(2,"path",26),S())}function u$t(n,o){n&1&&(le(),C(0,"svg",20),w(1,"path",27)(2,"path",28),S())}function h$t(n,o){if(n&1&&(f(0)(1,18),g(2,d$t,3,0,"svg",19)(3,p$t,3,0,"svg",19)(4,g$t,3,0,"svg",19)(5,u$t,3,0,"svg",19),v()()),n&2){let t=l(6).ngIf;d(),c("ngSwitch",t.annotation==null||t.annotation.pageInfo==null||t.annotation.pageInfo.deviceInfo==null?null:t.annotation.pageInfo.deviceInfo.deviceType),d(),c("ngSwitchCase","Mobile"),d(),c("ngSwitchCase","Tablet"),d(),c("ngSwitchCase","Desktop"),d(),c("ngSwitchCase","Monitor")}}function f$t(n,o){if(n&1&&w(0,"snippyly-user-avatar",29),n&2){let t=l(6).ngIf;c("user",t.annotation==null?null:t.annotation.from)}}function v$t(n,o){if(n&1&&(f(0),w(1,"app-comment-pin-unread-comment-indicator",15),v()),n&2){let t=l(7);d(),c("componentConfigSignal",t.componentConfigSignal)("template",t.unreadCommentIndicatorTemplate)}}function C$t(n,o){if(n&1&&w(0,"app-comment-pin-index",15)(1,"app-comment-pin-ghost-comment-indicator",15)(2,"app-comment-pin-private-comment-indicator",15),n&2){let t=l(7);c("componentConfigSignal",t.componentConfigSignal)("template",t.indexTemplate),d(),c("componentConfigSignal",t.componentConfigSignal)("template",t.ghostCommentIndicatorTemplate),d(),c("componentConfigSignal",t.componentConfigSignal)("template",t.privateCommentIndicatorTemplate)}}function _$t(n,o){if(n&1){let t=q();f(0),C(1,"div",17,5),G("click",function(i){return N(t),F(i.preventDefault())}),g(3,h$t,6,5,"ng-container",10)(4,f$t,1,1,"ng-template",null,6,De)(6,v$t,2,2,"ng-container",10)(7,C$t,3,6,"ng-template",null,7,De),S(),v()}if(n&2){let t=pe(5),e=pe(8),i=l(5).ngIf,r=l();d(),rt("--velt-internal-comment-pin-bg-color",(i.annotation==null||i.annotation.status==null?null:i.annotation.status.color)||null),ge("velt-comment-pin--marker-transparent",r.usingCustomCommentPin)("velt-comment-pin--marker-default",!r.usingCustomCommentPin),c("ngClass",$e(12,a$t,!i.customStatusesShown&&(i.annotation==null||i.annotation.status==null?null:i.annotation.status.type)==="default",!i.customStatusesShown&&(i.annotation==null||i.annotation.status==null?null:i.annotation.status.type)==="ongoing",!i.customStatusesShown&&(i.annotation==null||i.annotation.status==null?null:i.annotation.status.type)==="terminal")),x("role","presentation"),d(2),c("ngIf",i.isDeviceIndicatorOnCommentPinsEnabled&&i.isCommentAddedOnDifferentDeviceType)("ngIfElse",t),d(3),c("ngIf",!(i.user!=null&&i.user.isGuest)&&!(i.user!=null&&i.user.isAnonymous)&&(i==null||i.unreadCommentsMap==null?null:i.unreadCommentsMap[i.annotation==null?null:i.annotation.annotationId]))("ngIfElse",e)}}function y$t(n,o){if(n&1){let t=q();C(0,"div",14),G("click",function(i){return N(t),F(i.preventDefault())}),g(1,_$t,9,16,"ng-container",16),S()}if(n&2){let t=l(4).ngIf,e=l();x("role","presentation"),d(),c("veltDynamicTemplate",$(4,r$t,e.template,M(2,Afe,e.componentConfigSignal),t==null?null:t.variant,e.setIfCondition.bind(e),e.elementRef))}}function S$t(n,o){if(n&1&&g(0,m$t,2,2,"ng-container",10)(1,y$t,2,10,"ng-template",null,4,De),n&2){let t=pe(2),e=l(3).ngIf;c("ngIf",e.popoverMode)("ngIfElse",t)}}function b$t(n,o){if(n&1){let t=q();C(0,"velt-comment-dialog-portal-internal",12,1),G("saveComment",function(i){N(t);let r=l(3);return F(r.saveComment.emit(i))})("togglePinSelection",function(i){N(t);let r=l(3);return F(r.onPinBubblePointerUp(i))})("pointerUp",function(){N(t);let i=l(3);return F(i.onPointerUpOnDialog())}),C(2,"div",13,2),g(4,c$t,3,1,"ng-container",10)(5,S$t,3,2,"ng-template",null,3,De),S()()}if(n&2){let t=pe(6),e=l(2).ngIf,i=l();c("annotation",e.annotation)("user",e.user)("commentPinSelected",e.commentPinSelected)("annotationDragging",e.annotationDragging)("commentPinType",e.commentPinType)("targetElement",e.targetElement)("bubbleOnPin",e.bubbleOnPin)("bubbleOnPinHover",e.bubbleOnPinHover)("containerComponentId",e.containerComponentId),d(2),rt("--velt-internal-comment-pin-max-width",i.pinMaxWidth),ge("velt-comment-pin--ghost",!!(e.annotation!=null&&e.annotation.ghostComment))("velt-comment-pin--different-device",e.isDeviceIndicatorOnCommentPinsEnabled&&e.isCommentAddedOnDifferentDeviceType)("velt-comment-pin--outside-viewport",!e.annotationDragging&&i.isOutsideViewport)("velt-comment-pin-open",e.commentPinSelected&&!e.annotationDragging)("velt-comment-pin-unread-comment",!(e.user!=null&&e.user.isGuest)&&!(e.user!=null&&e.user.isAnonymous)&&(e==null||e.unreadCommentsMap==null?null:e.unreadCommentsMap[e.annotation==null?null:e.annotation.annotationId]))("velt-display-none",e.commentPinType!=="bubble"&&e.commentBubbleElementAnnotationId&&e.commentBubbleElementAnnotationId!==(e.annotation==null?null:e.annotation.annotationId)),x("data-testid",i.componentId)("role","button")("aria-expanded",e.commentPinSelected),d(2),c("ngIf",e.commentPinType==="bubble"||e.commentPinType==="chart")("ngIfElse",t)}}function I$t(n,o){if(n&1&&(f(0),g(1,l$t,2,2,"velt-shadow-dom-internal",10)(2,b$t,7,28,"ng-template",null,0,De),v()),n&2){let t=pe(3),e=l().ngIf,i=l();d(),c("ngIf",!i.template&&i.pinShadowDOM&&!(Nt(2,Ofe)!=null&&Nt(3,Ofe).includes(e.commentPinType)))("ngIfElse",t)}}function E$t(n,o){if(n&1&&(f(0),g(1,I$t,4,4,"ng-container",9),v()),n&2){let t=l();d(),c("veltIf",R(3,o$t,t.conditionSignal(),M(1,Afe,t.componentConfigSignal)))}}var mg=(()=>{let o=class o extends c9{constructor(e,i,r,a,s,m,p){super(m,p,r),this.commentService=e,this.domService=i,this.loggingService=r,this.commentPinPortalService=a,this.wireframeService=s,this.elementRef=m,this.dynamicDataService=p,this.commentPinSelected=!1,this.annotationDragging=!1,this.commentPinType="pin",this.usingCustomCommentPin=!1,this.multipleCommentPinsSelected=!1,this.avatarErrorImage="",this.saveComment=new Ae,this.pinShadowDOM=!1,this.subscriptions=[],this.commentTargetElementClicked=new Ae,this.togglePinSelection=new Ae,this.commentBubbleAvailable=!1,this.commentPinPosition={top:0,left:0},this.isOutsideViewport=!1,this.pinMaxWidth="",this.previouslySelectedAnnotations={},this.deviceInfo=new ei,this.COMMENT_PIN_SIZE=40,this.componentConfigSignal=Te({isGhostComment:!1,isPrivateComment:!1,showCommentIndex:!1,bubbleOnPin:!1,bubbleOnPinHover:!1,commentPinSelected:!1,annotationDragging:!1,popoverMode:!1,isDeviceIndicatorOnCommentPinsEnabled:!1,isCommentAddedOnDifferentDeviceType:!1,annotation:this.annotation,user:this.user,unreadCommentsMap:null,popoverTriangleComponent:!1}),this.veltElement=!0,this.componentId="velt-comment-pin",this.loggingService.log("%c[WB] Creating COMPONENT CommentPinComponent","color: blue;"),this.subscriptions.push(this.domService.getDeviceInfo$().subscribe(h=>{this.deviceInfo=h,this.checkIfCommentAddedOnDifferentDeviceType()})),this.subscriptions.push(this.commentService.getShowCommentIndex().subscribe(h=>{this.componentConfigSignal.update(_=>(_=T(I({},_),{showCommentIndex:h}),_))},h=>{this.catchError("Error in CommentPinComponent getShowCommentIndex subscription: ",h)})),this.subscriptions.push(this.commentService.getBubbleOnPin$().subscribe(h=>{this.componentConfigSignal.update(_=>(_=T(I({},_),{bubbleOnPin:h}),_))},h=>{this.catchError("Error in CommentPinComponent getBubbleOnPin subscription: ",h)})),this.subscriptions.push(this.commentService.getBubbleOnPinHover$().subscribe(h=>{this.componentConfigSignal.update(_=>(_=T(I({},_),{bubbleOnPinHover:h}),_))},h=>{this.catchError("Error in CommentPinComponent getBubbleOnPinHover subscription: ",h)})),this.subscriptions.push(this.commentService.getPopoverTriangleComponent$().subscribe(h=>{this.componentConfigSignal.update(_=>(_=T(I({},_),{popoverTriangleComponent:h}),_))},h=>{this.catchError("Error in CommentPinComponent getPopoverTriangleComponent$ subscription: ",h)})),this.subscriptions.push(this.commentService.getPinShadowDOM$().subscribe(h=>{this.pinShadowDOM=h},h=>{this.catchError("Error in CommentPinComponent getPinShadowDOM$ subscription: ",h)})),this.subscriptions.push(this.commentService.getPinDarkMode$().subscribe(h=>{h!==null&&(h?this.elementRef.nativeElement.setAttribute("dark",""):this.elementRef.nativeElement.removeAttribute("dark"))},h=>{this.catchError("Error in CommentPinComponent pinDarkMode$ subscription: ",h)})),this.subscriptions.push(this.commentService.getPopoverMode$().subscribe(h=>{this.componentConfigSignal.update(_=>(_=T(I({},_),{popoverMode:h}),_))},h=>{this.catchError("Error in CommentPinComponent getPopoverMode subscription: ",h)})),this.subscriptions.push(this.commentService.getDeviceIndicatorOnCommentPins$().subscribe(h=>{this.componentConfigSignal.update(_=>(_=T(I({},_),{isDeviceIndicatorOnCommentPinsEnabled:h}),_))},h=>{this.catchError("Error in CommentPinComponent getDeviceIndicatorOnCommentPins subscription: ",h)})),this.subscriptions.push(this.commentService.getUnreadCommentsMap$().subscribe(h=>{this.componentConfigSignal.update(_=>(_=T(I({},_),{unreadCommentsMap:h}),_))})),this.subscriptions.push(this.commentService.getCustomStatusesShown$().subscribe(h=>{this.componentConfigSignal.update(_=>(_=T(I({},_),{customStatusesShown:h}),_))}))}ngOnInit(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;"),super.ngOnInit(),this.setupA11yAttributes(),!this.template){let e="velt-comment-pin-wireframe";this.variant&&(e+=`---${this.variant}`),this.subscriptions.push(this.wireframeService.getWireframe$(e).subscribe(i=>{if(i){let r=document.createElement(i.tagName);r.innerHTML=i.innerHTML,this.template=r,this.getChildTemplate()}}))}this.getChildTemplate()}catch(e){this.catchError("Error in CommentsToolComponent OnInit: ",e)}}getChildTemplate(){try{if(!this.ghostCommentIndicatorTemplate&&this.template){let e=this.template.querySelector("velt-comment-pin-ghost-comment-indicator-wireframe");et(e)||(this.ghostCommentIndicatorTemplate=e)}if(!this.indexTemplate&&this.template){let e=this.template.querySelector("velt-comment-pin-index-wireframe");et(e)||(this.indexTemplate=e)}if(!this.privateCommentIndicatorTemplate&&this.template){let e=this.template.querySelector("velt-comment-pin-private-comment-indicator-wireframe");et(e)||(this.privateCommentIndicatorTemplate=e)}if(!this.triangleTemplate&&this.template){let e=this.template.querySelector("velt-comment-pin-triangle-wireframe");et(e)||(this.triangleTemplate=e)}if(!this.unreadCommentIndicatorTemplate&&this.template){let e=this.template.querySelector("velt-comment-pin-unread-comment-indicator-wireframe");et(e)||(this.unreadCommentIndicatorTemplate=e)}}catch(e){this.loggingService.catch("Error in CommentPinComponent getChildTemplate: ",e)}}ngAfterViewInit(){try{this.subscriptions.push(this.commentPinPortalService.getCommentPinTemplate$().subscribe(e=>{if(e!==null){let i=e?.cloneNode(!0);if(i.setAttribute("slot","comment-pin"),this.pinRef!==void 0){this.pinRef.nativeElement.appendChild(i);let r=T0(this.componentConfigSignal().annotation);this.injectAttributeData(i,r),this.usingCustomCommentPin=!0,this.commentPinPortalService.emitCustomPinEvent({annotation:this.componentConfigSignal().annotation,element:i}),this.pinRef.nativeElement.childNodes.forEach(a=>{a?.tagName?.toLowerCase()===j.TAGS.SNIPPYLY_USER_AVATAR&&a.remove()})}}else this.usingCustomCommentPin=!1})),this.subscriptions.push(this.commentService.getBubbleCommentAnnotationIds$().subscribe(e=>{if(e.includes(this.componentConfigSignal().annotation?.annotationId)){this.commentBubbleElement=this.commentService.getCommentBubbleElement(this.componentConfigSignal().annotation);let i=this.commentBubbleElement?.getAttribute(j.ATTRIBUTES.VELT_ANNOTATION_ID)||"";this.componentConfigSignal().commentBubbleElementAnnotationId!==i&&(this.componentConfigSignal.update(r=>(r=T(I({},r),{commentBubbleElementAnnotationId:i}),r)),this.commentBubbleAvailable=!0)}else this.commentBubbleAvailable&&(this.commentBubbleElement=null,this.componentConfigSignal.update(i=>(i=T(I({},i),{commentBubbleElementAnnotationId:""}),i)),this.commentBubbleAvailable=!1)},e=>{this.catchError("Error in CommentPinComponent getBubbleCommentAnnotationIds$ subscription: ",e)}))}catch(e){this.catchError("Error in CommentPinComponent AfterViewInit: ",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentPinComponent setupA11yAttributes:",e)}}ngOnChanges(e){try{if(e&&Object.keys(e).forEach(i=>{this.componentConfigSignal.update(r=>(r=T(I({},r),{[i]:e[i].currentValue}),r))}),e?.annotation){if(this.commentService.customPinsById.has(this.componentConfigSignal().annotation.annotationId)){let r=this.commentService.getCustomPinById(this.componentConfigSignal().annotation.annotationId);if(r!==void 0){let a=T0(this.componentConfigSignal().annotation);this.injectAttributeData(r,a)}}this.setUserInitial(),this.componentConfigSignal.update(r=>(r=T(I({},r),{isPrivateComment:this.componentConfigSignal().annotation?.iam?.accessMode===Qi.PRIVATE,isGhostComment:!!this.componentConfigSignal().annotation?.ghostComment}),r)),this.checkIfCommentAddedOnDifferentDeviceType();let i=JSON.parse(JSON.stringify(this.commentPinPosition||{}));this.commentPinPosition={top:this.componentConfigSignal().annotation?.position?.top||0,left:this.componentConfigSignal().annotation?.position?.left||0}}}catch(i){this.catchError("Error in CommentPinComponent ngOnChanges: ",i)}}detectCommentPinOutsideViewport(){try{this.loggingService.log("%c[WB] Calling FUNCTION: detectCommentPinOutsideViewport","color: green;");let e=this.pinRef?.nativeElement;if(e){let i=e?.getBoundingClientRect(),r=Math.max(document?.documentElement?.clientWidth||0,window?.innerWidth||0);if(i?.right>r){let a=r-i.left;a>0?(this.pinMaxWidth=`${a}px`,this.isOutsideViewport=!0):(this.isOutsideViewport=!1,this.pinMaxWidth="")}else this.isOutsideViewport=!1,this.pinMaxWidth=""}else this.isOutsideViewport=!1}catch(e){this.catchError("Error in CommentPinComponent detectCommentPinOutsideViewport: ",e)}}checkIfCommentAddedOnDifferentDeviceType(){try{this.componentConfigSignal().annotation?.pageInfo?.deviceInfo?.deviceType!==this.deviceInfo.deviceType?(this.componentConfigSignal.update(e=>(e=T(I({},e),{isCommentAddedOnDifferentDeviceType:!0}),e)),this.COMMENT_PIN_SIZE=34):(this.componentConfigSignal.update(e=>(e=T(I({},e),{isCommentAddedOnDifferentDeviceType:!1}),e)),this.COMMENT_PIN_SIZE=40)}catch(e){this.catchError("Error in CommentPinComponent checkIfCommentAddedOnDifferentDeviceType: ",e)}}updateOverlayPosition(){try{this.loggingService.log("updateOverlayPosition",this.componentConfigSignal().annotation?.annotationId),this.commentDialogPortalRef?.updateOverlayPosition()}catch(e){this.catchError("Error in CommentPinComponent updateOverlayPosition: ",e)}}onPointerUpOnDialog(){try{this.componentConfigSignal().commentPinSelected||this.togglePinSelection.emit()}catch(e){this.catchError("Error in CommentPinComponent onPointerUpOnDialog: ",e)}}onPinBubblePointerUp(e){try{(!this.componentConfigSignal().commentPinSelected||e)&&this.togglePinSelection.emit(e)}catch(i){this.catchError("Error in CommentPinComponent onPointerUpOnDialog: ",i)}}ngOnDestroy(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnDestroy","color: green;");try{super.ngOnDestroy(),this.unsubscribe()}catch(e){this.catchError("Error in CommentPinComponent ondestroy: ",e)}}unsubscribe(){this.loggingService.log("%c[WB] Calling FUNCTION: unsubscribe","color: green;");try{this.subscriptions.map(e=>{e.unsubscribe()}),this.subscriptions=[]}catch(e){this.catchError("Error in CommentPinComponent unsubscribe: ",e)}}setUserInitial(){try{this.userInitial=this.componentConfigSignal().annotation?.from?.initial||(this.componentConfigSignal().annotation?.from?.name?this.componentConfigSignal().annotation.from.name?.charAt(0).toUpperCase():this.componentConfigSignal().annotation?.from?.email?.charAt(0).toUpperCase()||"")}catch(e){this.catchError("Error in CommentPinComponent setUserInitial: ",e)}}catchError(e,i,r){try{this.loggingService.catch(e,i,T(I({},r||{}),{annotationId:this.componentConfigSignal()?.annotation?.annotationId}))}catch{}}};o.\u0275fac=function(i){return new(i||o)(u(we),u(Ne),u(y),u(z9),u(ze),u(k),u(b))},o.\u0275cmp=O({type:o,selectors:[["snippyly-comment-pin"]],viewQuery:function(i,r){if(i&1&&(ot(t$t,5),ot(n$t,5)),i&2){let a;Qe(a=Je())&&(r.pinRef=a.first),Qe(a=Je())&&(r.commentDialogPortalRef=a.first)}},hostVars:1,hostBindings:function(i,r){i&2&&x("data-velt-element",r.veltElement)},inputs:{annotation:"annotation",commentPinSelected:"commentPinSelected",annotationDragging:"annotationDragging",commentPinType:"commentPinType",multipleCommentPinsSelected:"multipleCommentPinsSelected",avatarErrorImage:"avatarErrorImage",user:"user",variant:"variant",containerComponentId:"containerComponentId",targetElement:"targetElement"},outputs:{saveComment:"saveComment",commentTargetElementClicked:"commentTargetElementClicked",togglePinSelection:"togglePinSelection"},standalone:!1,features:[U([b]),B,Xe],ngContentSelectors:i$t,decls:1,vars:1,consts:[["commentPinContainerRef",""],["commentDialogPortalRef",""],["trigger","cdkOverlayOrigin"],["normalPinRef",""],["defaultPinRef",""],["pinRef",""],["userAvatarRef",""],["readCommentIndicatorsRef",""],[4,"ngIf"],[4,"veltIf"],[4,"ngIf","ngIfElse"],[4,"ngTemplateOutlet"],[3,"saveComment","togglePinSelection","pointerUp","annotation","user","commentPinSelected","annotationDragging","commentPinType","targetElement","bubbleOnPin","bubbleOnPinHover","containerComponentId"],["id","comment-pin-block","cdkOverlayOrigin","",1,"velt-comment-pin"],[3,"click"],[3,"componentConfigSignal","template"],[4,"veltDynamicTemplate"],[1,"velt-comment-pin--marker",3,"click","ngClass"],[3,"ngSwitch"],["width","18","height","18","viewBox","0 0 18 18","fill","none","xmlns","http://www.w3.org/2000/svg",4,"ngSwitchCase"],["width","18","height","18","viewBox","0 0 18 18","fill","none","xmlns","http://www.w3.org/2000/svg"],["d","M12.0357 1.5H5.96429C5.29365 1.5 4.75 2.17157 4.75 3V15C4.75 15.8284 5.29365 16.5 5.96429 16.5H12.0357C12.7063 16.5 13.25 15.8284 13.25 15V3C13.25 2.17157 12.7063 1.5 12.0357 1.5Z","stroke","white","stroke-width","1.5","stroke-linecap","round","stroke-linejoin","round"],["d","M9 13.5H9.0075","stroke","white","stroke-width","1.5","stroke-linecap","round","stroke-linejoin","round"],["fill-rule","evenodd","clip-rule","evenodd","d","M12.75 1.5H5.25C4.83579 1.5 4.5 1.83579 4.5 2.25V15.75C4.5 16.1642 4.83579 16.5 5.25 16.5H12.75C13.1642 16.5 13.5 16.1642 13.5 15.75V2.25C13.5 1.83579 13.1642 1.5 12.75 1.5ZM5.25 0C4.00736 0 3 1.00736 3 2.25V15.75C3 16.9926 4.00736 18 5.25 18H12.75C13.9926 18 15 16.9926 15 15.75V2.25C15 1.00736 13.9926 0 12.75 0H5.25Z","fill","white"],["d","M9.75 14.25C9.75 14.6642 9.41421 15 9 15C8.58579 15 8.25 14.6642 8.25 14.25C8.25 13.8358 8.58579 13.5 9 13.5C9.41421 13.5 9.75 13.8358 9.75 14.25Z","fill","white"],["fill-rule","evenodd","clip-rule","evenodd","d","M3.75 4.5L3.75 11.25L14.25 11.25L14.25 4.5C14.25 4.08579 13.9142 3.75 13.5 3.75L4.5 3.75C4.08579 3.75 3.75 4.08579 3.75 4.5ZM2.25 12.75L15.75 12.75L15.75 4.5C15.75 3.25736 14.7426 2.25 13.5 2.25L4.5 2.25C3.25736 2.25 2.25 3.25736 2.25 4.5L2.25 12.75Z","fill","white"],["fill-rule","evenodd","clip-rule","evenodd","d","M2.25 12.75L2.25 13.5C2.25 13.9142 2.58579 14.25 3 14.25L15 14.25C15.4142 14.25 15.75 13.9142 15.75 13.5L15.75 12.75L2.25 12.75ZM0.75 13.5C0.75 14.7426 1.75736 15.75 3 15.75L15 15.75C16.2426 15.75 17.25 14.7426 17.25 13.5L17.25 12C17.25 11.5858 16.9142 11.25 16.5 11.25L1.5 11.25C1.08579 11.25 0.75 11.5858 0.75 12L0.75 13.5Z","fill","white"],["d","M6.75 13.5H8.25V15H9.75V13.5H11.25V15H12C12.4142 15 12.75 15.3358 12.75 15.75C12.75 16.1642 12.4142 16.5 12 16.5H6C5.58579 16.5 5.25 16.1642 5.25 15.75C5.25 15.3358 5.58579 15 6 15H6.75V13.5Z","fill","white"],["fill-rule","evenodd","clip-rule","evenodd","d","M3 4.5L3 10.5C3 11.3284 3.67157 12 4.5 12L13.5 12C14.3284 12 15 11.3284 15 10.5L15 4.5C15 3.67157 14.3284 3 13.5 3L4.5 3C3.67157 3 3 3.67157 3 4.5ZM1.5 10.5C1.5 12.1569 2.84315 13.5 4.5 13.5L13.5 13.5C15.1569 13.5 16.5 12.1569 16.5 10.5L16.5 4.5C16.5 2.84315 15.1569 1.5 13.5 1.5L4.5 1.5C2.84315 1.5 1.5 2.84315 1.5 4.5L1.5 10.5Z","fill","white"],[3,"user"]],template:function(i,r){i&1&&(Vt(),g(0,E$t,2,6,"ng-container",8)),i&2&&c("ngIf",r.componentConfigSignal())},dependencies:[Br,Z,vt,Li,Yi,An,Hn,ne,X0,K0,Z0,J0,Q0,tn,a_,ae],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}[_nghost-%COMP%]{--velt-green: var(--velt-light-mode-green);--velt-magenta: var(--velt-light-mode-magenta);--velt-amber: var(--velt-light-mode-amber);--velt-purple: var(--velt-light-mode-purple);--velt-cyan: var(--velt-light-mode-cyan);--velt-orange: var(--velt-light-mode-orange);--velt-black: var(--velt-light-mode-black);--velt-white: var(--velt-light-mode-white);--velt-gray: var(--velt-light-mode-gray);--velt-error: var(--velt-light-mode-error);--velt-error-hover: var(--velt-light-mode-error-hover);--velt-error-foreground: var(--velt-light-mode-error-foreground);--velt-error-light: var(--velt-light-mode-error-light);--velt-error-transparent: var(--velt-light-mode-error-transparent);--velt-warning: var(--velt-light-mode-warning);--velt-warning-hover: var(--velt-light-mode-warning-hover);--velt-warning-foreground: var(--velt-light-mode-warning-foreground);--velt-warning-light: var(--velt-light-mode-warning-light);--velt-warning-transparent: var(--velt-light-mode-warning-transparent);--velt-success: var(--velt-light-mode-success);--velt-success-hover: var(--velt-light-mode-success-hover);--velt-success-foreground: var(--velt-light-mode-success-foreground);--velt-success-light: var(--velt-light-mode-success-light);--velt-success-transparent: var(--velt-light-mode-success-transparent);--velt-accent: var(--velt-light-mode-accent);--velt-accent-text: var(--velt-light-mode-accent-text);--velt-accent-hover: var(--velt-light-mode-accent-hover);--velt-accent-foreground: var(--velt-light-mode-accent-foreground);--velt-accent-light: var(--velt-light-mode-accent-light);--velt-accent-transparent: var(--velt-light-mode-accent-transparent);--velt-text-0: var(--velt-light-mode-text-0);--velt-text-1: var(--velt-light-mode-text-1);--velt-text-2: var(--velt-light-mode-text-2);--velt-text-3: var(--velt-light-mode-text-3);--velt-text-4: var(--velt-light-mode-text-4);--velt-text-5: var(--velt-light-mode-text-5);--velt-text-6: var(--velt-light-mode-text-6);--velt-text-7: var(--velt-light-mode-text-7);--velt-text-8: var(--velt-light-mode-text-8);--velt-text-9: var(--velt-light-mode-text-9);--velt-text-10: var(--velt-light-mode-text-10);--velt-text-11: var(--velt-light-mode-text-11);--velt-text-12: var(--velt-light-mode-text-12);--velt-background-0: var(--velt-light-mode-background-0);--velt-background-1: var(--velt-light-mode-background-1);--velt-background-2: var(--velt-light-mode-background-2);--velt-background-3: var(--velt-light-mode-background-3);--velt-background-4: var(--velt-light-mode-background-4);--velt-background-5: var(--velt-light-mode-background-5);--velt-background-6: var(--velt-light-mode-background-6);--velt-background-7: var(--velt-light-mode-background-7);--velt-background-8: var(--velt-light-mode-background-8);--velt-background-9: var(--velt-light-mode-background-9);--velt-background-10: var(--velt-light-mode-background-10);--velt-border-0: var(--velt-light-mode-border-0);--velt-border-1: var(--velt-light-mode-border-1);--velt-border-2: var(--velt-light-mode-border-2);--velt-border-3: var(--velt-light-mode-border-3);--velt-border-4: var(--velt-light-mode-border-4);--velt-border-5: var(--velt-light-mode-border-5);--velt-border-6: var(--velt-light-mode-border-6);--velt-border-7: var(--velt-light-mode-border-7);--velt-border-8: var(--velt-light-mode-border-8);--velt-border-9: var(--velt-light-mode-border-9);--velt-border-10: var(--velt-light-mode-border-10);--velt-background-transparent: var(--velt-light-mode-background-transparent);--velt-border-transparent: var(--velt-light-mode-border-transparent);--velt-animation-transparent: var(--velt-light-mode-animation-transparent);--velt-internal-comment-pin-bg-color: var(--velt-accent)}[dark][_nghost-%COMP%]{--velt-green: var(--velt-dark-mode-green);--velt-magenta: var(--velt-dark-mode-magenta);--velt-amber: var(--velt-dark-mode-amber);--velt-purple: var(--velt-dark-mode-purple);--velt-cyan: var(--velt-dark-mode-cyan);--velt-orange: var(--velt-dark-mode-orange);--velt-black: var(--velt-dark-mode-black);--velt-white: var(--velt-dark-mode-white);--velt-gray: var(--velt-dark-mode-gray);--velt-error: var(--velt-dark-mode-error);--velt-error-hover: var(--velt-dark-mode-error-hover);--velt-error-foreground: var(--velt-dark-mode-error-foreground);--velt-error-light: var(--velt-dark-mode-error-light);--velt-error-transparent: var(--velt-dark-mode-error-transparent);--velt-warning: var(--velt-dark-mode-warning);--velt-warning-hover: var(--velt-dark-mode-warning-hover);--velt-warning-foreground: var(--velt-dark-mode-warning-foreground);--velt-warning-light: var(--velt-dark-mode-warning-light);--velt-warning-transparent: var(--velt-dark-mode-warning-transparent);--velt-success: var(--velt-dark-mode-success);--velt-success-hover: var(--velt-dark-mode-success-hover);--velt-success-foreground: var(--velt-dark-mode-success-foreground);--velt-success-light: var(--velt-dark-mode-success-light);--velt-success-transparent: var(--velt-dark-mode-success-transparent);--velt-accent: var(--velt-dark-mode-accent);--velt-accent-text: var(--velt-dark-mode-accent-text);--velt-accent-hover: var(--velt-dark-mode-accent-hover);--velt-accent-foreground: var(--velt-dark-mode-accent-foreground);--velt-accent-light: var(--velt-dark-mode-accent-light);--velt-accent-transparent: var(--velt-dark-mode-accent-transparent);--velt-text-0: var(--velt-dark-mode-text-0);--velt-text-1: var(--velt-dark-mode-text-1);--velt-text-2: var(--velt-dark-mode-text-2);--velt-text-3: var(--velt-dark-mode-text-3);--velt-text-4: var(--velt-dark-mode-text-4);--velt-text-5: var(--velt-dark-mode-text-5);--velt-text-6: var(--velt-dark-mode-text-6);--velt-text-7: var(--velt-dark-mode-text-7);--velt-text-8: var(--velt-dark-mode-text-8);--velt-text-9: var(--velt-dark-mode-text-9);--velt-text-10: var(--velt-dark-mode-text-10);--velt-text-11: var(--velt-dark-mode-text-11);--velt-text-12: var(--velt-dark-mode-text-12);--velt-background-0: var(--velt-dark-mode-background-0);--velt-background-1: var(--velt-dark-mode-background-1);--velt-background-2: var(--velt-dark-mode-background-2);--velt-background-3: var(--velt-dark-mode-background-3);--velt-background-4: var(--velt-dark-mode-background-4);--velt-background-5: var(--velt-dark-mode-background-5);--velt-background-6: var(--velt-dark-mode-background-6);--velt-background-7: var(--velt-dark-mode-background-7);--velt-background-8: var(--velt-dark-mode-background-8);--velt-background-9: var(--velt-dark-mode-background-9);--velt-background-10: var(--velt-dark-mode-background-10);--velt-border-0: var(--velt-dark-mode-border-0);--velt-border-1: var(--velt-dark-mode-border-1);--velt-border-2: var(--velt-dark-mode-border-2);--velt-border-3: var(--velt-dark-mode-border-3);--velt-border-4: var(--velt-dark-mode-border-4);--velt-border-5: var(--velt-dark-mode-border-5);--velt-border-6: var(--velt-dark-mode-border-6);--velt-border-7: var(--velt-dark-mode-border-7);--velt-border-8: var(--velt-dark-mode-border-8);--velt-border-9: var(--velt-dark-mode-border-9);--velt-border-10: var(--velt-dark-mode-border-10);--velt-background-transparent: var(--velt-dark-mode-background-transparent);--velt-border-transparent: var(--velt-dark-mode-border-transparent);--velt-animation-transparent: var(--velt-dark-mode-animation-transparent)}.velt-comment-pin[_ngcontent-%COMP%] .velt-comment-pin--indicator-bubble{position:absolute;border-radius:100%;text-align:center;top:calc(var(--velt-spacing-sm) * -1);right:calc(var(--velt-spacing-sm) * -1);bottom:unset;left:unset;height:24px;width:24px;display:flex;align-items:center;justify-content:center;box-sizing:border-box}.velt-comment-pin[_ngcontent-%COMP%] .velt-comment-pin--indicator-bubble.velt-comment-pin--private-indicator{height:28px;width:28px;top:calc(var(--velt-spacing-md) * -1);right:calc(var(--velt-spacing-md) * -1);left:unset;bottom:unset}.velt-comment-pin[_ngcontent-%COMP%] .velt-comment-pin--indicator-bubble.velt-comment-pin--ghost-indicator{height:28px;width:28px;top:calc(var(--velt-spacing-md) * -1);right:calc(var(--velt-spacing-md) * -1);left:unset;bottom:unset}.velt-comment-pin[_ngcontent-%COMP%] .velt-comment-pin--indicator-bubble.velt-comment-pin--unread-indicator{background-color:var(--velt-error);color:var(--velt-error-foreground);height:16px;width:16px;top:calc(var(--velt-spacing-xs) * -1);right:calc(var(--velt-spacing-xs) * -1);left:unset;bottom:unset}.velt-comment-pin[_ngcontent-%COMP%] .velt-comment-pin--indicator-bubble.velt-comment-pin--index-3-digit{border-radius:100%;height:30px;width:30px;top:calc(var(--velt-spacing-md) * -1);right:calc(var(--velt-spacing-md) * -1);bottom:unset;left:unset}.velt-comment-pin[_ngcontent-%COMP%] .velt-comment-pin--index{border:1px solid rgb(210,210,210);color:var(--velt-black);background:var(--velt-white)}.velt-comment-pin[_ngcontent-%COMP%] .velt-comment-pin--index .comment-annotation-number{border-radius:100%;width:24px;height:24px;font-size:calc((.55rem + 0px) * var(--velt-base-rem-unit));display:inline-flex;justify-content:center;align-items:center;box-sizing:content-box;position:relative}.velt-comment-pin[_ngcontent-%COMP%] .velt-comment-pin--index .comment-annotation-number:after{content:attr(data-comment-annotation-number);position:absolute;font-weight:400;letter-spacing:normal;word-spacing:normal}.velt-comment-pin[_ngcontent-%COMP%] .velt-comment-pin--private-indicator{color:var(--velt-white);background:linear-gradient(0deg,#000000bf 0% 100%),var(--velt-accent);border-radius:100%;border:1px solid rgba(255,255,255,.24);padding:var(--velt-spacing-sm)}.velt-comment-pin[_ngcontent-%COMP%] .velt-comment-pin--ghost-indicator{color:var(--velt-error-foreground);background:var(--velt-error);border-radius:100%;border:1px solid rgba(255,255,255,.24);padding:var(--velt-spacing-sm)}.velt-comment-pin--different-device[_ngcontent-%COMP%] .velt-comment-pin--private-indicator[_ngcontent-%COMP%], .velt-comment-pin--different-device[_ngcontent-%COMP%] .velt-comment-pin--ghost-indicator[_ngcontent-%COMP%]{padding:calc(var(--velt-spacing-md) / 2);width:24px;height:24px;top:calc(var(--velt-spacing-sm) * -1);right:calc(var(--velt-spacing-sm) * -1)}.velt-comment-pin--marker[_ngcontent-%COMP%]{display:flex;justify-content:center;align-items:center;position:relative;width:calc((2.5rem + 0px) * var(--velt-base-rem-unit));height:calc((2.5rem + 0px) * var(--velt-base-rem-unit));border:2px solid var(--velt-border-3);border-radius:100% 100% 100% 2px;box-shadow:0 8px 16px -8px #0f0f0f1a;z-index:1;cursor:pointer;background:var(--velt-internal-comment-pin-bg-color);box-sizing:border-box}.velt-comment-pin--marker.velt-comment-pin--status-default[_ngcontent-%COMP%]{background:var(--velt-accent, var(--velt-internal-comment-pin-bg-color))}.velt-comment-pin--marker.velt-comment-pin--status-ongoing[_ngcontent-%COMP%]{background:var(--velt-warning, var(--velt-internal-comment-pin-bg-color))}.velt-comment-pin--marker.velt-comment-pin--status-terminal[_ngcontent-%COMP%]{background:var(--velt-success, var(--velt-internal-comment-pin-bg-color))}snippyly-user-avatar[_ngcontent-%COMP%]{--legacy-velt-user-avatar-size: 1.5rem;background-color:var(--velt-gray);background-size:cover;border-radius:100%;display:flex;align-items:center;justify-content:center;position:relative}.velt-comment-pin--popover[_ngcontent-%COMP%]{width:0;height:0;border-style:solid;border-width:0 10px 10px 0;border-color:transparent var(--velt-accent) transparent transparent}.velt-comment-pin.velt-comment-pin--different-device[_ngcontent-%COMP%], .velt-comment-pin.velt-comment-pin--different-device[_ngcontent-%COMP%] .velt-comment-pin--marker[_ngcontent-%COMP%]{width:calc((2.125rem + 0px) * var(--velt-base-rem-unit));height:calc((2.125rem + 0px) * var(--velt-base-rem-unit))}.velt-comment-pin.velt-comment-pin--ghost[_ngcontent-%COMP%] .velt-comment-pin--marker-default.velt-comment-pin--marker[_ngcontent-%COMP%]{background:var(--velt-gray)}.velt-comment-pin.velt-comment-pin--ghost[_ngcontent-%COMP%] .velt-comment-pin--popover[_ngcontent-%COMP%]{border-color:transparent var(--velt-gray) transparent transparent}.velt-comment-pin.velt-comment-pin--outside-viewport[_ngcontent-%COMP%]{max-width:var(--velt-internal-comment-pin-max-width);overflow:hidden} .velt-comment-dialog-overlay-panel{z-index:2147483567}.velt-comment-pin--marker-transparent[_ngcontent-%COMP%]{background:transparent;border:unset;border-radius:unset;box-shadow:unset}"],changeDetection:0});let n=o;return n})();function x$t(n,o){if(n&1){let t=q();f(0),C(1,"velt-multi-thread-comment-dialog-internal",6),G("afterViewInit",function(){N(t);let i=l().last,r=l(2);return F(i?r.calculatePosition():null)})("saveComment",function(i){N(t);let r=l().$implicit,a=l(2);return F(a.saveComment(r==null?null:r.annotation,i))}),S(),v()}if(n&2){let t=l().$implicit,e=l().ngIf,i=l();d(),c("multiThreadAnnotationId",t==null||t.annotation==null?null:t.annotation.annotationId)("annotation",t==null?null:t.annotation)("user",e.user)("commentPinSelected",!!e.selectedAnnotationsMap[t==null||t.annotation==null?null:t.annotation.annotationId]),x("data-testid",i.componentId+"-multi-thread-"+(t==null||t.annotation==null?null:t.annotation.annotationId))}}function T$t(n,o){if(n&1){let t=q();C(0,"snippyly-comment-dialog",7),G("afterViewInit",function(){N(t);let i=l().last,r=l(2);return F(i?r.calculatePosition():null)})("saveComment",function(i){N(t);let r=l().$implicit,a=l(2);return F(a.saveComment(r==null?null:r.annotation,i))}),S()}if(n&2){let t=l().$implicit,e=l().ngIf,i=l();c("annotation",t==null?null:t.annotation)("user",e.user)("commentPinSelected",!!e.selectedAnnotationsMap[t==null||t.annotation==null?null:t.annotation.annotationId])("inlineCommentMode",e.inlineCommentMode)("isInsidePdfViewer",t==null?null:t.isInsidePdfViewer),x("data-testid",i.componentId+"-single-thread-"+(t==null||t.annotation==null?null:t.annotation.annotationId))}}function D$t(n,o){if(n&1){let t=q();f(0),C(1,"div",4),G("click",function(){let i=N(t).$implicit,r=l(2);return F(r.togglePinSelection(i==null?null:i.annotation))}),g(2,x$t,2,5,"ng-container",5)(3,T$t,1,6,"ng-template",null,0,De),S(),v()}if(n&2){let t=o.$implicit,e=pe(4),i=l().ngIf,r=l();d(),rt("top",t==null?null:t.top,"px"),ge("selected",i.selectedAnnotationsMap[t==null||t.annotation==null?null:t.annotation.annotationId]),c("id","snippyly-comments-on-right-block-"+(t==null||t.annotation==null?null:t.annotation.annotationId)),x("data-testid",r.componentId+"-block-"+(t==null||t.annotation==null?null:t.annotation.annotationId))("role","region")("tabindex",0),d(),c("ngIf",(t==null||t.annotation==null?null:t.annotation.type)==="multiThread")("ngIfElse",e)}}function w$t(n,o){if(n&1&&(f(0),C(1,"div",2),A(2,"translate"),g(3,D$t,5,10,"ng-container",3),S(),v()),n&2){let t=o.ngIf,e=l();d(),x("data-testid",e.componentId)("role","complementary")("aria-label",P(2,5,"Comments panel")),d(2),c("ngForOf",t.commentPinAnnotationsArray)("ngForTrackBy",e.trackById)}}var Pfe=(()=>{let o=class o{constructor(e,i,r,a,s){this.authService=e,this.commentService=i,this.domService=r,this.elementRef=a,this.loggingService=s,this.commentPinAnnotations=[],this.subscriptions=[],this.positionChangeDetectionSubscriptions=[],this.componentConfigSignal=Te({commentPinAnnotationsArray:[],selectedAnnotationsMap:{},user:void 0,inlineCommentMode:!1}),this.veltElement=!0,this.componentId="velt-comments-stream-view",this.subscriptions.push(this.authService.getUser$().subscribe(m=>{this.componentConfigSignal.update(p=>(p=T(I({},p),{user:m}),p))},m=>{this.loggingService.catch("Error in CommentsStreamViewComponent getUser$ subscription: ",m)})),this.subscriptions.push(this.domService.getSelectedAnnotationsMap$().subscribe(m=>{this.componentConfigSignal.update(p=>(p=T(I({},p),{selectedAnnotationsMap:m}),p)),setTimeout(()=>{this.calculatePosition(),Object.keys(this.componentConfigSignal().selectedAnnotationsMap).length===1&&this.goToAnnotation(this.componentConfigSignal().selectedAnnotationsMap[Object.keys(this.componentConfigSignal().selectedAnnotationsMap)[0]])},100)},m=>{this.loggingService.catch("Error in CommentsStreamViewComponent getSelectedAnnotationsMap$ subscription: ",m)})),this.subscriptions.push(this.commentService.getInlineCommentMode$().subscribe(m=>{this.componentConfigSignal.update(p=>(p=T(I({},p),{inlineCommentMode:m}),p))}))}ngOnInit(){this.setupA11yAttributes()}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentsStreamViewComponent setupA11yAttributes:",e)}}ngAfterViewInit(){this.streamViewContainerId&&(this.scrollableParentElement=document.getElementById(this.streamViewContainerId)),this.scrollableParentElement||(this.scrollableParentElement=fv(this.elementRef.nativeElement)),this.scrollableParentElement||(this.scrollableParentElement=document.documentElement),this.calculateTargetElementPositions()}ngOnChanges(e){try{e.commentPinAnnotations&&this.calculateTargetElementPositions()}catch(i){this.loggingService.catch("Error in CommentsStreamViewComponent ngOnChanges: ",i)}}goToAnnotation(e){let i=null;e.targetElement||e.areaAnnotationId?i=document.getElementById(`comment-pin-container-${e.annotationId}`):i=document.querySelector(`[data-velt-id='${e.annotationId}']`),i&&i.scrollIntoView({behavior:"auto",block:"center",inline:"nearest"})}togglePinSelection(e){try{this.componentConfigSignal().selectedAnnotationsMap[e.annotationId]||(this.goToAnnotation(e),this.domService.toggleAnnotationSelection(e))}catch(i){this.loggingService.catch("Error in CommentsStreamViewComponent togglePinSelection: ",i)}}saveComment(e,i){try{this.commentService.saveComment(e,i)}catch(r){this.loggingService.catch("Error in CommentsStreamViewComponent saveComment: ",r)}}calculateTargetElementPositions(){try{this.positionChangeDetectionSubscriptions.forEach(i=>{i.unsubscribe()});let e=[];if(this.commentPinAnnotations.forEach(i=>{let r={},a=null;i.targetElement||i.areaAnnotationId?a=document.getElementById(`comment-pin-container-${i.annotationId}`):a=document.querySelector(`[data-velt-id='${i.annotationId}']`),a&&(r.annotation=i,r.targetElement=a,r.targetOffsetTop=IU(a,this.scrollableParentElement)?.top||0,r.isInsidePdfViewer=Cv(a,j.ATTRIBUTES.VELT_PDF_VIEWER),e.push(r))}),e.sort((i,r)=>i.targetElement.getBoundingClientRect().top-r.targetElement.getBoundingClientRect().top),this.componentConfigSignal.update(i=>(i=T(I({},i),{commentPinAnnotationsArray:e}),i)),this.componentConfigSignal().commentPinAnnotationsArray?.length){let i=this.componentConfigSignal().commentPinAnnotationsArray[this.componentConfigSignal().commentPinAnnotationsArray.length-1]?.targetElement;this.detectPositionChange(i)}this.calculatePosition()}catch(e){this.loggingService.catch("Error in CommentsStreamViewComponent calculateTargetElementPositions: ",e)}}trackById(e,i){return i.annotation.annotationId}calculatePosition(){try{if(Object.keys(this.componentConfigSignal().selectedAnnotationsMap).length===1){let e=Object.keys(this.componentConfigSignal().selectedAnnotationsMap)[0],i=this.componentConfigSignal().commentPinAnnotationsArray.findIndex(s=>s.annotation.annotationId===e),r=this.componentConfigSignal().commentPinAnnotationsArray.slice(0,i+1).reverse(),a=this.componentConfigSignal().commentPinAnnotationsArray.slice(i);this.calculateDialogPosition(r,!0),this.calculateDialogPosition(a),r.shift(),this.componentConfigSignal.update(s=>(s=T(I({},s),{commentPinAnnotationsArray:[...r.reverse().slice(),...a.slice()]}),s))}else this.calculateDialogPosition(this.componentConfigSignal().commentPinAnnotationsArray)}catch(e){this.loggingService.catch("Error in CommentsStreamViewComponent calculatePosition: ",e)}}calculateDialogPosition(e,i=!1){try{e.forEach((r,a,s)=>{if(!r.dialogElement){let m=this.elementRef?.nativeElement?.querySelector(`[id="snippyly-comments-on-right-block-${r.annotation.annotationId}"]`);m&&(r.dialogElement=m,r.dialogOffsetTop=IU(m,this.scrollableParentElement)?.top||0)}if(!a)r.top=r.targetOffsetTop;else if(i){let m=s[a-1];if(r.dialogElement){let p=m.top-r.dialogElement?.getBoundingClientRect()?.height-24,h=r.targetOffsetTop;p<r.top?r.top=p:h&&(h<=p?r.top=h:r.top=p)}}else{let m=s[a-1];if(m.dialogElement){let p=m.top+m.dialogElement?.getBoundingClientRect()?.height+24,h=r.targetOffsetTop;p>r.dialogOffsetTop&&p>h?r.top=p:h&&(h>=p?r.top=h:r.top=p)}}})}catch(r){this.loggingService.catch("Error in CommentsStreamViewComponent calculateDialogPosition: ",r)}}detectPositionChange(e){try{let i=Rg(0,td).pipe(ce(()=>{let r=e.getBoundingClientRect();return{top:r.top,left:r.left}}),qt((r,a)=>r.top===a.top&&r.left===a.left),Pi());this.positionChangeDetectionSubscriptions.push(i.subscribe(()=>{this.calculateTargetElementPositions()},r=>{}))}catch(i){this.loggingService.catch("Error in CommentsStreamViewComponent detectPositionChange: ",i)}}ngOnDestroy(){try{this.subscriptions.forEach(e=>{e.unsubscribe()})}catch{}}};o.\u0275fac=function(i){return new(i||o)(u(He),u(we),u(Ne),u(k),u(y))},o.\u0275cmp=O({type:o,selectors:[["snippyly-comments-stream-view"]],hostVars:1,hostBindings:function(i,r){i&2&&x("data-velt-element",r.veltElement)},inputs:{commentPinAnnotations:"commentPinAnnotations",streamViewContainerId:"streamViewContainerId"},standalone:!1,features:[Xe],decls:1,vars:1,consts:[["commentDialogRef",""],[4,"ngIf"],["velt-ignore-change-detection","true",1,"snippyly-comments-on-right-container"],[4,"ngFor","ngForOf","ngForTrackBy"],["velt-ignore-change-detection","true",1,"snippyly-comments-on-right-block",3,"click","id"],[4,"ngIf","ngIfElse"],[3,"afterViewInit","saveComment","multiThreadAnnotationId","annotation","user","commentPinSelected"],[3,"afterViewInit","saveComment","annotation","user","commentPinSelected","inlineCommentMode","isInsidePdfViewer"]],template:function(i,r){i&1&&g(0,w$t,4,7,"ng-container",1),i&2&&c("ngIf",r.componentConfigSignal())},dependencies:[ht,Z,Go,rs,de],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}.snippyly-comments-on-right-container[_ngcontent-%COMP%]{position:absolute;top:0;right:10vw;width:300px;background:#90ee90}.snippyly-comments-on-right-container[_ngcontent-%COMP%] .snippyly-comments-on-right-block[_ngcontent-%COMP%]{position:absolute;box-shadow:none;transition:top .5s ease,left .5s ease,box-shadow .5s ease;left:0}.snippyly-comments-on-right-container[_ngcontent-%COMP%] .snippyly-comments-on-right-block.selected[_ngcontent-%COMP%]{left:-36px;z-index:1}.snippyly-comments-on-right-container[_ngcontent-%COMP%] .snippyly-comments-on-right-block .comment-dialog-container{transition:box-shadow .5s ease;box-shadow:none!important}.snippyly-comments-on-right-container[_ngcontent-%COMP%] .snippyly-comments-on-right-block.selected .comment-dialog-container{box-shadow:0 calc((1rem + 0px) * var(--velt-base-rem-unit)) calc((3rem + 0px) * var(--velt-base-rem-unit)) #0000002d!important}"],changeDetection:0});let n=o;return n})();var A$t=()=>["snippyly-inbox-panel"];function P$t(n,o){n&1&&Ue(0)}function M$t(n,o){if(n&1&&g(0,P$t,1,0,"ng-container",7),n&2){l();let t=pe(6);c("ngTemplateOutlet",t)}}function k$t(n,o){if(n&1){let t=q();C(0,"velt-multi-thread-comment-dialog-internal",11),A(1,"translate"),G("saveComment",function(i){N(t);let r=l(4);return F(r.saveComment(i))}),S()}if(n&2){let t=l(3).ngIf,e=l();c("multiThreadAnnotationId",t.commentAnnotation==null?null:t.commentAnnotation.annotationId)("annotation",t.commentAnnotation)("user",t.user)("commentPinSelected",!0)("inboxMode",!0),x("data-testid",e.componentId+"-multi-thread-dialog")("role","dialog")("aria-label",P(1,8,"Multi-thread comment dialog"))}}function R$t(n,o){if(n&1&&(f(0),g(1,k$t,2,10,"velt-multi-thread-comment-dialog-internal",10),v()),n&2){let t=l(2).ngIf;d(),c("ngIf",t.commentAnnotation&&t.user)}}function N$t(n,o){if(n&1){let t=q();C(0,"snippyly-comment-dialog",13),A(1,"translate"),G("saveComment",function(i){N(t);let r=l(4);return F(r.saveComment(i))}),S()}if(n&2){let t=l(3).ngIf,e=l();c("annotation",t.commentAnnotation)("user",t.user)("commentPinSelected",!0)("inboxMode",!0),x("data-testid",e.componentId+"-single-dialog")("role","dialog")("aria-label",P(1,7,"Single comment dialog"))}}function F$t(n,o){if(n&1&&g(0,N$t,2,9,"snippyly-comment-dialog",12),n&2){let t=l(2).ngIf;c("ngIf",t.commentAnnotation&&t.user)}}function L$t(n,o){if(n&1&&(C(0,"div",8),A(1,"translate"),g(2,R$t,2,1,"ng-container",9)(3,F$t,1,1,"ng-template",null,3,De),S()),n&2){let t=pe(4),e=l().ngIf,i=l();ge("mobile",e.isPhone)("visible",!!e.commentAnnotation),x("data-testid",i.componentId)("role","region")("aria-label",P(1,10,"Comment inbox container"))("aria-expanded",!!e.commentAnnotation),d(2),c("ngIf",(e==null||e.commentAnnotation==null?null:e.commentAnnotation.type)==="multiThread")("ngIfElse",t)}}function B$t(n,o){if(n&1&&(f(0),w(1,"div",5,0),g(3,M$t,1,1,"ng-template",6,1,De)(5,L$t,5,12,"ng-template",null,2,De),v()),n&2){let t=pe(2),e=l();d(),x("data-testid",e.componentId+"-trigger")("aria-hidden",!0),d(2),c("cdkConnectedOverlayOrigin",t)("cdkConnectedOverlayOpen",!0)("cdkConnectedOverlayDisableClose",!0)("cdkConnectedOverlayPanelClass",Nt(6,A$t))}}var Mfe=(()=>{let o=class o extends nt{constructor(e,i,r,a,s,m){super(s,m),this.authService=e,this.breakpointObserver=i,this.commentService=r,this.loggingService=a,this.elementRef=s,this.themeService=m,this.componentConfigSignal=Te({isPhone:!1,sidebarVisible:!1}),this.subscriptions=[],this.componentId="velt-comment-inbox";try{this.subscriptions.push(this.breakpointObserver.observe(Oi.XSmall).subscribe(p=>{p.matches?this.componentConfigSignal.update(h=>(h=T(I({},h),{isPhone:!0}),h)):this.componentConfigSignal.update(h=>(h=T(I({},h),{isPhone:!1}),h))},p=>{this.catchError("Error in CommentInboxComponent breakpointObserver subscription: ",p)}))}catch{}}ngOnInit(){try{this.setupA11yAttributes(),this.subscriptions.push(this.authService.getUser$().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{user:e}),i))},e=>{this.catchError("Error in CommentInboxComponent getUser$ subscription: ",e)}))}catch(e){this.catchError("Error in CommentInboxComponent ngOnInit: ",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentInboxComponent setupA11yAttributes:",e)}}ngOnChanges(e){try{e.commentAnnotation&&this.componentConfigSignal.update(i=>(i=T(I({},i),{commentAnnotation:e.commentAnnotation.currentValue}),i))}catch(i){this.catchError("Error in CommentInboxComponent ngOnChanges: ",i)}}ngOnDestroy(){this.subscriptions.forEach(e=>e.unsubscribe()),super.ngOnDestroy()}saveComment(e){try{(this.commentAnnotation||e.annotation)&&this.commentService.saveComment(this.commentAnnotation||e.annotation,e)}catch(i){this.catchError("Error in CommentInboxComponent saveComment: ",i)}}catchError(e,i,r){try{this.loggingService.catch(e,i,T(I({},r||{}),{annotationId:this.componentConfigSignal()?.commentAnnotation?.annotationId}))}catch{}}};o.\u0275fac=function(i){return new(i||o)(u(He),u(po),u(we),u(y),u(k),u(Ye))},o.\u0275cmp=O({type:o,selectors:[["snippyly-comment-inbox"]],inputs:{commentAnnotation:"commentAnnotation"},standalone:!1,features:[B,Xe],decls:1,vars:1,consts:[["sidebarTrigger","cdkOverlayOrigin"],["sidebarOverlay","cdkConnectedOverlay"],["sidebarRef",""],["commentDialogRef",""],[4,"ngIf"],["cdkOverlayOrigin",""],["cdkConnectedOverlay","",3,"cdkConnectedOverlayOrigin","cdkConnectedOverlayOpen","cdkConnectedOverlayDisableClose","cdkConnectedOverlayPanelClass"],[4,"ngTemplateOutlet"],["id","sCommentInboxContainer","data-velt-comment-disabled","true",1,"velt-comment-inbox--container","s-inbox-container"],[4,"ngIf","ngIfElse"],[3,"multiThreadAnnotationId","annotation","user","commentPinSelected","inboxMode","saveComment",4,"ngIf"],[3,"saveComment","multiThreadAnnotationId","annotation","user","commentPinSelected","inboxMode"],[3,"annotation","user","commentPinSelected","inboxMode","saveComment",4,"ngIf"],[3,"saveComment","annotation","user","commentPinSelected","inboxMode"]],template:function(i,r){i&1&&g(0,B$t,7,7,"ng-container",4),i&2&&c("ngIf",r.componentConfigSignal())},dependencies:[Z,vt,Vn,An,Go,rs,de],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}[_nghost-%COMP%]{--velt-green: var(--velt-light-mode-green);--velt-magenta: var(--velt-light-mode-magenta);--velt-amber: var(--velt-light-mode-amber);--velt-purple: var(--velt-light-mode-purple);--velt-cyan: var(--velt-light-mode-cyan);--velt-orange: var(--velt-light-mode-orange);--velt-black: var(--velt-light-mode-black);--velt-white: var(--velt-light-mode-white);--velt-gray: var(--velt-light-mode-gray);--velt-error: var(--velt-light-mode-error);--velt-error-hover: var(--velt-light-mode-error-hover);--velt-error-foreground: var(--velt-light-mode-error-foreground);--velt-error-light: var(--velt-light-mode-error-light);--velt-error-transparent: var(--velt-light-mode-error-transparent);--velt-warning: var(--velt-light-mode-warning);--velt-warning-hover: var(--velt-light-mode-warning-hover);--velt-warning-foreground: var(--velt-light-mode-warning-foreground);--velt-warning-light: var(--velt-light-mode-warning-light);--velt-warning-transparent: var(--velt-light-mode-warning-transparent);--velt-success: var(--velt-light-mode-success);--velt-success-hover: var(--velt-light-mode-success-hover);--velt-success-foreground: var(--velt-light-mode-success-foreground);--velt-success-light: var(--velt-light-mode-success-light);--velt-success-transparent: var(--velt-light-mode-success-transparent);--velt-accent: var(--velt-light-mode-accent);--velt-accent-text: var(--velt-light-mode-accent-text);--velt-accent-hover: var(--velt-light-mode-accent-hover);--velt-accent-foreground: var(--velt-light-mode-accent-foreground);--velt-accent-light: var(--velt-light-mode-accent-light);--velt-accent-transparent: var(--velt-light-mode-accent-transparent);--velt-text-0: var(--velt-light-mode-text-0);--velt-text-1: var(--velt-light-mode-text-1);--velt-text-2: var(--velt-light-mode-text-2);--velt-text-3: var(--velt-light-mode-text-3);--velt-text-4: var(--velt-light-mode-text-4);--velt-text-5: var(--velt-light-mode-text-5);--velt-text-6: var(--velt-light-mode-text-6);--velt-text-7: var(--velt-light-mode-text-7);--velt-text-8: var(--velt-light-mode-text-8);--velt-text-9: var(--velt-light-mode-text-9);--velt-text-10: var(--velt-light-mode-text-10);--velt-text-11: var(--velt-light-mode-text-11);--velt-text-12: var(--velt-light-mode-text-12);--velt-background-0: var(--velt-light-mode-background-0);--velt-background-1: var(--velt-light-mode-background-1);--velt-background-2: var(--velt-light-mode-background-2);--velt-background-3: var(--velt-light-mode-background-3);--velt-background-4: var(--velt-light-mode-background-4);--velt-background-5: var(--velt-light-mode-background-5);--velt-background-6: var(--velt-light-mode-background-6);--velt-background-7: var(--velt-light-mode-background-7);--velt-background-8: var(--velt-light-mode-background-8);--velt-background-9: var(--velt-light-mode-background-9);--velt-background-10: var(--velt-light-mode-background-10);--velt-border-0: var(--velt-light-mode-border-0);--velt-border-1: var(--velt-light-mode-border-1);--velt-border-2: var(--velt-light-mode-border-2);--velt-border-3: var(--velt-light-mode-border-3);--velt-border-4: var(--velt-light-mode-border-4);--velt-border-5: var(--velt-light-mode-border-5);--velt-border-6: var(--velt-light-mode-border-6);--velt-border-7: var(--velt-light-mode-border-7);--velt-border-8: var(--velt-light-mode-border-8);--velt-border-9: var(--velt-light-mode-border-9);--velt-border-10: var(--velt-light-mode-border-10);--velt-background-transparent: var(--velt-light-mode-background-transparent);--velt-border-transparent: var(--velt-light-mode-border-transparent);--velt-animation-transparent: var(--velt-light-mode-animation-transparent)}[dark][_nghost-%COMP%]{--velt-green: var(--velt-dark-mode-green);--velt-magenta: var(--velt-dark-mode-magenta);--velt-amber: var(--velt-dark-mode-amber);--velt-purple: var(--velt-dark-mode-purple);--velt-cyan: var(--velt-dark-mode-cyan);--velt-orange: var(--velt-dark-mode-orange);--velt-black: var(--velt-dark-mode-black);--velt-white: var(--velt-dark-mode-white);--velt-gray: var(--velt-dark-mode-gray);--velt-error: var(--velt-dark-mode-error);--velt-error-hover: var(--velt-dark-mode-error-hover);--velt-error-foreground: var(--velt-dark-mode-error-foreground);--velt-error-light: var(--velt-dark-mode-error-light);--velt-error-transparent: var(--velt-dark-mode-error-transparent);--velt-warning: var(--velt-dark-mode-warning);--velt-warning-hover: var(--velt-dark-mode-warning-hover);--velt-warning-foreground: var(--velt-dark-mode-warning-foreground);--velt-warning-light: var(--velt-dark-mode-warning-light);--velt-warning-transparent: var(--velt-dark-mode-warning-transparent);--velt-success: var(--velt-dark-mode-success);--velt-success-hover: var(--velt-dark-mode-success-hover);--velt-success-foreground: var(--velt-dark-mode-success-foreground);--velt-success-light: var(--velt-dark-mode-success-light);--velt-success-transparent: var(--velt-dark-mode-success-transparent);--velt-accent: var(--velt-dark-mode-accent);--velt-accent-text: var(--velt-dark-mode-accent-text);--velt-accent-hover: var(--velt-dark-mode-accent-hover);--velt-accent-foreground: var(--velt-dark-mode-accent-foreground);--velt-accent-light: var(--velt-dark-mode-accent-light);--velt-accent-transparent: var(--velt-dark-mode-accent-transparent);--velt-text-0: var(--velt-dark-mode-text-0);--velt-text-1: var(--velt-dark-mode-text-1);--velt-text-2: var(--velt-dark-mode-text-2);--velt-text-3: var(--velt-dark-mode-text-3);--velt-text-4: var(--velt-dark-mode-text-4);--velt-text-5: var(--velt-dark-mode-text-5);--velt-text-6: var(--velt-dark-mode-text-6);--velt-text-7: var(--velt-dark-mode-text-7);--velt-text-8: var(--velt-dark-mode-text-8);--velt-text-9: var(--velt-dark-mode-text-9);--velt-text-10: var(--velt-dark-mode-text-10);--velt-text-11: var(--velt-dark-mode-text-11);--velt-text-12: var(--velt-dark-mode-text-12);--velt-background-0: var(--velt-dark-mode-background-0);--velt-background-1: var(--velt-dark-mode-background-1);--velt-background-2: var(--velt-dark-mode-background-2);--velt-background-3: var(--velt-dark-mode-background-3);--velt-background-4: var(--velt-dark-mode-background-4);--velt-background-5: var(--velt-dark-mode-background-5);--velt-background-6: var(--velt-dark-mode-background-6);--velt-background-7: var(--velt-dark-mode-background-7);--velt-background-8: var(--velt-dark-mode-background-8);--velt-background-9: var(--velt-dark-mode-background-9);--velt-background-10: var(--velt-dark-mode-background-10);--velt-border-0: var(--velt-dark-mode-border-0);--velt-border-1: var(--velt-dark-mode-border-1);--velt-border-2: var(--velt-dark-mode-border-2);--velt-border-3: var(--velt-dark-mode-border-3);--velt-border-4: var(--velt-dark-mode-border-4);--velt-border-5: var(--velt-dark-mode-border-5);--velt-border-6: var(--velt-dark-mode-border-6);--velt-border-7: var(--velt-dark-mode-border-7);--velt-border-8: var(--velt-dark-mode-border-8);--velt-border-9: var(--velt-dark-mode-border-9);--velt-border-10: var(--velt-dark-mode-border-10);--velt-background-transparent: var(--velt-dark-mode-background-transparent);--velt-border-transparent: var(--velt-dark-mode-border-transparent);--velt-animation-transparent: var(--velt-dark-mode-animation-transparent)}*[_ngcontent-%COMP%]{box-sizing:border-box} .snippyly-inbox-panel{top:0!important;left:0!important}.s-overflow-hidden[_ngcontent-%COMP%]{overflow:hidden!important} .velt-comment-inbox--container{height:100vh;width:calc((26rem + 0px) * var(--velt-base-rem-unit));position:fixed;top:0;right:-100%;padding:var(--velt-spacing-lg);box-sizing:border-box;z-index:999999997;transition:width .5s ease-in-out,right .5s ease-in-out} .velt-comment-inbox--container.mobile{width:100%;height:100%;box-sizing:border-box;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px)} .velt-comment-inbox--container.visible{right:0}"],changeDetection:0});let n=o;return n})();function U$t(n,o){if(n&1){let t=q();f(0),C(1,"div",3),G("click",function(){let i=N(t).$implicit,r=l(2);return F(r.scrollToAnnotation(i==null?null:i.key))}),C(2,"div",4),te(3),A(4,"translate"),S()(),v()}if(n&2){let t=o.$implicit,e=l().ngIf,i=l();d(),rt("top",t.value.top,"%")("transform","translate(0, -"+t.value.top+"%)"),ge("v-unread-comment",!(e.user!=null&&e.user.isGuest)&&!(e.user!=null&&e.user.isAnonymous)&&(e.unreadCommentsMap==null?null:e.unreadCommentsMap[t==null||t.value==null||t.value.annotation==null?null:t.value.annotation.annotationId])),x("data-testid",i.componentId+"-pin-"+t.key)("role","button")("tabindex",0),d(),x("role","tooltip")("aria-hidden","true"),d(),ve(" ",P(4,12,"Go to comments here.")," ")}}function j$t(n,o){if(n&1&&(f(0),C(1,"div",1),A(2,"translate"),g(3,U$t,5,14,"ng-container",2),A(4,"keyvalue"),S(),v()),n&2){let t=o.ngIf,e=l();d(),ge("velt-comments-minimap-container--target-scrollable-element",!!t.targetScrollableElementId)("velt-comments-minimap-position--left",t.position==="left"),x("data-testid",e.componentId)("role","navigation")("aria-label",P(2,9,"Comments minimap")),d(2),c("ngForOf",P(4,11,t.commentAnnotationPositionMap))("ngForTrackBy",e.trackByAnnotationId)}}var G9=(()=>{let o=class o{constructor(e,i,r){this.commentService=e,this.loggingService=i,this.elementRef=r,this.commentAnnotations=[],this.targetScrollableElementId=null,this.position="right",this.commentCountsByPosition={},this.minimapHeatmapGradient="",this.componentConfigSignal=Te({targetScrollableElementId:null,position:"right",commentAnnotationPositionMap:{},user:null,unreadCommentsMap:null}),this.subscriptions=[],this.componentId="velt-comments-minimap",this.loggingService.log("%c[WB] Creating CLASS: CommentsMinimapComponent","color: blue;")}ngOnInit(){try{this.setupA11yAttributes(),this.subscriptions.push(this.commentService.getUnreadCommentsMap$().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{unreadCommentsMap:e}),i))}))}catch(e){this.loggingService.catch("Error in CommentsMinimapComponent ngOnInit: ",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentsMinimapComponent setupA11yAttributes:",e)}}ngOnChanges(e){try{e&&Object.keys(e).forEach(i=>{this.componentConfigSignal.update(r=>(r=T(I({},r),{[i]:e[i].currentValue}),r))}),e?.commentAnnotations&&setTimeout(()=>{this.setCommentAnnotationPositionMap()},200)}catch(i){this.loggingService.catch("Error in CommentsMinimapComponent ngOnChanges: ",i)}}trackByAnnotationId(e,i){return i?.annotation?.annotationId||e}setCommentAnnotationPositionMap(){try{this.componentConfigSignal.update(e=>(e=T(I({},e),{commentAnnotationPositionMap:{}}),e)),this.commentAnnotations.forEach(e=>{let i=null;if(e.targetElement||e.areaAnnotationId?i=document.getElementById(`comment-pin-container-${e.annotationId}`):i=document.querySelector(`[data-velt-id='${e.annotationId}']`),i){let r=this.getElementPosition(i)?.percentageOfTotalHeight;r!=null&&this.componentConfigSignal.update(a=>(a=T(I({},a),{commentAnnotationPositionMap:T(I({},a.commentAnnotationPositionMap),{[e.annotationId]:{annotation:e,top:r,element:i}})}),a))}})}catch(e){this.loggingService.catch("Error in CommentsMinimapComponent setCommentAnnotationPositionByCommentAnnotationIndex: ",e)}}scrollToAnnotation(e){try{let i=this.componentConfigSignal().commentAnnotationPositionMap[e];i&&i.element&&i.element.scrollIntoView({behavior:"smooth",block:"center",inline:"center"})}catch(i){this.loggingService.catch("Error in CommentsMinimapComponent scrollToAnnotation: ",i)}}getElementPosition(e){try{let i=0,r=e,a=this.componentConfigSignal().targetScrollableElementId&&document.getElementById(this.componentConfigSignal().targetScrollableElementId);for(;r&&(i+=r.offsetTop||0,r=r.offsetParent,!(a&&r===a)););let s=0;if(a)s=a.scrollHeight;else{let p=document.body,h=document.documentElement;s=Math.max(p.scrollHeight,p.offsetHeight,h.clientHeight,h.scrollHeight,h.offsetHeight)}let m=i/s*100;return{pixelsFromTop:i,percentageOfTotalHeight:m}}catch(i){return this.loggingService.catch("Error in CommentsMinimapComponent getElementPosition: ",i),null}}ngOnDestroy(){try{this.subscriptions.forEach(e=>{e.unsubscribe()})}catch(e){this.loggingService.catch("Error in CommentsMinimapComponent ngOnDestroy: ",e)}}};o.\u0275fac=function(i){return new(i||o)(u(we),u(y),u(k))},o.\u0275cmp=O({type:o,selectors:[["app-comments-minimap"]],inputs:{commentAnnotations:"commentAnnotations",user:"user",targetScrollableElementId:"targetScrollableElementId",position:"position"},standalone:!1,features:[Xe],decls:1,vars:1,consts:[[4,"ngIf"],[1,"v-comments-minimap-container"],[4,"ngFor","ngForOf","ngForTrackBy"],[1,"v-comment-minimap-pin",3,"click"],[1,"v-comment-count"]],template:function(i,r){i&1&&g(0,j$t,5,13,"ng-container",0),i&2&&c("ngIf",r.componentConfigSignal())},dependencies:[ht,Z,im,de],styles:['html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}[_nghost-%COMP%]{--velt-green: var(--velt-light-mode-green);--velt-magenta: var(--velt-light-mode-magenta);--velt-amber: var(--velt-light-mode-amber);--velt-purple: var(--velt-light-mode-purple);--velt-cyan: var(--velt-light-mode-cyan);--velt-orange: var(--velt-light-mode-orange);--velt-black: var(--velt-light-mode-black);--velt-white: var(--velt-light-mode-white);--velt-gray: var(--velt-light-mode-gray);--velt-error: var(--velt-light-mode-error);--velt-error-hover: var(--velt-light-mode-error-hover);--velt-error-foreground: var(--velt-light-mode-error-foreground);--velt-error-light: var(--velt-light-mode-error-light);--velt-error-transparent: var(--velt-light-mode-error-transparent);--velt-warning: var(--velt-light-mode-warning);--velt-warning-hover: var(--velt-light-mode-warning-hover);--velt-warning-foreground: var(--velt-light-mode-warning-foreground);--velt-warning-light: var(--velt-light-mode-warning-light);--velt-warning-transparent: var(--velt-light-mode-warning-transparent);--velt-success: var(--velt-light-mode-success);--velt-success-hover: var(--velt-light-mode-success-hover);--velt-success-foreground: var(--velt-light-mode-success-foreground);--velt-success-light: var(--velt-light-mode-success-light);--velt-success-transparent: var(--velt-light-mode-success-transparent);--velt-accent: var(--velt-light-mode-accent);--velt-accent-text: var(--velt-light-mode-accent-text);--velt-accent-hover: var(--velt-light-mode-accent-hover);--velt-accent-foreground: var(--velt-light-mode-accent-foreground);--velt-accent-light: var(--velt-light-mode-accent-light);--velt-accent-transparent: var(--velt-light-mode-accent-transparent);--velt-text-0: var(--velt-light-mode-text-0);--velt-text-1: var(--velt-light-mode-text-1);--velt-text-2: var(--velt-light-mode-text-2);--velt-text-3: var(--velt-light-mode-text-3);--velt-text-4: var(--velt-light-mode-text-4);--velt-text-5: var(--velt-light-mode-text-5);--velt-text-6: var(--velt-light-mode-text-6);--velt-text-7: var(--velt-light-mode-text-7);--velt-text-8: var(--velt-light-mode-text-8);--velt-text-9: var(--velt-light-mode-text-9);--velt-text-10: var(--velt-light-mode-text-10);--velt-text-11: var(--velt-light-mode-text-11);--velt-text-12: var(--velt-light-mode-text-12);--velt-background-0: var(--velt-light-mode-background-0);--velt-background-1: var(--velt-light-mode-background-1);--velt-background-2: var(--velt-light-mode-background-2);--velt-background-3: var(--velt-light-mode-background-3);--velt-background-4: var(--velt-light-mode-background-4);--velt-background-5: var(--velt-light-mode-background-5);--velt-background-6: var(--velt-light-mode-background-6);--velt-background-7: var(--velt-light-mode-background-7);--velt-background-8: var(--velt-light-mode-background-8);--velt-background-9: var(--velt-light-mode-background-9);--velt-background-10: var(--velt-light-mode-background-10);--velt-border-0: var(--velt-light-mode-border-0);--velt-border-1: var(--velt-light-mode-border-1);--velt-border-2: var(--velt-light-mode-border-2);--velt-border-3: var(--velt-light-mode-border-3);--velt-border-4: var(--velt-light-mode-border-4);--velt-border-5: var(--velt-light-mode-border-5);--velt-border-6: var(--velt-light-mode-border-6);--velt-border-7: var(--velt-light-mode-border-7);--velt-border-8: var(--velt-light-mode-border-8);--velt-border-9: var(--velt-light-mode-border-9);--velt-border-10: var(--velt-light-mode-border-10);--velt-background-transparent: var(--velt-light-mode-background-transparent);--velt-border-transparent: var(--velt-light-mode-border-transparent);--velt-animation-transparent: var(--velt-light-mode-animation-transparent)}.v-comments-minimap-container[_ngcontent-%COMP%]{display:block;position:fixed;height:100vh;top:0;right:0;background:#00000014;z-index:var(--velt-comments-minimap-z-index)}.v-comments-minimap-container[_ngcontent-%COMP%] .v-comment-minimap-pin[_ngcontent-%COMP%]{position:absolute;right:0;width:12px;height:4px;flex-shrink:0;border-radius:var(--velt-border-radius-2xs);border:1px solid rgba(255,255,255,.16);background:color-mix(in srgb,var(--velt-accent) 80%,transparent);cursor:pointer}.v-comments-minimap-container[_ngcontent-%COMP%] .v-comment-minimap-pin[_ngcontent-%COMP%] .v-comment-count[_ngcontent-%COMP%]{position:absolute;top:50%;right:20px;z-index:1000;min-width:max-content;background:color-mix(in srgb,var(--velt-accent) 80%,transparent);font-size:var(--velt-font-size-xs);padding:var(--velt-spacing-xs) var(--velt-spacing-sm);border-radius:var(--velt-border-radius-xs);transform:translateY(-50%);color:var(--velt-accent-foreground);display:none}.v-comments-minimap-container[_ngcontent-%COMP%] .v-comment-minimap-pin[_ngcontent-%COMP%] .v-comment-count[_ngcontent-%COMP%]:after{content:"";position:absolute;border-style:solid;border-width:4px 0 4px 4px;border-color:transparent color-mix(in srgb,var(--velt-accent) 80%,transparent);display:block;width:0;z-index:1;right:calc(var(--velt-spacing-xs) * -1);top:50%;transform:translateY(-50%)}.v-comments-minimap-container[_ngcontent-%COMP%] .v-comment-minimap-pin[_ngcontent-%COMP%]:hover .v-comment-count[_ngcontent-%COMP%]{display:block}.v-comments-minimap-container[_ngcontent-%COMP%] .v-comment-minimap-pin.v-unread-comment[_ngcontent-%COMP%]{background-color:color-mix(in srgb,var(--velt-error) 80%,transparent)}.v-comments-minimap-container[_ngcontent-%COMP%] .v-comment-minimap-pin.v-unread-comment[_ngcontent-%COMP%] .v-comment-count[_ngcontent-%COMP%]{background:color-mix(in srgb,var(--velt-error) 80%,transparent)}.v-comments-minimap-container[_ngcontent-%COMP%] .v-comment-minimap-pin.v-unread-comment[_ngcontent-%COMP%] .v-comment-count[_ngcontent-%COMP%]:after{border-color:transparent color-mix(in srgb,var(--velt-error) 80%,transparent)}.v-comments-minimap-container.velt-comments-minimap-container--target-scrollable-element[_ngcontent-%COMP%]{position:absolute;height:100%}.v-comments-minimap-container.velt-comments-minimap-position--left[_ngcontent-%COMP%], .v-comments-minimap-container.velt-comments-minimap-position--left[_ngcontent-%COMP%] .v-comment-minimap-pin[_ngcontent-%COMP%]{right:auto;left:0}.v-comments-minimap-container.velt-comments-minimap-position--left[_ngcontent-%COMP%] .v-comment-minimap-pin[_ngcontent-%COMP%] .v-comment-count[_ngcontent-%COMP%]{right:auto;left:20px}.v-comments-minimap-container.velt-comments-minimap-position--left[_ngcontent-%COMP%] .v-comment-minimap-pin[_ngcontent-%COMP%] .v-comment-count[_ngcontent-%COMP%]:after{right:auto;left:calc(var(--velt-spacing-xs) * -1);border-width:4px 4px 4px 0}'],changeDetection:0});let n=o;return n})();function $$t(n,o){n&1&&Ue(0)}function H$t(n,o){if(n&1&&(C(0,"velt-shadow-dom-internal"),g(1,$$t,1,0,"ng-container",6),S()),n&2){l();let t=pe(3);d(),c("ngTemplateOutlet",t)}}function z$t(n,o){if(n&1&&(w(0,"snippyly-comments-stream-view",10),A(1,"translate")),n&2){let t=l(3).ngIf,e=l();c("commentPinAnnotations",t.commentPinAnnotationsForStreamView)("streamViewContainerId",e.streamViewContainerId),x("data-testid",e.componentId+"-stream")("role","complementary")("aria-label",P(1,5,"Comments stream view"))}}function G$t(n,o){if(n&1&&(w(0,"snippyly-comment-inbox",11),A(1,"translate")),n&2){let t=l(3).ngIf,e=l();c("darkMode",t.darkMode)("commentAnnotation",t.selectedCommentAnnotation),x("data-testid",e.componentId+"-inbox")("role","complementary")("aria-label",P(1,5,"Comments inbox"))}}function W$t(n,o){if(n&1&&(w(0,"app-comments-minimap",12),A(1,"translate")),n&2){let t=l(3).ngIf,e=l();c("commentAnnotations",t.commentPinAnnotations)("user",t.user)("position",t.minimapPosition),x("data-testid",e.componentId+"-minimap")("role","complementary")("aria-label",P(1,6,"Comments location overview"))}}function q$t(n,o){if(n&1&&(w(0,"snippyly-comment-adder"),g(1,z$t,2,7,"snippyly-comments-stream-view",7)(2,G$t,2,7,"snippyly-comment-inbox",8)(3,W$t,2,8,"app-comments-minimap",9)),n&2){let t=l(2).ngIf,e=l();x("data-testid",e.componentId+"-adder"),d(),c("ngIf",t.streamMode&&t.commentsOnDom),d(),c("ngIf",t.inboxMode&&t.commentsOnDom),d(),c("ngIf",t.minimapEnabled&&t.commentsOnDom)}}function Y$t(n,o){if(n&1&&(f(0),g(1,H$t,2,1,"velt-shadow-dom-internal",5)(2,q$t,4,4,"ng-template",null,0,De),v()),n&2){let t=pe(3),e=l().ngIf;d(),c("ngIf",e.shadowDOM)("ngIfElse",t)}}function K$t(n,o){if(n&1){let t=q();f(0),g(1,Y$t,4,2,"ng-container",1),C(2,"div",2)(3,"slot",3),G("slotchange",function(i){N(t);let r=l();return F(r.handleCommentPinSlotChanged(i))}),S()(),w(4,"app-persistent-comment-mode",4),v()}if(n&2){let t=o.ngIf,e=l();d(),c("ngIf",t.isFirstComponent),d(),x("aria-hidden","true")("data-testid",e.componentId+"-slot-container"),d(2),c("componentConfigSignal",e.componentConfigSignal),x("data-testid",e.componentId+"-persistent-mode")}}var jH=(()=>{let o=class o{set textMode(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableTextComments():this.commentService.disableTextComments()}set popoverMode(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enablePopoverMode():this.commentService.disablePopoverMode()}set popoverTriangleComponent(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enablePopoverTriangleComponent():this.commentService.disablePopoverTriangleComponent()}set collapsedComments(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableCollapsedComments():this.commentService.disableCollapsedComments()}set shortUserName(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableShortUserName():this.commentService.disableShortUserName()}catch{}}set readOnly(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableReadOnly():this.commentService.disableReadOnly()}catch{}}set deleteThreadWithFirstComment(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableDeleteThreadWithFirstComment():this.commentService.disableDeleteThreadWithFirstComment()}catch{}}set resolveStatusAccessAdminOnly(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableResolveStatusAccessAdminOnly():this.commentService.disableResolveStatusAccessAdminOnly()}set svgAsImg(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableSvgAsImg():this.commentService.disableSvgAsImg()}catch{}}set commentToNearestAllowedElement(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableCommentToNearestAllowedElement():this.commentService.disableCommentToNearestAllowedElement()}catch{}}set floatingCommentDialog(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.commentService.disableFloatingComments(!i)}set moderatorMode(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.commentService.setModeratorMode(i)}set _streamMode(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.commentService.setStreamMode(i)}set atHereLabel(e){e&&this.contactService.setAtHereLabel(e)}set _atHereEnabled(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.contactService.enableAtHere():this.contactService.disableAtHere()}set _deleteReplyConfirmation(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableDeleteReplyConfirmation():this.commentService.disableDeleteReplyConfirmation()}set _expandMentionGroups(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableExpandMentionGroups():this.commentService.disableExpandMentionGroups()}set _showMentionGroupsFirst(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableShowMentionGroupsFirst():this.commentService.disableShowMentionGroupsFirst()}set _showMentionGroupsOnly(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableShowMentionGroupsOnly():this.commentService.disableShowMentionGroupsOnly()}set _fullExpanded(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableFullExpanded():this.commentService.disableFullExpanded()}catch{}}set _draftMode(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableDraftMode():this.commentService.disableDraftMode()}catch{}}set atHereDescription(e){e&&this.contactService.setAtHereDescription(e)}set _persistentCommentMode(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enablePersistentCommentMode():this.commentService.disablePersistentCommentMode()}set _seenByUsers(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableSeenByUsers():this.commentService.disableSeenByUsers()}set signInButton(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.commentService.enableSignInButton(i)}set upgradeButton(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.commentService.enableUpgradeButton(i)}set attachments(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.commentService.enableAttachment(i)}set recordings(e){let i=e;typeof e=="string"&&(i=e?.split(",")?.map(r=>r.trim()),this.commentService.setAllowedRecordings(i))}set reactions(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableReactions():this.commentService.disableReactions()}set deviceInfo(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.commentService.showScreenSizeInfo(i)}set commentIndex(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.commentService.showCommentIndex(i)}set dialogOnHover(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.commentService.setEnableDialogOnHover(i)}set dialogOnTargetElementClick(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.commentService.setEnableDialogOnTargetElementClick(i)}set priority(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.commentService.setEnablePriority(i)}set status(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.commentService.setEnableStatus(i)}set resolveButton(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.commentService.setEnableResolve(i)}set _inboxMode(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableInboxMode():this.commentService.disableInboxMode()}set _suggestionMode(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.commentService.setSuggestionMode(i)}set _mobileMode(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.commentService.setMobileMode(i)}set _inlineCommentMode(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableInlineCommentMode():this.commentService.disableInlineCommentMode()}set _privateCommentMode(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enablePrivateCommentMode():this.commentService.disablePrivateCommentMode()}set _minimap(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableMinimap():this.commentService.disableMinimap()}set _minimapPosition(e){try{this.componentConfigSignal.update(i=>(i=T(I({},i),{minimapPosition:e}),i)),this.commentService.setAnalyticsFeatureConfig({config:{minimapPosition:e}})}catch{}}set _ghostComments(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableGhostComments():this.commentService.disableGhostComments()}set _ghostCommentsIndicator(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableGhostCommentsMessage():this.commentService.disableGhostCommentsMessage()}set _commentsOnDom(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.showCommentsOnDom():this.commentService.hideCommentsOnDom()}set _resolvedCommentsOnDom(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.showResolvedCommentsOnDom():this.commentService.hideResolvedCommentsOnDom()}set _filterCommentsOnDom(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableFilterCommentsOnDom():this.commentService.disableFilterCommentsOnDom()}catch{}}set _bubbleOnPin(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableBubbleOnPin():this.commentService.disableBubbleOnPin()}catch{}}set _bubbleOnPinHover(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableBubbleOnPinHover():this.commentService.disableBubbleOnPinHover()}catch{}}set _multiThreadMode(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableMultiThread():this.commentService.disableMultiThread()}catch{}}set _multiThread(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableMultiThread():this.commentService.disableMultiThread()}catch{}}set _commentTool(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableCommentTool():this.commentService.disableCommentTool()}set _sidebarButtonOnCommentDialog(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableSidebarButtonOnCommentDialog():this.commentService.disableSidebarButtonOnCommentDialog()}set _deviceIndicatorOnCommentPins(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableDeviceIndicatorOnCommentPins():this.commentService.disableDeviceIndicatorOnCommentPins()}catch{}}set _scrollToComment(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableScrollToComment():this.commentService.disableScrollToComment()}set _userMentions(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableUserMentions():this.commentService.disableUserMentions()}set _deleteOnBackspace(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableDeleteOnBackspace():this.commentService.disableDeleteOnBackspace()}catch{}}set _hotkey(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableHotkey():this.commentService.disableHotkey()}catch{}}set _recordingSummary(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableRecordingSummary():this.commentService.disableRecordingSummary()}catch{}}set _recordingTranscription(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.recorderAnnotationService.enableRecordingTranscription():this.recorderAnnotationService.disableRecordingTranscription()}catch{}}set _recordingCountdown(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableRecordingCountdown():this.commentService.disableRecordingCountdown()}catch{}}set _unreadIndicatorMode(e){try{this.commentService.setUnreadIndicatorMode(e)}catch{}}set _enterKeyToSubmit(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableEnterKeyToSubmit():this.commentService.disableEnterKeyToSubmit()}catch{}}set _pinShadowDOM(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enablePinShadowDOM():this.commentService.disablePinShadowDOM()}catch{}}set _dialogShadowDOM(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableDialogShadowDOM():this.commentService.disableDialogShadowDOM()}catch{}}set _persistentCommentShadowDOM(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.componentConfigSignal.update(r=>(r=T(I({},r),{persistentCommentShadowDOM:!!i}),r)),this.commentService.setAnalyticsFeatureConfig({config:{persistentCommentShadowDOM:!!i}})}catch{}}set _shadowDOM(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.componentConfigSignal.update(r=>(r=T(I({},r),{shadowDOM:!!i,persistentCommentShadowDOM:!!i}),r)),this.componentConfigSignal().shadowDOM?(this.commentService.enableDialogShadowDOM(),this.commentService.enablePinShadowDOM(),this.commentService.enableTextCommentToolShadowDOM(),this.commentService.enableTextCommentToolbarShadowDOM()):(this.commentService.disableDialogShadowDOM(),this.commentService.disablePinShadowDOM(),this.commentService.disableTextCommentToolShadowDOM(),this.commentService.disableTextCommentToolbarShadowDOM()),this.commentService.setAnalyticsFeatureConfig({config:{shadowDom:!!i}})}catch{}}set _textCommentToolShadowDOM(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableTextCommentToolShadowDOM():this.commentService.disableTextCommentToolShadowDOM()}catch{}}set _pinDarkMode(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enablePinDarkMode():this.commentService.disablePinDarkMode()}catch{}}set _textCommentToolDarkMode(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableTextCommentToolDarkMode():this.commentService.disableTextCommentToolDarkMode()}catch{}}set _textCommentToolbarDarkMode(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableTextCommentToolbarDarkMode():this.commentService.disableTextCommentToolbarDarkMode()}catch{}}set _textCommentToolbarShadowDOM(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableTextCommentToolbarShadowDOM():this.commentService.disableTextCommentToolbarShadowDOM()}catch{}}set _changeDetectionInCommentMode(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableChangeDetectionInCommentMode():this.commentService.disableChangeDetectionInCommentMode()}catch{}}set _areaComment(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableAreaComment():this.commentService.disableAreaComment()}catch{}}set _pinCursorImage(e){try{this.commentService.setPinCursorImage(e||"")}catch{}}set allowedElementIds(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.commentService.setAllowedElementIds(i)}catch{}}set allowedElementClassNames(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.commentService.setAllowedElementClassNames(i)}catch{}}set allowedElementQuerySelectors(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.commentService.setAllowedElementQuerySelectors(i)}catch{}}set _commentPinHighlighter(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableCommentPinHighlighter():this.commentService.disableCommentPinHighlighter()}catch{}}set _customReactions(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.commentService.setCustomReactions(i)}catch{}}set customStatus(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.commentService.setCustomStatuses(i)}set customListDataOnAnnotation(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.commentService.createCustomListDataOnAnnotation(i)}set customListDataOnComment(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.autocompleteService.create(i)}set customPriority(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.customFilterService.setCustomPriorityFilters(i)}set _customAutocompleteSearch(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableCustomAutocompleteSearch():this.commentService.disableCustomAutocompleteSearch()}catch{}}set customCategory(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.customFilterService.setCustomCategories(i)}set composerMode(e){this.commentService.setComposerMode(e)}set autoCategorize(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.commentService.setEnableAutoCategorize(!!i)}catch(i){this.loggingService.catch("Error in CommentsContainerComponent set autoCategorize: ",i)}}set isDarkMode(e){this._darkAttribute=e,this.checkDarkMode(),this.commentService.setCommentContainerDarkMode(e===""||e==="true")}constructor(e,i,r,a,s,m,p,h,_,E,D,L){this.analyticsService=e,this.authService=i,this.domService=r,this.commentService=a,this.commentPinPortalService=s,this.commentTextPortalService=m,this.customFilterService=p,this.loggingService=h,this.elementRef=_,this.autocompleteService=E,this.contactService=D,this.recorderAnnotationService=L,this.onCommentAdd=new Ae,this.onSignIn=new Ae,this.onUpgrade=new Ae,this.onCustomPinInject=new Ae,this.onCommentUpdate=new Ae,this.onCommentAccept=new Ae,this.onCommentReject=new Ae,this.onSidebarButtonOnCommentDialogClick=new Ae,this.onCommentSelectionChange=new Ae,this.onCopyLink=new Ae,this.subscriptions=[],this.selectedAnnotationsMap={},this.commentAnnotationFocused=!1,this.enableGhostComments=!1,this.resolvedCommentsOnDom=!1,this.scrollToComment=!1,this.componentConfigSignal=Te({addCommentMode:!1,commentPinAnnotations:[],multiThreadCommentPinAnnotations:[],commentPinAnnotationsForStreamView:[],commentsOnDom:!1,inboxMode:!1,isFirstComponent:!0,minimapEnabled:!1,minimapPosition:"right",persistentCommentMode:!1,persistentModeBanner:!1,privateCommentModeEnabled:!1,selectedCommentAnnotation:void 0,shadowDOM:!0,streamMode:!1,user:null,darkMode:!1,disableCommentMode:this.disableCommentMode.bind(this),persistentCommentShadowDOM:!0}),this.veltId=Pn(),this.veltElement=!0,this.componentId="velt-comments-container";try{this.loggingService.log("%c[WB] Creating CLASS: CommentsContainerComponent","color: blue;"),this._darkAttribute=this.elementRef.nativeElement.getAttribute("dark");let H=new URL(window.location.href);this.focusCommentAnnotationId=H.searchParams.get(j.URL_PARAMS.COMMENT_ID),this.commentService.setCommentAddedEmitter(this.onCommentAdd)}catch(H){this.loggingService.catch("Error in CommentsContainerComponent constructor: ",H)}}ngOnInit(){try{this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;"),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentsContainerComponent ngOnInit:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentsContainerComponent setupA11yAttributes:",e)}}ngOnChanges(e){try{e&&Object.keys(e).forEach(i=>{this.componentConfigSignal.update(r=>(r=T(I({},r),{[i]:e[i].currentValue}),r))})}catch(i){this.loggingService.catch("Error in SubtitlesComponent ngOnChanges: ",i)}}ngAfterViewInit(){try{let e=document.querySelector(j.TAGS.SNIPPYLY_COMMENTS),i=document.querySelector(j.TAGS.VELT_COMMENTS);document.querySelector(`${j.TAGS.VELT_COMMENTS}[${j.ATTRIBUTES.VELT_IS_FIRST_COMPONENT}]`)||(i?this.veltId===i?.getAttribute(j.ATTRIBUTES.VELT_ID)&&(this.componentConfigSignal.update(a=>(a=T(I({},a),{isFirstComponent:!0}),a)),i?.setAttribute(j.ATTRIBUTES.VELT_IS_FIRST_COMPONENT,"true"),this.initComponent()):this.veltId===e?.getAttribute(j.ATTRIBUTES.VELT_ID)&&(this.componentConfigSignal.update(a=>(a=T(I({},a),{isFirstComponent:!0}),a)),e?.setAttribute(j.ATTRIBUTES.VELT_IS_FIRST_COMPONENT,"true"),this.initComponent()))}catch(e){this.loggingService.catch("Error in CommentsContainerComponent AfterViewInit: ",e)}}initComponent(){try{this.commentService.addAreaContainerTag(),this.subscriptions.push(this.authService.getUser$().pipe(Fe(e=>!!e)).subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{user:e}),i)),e&&this.setCommentInstalledInAnalytics()},e=>{this.loggingService.catch("Error in getUser: ",e)})),this.subscriptions.push(this.commentService.getStreamMode$().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{streamMode:e}),i))},e=>{this.loggingService.catch("Error in CommentsContainerComponent getStreamMode$ subscription: ",e)})),this.subscriptions.push(this.commentService.getInboxMode$().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{inboxMode:e}),i))},e=>{this.loggingService.catch("Error in CommentsContainerComponent getInboxMode$ subscription: ",e)})),this.subscriptions.push(this.commentService.getMinimap$().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{minimapEnabled:e}),i))},e=>{this.loggingService.catch("Error in CommentsContainerComponent getMinimap$ subscription: ",e)})),this.subscriptions.push(this.commentService.addCommentModeChange().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{addCommentMode:e}),i))},e=>{this.loggingService.catch("Error in CommentsContainerComponent addCommentModeChange subscription: ",e)})),this.subscriptions.push(this.commentService.persistentCommentModeChange().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{persistentCommentMode:e}),i))},e=>{this.loggingService.catch("Error in CommentsContainerComponent persistentCommentModeChange subscription: ",e)})),this.subscriptions.push(this.commentService.persistentModeBannerChange().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{persistentModeBanner:e}),i))},e=>{this.loggingService.catch("Error in CommentsContainerComponent persistentModeBannerChange subscription: ",e)})),this.subscriptions.push(this.commentService.getPrivateCommentMode$().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{privateCommentModeEnabled:e}),i))},e=>{this.loggingService.catch("Error in CommentsContainerComponent getPrivateCommentMode$ subscription: ",e)})),this.subscriptions.push(this.commentService.getScrollToComment$().subscribe(e=>{this.scrollToComment=e},e=>{this.loggingService.catch("Error in CommentsContainerComponent getScrollToComment$ subscription: ",e)})),this.subscriptions.push(this.commentService.getSignInButtonClick$().subscribe(()=>{this.onSignIn.emit()},e=>{this.loggingService.catch("Error in CommentsContainerComponent getSignInButtonClick$ subscription: ",e)})),this.subscriptions.push(this.commentService.getUpgradeButtonClick$().subscribe(()=>{this.onUpgrade.emit()},e=>{this.loggingService.catch("Error in CommentsContainerComponent getUpgradeButtonClick$ subscription: ",e)})),this.subscriptions.push(this.domService.getSelectedAnnotationsMap$().subscribe(e=>{this.selectedAnnotationsMap=e},e=>{this.loggingService.catch("Error in CommentsContainerComponent getSidebarVisibility$ subscription: ",e)})),this.subscriptions.push(this.commentPinPortalService.getCustomPinEvents$().subscribe(e=>{this.onCustomPinInject.emit(e)},e=>{this.loggingService.catch("Error in CommentsContainerComponent getCustomPinEvents$ subscription: ",e)})),this.subscriptions.push(this.commentService.commentUpdated$.subscribe(e=>{this.onCommentUpdate.emit(e)},e=>{this.loggingService.catch("Error in CommentsContainerComponent commentUpdated$ subscription: ",e)})),this.subscriptions.push(this.commentService.commentAccepted$.subscribe(e=>{this.onCommentAccept.emit(e)},e=>{this.loggingService.catch("Error in CommentsContainerComponent commentAccepted$ subscription: ",e)})),this.subscriptions.push(this.commentService.commentRejected$.subscribe(e=>{this.onCommentReject.emit(e)},e=>{this.loggingService.catch("Error in CommentsContainerComponent commentRejected$ subscription: ",e)})),this.subscriptions.push(this.commentService.getSidebarButtonOnCommentDialogClick$().subscribe(e=>{this.onSidebarButtonOnCommentDialogClick.emit(e)},e=>{this.loggingService.catch("Error in CommentsContainerComponent getSidebarButtonOnCommentDialogClick$ subscription: ",e)})),this.subscriptions.push(this.commentService.onCommentSelectionChange$().subscribe(e=>{this.onCommentSelectionChange.emit(e)},e=>{this.loggingService.catch("Error in CommentsContainerComponent onCommentSelectionChange$ subscription: ",e)})),this.subscriptions.push(this.commentService.getCopyLink$().subscribe(e=>{this.onCopyLink.emit(e)},e=>{this.loggingService.catch("Error in CommentsContainerComponent getCopyLink$ subscription: ",e)})),this.getAllCommentsOnCurrentDocument()}catch(e){this.loggingService.catch("Error in CommentsContainerComponent initComponent: ",e)}}getAllCommentsOnCurrentDocument(){this.loggingService.log("%c[WB] Calling FUNCTION: getAllCommentsOnCurrentDocument","color: green;");try{this.subscriptions.push(this.commentService.getCommentsOnDom$().pipe(he(e=>(this.componentConfigSignal.update(i=>(i=T(I({},i),{commentsOnDom:e}),i)),this.componentConfigSignal().commentsOnDom?Rn([this.commentService.getAllCommentAnnotations({detectGhostComments:!0,addFilterCommentsOnDomCheck:!0,analytics:{enabled:!0,properties:{source:"internal",sourceId:"commentsContainer"}}}),this.commentService.getAllMultiThreadCommentAnnotations(void 0,void 0,void 0,!0)]).pipe(ce(([i,r])=>[...i||[],...r||[]]),he(i=>this.commentService.getEnableGhostComments$().pipe(ce(r=>(this.enableGhostComments=r,i)))),he(i=>this.commentService.getCommentsOnDom$().pipe(ce(r=>(this.componentConfigSignal.update(a=>(a=T(I({},a),{commentsOnDom:r}),a)),i)))),he(i=>this.commentService.getResolvedCommentsOnDom$().pipe(ce(r=>(this.resolvedCommentsOnDom=r,i)))),he(i=>this.domService.getSelectedAnnotationsMap$().pipe(ce(r=>({filteredAnnotations:i||[],selectedAnnotationsMap:r||{}}))))):se({filteredAnnotations:[],selectedAnnotationsMap:{}})))).subscribe(e=>{try{this.loggingService.log(e),this.componentConfigSignal.update(s=>(s=T(I({},s),{commentPinAnnotations:e?.filteredAnnotations}),s)),this.commentService.setCommentAnnotationsFromCommentsContainer(this.componentConfigSignal().commentPinAnnotations);let i;this.componentConfigSignal().commentPinAnnotations.forEach(s=>{this.selectedAnnotationsMap[s?.annotationId]&&(s?.multiThreadAnnotationId||(i=s))}),this.componentConfigSignal.update(s=>(s=T(I({},s),{selectedCommentAnnotation:i}),s));let r=this.componentConfigSignal().commentPinAnnotations.filter(s=>s.targetElement&&s?.position);r=r.filter(s=>{let m=!0;return s?.ghostComment?.type===Ws.DIFFERENT_DEVICE&&!s?.ghostComment?.isSameGroup&&(e.selectedAnnotationsMap[s.annotationId]||(m=!1)),s?.ghostComment&&!this.enableGhostComments&&(m=!1),!this.resolvedCommentsOnDom&&!(this.commentService.getFilterCommentsOnDom()&&this.commentService.getCommentsFromSidebarMap())&&s.status!==void 0&&s.status.type==="terminal"&&(e.selectedAnnotationsMap[s.annotationId]||(m=!1)),m}),this.commentPinPortalService.checkPinsToRemove(r),r.forEach(s=>{this.commentPinPortalService.setCommentPin(s)});let a=this.componentConfigSignal().commentPinAnnotations.filter(s=>s.targetTextRange);a=a.filter(s=>!(!this.resolvedCommentsOnDom&&!(this.commentService.getFilterCommentsOnDom()&&this.commentService.getCommentsFromSidebarMap())&&s.status!==void 0&&s.status.type==="terminal"&&!e.selectedAnnotationsMap[s.annotationId])),this.commentTextPortalService.updateTextCommentAnnotations(a),this.componentConfigSignal.update(s=>(s=T(I({},s),{commentPinAnnotationsForStreamView:this.componentConfigSignal().commentPinAnnotations.slice()}),s)),this.focusCommentAnnotation()}catch(i){this.loggingService.catch("Error in CommentsContainerComponent getAllCommentsOnCurrentDocument inside subscription: ",i)}},e=>{this.loggingService.catch("Error in CommentsContainerComponent getAllCommentsOnCurrentDocument subscription: ",e)}))}catch(e){this.loggingService.catch("Error in CommentsContainerComponent getAllCommentsOnCurrentDocument: ",e)}}ngOnDestroy(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnDestroy","color: green;");try{this.unsubscribe(),this.commentService.setContextProvider(null),this.commentService.setCommentAddedEmitter(null),this.componentConfigSignal().isFirstComponent&&this.commentService.setCommentAnnotationsFromCommentsContainer([])}catch(e){this.loggingService.catch("Error in CommentsContainerComponent ondestroy: ",e)}}unsubscribe(){this.loggingService.log("%c[WB] Calling FUNCTION: unsubscribe","color: green;");try{this.subscriptions.map(e=>{e.unsubscribe()}),this.subscriptions=[]}catch(e){this.loggingService.catch("Error in CommentsContainerComponent unsubscribe: ",e)}}handleCommentPinSlotChanged(e){try{let i=e.target;if(i.assignedElements().length>0){let r=i.assignedElements()[0];this.commentPinPortalService.setCommentPinOverrideTemplate(r)}}catch(i){this.loggingService.catch("Error in CommentsContainerComponent handleCommentPinSlotChanged: ")}}focusCommentAnnotation(){if(this.focusCommentAnnotationId&&!this.commentAnnotationFocused){let e=this.componentConfigSignal().commentPinAnnotations.find(i=>i.annotationId===this.focusCommentAnnotationId);e&&(this.commentAnnotationFocused=!0,sessionStorage.setItem(j.SESSION_STORAGE.SNIPPYLY_AUTO_SELECT_ANNOTATION_ID,e.annotationId),this.selectedAnnotationsMap[e.annotationId]||this.domService.toggleAnnotationSelection(e),setTimeout(()=>{let i=null;e.targetElement||e.areaAnnotationId?i=document.getElementById(`comment-pin-container-${e.annotationId}`):(i=document.querySelector(`[data-velt-id='${e.annotationId}']`),sessionStorage.setItem(j.SESSION_STORAGE.SNIPPYLY_AUTO_SELECT_ANNOTATION_ID,e.annotationId)),i||(i=document.querySelector(`${j.TAGS.VELT_COMMENT_TEXT}[${j.ATTRIBUTES.ANNOTATION_ID}="${e.annotationId}"]`)),i&&this.scrollToComment&&i.scrollIntoView({behavior:"auto",block:"center",inline:"nearest"})},100))}}setCommentInstalledInAnalytics(){try{this.analyticsService.setInstalledFeature(ke.COMMENT)}catch(e){this.loggingService.catch("Error in CommentsContainerComponent setCommentInstalledInAnalytics: ",e)}}disableCommentMode(){try{this.commentService.disableAddCommentMode()}catch(e){this.loggingService.catch("Error in CommentsContainerComponent disableCommentMode: ",e)}}checkDarkMode(){try{this._darkAttribute===""?this.componentConfigSignal.update(e=>(e=T(I({},e),{darkMode:!0}),e)):this.componentConfigSignal.update(e=>(e=T(I({},e),{darkMode:!1}),e))}catch(e){this.loggingService.catch("Error in CommentsContainerComponent checkDarkMode: ",e)}}};o.\u0275fac=function(i){return new(i||o)(u(Ze),u(He),u(Ne),u(we),u(z9),u(l9),u(zo),u(y),u(k),u(el),u(Ci),u(ji))},o.\u0275cmp=O({type:o,selectors:[["app-comments-container"]],hostVars:2,hostBindings:function(i,r){i&2&&x("data-velt-id",r.veltId)("data-velt-element",r.veltElement)},inputs:{textMode:"textMode",popoverMode:"popoverMode",popoverTriangleComponent:"popoverTriangleComponent",collapsedComments:"collapsedComments",shortUserName:"shortUserName",readOnly:"readOnly",deleteThreadWithFirstComment:"deleteThreadWithFirstComment",resolveStatusAccessAdminOnly:"resolveStatusAccessAdminOnly",svgAsImg:"svgAsImg",commentToNearestAllowedElement:"commentToNearestAllowedElement",floatingCommentDialog:"floatingCommentDialog",moderatorMode:"moderatorMode",_streamMode:[0,"streamMode","_streamMode"],atHereLabel:"atHereLabel",_atHereEnabled:[0,"atHereEnabled","_atHereEnabled"],_deleteReplyConfirmation:[0,"deleteReplyConfirmation","_deleteReplyConfirmation"],_expandMentionGroups:[0,"expandMentionGroups","_expandMentionGroups"],_showMentionGroupsFirst:[0,"showMentionGroupsFirst","_showMentionGroupsFirst"],_showMentionGroupsOnly:[0,"showMentionGroupsOnly","_showMentionGroupsOnly"],_fullExpanded:[0,"fullExpanded","_fullExpanded"],_draftMode:[0,"draftMode","_draftMode"],atHereDescription:"atHereDescription",_persistentCommentMode:[0,"persistentCommentMode","_persistentCommentMode"],_seenByUsers:[0,"seenByUsers","_seenByUsers"],signInButton:"signInButton",upgradeButton:"upgradeButton",attachments:"attachments",recordings:"recordings",reactions:"reactions",deviceInfo:"deviceInfo",commentIndex:"commentIndex",dialogOnHover:"dialogOnHover",dialogOnTargetElementClick:"dialogOnTargetElementClick",priority:"priority",status:"status",resolveButton:"resolveButton",_inboxMode:[0,"inboxMode","_inboxMode"],_suggestionMode:[0,"suggestionMode","_suggestionMode"],_mobileMode:[0,"mobileMode","_mobileMode"],_inlineCommentMode:[0,"inlineCommentMode","_inlineCommentMode"],_privateCommentMode:[0,"privateCommentMode","_privateCommentMode"],_minimap:[0,"minimap","_minimap"],_minimapPosition:[0,"minimapPosition","_minimapPosition"],_ghostComments:[0,"ghostComments","_ghostComments"],_ghostCommentsIndicator:[0,"ghostCommentsIndicator","_ghostCommentsIndicator"],_commentsOnDom:[0,"commentsOnDom","_commentsOnDom"],_resolvedCommentsOnDom:[0,"resolvedCommentsOnDom","_resolvedCommentsOnDom"],_filterCommentsOnDom:[0,"filterCommentsOnDom","_filterCommentsOnDom"],_bubbleOnPin:[0,"bubbleOnPin","_bubbleOnPin"],_bubbleOnPinHover:[0,"bubbleOnPinHover","_bubbleOnPinHover"],_multiThreadMode:[0,"multiThreadMode","_multiThreadMode"],_multiThread:[0,"multiThread","_multiThread"],_commentTool:[0,"commentTool","_commentTool"],_sidebarButtonOnCommentDialog:[0,"sidebarButtonOnCommentDialog","_sidebarButtonOnCommentDialog"],_deviceIndicatorOnCommentPins:[0,"deviceIndicatorOnCommentPins","_deviceIndicatorOnCommentPins"],_scrollToComment:[0,"scrollToComment","_scrollToComment"],_userMentions:[0,"userMentions","_userMentions"],_deleteOnBackspace:[0,"deleteOnBackspace","_deleteOnBackspace"],_hotkey:[0,"hotkey","_hotkey"],_recordingSummary:[0,"recordingSummary","_recordingSummary"],_recordingTranscription:[0,"recordingTranscription","_recordingTranscription"],_recordingCountdown:[0,"recordingCountdown","_recordingCountdown"],_unreadIndicatorMode:[0,"unreadIndicatorMode","_unreadIndicatorMode"],_enterKeyToSubmit:[0,"enterKeyToSubmit","_enterKeyToSubmit"],_pinShadowDOM:[0,"pinShadowDom","_pinShadowDOM"],_dialogShadowDOM:[0,"dialogShadowDom","_dialogShadowDOM"],_persistentCommentShadowDOM:[0,"persistentCommentShadowDom","_persistentCommentShadowDOM"],_shadowDOM:[0,"shadowDom","_shadowDOM"],_textCommentToolShadowDOM:[0,"textCommentToolShadowDom","_textCommentToolShadowDOM"],_pinDarkMode:[0,"pinDarkMode","_pinDarkMode"],_textCommentToolDarkMode:[0,"textCommentToolDarkMode","_textCommentToolDarkMode"],_textCommentToolbarDarkMode:[0,"textCommentToolbarDarkMode","_textCommentToolbarDarkMode"],_textCommentToolbarShadowDOM:[0,"textCommentToolbarShadowDom","_textCommentToolbarShadowDOM"],_changeDetectionInCommentMode:[0,"changeDetectionInCommentMode","_changeDetectionInCommentMode"],_areaComment:[0,"areaComment","_areaComment"],_pinCursorImage:[0,"pinCursorImage","_pinCursorImage"],allowedElementIds:"allowedElementIds",allowedElementClassNames:"allowedElementClassNames",allowedElementQuerySelectors:"allowedElementQuerySelectors",_commentPinHighlighter:[0,"commentPinHighlighter","_commentPinHighlighter"],_customReactions:[0,"customReactions","_customReactions"],customStatus:"customStatus",customListDataOnAnnotation:"customListDataOnAnnotation",customListDataOnComment:"customListDataOnComment",customPriority:"customPriority",_customAutocompleteSearch:[0,"customAutocompleteSearch","_customAutocompleteSearch"],customCategory:"customCategory",streamViewContainerId:"streamViewContainerId",composerMode:"composerMode",autoCategorize:"autoCategorize",isDarkMode:[0,"darkMode","isDarkMode"]},outputs:{onCommentAdd:"onCommentAdd",onSignIn:"onSignIn",onUpgrade:"onUpgrade",onCustomPinInject:"onCustomPinInject",onCommentUpdate:"onCommentUpdate",onCommentAccept:"onCommentAccept",onCommentReject:"onCommentReject",onSidebarButtonOnCommentDialogClick:"onSidebarButtonOnCommentDialogClick",onCommentSelectionChange:"onCommentSelectionChange",onCopyLink:"onCopyLink"},standalone:!1,features:[Xe],decls:1,vars:1,consts:[["commentsDataRef",""],[4,"ngIf"],[2,"display","none"],["id","comment-pin-slot","name","comment-pin",3,"slotchange"],[3,"componentConfigSignal"],[4,"ngIf","ngIfElse"],[4,"ngTemplateOutlet"],[3,"commentPinAnnotations","streamViewContainerId",4,"ngIf"],[3,"darkMode","commentAnnotation",4,"ngIf"],[3,"commentAnnotations","user","position",4,"ngIf"],[3,"commentPinAnnotations","streamViewContainerId"],[3,"darkMode","commentAnnotation"],[3,"commentAnnotations","user","position"]],template:function(i,r){i&1&&g(0,K$t,5,5,"ng-container",1),i&2&&c("ngIf",r.componentConfigSignal())},dependencies:[Z,vt,tce,Pfe,Mfe,G9,tn,BC,de],encapsulation:2,changeDetection:0});let n=o;return n})();var Z$t=["sidebarRef"],X$t=n=>({componentConfigSignal:n}),Q$t=(n,o)=>({condition:n,data:o}),J$t=(n,o)=>({componentConfigSignal:n,sidebarRef:o}),eHt=(n,o)=>({template:n,context:o});function tHt(n,o){if(n&1&&(C(0,"div",5,0),w(2,"app-comment-sidebar-skeleton",6)(3,"app-comment-sidebar-panel",7)(4,"app-comment-sidebar-focused-thread",8),S()),n&2){let t=pe(1),e=l(3).ngIf,i=l();ge("s-overflow-hidden",e.moreFiltersVisible)("velt-sidebar--more-filters-visible",e.moreFiltersVisible),x("aria-expanded",e.sidebarVisible),d(2),c("componentConfigSignal",i.componentConfigSignal),d(),c("sidebarRef",t)("componentConfigSignal",i.componentConfigSignal),d(),c("componentConfigSignal",i.componentConfigSignal)("sidebarRef",t)}}function nHt(n,o){if(n&1){let t=q();f(0),C(1,"div",3),A(2,"translate"),G("click",function(i){N(t);let r=l(3);return F(r.onClick(i))}),g(3,tHt,5,10,"div",4),S(),v()}if(n&2){let t=l(2).ngIf,e=l();d(),ge("mobile",t.isPhone)("visible",t.sidebarVisible||t.embedMode||t.floatingMode)("floating",t.floatingMode)("embed",t.embedMode)("page",t.pageMode),c("ngClass",t.position),x("data-testid",e.componentId)("aria-label",P(2,14,"Comments sidebar")),d(2),c("veltDynamicTemplate",R(19,eHt,e.template,R(16,J$t,e.componentConfigSignal,e.sidebarRef)))}}function iHt(n,o){if(n&1&&(f(0),g(1,nHt,4,22,"ng-container",1),v()),n&2){let t=l().ngIf;d(),c("ngIf",t)}}function oHt(n,o){if(n&1&&(f(0),g(1,iHt,2,1,"ng-container",2),v()),n&2){let t=l();d(),c("veltIf",R(3,Q$t,t.conditionSignal(),M(1,X$t,t.componentConfigSignal)))}}var Rfe=(()=>{let o=class o extends nt{constructor(e,i,r,a){super(e,i,void 0,void 0,void 0,a,r),this.elementRef=e,this.themeService=i,this.loggingService=r,this.dynamicDataService=a,this.onWrapperClick=new Ae,this.componentId="velt-comments-sidebar-wrapper",super.initializeComponentConfigSignal(new We)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentsSidebarWrapperComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentsSidebarWrapperComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in setupA11yAttributes:",e)}}onClick(e){try{this.onWrapperClick.emit(e)}catch{}}};o.\u0275fac=function(i){return new(i||o)(u(k),u(Ye),u(y),u(b))},o.\u0275cmp=O({type:o,selectors:[["velt-comments-sidebar-wrapper-internal"]],viewQuery:function(i,r){if(i&1&&ot(Z$t,7),i&2){let a;Qe(a=Je())&&(r.sidebarRef=a.first)}},outputs:{onWrapperClick:"onWrapperClick"},standalone:!1,features:[U([b]),B],decls:1,vars:1,consts:[["sidebarRef",""],[4,"ngIf"],[4,"veltIf"],["data-velt-element","true","data-velt-comment-disabled","true","role","complementary",1,"velt-sidebar-container",3,"click","ngClass"],["class","velt-sidebar","role","region",3,"s-overflow-hidden","velt-sidebar--more-filters-visible",4,"veltDynamicTemplate"],["role","region",1,"velt-sidebar"],[3,"componentConfigSignal"],[3,"sidebarRef","componentConfigSignal"],[3,"componentConfigSignal","sidebarRef"]],template:function(i,r){i&1&&g(0,oHt,2,6,"ng-container",1),i&2&&c("ngIf",r.componentConfigSignal())},dependencies:[Br,Z,ne,mh,ch,HC,ae,de],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}[_nghost-%COMP%]{--velt-green: var(--velt-light-mode-green);--velt-magenta: var(--velt-light-mode-magenta);--velt-amber: var(--velt-light-mode-amber);--velt-purple: var(--velt-light-mode-purple);--velt-cyan: var(--velt-light-mode-cyan);--velt-orange: var(--velt-light-mode-orange);--velt-black: var(--velt-light-mode-black);--velt-white: var(--velt-light-mode-white);--velt-gray: var(--velt-light-mode-gray);--velt-error: var(--velt-light-mode-error);--velt-error-hover: var(--velt-light-mode-error-hover);--velt-error-foreground: var(--velt-light-mode-error-foreground);--velt-error-light: var(--velt-light-mode-error-light);--velt-error-transparent: var(--velt-light-mode-error-transparent);--velt-warning: var(--velt-light-mode-warning);--velt-warning-hover: var(--velt-light-mode-warning-hover);--velt-warning-foreground: var(--velt-light-mode-warning-foreground);--velt-warning-light: var(--velt-light-mode-warning-light);--velt-warning-transparent: var(--velt-light-mode-warning-transparent);--velt-success: var(--velt-light-mode-success);--velt-success-hover: var(--velt-light-mode-success-hover);--velt-success-foreground: var(--velt-light-mode-success-foreground);--velt-success-light: var(--velt-light-mode-success-light);--velt-success-transparent: var(--velt-light-mode-success-transparent);--velt-accent: var(--velt-light-mode-accent);--velt-accent-text: var(--velt-light-mode-accent-text);--velt-accent-hover: var(--velt-light-mode-accent-hover);--velt-accent-foreground: var(--velt-light-mode-accent-foreground);--velt-accent-light: var(--velt-light-mode-accent-light);--velt-accent-transparent: var(--velt-light-mode-accent-transparent);--velt-text-0: var(--velt-light-mode-text-0);--velt-text-1: var(--velt-light-mode-text-1);--velt-text-2: var(--velt-light-mode-text-2);--velt-text-3: var(--velt-light-mode-text-3);--velt-text-4: var(--velt-light-mode-text-4);--velt-text-5: var(--velt-light-mode-text-5);--velt-text-6: var(--velt-light-mode-text-6);--velt-text-7: var(--velt-light-mode-text-7);--velt-text-8: var(--velt-light-mode-text-8);--velt-text-9: var(--velt-light-mode-text-9);--velt-text-10: var(--velt-light-mode-text-10);--velt-text-11: var(--velt-light-mode-text-11);--velt-text-12: var(--velt-light-mode-text-12);--velt-background-0: var(--velt-light-mode-background-0);--velt-background-1: var(--velt-light-mode-background-1);--velt-background-2: var(--velt-light-mode-background-2);--velt-background-3: var(--velt-light-mode-background-3);--velt-background-4: var(--velt-light-mode-background-4);--velt-background-5: var(--velt-light-mode-background-5);--velt-background-6: var(--velt-light-mode-background-6);--velt-background-7: var(--velt-light-mode-background-7);--velt-background-8: var(--velt-light-mode-background-8);--velt-background-9: var(--velt-light-mode-background-9);--velt-background-10: var(--velt-light-mode-background-10);--velt-border-0: var(--velt-light-mode-border-0);--velt-border-1: var(--velt-light-mode-border-1);--velt-border-2: var(--velt-light-mode-border-2);--velt-border-3: var(--velt-light-mode-border-3);--velt-border-4: var(--velt-light-mode-border-4);--velt-border-5: var(--velt-light-mode-border-5);--velt-border-6: var(--velt-light-mode-border-6);--velt-border-7: var(--velt-light-mode-border-7);--velt-border-8: var(--velt-light-mode-border-8);--velt-border-9: var(--velt-light-mode-border-9);--velt-border-10: var(--velt-light-mode-border-10);--velt-background-transparent: var(--velt-light-mode-background-transparent);--velt-border-transparent: var(--velt-light-mode-border-transparent);--velt-animation-transparent: var(--velt-light-mode-animation-transparent)}[dark][_nghost-%COMP%]{--velt-green: var(--velt-dark-mode-green);--velt-magenta: var(--velt-dark-mode-magenta);--velt-amber: var(--velt-dark-mode-amber);--velt-purple: var(--velt-dark-mode-purple);--velt-cyan: var(--velt-dark-mode-cyan);--velt-orange: var(--velt-dark-mode-orange);--velt-black: var(--velt-dark-mode-black);--velt-white: var(--velt-dark-mode-white);--velt-gray: var(--velt-dark-mode-gray);--velt-error: var(--velt-dark-mode-error);--velt-error-hover: var(--velt-dark-mode-error-hover);--velt-error-foreground: var(--velt-dark-mode-error-foreground);--velt-error-light: var(--velt-dark-mode-error-light);--velt-error-transparent: var(--velt-dark-mode-error-transparent);--velt-warning: var(--velt-dark-mode-warning);--velt-warning-hover: var(--velt-dark-mode-warning-hover);--velt-warning-foreground: var(--velt-dark-mode-warning-foreground);--velt-warning-light: var(--velt-dark-mode-warning-light);--velt-warning-transparent: var(--velt-dark-mode-warning-transparent);--velt-success: var(--velt-dark-mode-success);--velt-success-hover: var(--velt-dark-mode-success-hover);--velt-success-foreground: var(--velt-dark-mode-success-foreground);--velt-success-light: var(--velt-dark-mode-success-light);--velt-success-transparent: var(--velt-dark-mode-success-transparent);--velt-accent: var(--velt-dark-mode-accent);--velt-accent-text: var(--velt-dark-mode-accent-text);--velt-accent-hover: var(--velt-dark-mode-accent-hover);--velt-accent-foreground: var(--velt-dark-mode-accent-foreground);--velt-accent-light: var(--velt-dark-mode-accent-light);--velt-accent-transparent: var(--velt-dark-mode-accent-transparent);--velt-text-0: var(--velt-dark-mode-text-0);--velt-text-1: var(--velt-dark-mode-text-1);--velt-text-2: var(--velt-dark-mode-text-2);--velt-text-3: var(--velt-dark-mode-text-3);--velt-text-4: var(--velt-dark-mode-text-4);--velt-text-5: var(--velt-dark-mode-text-5);--velt-text-6: var(--velt-dark-mode-text-6);--velt-text-7: var(--velt-dark-mode-text-7);--velt-text-8: var(--velt-dark-mode-text-8);--velt-text-9: var(--velt-dark-mode-text-9);--velt-text-10: var(--velt-dark-mode-text-10);--velt-text-11: var(--velt-dark-mode-text-11);--velt-text-12: var(--velt-dark-mode-text-12);--velt-background-0: var(--velt-dark-mode-background-0);--velt-background-1: var(--velt-dark-mode-background-1);--velt-background-2: var(--velt-dark-mode-background-2);--velt-background-3: var(--velt-dark-mode-background-3);--velt-background-4: var(--velt-dark-mode-background-4);--velt-background-5: var(--velt-dark-mode-background-5);--velt-background-6: var(--velt-dark-mode-background-6);--velt-background-7: var(--velt-dark-mode-background-7);--velt-background-8: var(--velt-dark-mode-background-8);--velt-background-9: var(--velt-dark-mode-background-9);--velt-background-10: var(--velt-dark-mode-background-10);--velt-border-0: var(--velt-dark-mode-border-0);--velt-border-1: var(--velt-dark-mode-border-1);--velt-border-2: var(--velt-dark-mode-border-2);--velt-border-3: var(--velt-dark-mode-border-3);--velt-border-4: var(--velt-dark-mode-border-4);--velt-border-5: var(--velt-dark-mode-border-5);--velt-border-6: var(--velt-dark-mode-border-6);--velt-border-7: var(--velt-dark-mode-border-7);--velt-border-8: var(--velt-dark-mode-border-8);--velt-border-9: var(--velt-dark-mode-border-9);--velt-border-10: var(--velt-dark-mode-border-10);--velt-background-transparent: var(--velt-dark-mode-background-transparent);--velt-border-transparent: var(--velt-dark-mode-border-transparent);--velt-animation-transparent: var(--velt-dark-mode-animation-transparent)}.velt-sidebar-container[_ngcontent-%COMP%]{height:100vh;width:calc((26rem + 0px) * var(--velt-base-rem-unit));position:fixed;top:0;padding:var(--velt-spacing-lg);box-sizing:border-box;z-index:999999997}.velt-sidebar-container.left[_ngcontent-%COMP%]{left:-100%;transition:width .5s ease-in-out,left .5s ease-in-out}.velt-sidebar-container.left.visible[_ngcontent-%COMP%]{left:0}.velt-sidebar-container.right[_ngcontent-%COMP%]{right:-100%;transition:width .5s ease-in-out,right .5s ease-in-out}.velt-sidebar-container.right.visible[_ngcontent-%COMP%]{right:0}.velt-sidebar-container.mobile[_ngcontent-%COMP%]{width:100%;height:100%;box-sizing:border-box;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px)}.velt-sidebar-container.embed[_ngcontent-%COMP%]{width:100%;height:100%;position:unset;border:0}.velt-sidebar-container.floating[_ngcontent-%COMP%]{height:90vh;position:unset;border:0;padding:0;width:calc((22.5rem + 0px) * var(--velt-base-rem-unit))}.velt-sidebar-container.floating.embed[_ngcontent-%COMP%]{width:100%;height:100%}.velt-sidebar-container.page[_ngcontent-%COMP%] .velt-sidebar[_ngcontent-%COMP%]{padding-bottom:0}.velt-sidebar-container[_ngcontent-%COMP%] *[_ngcontent-%COMP%]{box-sizing:border-box}.velt-sidebar-container[_ngcontent-%COMP%] .velt-sidebar[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:var(--velt-spacing-lg);font-weight:400;font-size:var(--velt-font-size-sm);line-height:21px;align-items:center;background:var(--velt-background-0);border-radius:var(--velt-border-radius-lg);width:100%;overflow-x:hidden;position:relative;height:100%;border:1px solid var(--velt-border-5)}.velt-sidebar-container[_ngcontent-%COMP%] .velt-sidebar[_ngcontent-%COMP%] app-comment-sidebar-filter[_ngcontent-%COMP%]{position:absolute;top:0;left:0;width:100%;height:100%;-webkit-user-select:none;user-select:none;pointer-events:none}.velt-sidebar-container[_ngcontent-%COMP%] .velt-sidebar.velt-sidebar--more-filters-visible[_ngcontent-%COMP%] app-comment-sidebar-filter[_ngcontent-%COMP%]{pointer-events:initial;-webkit-user-select:initial;user-select:initial}.velt-sidebar-container[_ngcontent-%COMP%] .velt-sidebar[_ngcontent-%COMP%]::-webkit-scrollbar{display:none;width:0;height:0}.velt-sidebar-container[_ngcontent-%COMP%] .velt-sidebar[_ngcontent-%COMP%]:not(.s-overflow-hidden){overflow-y:auto}[_nghost-%COMP%] velt-comments-sidebar-wireframe{width:100%;height:100%;display:flex;flex-direction:column;gap:var(--velt-spacing-lg)}"],changeDetection:0});let n=o;return n})();var aHt=["sidebarOverlay"],sHt=["virtualScrollViewportRef"],lHt=["host"],cHt=n=>["snippyly-sidebar-panel",n];function mHt(n,o){n&1&&Ue(0)}function dHt(n,o){if(n&1&&(C(0,"velt-shadow-dom-internal"),g(1,mHt,1,0,"ng-container",7),S()),n&2){l(3);let t=pe(3);d(),c("ngTemplateOutlet",t)}}function pHt(n,o){if(n&1&&(f(0),g(1,dHt,2,1,"velt-shadow-dom-internal",6),v()),n&2){l(2);let t=pe(3),e=l();d(),c("ngIf",!e.template&&e.sidebarShadowDOM)("ngIfElse",t)}}function gHt(n,o){n&1&&Ue(0)}function uHt(n,o){if(n&1&&(C(0,"velt-shadow-dom-internal"),g(1,gHt,1,0,"ng-container",7),S()),n&2){l(5);let t=pe(3);d(),c("ngTemplateOutlet",t)}}function hHt(n,o){if(n&1&&(C(0,"div",11),g(1,uHt,2,1,"velt-shadow-dom-internal",6),S()),n&2){let t=l(4).ngIf,e=pe(3),i=l();ge("dark",t.darkMode),d(),c("ngIf",!i.template&&i.sidebarShadowDOM)("ngIfElse",e)}}function fHt(n,o){if(n&1&&g(0,hHt,2,4,"div",10),n&2){let t=l(3).ngIf;c("ngIf",t==null?null:t.sidebarVisible)}}function vHt(n,o){if(n&1&&(w(0,"div",8,2),g(2,fHt,1,1,"ng-template",9,3,De)),n&2){let t=pe(1),e=l(2).ngIf;d(2),c("cdkConnectedOverlayOrigin",t)("cdkConnectedOverlayOpen",!0)("cdkConnectedOverlayDisableClose",!0)("cdkConnectedOverlayPanelClass",M(4,cHt,e.darkMode?"dark":""))}}function CHt(n,o){if(n&1&&g(0,pHt,2,2,"ng-container",6)(1,vHt,4,6,"ng-template",null,1,De),n&2){let t=pe(2),e=l().ngIf;c("ngIf",e.embedMode||e.floatingMode)("ngIfElse",t)}}function _Ht(n,o){if(n&1){let t=q();C(0,"velt-comments-sidebar-wrapper-internal",12),A(1,"translate"),G("onWrapperClick",function(i){N(t);let r=l(2);return F(r.onClick(i))}),S()}if(n&2){let t=l().ngIf,e=l();c("componentConfigSignal",e.componentConfigSignal)("template",e.template)("darkMode",t.darkMode),x("data-testid",e.componentId)("aria-label",P(1,6,"Comments sidebar"))("aria-modal",!0)}}function yHt(n,o){if(n&1&&(f(0),g(1,CHt,3,2,"ng-template",5)(2,_Ht,2,8,"ng-template",null,0,De),v()),n&2){let t=o.ngIf;d(),c("ngIf",t.isFirstComponent||t.floatingMode)}}var W9=(()=>{let o=class o extends nt{set _pageMode(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.componentConfigSignal.update(r=>(r=T(I({},r),{pageMode:i}),r))}catch(i){this.loggingService.catch("Error in CommentsSidebarComponent _pageMode: ",i)}}set _filterCount(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.componentConfigSignal.update(r=>(r=T(I({},r),{filterCount:i}),r))}catch(i){this.loggingService.catch("Error in CommentsSidebarComponent _filterCount: ",i)}}set _customActions(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableSidebarCustomActions():this.commentService.disableSidebarCustomActions()}catch(i){this.loggingService.catch("Error in CommentsSidebarComponent _pageMode: ",i)}}set focusedThreadMode(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableFocusedThreadMode():this.commentService.disableFocusedThreadMode()}catch(i){this.loggingService.catch("Error in CommentsSidebarComponent _pageMode: ",i)}}set _sortData(e){try{this.componentConfigSignal.update(i=>(i=T(I({},i),{sortData:e}),i))}catch(i){this.loggingService.catch("Error in CommentsSidebarComponent _sortData: ",i)}}set enableUrlNavigation(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableSidebarUrlNavigation():this.commentService.disableSidebarUrlNavigation()}set urlNavigation(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableSidebarUrlNavigation():this.commentService.disableSidebarUrlNavigation()}set _queryParamsComments(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableQueryParamsComments():this.commentService.disableQueryParamsComments()}catch(i){this.loggingService.catch("Error in CommentsSidebarComponent _queryParamsComments: ",i)}}set _currentLocationSuffix(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.componentConfigSignal.update(r=>(r=T(I({},r),{currentLocationSuffix:!!i}),r))}catch{}}set _filterOptionLayout(e){try{this.componentConfigSignal.update(i=>(i=T(I({},i),{filterOptionLayout:e}),i))}catch{}}set _filterConfig(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i&&typeof i=="object"&&this.updateFilterConfig(i)}catch{}}set _groupConfig(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i&&typeof i=="object"&&this.componentConfigSignal.update(r=>(r=T(I({},r),{groupConfig:i}),r.groupConfig?.enable||(r.groupBy=null),r))}catch{}}set _filters(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i&&typeof i=="object"&&this.commentService.setCommentSidebarFilters(i)}catch{}}set _systemFiltersOperator(e){try{e&&this.commentService.setCommentSidebarSystemFiltersOperator(e)}catch{}}set _excludeLocationIds(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i&&typeof i=="object"&&this.commentService.setExcludeLocationIdsFromSidebar(i)}catch{}}set _fullExpanded(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.componentConfigSignal.update(r=>(r=T(I({},r),{fullExpanded:!!i}),r))}catch{}}set _sidebarShadowDOM(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.componentConfigSignal.update(r=>(r=T(I({},r),{shadowDom:i}),r)),i?this.commentService.enableSidebarShadowDOM():this.commentService.disableSidebarShadowDOM()}catch{}}constructor(e,i,r,a,s,m,p,h,_,E,D,L,H,K,oe,ue,be){super(p,be,void 0,r),this.analyticsService=e,this.authService=i,this.commentService=r,this.configService=a,this.domService=s,this.docService=m,this.elementRef=p,this.iamService=h,this.loggingService=_,this.breakpointObserver=E,this.customFilterService=D,this.translateService=L,this.cd=H,this.wireframeService=K,this.renderer=oe,this.dynamicComponentService=ue,this.themeService=be,this.embedMode=null,this.floatingMode=!1,this.dialogVariant="sidebar",this.focusedThreadDialogVariant="sidebar",this.filterPanelLayout="bottomSheet",this.pageModeComposerVariant="sidebar",this.searchPlaceholder="Search comments",this.openSidebar=new Ae,this.onSidebarOpen=new Ae,this.onSidebarCommentClick=new Ae,this.onSidebarCommentClickEvent=new Ae,this.onCommentClick=new Ae,this.onSidebarClose=new Ae,this.onCommentNavigationButtonClick=new Ae,this.subscriptions=[],this.locations={},this.commentAccessMode=Qi,this.commentReadAnalyticsCalled=!0,this.peopleTypes={all:"All",other:"Other"},this.pageTypes={all:"All",other:"Other"},this.unsetType={id:"unset",name:"Not set"},this.objectKeys=Object.keys,this.filteredGroupedCommentAnnotationsObj={},this.filteredGroupedCommentAnnotations=[],this.veltId=Pn(),this.veltElement=!0,this.defaultFilterConfig={location:{name:"Pages",enable:!0,multiSelection:!0,enableGrouping:!0},document:{name:"Documents",enable:!1,multiSelection:!0,enableGrouping:!1},people:{name:"Author",enable:!0,multiSelection:!0,enableGrouping:!0},assigned:{name:"Assigned",enable:!0,multiSelection:!0,enableGrouping:!0},tagged:{name:"Tagged",enable:!0,multiSelection:!0,enableGrouping:!0},priority:{name:"Priority",enable:!0,multiSelection:!0,enableGrouping:!1},status:{name:"Status",enable:!1,multiSelection:!0,enableGrouping:!1},category:{name:"Category",enable:!0,multiSelection:!0,enableGrouping:!1},commentType:{name:"Comment Type",enable:!0,multiSelection:!0,enableGrouping:!1},version:{name:"Versions",enable:!0,multiSelection:!1,enableGrouping:!1}},this.defaultGroupConfig={enable:!0,name:"Group By"},this.isUserGlobalContact=!1,this.resolvedCommentsOnDom=!1,this.position="right",this.commentRefId="",this.showDefault=!0,this.componentConfigSignal=Te({embedMode:this.embedMode,floatingMode:this.floatingMode,pageMode:!1,currentLocationSuffix:!1,queryParamsComments:!1,variant:this.variant,dialogVariant:this.dialogVariant,focusedThreadDialogVariant:this.focusedThreadDialogVariant,pageModeComposerVariant:this.pageModeComposerVariant,fullExpanded:!1,systemFiltersOperator:hc.AND,annotations:[],filteredCommentPinAnnotations:[],selectedAnnotationsMap:{},commentAnnotationsCountByFilters:{page:{},document:{},status:{},people:{},tagged:{},assigned:{},version:{},priority:{},commentCategory:{},accessMode:{}},noCommentsFound:!1,noCommentsFoundForAppliedFilters:!1,pageCommentAnnotation:new Ro,commentCategoryMap:j.CommentCategoryMap,virtualScrollData:[],isFirstComponent:!1,searchPlaceholder:this.searchPlaceholder,enableAutoCategorize:!1,filterConfig:JSON.parse(JSON.stringify(this.defaultFilterConfig)),filters:{pages:[],documents:[],statuses:[],statusIds:[],people:[],assigned:[],tagged:[],versions:[],versionIds:[],priorities:[],priorityIds:[],categories:[],categoryIds:[],accessModes:[],input:null},moreFiltersVisible:!1,groupByOptions:{},groupBy:null,peopleFilters:[],assignedFilters:[],taggedFilters:[],enablePriority:!1,enableStatus:!0,appliedFiltersCount:0,priorities:[],statuses:[],accessModes:[{id:Qi.PUBLIC,name:"Public"},{id:Qi.PRIVATE,name:"Private"}],filterOptionLayout:"checkbox",filterCount:!0,sidebarVisible:!1,pages:{},documents:{},showAllPages:!1,showAllDocuments:!1,versions:[],groupConfig:JSON.parse(JSON.stringify(this.defaultGroupConfig)),user:null,currentPage:null,currentDocument:null,isUserAdmin:!1,isPhone:!1,darkMode:!1,skeletonLoading:!0,shadowDom:void 0,position:this.position,filterPanelLayout:this.filterPanelLayout,customActionsState:{},readOnly:!1,trackByCategoryId:this.trackByCategoryId.bind(this),trackByPriorityId:this.trackByPriorityId.bind(this),trackByAccessModeId:this.trackByAccessModeId.bind(this),trackByPageKey:this.trackByPageKey.bind(this),trackByDocumentKey:this.trackByDocumentKey.bind(this),trackByPeople:this.trackByPeople.bind(this),trackByVersion:this.trackByVersion.bind(this),trackByGroupByOptionKey:this.trackByGroupByOptionKey.bind(this),onCommentAnnotationClick:this.onCommentAnnotationClick.bind(this),saveComment:this.saveComment.bind(this),trackCommentPinAnnotations:this.trackCommentPinAnnotations.bind(this),updateFilter:this.updateFilter.bind(this),toggleGroupedCommentAnnotations:this.toggleGroupedCommentAnnotations.bind(this),changeGroupBy:this.changeGroupBy.bind(this),closeSidebar:this.closeSidebar.bind(this),toggleMoreFilters:this.toggleMoreFilters.bind(this),savePageComment:this.savePageComment.bind(this),sortComments:this.sortComments.bind(this),goBackToAllComments:this.goBackToAllComments.bind(this),minimalFilterDropdownOpen:!1,minimalActionsDropdownOpen:!1,toggleMinimalFilterDropdown:this.toggleMinimalFilterDropdown.bind(this),unreadCommentsMap:null,minimalFilter:"all",filterCommentsByReadStatus:this.filterCommentsByReadStatus.bind(this),selectedMinimalFilterDropdownOption:{sorting:"date",filter:"all"},locationFilterDropdownOpen:!1,toggleLocationFilterDropdown:this.toggleLocationFilterDropdown.bind(this),documentFilterDropdownOpen:!1,toggleDocumentFilterDropdown:this.toggleDocumentFilterDropdown.bind(this),closeDocumentFilterDropdown:this.closeDocumentFilterDropdown.bind(this),markAllCommentAnnotationsAsRead:this.markAllCommentAnnotationsAsRead.bind(this),markAllCommentAnnotationsAsResolved:this.markAllCommentAnnotationsAsResolved.bind(this),toggleMinimalActionsDropdown:this.toggleMinimalActionsDropdown.bind(this),toggleCustomAction:this.toggleCustomAction.bind(this),focusedThreadMode:!1,focusedAnnotation:null,navigateToComment:this.navigateToComment.bind(this),resetFilters:this.resetFilters.bind(this),filterSearch:this.filterSearch.bind(this)}),this.sidebarShadowDOM=!1,this.dataAvailable=!1,this.componentId="velt-comments-sidebar";try{this.subscriptions.push(super.onDarkModeChange().subscribe(qe=>{this.componentConfigSignal.update(Re=>(Re=T(I({},Re),{darkMode:qe}),Re))})),this.loggingService.log("%c[WB] Creating CLASS: CommentsSidebarComponent","color: blue;"),this.componentConfigSignal.update(qe=>(qe=T(I({},qe),{groupBy:qe.groupByOptions.page}),qe.pageCommentAnnotation.isPageAnnotation=!0,qe)),this.updateGroupByOptions(),this.subscriptions.push(this.commentService.getSidebarShadowDOM$().subscribe(qe=>{this.sidebarShadowDOM=qe})),this.subscriptions.push(this.commentService.getFocusedThreadMode$().subscribe(qe=>{this.componentConfigSignal.update(Re=>(Re=T(I({},Re),{focusedThreadMode:qe}),Re))})),this.subscriptions.push(this.commentService.getReadOnly$().subscribe(qe=>{this.componentConfigSignal.update(Re=>(Re=T(I({},Re),{readOnly:qe}),Re))})),this.subscriptions.push(this.commentService.getQueryParamsComments$().subscribe(qe=>{this.componentConfigSignal.update(Re=>(Re=T(I({},Re),{queryParamsComments:qe}),Re)),this.setPages(),this.setDocuments()})),this.subscriptions.push(this.commentService.getUnreadCommentsMap$().subscribe(qe=>{this.componentConfigSignal.update(Re=>(Re=T(I({},Re),{unreadCommentsMap:qe}),Re))})),this.subscriptions.push(this.breakpointObserver.observe(Oi.XSmall).subscribe(qe=>{qe.matches?this.componentConfigSignal.update(Re=>(Re=T(I({},Re),{isPhone:!0}),Re)):this.componentConfigSignal.update(Re=>(Re=T(I({},Re),{isPhone:!1}),Re))},qe=>{this.loggingService.catch("Error in CommentsSidebarComponent breakpointObserver subscription: ",qe)})),this.subscriptions.push(this.customFilterService.customStatusMap$.subscribe(qe=>{this.statusMap=qe,this.componentConfigSignal.update(Re=>(Re=T(I({},Re),{statuses:Object.values(qe)}),Re)),this.pruneStaleStatuses()})),this.subscriptions.push(this.customFilterService.customPriorityMap$.subscribe(qe=>{this.priorityMap=qe,this.componentConfigSignal.update(Re=>(Re=T(I({},Re),{priorities:[...Object.values(qe),{id:"unset",name:"Not set",color:"#FFFFFF"}]}),Re)),this.pruneStalePriorities()})),this.subscriptions.push(this.customFilterService.customCategoryMap$.subscribe(qe=>{this.componentConfigSignal.update(Re=>(Re=T(I({},Re),{commentCategoryMap:T(I({},qe),{other:{id:"other",name:"Other",color:"#00C48C"}})}),Re)),this.pruneStaleCategories()}));let Le=sessionStorage.getItem(j.SESSION_STORAGE.VELT_COMMENT_SIDEBAR_CUSTOM_ACTIONS_STATE);Le&&this.componentConfigSignal.update(qe=>(qe=T(I({},qe),{customActionsState:JSON.parse(Le)}),qe))}catch(Le){this.loggingService.catch("Error in CommentsSidebarComponent constructor: ",Le)}}ngOnInit(){try{if(this.setupA11yAttributes(),sessionStorage.getItem(j.SESSION_STORAGE.SNIPPYLY_COMMENT_SIDEBAR_FILTERS)){let e=JSON.parse(sessionStorage.getItem(j.SESSION_STORAGE.SNIPPYLY_COMMENT_SIDEBAR_FILTERS));delete e?.input,e?.people?.length&&e.people.find(i=>typeof i=="string")&&(e.people=[]),e?.pages?.length&&e.pages?.forEach(i=>{i?.id||(i.id=i.displayName)}),sessionStorage.getItem(j.SESSION_STORAGE.VELT_COMMENT_SIDEBAR_FILTERS_RESET)||(e.pages=[],sessionStorage.setItem(j.SESSION_STORAGE.VELT_COMMENT_SIDEBAR_FILTERS_RESET,"true")),this.componentConfigSignal.update(i=>(i=T(I({},i),{filters:e}),i)),this.pruneStaleStatuses(),this.pruneStalePriorities(),this.pruneStaleCategories()}if(sessionStorage.getItem(j.SESSION_STORAGE.SNIPPYLY_COMMENT_SIDEBAR_GROUP_BY)){let e=sessionStorage.getItem(j.SESSION_STORAGE.SNIPPYLY_COMMENT_SIDEBAR_GROUP_BY);e&&this.componentConfigSignal.update(i=>(i=I({},i),Object.keys(i.groupByOptions).forEach(r=>{i.groupByOptions[r]===e&&(i.groupBy=e)}),i))}}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent OnInit: ",e)}try{let e="velt-comments-sidebar-wireframe";this.variant&&(e+=`---${this.variant}`),this.subscriptions.push(this.wireframeService.getWireframe$(e).subscribe(i=>{if(i){this.commentRefId="comment-sidebar";let r=document.createElement(i.tagName);r.innerHTML=i.innerHTML,this.template=r}}))}catch(e){this.loggingService.catch("Error in CommentDialogComponent OnInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy(),this.subscriptions.forEach(e=>{e.unsubscribe()}),this.getAllCommentAnnotationsSubscription&&this.getAllCommentAnnotationsSubscription.unsubscribe(),this.componentConfigSignal.update(e=>(e=T(I({},e),{minimalFilterDropdownOpen:!1}),e)),this.commentService.setCommentsFromSidebarMap(null)}catch{}}ngAfterViewInit(){try{if(this.floatingMode)this.initComponent();else{let e=document.querySelector(j.TAGS.SNIPPYLY_COMMENTS_SIDEBAR),i=document.querySelector(j.TAGS.VELT_COMMENTS_SIDEBAR);i?this.veltId===i?.getAttribute(j.ATTRIBUTES.VELT_ID)&&(this.componentConfigSignal.update(r=>(r=T(I({},r),{isFirstComponent:!0}),r)),setTimeout(()=>{this.sidebarOverlay?.overlayRef?.hostElement&&(this.sidebarOverlay.overlayRef.hostElement.style.zIndex="1001")},100),this.initComponent()):this.veltId===e?.getAttribute(j.ATTRIBUTES.VELT_ID)&&(this.componentConfigSignal.update(r=>(r=T(I({},r),{isFirstComponent:!0}),r)),setTimeout(()=>{this.sidebarOverlay?.overlayRef?.hostElement&&(this.sidebarOverlay.overlayRef.hostElement.style.zIndex="1001")},100),this.initComponent())}}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent AfterViewInit: ",e)}}ngOnChanges(e){try{super.ngOnChanges(e),e&&Object.keys(e).forEach(i=>{this.componentConfigSignal.update(r=>(r=T(I({},r),{[i]:e[i].currentValue}),r))})}catch(i){this.loggingService.catch("Error in CommentsSidebarComponent ngOnChanges: ",i)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent setupA11yAttributes:",e)}}onClick(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: onClick","color: green;");let i=e?.target?.tagName?.toLowerCase();i!==j.TAGS.VELT_COMMENT_DIALOG&&i!==j.TAGS.SNIPPYLY_COMMENT_DIALOG&&!e?.target?.closest(j.TAGS.VELT_COMMENT_DIALOG)&&!e?.target?.closest(j.TAGS.SNIPPYLY_COMMENT_DIALOG)&&this.domService.resetSelectedAnnotationsMap()}catch(i){this.loggingService.catch("Error in CommentsSidebarComponent onClick: ",i)}}pruneStaleStatuses(){try{this.statusMap!==void 0&&this.componentConfigSignal.update(e=>(e=I({},e),e.filters.statuses=e.filters.statuses.filter(i=>i.id in this.statusMap),e.filters.statusIds=e.filters.statuses?.map(i=>i?.id),e))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent filterStaleStatuses: ",e)}}pruneStalePriorities(){try{this.priorityMap!==void 0&&this.componentConfigSignal.update(e=>(e=I({},e),e.filters.priorities=e.filters.priorities.filter(i=>i.id in this.priorityMap),e.filters.priorityIds=e.filters.priorities?.map(i=>i.id),e))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent filterStalePriorities: ",e)}}pruneStaleCategories(){try{this.componentConfigSignal().commentCategoryMap!==void 0&&this.componentConfigSignal.update(e=>(e=I({},e),e.filters.categories=e.filters.categories?.filter(i=>i.id in e.commentCategoryMap),e.filters.categoryIds=e.filters.categories?.map(i=>i.id),e))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent filterStaleCategories: ",e)}}trackByAnnotationGroup(e,i){return i?.displayName}trackByAnnotationId(e,i){return i?.annotationId}trackByCategoryId(e,i){return i?.value?.id||e}trackByPriorityId(e,i){return i?.id||e}trackByAccessModeId(e,i){return i?.id||e}trackByPageKey(e,i){return i?.key||e}trackByDocumentKey(e,i){return i?.key||e}trackByPeople(e,i){return i?.id||e}trackByVersion(e,i){return i?.id||e}trackByGroupByOptionKey(e,i){return i?.key||e}initComponent(){try{this.subscriptions.push(this.authService.getUser$().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{user:e}),i)),this.componentConfigSignal().user&&(this.setCommentSidebarInstalledInAnalytics(),this.setCommentSidebarEmbedModeInAnalytics(),this.setCommentSidebarFloatingModeInAnalytics())},e=>{this.loggingService.catch("Error in CommentsSidebarComponent getUser$ subscription: ",e)})),this.subscriptions.push(this.docService.getDocumentPaths$().subscribe(e=>{this.documentPaths=e,this.getAllCommentsOnCurrentDocument()},e=>{this.loggingService.catch("Error in CommentsSidebarComponent getDocumentPaths$ subscription: ",e)})),this.subscriptions.push(this.commentService.getSidebarCustomActionEventData().subscribe(e=>{e&&(this.componentConfigSignal.update(i=>(i=T(I({},i),{customActionsState:e.actions}),i)),sessionStorage.setItem(j.SESSION_STORAGE.VELT_COMMENT_SIDEBAR_CUSTOM_ACTIONS_STATE,JSON.stringify(e.actions)))})),this.subscriptions.push(this.docService.getLocation$().subscribe(e=>{this.location=e;let i=this.commentService.getCommentSidebarFilters(),r=i?I({},i):{version:[]};this.location?.location?.version?r.version=[{id:this.location.location.version?.id,name:this.location.location.version?.name}]:r?.version||(r.version=[]),this.commentService.setCommentSidebarFilters(r),this.setPages(),this.filteredGroupedCommentAnnotationsObj={}},e=>{this.loggingService.catch("Error in CommentsSidebarComponent getLocation$ subscription: ",e)})),this.subscriptions.push(this.docService.getLocations$().subscribe(e=>{this.locations=e,this.filteredGroupedCommentAnnotationsObj={}})),this.subscriptions.push(this.commentService.getEnableStatus$().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{enableStatus:e}),i))})),this.subscriptions.push(this.commentService.getEnablePriority$().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{enablePriority:e}),i))},e=>{this.loggingService.catch("Error in CommentsSidebarComponent getEnablePriority$ subscription: ",e)})),this.subscriptions.push(this.commentService.getEnableAutoCategorize$().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{enableAutoCategorize:e}),i))})),this.subscriptions.push(this.commentService.getSidebarVisibility$().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{sidebarVisible:e}),i)),this.componentConfigSignal().sidebarVisible&&(this.commentReadAnalyticsCalled=!1,setTimeout(()=>{Object.keys(this.componentConfigSignal().selectedAnnotationsMap).length&&this.goToAnnotationInSidebar(this.componentConfigSignal().selectedAnnotationsMap[Object.keys(this.componentConfigSignal().selectedAnnotationsMap)[0]])},500)),this.componentConfigSignal().sidebarVisible?(this.getAllCommentsOnCurrentDocument(),this.commentService.setCommentsFromSidebarMap(this.componentConfigSignal().filteredCommentPinAnnotations)):(this.getAllCommentAnnotationsSubscription&&this.getAllCommentAnnotationsSubscription.unsubscribe(),this.commentService.setCommentsFromSidebarMap(null))},e=>{this.loggingService.catch("Error in CommentsSidebarComponent getSidebarVisibility$ subscription: ",e)})),this.subscriptions.push(this.commentService.getCommentSidebarFilters$().subscribe(e=>{this.mergeClientFilters(e)})),this.subscriptions.push(this.commentService.getCommentSidebarSystemFiltersOperator$().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{systemFiltersOperator:e}),i)),this.filterCommentAnnotations()})),this.subscriptions.push(this.commentService.getOpenSidebar$().subscribe(e=>{this.openSidebar.emit(e),this.onSidebarOpen.emit(e)},e=>{this.loggingService.catch("Error in CommentsSidebarComponent getOpenSidebar$ subscription: ",e)})),this.subscriptions.push(this.domService.getSelectedAnnotationsMap$().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{selectedAnnotationsMap:e}),i)),Object.keys(this.componentConfigSignal().selectedAnnotationsMap).length===1&&!this.commentService.showFloatingComments()&&this.commentService.setSidebarVisibility(!0)},e=>{this.loggingService.catch("Error in CommentsSidebarComponent getSidebarVisibility$ subscription: ",e)})),this.subscriptions.push(this.domService.onDocumentClick$().subscribe(e=>{try{if(this.componentConfigSignal().sidebarVisible&&e&&!this.elementRef?.nativeElement?.contains(e?.target)){let i=document.querySelectorAll(".cdk-overlay-container");Array.from(i).some(a=>a?.contains(e?.target))||!this.embedMode&&!this.commentService.isSidebarOpenedByCustomTrigger()&&(e?.target?.hasAttribute(j.ATTRIBUTES.VELT_DOWNLOAD_BUTTON)||(this.closeSidebar(),e?.stopPropagation()))}}catch(i){this.loggingService.catch("Error in CommentsSidebarComponent onDocumentClick: ",i)}},e=>{this.loggingService.catch("Error in CommentsSidebarComponent onDocumentClick$ subscription: ",e)})),this.subscriptions.push(this.iamService.isUserAdmin$().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{isUserAdmin:e}),i))},e=>{this.loggingService.catch("Error in CommentsSidebarComponent isUserAdmin$ subscription: ",e)})),this.getAllCommentsOnCurrentDocument(),this.subscriptions.push(this.commentService.getSidebarCustomData().subscribe(e=>{this.updateVirtualScrollData(e)}))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent initComponent: ",e)}}updateVirtualScrollData(e){try{if(this.commentService.getSidebarCustomActionsValue()){this.componentConfigSignal.update(r=>(r=I({},r),r.virtualScrollData=[],r)),e?.data?.forEach((r,a)=>{e?.options?.grouping!==!1&&this.componentConfigSignal.update(s=>(s=I({},s),s.virtualScrollData.push({type:"group",data:{displayName:r?.groupName,isExpanded:r?.isExpanded===void 0&&a===0||r?.isExpanded,annotations:r?.annotations}}),s)),(r?.isExpanded===void 0&&a===0||r?.isExpanded)&&r?.annotations?.forEach(s=>{this.componentConfigSignal.update(m=>(m=I({},m),m.virtualScrollData.push({type:"annotation",data:s}),m))})}),this.componentConfigSignal.update(r=>(r=T(I({},r),{noCommentsFoundForAppliedFilters:!this.componentConfigSignal().virtualScrollData?.length}),r)),this.cd.markForCheck();let i=this.virtualScrollViewportRef?.elementRef?.nativeElement;i&&(i.scrollTop=0)}}catch(i){this.loggingService.catch("Error in CommentsSidebarComponent updateVirtualScrollData: ",i)}}updateVirtualScrollDataGroupToggle(e){try{if(this.commentService.getSidebarCustomActionsValue()){this.componentConfigSignal.update(r=>(r=I({},r),r.virtualScrollData=[],r)),e?.forEach(r=>{r.type==="group"&&(this.componentConfigSignal.update(a=>(a=I({},a),a.virtualScrollData.push(r),a)),r?.data?.isExpanded&&r?.data?.annotations.forEach(a=>{this.componentConfigSignal.update(s=>(s=I({},s),s.virtualScrollData.push({type:"annotation",data:a}),s))}))}),this.componentConfigSignal.update(r=>(r=T(I({},r),{noCommentsFoundForAppliedFilters:!this.componentConfigSignal().virtualScrollData?.length}),r)),this.cd.markForCheck();let i=this.virtualScrollViewportRef?.elementRef?.nativeElement;i&&(i.scrollTop=0)}}catch(i){this.loggingService.catch("Error in CommentsSidebarComponent updateVirtualScrollDataGroupToggle: ",i)}}getAllCommentsOnCurrentDocument(){this.loggingService.log("%c[WB] Calling FUNCTION: getAllCommentsOnCurrentDocument","color: green;");try{this.getAllCommentAnnotationsSubscription&&this.getAllCommentAnnotationsSubscription.unsubscribe(),this.componentConfigSignal.update(e=>(e=T(I({},e),{skeletonLoading:!0}),e)),this.getAllCommentAnnotationsSubscription=this.commentService.getAllCommentAnnotations({excludeDomChanges:!0,skipPositionCalculation:!0,fromCommentSidebar:!0,analytics:{enabled:!0,properties:{source:"internal",sourceId:"commentsSidebar"}}}).pipe(ce(e=>(e||this.componentConfigSignal.update(i=>(i=T(I({},i),{skeletonLoading:!0}),i)),e)),Fe(e=>!!e),ce(e=>e?.filter(i=>i?.comments?.length)),he(e=>this.commentService.getExcludeLocationIdsFromSidebar$().pipe(ce(i=>i?.length&&e?.length?e.filter(r=>r?.location?.id?!i.includes(r.location.id):!0):e))),he(e=>this.commentService.getResolvedCommentsOnDom$().pipe(ce(i=>(this.resolvedCommentsOnDom!==i&&(this.resolvedCommentsOnDom=i,i&&this.setResolvedStatusInFilter()),e))))).subscribe(e=>{if(this.dataAvailable=!0,this.componentConfigSignal.update(i=>{if(i=T(I({},i),{skeletonLoading:!1}),i.annotations=e?.filter(r=>!r?.isPageAnnotation||r?.comments?.length)||[],i.sortData==="asc"?i.annotations=i.annotations?.sort((r,a)=>r.lastUpdated-a.lastUpdated):i.sortData==="none"?i.annotations=i.annotations?.sort((r,a)=>a.createdAt-r.createdAt):i.annotations=i.annotations?.sort((r,a)=>a.lastUpdated-r.lastUpdated),i?.focusedAnnotation?.annotationId){let r=e?.find(a=>a.annotationId===i?.focusedAnnotation?.annotationId);r&&(i.focusedAnnotation=r)}return i}),this.setPages(),this.setDocuments(),this.setVersions(),this.setPeople(),this.filterCommentAnnotations(),this.updateAnnotationCountsByFilter(),this.componentConfigSignal().annotations?.length){let i=sessionStorage.getItem(j.SESSION_STORAGE.SNIPPYLY_SELECTED_ANNOTATION_ID);if(i){sessionStorage.removeItem(j.SESSION_STORAGE.SNIPPYLY_SELECTED_ANNOTATION_ID),this.commentService.setSidebarVisibility(!0);let r=this.componentConfigSignal().annotations.find(a=>a.annotationId===i);r&&this.goToAnnotation(r)}this.componentConfigSignal().sidebarVisible&&!this.commentReadAnalyticsCalled&&this.setCommentReadInAnalytics()}this.componentConfigSignal.update(i=>(i=T(I({},i),{noCommentsFound:!this.componentConfigSignal().annotations?.length}),i))},e=>{this.loggingService.catch("Error in CommentsSidebarComponent getAllCommentsOnCurrentDocument subscription: ",e),this.componentConfigSignal.update(i=>(i=T(I({},i),{skeletonLoading:!1}),i))})}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent getAllCommentsOnCurrentDocument: ",e)}}mergeClientFilters(e){try{if(Object.keys(e||{})?.length){if(e?.location&&(e?.location?.length?(this.componentConfigSignal.update(i=>(i=T(I({},i),{filters:T(I({},i.filters),{pages:[]})}),i)),e?.location?.forEach(i=>{if(i?.id&&(this.componentConfigSignal().filters?.pages||this.componentConfigSignal.update(a=>(a=T(I({},a),{filters:T(I({},a.filters),{pages:[]})}),a)),!this.componentConfigSignal().filters.pages.find(a=>a.id===i.id))){let a=this.docService.genarateLocationId(i);this.componentConfigSignal.update(s=>(s=T(I({},s),{filters:T(I({},s.filters),{pages:[...s.filters.pages,{id:i.id,displayName:i.displayName,locationIds:[a],selected:!0}]})}),s))}})):this.componentConfigSignal.update(i=>(i=T(I({},i),{filters:T(I({},i.filters),{pages:[]})}),i)),this.updatePageSelectedState()),e?.document&&(e?.document?.length?(this.componentConfigSignal.update(i=>(i=T(I({},i),{filters:T(I({},i.filters),{documents:[]})}),i)),e?.document?.forEach(i=>{(i?.id||i?.documentName)&&(this.componentConfigSignal().filters?.documents||this.componentConfigSignal.update(a=>(a=T(I({},a),{filters:T(I({},a.filters),{documents:[]})}),a)),this.componentConfigSignal().filters.documents.find(a=>a.id===i.id||a.documentName===i.documentName)||this.componentConfigSignal.update(a=>(a=T(I({},a),{filters:T(I({},a.filters),{documents:[...a.filters.documents,{id:i.id||i.documentName,documentName:i.documentName||i.id,selected:!0}]})}),a)))})):this.componentConfigSignal.update(i=>(i=T(I({},i),{filters:T(I({},i.filters),{documents:[]})}),i)),this.updateDocumentSelectedState()),e?.priority)if(e?.priority?.length){let i=e.priority;this.componentConfigSignal.update(r=>(r=T(I({},r),{filters:T(I({},r.filters),{priorities:r.priorities.filter(a=>i.includes(a.id)),priorityIds:i})}),r))}else this.componentConfigSignal.update(i=>(i=T(I({},i),{filters:T(I({},i.filters),{priorities:[],priorityIds:[]})}),i));if(e?.category)if(e?.category?.length){if(this.componentConfigSignal().commentCategoryMap){let i=e.category;this.componentConfigSignal.update(r=>(r=T(I({},r),{filters:T(I({},r.filters),{categories:Object.values(r.commentCategoryMap).filter(a=>i.includes(a.id)),categoryIds:i})}),r))}}else this.componentConfigSignal.update(i=>(i=T(I({},i),{filters:T(I({},i.filters),{categories:[],categoryIds:[]})}),i));if(e?.status)if(e?.status?.length){let i=e.status;this.componentConfigSignal.update(r=>(r=T(I({},r),{filters:T(I({},r.filters),{statuses:r.statuses.filter(a=>i.includes(a.id)),statusIds:i})}),r))}else this.componentConfigSignal.update(i=>(i=T(I({},i),{filters:T(I({},i.filters),{statuses:[],statusIds:[]})}),i));else sessionStorage.getItem(j.SESSION_STORAGE.SNIPPYLY_COMMENT_SIDEBAR_FILTERS)||this.setDefaultStatuses();if(e?.people){if(e?.people?.length){let i=[],r=this.componentConfigSignal().user;r&&e.people.find(s=>s.userId&&s.userId===r?.userId||s.email&&s.email===r?.email)&&i.push({id:r.userSnippylyId,name:r.name||r.email||r.userId||"",userId:r.userId,email:r.email}),e.people.forEach(a=>{if(a?.userId||a?.email){let s=this.componentConfigSignal().peopleFilters.find(m=>a.userId&&m?.user?.userId===a.userId||a.email&&m?.user?.email===a.email);if(s&&s?.user?.userSnippylyId!==r?.userSnippylyId)i.push({id:s?.user?.userSnippylyId,name:s?.user?.name,userId:s?.user?.userId,email:s?.user?.email});else{let m="",p=this.configService.getApiKey(),h=a.userId;p&&h&&(m=ym(p,h)),m!==r?.userSnippylyId&&i.push({id:m,name:a.name||a.email||a.userId,userId:a.userId,email:a.email})}}}),this.componentConfigSignal.update(a=>(a=T(I({},a),{filters:T(I({},a.filters),{people:i})}),a))}else this.componentConfigSignal.update(i=>(i=T(I({},i),{filters:T(I({},i.filters),{people:[]})}),i));this.setPeople(),this.updatePeopleSelectedState()}if(e?.assigned){if(e?.assigned?.length){let i=[],r=this.componentConfigSignal().user;r&&e.assigned.find(s=>s.userId&&s.userId===r?.userId||s.email&&s.email===r?.email)&&i.push({id:r.userSnippylyId,name:r.name||r.email||r.userId||"",userId:r.userId,email:r.email}),e.assigned.forEach(a=>{if(a?.userId||a?.email){let s=this.componentConfigSignal().assignedFilters.find(m=>a.userId&&m?.user?.userId===a.userId||a.email&&m?.user?.email===a.email);if(s&&s?.user?.userSnippylyId!==r?.userSnippylyId)i.push({id:s?.user?.userSnippylyId,name:s?.user?.name,userId:s?.user?.userId,email:s?.user?.email});else{let m="",p=this.configService.getApiKey(),h=a.userId;p&&h&&(m=ym(p,h)),m!==r?.userSnippylyId&&i.push({id:m,name:a.name||a.email||a.userId,userId:a.userId,email:a.email})}}}),this.componentConfigSignal.update(a=>(a=T(I({},a),{filters:T(I({},a.filters),{assigned:i})}),a))}else this.componentConfigSignal.update(i=>(i=T(I({},i),{filters:T(I({},i.filters),{assigned:[]})}),i));this.setPeople(),this.updatePeopleSelectedState()}if(e?.tagged){if(e?.tagged?.length){let i=[],r=this.componentConfigSignal().user;r&&e.tagged.find(s=>s.userId&&s.userId===r?.userId||s.email&&s.email===r?.email)&&i.push({id:r.userSnippylyId,name:r.name||r.email||r.userId||"",userId:r.userId,email:r.email}),e.tagged.forEach(a=>{if(a?.userId||a?.email){let s=this.componentConfigSignal().taggedFilters.find(m=>a.userId&&m?.user?.userId===a.userId||a.email&&m?.user?.email===a.email);if(s&&s?.user?.userSnippylyId!==r?.userSnippylyId)i.push({id:s?.user?.userSnippylyId,name:s?.user?.name,userId:s?.user?.userId,email:s?.user?.email});else{let m="",p=this.configService.getApiKey(),h=a.userId;p&&h&&(m=ym(p,h)),m!==r?.userSnippylyId&&i.push({id:m,name:a.name||a.email||a.userId,userId:a.userId,email:a.email})}}}),this.componentConfigSignal.update(a=>(a=T(I({},a),{filters:T(I({},a.filters),{tagged:i})}),a))}else this.componentConfigSignal.update(i=>(i=T(I({},i),{filters:T(I({},i.filters),{tagged:[]})}),i));this.setPeople(),this.updatePeopleSelectedState()}e?.version&&(e?.version?.length?this.componentConfigSignal.update(i=>(i=T(I({},i),{filters:T(I({},i.filters),{versions:e.version?.map(r=>({id:r.id,name:r.name||r.id}))||[],versionIds:e.version?.map(r=>r.id)||[]})}),i)):this.componentConfigSignal.update(i=>(i=T(I({},i),{filters:T(I({},i.filters),{versions:[],versionIds:[]})}),i)),this.setVersions()),this.filterCommentAnnotations(),this.updateAnnotationCountsByFilter(),this.setFiltersToStorage()}}catch(i){this.loggingService.catch("Error in CommentsSidebarComponent mergeClientFilters: ",i)}}onCommentAnnotationClick(e){try{let i=zn(e);this.componentConfigSignal().focusedThreadMode?this.componentConfigSignal.update(r=>(r=T(I({},r),{focusedAnnotation:e}),r)):this.navigateToComment(e,!1),this.emitOnSidebarCommentClick(i)}catch(i){this.loggingService.catch("Error in CommentsSidebarComponent onCommentAnnotationClick: ",i)}}navigateToComment(e,i=!0){try{if(i){let r=zn(e);this.emitOnCommentNavigationButtonClick(r)}if(this.commentService.getSidebarUrlNavigation()&&i)if(e?.pageInfo?.url&&e.pageInfo?.url!==window.location.href){sessionStorage.setItem(j.SESSION_STORAGE.SNIPPYLY_SELECTED_ANNOTATION_ID,e.annotationId);let r=e.pageInfo.url;try{let a=window.location.origin,s=new URL(e.pageInfo.url).origin;a!==s&&(r=r.replace(s,a))}catch(a){this.loggingService.catch("Error in CommentsSidebarComponent onCommentAnnotationClick in comparing url domains: ",a)}window.location.href===r?this.goToAnnotation(e,i):window.location.href=r}else this.goToAnnotation(e,i);else this.goToAnnotation(e,i)}catch(r){this.loggingService.catch("Error in CommentsSidebarComponent navigateToComment: ",r)}}goToAnnotation(e,i=!0){try{this.componentConfigSignal().selectedAnnotationsMap[e.annotationId]||e?.targetTextRange&&sessionStorage.setItem(j.SESSION_STORAGE.SNIPPYLY_AUTO_SELECT_ANNOTATION_ID,e?.annotationId),i?this.domService.toggleAnnotationSelection(e,void 0,void 0,!0):this.domService.toggleAnnotationSelection(e,void 0,"sidebarShowReplies",!0),i&&setTimeout(()=>{let r=null;e.targetElement||e.areaAnnotationId?r=document.getElementById(`comment-pin-container-${e.annotationId}`):r=document.querySelector(`[data-velt-id='${e.annotationId}']`),r||(r=document.querySelector(`${j.TAGS.VELT_COMMENT_TEXT}[${j.ATTRIBUTES.ANNOTATION_ID}="${e.annotationId}"]`)),r&&r.scrollIntoView({behavior:"auto",block:"center",inline:"nearest"})},100)}catch(r){this.loggingService.catch("Error in CommentsSidebarComponent goToAnnotation: ",r)}}goToAnnotationInSidebar(e){try{let i=document.getElementById(`sidebar-${e.annotationId}`);i&&i.scrollIntoView({behavior:"smooth",block:"center",inline:"center"})}catch(i){this.loggingService.catch("Error in CommentsSidebarComponent goToAnnotationInSidebar: ",i)}}saveComment(e,i){this.commentService.saveComment(e,i)}getDisplayNameFromPageInfo(e){try{return this.componentConfigSignal().queryParamsComments&&e&&e?.queryParams?`${e?.path||""}${e?.queryParams||""}`:e?.path||""}catch{return""}}setPages(){try{this.componentConfigSignal.update(a=>T(I({},a),{pages:{},currentPage:void 0}));let e=new Map,i={};this.componentConfigSignal().annotations.forEach(a=>{let s=a.locationId||a.documentParamsId;if(!s){i.other||(i.other={locationIds:[],displayName:"Others",id:"other"});return}let m=a?.location?.locationName||a?.documentParams?.locationName||this.getDisplayNameFromPageInfo(a?.pageInfo)||"",p=a?.location?.id||m;e.has(s)||(i[p]||(i[p]={locationIds:[],displayName:m,id:p}),e.set(s,p),i[p].locationIds.push(s))}),this.componentConfigSignal.update(a=>{let s=this.location?.locationId,m;if(s){let p=e.get(s);p&&(m=i[p].displayName)}else i.other&&(m="Others");return T(I({},a),{pages:i,currentPage:m})}),this.updateLocationInStorage(),this.componentConfigSignal().annotations?.length&&!sessionStorage.getItem(j.SESSION_STORAGE.SNIPPYLY_COMMENT_SIDEBAR_FILTERS)&&(this.updateFilter({key:"pages",value:null},!0),this.setDefaultStatuses()),this.updatePageSelectedState()}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent setPages: ",e)}}setDocuments(){try{this.componentConfigSignal.update(a=>T(I({},a),{documents:{},currentDocument:void 0}));let e=new Map,i={};this.componentConfigSignal().annotations.forEach(a=>{let s=a?.metadata?.clientDocumentId?.toString(),m=a?.metadata?.documentId?.toString(),h=this.docService.getDocumentMetadata(m)?.documentName;if(!s){i.other||(i.other={id:"other",documentName:"Others"});return}if(e.has(s))return;let _=s;i[_]||(i[_]={id:s,documentName:h||s}),e.set(s,_)}),this.componentConfigSignal.update(a=>{let s=this.documentPaths?.clientDocumentId?.toString(),m;if(s){let p=e.get(s);p&&(m=i[p].id)}else i.other&&(m="other");return T(I({},a),{documents:i,currentDocument:m})}),this.componentConfigSignal().annotations?.length&&!sessionStorage.getItem(j.SESSION_STORAGE.SNIPPYLY_COMMENT_SIDEBAR_FILTERS)&&this.updateFilter({key:"documents",value:null},!0),this.updateDocumentSelectedState()}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent setDocuments: ",e)}}setDefaultStatuses(){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDefaultStatuses","color: green;"),this.componentConfigSignal.update(e=>(e=T(I({},e),{filters:T(I({},e.filters),{statuses:[this.customFilterService.defaultStatus,...this.customFilterService.ongoingStatuses],statusIds:[this.customFilterService.defaultStatus?.id,...this.customFilterService.ongoingStatuses.map(i=>i?.id)]})}),e))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent setDefaultStatuses: ",e)}}setResolvedStatusInFilter(){try{this.loggingService.log("%c[WB] Calling FUNCTION: setResolvedStatusInFilter","color: green;"),this.componentConfigSignal().filters.statuses?.length&&this.customFilterService.resolvedStatus&&(this.componentConfigSignal().filters.statuses.find(i=>i?.id===this.customFilterService.resolvedStatus.id)||this.componentConfigSignal.update(i=>(i=T(I({},i),{filters:T(I({},i.filters),{statuses:[...i.filters.statuses,this.customFilterService.resolvedStatus],statusIds:[...i.filters.statuses.map(r=>r?.id),this.customFilterService.resolvedStatus.id]})}),i)))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent setResolvedStatusInFilter: ",e)}}trackCommentPinAnnotations(e,i){return i?.type==="group"?i?.data?.displayName:i?.type==="annotation"?i?.data?.annotationId:e}updateCurrentLocationIdInStorage(){try{this.location?.locationId&&this.componentConfigSignal().filters?.pages?.length&&this.componentConfigSignal.update(e=>(e=I({},e),e.filters.pages.forEach(i=>{i?.displayName===e.currentPage&&(i?.locationIds?.includes(this.location?.locationId)||i.locationIds.push(this.location?.locationId))}),e))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent updateCurrentLocationIdInStorage: ",e)}}updateLocationInStorage(){try{this.componentConfigSignal.update(e=>(e=I({},e),e.filters.pages.forEach(i=>{e.pages[i.displayName]&&(i.locationIds=e.pages[i.displayName].locationIds?.slice())}),e))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent updateLocationInStorage: ",e)}}updatePageSelectedState(){try{this.componentConfigSignal.update(e=>(e=I({},e),Object.values(e.pages).forEach(i=>{let r=e.filters?.pages?.find(a=>a.id===i?.id);r?(i.selected=!0,r.displayName||(r.displayName=i.displayName)):i.selected=!1}),e))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent updatePageSelectedState: ",e)}}setVersions(){try{let e=[];this.componentConfigSignal().annotations&&this.componentConfigSignal.update(i=>(i=I({},i),i.annotations.forEach(r=>{r?.location?.version&&(e.find(a=>a.id===r?.location?.version?.id)||e.push(r?.location?.version))}),i)),this.componentConfigSignal().filters?.versions?.length&&this.componentConfigSignal.update(i=>(i=I({},i),i.filters.versions.forEach(r=>{e.find(a=>a.id===r?.id)||r?.id!=="unset"&&e.push(r)}),i)),this.componentConfigSignal.update(i=>(i=I({},i),i.versions=e?.sort((r,a)=>r?.id?.localeCompare(a?.id)),i.versions.push({id:"unset",name:"Not set"}),i)),this.componentConfigSignal().annotations?.length&&!this.componentConfigSignal().versions?.length&&this.updateFilter({key:"versions",value:null},!0)}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent setVersions: ",e)}}setPeople(){try{let e=[],i=[],r=[],a=this.componentConfigSignal().user;a?.userSnippylyId&&(e.push({id:a.userSnippylyId,name:a.name||a.email||a.userId||"",user:a}),i.push({id:a.userSnippylyId,name:a.name||a.email||a.userId||"",user:a}),r.push({id:a.userSnippylyId,name:a.name||a.email||a.userId||"",user:a})),this.componentConfigSignal().annotations&&this.componentConfigSignal.update(s=>(s=I({},s),s.annotations.forEach(m=>{m?.from?.userSnippylyId&&s.user?.userSnippylyId!==m?.from?.userSnippylyId&&!e.find(p=>p.id===m?.from?.userSnippylyId)&&e.push({id:m?.from?.userSnippylyId,name:`${m?.from?.name||m?.from?.email}`,user:m?.from}),m?.assignedTo?.userSnippylyId&&s.user?.userSnippylyId!==m?.assignedTo?.userSnippylyId&&!i.find(p=>p.id===m?.assignedTo?.userSnippylyId)&&i.push({id:m?.assignedTo?.userSnippylyId,name:`${m?.assignedTo?.name||m?.assignedTo?.email}`,user:m?.assignedTo}),m?.comments?.forEach(p=>{p?.taggedUserContacts?.forEach(h=>{h?.contact?.userSnippylyId&&s.user?.userSnippylyId!==h?.contact?.userSnippylyId&&!r.find(_=>_.id===h?.contact?.userSnippylyId)&&r.push({id:h?.contact?.userSnippylyId,name:`${h?.contact?.name||h?.contact?.email}`,user:h?.contact})})})}),s)),this.componentConfigSignal().filters?.people?.length&&this.componentConfigSignal.update(s=>(s=I({},s),s.filters.people.forEach(m=>{e.find(p=>p.id===m?.id)||m?.id!=="other"&&e.push(m)}),s.filters.assigned.forEach(m=>{i.find(p=>p.id===m?.id)||m?.id!=="other"&&i.push(m)}),s.filters.tagged.forEach(m=>{r.find(p=>p.id===m?.id)||m?.id!=="other"&&r.push(m)}),s)),this.componentConfigSignal.update(s=>(s=T(I({},s),{peopleFilters:e,assignedFilters:i,taggedFilters:r}),s)),this.componentConfigSignal().annotations?.length&&(sessionStorage.getItem(j.SESSION_STORAGE.SNIPPYLY_COMMENT_SIDEBAR_FILTERS)||(this.updateFilter({key:"people",value:null},!0),this.updateFilter({key:"assigned",value:null},!0),this.updateFilter({key:"tagged",value:null},!0))),this.updatePeopleSelectedState()}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent setPeople: ",e)}}updatePeopleSelectedState(){try{this.componentConfigSignal.update(e=>(e=I({},e),e.peopleFilters.forEach(i=>{let r=e.filters?.people?.find(a=>a.id===i?.id||a?.userId&&a?.userId===i?.user?.userId||a?.email&&a?.email===i?.user?.email);r?(i.selected=!0,r?.id||(r.id=i?.user?.userSnippylyId)):i.selected=!1}),e.assignedFilters.forEach(i=>{let r=e.filters?.assigned?.find(a=>a.id===i?.id||a?.userId&&a?.userId===i?.user?.userId||a?.email&&a?.email===i?.user?.email);r?(i.selected=!0,r?.id||(r.id=i?.user?.userSnippylyId)):i.selected=!1}),e.taggedFilters.forEach(i=>{let r=e.filters?.tagged?.find(a=>a.id===i?.id||a?.userId&&a?.userId===i?.user?.userId||a?.email&&a?.email===i?.user?.email);r?(i.selected=!0,r?.id||(r.id=i?.user?.userSnippylyId)):i.selected=!1}),e))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent updatePeopleSelectedState: ",e)}}updateFilterConfig(e){try{if(e){let i=JSON.parse(JSON.stringify(this.defaultFilterConfig));Object.keys(i).forEach(r=>{e[r]&&(i[r]=e[r])}),this.componentConfigSignal.update(r=>(r=T(I({},r),{filterConfig:i}),r))}else this.componentConfigSignal.update(i=>(i=T(I({},i),{filterConfig:JSON.parse(JSON.stringify(this.defaultFilterConfig))}),i));this.updateGroupByOptions(),this.filterCommentAnnotations()}catch(i){this.loggingService.catch("Error in CommentsSidebarComponent updateFilterConfig: ",i)}}updateGroupByOptions(){try{let e={};this.componentConfigSignal.update(r=>(r=I({},r),Object.keys(r.filterConfig).forEach(a=>{let s=r.filterConfig[a];s.enableGrouping&&(e[a]=s.name)}),r.groupByOptions=JSON.parse(JSON.stringify(e)),r));let i=!1;this.componentConfigSignal().groupBy&&Object.keys(this.componentConfigSignal().groupByOptions).forEach(r=>{this.componentConfigSignal().groupByOptions[r]===this.componentConfigSignal().groupBy&&(i=!0)}),(!this.componentConfigSignal().groupBy||!i)&&this.componentConfigSignal.update(r=>(r=T(I({},r),{groupBy:Object.values(r.groupByOptions)[0]}),r))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent updateGroupByOptions: ",e)}}updateFilter(e,i=!1){let{key:r,value:a}=e;try{if(r)switch(r){case"statuses":if(i)this.componentConfigSignal.update(p=>(p=T(I({},p),{filters:T(I({},p.filters),{statuses:[],statusIds:[]})}),p)),this.resolvedCommentsOnDom=!0;else{let p=this.componentConfigSignal().filters?.statuses||[];p.find(h=>h.id===a.id)?this.componentConfigSignal.update(h=>(h=I({},h),h.filters.statuses=p.filter(_=>_.id!==a.id),h)):this.componentConfigSignal.update(h=>(h=I({},h),h.filters.statuses=[...p,a],h)),this.componentConfigSignal.update(h=>(h=T(I({},h),{filters:T(I({},h.filters),{statusIds:h.filters.statuses.map(_=>_?.id)})}),h))}break;case"pages":let s=this.componentConfigSignal().filters.pages||[];if(i)this.componentConfigSignal.update(p=>(p=T(I({},p),{filters:T(I({},p.filters),{pages:[]})}),p));else{let p=a?.id||a?.displayName;s.find(h=>h?.id===p||h?.displayName===p)?this.componentConfigSignal.update(h=>(h=I({},h),h.filters.pages=s.filter(_=>_?.id!==p&&_?.displayName!==p),h)):this.componentConfigSignal().filterConfig?.location?.multiSelection?this.componentConfigSignal.update(h=>(h=I({},h),h.filters.pages=[...s,a],h)):this.componentConfigSignal.update(h=>(h=I({},h),h.filters.pages=[a],h))}this.sortPageFilters(),this.updatePageSelectedState();break;case"documents":let m=this.componentConfigSignal().filters.documents||[];if(i)this.componentConfigSignal.update(p=>(p=T(I({},p),{filters:T(I({},p.filters),{documents:[]})}),p));else{let p=a?.id;m.find(h=>h?.id===p)?this.componentConfigSignal.update(h=>(h=I({},h),h.filters.documents=m.filter(_=>_?.id!==p),h)):this.componentConfigSignal.update(h=>(h=I({},h),h.filterConfig?.document?.multiSelection?h.filters.documents=[...m,a]:h.filters.documents=[a],h))}this.updateDocumentSelectedState();break;case"people":this.componentConfigSignal.update(p=>{p=I({},p);let h=p.filters.people||[];return i?p.filters.people=[]:h.find(_=>_?.id===a?.id)?p.filters.people=h.filter(_=>_?.id!==a?.id):p.filterConfig?.people?.multiSelection?p.filters.people=[...h,a]:p.filters.people=[a],p}),this.updatePeopleSelectedState();break;case"tagged":this.componentConfigSignal.update(p=>{p=I({},p);let h=p.filters.tagged||[];return i?p.filters.tagged=[]:h.find(_=>_?.id===a?.id)?p.filters.tagged=h.filter(_=>_?.id!==a?.id):p.filterConfig?.tagged?.multiSelection?p.filters.tagged=[...h,a]:p.filters.tagged=[a],p}),this.updatePeopleSelectedState();break;case"assigned":this.componentConfigSignal.update(p=>{p=I({},p);let h=p.filters.assigned||[];return i?p.filters.assigned=[]:h.find(_=>_?.id===a?.id)?p.filters.assigned=h.filter(_=>_?.id!==a?.id):p.filterConfig?.assigned?.multiSelection?p.filters.assigned=[...h,a]:p.filters.assigned=[a],p}),this.updatePeopleSelectedState();break;case"categories":this.componentConfigSignal.update(p=>{p=I({},p);let h=p.filters.categories||[];return i?p.filters.categories=[]:h.find(_=>_.id===a.id)?p.filters.categories=h.filter(_=>_!==a):p.filterConfig?.category?.multiSelection?p.filters.categories=[...h,a]:p.filters.categories=[a],p.filters.categoryIds=p.filters.categories?.map(_=>_.id),p});break;case"priorities":this.componentConfigSignal.update(p=>{p=I({},p);let h=p.filters.priorities||[];return i?p.filters.priorities=[]:h.find(_=>_.id===a.id)?p.filters.priorities=h.filter(_=>_.id!==a.id):p.filterConfig?.priority?.multiSelection?p.filters.priorities=[...h,a]:p.filters.priorities=[a],p.filters.priorityIds=p.filters.priorities?.map(_=>_.id),p});break;case"accessModes":this.componentConfigSignal.update(p=>{p=I({},p);let h=p.filters.accessModes||[];return i?p.filters.accessModes=[]:h.find(_=>_===a.id)?p.filters.accessModes=h.filter(_=>_!==a.id):p.filterConfig?.commentType?.multiSelection?p.filters.accessModes=[...h,a.id]:p.filters.accessModes=[a.id],p});break;case"versions":this.componentConfigSignal.update(p=>{p=I({},p);let h=p.filters.versions||[];return i?p.filters.versions=[]:h.find(_=>_.id===a.id)?p.filters.versions=h.filter(_=>_.id!==a.id):p.filterConfig?.version?.multiSelection?p.filters.versions=[...h,a]:p.filters.versions=[a],p.filters.versionIds=p.filters.versions?.map(_=>_?.id),p});break;default:this.componentConfigSignal.update(p=>(p=T(I({},p),{filters:T(I({},p.filters),{[r]:a})}),p));break}this.filterCommentAnnotations(),this.setFiltersToStorage()}catch(s){this.loggingService.catch("Error in CommentsSidebarComponent updateFilter: ",s)}}sortPageFilters(){try{this.componentConfigSignal.update(e=>(e=I({},e),e.filters?.pages?.sort((i,r)=>i?.displayName===e.currentPage?-1:r?.displayName===e.currentPage?1:i?.displayName?.localeCompare(r?.displayName)),e))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent sortPageFilters: ",e)}}updateAnnotationCountsByFilter(){try{if(!this.componentConfigSignal().filterCount)return;this.setAnnotationsCountPerPage(),this.setAnnotationsCountPerDocument(),this.setAnnotationsCountPerStatus(),this.setAnnotationsCountPerPeople(),this.setAnnotationsCountPerVersion(),this.setAnnotationsCountPerPriority(),this.setAnnotationsCountPerCommentCategory(),this.setAnnotationsCountPerAccessMode()}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent updateAnnotationCountsByFilter: ",e)}}setAnnotationsCountPerPage(){try{this.componentConfigSignal().pages&&this.componentConfigSignal.update(e=>(e=I({},e),Object.values(e.pages).forEach(i=>{e.commentAnnotationsCountByFilters.page[i.displayName]=this.filterAnnotationsByPage(i,e.annotations)?.length}),e))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent setAnnotationsCountPerPage: ",e)}}setAnnotationsCountPerDocument(){try{this.componentConfigSignal().documents&&this.componentConfigSignal.update(e=>(e=I({},e),Object.values(e.documents).forEach(i=>{e.commentAnnotationsCountByFilters.document[i.id]=this.filterAnnotationsByDocument(i,e.annotations)?.length}),e))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent setAnnotationsCountPerDocument: ",e)}}setAnnotationsCountPerStatus(){try{let e=this.componentConfigSignal();[this.customFilterService.defaultStatus,...this.customFilterService.ongoingStatuses,this.customFilterService.resolvedStatus].forEach(i=>{e.commentAnnotationsCountByFilters.status[i.id]=this.filterAnnotationsByStatus(i,e.annotations)?.length}),this.componentConfigSignal.update(i=>(i=T(I({},i),{commentAnnotationsCountByFilters:I({},i.commentAnnotationsCountByFilters)}),i))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent setAnnotationsCountPerStatus: ",e)}}setAnnotationsCountPerPeople(){try{this.componentConfigSignal.update(e=>(e=I({},e),e.peopleFilters?.forEach(i=>{e.commentAnnotationsCountByFilters.people[i.id]=this.filterAnnotationsByPeople(i,e.annotations)?.length}),e.taggedFilters?.forEach(i=>{e.commentAnnotationsCountByFilters.tagged[i.id]=this.filterAnnotationsByTagged(i,e.annotations)?.length}),e.assignedFilters?.forEach(i=>{e.commentAnnotationsCountByFilters.assigned[i.id]=this.filterAnnotationsByAssigned(i,e.annotations)?.length}),e))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent setAnnotationsCountPerPerson: ",e)}}setAnnotationsCountPerPriority(){try{this.componentConfigSignal.update(e=>(e=I({},e),e.priorities.forEach(i=>{e.commentAnnotationsCountByFilters.priority[i.id]=this.filterAnnotationsByPriority(i,e.annotations)?.length}),e))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent setAnnotationsCountPerPriority: ",e)}}setAnnotationsCountPerCommentCategory(){try{this.componentConfigSignal.update(e=>(e=I({},e),Object.values(e.commentCategoryMap).forEach(i=>{e.commentAnnotationsCountByFilters.commentCategory[i.id]=this.filterAnnotationsByCommentCategory(i,e.annotations)?.length}),e))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent setAnnotationsCountPerCommentCategory: ",e)}}setAnnotationsCountPerAccessMode(){try{this.componentConfigSignal.update(e=>(e=I({},e),e.accessModes.forEach(i=>{e.commentAnnotationsCountByFilters.accessMode[i.id]=this.filterAnnotationsByAccessMode(i.id,e.annotations)?.length}),e))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent setAnnotationsCountPerAccessMode: ",e)}}setAnnotationsCountPerVersion(){try{this.componentConfigSignal.update(e=>(e=I({},e),e.versions.forEach(i=>{e.commentAnnotationsCountByFilters.version[i.id]=this.filterAnnotationsByVersion(i,e.annotations)?.length}),e))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent setAnnotationsCountPerVersion: ",e)}}filterCommentAnnotations(){try{let e=this.componentConfigSignal(),i=!1,r=e.annotations.slice(),a=[],s=e.systemFiltersOperator;s===hc.AND?a=e.annotations.slice():a=[],e.appliedFiltersCount=0;let m=!1,p=new Set,h=_=>{try{s===hc.AND?a=a.filter(E=>_.some(D=>D.annotationId===E.annotationId)):_.forEach(E=>{p.add(E.annotationId)}),m=!0}catch{}};if(e.enablePriority&&e.filterConfig?.priority?.enable&&e.filters.priorities?.length){let _=[];e.filters.priorities?.forEach(E=>{_=[..._,...this.filterAnnotationsByPriority(E,r)]}),h(_),e.appliedFiltersCount++}if(e.filterConfig?.location?.enable&&e.filters.pages?.length){let _=[];e.filters.pages?.forEach(E=>{_=[..._,...this.filterAnnotationsByPage(E,r)]}),h(_),e.appliedFiltersCount++}if(e.filters.documents?.length){let _=[];e.filters.documents?.forEach(E=>{_=[..._,...this.filterAnnotationsByDocument(E,r)]}),h(_),e.appliedFiltersCount++}if(e.filterConfig?.people?.enable&&e.filters.people?.length){let _=[];e.filters.people?.forEach(E=>{_=[..._,...this.filterAnnotationsByPeople(E,r)]}),h(_),e.appliedFiltersCount++}if(e.filterConfig?.tagged?.enable&&e.filters.tagged?.length){let _=[];e.filters.tagged?.forEach(E=>{_=[..._,...this.filterAnnotationsByTagged(E,r)]}),h(_),e.appliedFiltersCount++}if(e.filterConfig?.assigned?.enable&&e.filters.assigned?.length){let _=[];e.filters.assigned?.forEach(E=>{_=[..._,...this.filterAnnotationsByAssigned(E,r)]}),h(_),e.appliedFiltersCount++}if(e.enableAutoCategorize&&e.filterConfig?.category?.enable&&e.filters.categories?.length){let _=[];e.filters.categories?.forEach(E=>{_=[..._,...this.filterAnnotationsByCommentCategory(E,r)]}),h(_),e.appliedFiltersCount++}if(e.isUserAdmin&&e.filterConfig?.commentType?.enable&&e.filters.accessModes?.length){let _=[];e.filters.accessModes?.forEach(E=>{_=[..._,...this.filterAnnotationsByAccessMode(E,r)]}),h(_),e.appliedFiltersCount++}if(e.filterConfig?.version?.enable&&e.filters.versions?.length){let _=[];e.filters.versions?.forEach(E=>{_=[..._,...this.filterAnnotationsByVersion(E,r)]}),h(_),e.appliedFiltersCount++}if(e.enableStatus&&e.filters.statuses?.length){let _=[];e.filters.statuses?.forEach(E=>{E.id===this.customFilterService.resolvedStatus.id&&(i=!0),_=[..._,...this.filterAnnotationsByStatus(E,r)]}),h(_)}s!==hc.AND&&(m?a=r.filter(_=>p.has(_.annotationId)):a=r),e.filters.input&&(a=this.filterAnnotationsByInput(e.filters.input,a)),e.minimalFilter&&(!i&&e.minimalFilter==="resolved"&&(a=e.annotations.slice()),a=a.filter(_=>{switch(e.minimalFilter){case"all":return!i&&!this.resolvedCommentsOnDom?_.status?.id!==this.customFilterService.resolvedStatus.id:!0;case"read":return!this.componentConfigSignal().unreadCommentsMap?.[_.annotationId]&&_.status?.id!==this.customFilterService.resolvedStatus.id;case"unread":return!!this.componentConfigSignal().unreadCommentsMap?.[_.annotationId]&&_.status?.id!==this.customFilterService.resolvedStatus.id||!!this.componentConfigSignal().selectedAnnotationsMap[_.annotationId];case"resolved":return _.status?.id===this.customFilterService.resolvedStatus.id;default:return!0}})),this.componentConfigSignal.update(_=>(_=T(I(I({},_),e),{filteredCommentPinAnnotations:a}),_)),(this.componentConfigSignal().embedMode||this.componentConfigSignal().sidebarVisible)&&this.commentService.setCommentsFromSidebarMap(a),this.groupFilteredCommentAnnotations(),this.componentConfigSignal().sortData||this.sortComments(this.componentConfigSignal().selectedMinimalFilterDropdownOption.sorting)}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent filterCommentAnnotations: ",e)}}toggleGroupedCommentAnnotations(e){try{e.isExpanded=!e.isExpanded,this.commentService.getSidebarCustomActionsValue()?(this.componentConfigSignal.update(i=>(i=I({},i),i)),this.updateVirtualScrollDataGroupToggle(this.componentConfigSignal().virtualScrollData)):this.setSidebarGroupedAnnotationsData()}catch(i){this.loggingService.catch("Error in CommentsSidebarComponent toggleGroupedCommentAnnotations: ",i)}}changeGroupBy(e){try{this.componentConfigSignal.update(i=>(i=I({},i),e?e===i.groupBy?i.groupBy=null:i.groupBy=e:i.groupBy=null,i)),sessionStorage.setItem(j.SESSION_STORAGE.SNIPPYLY_COMMENT_SIDEBAR_GROUP_BY,this.componentConfigSignal().groupBy||""),this.groupFilteredCommentAnnotations()}catch(i){this.loggingService.catch("Error in CommentsSidebarComponent changeGroupBy: ",i)}}groupFilteredCommentAnnotations(){try{let e=this.filteredGroupedCommentAnnotationsObj,i=this.componentConfigSignal(),r=i.systemFiltersOperator===hc.AND;switch(i.groupBy){case i.groupByOptions.people:let a=i.filters.people?.length&&r?i.filters.people:i.peopleFilters;this.filteredGroupedCommentAnnotationsObj={},a.forEach(H=>{let K=this.filterAnnotationsByPeople(H,this.componentConfigSignal().filteredCommentPinAnnotations),oe=i.user?.userSnippylyId===H.id;K?.length&&(this.filteredGroupedCommentAnnotationsObj[H.id]={displayName:oe?"Me":H.name,annotations:K,isExpanded:e[H.id]?e[H.id]?.isExpanded:!0})}),this.filteredGroupedCommentAnnotations=[],i.peopleFilters.forEach(H=>{this.filteredGroupedCommentAnnotationsObj[H.id]&&this.filteredGroupedCommentAnnotations.push(this.filteredGroupedCommentAnnotationsObj[H.id])});break;case i.groupByOptions.assigned:let s=i.filters.assigned?.length&&r?i.filters.assigned:i.assignedFilters;this.filteredGroupedCommentAnnotationsObj={},s.forEach(H=>{let K=this.filterAnnotationsByAssigned(H,this.componentConfigSignal().filteredCommentPinAnnotations),oe=i.user?.userSnippylyId===H.id;K?.length&&(this.filteredGroupedCommentAnnotationsObj[H.id]={displayName:oe?"Me":H.name,annotations:K,isExpanded:e[H.id]?e[H.id]?.isExpanded:!0})}),this.filteredGroupedCommentAnnotations=[],i.assignedFilters.forEach(H=>{this.filteredGroupedCommentAnnotationsObj[H.id]&&this.filteredGroupedCommentAnnotations.push(this.filteredGroupedCommentAnnotationsObj[H.id])});break;case i.groupByOptions.tagged:let m=i.filters.tagged?.length&&r?i.filters.tagged:i.taggedFilters;this.filteredGroupedCommentAnnotationsObj={},m.forEach(H=>{let K=this.filterAnnotationsByTagged(H,this.componentConfigSignal().filteredCommentPinAnnotations),oe=i.user?.userSnippylyId===H.id;K?.length&&(this.filteredGroupedCommentAnnotationsObj[H.id]={displayName:oe?"Me":H.name,annotations:K,isExpanded:e[H.id]?e[H.id]?.isExpanded:!0})}),this.filteredGroupedCommentAnnotations=[],i.taggedFilters.forEach(H=>{this.filteredGroupedCommentAnnotationsObj[H.id]&&this.filteredGroupedCommentAnnotations.push(this.filteredGroupedCommentAnnotationsObj[H.id])});break;case i.groupByOptions.page:case i.groupByOptions.location:i=this.componentConfigSignal();let p=i.filters.pages?.length&&r?i.filters.pages:Object.values(i.pages||{});p?.sort((H,K)=>H?.displayName===i.currentPage?-1:K?.displayName===i.currentPage?1:0),this.filteredGroupedCommentAnnotationsObj={},p.forEach(H=>{let K=H?.displayName===i?.currentPage;this.locations&&Object.keys(this.locations||{}).forEach(ue=>{let be=this.locations[ue]?.location;be?.id&&be?.id===H?.id&&(K=!0)});let oe=this.filterAnnotationsByPage(H,this.componentConfigSignal().filteredCommentPinAnnotations);if((H.id||H?.displayName)&&oe?.length){let ue=H.id||H?.displayName||"";this.filteredGroupedCommentAnnotationsObj[ue]={displayName:H.displayName,annotations:oe,isExpanded:e[ue]?e[ue]?.isExpanded:!!K}}}),this.filteredGroupedCommentAnnotations=[];let h=i?.filterConfig?.location?.order||[];if(h?.length){let H=K=>{let oe=h.indexOf(K?.id);return oe===-1?1/0:oe};p.sort((K,oe)=>{let ue=H(K),be=H(oe);return ue!==be?ue-be:p.indexOf(K)-p.indexOf(oe)})}p.forEach(H=>{let K=H.id||H?.displayName||"";K&&this.filteredGroupedCommentAnnotationsObj[K]&&this.filteredGroupedCommentAnnotations.push(this.filteredGroupedCommentAnnotationsObj[K])}),this.componentConfigSignal.update(H=>(H=I(I({},H),i),H));break;case i.groupByOptions.priority:let _=i.filters.priorities?.length&&r?i.filters.priorities:i.priorities;this.filteredGroupedCommentAnnotationsObj={},_.forEach(H=>{let K=this.filterAnnotationsByPriority(H,this.componentConfigSignal().filteredCommentPinAnnotations);K?.length&&(this.filteredGroupedCommentAnnotationsObj[H.id]={displayName:H.name,annotations:K,isExpanded:e[H.id]?e[H.id]?.isExpanded:!0})}),this.filteredGroupedCommentAnnotations=[],i.priorities.forEach(H=>{this.filteredGroupedCommentAnnotationsObj[H.id]&&this.filteredGroupedCommentAnnotations.push(this.filteredGroupedCommentAnnotationsObj[H.id])}),this.componentConfigSignal.update(H=>(H=I(I({},H),i),H));break;case i.groupByOptions.category:let E=i.filters.categories?.length&&r?i.filters.categories:Object.values(i.commentCategoryMap||{});this.filteredGroupedCommentAnnotationsObj={},E.forEach(H=>{let K=this.filterAnnotationsByCommentCategory(H,this.componentConfigSignal().filteredCommentPinAnnotations);K?.length&&(this.filteredGroupedCommentAnnotationsObj[H.id]={displayName:H.name,annotations:K,isExpanded:e[H.id]?e[H.id]?.isExpanded:!0})}),this.filteredGroupedCommentAnnotations=[],E.forEach(H=>{this.filteredGroupedCommentAnnotationsObj[H.id]&&this.filteredGroupedCommentAnnotations.push(this.filteredGroupedCommentAnnotationsObj[H.id])}),this.componentConfigSignal.update(H=>(H=I(I({},H),i),H));break;case i.groupByOptions.document:i=this.componentConfigSignal();let D=i.filters.documents?.length&&r?i.filters.documents:Object.values(i.documents||{});D?.sort((H,K)=>H?.id===i.currentDocument?-1:K?.id===i.currentDocument?1:0),this.filteredGroupedCommentAnnotationsObj={},D.forEach(H=>{let K=H?.id===i?.currentDocument,oe=this.filterAnnotationsByDocument(H,this.componentConfigSignal().filteredCommentPinAnnotations);if(H.id&&oe?.length){let ue=H.id||"";this.filteredGroupedCommentAnnotationsObj[ue]={displayName:H.documentName||H.id||"",annotations:oe,isExpanded:e[ue]?e[ue]?.isExpanded:!!K}}}),this.filteredGroupedCommentAnnotations=[];let L=i?.filterConfig?.document?.order||[];if(L?.length){let H=K=>{let oe=L.indexOf(K?.id);return oe===-1?1/0:oe};D.sort((K,oe)=>{let ue=H(K),be=H(oe);return ue!==be?ue-be:D.indexOf(K)-D.indexOf(oe)})}D.forEach(H=>{let K=H.id;K&&this.filteredGroupedCommentAnnotationsObj[K]&&this.filteredGroupedCommentAnnotations.push(this.filteredGroupedCommentAnnotationsObj[K])}),this.componentConfigSignal.update(H=>(H=I(I({},H),i),H));break;default:this.filteredGroupedCommentAnnotationsObj={},this.filteredGroupedCommentAnnotationsObj={[this.pageTypes.all]:{displayName:this.pageTypes.all,annotations:this.componentConfigSignal().filteredCommentPinAnnotations,isExpanded:e[this.pageTypes.all]?e[this.pageTypes.all]?.isExpanded:!0}},this.filteredGroupedCommentAnnotations=[this.filteredGroupedCommentAnnotationsObj[this.pageTypes.all]];break}this.setSidebarGroupedAnnotationsData()}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent groupFilteredCommentAnnotations: ",e)}}setSidebarGroupedAnnotationsData(){try{if(this.commentService.getSidebarCustomActionsValue())this.commentService.getSidebarCustomActionsValue()&&this.dataAvailable&&(this.commentService.getSidebarCustomActionEventDataOnInitValue()?this.commentService.setSidebarCustomActionEventDataAllChanges(this.componentConfigSignal().customActionsState,this.componentConfigSignal().annotations,this.componentConfigSignal().unreadCommentsMap,this.componentConfigSignal().filteredCommentPinAnnotations):this.commentService.setSidebarCustomActionEventDataOnInit(this.componentConfigSignal().customActionsState,this.componentConfigSignal().annotations,this.componentConfigSignal().unreadCommentsMap,this.componentConfigSignal().filteredCommentPinAnnotations));else{let e=this.filteredGroupedCommentAnnotations.length===1&&this.filteredGroupedCommentAnnotations[0].displayName==="Others";this.componentConfigSignal.update(r=>(r=I({},r),r.virtualScrollData=[],r)),this.filteredGroupedCommentAnnotations.forEach(r=>{!e&&r.annotations?.length&&this.componentConfigSignal.update(a=>(a=I({},a),a.virtualScrollData.push({type:"group",data:r}),a)),(r.isExpanded||e)&&r.annotations.forEach(a=>{this.componentConfigSignal.update(s=>(s=I({},s),s.virtualScrollData.push({type:"annotation",data:a}),s))})}),this.componentConfigSignal.update(r=>(r=T(I({},r),{noCommentsFoundForAppliedFilters:!this.componentConfigSignal().virtualScrollData?.length}),r)),this.cd.markForCheck();let i=this.virtualScrollViewportRef?.elementRef?.nativeElement;i&&(i.scrollTop=0)}}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent setSidebarGroupedAnnotationsData: ",e)}}filterAnnotationsByPage(e,i){try{return i?.filter(r=>e?.locationIds?.length?r?.locationId?r?.location?.id===e?.id||e?.locationIds?.includes(r?.locationId):r?.documentParams?.id===e?.id||e?.locationIds?.includes(r?.documentParamsId):!r?.locationId&&!r?.documentParamsId)}catch(r){return this.loggingService.catch("Error in CommentsSidebarComponent filterAnnotationsByPage: ",r),[]}}filterAnnotationsByStatus(e,i){try{return i.filter(r=>r?.status?.id===e.id)}catch(r){return this.loggingService.catch("Error in CommentsSidebarComponent filterAnnotationsByStatus: ",r),[]}}filterAnnotationsByPeople(e,i){try{return e.id?i.filter(r=>r?.from?.userSnippylyId===e?.id||r?.from?.userId===e?.id||r?.from?.email===e?.id):i}catch(r){return this.loggingService.catch("Error in CommentsSidebarComponent filterAnnotationsByPeople: ",r),[]}}filterAnnotationsByTagged(e,i){try{return e.id===this.componentConfigSignal().user?.userSnippylyId?i.filter(r=>{let a=!1;return r.comments.forEach(s=>{s.taggedUserContacts?.forEach(m=>{m?.contact?.userSnippylyId===this.componentConfigSignal().user?.userSnippylyId&&(a=!0)})}),a}):i.filter(r=>r?.comments?.some(a=>a?.taggedUserContacts?.some(s=>s?.contact?.userSnippylyId===e?.id)))}catch(r){return this.loggingService.catch("Error in CommentsSidebarComponent filterAnnotationsByTagged: ",r),[]}}filterAnnotationsByAssigned(e,i){try{return e.id===this.componentConfigSignal().user?.userSnippylyId?i.filter(r=>r?.assignedTo?.userId===this.componentConfigSignal().user?.userId):i.filter(r=>r?.assignedTo?.userSnippylyId===e?.id)}catch(r){return this.loggingService.catch("Error in CommentsSidebarComponent filterAnnotationsByAssigned: ",r),[]}}filterAnnotationsByPriority(e,i){try{return e.id==="unset"?i.filter(r=>!r?.priority):i.filter(r=>r?.priority?.id===e.id)}catch(r){return this.loggingService.catch("Error in CommentsSidebarComponent filterAnnotationsByPriority: ",r),[]}}filterAnnotationsByCommentCategory(e,i){try{switch(e?.id){case"other":return i?.filter(r=>!r?.commentCategories?.length||r?.commentCategories?.find(a=>a?.id===e?.id))}return i?.filter(r=>(r?.commentCategories||[])?.find(a=>a?.id===e?.id))}catch(r){return this.loggingService.catch("Error in CommentsSidebarComponent filterAnnotationsByCommentCategory: ",r),[]}}filterAnnotationsByAccessMode(e,i){try{return e===Qi.PRIVATE?i.filter(r=>r?.iam?.accessMode===Qi.PRIVATE):i.filter(r=>!r?.iam?.accessMode||r?.iam?.accessMode===Qi.PUBLIC)}catch(r){return this.loggingService.catch("Error in CommentsSidebarComponent filterAnnotationsByAccessMode: ",r),[]}}filterAnnotationsByVersion(e,i){try{return e.id==="unset"?i.filter(r=>!r?.location?.version):i.filter(r=>r?.location?.version?.id===e.id)}catch(r){return this.loggingService.catch("Error in CommentsSidebarComponent filterAnnotationsByVersion: ",r),[]}}filterAnnotationsByInput(e,i){try{return i.filter(r=>{let a=!1;for(let s=0;s<r?.comments?.length;s++){let m=r?.comments[s];if(m?.commentText?.toLowerCase().includes(e.toLowerCase())){a=!0;break}else if(m?.from?.name?.toLowerCase().includes(e.toLowerCase())){a=!0;break}}return a})}catch(r){return this.loggingService.catch("Error in CommentsSidebarComponent filterAnnotationsByInput: ",r),[]}}closeSidebar(){try{this.commentService.setSidebarVisibility(!1,!1,!0),this.onSidebarClose.emit()}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent closeSidebar: ",e)}}emitOnSidebarCommentClick(e){try{let i=this.documentPaths?.clientDocumentId,r=e?.location;r||(r=e?.documentParams);let a={};e.context&&(a=e.context),this.onSidebarCommentClick.emit({documentId:i,location:r,targetElementId:e?.targetElementId,context:a,annotation:e}),this.onSidebarCommentClickEvent.emit({documentId:i,location:r,targetElementId:e?.targetElementId,context:a,annotation:e}),this.onCommentClick.emit({documentId:i,location:r,targetElementId:e?.targetElementId,context:a,annotation:e}),this.commentService.onSidebarCommentClick({documentId:i,location:r,targetElementId:e?.targetElementId,context:a,annotation:e})}catch(i){this.loggingService.catch("Error in CommentsSidebarComponent onSidebarCommentClick: ",i)}}emitOnCommentNavigationButtonClick(e){try{let i=this.documentPaths?.clientDocumentId,r=e?.location;r||(r=e?.documentParams);let a={};e.context&&(a=e.context),this.onCommentNavigationButtonClick.emit({documentId:i,location:r,targetElementId:e?.targetElementId,context:a,annotation:e})}catch(i){this.loggingService.catch("Error in CommentsSidebarComponent emitOnCommentNavigationButtonClick: ",i)}}setFiltersToStorage(){try{let e=JSON.parse(JSON.stringify(this.componentConfigSignal().filters));delete e?.input;let i=JSON.stringify(e);sessionStorage.setItem(j.SESSION_STORAGE.SNIPPYLY_COMMENT_SIDEBAR_FILTERS,i)}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent setFiltersToStorage: ",e)}}setCommentSidebarInstalledInAnalytics(){try{this.analyticsService.setInstalledFeature(Bu.COMMENT_SIDEBAR)}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent setCommentSidebarInstalledInAnalytics: ",e)}}setCommentSidebarEmbedModeInAnalytics(){try{this.componentConfigSignal().embedMode&&this.analyticsService.trackEvent(X.Events.Comments.COMMENT_SIDEBAR_EMBED_MODE_ENABLED,{commentMode:this.commentService.getCommentMode()})}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent setCommentSidebarEmbedModeInAnalytics: ",e)}}setCommentSidebarFloatingModeInAnalytics(){try{this.componentConfigSignal().floatingMode&&this.analyticsService.trackEvent(X.Events.Comments.COMMENT_SIDEBAR_FLOATING_MODE_ENABLED,{commentMode:this.commentService.getCommentMode()})}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent setCommentSidebarFloatingModeInAnalytics: ",e)}}setCommentReadInAnalytics(){try{this.loggingService.log("%c[WB] Calling FUNCTION: setCommentReadInAnalytics","color: green;"),this.commentReadAnalyticsCalled||(this.commentReadAnalyticsCalled=!0,this.analyticsService.trackEvent(X.Events.Comments.COMMENT_READ,{uiLocation:"sidebar",commentMode:this.commentService.getCommentMode(),readType:"hover"}))}catch(e){this.loggingService.catch("Error in CommentDialogComponent setCommentReadInAnalytics: ",e)}}toggleMoreFilters(e){this.componentConfigSignal.update(i=>(i=T(I({},i),{moreFiltersVisible:!i.moreFiltersVisible}),i)),e&&e?.scrollTo({top:0})}savePageComment(e){try{let i=e?.updatedComment;i&&this.commentService.addComment(void 0,void 0,void 0,void 0,!0,[i],void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,e?.annotation?.assignedTo),this.componentConfigSignal.update(r=>(r=I({},r),r.pageCommentAnnotation=new Ro,r.pageCommentAnnotation.isPageAnnotation=!0,r))}catch(i){this.loggingService.catch("Error in CommentsSidebarComponent savePageComment: ",i)}}sortComments(e){try{this.componentConfigSignal.update(i=>{let r=[...i.virtualScrollData];return r.sort((a,s)=>{if(a.type==="annotation"&&s.type==="annotation"){if(e==="date"){let m=new Date(a.data.lastUpdated).getTime();return new Date(s.data.lastUpdated).getTime()-m}else if(e==="unread"){let m=i.unreadCommentsMap?.[a.data.annotationId]||0,p=i.unreadCommentsMap?.[s.data.annotationId]||0;if(m>0&&p===0)return-1;if(m===0&&p>0)return 1;let h=new Date(a.data.lastUpdated).getTime();return new Date(s.data.lastUpdated).getTime()-h}}return 0}),i=T(I({},i),{virtualScrollData:r}),i}),this.componentConfigSignal.update(i=>(i=T(I({},i),{selectedMinimalFilterDropdownOption:T(I({},i.selectedMinimalFilterDropdownOption),{sorting:e})}),i))}catch(i){this.loggingService.catch("Error in CommentsSidebarComponent sortComments: ",i)}}toggleMinimalFilterDropdown(){try{this.componentConfigSignal.update(e=>(e=T(I({},e),{minimalFilterDropdownOpen:!e.minimalFilterDropdownOpen}),e))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent toggleMinimalFilterDropdown: ",e)}}filterCommentsByReadStatus(e){try{this.componentConfigSignal.update(i=>(i=T(I({},i),{minimalFilter:e,selectedMinimalFilterDropdownOption:T(I({},i.selectedMinimalFilterDropdownOption),{filter:e})}),i)),this.filterCommentAnnotations()}catch(i){this.loggingService.catch("Error in CommentsSidebarComponent filterCommentsByReadStatus: ",i)}}resetFilters(){try{this.componentConfigSignal.update(e=>(e=T(I({},e),{minimalFilter:"all",customActionsState:{all:!0},filters:{statuses:[],statusIds:[],pages:[],documents:[],people:[],assigned:[],tagged:[],versions:[],categories:[],priorities:[],accessModes:[],input:"",versionIds:[],priorityIds:[],categoryIds:[]},selectedMinimalFilterDropdownOption:T(I({},e.selectedMinimalFilterDropdownOption),{filter:"all"})}),e)),this.resolvedCommentsOnDom=!1,this.filterCommentsByReadStatus("all"),this.updateFilter({key:"pages",value:null},!0),this.updateFilter({key:"documents",value:null},!0),this.updateFilter({key:"people",value:null},!0),this.updateFilter({key:"assigned",value:null},!0),this.updateFilter({key:"tagged",value:null},!0),this.updateFilter({key:"statuses",value:null},!0),this.updateFilter({key:"priorities",value:null},!0),this.updateFilter({key:"categories",value:null},!0),this.updateFilter({key:"versions",value:null},!0),sessionStorage.removeItem(j.SESSION_STORAGE.VELT_COMMENT_SIDEBAR_CUSTOM_ACTIONS_STATE)}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent resetFilters: ",e)}}toggleLocationFilterDropdown(){try{this.componentConfigSignal.update(e=>(e=T(I({},e),{locationFilterDropdownOpen:!e.locationFilterDropdownOpen}),e))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent toggleLocationFilterDropdown: ",e)}}toggleDocumentFilterDropdown(){try{this.componentConfigSignal.update(e=>(e=T(I({},e),{documentFilterDropdownOpen:!e.documentFilterDropdownOpen}),e))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent toggleDocumentFilterDropdown: ",e)}}closeDocumentFilterDropdown(){try{this.componentConfigSignal.update(e=>(e=T(I({},e),{documentFilterDropdownOpen:!1}),e))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent closeDocumentFilterDropdown: ",e)}}toggleMinimalActionsDropdown(){try{this.componentConfigSignal.update(e=>(e=T(I({},e),{minimalActionsDropdownOpen:!e.minimalActionsDropdownOpen}),e))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent toggleMinimalActionsDropdown: ",e)}}markAllCommentAnnotationsAsRead(){try{this.commentService.setCommentAnnotationsAsRead(this.componentConfigSignal().filteredCommentPinAnnotations)}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent setCommentAnnotationsAsRead: ",e)}}markAllCommentAnnotationsAsResolved(){try{this.commentService.setCommentAnnotationsAsResolved(this.componentConfigSignal().filteredCommentPinAnnotations)}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent markAllCommentAnnotationsAsResolved: ",e)}}toggleCustomAction(e,i){try{i==="toggle"?(this.componentConfigSignal.update(r=>(r=T(I({},r),{customActionsState:{[e]:!r.customActionsState[e]}}),r)),sessionStorage.setItem(j.SESSION_STORAGE.VELT_COMMENT_SIDEBAR_CUSTOM_ACTIONS_STATE,JSON.stringify(this.componentConfigSignal().customActionsState)),this.commentService.setSidebarCustomActionEventData(this.componentConfigSignal().customActionsState,this.componentConfigSignal().annotations,this.componentConfigSignal().unreadCommentsMap,this.componentConfigSignal().filteredCommentPinAnnotations)):(this.commentService.setSidebarCustomActionEventData({[e]:!0},this.componentConfigSignal().annotations,this.componentConfigSignal().unreadCommentsMap,this.componentConfigSignal().filteredCommentPinAnnotations),sessionStorage.setItem(j.SESSION_STORAGE.VELT_COMMENT_SIDEBAR_CUSTOM_ACTIONS_STATE,JSON.stringify({[e]:!0})))}catch(r){this.loggingService.catch("Error in CommentsSidebarComponent toggleCustomAction: ",r)}}goBackToAllComments(){try{this.componentConfigSignal.update(e=>(e=T(I({},e),{focusedAnnotation:null}),e))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent goBackToAllComments: ",e)}}filterSearch(e,i){try{let r=this.componentConfigSignal();if(!r?.peopleFilters)return;let a,s;switch(i){case"people":a=r.peopleFilters,!e||e===""?s=a:s=a.filter(m=>m?.name?.toLowerCase().includes(e.toLowerCase()));break;case"assigned":a=r.assignedFilters,!e||e===""?s=a:s=a.filter(m=>m?.name?.toLowerCase().includes(e.toLowerCase()));break;case"tagged":a=r.taggedFilters,!e||e===""?s=a:s=a.filter(m=>m?.name?.toLowerCase().includes(e.toLowerCase()));break;case"pages":a=r.pages,!e||e===""?s=r.pages:(s={},Object.keys(a).filter(p=>p.toLowerCase().includes(e.toLowerCase())).forEach(p=>{s[p]=a[p]}));break;case"documents":a=r.documents,!e||e===""?s=r.documents:(s={},Object.keys(a).filter(p=>a[p]?.documentName?.toLowerCase().includes(e.toLowerCase())).forEach(p=>{s[p]=a[p]}));break;case"statuses":a=r.statuses,!e||e===""?s=a:s=a.filter(m=>m.name.toLowerCase().includes(e.toLowerCase()));break;case"priorities":a=r.priorities,!e||e===""?s=a:s=a.filter(m=>m.name.toLowerCase().includes(e.toLowerCase()));break;case"categories":a=r.commentCategoryMap,!e||e===""?s=r.commentCategoryMap:(s={},Object.keys(a).filter(p=>p.toLowerCase().includes(e.toLowerCase())).forEach(p=>{s[p]=a[p]}));break;case"versions":a=r.versions,!e||e===""?s=r.versions:s=a.filter(m=>m.name.toLowerCase().includes(e.toLowerCase()));break}return s}catch(r){return this.loggingService.catch("Error in CommentsSidebarComponent filterPeople: ",r),[]}}updateDocumentSelectedState(){try{this.componentConfigSignal.update(e=>(e=I({},e),Object.values(e.documents).forEach(i=>{let r=e.filters?.documents?.find(a=>a.id===i?.id);r?(i.selected=!0,r.documentName||(r.documentName=i.documentName)):i.selected=!1}),e))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent updateDocumentSelectedState: ",e)}}filterAnnotationsByDocument(e,i){try{return i?.filter(r=>e?.id&&e.id!=="other"?r?.metadata?.clientDocumentId?.toString()===e.id:!r?.metadata?.clientDocumentId)}catch(r){return this.loggingService.catch("Error in CommentsSidebarComponent filterAnnotationsByDocument: ",r),[]}}};o.\u0275fac=function(i){return new(i||o)(u(Ze),u(He),u(we),u(jt),u(Ne),u(lt),u(k),u(fn),u(y),u(po),u(zo),u(tl),u(Kt),u(ze),u(Wi),u(r_),u(Ye))},o.\u0275cmp=O({type:o,selectors:[["app-comments-sidebar"]],viewQuery:function(i,r){if(i&1&&(ot(aHt,5),ot(sHt,5),ot(lHt,7)),i&2){let a;Qe(a=Je())&&(r.sidebarOverlay=a.first),Qe(a=Je())&&(r.virtualScrollViewportRef=a.first),Qe(a=Je())&&(r.hostElement=a.first)}},hostVars:2,hostBindings:function(i,r){i&2&&x("data-velt-id",r.veltId)("data-velt-element",r.veltElement)},inputs:{embedMode:"embedMode",floatingMode:"floatingMode",_pageMode:[0,"pageMode","_pageMode"],_filterCount:[0,"filterCount","_filterCount"],_customActions:[0,"customActions","_customActions"],focusedThreadMode:"focusedThreadMode",_sortData:[0,"sortData","_sortData"],enableUrlNavigation:"enableUrlNavigation",urlNavigation:"urlNavigation",_queryParamsComments:[0,"queryParamsComments","_queryParamsComments"],_currentLocationSuffix:[0,"currentLocationSuffix","_currentLocationSuffix"],_filterOptionLayout:[0,"filterOptionLayout","_filterOptionLayout"],_filterConfig:[0,"filterConfig","_filterConfig"],_groupConfig:[0,"groupConfig","_groupConfig"],_filters:[0,"filters","_filters"],_systemFiltersOperator:[0,"systemFiltersOperator","_systemFiltersOperator"],_excludeLocationIds:[0,"excludeLocationIds","_excludeLocationIds"],_fullExpanded:[0,"fullExpanded","_fullExpanded"],dialogVariant:"dialogVariant",focusedThreadDialogVariant:"focusedThreadDialogVariant",filterPanelLayout:"filterPanelLayout",pageModeComposerVariant:"pageModeComposerVariant",searchPlaceholder:"searchPlaceholder",_sidebarShadowDOM:[0,"shadowDom","_sidebarShadowDOM"],variant:"variant",position:"position"},outputs:{openSidebar:"openSidebar",onSidebarOpen:"onSidebarOpen",onSidebarCommentClick:"sidebarCommentClick",onSidebarCommentClickEvent:"onSidebarCommentClick",onCommentClick:"onCommentClick",onSidebarClose:"onSidebarClose",onCommentNavigationButtonClick:"onCommentNavigationButtonClick"},standalone:!1,features:[B,Xe],decls:1,vars:1,consts:[["sidebarRef",""],["defaultSidebarMode",""],["sidebarTrigger","cdkOverlayOrigin"],["sidebarOverlay","cdkConnectedOverlay"],[4,"ngIf"],[3,"ngIf"],[4,"ngIf","ngIfElse"],[4,"ngTemplateOutlet"],["cdkOverlayOrigin",""],["cdkConnectedOverlay","",3,"cdkConnectedOverlayOrigin","cdkConnectedOverlayOpen","cdkConnectedOverlayDisableClose","cdkConnectedOverlayPanelClass"],["class","velt-comments-sidebar-container",3,"dark",4,"ngIf"],[1,"velt-comments-sidebar-container"],["role","dialog",3,"onWrapperClick","componentConfigSignal","template","darkMode"]],template:function(i,r){i&1&&g(0,yHt,4,1,"ng-container",4),i&2&&c("ngIf",r.componentConfigSignal())},dependencies:[Z,vt,Vn,An,tn,Rfe,de],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}[_nghost-%COMP%]{width:100%} .snippyly-sidebar-panel .viewport .cdk-virtual-scroll-content-wrapper{max-width:100%}.s-overflow-hidden[_ngcontent-%COMP%]{overflow:hidden}"],changeDetection:0});let n=o;return n})();var SHt=["*"];function bHt(n,o){if(n&1&&w(0,"snippyly-user-avatar",12),n&2){let t=l(3);c("user",t.cursorUser)}}function IHt(n,o){if(n&1&&w(0,"video",13),n&2){let t=l(3);ge("flip",t.selfCursorPointer),c("srcObject",t.stream)("volume",t.selfCursorPointer?0:1)}}function EHt(n,o){if(n&1&&w(0,"audio",13),n&2){let t=l(3);c("srcObject",t.stream)("volume",t.selfCursorPointer?0:1)}}function xHt(n,o){if(n&1&&(C(0,"div",6)(1,"div",7)(2,"div",8),g(3,bHt,1,1,"snippyly-user-avatar",9)(4,IHt,1,4,"video",10)(5,EHt,1,2,"audio",11),S()()()),n&2){let t=l(2);d(),rt("background",t.cursorUser==null?null:t.cursorUser.color)("border",t.gainVolume&&t.lightenedColor?t.getGainAnimationBorderStyle():""),d(2),c("ngIf",!(t.huddleState!=null&&t.huddleState.videoState)),d(),c("ngIf",t.huddleState==null?null:t.huddleState.videoState),d(),c("ngIf",(t.huddleState==null?null:t.huddleState.audioState)&&!(t.huddleState!=null&&t.huddleState.videoState))}}function THt(n,o){if(n&1){let t=q();C(0,"div",14)(1,"img",15),G("error",function(){N(t);let i=l(3);return F(i.onImageLoadError())}),S()()}if(n&2){let t=l(3);rt("background-color",t.cursorUser.color),ge("user-presence-text-container-comment-border",t.cursorUser.comment),d(),c("src",t.cursorUser==null?null:t.cursorUser.photoUrl,dn)}}function DHt(n,o){if(n&1&&(C(0,"p",20),te(1),A(2,"translate"),S()),n&2){let t,e=l(5);rt("color",e.getTextColor(e.cursorUser==null?null:e.cursorUser.color)),d(),ve(" ",P(2,3,e.cursorUser.name||(!(e.cursorUser==null||e.cursorUser.email==null||(t=e.cursorUser.email.split("@"))==null)&&t.length?e.cursorUser==null||e.cursorUser.email==null?null:e.cursorUser.email.split("@")[0]:e.cursorUser==null?null:e.cursorUser.email)),"")}}function wHt(n,o){if(n&1&&(C(0,"p",21),te(1),A(2,"translate"),S()),n&2){let t=l(5);d(),je(P(2,1,t.cursorUser.comment))}}function OHt(n,o){if(n&1&&(C(0,"div",17),g(1,DHt,3,5,"p",18)(2,wHt,3,3,"p",19),S()),n&2){let t=l(4);rt("background-color",t.cursorUser.color),ge("user-presence-text-container-comment-border",t.cursorUser.comment)("px-3",t.cursorUser.comment)("py-2",t.cursorUser.comment),d(),c("ngIf",t.cursorUser.name||(t.cursorUser==null?null:t.cursorUser.email)),d(),c("ngIf",t.cursorUser.comment)}}function AHt(n,o){n&1&&(C(0,"div",22),w(1,"velt-skeleton-loader-internal",23),S())}function PHt(n,o){if(n&1&&g(0,OHt,3,10,"div",16)(1,AHt,2,0,"ng-template",null,2,De),n&2){let t=pe(2),e=l(3);c("ngIf",e.cursorUser.name||(e.cursorUser==null?null:e.cursorUser.email)||e.cursorUser.comment)("ngIfElse",t)}}function MHt(n,o){if(n&1&&g(0,THt,2,5,"ng-template",5)(1,PHt,3,2,"ng-template",null,1,De),n&2){let t=pe(2),e=l(2);c("ngIf",e.avatarMode&&!e.showInitial)("ngIfElse",t)}}function kHt(n,o){if(n&1&&(C(0,"div",4),Rt(1),g(2,xHt,6,7,"ng-template",5)(3,MHt,3,2,"ng-template",null,0,De),S()),n&2){let t=pe(4),e=l();rt("top",e.cursorUser==null||e.cursorUser.position==null?null:e.cursorUser.position.top,"px")("left",e.cursorUser==null||e.cursorUser.position==null?null:e.cursorUser.position.left,"px"),ge("no-transition",e.selfCursorPointer),d(2),c("ngIf",e.stream&&((e.huddleState==null?null:e.huddleState.audioState)||(e.huddleState==null?null:e.huddleState.videoState)))("ngIfElse",t)}}var Nfe=(()=>{let o=class o{get cursorUser(){return this._cursorUser}set cursorUser(e){this._cursorUser=e,e?.color&&(this.lightenedColor=lre(e?.color,80))}get stream(){return this._stream}set stream(e){this._stream=e,e&&this.startGainAnimation(e),this.huddleService.updateHuddleCursorAvailableByAttendeeId(this.cursorUser.userSnippylyId,!!this.stream)}constructor(e,i){this.huddleService=e,this.loggingService=i,this.selfCursorPointer=!1,this.avatarMode=!1,this.showInitial=!1,this.veltElement=!0}ngOnInit(){}ngAfterViewInit(){}startGainAnimation(e){try{let i=new AudioContext,r=i.createMediaStreamSource(e),a=i.createAnalyser();r.connect(a);let s=new Uint8Array(a.frequencyBinCount),m=()=>{a.getByteFrequencyData(s);let p=s.reduce((h,_)=>h+_,0)/s.length;this.gainVolume=p,this.gainAnimationId=requestAnimationFrame(m)};this.gainAnimationId=requestAnimationFrame(m)}catch(i){this.loggingService.catch("Error in CursorPointerComponent startGainAnimation: ",i)}}stopGainAnimation(){try{this.gainAnimationId!==void 0&&cancelAnimationFrame(this.gainAnimationId),this.gainVolume=void 0}catch(e){this.loggingService.catch("Error in CursorPointerComponent stopGainAnimation: ",e)}}getOutlineSizeByGainAmount(){try{if(this.gainVolume!==void 0)return sre(0,5,Math.min(1,this.gainVolume/15))}catch(e){this.loggingService.catch("Error in CursorPointerComponent getOutlineSizeByGainAmount: ",e)}return 0}getGainAnimationBorderStyle(){return this.getOutlineSizeByGainAmount()+"px solid "+(this.lightenedColor||"white")+" !important"}onImageLoadError(){this.loggingService.log("%c[WB] Calling FUNCTION: onImageLoadError","color: green;");try{this.showInitial=!0}catch(e){this.loggingService.catch("Error in CursorPointerComponent onImageLoadError: ",e)}}getTextColor(e){return e?cre(e):"#141416"}ngOnDestroy(){try{this.stopGainAnimation(),this.stream=void 0}catch(e){this.loggingService.catch("Error in CursorPointerComponent ngOnDestroy: ",e)}}};o.\u0275fac=function(i){return new(i||o)(u(pr),u(y))},o.\u0275cmp=O({type:o,selectors:[["snippyly-cursor-pointer"]],hostVars:1,hostBindings:function(i,r){i&2&&x("data-velt-element",r.veltElement)},inputs:{cursorUser:"cursorUser",selfCursorPointer:"selfCursorPointer",avatarMode:"avatarMode",huddleState:"huddleState",stream:"stream"},standalone:!1,ngContentSelectors:SHt,decls:1,vars:1,consts:[["cursorRef",""],["defaultModeRef",""],["loadingTemplateRef",""],["part","container","class","user-presence-pointer",3,"no-transition","top","left",4,"ngIf"],["part","container",1,"user-presence-pointer"],[3,"ngIf","ngIfElse"],[1,"s-cursor-video-spacing"],["part","huddle-avatar-container",1,"s-cursor-video-container"],[1,"s-cursor-video-block"],[3,"user",4,"ngIf"],["playsinline","","autoplay","true",3,"srcObject","flip","volume",4,"ngIf"],["playsinline","","autoplay","true",3,"srcObject","volume",4,"ngIf"],[3,"user"],["playsinline","","autoplay","true",3,"srcObject","volume"],["part","avatar-container",1,"user-avatar-container"],[3,"error","src"],["part","label-container","class","user-presence-text-container",3,"backgroundColor","user-presence-text-container-comment-border","px-3","py-2",4,"ngIf","ngIfElse"],["part","label-container",1,"user-presence-text-container"],["part","label","class","user-presence-name small mb-0",3,"color",4,"ngIf"],["class","user-presence-comment mb-0",4,"ngIf"],["part","label",1,"user-presence-name","small","mb-0"],[1,"user-presence-comment","mb-0"],[1,"user-presence-text-container-loading"],["height","24px","width","80px","borderRadius","24px"]],template:function(i,r){i&1&&(Vt(),g(0,kHt,5,8,"div",3)),i&2&&c("ngIf",r.cursorUser==null?null:r.cursorUser.position)},dependencies:[Z,Hn,Io,de],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}*[_ngcontent-%COMP%]{box-sizing:border-box;margin:0;padding:0;-webkit-tap-highlight-color:rgba(255,255,255,0);outline:none;height:unset;width:unset;text-align:left;line-height:1.5;color:#000}*[_ngcontent-%COMP%]:empty{display:revert}.user-presence-pointer[_ngcontent-%COMP%]{position:fixed;z-index:var(--velt-cursor-z-index);-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-o-user-select:none;user-select:none;filter:brightness(110%) saturate(110%);transition:top linear 75ms,left linear 75ms}.user-presence-pointer.no-transition[_ngcontent-%COMP%]{transition:none}.user-presence-text-container[_ngcontent-%COMP%]{transform:translate(calc((1.2rem + 0px) * var(--velt-base-rem-unit))) translateY(calc((-.7rem + 0px) * var(--velt-base-rem-unit)));padding:calc((.4rem + 0px) * var(--velt-base-rem-unit));box-shadow:0 1px 4px #10101036;border-radius:12px;filter:brightness(110%) saturate(110%)}.user-presence-text-container-loading[_ngcontent-%COMP%]{transform:translate(calc((1.2rem + 0px) * var(--velt-base-rem-unit))) translateY(calc((-.7rem + 0px) * var(--velt-base-rem-unit)))}.user-presence-text-container-comment-border[_ngcontent-%COMP%]{border-bottom-left-radius:calc((1.3rem + 0px) * var(--velt-base-rem-unit));border-bottom-right-radius:calc((1.3rem + 0px) * var(--velt-base-rem-unit));border-top-right-radius:calc((1.3rem + 0px) * var(--velt-base-rem-unit));margin-top:calc((-.5rem + 0px) * var(--velt-base-rem-unit))}.user-presence-name[_ngcontent-%COMP%]{margin:0;font-size:calc((.7rem + 0px) * var(--velt-base-rem-unit));color:#fff}.user-avatar-container[_ngcontent-%COMP%]{width:calc((var(--legacy-velt-cursor-avatar-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-cursor-avatar-size) + 0px) * var(--velt-base-rem-unit));box-shadow:0 1px 4px #10101036;transform:translate(calc((1.2rem + 0px) * var(--velt-base-rem-unit))) translateY(calc((-.7rem + 0px) * var(--velt-base-rem-unit)));padding:calc((.08rem + 0px) * var(--velt-base-rem-unit));border-radius:100%}.user-avatar-container[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;border-radius:100%}.s-cursor-video-spacing[_ngcontent-%COMP%]{width:calc((var(--legacy-velt-cursor-video-size) + 16px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-cursor-video-size) + 16px) * var(--velt-base-rem-unit));display:flex;justify-content:center;align-items:center;position:absolute;top:calc((.4rem + 0px) * var(--velt-base-rem-unit));left:calc((.4rem + 0px) * var(--velt-base-rem-unit));background:transparent}.s-cursor-video-container[_ngcontent-%COMP%]{width:calc((var(--legacy-velt-cursor-video-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-cursor-video-size) + 0px) * var(--velt-base-rem-unit));box-sizing:content-box;padding:calc((.15rem + 0px) * var(--velt-base-rem-unit));border-radius:calc((10rem + 0px) * var(--velt-base-rem-unit));box-shadow:0 1px 4px #10101036}.s-cursor-video-container[_ngcontent-%COMP%] .s-cursor-video-block[_ngcontent-%COMP%]{position:relative;width:100%;height:100%}.s-cursor-video-container[_ngcontent-%COMP%] snippyly-user-avatar[_ngcontent-%COMP%]{position:absolute;--legacy-velt-avatar-size: var(--legacy-velt-cursor-video-size);--legacy-velt-avatar-user-initial-font-size: 1.5rem}.s-cursor-video-container[_ngcontent-%COMP%] snippyly-user-avatar[_ngcontent-%COMP%] .s-user-avatar-container[_ngcontent-%COMP%]{width:calc((var(--legacy-velt-cursor-video-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-cursor-video-size) + 0px) * var(--velt-base-rem-unit));border-radius:0;max-width:100%;max-height:100%}.s-cursor-video-container[_ngcontent-%COMP%] snippyly-user-avatar[_ngcontent-%COMP%] .s-user-avatar-container[_ngcontent-%COMP%] .s-user-avatar-initial[_ngcontent-%COMP%]:after{font-size:calc((2rem + 0px) * var(--velt-base-rem-unit))}.s-cursor-video-container[_ngcontent-%COMP%] video[_ngcontent-%COMP%]{width:100%;height:100%;border-radius:calc((10rem + 0px) * var(--velt-base-rem-unit));object-fit:cover}"],changeDetection:0});let n=o;return n})();function NHt(n,o){if(n&1&&(C(0,"snippyly-cursor-pointer",5)(1,"slot",6),le(),C(2,"svg",7)(3,"g",8),w(4,"path",9)(5,"path",10),S(),C(6,"defs")(7,"filter",11),w(8,"feFlood",12)(9,"feColorMatrix",13)(10,"feOffset",14)(11,"feGaussianBlur",15)(12,"feColorMatrix",16)(13,"feBlend",17)(14,"feBlend",18),S()()()()()),n&2){let t=l().$implicit,e=l(2).ngIf,i=l();c("cursorUser",t)("avatarMode",i.avatarMode)("huddleState",e.huddleOnCursorModeByAttendeeId[t==null?null:t.userSnippylyId]?e.attendeesByUserId[t==null?null:t.userSnippylyId]==null?null:e.attendeesByUserId[t==null?null:t.userSnippylyId].state:void 0)("stream",e.huddleOnCursorModeByAttendeeId[t==null?null:t.userSnippylyId]?e.remoteStreamsByUserId[t==null?null:t.userSnippylyId]==null?null:e.remoteStreamsByUserId[t==null?null:t.userSnippylyId].webcam:void 0),d(4),x("fill",t.color),d(),x("fill",t.color)}}function FHt(n,o){if(n&1&&(f(0),g(1,NHt,15,6,"snippyly-cursor-pointer",4),v()),n&2){let t=o.$implicit;d(),c("ngIf",t==null?null:t.position)}}function LHt(n,o){if(n&1&&(C(0,"snippyly-cursor-pointer",19)(1,"slot",6),le(),C(2,"svg",7)(3,"g",8),w(4,"path",9)(5,"path",10),S(),C(6,"defs")(7,"filter",11),w(8,"feFlood",12)(9,"feColorMatrix",13)(10,"feOffset",14)(11,"feGaussianBlur",15)(12,"feColorMatrix",16)(13,"feBlend",17)(14,"feBlend",18),S()()()()()),n&2){let t=l(2).ngIf,e=l();c("cursorUser",t.currentCursorUser)("selfCursorPointer",!0)("avatarMode",e.avatarMode)("huddleState",t.huddleOnCursorMode?t.attendeesByUserId[t.currentCursorUser==null?null:t.currentCursorUser.userSnippylyId]==null?null:t.attendeesByUserId[t.currentCursorUser==null?null:t.currentCursorUser.userSnippylyId].state:void 0)("stream",t.localStream),d(4),x("fill",t.currentCursorUser.color),d(),x("fill",t.currentCursorUser.color)}}function BHt(n,o){if(n&1&&g(0,FHt,2,1,"ng-container",2)(1,LHt,15,7,"snippyly-cursor-pointer",3),n&2){let t=l().ngIf,e=l();c("ngForOf",t.cursorUsers)("ngForTrackBy",e.trackById),d(),c("ngIf",t.huddleJoined&&t.huddleOnCursorMode&&t.currentCursorUser)}}function VHt(n,o){if(n&1&&(f(0),g(1,BHt,2,3,"ng-template",1),v()),n&2){let t=o.ngIf;d(),c("ngIf",t.isFirstComponent&&!(t.user!=null&&t.user.isAnonymous))}}var $H=(()=>{let o=class o{get inactivityTime(){return this._inactivityTime}set inactivityTime(e){try{isNaN(e)?this.loggingService.catch("Error in Cursor set inactivityTime: ","inactivity-time value is not a number."):(this._inactivityTime=e,this.cursorService.setInactivityTime(this._inactivityTime))}catch(i){this.loggingService.catch("Error in Cursor set inactivityTime: ",i)}}get allowedElementIds(){return this._allowedElementIds}set allowedElementIds(e){try{this._allowedElementIds=typeof e=="string"?JSON.parse(e):e,this.cursorService.setAllowedElementIds(this._allowedElementIds)}catch(i){this.loggingService.catch("Error in Cursor set allowedElementIds: ",i)}}constructor(e,i,r,a,s,m){this.analyticsService=e,this.authService=i,this.cursorService=r,this.domService=a,this.huddleService=s,this.loggingService=m,this.avatarMode=!1,this.onCursorUsersChanged=new Ae,this.onCursorUserChange=new Ae,this.subscriptions=[],this.constants=j,this.showInitials={},this.componentConfigSignal=Te({isFirstComponent:!1,user:void 0,cursorUsers:[],huddleOnCursorModeByAttendeeId:{},attendeesByUserId:{},remoteStreamsByUserId:{},huddleOnCursorMode:!1,huddleJoined:!1,currentCursorUser:new Kv,localStream:void 0}),this.veltId=Pn(),this.veltElement=!0,this._inactivityTime=5,this._allowedElementIds=[],this.loggingService.log("%c[WB] Creating CLASS: CursorComponent","color: blue;")}ngOnInit(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;")}ngAfterViewInit(){try{let e=document.querySelector(j.TAGS.SNIPPYLY_CURSOR),i=document.querySelector(j.TAGS.VELT_CURSOR);i?this.veltId===i?.getAttribute(j.ATTRIBUTES.VELT_ID)&&(this.componentConfigSignal.update(r=>(r=T(I({},r),{isFirstComponent:!0}),r)),this.initComponent()):this.veltId===e?.getAttribute(j.ATTRIBUTES.VELT_ID)&&(this.componentConfigSignal.update(r=>(r=T(I({},r),{isFirstComponent:!0}),r)),this.initComponent())}catch(e){this.loggingService.catch("Error in CursorComponent AfterViewInit: ",e)}}initComponent(){try{this.cursorService.checkCursorTagAvailable(),this.subscriptions.push(this.authService.getUser$().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{user:e}),i)),this.componentConfigSignal().user&&this.setCursorInstalledInAnalytics()},e=>{this.loggingService.catch("Error in CursorComponent getUser$ subscription: ",e)})),this.subscriptions.push(this.huddleService.getHuddleJoined$().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{huddleJoined:e}),i))})),this.subscriptions.push(this.huddleService.getHuddleOnCursorMode$().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{huddleOnCursorMode:e}),i))},e=>{this.loggingService.catch("Error in CursorComponent getHuddleOnCursorMode$ subscription: ",e)})),this.subscriptions.push(this.huddleService.localStream$.subscribe(e=>{e?this.componentConfigSignal.update(i=>(i=T(I({},i),{localStream:e}),i)):this.componentConfigSignal.update(i=>(i=T(I({},i),{localStream:void 0}),i))})),this.subscriptions.push(this.huddleService.getRemoteStreamsByUserId$().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{remoteStreamsByUserId:e}),i))},e=>{this.loggingService.catch("Error in CursorComponent getRemoteStreamsByUserId$ subscription: ",e)})),this.subscriptions.push(this.huddleService.getHuddleAttendees$().subscribe(e=>{let i={};e?i=e.reduce((r,a)=>(r[a.userSnippylyId]=a,r),{}):i={},this.componentConfigSignal.update(r=>(r=T(I({},r),{attendeesByUserId:i}),r))},e=>{this.loggingService.catch("Error in CursorComponent getAttendees$ subscription: ",e)})),this.subscriptions.push(this.huddleService.getHuddleOnCursorModeByAttendeeId$().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{huddleOnCursorModeByAttendeeId:e}),i))})),this.subscriptions.push(this.domService.onWindowPointerMove$().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{currentCursorUser:T(I({},i.currentCursorUser),{position:{left:(e?.clientX||0)-2,top:(e?.clientY||0)-2}})}),i))},e=>{this.loggingService.catch("Error in CursorComponent onWindowPointerMove$ subscription: ",e)})),this.getCurrentCursorUser(),this.getLiveCursorsOnCurrentDocument()}catch(e){this.loggingService.catch("Error in CursorComponent initComponent: ",e)}}ngOnDestroy(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnDestroy","color: green;");try{this.unsubscribe()}catch(e){this.loggingService.catch("Error in CursorComponent ondestroy: ",e)}}unsubscribe(){this.loggingService.log("%c[WB] Calling FUNCTION: unsubscribe","color: green;");try{this.subscriptions.map(e=>{e.unsubscribe()}),this.subscriptions=[]}catch(e){this.loggingService.catch("Error in CursorComponent unsubscribe: ",e)}}getLiveCursorsOnCurrentDocument(){this.loggingService.log("%c[WB] Calling FUNCTION: getLiveCursorsOnCurrentDocument","color: green;");try{this.subscriptions.push(this.cursorService.getLiveCursorsOnCurrentDocument().pipe(Fe(e=>!!e)).subscribe(e=>{this.loggingService.log(e),e&&(this.componentConfigSignal.update(i=>(i=T(I({},i),{cursorUsers:e}),i)),this.onCursorUsersChanged.emit(e),this.onCursorUserChange.emit(e))},e=>{this.loggingService.catch("Error in CursorComponent getLiveCursorsOnCurrentDocument subscription: ",e)}))}catch(e){this.loggingService.catch("Error in CursorComponent getLiveCursorsOnCurrentDocument: ",e)}}getCurrentCursorUser(){this.loggingService.log("%c[WB] Calling FUNCTION: getCurrentCursorUser","color: green;");try{this.subscriptions.push(this.cursorService.getCursorUser().pipe(Fe(e=>!!e)).subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{currentCursorUser:T(I({},e),{position:i.currentCursorUser?.position})}),i))},e=>{this.loggingService.catch("Error in CursorComponent getCurrentCursorUser subscription: ",e)}))}catch(e){this.loggingService.catch("Error in CursorComponent getCurrentCursorUser: ",e)}}trackById(e,i){return i?.userId}onImageLoadError(e){this.loggingService.log("%c[WB] Calling FUNCTION: onImageLoadError","color: green;");try{this.showInitials[e.userId]=!0}catch(i){this.loggingService.catch("Error in CursorComponent onImageLoadError: ",i)}}setCursorInstalledInAnalytics(){try{this.analyticsService.setInstalledFeature(ke.CURSOR)}catch(e){this.loggingService.catch("Error in CursorComponent setCursorInstalledInAnalytics: ",e)}}};o.\u0275fac=function(i){return new(i||o)(u(Ze),u(He),u(a0),u(Ne),u(pr),u(y))},o.\u0275cmp=O({type:o,selectors:[["app-cursor"]],hostVars:2,hostBindings:function(i,r){i&2&&x("data-velt-id",r.veltId)("data-velt-element",r.veltElement)},inputs:{avatarMode:"avatarMode",inactivityTime:"inactivityTime",allowedElementIds:"allowedElementIds"},outputs:{onCursorUsersChanged:"cursorUsersChanged",onCursorUserChange:"onCursorUserChange"},standalone:!1,decls:1,vars:1,consts:[[4,"ngIf"],[3,"ngIf"],[4,"ngFor","ngForOf","ngForTrackBy"],[3,"cursorUser","selfCursorPointer","avatarMode","huddleState","stream",4,"ngIf"],[3,"cursorUser","avatarMode","huddleState","stream",4,"ngIf"],[3,"cursorUser","avatarMode","huddleState","stream"],["name","cursor"],["width","24","height","24","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg",1,"cursor-icon"],["filter","url(#filter0_d_6047_31299)"],["d","M7.68749 16.5142L5.42791 5.15177C5.26065 4.31067 6.16027 3.66301 6.90484 4.08848L16.8788 9.78786C17.6558 10.2319 17.503 11.3948 16.6376 11.623L12.3849 12.7447C12.1377 12.8098 11.9249 12.9672 11.7902 13.1844L9.51802 16.8464C9.03968 17.6174 7.86445 17.4041 7.68749 16.5142Z","fill","#625DF5"],["d","M4.93751 5.24929L7.19709 16.6118C7.46253 17.9466 9.22538 18.2664 9.94288 17.11L12.215 13.448C12.2824 13.3394 12.3888 13.2607 12.5124 13.2281L16.7651 12.1065C18.0632 11.7642 18.2924 10.0198 17.1268 9.35374L7.15291 3.65436C6.03605 3.01615 4.68662 3.98765 4.93751 5.24929Z","stroke","white","stroke-linecap","square"],["id","filter0_d_6047_31299","x","0.588557","y","0.405717","width","21.6129","height","23.0055","filterUnits","userSpaceOnUse","color-interpolation-filters","sRGB"],["flood-opacity","0","result","BackgroundImageFix"],["in","SourceAlpha","type","matrix","values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0","result","hardAlpha"],["dy","1.1"],["stdDeviation","1.2"],["type","matrix","values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.17 0"],["mode","normal","in2","BackgroundImageFix","result","effect1_dropShadow_6047_31299"],["mode","normal","in","SourceGraphic","in2","effect1_dropShadow_6047_31299","result","shape"],[3,"cursorUser","selfCursorPointer","avatarMode","huddleState","stream"]],template:function(i,r){i&1&&g(0,VHt,2,1,"ng-container",0),i&2&&c("ngIf",r.componentConfigSignal())},dependencies:[ht,Z,Nfe],styles:[`html{--velt-base-rem-unit: 1}*[data-snippyly-element=true],*[data-velt-element=true]{font-family:var(--velt-default-font-family)}velt-wireframe{display:none!important}*{box-sizing:border-box;margin:0;padding:0;-webkit-tap-highlight-color:rgba(255,255,255,0);outline:none;height:unset;width:unset;text-align:left;line-height:1.5;color:#000;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit));pointer-events:none!important}*:empty{display:revert}.cursor-icon path{stroke:#fff;stroke-width:1px;stroke-linejoin:round}
415
+ `||this.componentConfigSignal().selectedAttachments?.length||this.componentConfigSignal().attachmentsToDelete?.length||this.componentConfigSignal().recorderInitConfig&&this.componentConfigSignal().recorderInitConfig?.panelId===this.componentConfigSignal().commentDialogUniqueId||this.componentConfigSignal().localRecordedData?.length?this.componentConfigSignal.update(e=>(e=T(I({},e),{getAnnotationDraftAttribute:e.annotation?.annotationId}),e)):this.componentConfigSignal.update(e=>(e=T(I({},e),{getAnnotationDraftAttribute:null}),e))}catch(e){this.catchError("Error in CommentDialogComponent checkGetAnnotationDraftAttribute: ",e)}}checkShowGhostCommentMessage(){try{this.componentConfigSignal().ghostComment&&this.componentConfigSignal().enableGhostCommentsMessage&&![this.componentConfigSignal().commentAcceptedStatus?.id,this.componentConfigSignal().commentRejectedStatus?.id].includes(this.componentConfigSignal().annotation?.status?.id)?this.componentConfigSignal.update(e=>(e=T(I({},e),{showGhostCommentMessage:!0}),e)):this.componentConfigSignal.update(e=>(e=T(I({},e),{showGhostCommentMessage:!1}),e))}catch(e){this.catchError("Error in CommentDialogComponent checkShowGhostCommentMessage: ",e)}}checkShowSuggestionModeActions(){try{this.componentConfigSignal().suggestionMode&&this.componentConfigSignal().dialogSelectedByKnownUser&&this.componentConfigSignal().annotation?.status?.type!=="terminal"&&this.componentConfigSignal().annotation?.comments?.length?this.componentConfigSignal.update(e=>(e=T(I({},e),{showSuggestionModeActions:!0}),e)):this.componentConfigSignal.update(e=>(e=T(I({},e),{showSuggestionModeActions:!1}),e))}catch(e){this.catchError("Error in CommentDialogComponent checkShowSuggestionModeActions: ",e)}}ngOnDestroy(){super.ngOnDestroy(),this.loggingService.log("%c[WB] Calling FUNCTION: unsubscribe","color: green;");try{this.veltDynamicComponents.forEach(e=>{e.destroy()}),this.subscriptions.map(e=>{e.unsubscribe()}),this.domService.setRecordingInProgress(this.componentConfigSignal().annotation?.annotationId,!1),this.subscriptions=[],this.componentConfigSignal().recorderInitConfig?.panelId===this.componentConfigSignal().commentDialogUniqueId&&this.recorderService.clearRecording(),this.resizeObserver&&this.componentConfigSignal().commentsContainer?.nativeElement&&this.resizeObserver.unobserve(this.componentConfigSignal().commentsContainer?.nativeElement),clearTimeout(this.escapePressTimeout),this.componentConfigSignal().getAnnotationDraftAttribute&&this.commentService.getDraftMode()&&!this.componentConfigSignal().editComment&&this.componentConfigSignal().getAnnotationDraftAttribute&&this.addComment(void 0,!0)}catch(e){this.catchError("Error in CommentDialogComponent unsubscribe: ",e)}}closeDialog(){try{this.domService.resetSelectedAnnotationsMap()}catch(e){this.catchError("Error in CommentDialogComponent closeDialog: ",e)}}openDropdownIndex(e){try{this.componentConfigSignal.update(i=>(i=T(I({},i),{openDropdownIndexValue:e}),i))}catch(i){this.catchError("Error in CommentDialogComponent openDropdownIndex: ",i)}}navigateToCommentEmit(){try{this.onCommentNavigationButtonClick.emit(this.componentConfigSignal().annotation)}catch(e){this.catchError("Error in CommentDialogComponent navigateToComment: ",e)}}moveCursorToEnd(e){try{if(!e?.isConnected)return;e.focus(),setTimeout(()=>{let i=document.createRange(),r=window.getSelection();i.selectNodeContents(e),i.collapse(!1),r?.removeAllRanges(),r?.addRange(i)},0)}catch(i){this.catchError("Error in CommentDialogComponent moveCursorToEnd: ",i)}}focusOnComposerInput(){try{this.onComposerClick();let e=dre();this.componentConfigSignal().newCommentTextArea?.nativeElement&&(this.componentConfigSignal().newCommentTextArea.nativeElement?.contains(e)||this.moveCursorToEnd(this.componentConfigSignal().newCommentTextArea.nativeElement)),this.componentConfigSignal().editCommentTextArea?.nativeElement&&(this.componentConfigSignal().editCommentTextArea.nativeElement?.contains(e)||this.moveCursorToEnd(this.componentConfigSignal().editCommentTextArea.nativeElement))}catch(e){this.catchError("Error in CommentDialogComponent focusOnComposerInput: ",e)}}onComposerClick(){try{this.commentActionsService?.onComposerClick({commentAnnotation:this.componentConfigSignal().annotation}),this.componentConfigSignal().commentPinSelected||(this.componentConfigSignal().sidebarMode?this.domService.toggleAnnotationSelection(this.componentConfigSignal().annotation,this.componentConfigSignal().containerComponentId,"sidebarShowReplies"):this.domService.toggleAnnotationSelection(this.componentConfigSignal().annotation,this.componentConfigSignal().containerComponentId))}catch(e){this.catchError("Error in CommentDialogComponent onComposerClick: ",e)}}getCurrentDialogView(){try{let e={};if(this.componentConfigSignal().annotation?.annotationId){let i=this.componentConfigSignal().commentViews?.[this.componentConfigSignal().annotation?.annotationId]?.comments;Object.keys(i||{}).forEach(r=>{let a=[],s=0;Object.keys(i[r]?.views||{}).forEach(m=>{let p={};p.user=this.componentConfigSignal().userContactsBySnippylyId?.[m],p.viewedAt=i[r]?.views?.[m]?.timestamp,p.user?.userId!==this.componentConfigSignal().user?.userId&&(a.push(p),(p.user?.email||p.user?.name)&&s++)}),e[r]={count:s,views:a}})}this.componentConfigSignal.update(i=>(i=T(I({},i),{currentDialogView:e}),i))}catch(e){this.catchError("Error in CommentDialogComponent getCurrentDialogView: ",e)}}catchError(e,i,r){try{this.loggingService.catch(e,i,T(I({},r||{}),{annotationId:this.componentConfigSignal()?.annotation?.annotationId}))}catch{}}};o.\u0275fac=function(i){return new(i||o)(u(Ze),u(He),u(we),u(ii),u(l9),u(Ci),u(Ne),u(ui),u(Ls),u(r_),u(y),u(zo),u(fn),u(nr),u(es),u(Ye),u(k),u(Wi),u(ze),u(lt),u(Tn),u(Kt),u(dc,8))},o.\u0275cmp=O({type:o,selectors:[["snippyly-comment-dialog"]],viewQuery:function(i,r){if(i&1&&(ot(njt,5),ot(ijt,5),ot(ojt,5),ot(Efe,7),ot(Efe,5,Si)),i&2){let a;Qe(a=Je())&&(r.commentsContainer=a.first),Qe(a=Je())&&(r.newCommentTextArea=a.first),Qe(a=Je())&&(r.editCommentTextArea=a.first),Qe(a=Je())&&(r.hostElement=a.first),Qe(a=Je())&&(r.hostViewContainer=a.first)}},hostVars:1,hostBindings:function(i,r){i&2&&x("data-velt-element",r.veltElement)},inputs:{snippylyReadId:"snippylyReadId",screenshotDomain:"screenshotDomain",annotationIndex:"annotationIndex",userContacts:"userContacts",annotation:"annotation",user:"user",dialogMode:"dialogMode",sidebarMode:"sidebarMode",fullExpanded:"fullExpanded",inboxMode:"inboxMode",multiThread:"multiThread",inlineCommentMode:"inlineCommentMode",inlineCommentSectionMode:"inlineCommentSectionMode",commentComposerMode:"commentComposerMode",isInsidePdfViewer:"isInsidePdfViewer",locationDisplayName:"locationDisplayName",locationVersion:"locationVersion",commentPinSelected:"commentPinSelected",variant:"variant",shadowDom:"shadowDom",commentPinType:"commentPinType",composerMode:"composerMode",containerComponentId:"containerComponentId",focusedThreadMode:"focusedThreadMode",isFocusedThreadEnabled:"isFocusedThreadEnabled",pageModeComposer:"pageModeComposer",composerPosition:"composerPosition",sortBy:"sortBy",sortOrder:"sortOrder",dialogTemplate:"dialogTemplate"},outputs:{deleteCommentThread:"deleteCommentThread",saveComment:"saveComment",afterViewInit:"afterViewInit",signInToAccessFeature:"signInToAccessFeature",pointerOutFromCommentDialog:"pointerOutFromCommentDialog",pointerUp:"pointerUp",updateOverlayPosition:"updateOverlayPosition",onCommentNavigationButtonClick:"onCommentNavigationButtonClick"},standalone:!1,features:[B,Xe],decls:4,vars:66,consts:[["host","","commentsContainer",""],["defaultDialogRef",""],["commentsContainer",""],[1,"modal-div","velt-comment-dialog",3,"click","pointerout","pointerdown","pointerup"],[4,"ngIf"],[4,"ngIf","ngIfElse"],[4,"ngTemplateOutlet"],["part","container","class","modal-div velt-comment-dialog",3,"dialog","velt-comment-dialog--dialog-mode","bottom-sheet","velt-comment-dialog--bottom-sheet","inbox","velt-comment-dialog--inbox-mode","readonly","velt-comment-dialog--readonly","no-comments","velt-comment-dialog--no-comments","selected","velt-comment-dialog--selected","screen-recording","velt-comment-dialog--screen-recording","s-ghost-comment-annotation","velt-comment-dialog--ghost-comment-annotation","inline-comment-mode","velt-comment-dialog--inline-comment-mode","velt-comment-dialog--multi-thread-mode","velt-comment-dialog--page-comment","velt-comment-dialog--inline-comment-section-mode","velt-comment-dialog--comment-composer-mode","velt-comment-dialog--focused-thread-mode","velt-comment-dialog--page-mode-composer","private-comment","velt-comment-dialog--private-comment","click","pointerout","pointerdown","pointerup",4,"ngIf"],["part","container","class","modal-div velt-comment-dialog",3,"dialog","velt-comment-dialog--dialog-mode","sidebar","velt-comment-dialog--sidebar-mode","bottom-sheet","velt-comment-dialog--bottom-sheet","readonly","velt-comment-dialog--readonly","no-comments","velt-comment-dialog--no-comments","selected","velt-comment-dialog--selected","screen-recording","velt-comment-dialog--screen-recording","s-ghost-comment-annotation","velt-comment-dialog--focused-thread-mode","velt-comment-dialog--ghost-comment-annotation","velt-comment-dialog--page-mode-composer","private-comment","velt-comment-dialog--private-comment","click","pointerout","pointerdown","pointerup",4,"ngIf"],["part","container","class","modal-div velt-comment-dialog",3,"dialog","velt-comment-dialog--dialog-mode","bottom-sheet","velt-comment-dialog--bottom-sheet","inbox","velt-comment-dialog--inbox-mode","readonly","velt-comment-dialog--readonly","no-comments","velt-comment-dialog--no-comments","selected","velt-comment-dialog--selected","screen-recording","velt-comment-dialog--screen-recording","s-ghost-comment-annotation","velt-comment-dialog--ghost-comment-annotation","inline-comment-mode","velt-comment-dialog--inline-comment-mode","velt-comment-dialog--multi-thread-mode","velt-comment-dialog--page-comment","velt-comment-dialog--focused-thread-mode","velt-comment-dialog--inline-comment-section-mode","velt-comment-dialog--comment-composer-mode","velt-comment-dialog--page-mode-composer","private-comment","velt-comment-dialog--private-comment","click","pointerout","pointerdown","pointerup",4,"ngIf"],["part","container",1,"modal-div","velt-comment-dialog",3,"click","pointerout","pointerdown","pointerup"],[3,"componentConfigSignal"],["class","line-div velt-comment-dialog--line-div",4,"ngIf"],["class","velt-action-bar velt-comment-dialog--action-bar",4,"ngIf"],[1,"line-div","velt-comment-dialog--line-div"],[1,"velt-action-bar","velt-comment-dialog--action-bar"],[3,"componentConfigSignal",4,"ngIf"],["class","velt-comment-dialog--action-bar-group",4,"ngIf"],[1,"velt-comment-dialog--action-bar-group"]],template:function(i,r){if(i&1){let a=q();C(0,"div",3,0),G("click",function(){return N(a),F(r.onClick())})("pointerout",function(m){return N(a),r.onPointerOutCommentDialog(m),F(m.stopPropagation())})("pointerdown",function(m){return N(a),F(m.stopPropagation())})("pointerup",function(m){return N(a),r.onPointerUp(),F(m.stopPropagation())}),S(),g(3,Ojt,4,1,"ng-container",4)}if(i&2){let a,s,m,p,h,_,E,D,L,H,K,oe,ue,be,Le,qe,Re,_e,Ee,Oe,ye,fe,Be,xe,wn,$t,ft,Ot,Mt,ln,no,oi,Ri,pn,_i;ge("sidebar",(a=r.componentConfigSignal())==null?null:a.sidebarMode)("velt-comment-dialog--sidebar-mode",(s=r.componentConfigSignal())==null?null:s.sidebarMode)("dialog",(m=r.componentConfigSignal())==null?null:m.dialogMode)("velt-comment-dialog--dialog-mode",(p=r.componentConfigSignal())==null?null:p.dialogMode)("hide",(h=r.componentConfigSignal())==null?null:h.showDefault)("velt-comment-dialog--hide",(_=r.componentConfigSignal())==null?null:_.showDefault)("bottom-sheet",(E=r.componentConfigSignal())==null?null:E.bottomSheetMode)("velt-comment-dialog--bottom-sheet",(D=r.componentConfigSignal())==null?null:D.bottomSheetMode)("inbox",(L=r.componentConfigSignal())==null?null:L.inboxMode)("velt-comment-dialog--inbox-mode",(H=r.componentConfigSignal())==null?null:H.inboxMode)("readonly",((K=r.componentConfigSignal())==null||K.user==null?null:K.user.isReadOnly)||((K=r.componentConfigSignal())==null||K.user==null?null:K.user.isAnonymous))("velt-comment-dialog--readonly",((oe=r.componentConfigSignal())==null||oe.user==null?null:oe.user.isReadOnly)||((oe=r.componentConfigSignal())==null||oe.user==null?null:oe.user.isAnonymous))("no-comments",!(!((ue=r.componentConfigSignal())==null||ue.annotation==null||ue.annotation.comments==null)&&ue.annotation.comments.length))("velt-comment-dialog--no-comments",!(!((be=r.componentConfigSignal())==null||be.annotation==null||be.annotation.comments==null)&&be.annotation.comments.length))("selected",(Le=r.componentConfigSignal())==null?null:Le.commentDialogSelected)("velt-comment-dialog--selected",(qe=r.componentConfigSignal())==null?null:qe.commentDialogSelected)("screen-recording",((Re=r.componentConfigSignal())==null||Re.recorderInitConfig==null?null:Re.recorderInitConfig.type)==="screen")("velt-comment-dialog--screen-recording",((_e=r.componentConfigSignal())==null||_e.recorderInitConfig==null?null:_e.recorderInitConfig.type)==="screen")("s-ghost-comment-annotation",(Ee=r.componentConfigSignal())==null?null:Ee.showGhostCommentMessage)("velt-comment-dialog--ghost-comment-annotation",(Oe=r.componentConfigSignal())==null?null:Oe.showGhostCommentMessage)("velt-comment-dialog--focused-thread-mode",(ye=r.componentConfigSignal())==null?null:ye.focusedThreadMode)("inline-comment-mode",((fe=r.componentConfigSignal())==null?null:fe.inlineCommentMode)&&!((fe=r.componentConfigSignal())!=null&&fe.isInsidePdfViewer))("velt-comment-dialog--page-comment",(Be=r.componentConfigSignal())==null||Be.annotation==null?null:Be.annotation.isPageAnnotation)("velt-comment-dialog--inline-comment-mode",((xe=r.componentConfigSignal())==null?null:xe.inlineCommentMode)&&!((xe=r.componentConfigSignal())!=null&&xe.isInsidePdfViewer))("velt-comment-dialog--multi-thread-mode",(wn=r.componentConfigSignal())==null?null:wn.multiThread)("velt-comment-dialog--comment-composer-mode",($t=r.componentConfigSignal())==null?null:$t.commentComposerMode)("velt-comment-dialog--page-mode-composer",(ft=r.componentConfigSignal())==null?null:ft.pageModeComposer)("private-comment",(Ot=r.componentConfigSignal())==null?null:Ot.isPrivateComment)("velt-comment-dialog--private-comment",(Mt=r.componentConfigSignal())==null?null:Mt.isPrivateComment),x("data-velt-annotation-draft",(ln=r.componentConfigSignal())==null?null:ln.getAnnotationDraftAttribute)("data-velt-annotation-edit-comment",(no=r.componentConfigSignal())!=null&&no.editComment?!0:void 0)("data-velt-comment-dialog-comments-count",((oi=r.componentConfigSignal())==null||oi.annotation==null||oi.annotation.comments==null?null:oi.annotation.comments.length)||"0")("data-velt-comment-dialog-comments-status",(Ri=r.componentConfigSignal())==null||Ri.annotation==null||Ri.annotation.status==null?null:Ri.annotation.status.id)("data-velt-comment-dialog-comments-status-type",(pn=r.componentConfigSignal())==null||pn.annotation==null||pn.annotation.status==null?null:pn.annotation.status.type)("data-velt-comment-dialog-comments-priority",(_i=r.componentConfigSignal())==null||_i.annotation==null||_i.annotation.priority==null?null:_i.annotation.priority.id)("data-testid",r.componentId+"-root"),d(3),c("ngIf",r.componentConfigSignal())}},dependencies:[Z,vt,N0,P0,F0,A0,R0,lh,w0,B0,O0,j0,V0,tn,GC],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}[_nghost-%COMP%]{--velt-green: var(--velt-light-mode-green);--velt-magenta: var(--velt-light-mode-magenta);--velt-amber: var(--velt-light-mode-amber);--velt-purple: var(--velt-light-mode-purple);--velt-cyan: var(--velt-light-mode-cyan);--velt-orange: var(--velt-light-mode-orange);--velt-black: var(--velt-light-mode-black);--velt-white: var(--velt-light-mode-white);--velt-gray: var(--velt-light-mode-gray);--velt-error: var(--velt-light-mode-error);--velt-error-hover: var(--velt-light-mode-error-hover);--velt-error-foreground: var(--velt-light-mode-error-foreground);--velt-error-light: var(--velt-light-mode-error-light);--velt-error-transparent: var(--velt-light-mode-error-transparent);--velt-warning: var(--velt-light-mode-warning);--velt-warning-hover: var(--velt-light-mode-warning-hover);--velt-warning-foreground: var(--velt-light-mode-warning-foreground);--velt-warning-light: var(--velt-light-mode-warning-light);--velt-warning-transparent: var(--velt-light-mode-warning-transparent);--velt-success: var(--velt-light-mode-success);--velt-success-hover: var(--velt-light-mode-success-hover);--velt-success-foreground: var(--velt-light-mode-success-foreground);--velt-success-light: var(--velt-light-mode-success-light);--velt-success-transparent: var(--velt-light-mode-success-transparent);--velt-accent: var(--velt-light-mode-accent);--velt-accent-text: var(--velt-light-mode-accent-text);--velt-accent-hover: var(--velt-light-mode-accent-hover);--velt-accent-foreground: var(--velt-light-mode-accent-foreground);--velt-accent-light: var(--velt-light-mode-accent-light);--velt-accent-transparent: var(--velt-light-mode-accent-transparent);--velt-text-0: var(--velt-light-mode-text-0);--velt-text-1: var(--velt-light-mode-text-1);--velt-text-2: var(--velt-light-mode-text-2);--velt-text-3: var(--velt-light-mode-text-3);--velt-text-4: var(--velt-light-mode-text-4);--velt-text-5: var(--velt-light-mode-text-5);--velt-text-6: var(--velt-light-mode-text-6);--velt-text-7: var(--velt-light-mode-text-7);--velt-text-8: var(--velt-light-mode-text-8);--velt-text-9: var(--velt-light-mode-text-9);--velt-text-10: var(--velt-light-mode-text-10);--velt-text-11: var(--velt-light-mode-text-11);--velt-text-12: var(--velt-light-mode-text-12);--velt-background-0: var(--velt-light-mode-background-0);--velt-background-1: var(--velt-light-mode-background-1);--velt-background-2: var(--velt-light-mode-background-2);--velt-background-3: var(--velt-light-mode-background-3);--velt-background-4: var(--velt-light-mode-background-4);--velt-background-5: var(--velt-light-mode-background-5);--velt-background-6: var(--velt-light-mode-background-6);--velt-background-7: var(--velt-light-mode-background-7);--velt-background-8: var(--velt-light-mode-background-8);--velt-background-9: var(--velt-light-mode-background-9);--velt-background-10: var(--velt-light-mode-background-10);--velt-border-0: var(--velt-light-mode-border-0);--velt-border-1: var(--velt-light-mode-border-1);--velt-border-2: var(--velt-light-mode-border-2);--velt-border-3: var(--velt-light-mode-border-3);--velt-border-4: var(--velt-light-mode-border-4);--velt-border-5: var(--velt-light-mode-border-5);--velt-border-6: var(--velt-light-mode-border-6);--velt-border-7: var(--velt-light-mode-border-7);--velt-border-8: var(--velt-light-mode-border-8);--velt-border-9: var(--velt-light-mode-border-9);--velt-border-10: var(--velt-light-mode-border-10);--velt-background-transparent: var(--velt-light-mode-background-transparent);--velt-border-transparent: var(--velt-light-mode-border-transparent);--velt-animation-transparent: var(--velt-light-mode-animation-transparent)}[dark][_nghost-%COMP%]{--velt-green: var(--velt-dark-mode-green);--velt-magenta: var(--velt-dark-mode-magenta);--velt-amber: var(--velt-dark-mode-amber);--velt-purple: var(--velt-dark-mode-purple);--velt-cyan: var(--velt-dark-mode-cyan);--velt-orange: var(--velt-dark-mode-orange);--velt-black: var(--velt-dark-mode-black);--velt-white: var(--velt-dark-mode-white);--velt-gray: var(--velt-dark-mode-gray);--velt-error: var(--velt-dark-mode-error);--velt-error-hover: var(--velt-dark-mode-error-hover);--velt-error-foreground: var(--velt-dark-mode-error-foreground);--velt-error-light: var(--velt-dark-mode-error-light);--velt-error-transparent: var(--velt-dark-mode-error-transparent);--velt-warning: var(--velt-dark-mode-warning);--velt-warning-hover: var(--velt-dark-mode-warning-hover);--velt-warning-foreground: var(--velt-dark-mode-warning-foreground);--velt-warning-light: var(--velt-dark-mode-warning-light);--velt-warning-transparent: var(--velt-dark-mode-warning-transparent);--velt-success: var(--velt-dark-mode-success);--velt-success-hover: var(--velt-dark-mode-success-hover);--velt-success-foreground: var(--velt-dark-mode-success-foreground);--velt-success-light: var(--velt-dark-mode-success-light);--velt-success-transparent: var(--velt-dark-mode-success-transparent);--velt-accent: var(--velt-dark-mode-accent);--velt-accent-text: var(--velt-dark-mode-accent-text);--velt-accent-hover: var(--velt-dark-mode-accent-hover);--velt-accent-foreground: var(--velt-dark-mode-accent-foreground);--velt-accent-light: var(--velt-dark-mode-accent-light);--velt-accent-transparent: var(--velt-dark-mode-accent-transparent);--velt-text-0: var(--velt-dark-mode-text-0);--velt-text-1: var(--velt-dark-mode-text-1);--velt-text-2: var(--velt-dark-mode-text-2);--velt-text-3: var(--velt-dark-mode-text-3);--velt-text-4: var(--velt-dark-mode-text-4);--velt-text-5: var(--velt-dark-mode-text-5);--velt-text-6: var(--velt-dark-mode-text-6);--velt-text-7: var(--velt-dark-mode-text-7);--velt-text-8: var(--velt-dark-mode-text-8);--velt-text-9: var(--velt-dark-mode-text-9);--velt-text-10: var(--velt-dark-mode-text-10);--velt-text-11: var(--velt-dark-mode-text-11);--velt-text-12: var(--velt-dark-mode-text-12);--velt-background-0: var(--velt-dark-mode-background-0);--velt-background-1: var(--velt-dark-mode-background-1);--velt-background-2: var(--velt-dark-mode-background-2);--velt-background-3: var(--velt-dark-mode-background-3);--velt-background-4: var(--velt-dark-mode-background-4);--velt-background-5: var(--velt-dark-mode-background-5);--velt-background-6: var(--velt-dark-mode-background-6);--velt-background-7: var(--velt-dark-mode-background-7);--velt-background-8: var(--velt-dark-mode-background-8);--velt-background-9: var(--velt-dark-mode-background-9);--velt-background-10: var(--velt-dark-mode-background-10);--velt-border-0: var(--velt-dark-mode-border-0);--velt-border-1: var(--velt-dark-mode-border-1);--velt-border-2: var(--velt-dark-mode-border-2);--velt-border-3: var(--velt-dark-mode-border-3);--velt-border-4: var(--velt-dark-mode-border-4);--velt-border-5: var(--velt-dark-mode-border-5);--velt-border-6: var(--velt-dark-mode-border-6);--velt-border-7: var(--velt-dark-mode-border-7);--velt-border-8: var(--velt-dark-mode-border-8);--velt-border-9: var(--velt-dark-mode-border-9);--velt-border-10: var(--velt-dark-mode-border-10);--velt-background-transparent: var(--velt-dark-mode-background-transparent);--velt-border-transparent: var(--velt-dark-mode-border-transparent);--velt-animation-transparent: var(--velt-dark-mode-animation-transparent)}[type=button][_ngcontent-%COMP%]:not(:disabled), [type=reset][_ngcontent-%COMP%]:not(:disabled), [type=submit][_ngcontent-%COMP%]:not(:disabled), button[_ngcontent-%COMP%]:not(:disabled){cursor:pointer}[_ngcontent-%COMP%]::-webkit-scrollbar{display:none;width:0;height:0}[_ngcontent-%COMP%]::-webkit-scrollbar{width:0;height:0}[_ngcontent-%COMP%]::-webkit-scrollbar-button{width:0;height:0} .velt-comment-dialog-thread-card-message--email-chip, .velt-autocomplete--contact-chip, .velt-autocomplete--group-chip{color:var(--velt-accent-text);background:var(--velt-accent-transparent);border-radius:var(--velt-border-radius-xs);padding:var(--velt-spacing-xs);word-break:break-word;font-size:var(--velt-font-size-sm);font-style:normal;font-weight:400;line-height:120%} .velt-comment-dialog-thread-card-message--email-chip.velt-autocomplete--contact-chip-current-user, .velt-autocomplete--contact-chip.velt-autocomplete--contact-chip-current-user, .velt-autocomplete--group-chip.velt-autocomplete--contact-chip-current-user{background-color:color-mix(in srgb,var(--velt-warning) 12%,transparent);color:color-mix(in srgb,var(--velt-warning) 32%,var(--velt-text-0))} velt-autocomplete-chip velt-skeleton-loader-internal{width:50px;border-radius:var(--velt-border-radius-xs);margin-block:6px} .velt-comment-dialog--here-chip{color:var(--velt-accent-text);background:var(--velt-accent-transparent);border-radius:var(--velt-border-radius-xs);padding:var(--velt-spacing-xs);word-break:break-word}.velt-comment-dialog--comment-link[_ngcontent-%COMP%]{color:var(--velt-accent);word-break:break-all;display:unset}.velt-comment-dialog-shake[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_shake .82s cubic-bezier(.36,.07,.19,.97) both}@keyframes _ngcontent-%COMP%_shake{10%,90%{transform:translate3d(-1px,0,0)}20%,80%{transform:translate3d(2px,0,0)}30%,50%,70%{transform:translate3d(-4px,0,0)}40%,60%{transform:translate3d(4px,0,0)}}.velt-comment-dialog[_ngcontent-%COMP%]{position:relative;display:flex;flex-direction:column;gap:var(--velt-spacing-lg);border-radius:var(--velt-border-radius-md);box-shadow:0 8px 16px -8px #0f0f0f1a;box-sizing:border-box;width:361px;text-align:left;font-size:var(--velt-font-size-sm);padding:var(--velt-spacing-lg);background-color:var(--velt-background-0);border:1px solid var(--velt-border-4);color:var(--velt-text-3)}.velt-comment-dialog[_ngcontent-%COMP%] .velt-comment-dialog--line-div[_ngcontent-%COMP%]{border-top:1px solid var(--velt-border-4);width:100%}.velt-comment-dialog.velt-comment-dialog--no-comments[_ngcontent-%COMP%]{padding:0;gap:0}.velt-comment-dialog.velt-comment-dialog--multi-thread-mode[_ngcontent-%COMP%]{box-shadow:none;border:0;background-color:transparent}.velt-comment-dialog.velt-comment-dialog--sidebar-mode[_ngcontent-%COMP%]{width:100%;min-width:100%;box-shadow:none;background:transparent;border-color:transparent}.velt-comment-dialog.velt-comment-dialog--sidebar-mode[_ngcontent-%COMP%]:hover, .velt-comment-dialog.velt-comment-dialog--sidebar-mode.velt-comment-dialog--selected[_ngcontent-%COMP%]{background-color:var(--velt-background-0);border-color:var(--velt-border-4)}.velt-comment-dialog.velt-comment-dialog--page-mode-composer[_ngcontent-%COMP%]{width:100%;padding-inline:var(--velt-spacing-lg);box-shadow:none;background:transparent;border-color:transparent}.velt-comment-dialog.velt-comment-dialog--inline-comment-mode[_ngcontent-%COMP%]{padding:0;box-shadow:none;border-color:transparent;background:transparent;width:100%}.velt-comment-dialog.velt-comment-dialog--inline-comment-section-mode[_ngcontent-%COMP%]{width:100%;box-shadow:none}.velt-comment-dialog.velt-comment-dialog--inline-comment-section-mode.no-comments[_ngcontent-%COMP%]{padding:var(--velt-spacing-md) var(--velt-spacing-sm) var(--velt-spacing-md) var(--velt-spacing-lg)}.velt-comment-dialog.velt-comment-dialog--bottom-sheet[_ngcontent-%COMP%]{width:100%;border-bottom-left-radius:0;border-bottom-right-radius:0} .snippyly-comment-rewriter-text{color:var(--velt-black);background-color:color-mix(in srgb,var(--velt-warning) 42%,var(--velt-white))}.velt-comment-dialog--hide[_ngcontent-%COMP%]{display:none}.velt-comment-dialog--action-bar[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:space-around;padding:var(--velt-spacing-lg);box-sizing:border-box;text-align:center;color:var(--velt-accent-text);gap:var(--velt-spacing-2xl)}.velt-comment-dialog--action-bar[_ngcontent-%COMP%]:empty{display:none}.velt-comment-dialog--action-bar[_ngcontent-%COMP%] .velt-comment-dialog--action-bar-group[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center;justify-content:space-around;width:100%;box-sizing:border-box}.velt-comment-dialog--focused-thread-mode[_ngcontent-%COMP%]{border:none;height:100%}.velt-comment-dialog--focused-thread-mode[_ngcontent-%COMP%] app-comment-dialog-body[_ngcontent-%COMP%]{display:flex;flex-grow:1;min-height:0;width:100%;overflow:scroll}"],changeDetection:0});let n=o;return n})();var $9=(()=>{let o=class o{constructor(e,i,r,a){this.bottomSheet=e,this.domService=i,this.loggingService=r,this.elementRef=a,this.user=new wo,this.isInsidePdfViewer=!1,this.bottomSheetData$=new Ce(null),this.saveComment=new Ae,this.veltElement=!0,this.subscriptions=[],this.componentId="velt-comment-bottom-sheet"}ngOnInit(){this.setupA11yAttributes()}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","dialog"),e.setAttribute("aria-label","Comment bottom sheet")}catch(e){this.loggingService.catch("Error in CommentBottomSheetComponent setupA11yAttributes:",e)}}ngAfterViewInit(){this.openBottomSheet(),this.setBottomSheetData()}ngOnChanges(e){try{e?.annotation&&this.setBottomSheetData()}catch(i){this.catchError("Error in CommentBottomSheetComponent ngOnChanges: ",i)}}setBottomSheetData(){try{this.bottomSheetData$.next({annotation:this.annotation,user:this.user,commentPinSelected:!0,isInsidePdfViewer:this.isInsidePdfViewer,multiThreadAnnotationId:this.annotation?.type==="multiThread"?this.annotation.annotationId:null,saveComment:e=>{this.saveComment.emit(e)},dismiss:()=>{this.closeBottomSheet()}})}catch(e){this.catchError("Error in CommentBottomSheetComponent setBottomSheetData: ",e)}}openBottomSheet(){return Q(this,null,function*(){try{this.annotation.type==="multiThread"?(this.bottomSheetRef=this.bottomSheet.open(rs,{data:this.bottomSheetData$.asObservable(),panelClass:"snippyly-comment-bottom-sheet-container"}),this.subscriptions.push(this.bottomSheetRef.backdropClick().subscribe(()=>{this.domService.resetSelectedAnnotationsMap()}))):(this.bottomSheetRef=this.bottomSheet.open(Go,{data:this.bottomSheetData$.asObservable(),panelClass:"snippyly-comment-bottom-sheet-container"}),this.subscriptions.push(this.bottomSheetRef.backdropClick().subscribe(()=>{this.domService.resetSelectedAnnotationsMap()})))}catch(e){this.catchError("Error in CommentBottomSheetComponent openBottomSheet: ",e)}})}closeBottomSheet(){try{this.bottomSheetRef&&this.bottomSheetRef.dismiss()}catch(e){this.catchError("Error in CommentBottomSheetComponent closeBottomSheet: ",e)}}ngOnDestroy(){this.closeBottomSheet(),this.subscriptions.forEach(e=>{e?.unsubscribe()})}catchError(e,i,r){try{this.loggingService.catch(e,i,T(I({},r||{}),{annotationId:this.annotation?.annotationId}))}catch{}}};o.\u0275fac=function(i){return new(i||o)(u(pc),u(Ne),u(y),u(k))},o.\u0275cmp=O({type:o,selectors:[["snippyly-comment-bottom-sheet"]],hostVars:1,hostBindings:function(i,r){i&2&&x("data-velt-element",r.veltElement)},inputs:{annotation:"annotation",user:"user",isInsidePdfViewer:"isInsidePdfViewer"},outputs:{saveComment:"saveComment"},standalone:!1,features:[Xe],decls:0,vars:0,template:function(i,r){},styles:[".snippyly-comment-bottom-sheet-container{padding:0!important} .snippyly-comment-bottom-sheet-container .mat-bottom-sheet-container{padding:0!important}"],changeDetection:0});let n=o;return n})();function Pjt(n,o){if(n&1){let t=q();C(0,"div",4),G("pointerup",function(i){return N(t),l(2).togglePinSelection(),F(i.stopPropagation())})("click",function(i){return N(t),F(i.stopPropagation())})("cdkDragStarted",function(){N(t);let i=l(2);return F(i.onPinDragStart())}),C(1,"snippyly-comment-pin",5),G("saveComment",function(i){N(t);let r=l(2);return F(r.saveComment(i))})("commentTargetElementClicked",function(){N(t);let i=l(2);return F(i.togglePinSelection())})("togglePinSelection",function(i){N(t);let r=l(2);return F(r.togglePinSelection(i))}),S()()}if(n&2){let t=l().ngIf,e=l();rt("top",(t.commentPinAnnotation==null||t.commentPinAnnotation.position==null?null:t.commentPinAnnotation.position.top)-0+t.offsetTop,"px")("left",(t.commentPinAnnotation==null||t.commentPinAnnotation.position==null?null:t.commentPinAnnotation.position.left)-10+t.offsetLeft,"px"),c("id","comment-pin-container-"+(t.commentPinAnnotation==null?null:t.commentPinAnnotation.annotationId)),x("data-testid",e.componentId+"-popover")("role","button")("aria-expanded",t.commentPinSelected),d(),c("annotation",t.commentPinAnnotation)("containerComponentId",t.componentId)("commentPinSelected",t.commentPinSelected&&!t.annotationDragging)("multipleCommentPinSelected",t.commentPinSelected&&e.objectKeys(t.selectedAnnotationsMap).length>1)("targetElement",t.targetElement)("user",t.user)}}function Mjt(n,o){if(n&1){let t=q();C(0,"div",7),G("pointerup",function(i){return N(t),l(3).togglePinSelection(),F(i.stopPropagation())})("touchend",function(i){return N(t),i.stopPropagation(),F(i.preventDefault())})("mousedown",function(i){return N(t),F(i.stopPropagation())})("touchstart",function(i){return N(t),F(i.stopPropagation())})("pointerdown",function(i){return N(t),F(i.stopPropagation())})("click",function(i){return N(t),F(i.stopPropagation())})("cdkDragStarted",function(){N(t);let i=l(3);return F(i.onPinDragStart())})("cdkDragMoved",function(i){N(t);let r=l(3);return F(r.onPinMove(i))})("cdkDragReleased",function(){N(t);let i=l(3);return F(i.onPinRelease())}),C(1,"snippyly-comment-pin",8,1),G("togglePinSelection",function(i){N(t);let r=l(3);return F(r.togglePinSelection(i))})("saveComment",function(i){N(t);let r=l(3);return F(r.saveComment(i))}),S()()}if(n&2){let t,e=pe(2),i=l(2).ngIf,r=l();rt("top",i.annotationDragging?(i.dragPosition==null?null:i.dragPosition.top)-((e==null?null:e.COMMENT_PIN_SIZE)||40):(i.commentPinAnnotation==null||i.commentPinAnnotation.position==null?null:i.commentPinAnnotation.position.top)-((e==null?null:e.COMMENT_PIN_SIZE)||40)+i.offsetTop,"px")("left",i.annotationDragging?i.dragPosition==null?null:i.dragPosition.left:(i.commentPinAnnotation==null||i.commentPinAnnotation.position==null?null:i.commentPinAnnotation.position.left)+i.offsetLeft,"px")("--velt-comment-pin-transform",i.annotationDragging?"none":(t=i.pinTransform)!==null&&t!==void 0?t:"none")("transform",!i.annotationDragging&&(!(i.commentPinAnnotation==null||i.commentPinAnnotation.position==null)&&i.commentPinAnnotation.position.parentScaleX)?"scale("+1/((i.commentPinAnnotation==null||i.commentPinAnnotation.position==null?null:i.commentPinAnnotation.position.parentScaleX)||1)+", "+1/((i.commentPinAnnotation==null||i.commentPinAnnotation.position==null?null:i.commentPinAnnotation.position.parentScaleY)||1)+")":""),ge("pin-dragging",i.annotationDragging),c("id","comment-pin-container-"+(i.commentPinAnnotation==null?null:i.commentPinAnnotation.annotationId))("cdkDragDisabled",(i.commentPinAnnotation==null||i.commentPinAnnotation.from==null?null:i.commentPinAnnotation.from.userId)!==(i.user==null?null:i.user.userId)),x("data-testid",r.componentId+"-default")("role","button")("aria-expanded",i.commentPinSelected)("aria-grabbed",i.annotationDragging)("data-transform-inside",i.transformContext?"true":"false"),d(),c("annotation",i.commentPinAnnotation)("annotationDragging",i.annotationDragging)("containerComponentId",i.componentId)("commentPinSelected",i.commentPinSelected&&!i.annotationDragging)("multipleCommentPinSelected",i.commentPinSelected&&r.objectKeys(i.selectedAnnotationsMap).length>1)("targetElement",i.targetElement)("user",i.user)}}function kjt(n,o){if(n&1&&g(0,Mjt,3,24,"div",6),n&2){let t=l().ngIf;c("ngIf",t.commentPinAnnotation==null?null:t.commentPinAnnotation.position)}}function Rjt(n,o){if(n&1&&(f(0),g(1,Pjt,2,14,"div",3)(2,kjt,1,1,"ng-template",null,0,De),v()),n&2){let t=o.ngIf,e=pe(3);d(),c("ngIf",t.popoverMode)("ngIfElse",e)}}var H9=(()=>{let o=class o{constructor(e,i,r,a,s,m,p){this.analyticsService=e,this.authService=i,this.docService=r,this.domService=a,this.commentService=s,this.loggingService=m,this.elementRef=p,this.multipleCommentPinsSelected=!1,this.avatarErrorImage="",this.objectKeys=Object.keys,this.selectedAnnotationsLocationMap={},this.subscriptions=[],this.componentConfigSignal=Te({popoverMode:!1,commentPinAnnotation:void 0,commentPinSelected:!1,offsetLeft:0,offsetTop:0,selectedAnnotationsMap:{},annotationDragging:!1,dragPosition:null,targetElement:void 0,user:void 0,componentId:`comment-pin-portal-${Pn()}`}),this.veltElement=!0,this.componentId="velt-comment-pin-portal",this.subscriptions.push(this.authService.getUser$().subscribe(h=>{this.componentConfigSignal.update(_=>(_=T(I({},_),{user:h}),_))},h=>{this.catchError("Error in CommentPinPortalComponent getUser$ subscription: ",h)})),this.subscriptions.push(this.domService.getSelectedAnnotationsMap$().subscribe(h=>{this.componentConfigSignal.update(_=>(_=T(I({},_),{selectedAnnotationsMap:h}),_)),this.checkCommentPinSelected()},h=>{this.catchError("Error in CommentPinPortalComponent getSelectedAnnotationsMap$ subscription: ",h)})),this.subscriptions.push(this.domService.getSelectedAnnotationsLocationMap$().subscribe(h=>{this.selectedAnnotationsLocationMap=h||{},this.checkCommentPinSelected()},h=>{this.catchError("Error in CommentPinPortalComponent getSelectedAnnotationsLocationMap$ subscription: ",h)})),this.subscriptions.push(this.commentService.getPopoverMode$().subscribe(h=>{this.componentConfigSignal.update(_=>(_=T(I({},_),{popoverMode:h}),_))},h=>{this.catchError("Error in CommentPinPortalComponent getPopoverMode subscription: ",h)}))}ngOnInit(){try{this.setupA11yAttributes(),this.subscriptions.push(this.commentService.getTransformContext$().subscribe(e=>{this.componentConfigSignal.update(i=>{if(i=T(I({},i),{transformContext:e}),e&&this.isElementInsideTransformContainer(this.elementRef?.nativeElement,e.containerSelector)){let r=e.transforms.scale?1/e.transforms.scale:1;i.pinTransform=`scale(${r})`}else i.pinTransform=void 0;return i})}))}catch(e){this.loggingService.catch("Error in CommentPinPortalComponent ngOnInit:",e)}}isElementInsideTransformContainer(e,i){try{return document.querySelector(i)?.contains(e)??!1}catch(r){return this.loggingService.catch("Error in CommentPinPortalComponent isElementInsideTransformContainer:",r),!1}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentPinPortalComponent setupA11yAttributes:",e)}}setCommentPinAnnotation(e){try{this.componentConfigSignal.update(i=>(i=T(I({},i),{commentPinAnnotation:e}),i)),this.id=this.componentConfigSignal().commentPinAnnotation?.annotationId,this.checkCommentPinSelected()}catch(i){this.catchError("Error in CommentPinPortalComponent setCommentPinAnnotation: ",i)}}setSourceId(e){try{this.componentConfigSignal.update(i=>(i=T(I({},i),{sourceId:e}),i)),this.checkCommentPinSelected()}catch(i){this.catchError("Error in CommentPinPortalComponent setSourceId: ",i)}}getMultiThreadCommentAnnotations(){}checkCommentPinSelected(){try{let e=this.componentConfigSignal().selectedAnnotationsMap,i=this.componentConfigSignal().commentPinAnnotation,r=this.componentConfigSignal().sourceId;if(i){let a=!!e[i.annotationId];if(a)if(i?.isDraft)i?.sourceId&&(a=i?.sourceId===r,a&&this.domService.setSelectedAnnotationLocation(i.annotationId,this.componentConfigSignal().componentId));else{let s=this.selectedAnnotationsLocationMap?.[i.annotationId];s&&(a=s===this.componentConfigSignal().componentId)}a!==this.componentConfigSignal().commentPinSelected&&this.componentConfigSignal.update(s=>(s=T(I({},s),{commentPinSelected:a}),s))}}catch(e){this.catchError("Error in CommentPinPortalComponent checkCommentPinSelected: ",e)}}setTargetElement(e){try{this.componentConfigSignal.update(i=>(i=T(I({},i),{targetElement:e}),i))}catch(i){this.catchError("Error in CommentPinPortalComponent setTargetElement: ",i)}}setOffsetLeft(e){try{this.componentConfigSignal.update(i=>(i=T(I({},i),{offsetLeft:e}),i))}catch(i){this.catchError("Error in CommentPinPortalComponent setOffsetLeft: ",i)}}setOffsetTop(e){try{this.componentConfigSignal.update(i=>(i=T(I({},i),{offsetTop:e}),i))}catch(i){this.catchError("Error in CommentPinPortalComponent setOffsetTop: ",i)}}togglePinSelection(e){try{let i=e||this.componentConfigSignal().commentPinAnnotation;if(this.componentConfigSignal().selectedAnnotationsMap[i?.annotationId]&&this.selectedAnnotationsLocationMap?.[i?.annotationId]===this.componentConfigSignal().componentId)i?.ghostComment?.type!==Ws.DIFFERENT_DEVICE&&document.querySelector(`[${j.ATTRIBUTES.VELT_ANNOTATION_DRAFT}="${i?.annotationId}"]`)&&this.domService.resetSelectedAnnotationsMap(!0,"comments");else{let a=document.querySelector(`[${j.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);if(a||(a=(this.domService.getDraftCommentAnnotationDialogs()||[])[0]),a){let s=a.getAttribute(j.ATTRIBUTES.VELT_ANNOTATION_DRAFT);if(s){let m=document.getElementById(`comment-pin-container-${s}`)||document.querySelector(`[data-velt-id='${s}']`);m&&(m.scrollIntoView({behavior:"auto",block:"center",inline:"center"}),this.domService.resetSelectedAnnotationsMap(!0,"comments"))}}else this.domService.resetSelectedAnnotationsMap(!0,"comments"),this.componentConfigSignal().targetElement&&this.domService.isElementVisibleOnScreen(this.componentConfigSignal().targetElement)&&(this.componentConfigSignal().annotationDragging||this.domService.toggleAnnotationSelection(i,this.componentConfigSignal().componentId,void 0,!0))}}catch(i){this.catchError("Error in CommentPinPortalComponent togglePinSelection: ",i)}}onPinDragStart(){try{this.componentConfigSignal().selectedAnnotationsMap[this.componentConfigSignal().commentPinAnnotation.annotationId]&&this.componentConfigSignal().commentPinAnnotation?.ghostComment?.type!==Ws.DIFFERENT_DEVICE&&this.domService.toggleAnnotationSelection(this.componentConfigSignal().commentPinAnnotation,this.componentConfigSignal().componentId);let e=document.getElementById(this.componentConfigSignal().commentPinAnnotation.annotationId);if(!e)return;this.parentElement=e.parentElement;let i=this.componentConfigSignal().commentPinAnnotation.position,r=this.componentConfigSignal().transformContext,a=this.parentElement.getBoundingClientRect(),s=a.left+i.left,m=a.top+i.top,p=r&&this.isElementInsideTransformContainer(e,r.containerSelector);this.componentConfigSignal.update(h=>(h=T(I({},h),{elementInTransformedContainer:p}),h)),e.style.width="20px",e.style.height="20px",e.style.margin="0",e.style.padding="0",e.style.display="block",e.style.visibility="visible",e.style.opacity="1",e.style.backgroundColor="var(--velt-comment-pin-background-color, #2d62ff)",e.style.borderRadius="50%",e.style.boxShadow="0 2px 4px rgba(0, 0, 0, 0.2)",e.style.pointerEvents="auto",e.offsetWidth,document.body.appendChild(e),e.style.position="fixed",e.style.top=`${m}px`,e.style.left=`${s}px`,e.style.zIndex="10000",e.style.transform="none",e.offsetWidth,this.componentConfigSignal.update(h=>(h=T(I({},h),{annotationDragging:!0}),h))}catch(e){this.catchError("Error in CommentPinPortalComponent onPinDragStart: ",e)}}onPinMove(e){try{this.updateCurrentPinPosition(e)}catch(i){this.catchError("Error in CommentPinPortalComponent onPinMove: ",i)}}updateCurrentPinPosition(e){try{this.domService.removeHighlightFromElement(this.componentConfigSignal().targetElement);let i=e.event,r=i?.touches?.length?i.touches[0]?.clientX:i.clientX,a=i?.touches?.length?i.touches[0]?.clientY:i.clientY,s=this.componentConfigSignal().transformContext,m=this.domService.getBackgroundElement(r,a);m&&this.commentService.isElementInsideAllowedElements(m)&&(this.componentConfigSignal.update(p=>(p=T(I({},p),{targetElement:m}),p)),this.domService.highlightElement(this.componentConfigSignal().targetElement),this.pointerMoveEvent=e.event,this.componentConfigSignal.update(p=>(p=T(I({},p),{dragPosition:{top:a,left:r}}),p)))}catch(i){this.catchError("Error in CommentPinPortalComponent updateCurrentPinPosition: ",i)}}onPinRelease(){try{let e=document.getElementById(this.componentConfigSignal().commentPinAnnotation.annotationId);if(!e||!this.parentElement)return;this.domService.removeHighlightFromElement(this.componentConfigSignal().targetElement);let i=this.domService.getElementFromXPath(this.componentConfigSignal().commentPinAnnotation.targetElement?.xpath),r=this.componentConfigSignal().commentPinAnnotation?.targetElement;if(this.pointerMoveEvent){let oe=this.domService.getTargetElementForCursorPosition(this.pointerMoveEvent,!0,!0,!0,ue=>{if(this.commentService.getSvgAsImg()){let be=ue?.closest(`[${j.ATTRIBUTES.VELT_COMMENT_CONTAINER}]`);be&&be instanceof HTMLElement&&(ue=be)}return ue});oe&&(r=oe)}let a=this.domService.getElementFromXPath(r?.xpath),s=this.componentConfigSignal().commentPinAnnotation.targetElement?.xpath,m=r?.xpath,p=s===m;if(!a)return;let h=this.componentConfigSignal().dragPosition,_=a.getBoundingClientRect(),E=50,D=50;if(h){let oe=h.left-_.left,ue=h.top-_.top;E=oe/_.width*100,D=ue/_.height*100,E=Math.max(0,Math.min(100,E)),D=Math.max(0,Math.min(100,D))}let L=I({},this.componentConfigSignal().commentPinAnnotation);L.targetElement=I({},r),L.targetElement.leftPercentage=E,L.targetElement.topPercentage=D,this.commentService.calculateCommentAnnotationPosition(L),this.componentConfigSignal.update(oe=>(oe=T(I({},oe),{commentPinAnnotation:L,targetElement:a}),oe));let H=this.domService.isElementInsideAdditionalLocationContainer(i)||this.domService.isElementInsideAdditionalLocationContainer(a),K=this.docService.getAdditionalDocumentIdFromElement(a)||this.docService.getDocumentPaths()?.clientDocumentId;if(!this.componentConfigSignal().commentPinAnnotation?.metadata?.clientDocumentId||this.componentConfigSignal().commentPinAnnotation?.metadata?.clientDocumentId==K?(this.componentConfigSignal.update(oe=>(oe=T(I({},oe),{commentPinAnnotation:T(I({},oe.commentPinAnnotation),{targetElement:r})}),oe)),this.commentService.updateComment(this.componentConfigSignal().commentPinAnnotation,H)):this.componentConfigSignal.update(oe=>(oe=T(I({},oe),{targetElement:i}),oe)),p){let oe=this.componentConfigSignal().transformContext,ue=this.componentConfigSignal().elementInTransformedContainer,be=oe&&this.isElementInsideTransformContainer(a,oe.containerSelector);this.componentConfigSignal.update(qe=>(qe=T(I({},qe),{elementInTransformedContainer:be}),qe));let Le=e.getBoundingClientRect();if(!ue&&be){e.style.transition="none";let qe=Le.top,Re=Le.left;this.parentElement.appendChild(e),e.style.position="fixed",e.style.top=`${qe}px`,e.style.left=`${Re}px`,e.offsetWidth,requestAnimationFrame(()=>{e.style.position="absolute",be&&L.position.transformContext?(e.style.top=`${L.position.top}px`,e.style.left=`${L.position.left}px`,L.position.transformContext.scale!==1&&(e.style.transform=`scale(${1/L.position.transformContext.scale})`)):(e.style.top=`${L.position.top}px`,e.style.left=`${L.position.left}px`)})}else e.style.transition="none",this.parentElement.appendChild(e),e.style.position="absolute",e.style.width="20px",e.style.height="20px",e.style.backgroundColor="var(--velt-comment-pin-background-color, #2d62ff)",e.style.borderRadius="50%",e.style.boxShadow="0 2px 4px rgba(0, 0, 0, 0.2)",e.style.visibility="visible",e.style.display="block",e.offsetWidth,be&&L.position.transformContext?(e.style.top=`${L.position.top}px`,e.style.left=`${L.position.left}px`):(e.style.top=`${L.position.top}px`,e.style.left=`${L.position.left}px`);e.offsetWidth,this.componentConfigSignal.update(qe=>(qe=T(I({},qe),{annotationDragging:!1,dragPosition:null}),qe))}this.analyticsService.trackEvent(X.Events.Comments.COMMENT_PIN_DRAGGED,{annotationId:this.componentConfigSignal().commentPinAnnotation.annotationId,commentMode:this.commentService.getCommentMode()})}catch(e){this.catchError("Error in CommentPinPortalComponent onPinRelease: ",e)}}saveComment(e){try{this.commentService.saveComment(this.componentConfigSignal().commentPinAnnotation,e)}catch(i){this.catchError("Error in CommentPinPortalComponent saveComment: ",i)}}ngOnDestroy(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnDestroy","color: green;");try{this.unsubscribe()}catch(e){this.catchError("Error in CommentPinPortalComponent ondestroy: ",e)}}unsubscribe(){this.loggingService.log("%c[WB] Calling FUNCTION: unsubscribe","color: green;");try{this.subscriptions.map(e=>{e.unsubscribe()}),this.subscriptions=[]}catch(e){this.catchError("Error in CommentPinPortalComponent unsubscribe: ",e)}}catchError(e,i,r){try{this.loggingService.catch(e,i,T(I({},r||{}),{annotationId:this.componentConfigSignal()?.commentPinAnnotation?.annotationId}))}catch{}}};o.\u0275fac=function(i){return new(i||o)(u(Ze),u(He),u(lt),u(Ne),u(we),u(y),u(k))},o.\u0275cmp=O({type:o,selectors:[["snippyly-comment-pin-portal"]],hostVars:2,hostBindings:function(i,r){i&2&&(xa("id",r.id),x("data-velt-element",r.veltElement))},inputs:{multipleCommentPinsSelected:"multipleCommentPinsSelected",avatarErrorImage:"avatarErrorImage"},standalone:!1,decls:1,vars:1,consts:[["defaultPinPortalRef",""],["commentPinRef",""],[4,"ngIf"],["class","comment-pin-portal",3,"id","top","left","pointerup","click","cdkDragStarted",4,"ngIf","ngIfElse"],[1,"comment-pin-portal",3,"pointerup","click","cdkDragStarted","id"],[3,"saveComment","commentTargetElementClicked","togglePinSelection","annotation","containerComponentId","commentPinSelected","multipleCommentPinSelected","targetElement","user"],["class","comment-pin-portal","cdkDrag","","cdkDragHandle","",3,"id","pin-dragging","top","left","--velt-comment-pin-transform","transform","cdkDragDisabled","pointerup","touchend","mousedown","touchstart","pointerdown","click","cdkDragStarted","cdkDragMoved","cdkDragReleased",4,"ngIf"],["cdkDrag","","cdkDragHandle","",1,"comment-pin-portal",3,"pointerup","touchend","mousedown","touchstart","pointerdown","click","cdkDragStarted","cdkDragMoved","cdkDragReleased","id","cdkDragDisabled"],[3,"togglePinSelection","saveComment","annotation","annotationDragging","containerComponentId","commentPinSelected","multipleCommentPinSelected","targetElement","user"]],template:function(i,r){i&1&&g(0,Rjt,4,2,"ng-container",2),i&2&&c("ngIf",r.componentConfigSignal())},styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}[_nghost-%COMP%]{position:absolute!important;top:0!important;left:0!important;box-sizing:border-box!important;-webkit-tap-highlight-color:rgba(255,255,255,0)!important;outline:none!important;margin:0!important;padding:0!important;height:unset!important;width:unset!important;text-align:left!important;z-index:var(--velt-comment-pin-z-index)!important}*[_ngcontent-%COMP%]{box-sizing:border-box;-webkit-tap-highlight-color:rgba(255,255,255,0)!important;outline:none!important;margin:0!important;padding:0!important;height:unset;width:unset;text-align:left!important;line-height:1.5!important;color:#000!important;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit));-webkit-text-fill-color:initial!important}*[_ngcontent-%COMP%]:empty{display:revert!important}.comment-pin-portal[_ngcontent-%COMP%]{position:absolute;transform:var(--velt-comment-pin-transform, none)!important;transform-origin:0 100%!important;transform-box:fill-box!important;top:0;left:0}.comment-pin-portal.pin-dragging[_ngcontent-%COMP%]{position:fixed;z-index:var(--velt-comment-pin-z-index)!important}"],changeDetection:0});let n=o;return n})();var z9=(()=>{let o=class o{constructor(e,i,r,a,s,m){this.commentService=e,this.domService=i,this.componentFactoryResolver=r,this.injector=a,this.appRef=s,this.loggingService=m,this.commentsPinById={},this.commentPinTemplate$=new Ce(null),this.customPinEvents$=new Ke}setCommentPin(e){try{if(!this.commentsPinById[e.annotationId])this.setPinPortal(e);else{let i=!1;if(e?.ghostComment?i=e?.ghostComment?.targetElement?.xpath!==this.commentsPinById[e.annotationId]?.[0]?.annotation?.ghostComment?.targetElement?.xpath:this.commentsPinById[e.annotationId]?.[0]?.annotation?.ghostComment?i=!0:i=e.targetElement?.xpath!==this.commentsPinById[e.annotationId]?.[0]?.annotation?.targetElement?.xpath,!i)this.commentsPinById[e.annotationId]?.forEach(r=>{let a=r.portalRef,s=r.userTargetElement,m=r.pinHostElement;if(document.body.contains(s)&&document.body.contains(m))a&&(a.instance.setCommentPinAnnotation(e),this.updateElementOffset(e));else{let p=r.pinHostDomPortalOutlet;p&&(this.removeCommentPinHostAttributes(e.annotationId,r.pinHostElement),this.removeCommentDisabledAttribute(m),p.detach(),delete this.commentsPinById[e.annotationId],e.ghostComment&&this.unselectCommentAnnotation(e),this.setPinPortal(e))}});else{let r=this.commentsPinById[e.annotationId]?.[0]?.pinHostDomPortalOutlet;r&&(this.removeCommentPinHostAttributes(e.annotationId,this.commentsPinById[e.annotationId]?.[0]?.pinHostElement),this.removeCommentDisabledAttribute(this.commentsPinById[e.annotationId]?.[0]?.pinHostElement),r.detach(),delete this.commentsPinById[e.annotationId],e.ghostComment&&this.unselectCommentAnnotation(e),this.setPinPortal(e))}}}catch(i){this.loggingService.catch("Error in CommentPinPortalService setCommentPin: ",i)}}unselectCommentAnnotation(e){try{this.loggingService.log("%c[WB] Calling CommentPinPortalService FUNCTION: unselectCommentAnnotation","color: green;"),this.domService.getSelectedAnnotationsMap()?.[e?.annotationId]&&this.domService.toggleAnnotationSelection(e)}catch(i){this.loggingService.catch("Error in CommentPinPortalService unselectCommentAnnotation: ",i)}}setPinPortal(e){try{let i=this.commentService.getElementFromComments(e);i.length>0&&(this.commentsPinById[e.annotationId]=[],i.forEach(r=>{if(r){let a=this.domService.getHostElement(r),s=new Lo(H9),m=new Bo(a,this.componentFactoryResolver,this.appRef,this.injector),p=m.attach(s);p.instance.setCommentPinAnnotation(e),p.instance.setTargetElement(r);let h=r?.getAttribute(j.ATTRIBUTES.VELT_SOURCE_ID);h&&p.instance.setSourceId(h),this.commentsPinById[e.annotationId].push({pinHostDomPortalOutlet:m,pinPortal:s,portalRef:p,annotation:JSON.parse(JSON.stringify(e)),userTargetElement:r,pinHostElement:a}),this.setCommentPinHostAttributes(e.annotationId,a),this.setCommentDisabledAttribute(a),this.updateElementOffset(e)}}))}catch(i){this.loggingService.catch("Error in CommentPinPortalService setPinPortal: ",i)}}setCommentPinHostAttributes(e,i){try{let r=i.getAttribute(j.ATTRIBUTES.VELT_COMMENT_PIN_HOST);if(r){let a=r.split(",");a.includes(e)||(a.push(e),i.setAttribute(j.ATTRIBUTES.VELT_COMMENT_PIN_HOST,a.join(",")))}else i.setAttribute(j.ATTRIBUTES.VELT_COMMENT_PIN_HOST,e);window.getComputedStyle(i).position==="static"&&(Sm(i)||i.setAttribute(j.ATTRIBUTES.VELT_COMMENT_PIN_HOST_STATIC,"true"))}catch(r){this.loggingService.catch("Error in CommentPinPortalService setCommentPinHostAttributes: ",r)}}removeCommentPinHostAttributes(e,i){try{let r=i.getAttribute(j.ATTRIBUTES.VELT_COMMENT_PIN_HOST);if(r){let a=r.split(","),s=a.indexOf(e);s>-1&&(a.splice(s,1),a.length>0?i.setAttribute(j.ATTRIBUTES.VELT_COMMENT_PIN_HOST,a.join(",")):i.removeAttribute(j.ATTRIBUTES.VELT_COMMENT_PIN_HOST))}i?.getAttribute(j.ATTRIBUTES.VELT_COMMENT_PIN_HOST)||i.removeAttribute(j.ATTRIBUTES.VELT_COMMENT_PIN_HOST_STATIC)}catch(r){this.loggingService.catch("Error in CommentPinPortalService removeCommentPinHostAttributes: ",r)}}setCommentDisabledAttribute(e){try{this.commentService.getPopoverMode()&&e.setAttribute(j.ATTRIBUTES.VELT_COMMENT_DISABLED,"auto")}catch(i){this.loggingService.catch("Error in CommentPinPortalService setCommentDisabledAttribute: ",i)}}removeCommentDisabledAttribute(e){try{e?.getAttribute(j.ATTRIBUTES.VELT_COMMENT_DISABLED)==="auto"&&e.removeAttribute(j.ATTRIBUTES.VELT_COMMENT_DISABLED)}catch(i){this.loggingService.catch("Error in CommentPinPortalService removeCommentDisabledAttribute: ",i)}}updateElementOffset(e){try{for(let i of this.commentsPinById[e.annotationId]){let{portalRef:r,userTargetElement:a,pinHostElement:s}=i,m=this.domService.getElementOffset(a,s);r.instance.setOffsetLeft(m.offsetLeft),r.instance.setOffsetTop(m.offsetTop)}}catch(i){this.loggingService.catch("Error in CommentPinPortalService updateElementOffset: ",i)}}checkPinsToRemove(e){try{let i=e.map(r=>r.annotationId);Object.keys(this.commentsPinById).forEach(r=>{i.includes(r)||(this.commentService.customPinsById.has(r)&&this.commentService.customPinsById.delete(r),this.commentsPinById[r].forEach(s=>{s.pinHostDomPortalOutlet.detach(),this.removeCommentPinHostAttributes(r,s.pinHostElement),this.removeCommentDisabledAttribute(s.pinHostElement),this.domService.removeHighlightFromElement(s.pinHostElement),s.userTargetElement&&this.domService.removeHighlightFromElement(s.userTargetElement)}),delete this.commentsPinById[r])})}catch(i){this.loggingService.catch("Error in CommentPinPortalService checkPinsToRemove: ",i)}}setCommentPinOverrideTemplate(e){this.commentPinTemplate$.next(e)}getCommentPinTemplate$(){return this.commentPinTemplate$}emitCustomPinEvent(e){try{let{element:i,annotation:r}=e;r&&this.commentService.customPinsById.set(r.annotationId,i),this.customPinEvents$.next(e)}catch(i){this.loggingService.catch("Error in CommentPinPortalService emitCustomPinEvent",i)}}getCustomPinEvents$(){return this.customPinEvents$}};o.\u0275fac=function(i){return new(i||o)(J(we),J(Ne),J(xo),J(xt),J(di),J(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var ne=(()=>{let o=class o{set veltDynamicTemplate({template:e,context:i,id:r,cloneTemplate:a,componentName:s,variant:m,suffix:p,setIfCondition:h,componentElementRef:_,replaceTemplate:E=!0}){try{if(p&&(s+=`--${p}`),m&&(s+=`---${m}`),s){let D=this.wireframeService.getConditionElement(s);if(!D&&e&&(D=e),D){let L=D?.getAttribute("velt-if");L&&h&&h(L),Array.from(D.attributes).forEach(H=>{_?.nativeElement.setAttribute(H.name,H.value)}),i?.componentConfigSignal?this.dynamicDataService.applyConditionalClasses(_?.nativeElement,i):this.dynamicDataService.applyConditionalClasses(_?.nativeElement)}}if(s&&!e){let D=this.wireframeService.getWireframe(s);if(D){let L=document.createElement(D.tagName);L.innerHTML=D.innerHTML,this.template=L}}else this.template=e;this.data=i,this.id=r,this.cloneTemplate=!!a,this.cloneTemplate&&e&&(this.template=this.domService.deepCloneElement(e)),this.checkToUpdateTemplate(E)}catch(D){this.loggingService.warn("Error in DynamicTemplateDirective veltDynamicTemplate: ",D)}}constructor(e,i,r,a,s,m,p,h){this.elementRef=e,this.templateRef=i,this.viewContainer=r,this.dynamicComponentService=a,this.loggingService=s,this.domService=m,this.wireframeService=p,this.dynamicDataService=h,this.directiveId=Math.random().toString(36).substring(7),this.isCustomTemplateMode=!1,this.isDefaultTemplateMode=!1,this.cloneTemplate=!1,this.injectedElements=[],this.componentRefs=[];try{this.loggingService.log("%c[WB] Creating CLASS: DynamicTemplateDirective","color: blue;")}catch(_){this.loggingService.catch("Error in DynamicTemplateDirective constructor: ",_)}}checkDataValue(e,i){let r=e.querySelectorAll("[data-velt]");function a(s,m){return m.split(".").reduce((p,h)=>p&&p[h],s)}r.forEach(s=>{let m=s.getAttribute("data-velt");if(m&&i){let p=a(i,m);s instanceof HTMLElement&&(s.innerText=JSON.stringify(p,null,2))}})}checkToUpdateTemplate(e){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: checkToUpdateTemplate","color: green;"),this.template&&e)if(this.isDefaultTemplateMode=!1,this.isCustomTemplateMode)this.updateDataOnComponentRefs(this.data);else{this.isCustomTemplateMode=!0,this.cleanUp();let i=document.createElement(this.template.tagName);i.innerHTML=this.template.innerHTML,this.injectElementNextToSibling(this.elementRef.nativeElement,i)}else this.isCustomTemplateMode=!1,this.isDefaultTemplateMode||(this.cleanUp(),this.viewContainer.createEmbeddedView(this.templateRef),this.isDefaultTemplateMode=!0)}catch(i){this.loggingService.catch("Error in DynamicTemplateDirective checkToUpdateTemplate: ",i)}}injectElementNextToSibling(e,i){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: injectElementNextToSibling","color: green;"),!i)return;this.cleanUp();let r=i;for(let s=0;s<r.children.length;s++){let m=r.children[s],p=this.dynamicComponentService.processAndReplaceVeltComponents(m,this.data,this.id?this.id:`from-directive-${this.directiveId}`,[],"from directive");p?.length&&this.componentRefs.push(...p)}r.setAttribute("data-velt-added-from-directive","true"),this.customTemplate=r;let a=Array.from(r.childNodes).reverse();e.nextSibling&&e.nextSibling&&e.nextSibling.getAttribute&&e.nextSibling.getAttribute("data-velt-added-from-directive")&&e.parentNode.removeChild(e.nextSibling),a.forEach(s=>{e.parentNode.insertBefore(s,e.nextSibling),s instanceof Element&&this.injectedElements.push(s)}),r.remove()}catch(r){this.loggingService.catch("Error in DynamicTemplateDirective injectElementNextToSibling: ",r)}}updateDataOnComponentRefs(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: updateDataOnComponentRefs","color: green;"),this.componentRefs.forEach(i=>{this.dynamicComponentService.setCommentRefData(e,i)})}catch(i){this.loggingService.catch("Error in DynamicTemplateDirective updateDataOnComponentRefs: ",i)}}ngOnDestroy(){try{this.cleanUp()}catch(e){this.loggingService.catch("Error in DynamicTemplateDirective ngOnDestroy: ",e)}}cleanUp(){try{this.componentRefs.forEach(e=>{e.destroy()}),this.injectedElements.forEach(e=>{e.remove()}),this.injectedElements=[],this.viewContainer.clear()}catch(e){this.loggingService.catch("Error in DynamicTemplateDirective cleanUp: ",e)}}};o.\u0275fac=function(i){return new(i||o)(u(k),u(So),u(Si),u(r_),u(y),u(Ne),u(ze),u(b))},o.\u0275dir=Bt({type:o,selectors:[["","veltDynamicTemplate",""]],inputs:{veltDynamicTemplate:"veltDynamicTemplate"},standalone:!1});let n=o;return n})();function Njt(n,o){if(n&1&&w(0,"div",7),n&2){let t=l(2);x("data-testid",t.componentId+"-unread-indicator")("aria-hidden","true")}}function Fjt(n,o){if(n&1&&(f(0),C(1,"div",1)(2,"div",2),le(),C(3,"svg",3),A(4,"translate"),w(5,"path",4),S(),g(6,Njt,1,2,"div",5),S(),mt(),C(7,"span",6),te(8),S()(),v()),n&2){let t=o.ngIf,e=l();d(),x("data-testid",e.componentId)("role","status"),d(),x("data-testid",e.componentId+"-unread-container")("aria-hidden",!(t!=null&&t.unreadAnnotationCount)),d(),x("role","img")("aria-label",P(4,11,"Comment icon"))("focusable","false"),d(3),c("ngIf",t==null?null:t.unreadAnnotationCount),d(),x("data-testid",e.componentId+"-count")("aria-hidden","true"),d(),je(t==null?null:t.count)}}var Tfe=(()=>{let o=class o extends nt{constructor(e,i,r,a,s){super(s,a,void 0,e),this.commentService=e,this.loggingService=i,this.customFilterService=r,this.themeService=a,this.elementRef=s,this.componentConfigSignal=Te({unreadCommentsMap:null,count:0}),this.subscription=[],this.componentId="velt-comment-pin-bubble";try{this.subscription.push(this.commentService.getUnreadCommentsMap$().subscribe(m=>{this.componentConfigSignal.update(p=>(p=I({},p),p.unreadCommentsMap=m,p))}))}catch(m){this.catchError("Error in CommentPinBubbleComponent constructor: ",m)}}ngOnInit(){try{this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentPinBubbleComponent ngOnInit:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentPinBubbleComponent setupA11yAttributes:",e)}}ngOnChanges(e){super.ngOnChanges(e);try{e&&Object.keys(e).forEach(i=>{this.componentConfigSignal.update(r=>{if(r=T(I({},r),{[i]:e[i].currentValue}),i==="annotation")if(r?.annotation?.type==="multiThread"){let a=Object.keys(r.unreadCommentsMap||{});r?.annotation?.commentAnnotationsMap&&(r.count=0,Object.values(r?.annotation?.commentAnnotationsMap||{}).forEach(s=>{s?.status?.id!==this.customFilterService.resolvedStatus?.id&&(r.count=(r?.count||0)+1),a.includes(s.annotationId)&&(r.unreadAnnotationCount=(r.unreadAnnotationCount||0)+1)}))}else r.count=r?.annotation?.comments?.length;return r})})}catch{}}ngOnDestroy(){super.ngOnDestroy();try{this.subscription.forEach(e=>e.unsubscribe())}catch(e){this.catchError("Error in CommentPinBubbleComponent ngOnDestroy: ",e)}}catchError(e,i,r){try{this.loggingService.catch(e,i,T(I({},r||{}),{annotationId:this.componentConfigSignal()?.annotation?.annotationId}))}catch{}}};o.\u0275fac=function(i){return new(i||o)(u(we),u(y),u(zo),u(Ye),u(k))},o.\u0275cmp=O({type:o,selectors:[["velt-comment-pin-bubble-internal"]],inputs:{annotation:"annotation"},standalone:!1,features:[B,Xe],decls:1,vars:1,consts:[[4,"ngIf"],[1,"velt-comment-pin-bubble-container"],[1,"velt-comment-pin-bubble--unread-indicator-container"],["width","16","height","16","viewBox","0 0 16 16","fill","none","xmlns","http://www.w3.org/2000/svg"],["d","M12.6666 1.33325H3.33325C2.80282 1.33325 2.29411 1.54397 1.91904 1.91904C1.54397 2.29411 1.33325 2.80282 1.33325 3.33325V9.99992C1.33325 10.5304 1.54397 11.0391 1.91904 11.4141C2.29411 11.7892 2.80282 11.9999 3.33325 11.9999H11.0599L13.5266 14.4733C13.5889 14.535 13.6628 14.5839 13.744 14.6171C13.8252 14.6503 13.9122 14.6671 13.9999 14.6666C14.0874 14.6688 14.1741 14.6506 14.2533 14.6133C14.375 14.5632 14.4792 14.4783 14.5528 14.3692C14.6263 14.26 14.6659 14.1315 14.6666 13.9999V3.33325C14.6666 2.80282 14.4559 2.29411 14.0808 1.91904C13.7057 1.54397 13.197 1.33325 12.6666 1.33325ZM13.3333 12.3933L11.8066 10.8599C11.7443 10.7981 11.6704 10.7492 11.5892 10.7161C11.508 10.6829 11.421 10.6661 11.3333 10.6666H3.33325C3.15644 10.6666 2.98687 10.5963 2.86185 10.4713C2.73682 10.3463 2.66659 10.1767 2.66659 9.99992V3.33325C2.66659 3.15644 2.73682 2.98687 2.86185 2.86185C2.98687 2.73682 3.15644 2.66659 3.33325 2.66659H12.6666C12.8434 2.66659 13.013 2.73682 13.138 2.86185C13.263 2.98687 13.3333 3.15644 13.3333 3.33325V12.3933Z","fill","currentColor"],["class","velt-comment-pin-bubble--unread-indicator",4,"ngIf"],[1,"velt-comment-pin-bubble--count"],[1,"velt-comment-pin-bubble--unread-indicator"]],template:function(i,r){i&1&&g(0,Fjt,9,13,"ng-container",0),i&2&&c("ngIf",r.componentConfigSignal())},dependencies:[Z,de],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}[_nghost-%COMP%]{--velt-green: var(--velt-light-mode-green);--velt-magenta: var(--velt-light-mode-magenta);--velt-amber: var(--velt-light-mode-amber);--velt-purple: var(--velt-light-mode-purple);--velt-cyan: var(--velt-light-mode-cyan);--velt-orange: var(--velt-light-mode-orange);--velt-black: var(--velt-light-mode-black);--velt-white: var(--velt-light-mode-white);--velt-gray: var(--velt-light-mode-gray);--velt-error: var(--velt-light-mode-error);--velt-error-hover: var(--velt-light-mode-error-hover);--velt-error-foreground: var(--velt-light-mode-error-foreground);--velt-error-light: var(--velt-light-mode-error-light);--velt-error-transparent: var(--velt-light-mode-error-transparent);--velt-warning: var(--velt-light-mode-warning);--velt-warning-hover: var(--velt-light-mode-warning-hover);--velt-warning-foreground: var(--velt-light-mode-warning-foreground);--velt-warning-light: var(--velt-light-mode-warning-light);--velt-warning-transparent: var(--velt-light-mode-warning-transparent);--velt-success: var(--velt-light-mode-success);--velt-success-hover: var(--velt-light-mode-success-hover);--velt-success-foreground: var(--velt-light-mode-success-foreground);--velt-success-light: var(--velt-light-mode-success-light);--velt-success-transparent: var(--velt-light-mode-success-transparent);--velt-accent: var(--velt-light-mode-accent);--velt-accent-text: var(--velt-light-mode-accent-text);--velt-accent-hover: var(--velt-light-mode-accent-hover);--velt-accent-foreground: var(--velt-light-mode-accent-foreground);--velt-accent-light: var(--velt-light-mode-accent-light);--velt-accent-transparent: var(--velt-light-mode-accent-transparent);--velt-text-0: var(--velt-light-mode-text-0);--velt-text-1: var(--velt-light-mode-text-1);--velt-text-2: var(--velt-light-mode-text-2);--velt-text-3: var(--velt-light-mode-text-3);--velt-text-4: var(--velt-light-mode-text-4);--velt-text-5: var(--velt-light-mode-text-5);--velt-text-6: var(--velt-light-mode-text-6);--velt-text-7: var(--velt-light-mode-text-7);--velt-text-8: var(--velt-light-mode-text-8);--velt-text-9: var(--velt-light-mode-text-9);--velt-text-10: var(--velt-light-mode-text-10);--velt-text-11: var(--velt-light-mode-text-11);--velt-text-12: var(--velt-light-mode-text-12);--velt-background-0: var(--velt-light-mode-background-0);--velt-background-1: var(--velt-light-mode-background-1);--velt-background-2: var(--velt-light-mode-background-2);--velt-background-3: var(--velt-light-mode-background-3);--velt-background-4: var(--velt-light-mode-background-4);--velt-background-5: var(--velt-light-mode-background-5);--velt-background-6: var(--velt-light-mode-background-6);--velt-background-7: var(--velt-light-mode-background-7);--velt-background-8: var(--velt-light-mode-background-8);--velt-background-9: var(--velt-light-mode-background-9);--velt-background-10: var(--velt-light-mode-background-10);--velt-border-0: var(--velt-light-mode-border-0);--velt-border-1: var(--velt-light-mode-border-1);--velt-border-2: var(--velt-light-mode-border-2);--velt-border-3: var(--velt-light-mode-border-3);--velt-border-4: var(--velt-light-mode-border-4);--velt-border-5: var(--velt-light-mode-border-5);--velt-border-6: var(--velt-light-mode-border-6);--velt-border-7: var(--velt-light-mode-border-7);--velt-border-8: var(--velt-light-mode-border-8);--velt-border-9: var(--velt-light-mode-border-9);--velt-border-10: var(--velt-light-mode-border-10);--velt-background-transparent: var(--velt-light-mode-background-transparent);--velt-border-transparent: var(--velt-light-mode-border-transparent);--velt-animation-transparent: var(--velt-light-mode-animation-transparent);display:flex;cursor:pointer}[dark][_nghost-%COMP%]{--velt-green: var(--velt-dark-mode-green);--velt-magenta: var(--velt-dark-mode-magenta);--velt-amber: var(--velt-dark-mode-amber);--velt-purple: var(--velt-dark-mode-purple);--velt-cyan: var(--velt-dark-mode-cyan);--velt-orange: var(--velt-dark-mode-orange);--velt-black: var(--velt-dark-mode-black);--velt-white: var(--velt-dark-mode-white);--velt-gray: var(--velt-dark-mode-gray);--velt-error: var(--velt-dark-mode-error);--velt-error-hover: var(--velt-dark-mode-error-hover);--velt-error-foreground: var(--velt-dark-mode-error-foreground);--velt-error-light: var(--velt-dark-mode-error-light);--velt-error-transparent: var(--velt-dark-mode-error-transparent);--velt-warning: var(--velt-dark-mode-warning);--velt-warning-hover: var(--velt-dark-mode-warning-hover);--velt-warning-foreground: var(--velt-dark-mode-warning-foreground);--velt-warning-light: var(--velt-dark-mode-warning-light);--velt-warning-transparent: var(--velt-dark-mode-warning-transparent);--velt-success: var(--velt-dark-mode-success);--velt-success-hover: var(--velt-dark-mode-success-hover);--velt-success-foreground: var(--velt-dark-mode-success-foreground);--velt-success-light: var(--velt-dark-mode-success-light);--velt-success-transparent: var(--velt-dark-mode-success-transparent);--velt-accent: var(--velt-dark-mode-accent);--velt-accent-text: var(--velt-dark-mode-accent-text);--velt-accent-hover: var(--velt-dark-mode-accent-hover);--velt-accent-foreground: var(--velt-dark-mode-accent-foreground);--velt-accent-light: var(--velt-dark-mode-accent-light);--velt-accent-transparent: var(--velt-dark-mode-accent-transparent);--velt-text-0: var(--velt-dark-mode-text-0);--velt-text-1: var(--velt-dark-mode-text-1);--velt-text-2: var(--velt-dark-mode-text-2);--velt-text-3: var(--velt-dark-mode-text-3);--velt-text-4: var(--velt-dark-mode-text-4);--velt-text-5: var(--velt-dark-mode-text-5);--velt-text-6: var(--velt-dark-mode-text-6);--velt-text-7: var(--velt-dark-mode-text-7);--velt-text-8: var(--velt-dark-mode-text-8);--velt-text-9: var(--velt-dark-mode-text-9);--velt-text-10: var(--velt-dark-mode-text-10);--velt-text-11: var(--velt-dark-mode-text-11);--velt-text-12: var(--velt-dark-mode-text-12);--velt-background-0: var(--velt-dark-mode-background-0);--velt-background-1: var(--velt-dark-mode-background-1);--velt-background-2: var(--velt-dark-mode-background-2);--velt-background-3: var(--velt-dark-mode-background-3);--velt-background-4: var(--velt-dark-mode-background-4);--velt-background-5: var(--velt-dark-mode-background-5);--velt-background-6: var(--velt-dark-mode-background-6);--velt-background-7: var(--velt-dark-mode-background-7);--velt-background-8: var(--velt-dark-mode-background-8);--velt-background-9: var(--velt-dark-mode-background-9);--velt-background-10: var(--velt-dark-mode-background-10);--velt-border-0: var(--velt-dark-mode-border-0);--velt-border-1: var(--velt-dark-mode-border-1);--velt-border-2: var(--velt-dark-mode-border-2);--velt-border-3: var(--velt-dark-mode-border-3);--velt-border-4: var(--velt-dark-mode-border-4);--velt-border-5: var(--velt-dark-mode-border-5);--velt-border-6: var(--velt-dark-mode-border-6);--velt-border-7: var(--velt-dark-mode-border-7);--velt-border-8: var(--velt-dark-mode-border-8);--velt-border-9: var(--velt-dark-mode-border-9);--velt-border-10: var(--velt-dark-mode-border-10);--velt-background-transparent: var(--velt-dark-mode-background-transparent);--velt-border-transparent: var(--velt-dark-mode-border-transparent);--velt-animation-transparent: var(--velt-dark-mode-animation-transparent)}.velt-comment-pin-bubble-container[_ngcontent-%COMP%]{display:flex;padding:var(--velt-spacing-xs);align-items:center;border-radius:var(--velt-border-radius-sm);box-shadow:0 0 1px #4551613d,0 2px 4px #45516124;color:var(--velt-accent-text);gap:var(--velt-spacing-xs);background-color:var(--velt-background-0);font-family:var(--velt-default-font-family)}.velt-comment-pin-bubble--unread-indicator-container[_ngcontent-%COMP%]{position:relative;display:flex}.velt-comment-pin-bubble--unread-indicator[_ngcontent-%COMP%]{position:absolute;top:-2px;right:-2px;display:block;width:8px;height:8px;margin-left:var(--velt-spacing-xs);border-radius:var(--velt-border-radius-full);background-color:var(--velt-error);color:var(--velt-error-foreground)}"],changeDetection:0});let n=o;return n})();var Bjt=["commentDialogOverlay"],Vjt=["commentPinBubbleOverlay"],Ujt=["*"],jjt=()=>["snippyly-overlay-panel","velt-comment-pin-bubble-overlay-panel"],Dfe=n=>({trigger:n}),$jt=()=>["snippyly-overlay-panel","velt-comment-dialog-overlay-panel"];function Hjt(n,o){n&1&&Ue(0)}function zjt(n,o){if(n&1&&(f(0),g(1,Hjt,1,0,"ng-container",13),v()),n&2){l();let t=pe(1);l(2);let e=pe(9);d(),c("ngTemplateOutlet",e)("ngTemplateOutletContext",M(2,Dfe,t))}}function Gjt(n,o){if(n&1){let t=q();C(0,"div",11,4),A(2,"translate"),G("click",function(i){return N(t),F(i.preventDefault())})("pointerenter",function(i){return N(t),l(3).onBubblePointerOver(i),F(i.stopPropagation())})("pointerleave",function(){N(t);let i=l(3);return F(i.onBubblePointerOut())})("pointerup",function(){N(t);let i=l(3);return F(i.onPointerUpOnBubble())}),C(3,"velt-comment-pin-bubble-internal",12),G("afterViewInit",function(){N(t);let i=l(3);return F(i.onBubbleAfterViewInit())})("onDestroy",function(){N(t);let i=l(3);return F(i.onBubbleOnDestroy())}),S()(),g(4,zjt,2,4,"ng-container",6)}if(n&2){let t=l(2).ngIf;x("role","button")("aria-expanded",t.commentBubbleHover)("aria-label",P(2,5,"Comment bubble")),d(3),c("annotation",t.annotation),d(),c("ngIf",t.isBubbleInitialized)}}function Wjt(n,o){if(n&1){let t=q();f(0),g(1,Gjt,5,7,"ng-template",10,3,De),G("positionChange",function(i){N(t);let r=l(2);return F(r.onCommentPinBubblePositionChange(i))}),v()}if(n&2){let t=l().ngIf,e=pe(2);d(),c("cdkConnectedOverlayOrigin",e)("cdkConnectedOverlayOpen",!t.annotationDragging&&!!(t!=null&&t.user)&&(t.bubbleOnPinHover&&t.commentPinHover||t.commentBubbleHover||t.commentPinSelected))("cdkConnectedOverlayPanelClass",Nt(10,jjt))("cdkConnectedOverlayOffsetY",t.popoverMode?0:t.commentPinBubbleOverlayOriginY==="top"?-8:2)("cdkConnectedOverlayOffsetX",t.popoverMode?t.commentPinBubbleOverlayOriginX==="end"?4:0:t.showCommentIndex&&t.commentPinBubbleOverlayOriginX==="end"?8:0)("cdkConnectedOverlayBackdropClass","velt-overlay-backdrop")("cdkConnectedOverlayLockPosition",!1)("cdkConnectedOverlayPositions",t.positions)("cdkConnectedOverlayGrowAfterOpen",!0)("cdkConnectedOverlayDisableClose",!0)}}function qjt(n,o){n&1&&Ue(0)}function Yjt(n,o){if(n&1&&g(0,qjt,1,0,"ng-container",13),n&2){l();let t=pe(2),e=pe(9);c("ngTemplateOutlet",e)("ngTemplateOutletContext",M(2,Dfe,t))}}function Kjt(n,o){if(n&1){let t=q();f(0),C(1,"velt-multi-thread-comment-dialog-internal",14),A(2,"translate"),G("saveComment",function(i){N(t);let r=l(4);return F(r.saveComment.emit(i))})("updateOverlayPosition",function(){N(t);let i=l(4);return F(i.updateOverlayPosition())})("pointerOutFromCommentDialog",function(i){N(t);let r=l(4);return F(r.onPointerOutFromCommentDialog(i))})("pointerUp",function(i){N(t);let r=l(4);return F(r.onPointerUpOnDialog(i))}),S(),v()}if(n&2){let t=l(3).ngIf;d(),c("multiThreadAnnotationId",t.annotation==null?null:t.annotation.annotationId)("annotation",t.annotation)("user",t.user)("commentPinSelected",t.commentPinSelected)("containerComponentId",t.containerComponentId)("commentPinType",t.commentPinType),x("role","dialog")("aria-label",P(2,8,"Multi-thread comment dialog"))}}function Zjt(n,o){if(n&1){let t=q();C(0,"snippyly-comment-dialog",15),A(1,"translate"),G("saveComment",function(i){N(t);let r=l(4);return F(r.saveComment.emit(i))})("updateOverlayPosition",function(){N(t);let i=l(4);return F(i.updateOverlayPosition())})("pointerOutFromCommentDialog",function(i){N(t);let r=l(4);return F(r.onPointerOutFromCommentDialog(i))})("pointerUp",function(){N(t);let i=l(4);return F(i.onPointerUpOnDialog())}),S()}if(n&2){let t=l(3).ngIf;c("annotation",t.annotation)("user",t.user)("commentPinSelected",t.commentPinSelected)("containerComponentId",t.containerComponentId)("commentPinType",t.commentPinType),x("role","dialog")("aria-label",P(1,7,"Comment dialog"))}}function Xjt(n,o){if(n&1&&g(0,Kjt,3,10,"ng-container",8)(1,Zjt,2,9,"ng-template",null,2,De),n&2){let t=pe(2),e=l(2).ngIf;c("ngIf",(e==null||e.annotation==null?null:e.annotation.type)==="multiThread")("ngIfElse",t)}}function Qjt(n,o){if(n&1){let t=q();g(0,Xjt,3,2,"ng-template",10,5,De),G("positionChange",function(i){N(t);let r=l(2);return F(r.onCommentDialogPositionChange(i))})}if(n&2){let t=o.trigger,e=l().ngIf;c("cdkConnectedOverlayOrigin",t)("cdkConnectedOverlayOpen",(!e.commentBubbleAvailable||e.commentPinType==="bubble")&&!!(e!=null&&e.user)&&!e.annotationDragging&&(!e.isPhone||!e.mobileMode)&&!e.dialogOpenedInSidebar&&!e.streamMode&&!e.inboxMode&&e.floatingCommentsEnabled&&(e.commentPinSelected||e.dialogOnHover&&(e.bubbleOnPin?e.commentBubbleHover:e.commentPinHover)||e.commentPinType==="bubble"&&e.commentBubbleTargetPinHover))("cdkConnectedOverlayPanelClass",Nt(10,$jt))("cdkConnectedOverlayOffsetY",e.popoverMode?0:e.commentDialogOverlayOriginY==="top"?-8:2)("cdkConnectedOverlayOffsetX",e.popoverMode?e.commentDialogOverlayOriginX==="end"?4:0:e.showCommentIndex&&e.commentDialogOverlayOriginX==="end"?8:0)("cdkConnectedOverlayBackdropClass","velt-overlay-backdrop")("cdkConnectedOverlayLockPosition",!1)("cdkConnectedOverlayPositions",e.positions)("cdkConnectedOverlayGrowAfterOpen",!0)("cdkConnectedOverlayDisableClose",!0)}}function Jjt(n,o){if(n&1){let t=q();C(0,"snippyly-comment-bottom-sheet",16),A(1,"translate"),G("saveComment",function(i){N(t);let r=l(2);return F(r.saveComment.emit(i))}),S()}if(n&2){let t=l().ngIf;c("annotation",t.annotation)("user",t.user),x("role","dialog")("aria-label",P(1,4,"Comment bottom sheet"))}}function e$t(n,o){if(n&1){let t=q();f(0),C(1,"div",7,0),A(3,"translate"),G("click",function(i){return N(t),F(i.preventDefault())})("pointerenter",function(i){return N(t),l().onPointerOver(i),F(i.stopPropagation())})("pointerleave",function(){N(t);let i=l();return F(i.onPointerOut())}),Rt(4),S(),g(5,Wjt,3,11,"ng-container",8)(6,Yjt,1,4,"ng-template",null,1,De)(8,Qjt,2,11,"ng-template",null,2,De)(10,Jjt,2,6,"snippyly-comment-bottom-sheet",9),v()}if(n&2){let t=o.ngIf,e=pe(7),i=l();d(),x("data-testid",i.componentId+"-trigger")("role","button")("aria-expanded",t.commentPinSelected)("aria-haspopup","dialog")("aria-label",P(3,8,"Comment pin")),d(4),c("ngIf",t.bubbleOnPin&&!t.commentBubbleAvailable&&!t.dialogOpenedInSidebar)("ngIfElse",e),d(5),c("ngIf",(t==null?null:t.user)&&t.mobileMode&&t.isPhone&&!t.sidebarVisible&&!t.dialogOpenedInSidebar&&!t.inboxMode&&!t.streamMode&&t.floatingCommentsEnabled&&t.commentPinSelected)}}var a_=(()=>{let o=class o{constructor(e,i,r,a,s){this.breakpointObserver=e,this.commentService=i,this.domService=r,this.loggingService=a,this.elementRef=s,this.commentPinSelected=!1,this.annotationDragging=!1,this.commentPinType="pin",this.commentBubbleTargetPinHover=!1,this.showBubbleOnHover=!1,this.bubbleOnPin=!1,this.bubbleOnPinHover=!1,this.saveComment=new Ae,this.togglePinSelection=new Ae,this.commentTargetElementClicked=new Ae,this.isDialogOnHoverEnabled=!1,this.isDialogOnTargetElementClickEnabled=!1,this.previouslySelectedAnnotations={},this.eventListenersSubscriptions=[],this.customScrollableParentEventsListenersSubscriptions=[],this.componentConfigSignal=Te({bubbleOnPin:!1,bubbleOnPinHover:!1,dialogOnHover:!1,commentBubbleAvailable:!1,commentPinHover:!1,commentBubbleHover:!1,commentPinSelected:!1,popoverMode:!1,showCommentIndex:!1,commentBubbleTargetPinHover:!1,isBubbleInitialized:!1,annotationDragging:!1,commentPinBubbleOverlayOriginX:"start",commentPinBubbleOverlayOriginY:"top",positions:[],annotation:void 0,commentPinType:"pin",isPhone:!1,mobileMode:!1,streamMode:!1,inboxMode:!1,floatingCommentsEnabled:!1,sidebarVisible:!1,dialogOpenedInSidebar:!1,commentDialogOverlayOriginX:"start",commentDialogOverlayOriginY:"top",user:void 0}),this.subscriptions=[],this.componentId="velt-comment-dialog-portal";try{this.loggingService.log("%c[WB] Creating COMPONENT CommentDialogPortalComponent","color: blue;"),this.subscriptions.push(this.breakpointObserver.observe(Oi.XSmall).subscribe(m=>{m.matches?this.componentConfigSignal.update(p=>(p=T(I({},p),{isPhone:!0}),p)):this.componentConfigSignal.update(p=>(p=T(I({},p),{isPhone:!1}),p))},m=>{this.catchError("Error in CommentDialogPortalComponent breakpointObserver subscription: ",m)})),this.subscriptions.push(this.commentService.getSidebarVisibility$().subscribe(m=>{this.componentConfigSignal.update(p=>(p=T(I({},p),{sidebarVisible:m}),p))},m=>{this.catchError("Error in CommentDialogPortalComponent getSidebarVisibility$ subscription: ",m)})),this.subscriptions.push(this.commentService.getMobileMode$().subscribe(m=>{this.componentConfigSignal.update(p=>(p=T(I({},p),{mobileMode:m}),p))},m=>{this.catchError("Error in CommentDialogPortalComponent getMobileMode$ subscription: ",m)})),this.subscriptions.push(this.commentService.getShowCommentIndex().subscribe(m=>{this.componentConfigSignal.update(p=>(p=T(I({},p),{showCommentIndex:m}),p))},m=>{this.catchError("Error in CommentDialogPortalComponent getShowCommentIndex subscription: ",m)})),this.subscriptions.push(this.commentService.getStreamMode$().subscribe(m=>{this.componentConfigSignal.update(p=>(p=T(I({},p),{streamMode:m}),p))},m=>{this.catchError("Error in CommentDialogPortalComponent getStreamMode$ subscription: ",m)})),this.subscriptions.push(this.commentService.getInboxMode$().subscribe(m=>{this.componentConfigSignal.update(p=>(p=T(I({},p),{inboxMode:m}),p))},m=>{this.catchError("Error in CommentDialogPortalComponent getInboxMode subscription: ",m)})),this.subscriptions.push(this.domService.getDialogOpenedInSidebar().subscribe(m=>{this.componentConfigSignal.update(p=>(p=T(I({},p),{dialogOpenedInSidebar:m}),p))},m=>{this.catchError("Error in CommentDialogPortalComponent getDialogOpenedInSidebar subscription: ",m)})),this.subscriptions.push(this.commentService.getPopoverMode$().subscribe(m=>{this.componentConfigSignal.update(p=>(p=T(I({},p),{popoverMode:m}),p)),this.componentConfigSignal().popoverMode?this.componentConfigSignal.update(p=>(p=T(I({},p),{positions:j.OVERLAY_POSITIONS_FOR_POPOVER_MODE.map(h=>new fi({originX:h.originX,originY:h.originY},{overlayX:h.overlayX,overlayY:h.overlayY}))}),p)):this.componentConfigSignal.update(p=>(p=T(I({},p),{positions:j.OVERLAY_POSITIONS.map(h=>new fi({originX:h.originX,originY:h.originY},{overlayX:h.overlayX,overlayY:h.overlayY}))}),p)),this.addEventListeners()},m=>{this.catchError("Error in CommentDialogPortalComponent getPopoverMode subscription: ",m)})),this.subscriptions.push(this.commentService.showFloatingComments$().subscribe(m=>{this.componentConfigSignal.update(p=>(p=T(I({},p),{floatingCommentsEnabled:m}),p))},m=>{this.catchError("Error in CommentDialogPortalComponent showFloatingComments$ subscription: ",m)})),this.subscriptions.push(this.commentService.getEnableDialogOnHover$().subscribe(m=>{this.isDialogOnHoverEnabled=m,this.componentConfigSignal.update(p=>(p=T(I({},p),{dialogOnHover:m}),p)),this.addEventListeners()},m=>{this.catchError("Error in CommentDialogPortalComponent getEnableDialogOnHover subscription: ",m)})),this.subscriptions.push(this.commentService.getEnableDialogOnTargetElementClick$().subscribe(m=>{this.isDialogOnTargetElementClickEnabled=m,this.addEventListeners()},m=>{this.catchError("Error in CommentDialogPortalComponent getEnableDialogOnTargetElementClick subscription: ",m)})),this.subscriptions.push(this.commentService.getBubbleCommentAnnotationIds$().subscribe(m=>{if(m.includes(this.componentConfigSignal().annotation?.annotationId)){this.commentBubbleElement=this.commentService.getCommentBubbleElement(this.componentConfigSignal().annotation);let p=this.commentBubbleElement?.getAttribute(j.ATTRIBUTES.VELT_ANNOTATION_ID)||"";this.commentBubbleElementAnnotationId!==p&&(this.commentBubbleElementAnnotationId=p,this.componentConfigSignal.update(h=>(h=T(I({},h),{commentBubbleAvailable:!0}),h)))}else this.componentConfigSignal().commentBubbleAvailable&&(this.commentBubbleElement=null,this.commentBubbleElementAnnotationId="",this.componentConfigSignal.update(p=>(p=T(I({},p),{commentBubbleAvailable:!1}),p)))},m=>{this.catchError("Error in CommentDialogPortalComponent getBubbleCommentAnnotationIds$ subscription: ",m)})),this.subscriptions.push(this.domService.getSelectedAnnotationsMap$().pipe(Pi()).subscribe(([m,p])=>{this.previouslySelectedAnnotations=m||{},p&&!p[this.componentConfigSignal().annotation?.annotationId]&&this.componentConfigSignal().commentPinHover&&this.setCommentPinHover(!1)},m=>{this.catchError("Error in CommentDialogPortalComponent getSelectedAnnotationsMap$ subscription: ",m)}))}catch(m){this.catchError("Error in CommentDialogPortalComponent constructor: ",m)}}ngOnInit(){try{this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogPortalComponent ngOnInit:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogPortalComponent setupA11yAttributes:",e)}}ngAfterViewInit(){try{this.updateHighlightOnElement(),this.updateCommentActiveAttributeOnElement()}catch(e){this.catchError("Error in CommentDialogPortalComponent AfterViewInit: ",e)}}ngOnChanges(e){try{e&&Object.keys(e).forEach(i=>{this.componentConfigSignal.update(r=>(r=T(I({},r),{[i]:e[i].currentValue}),r))}),e?.commentPinSelected&&(this.componentConfigSignal().commentPinSelected&&this.setCommentPinHover(!1),this.updateHighlightOnElement(),this.updateCommentActiveAttributeOnElement()),e?.targetElement&&(this.addEventListeners(),this.targetElement?this.setCustomScrollableParents(Pp(this.targetElement)):this.setCustomScrollableParents([]))}catch(i){this.catchError("Error in CommentDialogPortalComponent ngOnChanges: ",i)}}onBubbleAfterViewInit(){try{this.componentConfigSignal.update(e=>(e=T(I({},e),{isBubbleInitialized:!0}),e))}catch(e){this.catchError("Error in CommentDialogPortalComponent onBubbleAfterViewInit: ",e)}}onBubbleOnDestroy(){try{this.componentConfigSignal.update(e=>(e=T(I({},e),{isBubbleInitialized:!1}),e))}catch(e){this.catchError("Error in CommentDialogPortalComponent onBubbleOnDestroy: ",e)}}onCommentPinBubblePositionChange(e){try{this.componentConfigSignal.update(i=>(i=T(I({},i),{commentPinBubbleOverlayOriginX:e.connectionPair.originX,commentPinBubbleOverlayOriginY:e.connectionPair.originY}),i))}catch(i){this.catchError("Error in CommentDialogPortalComponent onCommentPinBubblePositionChange: ",i)}}onCommentDialogPositionChange(e){try{this.componentConfigSignal.update(i=>(i=T(I({},i),{commentDialogOverlayOriginX:e.connectionPair.originX,commentDialogOverlayOriginY:e.connectionPair.originY}),i))}catch(i){this.catchError("Error in CommentDialogPortalComponent onCommentDialogPositionChange: ",i)}}updateOverlayPosition(){try{this.loggingService.log("updateOverlayPosition",this.componentConfigSignal().annotation?.annotationId),this.commentPinBubbleOverlay&&this.commentPinBubbleOverlay?.overlayRef?.updatePosition(),this.commentDialogOverlay&&this.commentDialogOverlay?.overlayRef?.updatePosition()}catch{}}onPointerOutFromCommentDialog(e){try{!this.targetElement?.contains(e?.relatedTarget)&&!this.componentConfigSignal().commentPinSelected&&this.onPointerOut()}catch(i){this.catchError("Error in CommentDialogPortalComponent onPointerOutFromCommentDialog: ",i)}}onPointerOut(){try{this.componentConfigSignal().bubbleOnPin?setTimeout(()=>{this.setCommentPinHover(!1)},500):this.setCommentPinHover(!1)}catch(e){this.catchError("Error in CommentDialogPortalComponent onPointerOut: ",e)}}setCommentPinHover(e){try{e&&this.targetElement&&!this.domService.isElementVisibleOnScreen(this.targetElement)&&(e=!1),this.componentConfigSignal.update(i=>(i=T(I({},i),{commentPinHover:e}),i)),this.updateHighlightOnElement(),this.updateCommentActiveAttributeOnElement(),this.commentBubbleElement&&(this.componentConfigSignal().commentPinHover?this.commentBubbleElement.setAttribute("comment-bubble-target-pin-hover","true"):this.commentBubbleElement.removeAttribute("comment-bubble-target-pin-hover"))}catch(i){this.catchError("Error in CommentDialogPortalComponent setCommentPinHover: ",i)}}addEventListeners(){try{this.removeEventListeners(),this.componentConfigSignal().popoverMode&&this.targetElement&&this.isDialogOnTargetElementClickEnabled&&this.componentConfigSignal().commentPinType!=="bubble"&&(this.isDialogOnHoverEnabled&&(this.eventListenersSubscriptions.push(ri(this.targetElement,"pointerover").subscribe(e=>{this.onPointerOver(e),e.stopPropagation()},e=>{this.catchError("Error in CommentDialogPortalComponent addEventListeners pointerover subscription: ",e)})),this.eventListenersSubscriptions.push(ri(this.targetElement,"pointerout").subscribe(e=>{!this.targetElement?.contains(e?.relatedTarget)&&!e?.relatedTarget?.closest(j.TAGS.SNIPPYLY_COMMENT_DIALOG)&&this.onPointerOut()},e=>{this.catchError("Error in CommentDialogPortalComponent addEventListeners pointerout subscription: ",e)}))),this.eventListenersSubscriptions.push(ri(this.targetElement,"click").subscribe(e=>{this.previouslySelectedAnnotations[this.componentConfigSignal().annotation?.annotationId]||(this.commentTargetElementClicked.emit(),e.stopPropagation())},e=>{this.catchError("Error in CommentDialogPortalComponent addEventListeners click subscription: ",e)})))}catch(e){this.catchError("Error in CommentDialogPortalComponent addEventListeners: ",e)}}removeEventListeners(){try{this.eventListenersSubscriptions.map(e=>{e.unsubscribe()}),this.eventListenersSubscriptions=[]}catch(e){this.catchError("Error in CommentDialogPortalComponent removeEventListeners: ",e)}}updateHighlightOnElement(){try{this.targetElement&&(this.componentConfigSignal().commentPinSelected||this.componentConfigSignal().commentPinHover?this.domService.highlightElement(this.targetElement):this.domService.removeHighlightFromElement(this.targetElement))}catch(e){this.catchError("Error in CommentDialogPortalComponent updateHighlightOnElement: ",e)}}updateCommentActiveAttributeOnElement(){try{this.loggingService.log("%c[WB] Calling FUNCTION: updateCommentActiveAttributeOnElement","color: green;"),this.componentConfigSignal().commentPinSelected||this.componentConfigSignal().commentPinHover?this.targetElement&&(this.targetElement?.hasAttribute(j.ATTRIBUTES.VELT_COMMENT_PIN_ACTIVE)||this.targetElement?.setAttribute(j.ATTRIBUTES.VELT_COMMENT_PIN_ACTIVE,"true")):this.targetElement&&this.targetElement?.hasAttribute(j.ATTRIBUTES.VELT_COMMENT_PIN_ACTIVE)&&this.targetElement?.removeAttribute(j.ATTRIBUTES.VELT_COMMENT_PIN_ACTIVE)}catch(e){this.catchError("Error in CommentDialogPortalComponent onCommentFocusChange: ",e)}}onPointerUpOnDialog(e){try{(!this.componentConfigSignal().commentPinSelected||e)&&this.togglePinSelection.emit(e)}catch(i){this.catchError("Error in CommentDialogPortalComponent onPointerUpOnDialog: ",i)}}onPointerOver(e){try{if(this.componentConfigSignal().commentPinHover)return;e.buttons?this.componentConfigSignal().commentPinHover&&this.setCommentPinHover(!1):!this.componentConfigSignal().commentPinHover&&(this.componentConfigSignal().bubbleOnPin?this.componentConfigSignal().bubbleOnPinHover:this.isDialogOnHoverEnabled)&&this.setCommentPinHover(!0)}catch(i){this.catchError("Error in CommentDialogPortalComponent onPointerOver: ",i)}}setCustomScrollableParents(e){try{this.customScrollableParents=e,this.addCustomScrollableParentsEventListeners()}catch(i){this.catchError("Error in CommentDialogPortalComponent setCustomScrollableParents: ",i)}}addCustomScrollableParentsEventListeners(){try{this.removeCustomScrollableParentsEventListeners(),this.customScrollableParents?.length&&this.customScrollableParents?.forEach(e=>{this.customScrollableParentEventsListenersSubscriptions.push(ri(e,"scroll",{passive:!0}).subscribe(i=>{this.updateOverlayPosition()},i=>{this.catchError("Error in CommentDialogPortalComponent addCustomScrollableParentsEventListeners scroll subscription: ",i)}))})}catch(e){this.catchError("Error in CommentDialogPortalComponent addCustomScrollableParentsEventListeners: ",e)}}removeCustomScrollableParentsEventListeners(){try{this.customScrollableParentEventsListenersSubscriptions.map(e=>{e.unsubscribe()}),this.customScrollableParentEventsListenersSubscriptions=[]}catch(e){this.catchError("Error in CommentDialogPortalComponent removeCustomScrollableParentsEventListeners: ",e)}}onBubblePointerOver(e){try{if(this.componentConfigSignal().commentBubbleHover)return;e.buttons||this.componentConfigSignal.update(i=>(i=T(I({},i),{commentBubbleHover:!0}),i))}catch(i){this.catchError("Error in CommentDialogPortalComponent onBubblePointerOver: ",i)}}onBubblePointerOut(){try{this.componentConfigSignal.update(e=>(e=T(I({},e),{commentBubbleHover:!1}),e))}catch(e){this.catchError("Error in CommentDialogPortalComponent onBubblePointerOut: ",e)}}onPointerUpOnBubble(){try{this.componentConfigSignal().commentPinSelected||this.togglePinSelection.emit()}catch(e){this.catchError("Error in CommentDialogPortalComponent onPointerUpOnBubble: ",e)}}ngOnDestroy(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnDestroy","color: green;");try{this.unsubscribe()}catch(e){this.catchError("Error in CommentDialogPortalComponent ondestroy: ",e)}}unsubscribe(){this.loggingService.log("%c[WB] Calling FUNCTION: unsubscribe","color: green;");try{this.removeEventListeners(),this.removeCustomScrollableParentsEventListeners(),this.subscriptions.map(e=>{e.unsubscribe()}),this.subscriptions=[]}catch(e){this.catchError("Error in CommentDialogPortalComponent unsubscribe: ",e)}}catchError(e,i,r){try{this.loggingService.catch(e,i,T(I({},r||{}),{annotationId:this.componentConfigSignal()?.annotation?.annotationId}))}catch{}}};o.\u0275fac=function(i){return new(i||o)(u(po),u(we),u(Ne),u(y),u(k))},o.\u0275cmp=O({type:o,selectors:[["velt-comment-dialog-portal-internal"]],viewQuery:function(i,r){if(i&1&&(ot(Bjt,5),ot(Vjt,5)),i&2){let a;Qe(a=Je())&&(r.commentDialogOverlay=a.first),Qe(a=Je())&&(r.commentPinBubbleOverlay=a.first)}},inputs:{annotation:"annotation",commentPinSelected:"commentPinSelected",annotationDragging:"annotationDragging",commentPinType:"commentPinType",commentBubbleTargetPinHover:"commentBubbleTargetPinHover",user:"user",targetElement:"targetElement",showBubbleOnHover:"showBubbleOnHover",bubbleOnPin:"bubbleOnPin",bubbleOnPinHover:"bubbleOnPinHover",containerComponentId:"containerComponentId"},outputs:{saveComment:"saveComment",togglePinSelection:"togglePinSelection",commentTargetElementClicked:"commentTargetElementClicked"},standalone:!1,features:[Xe],ngContentSelectors:Ujt,decls:1,vars:1,consts:[["trigger","cdkOverlayOrigin"],["defaultDialogViewRef",""],["commentDialogRef",""],["commentPinBubbleOverlay","cdkConnectedOverlay"],["bubbleOnHoverTrigger","cdkOverlayOrigin"],["commentDialogOverlay","cdkConnectedOverlay"],[4,"ngIf"],["cdkOverlayOrigin","",3,"click","pointerenter","pointerleave"],[4,"ngIf","ngIfElse"],[3,"annotation","user","saveComment",4,"ngIf"],["cdkConnectedOverlay","",3,"positionChange","cdkConnectedOverlayOrigin","cdkConnectedOverlayOpen","cdkConnectedOverlayPanelClass","cdkConnectedOverlayOffsetY","cdkConnectedOverlayOffsetX","cdkConnectedOverlayBackdropClass","cdkConnectedOverlayLockPosition","cdkConnectedOverlayPositions","cdkConnectedOverlayGrowAfterOpen","cdkConnectedOverlayDisableClose"],["cdkOverlayOrigin","",3,"click","pointerenter","pointerleave","pointerup"],["veltAfterViewInit","",3,"afterViewInit","onDestroy","annotation"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[3,"saveComment","updateOverlayPosition","pointerOutFromCommentDialog","pointerUp","multiThreadAnnotationId","annotation","user","commentPinSelected","containerComponentId","commentPinType"],[3,"saveComment","updateOverlayPosition","pointerOutFromCommentDialog","pointerUp","annotation","user","commentPinSelected","containerComponentId","commentPinType"],[3,"saveComment","annotation","user"]],template:function(i,r){i&1&&(Vt(),g(0,e$t,11,10,"ng-container",6)),i&2&&c("ngIf",r.componentConfigSignal())},dependencies:[Z,vt,Vn,An,Go,$9,sg,Tfe,rs,de],encapsulation:2,changeDetection:0});let n=o;return n})();var t$t=["pinRef"],n$t=["commentDialogPortalRef"],i$t=["*"],Afe=n=>({componentConfigSignal:n}),o$t=(n,o)=>({condition:n,data:o}),Ofe=()=>["bubble","chart"],r$t=(n,o,t,e,i)=>({template:n,context:o,componentName:"velt-comment-pin-wireframe",variant:t,setIfCondition:e,componentElementRef:i}),a$t=(n,o,t)=>({"velt-comment-pin--status-default":n,"velt-comment-pin--status-ongoing":o,"velt-comment-pin--status-terminal":t});function s$t(n,o){n&1&&Ue(0)}function l$t(n,o){if(n&1&&(C(0,"velt-shadow-dom-internal"),g(1,s$t,1,0,"ng-container",11),S()),n&2){l();let t=pe(3),e=l(2);x("data-testid",e.componentId+"-shadow-dom"),d(),c("ngTemplateOutlet",t)}}function c$t(n,o){if(n&1){let t=q();f(0),C(1,"div",14),G("click",function(i){return N(t),F(i.preventDefault())}),Rt(2),S(),v()}n&2&&(d(),x("role","presentation"))}function m$t(n,o){if(n&1&&(f(0),w(1,"app-comment-pin-triangle",15),v()),n&2){let t=l(5);d(),c("componentConfigSignal",t.componentConfigSignal)("template",t.triangleTemplate)}}function d$t(n,o){n&1&&(le(),C(0,"svg",20),w(1,"path",21)(2,"path",22),S())}function p$t(n,o){n&1&&(le(),C(0,"svg",20),w(1,"path",23)(2,"path",24),S())}function g$t(n,o){n&1&&(le(),C(0,"svg",20),w(1,"path",25)(2,"path",26),S())}function u$t(n,o){n&1&&(le(),C(0,"svg",20),w(1,"path",27)(2,"path",28),S())}function h$t(n,o){if(n&1&&(f(0)(1,18),g(2,d$t,3,0,"svg",19)(3,p$t,3,0,"svg",19)(4,g$t,3,0,"svg",19)(5,u$t,3,0,"svg",19),v()()),n&2){let t=l(6).ngIf;d(),c("ngSwitch",t.annotation==null||t.annotation.pageInfo==null||t.annotation.pageInfo.deviceInfo==null?null:t.annotation.pageInfo.deviceInfo.deviceType),d(),c("ngSwitchCase","Mobile"),d(),c("ngSwitchCase","Tablet"),d(),c("ngSwitchCase","Desktop"),d(),c("ngSwitchCase","Monitor")}}function f$t(n,o){if(n&1&&w(0,"snippyly-user-avatar",29),n&2){let t=l(6).ngIf;c("user",t.annotation==null?null:t.annotation.from)}}function v$t(n,o){if(n&1&&(f(0),w(1,"app-comment-pin-unread-comment-indicator",15),v()),n&2){let t=l(7);d(),c("componentConfigSignal",t.componentConfigSignal)("template",t.unreadCommentIndicatorTemplate)}}function C$t(n,o){if(n&1&&w(0,"app-comment-pin-index",15)(1,"app-comment-pin-ghost-comment-indicator",15)(2,"app-comment-pin-private-comment-indicator",15),n&2){let t=l(7);c("componentConfigSignal",t.componentConfigSignal)("template",t.indexTemplate),d(),c("componentConfigSignal",t.componentConfigSignal)("template",t.ghostCommentIndicatorTemplate),d(),c("componentConfigSignal",t.componentConfigSignal)("template",t.privateCommentIndicatorTemplate)}}function _$t(n,o){if(n&1){let t=q();f(0),C(1,"div",17,5),G("click",function(i){return N(t),F(i.preventDefault())}),g(3,h$t,6,5,"ng-container",10)(4,f$t,1,1,"ng-template",null,6,De)(6,v$t,2,2,"ng-container",10)(7,C$t,3,6,"ng-template",null,7,De),S(),v()}if(n&2){let t=pe(5),e=pe(8),i=l(5).ngIf,r=l();d(),rt("--velt-internal-comment-pin-bg-color",(i.annotation==null||i.annotation.status==null?null:i.annotation.status.color)||null),ge("velt-comment-pin--marker-transparent",r.usingCustomCommentPin)("velt-comment-pin--marker-default",!r.usingCustomCommentPin),c("ngClass",$e(12,a$t,!i.customStatusesShown&&(i.annotation==null||i.annotation.status==null?null:i.annotation.status.type)==="default",!i.customStatusesShown&&(i.annotation==null||i.annotation.status==null?null:i.annotation.status.type)==="ongoing",!i.customStatusesShown&&(i.annotation==null||i.annotation.status==null?null:i.annotation.status.type)==="terminal")),x("role","presentation"),d(2),c("ngIf",i.isDeviceIndicatorOnCommentPinsEnabled&&i.isCommentAddedOnDifferentDeviceType)("ngIfElse",t),d(3),c("ngIf",!(i.user!=null&&i.user.isGuest)&&!(i.user!=null&&i.user.isAnonymous)&&(i==null||i.unreadCommentsMap==null?null:i.unreadCommentsMap[i.annotation==null?null:i.annotation.annotationId]))("ngIfElse",e)}}function y$t(n,o){if(n&1){let t=q();C(0,"div",14),G("click",function(i){return N(t),F(i.preventDefault())}),g(1,_$t,9,16,"ng-container",16),S()}if(n&2){let t=l(4).ngIf,e=l();x("role","presentation"),d(),c("veltDynamicTemplate",$(4,r$t,e.template,M(2,Afe,e.componentConfigSignal),t==null?null:t.variant,e.setIfCondition.bind(e),e.elementRef))}}function S$t(n,o){if(n&1&&g(0,m$t,2,2,"ng-container",10)(1,y$t,2,10,"ng-template",null,4,De),n&2){let t=pe(2),e=l(3).ngIf;c("ngIf",e.popoverMode)("ngIfElse",t)}}function b$t(n,o){if(n&1){let t=q();C(0,"velt-comment-dialog-portal-internal",12,1),G("saveComment",function(i){N(t);let r=l(3);return F(r.saveComment.emit(i))})("togglePinSelection",function(i){N(t);let r=l(3);return F(r.onPinBubblePointerUp(i))})("pointerUp",function(){N(t);let i=l(3);return F(i.onPointerUpOnDialog())}),C(2,"div",13,2),g(4,c$t,3,1,"ng-container",10)(5,S$t,3,2,"ng-template",null,3,De),S()()}if(n&2){let t=pe(6),e=l(2).ngIf,i=l();c("annotation",e.annotation)("user",e.user)("commentPinSelected",e.commentPinSelected)("annotationDragging",e.annotationDragging)("commentPinType",e.commentPinType)("targetElement",e.targetElement)("bubbleOnPin",e.bubbleOnPin)("bubbleOnPinHover",e.bubbleOnPinHover)("containerComponentId",e.containerComponentId),d(2),rt("--velt-internal-comment-pin-max-width",i.pinMaxWidth),ge("velt-comment-pin--ghost",!!(e.annotation!=null&&e.annotation.ghostComment))("velt-comment-pin--different-device",e.isDeviceIndicatorOnCommentPinsEnabled&&e.isCommentAddedOnDifferentDeviceType)("velt-comment-pin--outside-viewport",!e.annotationDragging&&i.isOutsideViewport)("velt-comment-pin-open",e.commentPinSelected&&!e.annotationDragging)("velt-comment-pin-unread-comment",!(e.user!=null&&e.user.isGuest)&&!(e.user!=null&&e.user.isAnonymous)&&(e==null||e.unreadCommentsMap==null?null:e.unreadCommentsMap[e.annotation==null?null:e.annotation.annotationId]))("velt-display-none",e.commentPinType!=="bubble"&&e.commentBubbleElementAnnotationId&&e.commentBubbleElementAnnotationId!==(e.annotation==null?null:e.annotation.annotationId)),x("data-testid",i.componentId)("role","button")("aria-expanded",e.commentPinSelected),d(2),c("ngIf",e.commentPinType==="bubble"||e.commentPinType==="chart")("ngIfElse",t)}}function I$t(n,o){if(n&1&&(f(0),g(1,l$t,2,2,"velt-shadow-dom-internal",10)(2,b$t,7,28,"ng-template",null,0,De),v()),n&2){let t=pe(3),e=l().ngIf,i=l();d(),c("ngIf",!i.template&&i.pinShadowDOM&&!(Nt(2,Ofe)!=null&&Nt(3,Ofe).includes(e.commentPinType)))("ngIfElse",t)}}function E$t(n,o){if(n&1&&(f(0),g(1,I$t,4,4,"ng-container",9),v()),n&2){let t=l();d(),c("veltIf",R(3,o$t,t.conditionSignal(),M(1,Afe,t.componentConfigSignal)))}}var mg=(()=>{let o=class o extends c9{constructor(e,i,r,a,s,m,p){super(m,p,r),this.commentService=e,this.domService=i,this.loggingService=r,this.commentPinPortalService=a,this.wireframeService=s,this.elementRef=m,this.dynamicDataService=p,this.commentPinSelected=!1,this.annotationDragging=!1,this.commentPinType="pin",this.usingCustomCommentPin=!1,this.multipleCommentPinsSelected=!1,this.avatarErrorImage="",this.saveComment=new Ae,this.pinShadowDOM=!1,this.subscriptions=[],this.commentTargetElementClicked=new Ae,this.togglePinSelection=new Ae,this.commentBubbleAvailable=!1,this.commentPinPosition={top:0,left:0},this.isOutsideViewport=!1,this.pinMaxWidth="",this.previouslySelectedAnnotations={},this.deviceInfo=new ei,this.COMMENT_PIN_SIZE=40,this.componentConfigSignal=Te({isGhostComment:!1,isPrivateComment:!1,showCommentIndex:!1,bubbleOnPin:!1,bubbleOnPinHover:!1,commentPinSelected:!1,annotationDragging:!1,popoverMode:!1,isDeviceIndicatorOnCommentPinsEnabled:!1,isCommentAddedOnDifferentDeviceType:!1,annotation:this.annotation,user:this.user,unreadCommentsMap:null,popoverTriangleComponent:!1}),this.veltElement=!0,this.componentId="velt-comment-pin",this.loggingService.log("%c[WB] Creating COMPONENT CommentPinComponent","color: blue;"),this.subscriptions.push(this.domService.getDeviceInfo$().subscribe(h=>{this.deviceInfo=h,this.checkIfCommentAddedOnDifferentDeviceType()})),this.subscriptions.push(this.commentService.getShowCommentIndex().subscribe(h=>{this.componentConfigSignal.update(_=>(_=T(I({},_),{showCommentIndex:h}),_))},h=>{this.catchError("Error in CommentPinComponent getShowCommentIndex subscription: ",h)})),this.subscriptions.push(this.commentService.getBubbleOnPin$().subscribe(h=>{this.componentConfigSignal.update(_=>(_=T(I({},_),{bubbleOnPin:h}),_))},h=>{this.catchError("Error in CommentPinComponent getBubbleOnPin subscription: ",h)})),this.subscriptions.push(this.commentService.getBubbleOnPinHover$().subscribe(h=>{this.componentConfigSignal.update(_=>(_=T(I({},_),{bubbleOnPinHover:h}),_))},h=>{this.catchError("Error in CommentPinComponent getBubbleOnPinHover subscription: ",h)})),this.subscriptions.push(this.commentService.getPopoverTriangleComponent$().subscribe(h=>{this.componentConfigSignal.update(_=>(_=T(I({},_),{popoverTriangleComponent:h}),_))},h=>{this.catchError("Error in CommentPinComponent getPopoverTriangleComponent$ subscription: ",h)})),this.subscriptions.push(this.commentService.getPinShadowDOM$().subscribe(h=>{this.pinShadowDOM=h},h=>{this.catchError("Error in CommentPinComponent getPinShadowDOM$ subscription: ",h)})),this.subscriptions.push(this.commentService.getPinDarkMode$().subscribe(h=>{h!==null&&(h?this.elementRef.nativeElement.setAttribute("dark",""):this.elementRef.nativeElement.removeAttribute("dark"))},h=>{this.catchError("Error in CommentPinComponent pinDarkMode$ subscription: ",h)})),this.subscriptions.push(this.commentService.getPopoverMode$().subscribe(h=>{this.componentConfigSignal.update(_=>(_=T(I({},_),{popoverMode:h}),_))},h=>{this.catchError("Error in CommentPinComponent getPopoverMode subscription: ",h)})),this.subscriptions.push(this.commentService.getDeviceIndicatorOnCommentPins$().subscribe(h=>{this.componentConfigSignal.update(_=>(_=T(I({},_),{isDeviceIndicatorOnCommentPinsEnabled:h}),_))},h=>{this.catchError("Error in CommentPinComponent getDeviceIndicatorOnCommentPins subscription: ",h)})),this.subscriptions.push(this.commentService.getUnreadCommentsMap$().subscribe(h=>{this.componentConfigSignal.update(_=>(_=T(I({},_),{unreadCommentsMap:h}),_))})),this.subscriptions.push(this.commentService.getCustomStatusesShown$().subscribe(h=>{this.componentConfigSignal.update(_=>(_=T(I({},_),{customStatusesShown:h}),_))}))}ngOnInit(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;"),super.ngOnInit(),this.setupA11yAttributes(),!this.template){let e="velt-comment-pin-wireframe";this.variant&&(e+=`---${this.variant}`),this.subscriptions.push(this.wireframeService.getWireframe$(e).subscribe(i=>{if(i){let r=document.createElement(i.tagName);r.innerHTML=i.innerHTML,this.template=r,this.getChildTemplate()}}))}this.getChildTemplate()}catch(e){this.catchError("Error in CommentsToolComponent OnInit: ",e)}}getChildTemplate(){try{if(!this.ghostCommentIndicatorTemplate&&this.template){let e=this.template.querySelector("velt-comment-pin-ghost-comment-indicator-wireframe");et(e)||(this.ghostCommentIndicatorTemplate=e)}if(!this.indexTemplate&&this.template){let e=this.template.querySelector("velt-comment-pin-index-wireframe");et(e)||(this.indexTemplate=e)}if(!this.privateCommentIndicatorTemplate&&this.template){let e=this.template.querySelector("velt-comment-pin-private-comment-indicator-wireframe");et(e)||(this.privateCommentIndicatorTemplate=e)}if(!this.triangleTemplate&&this.template){let e=this.template.querySelector("velt-comment-pin-triangle-wireframe");et(e)||(this.triangleTemplate=e)}if(!this.unreadCommentIndicatorTemplate&&this.template){let e=this.template.querySelector("velt-comment-pin-unread-comment-indicator-wireframe");et(e)||(this.unreadCommentIndicatorTemplate=e)}}catch(e){this.loggingService.catch("Error in CommentPinComponent getChildTemplate: ",e)}}ngAfterViewInit(){try{this.subscriptions.push(this.commentPinPortalService.getCommentPinTemplate$().subscribe(e=>{if(e!==null){let i=e?.cloneNode(!0);if(i.setAttribute("slot","comment-pin"),this.pinRef!==void 0){this.pinRef.nativeElement.appendChild(i);let r=T0(this.componentConfigSignal().annotation);this.injectAttributeData(i,r),this.usingCustomCommentPin=!0,this.commentPinPortalService.emitCustomPinEvent({annotation:this.componentConfigSignal().annotation,element:i}),this.pinRef.nativeElement.childNodes.forEach(a=>{a?.tagName?.toLowerCase()===j.TAGS.SNIPPYLY_USER_AVATAR&&a.remove()})}}else this.usingCustomCommentPin=!1})),this.subscriptions.push(this.commentService.getBubbleCommentAnnotationIds$().subscribe(e=>{if(e.includes(this.componentConfigSignal().annotation?.annotationId)){this.commentBubbleElement=this.commentService.getCommentBubbleElement(this.componentConfigSignal().annotation);let i=this.commentBubbleElement?.getAttribute(j.ATTRIBUTES.VELT_ANNOTATION_ID)||"";this.componentConfigSignal().commentBubbleElementAnnotationId!==i&&(this.componentConfigSignal.update(r=>(r=T(I({},r),{commentBubbleElementAnnotationId:i}),r)),this.commentBubbleAvailable=!0)}else this.commentBubbleAvailable&&(this.commentBubbleElement=null,this.componentConfigSignal.update(i=>(i=T(I({},i),{commentBubbleElementAnnotationId:""}),i)),this.commentBubbleAvailable=!1)},e=>{this.catchError("Error in CommentPinComponent getBubbleCommentAnnotationIds$ subscription: ",e)}))}catch(e){this.catchError("Error in CommentPinComponent AfterViewInit: ",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentPinComponent setupA11yAttributes:",e)}}ngOnChanges(e){try{if(e&&Object.keys(e).forEach(i=>{this.componentConfigSignal.update(r=>(r=T(I({},r),{[i]:e[i].currentValue}),r))}),e?.annotation){if(this.commentService.customPinsById.has(this.componentConfigSignal().annotation.annotationId)){let r=this.commentService.getCustomPinById(this.componentConfigSignal().annotation.annotationId);if(r!==void 0){let a=T0(this.componentConfigSignal().annotation);this.injectAttributeData(r,a)}}this.setUserInitial(),this.componentConfigSignal.update(r=>(r=T(I({},r),{isPrivateComment:this.componentConfigSignal().annotation?.iam?.accessMode===Qi.PRIVATE,isGhostComment:!!this.componentConfigSignal().annotation?.ghostComment}),r)),this.checkIfCommentAddedOnDifferentDeviceType();let i=JSON.parse(JSON.stringify(this.commentPinPosition||{}));this.commentPinPosition={top:this.componentConfigSignal().annotation?.position?.top||0,left:this.componentConfigSignal().annotation?.position?.left||0}}}catch(i){this.catchError("Error in CommentPinComponent ngOnChanges: ",i)}}detectCommentPinOutsideViewport(){try{this.loggingService.log("%c[WB] Calling FUNCTION: detectCommentPinOutsideViewport","color: green;");let e=this.pinRef?.nativeElement;if(e){let i=e?.getBoundingClientRect(),r=Math.max(document?.documentElement?.clientWidth||0,window?.innerWidth||0);if(i?.right>r){let a=r-i.left;a>0?(this.pinMaxWidth=`${a}px`,this.isOutsideViewport=!0):(this.isOutsideViewport=!1,this.pinMaxWidth="")}else this.isOutsideViewport=!1,this.pinMaxWidth=""}else this.isOutsideViewport=!1}catch(e){this.catchError("Error in CommentPinComponent detectCommentPinOutsideViewport: ",e)}}checkIfCommentAddedOnDifferentDeviceType(){try{this.componentConfigSignal().annotation?.pageInfo?.deviceInfo?.deviceType!==this.deviceInfo.deviceType?(this.componentConfigSignal.update(e=>(e=T(I({},e),{isCommentAddedOnDifferentDeviceType:!0}),e)),this.COMMENT_PIN_SIZE=34):(this.componentConfigSignal.update(e=>(e=T(I({},e),{isCommentAddedOnDifferentDeviceType:!1}),e)),this.COMMENT_PIN_SIZE=40)}catch(e){this.catchError("Error in CommentPinComponent checkIfCommentAddedOnDifferentDeviceType: ",e)}}updateOverlayPosition(){try{this.loggingService.log("updateOverlayPosition",this.componentConfigSignal().annotation?.annotationId),this.commentDialogPortalRef?.updateOverlayPosition()}catch(e){this.catchError("Error in CommentPinComponent updateOverlayPosition: ",e)}}onPointerUpOnDialog(){try{this.componentConfigSignal().commentPinSelected||this.togglePinSelection.emit()}catch(e){this.catchError("Error in CommentPinComponent onPointerUpOnDialog: ",e)}}onPinBubblePointerUp(e){try{(!this.componentConfigSignal().commentPinSelected||e)&&this.togglePinSelection.emit(e)}catch(i){this.catchError("Error in CommentPinComponent onPointerUpOnDialog: ",i)}}ngOnDestroy(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnDestroy","color: green;");try{super.ngOnDestroy(),this.unsubscribe()}catch(e){this.catchError("Error in CommentPinComponent ondestroy: ",e)}}unsubscribe(){this.loggingService.log("%c[WB] Calling FUNCTION: unsubscribe","color: green;");try{this.subscriptions.map(e=>{e.unsubscribe()}),this.subscriptions=[]}catch(e){this.catchError("Error in CommentPinComponent unsubscribe: ",e)}}setUserInitial(){try{this.userInitial=this.componentConfigSignal().annotation?.from?.initial||(this.componentConfigSignal().annotation?.from?.name?this.componentConfigSignal().annotation.from.name?.charAt(0).toUpperCase():this.componentConfigSignal().annotation?.from?.email?.charAt(0).toUpperCase()||"")}catch(e){this.catchError("Error in CommentPinComponent setUserInitial: ",e)}}catchError(e,i,r){try{this.loggingService.catch(e,i,T(I({},r||{}),{annotationId:this.componentConfigSignal()?.annotation?.annotationId}))}catch{}}};o.\u0275fac=function(i){return new(i||o)(u(we),u(Ne),u(y),u(z9),u(ze),u(k),u(b))},o.\u0275cmp=O({type:o,selectors:[["snippyly-comment-pin"]],viewQuery:function(i,r){if(i&1&&(ot(t$t,5),ot(n$t,5)),i&2){let a;Qe(a=Je())&&(r.pinRef=a.first),Qe(a=Je())&&(r.commentDialogPortalRef=a.first)}},hostVars:1,hostBindings:function(i,r){i&2&&x("data-velt-element",r.veltElement)},inputs:{annotation:"annotation",commentPinSelected:"commentPinSelected",annotationDragging:"annotationDragging",commentPinType:"commentPinType",multipleCommentPinsSelected:"multipleCommentPinsSelected",avatarErrorImage:"avatarErrorImage",user:"user",variant:"variant",containerComponentId:"containerComponentId",targetElement:"targetElement"},outputs:{saveComment:"saveComment",commentTargetElementClicked:"commentTargetElementClicked",togglePinSelection:"togglePinSelection"},standalone:!1,features:[U([b]),B,Xe],ngContentSelectors:i$t,decls:1,vars:1,consts:[["commentPinContainerRef",""],["commentDialogPortalRef",""],["trigger","cdkOverlayOrigin"],["normalPinRef",""],["defaultPinRef",""],["pinRef",""],["userAvatarRef",""],["readCommentIndicatorsRef",""],[4,"ngIf"],[4,"veltIf"],[4,"ngIf","ngIfElse"],[4,"ngTemplateOutlet"],[3,"saveComment","togglePinSelection","pointerUp","annotation","user","commentPinSelected","annotationDragging","commentPinType","targetElement","bubbleOnPin","bubbleOnPinHover","containerComponentId"],["id","comment-pin-block","cdkOverlayOrigin","",1,"velt-comment-pin"],[3,"click"],[3,"componentConfigSignal","template"],[4,"veltDynamicTemplate"],[1,"velt-comment-pin--marker",3,"click","ngClass"],[3,"ngSwitch"],["width","18","height","18","viewBox","0 0 18 18","fill","none","xmlns","http://www.w3.org/2000/svg",4,"ngSwitchCase"],["width","18","height","18","viewBox","0 0 18 18","fill","none","xmlns","http://www.w3.org/2000/svg"],["d","M12.0357 1.5H5.96429C5.29365 1.5 4.75 2.17157 4.75 3V15C4.75 15.8284 5.29365 16.5 5.96429 16.5H12.0357C12.7063 16.5 13.25 15.8284 13.25 15V3C13.25 2.17157 12.7063 1.5 12.0357 1.5Z","stroke","white","stroke-width","1.5","stroke-linecap","round","stroke-linejoin","round"],["d","M9 13.5H9.0075","stroke","white","stroke-width","1.5","stroke-linecap","round","stroke-linejoin","round"],["fill-rule","evenodd","clip-rule","evenodd","d","M12.75 1.5H5.25C4.83579 1.5 4.5 1.83579 4.5 2.25V15.75C4.5 16.1642 4.83579 16.5 5.25 16.5H12.75C13.1642 16.5 13.5 16.1642 13.5 15.75V2.25C13.5 1.83579 13.1642 1.5 12.75 1.5ZM5.25 0C4.00736 0 3 1.00736 3 2.25V15.75C3 16.9926 4.00736 18 5.25 18H12.75C13.9926 18 15 16.9926 15 15.75V2.25C15 1.00736 13.9926 0 12.75 0H5.25Z","fill","white"],["d","M9.75 14.25C9.75 14.6642 9.41421 15 9 15C8.58579 15 8.25 14.6642 8.25 14.25C8.25 13.8358 8.58579 13.5 9 13.5C9.41421 13.5 9.75 13.8358 9.75 14.25Z","fill","white"],["fill-rule","evenodd","clip-rule","evenodd","d","M3.75 4.5L3.75 11.25L14.25 11.25L14.25 4.5C14.25 4.08579 13.9142 3.75 13.5 3.75L4.5 3.75C4.08579 3.75 3.75 4.08579 3.75 4.5ZM2.25 12.75L15.75 12.75L15.75 4.5C15.75 3.25736 14.7426 2.25 13.5 2.25L4.5 2.25C3.25736 2.25 2.25 3.25736 2.25 4.5L2.25 12.75Z","fill","white"],["fill-rule","evenodd","clip-rule","evenodd","d","M2.25 12.75L2.25 13.5C2.25 13.9142 2.58579 14.25 3 14.25L15 14.25C15.4142 14.25 15.75 13.9142 15.75 13.5L15.75 12.75L2.25 12.75ZM0.75 13.5C0.75 14.7426 1.75736 15.75 3 15.75L15 15.75C16.2426 15.75 17.25 14.7426 17.25 13.5L17.25 12C17.25 11.5858 16.9142 11.25 16.5 11.25L1.5 11.25C1.08579 11.25 0.75 11.5858 0.75 12L0.75 13.5Z","fill","white"],["d","M6.75 13.5H8.25V15H9.75V13.5H11.25V15H12C12.4142 15 12.75 15.3358 12.75 15.75C12.75 16.1642 12.4142 16.5 12 16.5H6C5.58579 16.5 5.25 16.1642 5.25 15.75C5.25 15.3358 5.58579 15 6 15H6.75V13.5Z","fill","white"],["fill-rule","evenodd","clip-rule","evenodd","d","M3 4.5L3 10.5C3 11.3284 3.67157 12 4.5 12L13.5 12C14.3284 12 15 11.3284 15 10.5L15 4.5C15 3.67157 14.3284 3 13.5 3L4.5 3C3.67157 3 3 3.67157 3 4.5ZM1.5 10.5C1.5 12.1569 2.84315 13.5 4.5 13.5L13.5 13.5C15.1569 13.5 16.5 12.1569 16.5 10.5L16.5 4.5C16.5 2.84315 15.1569 1.5 13.5 1.5L4.5 1.5C2.84315 1.5 1.5 2.84315 1.5 4.5L1.5 10.5Z","fill","white"],[3,"user"]],template:function(i,r){i&1&&(Vt(),g(0,E$t,2,6,"ng-container",8)),i&2&&c("ngIf",r.componentConfigSignal())},dependencies:[Br,Z,vt,Li,Yi,An,Hn,ne,X0,K0,Z0,J0,Q0,tn,a_,ae],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}[_nghost-%COMP%]{--velt-green: var(--velt-light-mode-green);--velt-magenta: var(--velt-light-mode-magenta);--velt-amber: var(--velt-light-mode-amber);--velt-purple: var(--velt-light-mode-purple);--velt-cyan: var(--velt-light-mode-cyan);--velt-orange: var(--velt-light-mode-orange);--velt-black: var(--velt-light-mode-black);--velt-white: var(--velt-light-mode-white);--velt-gray: var(--velt-light-mode-gray);--velt-error: var(--velt-light-mode-error);--velt-error-hover: var(--velt-light-mode-error-hover);--velt-error-foreground: var(--velt-light-mode-error-foreground);--velt-error-light: var(--velt-light-mode-error-light);--velt-error-transparent: var(--velt-light-mode-error-transparent);--velt-warning: var(--velt-light-mode-warning);--velt-warning-hover: var(--velt-light-mode-warning-hover);--velt-warning-foreground: var(--velt-light-mode-warning-foreground);--velt-warning-light: var(--velt-light-mode-warning-light);--velt-warning-transparent: var(--velt-light-mode-warning-transparent);--velt-success: var(--velt-light-mode-success);--velt-success-hover: var(--velt-light-mode-success-hover);--velt-success-foreground: var(--velt-light-mode-success-foreground);--velt-success-light: var(--velt-light-mode-success-light);--velt-success-transparent: var(--velt-light-mode-success-transparent);--velt-accent: var(--velt-light-mode-accent);--velt-accent-text: var(--velt-light-mode-accent-text);--velt-accent-hover: var(--velt-light-mode-accent-hover);--velt-accent-foreground: var(--velt-light-mode-accent-foreground);--velt-accent-light: var(--velt-light-mode-accent-light);--velt-accent-transparent: var(--velt-light-mode-accent-transparent);--velt-text-0: var(--velt-light-mode-text-0);--velt-text-1: var(--velt-light-mode-text-1);--velt-text-2: var(--velt-light-mode-text-2);--velt-text-3: var(--velt-light-mode-text-3);--velt-text-4: var(--velt-light-mode-text-4);--velt-text-5: var(--velt-light-mode-text-5);--velt-text-6: var(--velt-light-mode-text-6);--velt-text-7: var(--velt-light-mode-text-7);--velt-text-8: var(--velt-light-mode-text-8);--velt-text-9: var(--velt-light-mode-text-9);--velt-text-10: var(--velt-light-mode-text-10);--velt-text-11: var(--velt-light-mode-text-11);--velt-text-12: var(--velt-light-mode-text-12);--velt-background-0: var(--velt-light-mode-background-0);--velt-background-1: var(--velt-light-mode-background-1);--velt-background-2: var(--velt-light-mode-background-2);--velt-background-3: var(--velt-light-mode-background-3);--velt-background-4: var(--velt-light-mode-background-4);--velt-background-5: var(--velt-light-mode-background-5);--velt-background-6: var(--velt-light-mode-background-6);--velt-background-7: var(--velt-light-mode-background-7);--velt-background-8: var(--velt-light-mode-background-8);--velt-background-9: var(--velt-light-mode-background-9);--velt-background-10: var(--velt-light-mode-background-10);--velt-border-0: var(--velt-light-mode-border-0);--velt-border-1: var(--velt-light-mode-border-1);--velt-border-2: var(--velt-light-mode-border-2);--velt-border-3: var(--velt-light-mode-border-3);--velt-border-4: var(--velt-light-mode-border-4);--velt-border-5: var(--velt-light-mode-border-5);--velt-border-6: var(--velt-light-mode-border-6);--velt-border-7: var(--velt-light-mode-border-7);--velt-border-8: var(--velt-light-mode-border-8);--velt-border-9: var(--velt-light-mode-border-9);--velt-border-10: var(--velt-light-mode-border-10);--velt-background-transparent: var(--velt-light-mode-background-transparent);--velt-border-transparent: var(--velt-light-mode-border-transparent);--velt-animation-transparent: var(--velt-light-mode-animation-transparent);--velt-internal-comment-pin-bg-color: var(--velt-accent)}[dark][_nghost-%COMP%]{--velt-green: var(--velt-dark-mode-green);--velt-magenta: var(--velt-dark-mode-magenta);--velt-amber: var(--velt-dark-mode-amber);--velt-purple: var(--velt-dark-mode-purple);--velt-cyan: var(--velt-dark-mode-cyan);--velt-orange: var(--velt-dark-mode-orange);--velt-black: var(--velt-dark-mode-black);--velt-white: var(--velt-dark-mode-white);--velt-gray: var(--velt-dark-mode-gray);--velt-error: var(--velt-dark-mode-error);--velt-error-hover: var(--velt-dark-mode-error-hover);--velt-error-foreground: var(--velt-dark-mode-error-foreground);--velt-error-light: var(--velt-dark-mode-error-light);--velt-error-transparent: var(--velt-dark-mode-error-transparent);--velt-warning: var(--velt-dark-mode-warning);--velt-warning-hover: var(--velt-dark-mode-warning-hover);--velt-warning-foreground: var(--velt-dark-mode-warning-foreground);--velt-warning-light: var(--velt-dark-mode-warning-light);--velt-warning-transparent: var(--velt-dark-mode-warning-transparent);--velt-success: var(--velt-dark-mode-success);--velt-success-hover: var(--velt-dark-mode-success-hover);--velt-success-foreground: var(--velt-dark-mode-success-foreground);--velt-success-light: var(--velt-dark-mode-success-light);--velt-success-transparent: var(--velt-dark-mode-success-transparent);--velt-accent: var(--velt-dark-mode-accent);--velt-accent-text: var(--velt-dark-mode-accent-text);--velt-accent-hover: var(--velt-dark-mode-accent-hover);--velt-accent-foreground: var(--velt-dark-mode-accent-foreground);--velt-accent-light: var(--velt-dark-mode-accent-light);--velt-accent-transparent: var(--velt-dark-mode-accent-transparent);--velt-text-0: var(--velt-dark-mode-text-0);--velt-text-1: var(--velt-dark-mode-text-1);--velt-text-2: var(--velt-dark-mode-text-2);--velt-text-3: var(--velt-dark-mode-text-3);--velt-text-4: var(--velt-dark-mode-text-4);--velt-text-5: var(--velt-dark-mode-text-5);--velt-text-6: var(--velt-dark-mode-text-6);--velt-text-7: var(--velt-dark-mode-text-7);--velt-text-8: var(--velt-dark-mode-text-8);--velt-text-9: var(--velt-dark-mode-text-9);--velt-text-10: var(--velt-dark-mode-text-10);--velt-text-11: var(--velt-dark-mode-text-11);--velt-text-12: var(--velt-dark-mode-text-12);--velt-background-0: var(--velt-dark-mode-background-0);--velt-background-1: var(--velt-dark-mode-background-1);--velt-background-2: var(--velt-dark-mode-background-2);--velt-background-3: var(--velt-dark-mode-background-3);--velt-background-4: var(--velt-dark-mode-background-4);--velt-background-5: var(--velt-dark-mode-background-5);--velt-background-6: var(--velt-dark-mode-background-6);--velt-background-7: var(--velt-dark-mode-background-7);--velt-background-8: var(--velt-dark-mode-background-8);--velt-background-9: var(--velt-dark-mode-background-9);--velt-background-10: var(--velt-dark-mode-background-10);--velt-border-0: var(--velt-dark-mode-border-0);--velt-border-1: var(--velt-dark-mode-border-1);--velt-border-2: var(--velt-dark-mode-border-2);--velt-border-3: var(--velt-dark-mode-border-3);--velt-border-4: var(--velt-dark-mode-border-4);--velt-border-5: var(--velt-dark-mode-border-5);--velt-border-6: var(--velt-dark-mode-border-6);--velt-border-7: var(--velt-dark-mode-border-7);--velt-border-8: var(--velt-dark-mode-border-8);--velt-border-9: var(--velt-dark-mode-border-9);--velt-border-10: var(--velt-dark-mode-border-10);--velt-background-transparent: var(--velt-dark-mode-background-transparent);--velt-border-transparent: var(--velt-dark-mode-border-transparent);--velt-animation-transparent: var(--velt-dark-mode-animation-transparent)}.velt-comment-pin[_ngcontent-%COMP%] .velt-comment-pin--indicator-bubble{position:absolute;border-radius:100%;text-align:center;top:calc(var(--velt-spacing-sm) * -1);right:calc(var(--velt-spacing-sm) * -1);bottom:unset;left:unset;height:24px;width:24px;display:flex;align-items:center;justify-content:center;box-sizing:border-box}.velt-comment-pin[_ngcontent-%COMP%] .velt-comment-pin--indicator-bubble.velt-comment-pin--private-indicator{height:28px;width:28px;top:calc(var(--velt-spacing-md) * -1);right:calc(var(--velt-spacing-md) * -1);left:unset;bottom:unset}.velt-comment-pin[_ngcontent-%COMP%] .velt-comment-pin--indicator-bubble.velt-comment-pin--ghost-indicator{height:28px;width:28px;top:calc(var(--velt-spacing-md) * -1);right:calc(var(--velt-spacing-md) * -1);left:unset;bottom:unset}.velt-comment-pin[_ngcontent-%COMP%] .velt-comment-pin--indicator-bubble.velt-comment-pin--unread-indicator{background-color:var(--velt-error);color:var(--velt-error-foreground);height:16px;width:16px;top:calc(var(--velt-spacing-xs) * -1);right:calc(var(--velt-spacing-xs) * -1);left:unset;bottom:unset}.velt-comment-pin[_ngcontent-%COMP%] .velt-comment-pin--indicator-bubble.velt-comment-pin--index-3-digit{border-radius:100%;height:30px;width:30px;top:calc(var(--velt-spacing-md) * -1);right:calc(var(--velt-spacing-md) * -1);bottom:unset;left:unset}.velt-comment-pin[_ngcontent-%COMP%] .velt-comment-pin--index{border:1px solid rgb(210,210,210);color:var(--velt-black);background:var(--velt-white)}.velt-comment-pin[_ngcontent-%COMP%] .velt-comment-pin--index .comment-annotation-number{border-radius:100%;width:24px;height:24px;font-size:calc((.55rem + 0px) * var(--velt-base-rem-unit));display:inline-flex;justify-content:center;align-items:center;box-sizing:content-box;position:relative}.velt-comment-pin[_ngcontent-%COMP%] .velt-comment-pin--index .comment-annotation-number:after{content:attr(data-comment-annotation-number);position:absolute;font-weight:400;letter-spacing:normal;word-spacing:normal}.velt-comment-pin[_ngcontent-%COMP%] .velt-comment-pin--private-indicator{color:var(--velt-white);background:linear-gradient(0deg,#000000bf 0% 100%),var(--velt-accent);border-radius:100%;border:1px solid rgba(255,255,255,.24);padding:var(--velt-spacing-sm)}.velt-comment-pin[_ngcontent-%COMP%] .velt-comment-pin--ghost-indicator{color:var(--velt-error-foreground);background:var(--velt-error);border-radius:100%;border:1px solid rgba(255,255,255,.24);padding:var(--velt-spacing-sm)}.velt-comment-pin--different-device[_ngcontent-%COMP%] .velt-comment-pin--private-indicator[_ngcontent-%COMP%], .velt-comment-pin--different-device[_ngcontent-%COMP%] .velt-comment-pin--ghost-indicator[_ngcontent-%COMP%]{padding:calc(var(--velt-spacing-md) / 2);width:24px;height:24px;top:calc(var(--velt-spacing-sm) * -1);right:calc(var(--velt-spacing-sm) * -1)}.velt-comment-pin--marker[_ngcontent-%COMP%]{display:flex;justify-content:center;align-items:center;position:relative;width:calc((2.5rem + 0px) * var(--velt-base-rem-unit));height:calc((2.5rem + 0px) * var(--velt-base-rem-unit));border:2px solid var(--velt-border-3);border-radius:100% 100% 100% 2px;box-shadow:0 8px 16px -8px #0f0f0f1a;z-index:1;cursor:pointer;background:var(--velt-internal-comment-pin-bg-color);box-sizing:border-box}.velt-comment-pin--marker.velt-comment-pin--status-default[_ngcontent-%COMP%]{background:var(--velt-accent, var(--velt-internal-comment-pin-bg-color))}.velt-comment-pin--marker.velt-comment-pin--status-ongoing[_ngcontent-%COMP%]{background:var(--velt-warning, var(--velt-internal-comment-pin-bg-color))}.velt-comment-pin--marker.velt-comment-pin--status-terminal[_ngcontent-%COMP%]{background:var(--velt-success, var(--velt-internal-comment-pin-bg-color))}snippyly-user-avatar[_ngcontent-%COMP%]{--legacy-velt-user-avatar-size: 1.5rem;background-color:var(--velt-gray);background-size:cover;border-radius:100%;display:flex;align-items:center;justify-content:center;position:relative}.velt-comment-pin--popover[_ngcontent-%COMP%]{width:0;height:0;border-style:solid;border-width:0 10px 10px 0;border-color:transparent var(--velt-accent) transparent transparent}.velt-comment-pin.velt-comment-pin--different-device[_ngcontent-%COMP%], .velt-comment-pin.velt-comment-pin--different-device[_ngcontent-%COMP%] .velt-comment-pin--marker[_ngcontent-%COMP%]{width:calc((2.125rem + 0px) * var(--velt-base-rem-unit));height:calc((2.125rem + 0px) * var(--velt-base-rem-unit))}.velt-comment-pin.velt-comment-pin--ghost[_ngcontent-%COMP%] .velt-comment-pin--marker-default.velt-comment-pin--marker[_ngcontent-%COMP%]{background:var(--velt-gray)}.velt-comment-pin.velt-comment-pin--ghost[_ngcontent-%COMP%] .velt-comment-pin--popover[_ngcontent-%COMP%]{border-color:transparent var(--velt-gray) transparent transparent}.velt-comment-pin.velt-comment-pin--outside-viewport[_ngcontent-%COMP%]{max-width:var(--velt-internal-comment-pin-max-width);overflow:hidden} .velt-comment-dialog-overlay-panel{z-index:2147483567}.velt-comment-pin--marker-transparent[_ngcontent-%COMP%]{background:transparent;border:unset;border-radius:unset;box-shadow:unset}"],changeDetection:0});let n=o;return n})();function x$t(n,o){if(n&1){let t=q();f(0),C(1,"velt-multi-thread-comment-dialog-internal",6),G("afterViewInit",function(){N(t);let i=l().last,r=l(2);return F(i?r.calculatePosition():null)})("saveComment",function(i){N(t);let r=l().$implicit,a=l(2);return F(a.saveComment(r==null?null:r.annotation,i))}),S(),v()}if(n&2){let t=l().$implicit,e=l().ngIf,i=l();d(),c("multiThreadAnnotationId",t==null||t.annotation==null?null:t.annotation.annotationId)("annotation",t==null?null:t.annotation)("user",e.user)("commentPinSelected",!!e.selectedAnnotationsMap[t==null||t.annotation==null?null:t.annotation.annotationId]),x("data-testid",i.componentId+"-multi-thread-"+(t==null||t.annotation==null?null:t.annotation.annotationId))}}function T$t(n,o){if(n&1){let t=q();C(0,"snippyly-comment-dialog",7),G("afterViewInit",function(){N(t);let i=l().last,r=l(2);return F(i?r.calculatePosition():null)})("saveComment",function(i){N(t);let r=l().$implicit,a=l(2);return F(a.saveComment(r==null?null:r.annotation,i))}),S()}if(n&2){let t=l().$implicit,e=l().ngIf,i=l();c("annotation",t==null?null:t.annotation)("user",e.user)("commentPinSelected",!!e.selectedAnnotationsMap[t==null||t.annotation==null?null:t.annotation.annotationId])("inlineCommentMode",e.inlineCommentMode)("isInsidePdfViewer",t==null?null:t.isInsidePdfViewer),x("data-testid",i.componentId+"-single-thread-"+(t==null||t.annotation==null?null:t.annotation.annotationId))}}function D$t(n,o){if(n&1){let t=q();f(0),C(1,"div",4),G("click",function(){let i=N(t).$implicit,r=l(2);return F(r.togglePinSelection(i==null?null:i.annotation))}),g(2,x$t,2,5,"ng-container",5)(3,T$t,1,6,"ng-template",null,0,De),S(),v()}if(n&2){let t=o.$implicit,e=pe(4),i=l().ngIf,r=l();d(),rt("top",t==null?null:t.top,"px"),ge("selected",i.selectedAnnotationsMap[t==null||t.annotation==null?null:t.annotation.annotationId]),c("id","snippyly-comments-on-right-block-"+(t==null||t.annotation==null?null:t.annotation.annotationId)),x("data-testid",r.componentId+"-block-"+(t==null||t.annotation==null?null:t.annotation.annotationId))("role","region")("tabindex",0),d(),c("ngIf",(t==null||t.annotation==null?null:t.annotation.type)==="multiThread")("ngIfElse",e)}}function w$t(n,o){if(n&1&&(f(0),C(1,"div",2),A(2,"translate"),g(3,D$t,5,10,"ng-container",3),S(),v()),n&2){let t=o.ngIf,e=l();d(),x("data-testid",e.componentId)("role","complementary")("aria-label",P(2,5,"Comments panel")),d(2),c("ngForOf",t.commentPinAnnotationsArray)("ngForTrackBy",e.trackById)}}var Pfe=(()=>{let o=class o{constructor(e,i,r,a,s){this.authService=e,this.commentService=i,this.domService=r,this.elementRef=a,this.loggingService=s,this.commentPinAnnotations=[],this.subscriptions=[],this.positionChangeDetectionSubscriptions=[],this.componentConfigSignal=Te({commentPinAnnotationsArray:[],selectedAnnotationsMap:{},user:void 0,inlineCommentMode:!1}),this.veltElement=!0,this.componentId="velt-comments-stream-view",this.subscriptions.push(this.authService.getUser$().subscribe(m=>{this.componentConfigSignal.update(p=>(p=T(I({},p),{user:m}),p))},m=>{this.loggingService.catch("Error in CommentsStreamViewComponent getUser$ subscription: ",m)})),this.subscriptions.push(this.domService.getSelectedAnnotationsMap$().subscribe(m=>{this.componentConfigSignal.update(p=>(p=T(I({},p),{selectedAnnotationsMap:m}),p)),setTimeout(()=>{this.calculatePosition(),Object.keys(this.componentConfigSignal().selectedAnnotationsMap).length===1&&this.goToAnnotation(this.componentConfigSignal().selectedAnnotationsMap[Object.keys(this.componentConfigSignal().selectedAnnotationsMap)[0]])},100)},m=>{this.loggingService.catch("Error in CommentsStreamViewComponent getSelectedAnnotationsMap$ subscription: ",m)})),this.subscriptions.push(this.commentService.getInlineCommentMode$().subscribe(m=>{this.componentConfigSignal.update(p=>(p=T(I({},p),{inlineCommentMode:m}),p))}))}ngOnInit(){this.setupA11yAttributes()}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentsStreamViewComponent setupA11yAttributes:",e)}}ngAfterViewInit(){this.streamViewContainerId&&(this.scrollableParentElement=document.getElementById(this.streamViewContainerId)),this.scrollableParentElement||(this.scrollableParentElement=fv(this.elementRef.nativeElement)),this.scrollableParentElement||(this.scrollableParentElement=document.documentElement),this.calculateTargetElementPositions()}ngOnChanges(e){try{e.commentPinAnnotations&&this.calculateTargetElementPositions()}catch(i){this.loggingService.catch("Error in CommentsStreamViewComponent ngOnChanges: ",i)}}goToAnnotation(e){let i=null;e.targetElement||e.areaAnnotationId?i=document.getElementById(`comment-pin-container-${e.annotationId}`):i=document.querySelector(`[data-velt-id='${e.annotationId}']`),i&&i.scrollIntoView({behavior:"auto",block:"center",inline:"nearest"})}togglePinSelection(e){try{this.componentConfigSignal().selectedAnnotationsMap[e.annotationId]||(this.goToAnnotation(e),this.domService.toggleAnnotationSelection(e))}catch(i){this.loggingService.catch("Error in CommentsStreamViewComponent togglePinSelection: ",i)}}saveComment(e,i){try{this.commentService.saveComment(e,i)}catch(r){this.loggingService.catch("Error in CommentsStreamViewComponent saveComment: ",r)}}calculateTargetElementPositions(){try{this.positionChangeDetectionSubscriptions.forEach(i=>{i.unsubscribe()});let e=[];if(this.commentPinAnnotations.forEach(i=>{let r={},a=null;i.targetElement||i.areaAnnotationId?a=document.getElementById(`comment-pin-container-${i.annotationId}`):a=document.querySelector(`[data-velt-id='${i.annotationId}']`),a&&(r.annotation=i,r.targetElement=a,r.targetOffsetTop=IU(a,this.scrollableParentElement)?.top||0,r.isInsidePdfViewer=Cv(a,j.ATTRIBUTES.VELT_PDF_VIEWER),e.push(r))}),e.sort((i,r)=>i.targetElement.getBoundingClientRect().top-r.targetElement.getBoundingClientRect().top),this.componentConfigSignal.update(i=>(i=T(I({},i),{commentPinAnnotationsArray:e}),i)),this.componentConfigSignal().commentPinAnnotationsArray?.length){let i=this.componentConfigSignal().commentPinAnnotationsArray[this.componentConfigSignal().commentPinAnnotationsArray.length-1]?.targetElement;this.detectPositionChange(i)}this.calculatePosition()}catch(e){this.loggingService.catch("Error in CommentsStreamViewComponent calculateTargetElementPositions: ",e)}}trackById(e,i){return i.annotation.annotationId}calculatePosition(){try{if(Object.keys(this.componentConfigSignal().selectedAnnotationsMap).length===1){let e=Object.keys(this.componentConfigSignal().selectedAnnotationsMap)[0],i=this.componentConfigSignal().commentPinAnnotationsArray.findIndex(s=>s.annotation.annotationId===e),r=this.componentConfigSignal().commentPinAnnotationsArray.slice(0,i+1).reverse(),a=this.componentConfigSignal().commentPinAnnotationsArray.slice(i);this.calculateDialogPosition(r,!0),this.calculateDialogPosition(a),r.shift(),this.componentConfigSignal.update(s=>(s=T(I({},s),{commentPinAnnotationsArray:[...r.reverse().slice(),...a.slice()]}),s))}else this.calculateDialogPosition(this.componentConfigSignal().commentPinAnnotationsArray)}catch(e){this.loggingService.catch("Error in CommentsStreamViewComponent calculatePosition: ",e)}}calculateDialogPosition(e,i=!1){try{e.forEach((r,a,s)=>{if(!r.dialogElement){let m=this.elementRef?.nativeElement?.querySelector(`[id="snippyly-comments-on-right-block-${r.annotation.annotationId}"]`);m&&(r.dialogElement=m,r.dialogOffsetTop=IU(m,this.scrollableParentElement)?.top||0)}if(!a)r.top=r.targetOffsetTop;else if(i){let m=s[a-1];if(r.dialogElement){let p=m.top-r.dialogElement?.getBoundingClientRect()?.height-24,h=r.targetOffsetTop;p<r.top?r.top=p:h&&(h<=p?r.top=h:r.top=p)}}else{let m=s[a-1];if(m.dialogElement){let p=m.top+m.dialogElement?.getBoundingClientRect()?.height+24,h=r.targetOffsetTop;p>r.dialogOffsetTop&&p>h?r.top=p:h&&(h>=p?r.top=h:r.top=p)}}})}catch(r){this.loggingService.catch("Error in CommentsStreamViewComponent calculateDialogPosition: ",r)}}detectPositionChange(e){try{let i=Rg(0,td).pipe(ce(()=>{let r=e.getBoundingClientRect();return{top:r.top,left:r.left}}),qt((r,a)=>r.top===a.top&&r.left===a.left),Pi());this.positionChangeDetectionSubscriptions.push(i.subscribe(()=>{this.calculateTargetElementPositions()},r=>{}))}catch(i){this.loggingService.catch("Error in CommentsStreamViewComponent detectPositionChange: ",i)}}ngOnDestroy(){try{this.subscriptions.forEach(e=>{e.unsubscribe()})}catch{}}};o.\u0275fac=function(i){return new(i||o)(u(He),u(we),u(Ne),u(k),u(y))},o.\u0275cmp=O({type:o,selectors:[["snippyly-comments-stream-view"]],hostVars:1,hostBindings:function(i,r){i&2&&x("data-velt-element",r.veltElement)},inputs:{commentPinAnnotations:"commentPinAnnotations",streamViewContainerId:"streamViewContainerId"},standalone:!1,features:[Xe],decls:1,vars:1,consts:[["commentDialogRef",""],[4,"ngIf"],["velt-ignore-change-detection","true",1,"snippyly-comments-on-right-container"],[4,"ngFor","ngForOf","ngForTrackBy"],["velt-ignore-change-detection","true",1,"snippyly-comments-on-right-block",3,"click","id"],[4,"ngIf","ngIfElse"],[3,"afterViewInit","saveComment","multiThreadAnnotationId","annotation","user","commentPinSelected"],[3,"afterViewInit","saveComment","annotation","user","commentPinSelected","inlineCommentMode","isInsidePdfViewer"]],template:function(i,r){i&1&&g(0,w$t,4,7,"ng-container",1),i&2&&c("ngIf",r.componentConfigSignal())},dependencies:[ht,Z,Go,rs,de],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}.snippyly-comments-on-right-container[_ngcontent-%COMP%]{position:absolute;top:0;right:10vw;width:300px;background:#90ee90}.snippyly-comments-on-right-container[_ngcontent-%COMP%] .snippyly-comments-on-right-block[_ngcontent-%COMP%]{position:absolute;box-shadow:none;transition:top .5s ease,left .5s ease,box-shadow .5s ease;left:0}.snippyly-comments-on-right-container[_ngcontent-%COMP%] .snippyly-comments-on-right-block.selected[_ngcontent-%COMP%]{left:-36px;z-index:1}.snippyly-comments-on-right-container[_ngcontent-%COMP%] .snippyly-comments-on-right-block .comment-dialog-container{transition:box-shadow .5s ease;box-shadow:none!important}.snippyly-comments-on-right-container[_ngcontent-%COMP%] .snippyly-comments-on-right-block.selected .comment-dialog-container{box-shadow:0 calc((1rem + 0px) * var(--velt-base-rem-unit)) calc((3rem + 0px) * var(--velt-base-rem-unit)) #0000002d!important}"],changeDetection:0});let n=o;return n})();var A$t=()=>["snippyly-inbox-panel"];function P$t(n,o){n&1&&Ue(0)}function M$t(n,o){if(n&1&&g(0,P$t,1,0,"ng-container",7),n&2){l();let t=pe(6);c("ngTemplateOutlet",t)}}function k$t(n,o){if(n&1){let t=q();C(0,"velt-multi-thread-comment-dialog-internal",11),A(1,"translate"),G("saveComment",function(i){N(t);let r=l(4);return F(r.saveComment(i))}),S()}if(n&2){let t=l(3).ngIf,e=l();c("multiThreadAnnotationId",t.commentAnnotation==null?null:t.commentAnnotation.annotationId)("annotation",t.commentAnnotation)("user",t.user)("commentPinSelected",!0)("inboxMode",!0),x("data-testid",e.componentId+"-multi-thread-dialog")("role","dialog")("aria-label",P(1,8,"Multi-thread comment dialog"))}}function R$t(n,o){if(n&1&&(f(0),g(1,k$t,2,10,"velt-multi-thread-comment-dialog-internal",10),v()),n&2){let t=l(2).ngIf;d(),c("ngIf",t.commentAnnotation&&t.user)}}function N$t(n,o){if(n&1){let t=q();C(0,"snippyly-comment-dialog",13),A(1,"translate"),G("saveComment",function(i){N(t);let r=l(4);return F(r.saveComment(i))}),S()}if(n&2){let t=l(3).ngIf,e=l();c("annotation",t.commentAnnotation)("user",t.user)("commentPinSelected",!0)("inboxMode",!0),x("data-testid",e.componentId+"-single-dialog")("role","dialog")("aria-label",P(1,7,"Single comment dialog"))}}function F$t(n,o){if(n&1&&g(0,N$t,2,9,"snippyly-comment-dialog",12),n&2){let t=l(2).ngIf;c("ngIf",t.commentAnnotation&&t.user)}}function L$t(n,o){if(n&1&&(C(0,"div",8),A(1,"translate"),g(2,R$t,2,1,"ng-container",9)(3,F$t,1,1,"ng-template",null,3,De),S()),n&2){let t=pe(4),e=l().ngIf,i=l();ge("mobile",e.isPhone)("visible",!!e.commentAnnotation),x("data-testid",i.componentId)("role","region")("aria-label",P(1,10,"Comment inbox container"))("aria-expanded",!!e.commentAnnotation),d(2),c("ngIf",(e==null||e.commentAnnotation==null?null:e.commentAnnotation.type)==="multiThread")("ngIfElse",t)}}function B$t(n,o){if(n&1&&(f(0),w(1,"div",5,0),g(3,M$t,1,1,"ng-template",6,1,De)(5,L$t,5,12,"ng-template",null,2,De),v()),n&2){let t=pe(2),e=l();d(),x("data-testid",e.componentId+"-trigger")("aria-hidden",!0),d(2),c("cdkConnectedOverlayOrigin",t)("cdkConnectedOverlayOpen",!0)("cdkConnectedOverlayDisableClose",!0)("cdkConnectedOverlayPanelClass",Nt(6,A$t))}}var Mfe=(()=>{let o=class o extends nt{constructor(e,i,r,a,s,m){super(s,m),this.authService=e,this.breakpointObserver=i,this.commentService=r,this.loggingService=a,this.elementRef=s,this.themeService=m,this.componentConfigSignal=Te({isPhone:!1,sidebarVisible:!1}),this.subscriptions=[],this.componentId="velt-comment-inbox";try{this.subscriptions.push(this.breakpointObserver.observe(Oi.XSmall).subscribe(p=>{p.matches?this.componentConfigSignal.update(h=>(h=T(I({},h),{isPhone:!0}),h)):this.componentConfigSignal.update(h=>(h=T(I({},h),{isPhone:!1}),h))},p=>{this.catchError("Error in CommentInboxComponent breakpointObserver subscription: ",p)}))}catch{}}ngOnInit(){try{this.setupA11yAttributes(),this.subscriptions.push(this.authService.getUser$().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{user:e}),i))},e=>{this.catchError("Error in CommentInboxComponent getUser$ subscription: ",e)}))}catch(e){this.catchError("Error in CommentInboxComponent ngOnInit: ",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentInboxComponent setupA11yAttributes:",e)}}ngOnChanges(e){try{e.commentAnnotation&&this.componentConfigSignal.update(i=>(i=T(I({},i),{commentAnnotation:e.commentAnnotation.currentValue}),i))}catch(i){this.catchError("Error in CommentInboxComponent ngOnChanges: ",i)}}ngOnDestroy(){this.subscriptions.forEach(e=>e.unsubscribe()),super.ngOnDestroy()}saveComment(e){try{(this.commentAnnotation||e.annotation)&&this.commentService.saveComment(this.commentAnnotation||e.annotation,e)}catch(i){this.catchError("Error in CommentInboxComponent saveComment: ",i)}}catchError(e,i,r){try{this.loggingService.catch(e,i,T(I({},r||{}),{annotationId:this.componentConfigSignal()?.commentAnnotation?.annotationId}))}catch{}}};o.\u0275fac=function(i){return new(i||o)(u(He),u(po),u(we),u(y),u(k),u(Ye))},o.\u0275cmp=O({type:o,selectors:[["snippyly-comment-inbox"]],inputs:{commentAnnotation:"commentAnnotation"},standalone:!1,features:[B,Xe],decls:1,vars:1,consts:[["sidebarTrigger","cdkOverlayOrigin"],["sidebarOverlay","cdkConnectedOverlay"],["sidebarRef",""],["commentDialogRef",""],[4,"ngIf"],["cdkOverlayOrigin",""],["cdkConnectedOverlay","",3,"cdkConnectedOverlayOrigin","cdkConnectedOverlayOpen","cdkConnectedOverlayDisableClose","cdkConnectedOverlayPanelClass"],[4,"ngTemplateOutlet"],["id","sCommentInboxContainer","data-velt-comment-disabled","true",1,"velt-comment-inbox--container","s-inbox-container"],[4,"ngIf","ngIfElse"],[3,"multiThreadAnnotationId","annotation","user","commentPinSelected","inboxMode","saveComment",4,"ngIf"],[3,"saveComment","multiThreadAnnotationId","annotation","user","commentPinSelected","inboxMode"],[3,"annotation","user","commentPinSelected","inboxMode","saveComment",4,"ngIf"],[3,"saveComment","annotation","user","commentPinSelected","inboxMode"]],template:function(i,r){i&1&&g(0,B$t,7,7,"ng-container",4),i&2&&c("ngIf",r.componentConfigSignal())},dependencies:[Z,vt,Vn,An,Go,rs,de],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}[_nghost-%COMP%]{--velt-green: var(--velt-light-mode-green);--velt-magenta: var(--velt-light-mode-magenta);--velt-amber: var(--velt-light-mode-amber);--velt-purple: var(--velt-light-mode-purple);--velt-cyan: var(--velt-light-mode-cyan);--velt-orange: var(--velt-light-mode-orange);--velt-black: var(--velt-light-mode-black);--velt-white: var(--velt-light-mode-white);--velt-gray: var(--velt-light-mode-gray);--velt-error: var(--velt-light-mode-error);--velt-error-hover: var(--velt-light-mode-error-hover);--velt-error-foreground: var(--velt-light-mode-error-foreground);--velt-error-light: var(--velt-light-mode-error-light);--velt-error-transparent: var(--velt-light-mode-error-transparent);--velt-warning: var(--velt-light-mode-warning);--velt-warning-hover: var(--velt-light-mode-warning-hover);--velt-warning-foreground: var(--velt-light-mode-warning-foreground);--velt-warning-light: var(--velt-light-mode-warning-light);--velt-warning-transparent: var(--velt-light-mode-warning-transparent);--velt-success: var(--velt-light-mode-success);--velt-success-hover: var(--velt-light-mode-success-hover);--velt-success-foreground: var(--velt-light-mode-success-foreground);--velt-success-light: var(--velt-light-mode-success-light);--velt-success-transparent: var(--velt-light-mode-success-transparent);--velt-accent: var(--velt-light-mode-accent);--velt-accent-text: var(--velt-light-mode-accent-text);--velt-accent-hover: var(--velt-light-mode-accent-hover);--velt-accent-foreground: var(--velt-light-mode-accent-foreground);--velt-accent-light: var(--velt-light-mode-accent-light);--velt-accent-transparent: var(--velt-light-mode-accent-transparent);--velt-text-0: var(--velt-light-mode-text-0);--velt-text-1: var(--velt-light-mode-text-1);--velt-text-2: var(--velt-light-mode-text-2);--velt-text-3: var(--velt-light-mode-text-3);--velt-text-4: var(--velt-light-mode-text-4);--velt-text-5: var(--velt-light-mode-text-5);--velt-text-6: var(--velt-light-mode-text-6);--velt-text-7: var(--velt-light-mode-text-7);--velt-text-8: var(--velt-light-mode-text-8);--velt-text-9: var(--velt-light-mode-text-9);--velt-text-10: var(--velt-light-mode-text-10);--velt-text-11: var(--velt-light-mode-text-11);--velt-text-12: var(--velt-light-mode-text-12);--velt-background-0: var(--velt-light-mode-background-0);--velt-background-1: var(--velt-light-mode-background-1);--velt-background-2: var(--velt-light-mode-background-2);--velt-background-3: var(--velt-light-mode-background-3);--velt-background-4: var(--velt-light-mode-background-4);--velt-background-5: var(--velt-light-mode-background-5);--velt-background-6: var(--velt-light-mode-background-6);--velt-background-7: var(--velt-light-mode-background-7);--velt-background-8: var(--velt-light-mode-background-8);--velt-background-9: var(--velt-light-mode-background-9);--velt-background-10: var(--velt-light-mode-background-10);--velt-border-0: var(--velt-light-mode-border-0);--velt-border-1: var(--velt-light-mode-border-1);--velt-border-2: var(--velt-light-mode-border-2);--velt-border-3: var(--velt-light-mode-border-3);--velt-border-4: var(--velt-light-mode-border-4);--velt-border-5: var(--velt-light-mode-border-5);--velt-border-6: var(--velt-light-mode-border-6);--velt-border-7: var(--velt-light-mode-border-7);--velt-border-8: var(--velt-light-mode-border-8);--velt-border-9: var(--velt-light-mode-border-9);--velt-border-10: var(--velt-light-mode-border-10);--velt-background-transparent: var(--velt-light-mode-background-transparent);--velt-border-transparent: var(--velt-light-mode-border-transparent);--velt-animation-transparent: var(--velt-light-mode-animation-transparent)}[dark][_nghost-%COMP%]{--velt-green: var(--velt-dark-mode-green);--velt-magenta: var(--velt-dark-mode-magenta);--velt-amber: var(--velt-dark-mode-amber);--velt-purple: var(--velt-dark-mode-purple);--velt-cyan: var(--velt-dark-mode-cyan);--velt-orange: var(--velt-dark-mode-orange);--velt-black: var(--velt-dark-mode-black);--velt-white: var(--velt-dark-mode-white);--velt-gray: var(--velt-dark-mode-gray);--velt-error: var(--velt-dark-mode-error);--velt-error-hover: var(--velt-dark-mode-error-hover);--velt-error-foreground: var(--velt-dark-mode-error-foreground);--velt-error-light: var(--velt-dark-mode-error-light);--velt-error-transparent: var(--velt-dark-mode-error-transparent);--velt-warning: var(--velt-dark-mode-warning);--velt-warning-hover: var(--velt-dark-mode-warning-hover);--velt-warning-foreground: var(--velt-dark-mode-warning-foreground);--velt-warning-light: var(--velt-dark-mode-warning-light);--velt-warning-transparent: var(--velt-dark-mode-warning-transparent);--velt-success: var(--velt-dark-mode-success);--velt-success-hover: var(--velt-dark-mode-success-hover);--velt-success-foreground: var(--velt-dark-mode-success-foreground);--velt-success-light: var(--velt-dark-mode-success-light);--velt-success-transparent: var(--velt-dark-mode-success-transparent);--velt-accent: var(--velt-dark-mode-accent);--velt-accent-text: var(--velt-dark-mode-accent-text);--velt-accent-hover: var(--velt-dark-mode-accent-hover);--velt-accent-foreground: var(--velt-dark-mode-accent-foreground);--velt-accent-light: var(--velt-dark-mode-accent-light);--velt-accent-transparent: var(--velt-dark-mode-accent-transparent);--velt-text-0: var(--velt-dark-mode-text-0);--velt-text-1: var(--velt-dark-mode-text-1);--velt-text-2: var(--velt-dark-mode-text-2);--velt-text-3: var(--velt-dark-mode-text-3);--velt-text-4: var(--velt-dark-mode-text-4);--velt-text-5: var(--velt-dark-mode-text-5);--velt-text-6: var(--velt-dark-mode-text-6);--velt-text-7: var(--velt-dark-mode-text-7);--velt-text-8: var(--velt-dark-mode-text-8);--velt-text-9: var(--velt-dark-mode-text-9);--velt-text-10: var(--velt-dark-mode-text-10);--velt-text-11: var(--velt-dark-mode-text-11);--velt-text-12: var(--velt-dark-mode-text-12);--velt-background-0: var(--velt-dark-mode-background-0);--velt-background-1: var(--velt-dark-mode-background-1);--velt-background-2: var(--velt-dark-mode-background-2);--velt-background-3: var(--velt-dark-mode-background-3);--velt-background-4: var(--velt-dark-mode-background-4);--velt-background-5: var(--velt-dark-mode-background-5);--velt-background-6: var(--velt-dark-mode-background-6);--velt-background-7: var(--velt-dark-mode-background-7);--velt-background-8: var(--velt-dark-mode-background-8);--velt-background-9: var(--velt-dark-mode-background-9);--velt-background-10: var(--velt-dark-mode-background-10);--velt-border-0: var(--velt-dark-mode-border-0);--velt-border-1: var(--velt-dark-mode-border-1);--velt-border-2: var(--velt-dark-mode-border-2);--velt-border-3: var(--velt-dark-mode-border-3);--velt-border-4: var(--velt-dark-mode-border-4);--velt-border-5: var(--velt-dark-mode-border-5);--velt-border-6: var(--velt-dark-mode-border-6);--velt-border-7: var(--velt-dark-mode-border-7);--velt-border-8: var(--velt-dark-mode-border-8);--velt-border-9: var(--velt-dark-mode-border-9);--velt-border-10: var(--velt-dark-mode-border-10);--velt-background-transparent: var(--velt-dark-mode-background-transparent);--velt-border-transparent: var(--velt-dark-mode-border-transparent);--velt-animation-transparent: var(--velt-dark-mode-animation-transparent)}*[_ngcontent-%COMP%]{box-sizing:border-box} .snippyly-inbox-panel{top:0!important;left:0!important}.s-overflow-hidden[_ngcontent-%COMP%]{overflow:hidden!important} .velt-comment-inbox--container{height:100vh;width:calc((26rem + 0px) * var(--velt-base-rem-unit));position:fixed;top:0;right:-100%;padding:var(--velt-spacing-lg);box-sizing:border-box;z-index:999999997;transition:width .5s ease-in-out,right .5s ease-in-out} .velt-comment-inbox--container.mobile{width:100%;height:100%;box-sizing:border-box;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px)} .velt-comment-inbox--container.visible{right:0}"],changeDetection:0});let n=o;return n})();function U$t(n,o){if(n&1){let t=q();f(0),C(1,"div",3),G("click",function(){let i=N(t).$implicit,r=l(2);return F(r.scrollToAnnotation(i==null?null:i.key))}),C(2,"div",4),te(3),A(4,"translate"),S()(),v()}if(n&2){let t=o.$implicit,e=l().ngIf,i=l();d(),rt("top",t.value.top,"%")("transform","translate(0, -"+t.value.top+"%)"),ge("v-unread-comment",!(e.user!=null&&e.user.isGuest)&&!(e.user!=null&&e.user.isAnonymous)&&(e.unreadCommentsMap==null?null:e.unreadCommentsMap[t==null||t.value==null||t.value.annotation==null?null:t.value.annotation.annotationId])),x("data-testid",i.componentId+"-pin-"+t.key)("role","button")("tabindex",0),d(),x("role","tooltip")("aria-hidden","true"),d(),ve(" ",P(4,12,"Go to comments here.")," ")}}function j$t(n,o){if(n&1&&(f(0),C(1,"div",1),A(2,"translate"),g(3,U$t,5,14,"ng-container",2),A(4,"keyvalue"),S(),v()),n&2){let t=o.ngIf,e=l();d(),ge("velt-comments-minimap-container--target-scrollable-element",!!t.targetScrollableElementId)("velt-comments-minimap-position--left",t.position==="left"),x("data-testid",e.componentId)("role","navigation")("aria-label",P(2,9,"Comments minimap")),d(2),c("ngForOf",P(4,11,t.commentAnnotationPositionMap))("ngForTrackBy",e.trackByAnnotationId)}}var G9=(()=>{let o=class o{constructor(e,i,r){this.commentService=e,this.loggingService=i,this.elementRef=r,this.commentAnnotations=[],this.targetScrollableElementId=null,this.position="right",this.commentCountsByPosition={},this.minimapHeatmapGradient="",this.componentConfigSignal=Te({targetScrollableElementId:null,position:"right",commentAnnotationPositionMap:{},user:null,unreadCommentsMap:null}),this.subscriptions=[],this.componentId="velt-comments-minimap",this.loggingService.log("%c[WB] Creating CLASS: CommentsMinimapComponent","color: blue;")}ngOnInit(){try{this.setupA11yAttributes(),this.subscriptions.push(this.commentService.getUnreadCommentsMap$().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{unreadCommentsMap:e}),i))}))}catch(e){this.loggingService.catch("Error in CommentsMinimapComponent ngOnInit: ",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentsMinimapComponent setupA11yAttributes:",e)}}ngOnChanges(e){try{e&&Object.keys(e).forEach(i=>{this.componentConfigSignal.update(r=>(r=T(I({},r),{[i]:e[i].currentValue}),r))}),e?.commentAnnotations&&setTimeout(()=>{this.setCommentAnnotationPositionMap()},200)}catch(i){this.loggingService.catch("Error in CommentsMinimapComponent ngOnChanges: ",i)}}trackByAnnotationId(e,i){return i?.annotation?.annotationId||e}setCommentAnnotationPositionMap(){try{this.componentConfigSignal.update(e=>(e=T(I({},e),{commentAnnotationPositionMap:{}}),e)),this.commentAnnotations.forEach(e=>{let i=null;if(e.targetElement||e.areaAnnotationId?i=document.getElementById(`comment-pin-container-${e.annotationId}`):i=document.querySelector(`[data-velt-id='${e.annotationId}']`),i){let r=this.getElementPosition(i)?.percentageOfTotalHeight;r!=null&&this.componentConfigSignal.update(a=>(a=T(I({},a),{commentAnnotationPositionMap:T(I({},a.commentAnnotationPositionMap),{[e.annotationId]:{annotation:e,top:r,element:i}})}),a))}})}catch(e){this.loggingService.catch("Error in CommentsMinimapComponent setCommentAnnotationPositionByCommentAnnotationIndex: ",e)}}scrollToAnnotation(e){try{let i=this.componentConfigSignal().commentAnnotationPositionMap[e];i&&i.element&&i.element.scrollIntoView({behavior:"smooth",block:"center",inline:"center"})}catch(i){this.loggingService.catch("Error in CommentsMinimapComponent scrollToAnnotation: ",i)}}getElementPosition(e){try{let i=0,r=e,a=this.componentConfigSignal().targetScrollableElementId&&document.getElementById(this.componentConfigSignal().targetScrollableElementId);for(;r&&(i+=r.offsetTop||0,r=r.offsetParent,!(a&&r===a)););let s=0;if(a)s=a.scrollHeight;else{let p=document.body,h=document.documentElement;s=Math.max(p.scrollHeight,p.offsetHeight,h.clientHeight,h.scrollHeight,h.offsetHeight)}let m=i/s*100;return{pixelsFromTop:i,percentageOfTotalHeight:m}}catch(i){return this.loggingService.catch("Error in CommentsMinimapComponent getElementPosition: ",i),null}}ngOnDestroy(){try{this.subscriptions.forEach(e=>{e.unsubscribe()})}catch(e){this.loggingService.catch("Error in CommentsMinimapComponent ngOnDestroy: ",e)}}};o.\u0275fac=function(i){return new(i||o)(u(we),u(y),u(k))},o.\u0275cmp=O({type:o,selectors:[["app-comments-minimap"]],inputs:{commentAnnotations:"commentAnnotations",user:"user",targetScrollableElementId:"targetScrollableElementId",position:"position"},standalone:!1,features:[Xe],decls:1,vars:1,consts:[[4,"ngIf"],[1,"v-comments-minimap-container"],[4,"ngFor","ngForOf","ngForTrackBy"],[1,"v-comment-minimap-pin",3,"click"],[1,"v-comment-count"]],template:function(i,r){i&1&&g(0,j$t,5,13,"ng-container",0),i&2&&c("ngIf",r.componentConfigSignal())},dependencies:[ht,Z,im,de],styles:['html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}[_nghost-%COMP%]{--velt-green: var(--velt-light-mode-green);--velt-magenta: var(--velt-light-mode-magenta);--velt-amber: var(--velt-light-mode-amber);--velt-purple: var(--velt-light-mode-purple);--velt-cyan: var(--velt-light-mode-cyan);--velt-orange: var(--velt-light-mode-orange);--velt-black: var(--velt-light-mode-black);--velt-white: var(--velt-light-mode-white);--velt-gray: var(--velt-light-mode-gray);--velt-error: var(--velt-light-mode-error);--velt-error-hover: var(--velt-light-mode-error-hover);--velt-error-foreground: var(--velt-light-mode-error-foreground);--velt-error-light: var(--velt-light-mode-error-light);--velt-error-transparent: var(--velt-light-mode-error-transparent);--velt-warning: var(--velt-light-mode-warning);--velt-warning-hover: var(--velt-light-mode-warning-hover);--velt-warning-foreground: var(--velt-light-mode-warning-foreground);--velt-warning-light: var(--velt-light-mode-warning-light);--velt-warning-transparent: var(--velt-light-mode-warning-transparent);--velt-success: var(--velt-light-mode-success);--velt-success-hover: var(--velt-light-mode-success-hover);--velt-success-foreground: var(--velt-light-mode-success-foreground);--velt-success-light: var(--velt-light-mode-success-light);--velt-success-transparent: var(--velt-light-mode-success-transparent);--velt-accent: var(--velt-light-mode-accent);--velt-accent-text: var(--velt-light-mode-accent-text);--velt-accent-hover: var(--velt-light-mode-accent-hover);--velt-accent-foreground: var(--velt-light-mode-accent-foreground);--velt-accent-light: var(--velt-light-mode-accent-light);--velt-accent-transparent: var(--velt-light-mode-accent-transparent);--velt-text-0: var(--velt-light-mode-text-0);--velt-text-1: var(--velt-light-mode-text-1);--velt-text-2: var(--velt-light-mode-text-2);--velt-text-3: var(--velt-light-mode-text-3);--velt-text-4: var(--velt-light-mode-text-4);--velt-text-5: var(--velt-light-mode-text-5);--velt-text-6: var(--velt-light-mode-text-6);--velt-text-7: var(--velt-light-mode-text-7);--velt-text-8: var(--velt-light-mode-text-8);--velt-text-9: var(--velt-light-mode-text-9);--velt-text-10: var(--velt-light-mode-text-10);--velt-text-11: var(--velt-light-mode-text-11);--velt-text-12: var(--velt-light-mode-text-12);--velt-background-0: var(--velt-light-mode-background-0);--velt-background-1: var(--velt-light-mode-background-1);--velt-background-2: var(--velt-light-mode-background-2);--velt-background-3: var(--velt-light-mode-background-3);--velt-background-4: var(--velt-light-mode-background-4);--velt-background-5: var(--velt-light-mode-background-5);--velt-background-6: var(--velt-light-mode-background-6);--velt-background-7: var(--velt-light-mode-background-7);--velt-background-8: var(--velt-light-mode-background-8);--velt-background-9: var(--velt-light-mode-background-9);--velt-background-10: var(--velt-light-mode-background-10);--velt-border-0: var(--velt-light-mode-border-0);--velt-border-1: var(--velt-light-mode-border-1);--velt-border-2: var(--velt-light-mode-border-2);--velt-border-3: var(--velt-light-mode-border-3);--velt-border-4: var(--velt-light-mode-border-4);--velt-border-5: var(--velt-light-mode-border-5);--velt-border-6: var(--velt-light-mode-border-6);--velt-border-7: var(--velt-light-mode-border-7);--velt-border-8: var(--velt-light-mode-border-8);--velt-border-9: var(--velt-light-mode-border-9);--velt-border-10: var(--velt-light-mode-border-10);--velt-background-transparent: var(--velt-light-mode-background-transparent);--velt-border-transparent: var(--velt-light-mode-border-transparent);--velt-animation-transparent: var(--velt-light-mode-animation-transparent)}.v-comments-minimap-container[_ngcontent-%COMP%]{display:block;position:fixed;height:100vh;top:0;right:0;background:#00000014;z-index:var(--velt-comments-minimap-z-index)}.v-comments-minimap-container[_ngcontent-%COMP%] .v-comment-minimap-pin[_ngcontent-%COMP%]{position:absolute;right:0;width:12px;height:4px;flex-shrink:0;border-radius:var(--velt-border-radius-2xs);border:1px solid rgba(255,255,255,.16);background:color-mix(in srgb,var(--velt-accent) 80%,transparent);cursor:pointer}.v-comments-minimap-container[_ngcontent-%COMP%] .v-comment-minimap-pin[_ngcontent-%COMP%] .v-comment-count[_ngcontent-%COMP%]{position:absolute;top:50%;right:20px;z-index:1000;min-width:max-content;background:color-mix(in srgb,var(--velt-accent) 80%,transparent);font-size:var(--velt-font-size-xs);padding:var(--velt-spacing-xs) var(--velt-spacing-sm);border-radius:var(--velt-border-radius-xs);transform:translateY(-50%);color:var(--velt-accent-foreground);display:none}.v-comments-minimap-container[_ngcontent-%COMP%] .v-comment-minimap-pin[_ngcontent-%COMP%] .v-comment-count[_ngcontent-%COMP%]:after{content:"";position:absolute;border-style:solid;border-width:4px 0 4px 4px;border-color:transparent color-mix(in srgb,var(--velt-accent) 80%,transparent);display:block;width:0;z-index:1;right:calc(var(--velt-spacing-xs) * -1);top:50%;transform:translateY(-50%)}.v-comments-minimap-container[_ngcontent-%COMP%] .v-comment-minimap-pin[_ngcontent-%COMP%]:hover .v-comment-count[_ngcontent-%COMP%]{display:block}.v-comments-minimap-container[_ngcontent-%COMP%] .v-comment-minimap-pin.v-unread-comment[_ngcontent-%COMP%]{background-color:color-mix(in srgb,var(--velt-error) 80%,transparent)}.v-comments-minimap-container[_ngcontent-%COMP%] .v-comment-minimap-pin.v-unread-comment[_ngcontent-%COMP%] .v-comment-count[_ngcontent-%COMP%]{background:color-mix(in srgb,var(--velt-error) 80%,transparent)}.v-comments-minimap-container[_ngcontent-%COMP%] .v-comment-minimap-pin.v-unread-comment[_ngcontent-%COMP%] .v-comment-count[_ngcontent-%COMP%]:after{border-color:transparent color-mix(in srgb,var(--velt-error) 80%,transparent)}.v-comments-minimap-container.velt-comments-minimap-container--target-scrollable-element[_ngcontent-%COMP%]{position:absolute;height:100%}.v-comments-minimap-container.velt-comments-minimap-position--left[_ngcontent-%COMP%], .v-comments-minimap-container.velt-comments-minimap-position--left[_ngcontent-%COMP%] .v-comment-minimap-pin[_ngcontent-%COMP%]{right:auto;left:0}.v-comments-minimap-container.velt-comments-minimap-position--left[_ngcontent-%COMP%] .v-comment-minimap-pin[_ngcontent-%COMP%] .v-comment-count[_ngcontent-%COMP%]{right:auto;left:20px}.v-comments-minimap-container.velt-comments-minimap-position--left[_ngcontent-%COMP%] .v-comment-minimap-pin[_ngcontent-%COMP%] .v-comment-count[_ngcontent-%COMP%]:after{right:auto;left:calc(var(--velt-spacing-xs) * -1);border-width:4px 4px 4px 0}'],changeDetection:0});let n=o;return n})();function $$t(n,o){n&1&&Ue(0)}function H$t(n,o){if(n&1&&(C(0,"velt-shadow-dom-internal"),g(1,$$t,1,0,"ng-container",6),S()),n&2){l();let t=pe(3);d(),c("ngTemplateOutlet",t)}}function z$t(n,o){if(n&1&&(w(0,"snippyly-comments-stream-view",10),A(1,"translate")),n&2){let t=l(3).ngIf,e=l();c("commentPinAnnotations",t.commentPinAnnotationsForStreamView)("streamViewContainerId",e.streamViewContainerId),x("data-testid",e.componentId+"-stream")("role","complementary")("aria-label",P(1,5,"Comments stream view"))}}function G$t(n,o){if(n&1&&(w(0,"snippyly-comment-inbox",11),A(1,"translate")),n&2){let t=l(3).ngIf,e=l();c("darkMode",t.darkMode)("commentAnnotation",t.selectedCommentAnnotation),x("data-testid",e.componentId+"-inbox")("role","complementary")("aria-label",P(1,5,"Comments inbox"))}}function W$t(n,o){if(n&1&&(w(0,"app-comments-minimap",12),A(1,"translate")),n&2){let t=l(3).ngIf,e=l();c("commentAnnotations",t.commentPinAnnotations)("user",t.user)("position",t.minimapPosition),x("data-testid",e.componentId+"-minimap")("role","complementary")("aria-label",P(1,6,"Comments location overview"))}}function q$t(n,o){if(n&1&&(w(0,"snippyly-comment-adder"),g(1,z$t,2,7,"snippyly-comments-stream-view",7)(2,G$t,2,7,"snippyly-comment-inbox",8)(3,W$t,2,8,"app-comments-minimap",9)),n&2){let t=l(2).ngIf,e=l();x("data-testid",e.componentId+"-adder"),d(),c("ngIf",t.streamMode&&t.commentsOnDom),d(),c("ngIf",t.inboxMode&&t.commentsOnDom),d(),c("ngIf",t.minimapEnabled&&t.commentsOnDom)}}function Y$t(n,o){if(n&1&&(f(0),g(1,H$t,2,1,"velt-shadow-dom-internal",5)(2,q$t,4,4,"ng-template",null,0,De),v()),n&2){let t=pe(3),e=l().ngIf;d(),c("ngIf",e.shadowDOM)("ngIfElse",t)}}function K$t(n,o){if(n&1){let t=q();f(0),g(1,Y$t,4,2,"ng-container",1),C(2,"div",2)(3,"slot",3),G("slotchange",function(i){N(t);let r=l();return F(r.handleCommentPinSlotChanged(i))}),S()(),w(4,"app-persistent-comment-mode",4),v()}if(n&2){let t=o.ngIf,e=l();d(),c("ngIf",t.isFirstComponent),d(),x("aria-hidden","true")("data-testid",e.componentId+"-slot-container"),d(2),c("componentConfigSignal",e.componentConfigSignal),x("data-testid",e.componentId+"-persistent-mode")}}var jH=(()=>{let o=class o{set textMode(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableTextComments():this.commentService.disableTextComments()}set popoverMode(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enablePopoverMode():this.commentService.disablePopoverMode()}set popoverTriangleComponent(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enablePopoverTriangleComponent():this.commentService.disablePopoverTriangleComponent()}set collapsedComments(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableCollapsedComments():this.commentService.disableCollapsedComments()}set shortUserName(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableShortUserName():this.commentService.disableShortUserName()}catch{}}set readOnly(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableReadOnly():this.commentService.disableReadOnly()}catch{}}set deleteThreadWithFirstComment(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableDeleteThreadWithFirstComment():this.commentService.disableDeleteThreadWithFirstComment()}catch{}}set resolveStatusAccessAdminOnly(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableResolveStatusAccessAdminOnly():this.commentService.disableResolveStatusAccessAdminOnly()}set svgAsImg(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableSvgAsImg():this.commentService.disableSvgAsImg()}catch{}}set commentToNearestAllowedElement(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableCommentToNearestAllowedElement():this.commentService.disableCommentToNearestAllowedElement()}catch{}}set floatingCommentDialog(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.commentService.disableFloatingComments(!i)}set moderatorMode(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.commentService.setModeratorMode(i)}set _streamMode(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.commentService.setStreamMode(i)}set atHereLabel(e){e&&this.contactService.setAtHereLabel(e)}set _atHereEnabled(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.contactService.enableAtHere():this.contactService.disableAtHere()}set _deleteReplyConfirmation(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableDeleteReplyConfirmation():this.commentService.disableDeleteReplyConfirmation()}set _expandMentionGroups(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableExpandMentionGroups():this.commentService.disableExpandMentionGroups()}set _showMentionGroupsFirst(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableShowMentionGroupsFirst():this.commentService.disableShowMentionGroupsFirst()}set _showMentionGroupsOnly(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableShowMentionGroupsOnly():this.commentService.disableShowMentionGroupsOnly()}set _fullExpanded(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableFullExpanded():this.commentService.disableFullExpanded()}catch{}}set _draftMode(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableDraftMode():this.commentService.disableDraftMode()}catch{}}set atHereDescription(e){e&&this.contactService.setAtHereDescription(e)}set _persistentCommentMode(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enablePersistentCommentMode():this.commentService.disablePersistentCommentMode()}set _seenByUsers(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableSeenByUsers():this.commentService.disableSeenByUsers()}set signInButton(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.commentService.enableSignInButton(i)}set upgradeButton(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.commentService.enableUpgradeButton(i)}set attachments(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.commentService.enableAttachment(i)}set recordings(e){let i=e;typeof e=="string"&&(i=e?.split(",")?.map(r=>r.trim()),this.commentService.setAllowedRecordings(i))}set reactions(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableReactions():this.commentService.disableReactions()}set deviceInfo(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.commentService.showScreenSizeInfo(i)}set commentIndex(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.commentService.showCommentIndex(i)}set dialogOnHover(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.commentService.setEnableDialogOnHover(i)}set dialogOnTargetElementClick(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.commentService.setEnableDialogOnTargetElementClick(i)}set priority(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.commentService.setEnablePriority(i)}set status(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.commentService.setEnableStatus(i)}set resolveButton(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.commentService.setEnableResolve(i)}set _inboxMode(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableInboxMode():this.commentService.disableInboxMode()}set _suggestionMode(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.commentService.setSuggestionMode(i)}set _mobileMode(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.commentService.setMobileMode(i)}set _inlineCommentMode(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableInlineCommentMode():this.commentService.disableInlineCommentMode()}set _privateCommentMode(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enablePrivateCommentMode():this.commentService.disablePrivateCommentMode()}set _minimap(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableMinimap():this.commentService.disableMinimap()}set _minimapPosition(e){try{this.componentConfigSignal.update(i=>(i=T(I({},i),{minimapPosition:e}),i)),this.commentService.setAnalyticsFeatureConfig({config:{minimapPosition:e}})}catch{}}set _ghostComments(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableGhostComments():this.commentService.disableGhostComments()}set _ghostCommentsIndicator(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableGhostCommentsMessage():this.commentService.disableGhostCommentsMessage()}set _commentsOnDom(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.showCommentsOnDom():this.commentService.hideCommentsOnDom()}set _resolvedCommentsOnDom(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.showResolvedCommentsOnDom():this.commentService.hideResolvedCommentsOnDom()}set _filterCommentsOnDom(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableFilterCommentsOnDom():this.commentService.disableFilterCommentsOnDom()}catch{}}set _bubbleOnPin(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableBubbleOnPin():this.commentService.disableBubbleOnPin()}catch{}}set _bubbleOnPinHover(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableBubbleOnPinHover():this.commentService.disableBubbleOnPinHover()}catch{}}set _multiThreadMode(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableMultiThread():this.commentService.disableMultiThread()}catch{}}set _multiThread(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableMultiThread():this.commentService.disableMultiThread()}catch{}}set _commentTool(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableCommentTool():this.commentService.disableCommentTool()}set _sidebarButtonOnCommentDialog(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableSidebarButtonOnCommentDialog():this.commentService.disableSidebarButtonOnCommentDialog()}set _deviceIndicatorOnCommentPins(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableDeviceIndicatorOnCommentPins():this.commentService.disableDeviceIndicatorOnCommentPins()}catch{}}set _scrollToComment(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableScrollToComment():this.commentService.disableScrollToComment()}set _userMentions(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableUserMentions():this.commentService.disableUserMentions()}set _deleteOnBackspace(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableDeleteOnBackspace():this.commentService.disableDeleteOnBackspace()}catch{}}set _hotkey(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableHotkey():this.commentService.disableHotkey()}catch{}}set _recordingSummary(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableRecordingSummary():this.commentService.disableRecordingSummary()}catch{}}set _recordingTranscription(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.recorderAnnotationService.enableRecordingTranscription():this.recorderAnnotationService.disableRecordingTranscription()}catch{}}set _recordingCountdown(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableRecordingCountdown():this.commentService.disableRecordingCountdown()}catch{}}set _unreadIndicatorMode(e){try{this.commentService.setUnreadIndicatorMode(e)}catch{}}set _enterKeyToSubmit(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableEnterKeyToSubmit():this.commentService.disableEnterKeyToSubmit()}catch{}}set _pinShadowDOM(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enablePinShadowDOM():this.commentService.disablePinShadowDOM()}catch{}}set _dialogShadowDOM(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableDialogShadowDOM():this.commentService.disableDialogShadowDOM()}catch{}}set _persistentCommentShadowDOM(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.componentConfigSignal.update(r=>(r=T(I({},r),{persistentCommentShadowDOM:!!i}),r)),this.commentService.setAnalyticsFeatureConfig({config:{persistentCommentShadowDOM:!!i}})}catch{}}set _shadowDOM(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.componentConfigSignal.update(r=>(r=T(I({},r),{shadowDOM:!!i,persistentCommentShadowDOM:!!i}),r)),this.componentConfigSignal().shadowDOM?(this.commentService.enableDialogShadowDOM(),this.commentService.enablePinShadowDOM(),this.commentService.enableTextCommentToolShadowDOM(),this.commentService.enableTextCommentToolbarShadowDOM()):(this.commentService.disableDialogShadowDOM(),this.commentService.disablePinShadowDOM(),this.commentService.disableTextCommentToolShadowDOM(),this.commentService.disableTextCommentToolbarShadowDOM()),this.commentService.setAnalyticsFeatureConfig({config:{shadowDom:!!i}})}catch{}}set _textCommentToolShadowDOM(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableTextCommentToolShadowDOM():this.commentService.disableTextCommentToolShadowDOM()}catch{}}set _pinDarkMode(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enablePinDarkMode():this.commentService.disablePinDarkMode()}catch{}}set _textCommentToolDarkMode(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableTextCommentToolDarkMode():this.commentService.disableTextCommentToolDarkMode()}catch{}}set _textCommentToolbarDarkMode(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableTextCommentToolbarDarkMode():this.commentService.disableTextCommentToolbarDarkMode()}catch{}}set _textCommentToolbarShadowDOM(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableTextCommentToolbarShadowDOM():this.commentService.disableTextCommentToolbarShadowDOM()}catch{}}set _changeDetectionInCommentMode(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableChangeDetectionInCommentMode():this.commentService.disableChangeDetectionInCommentMode()}catch{}}set _areaComment(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableAreaComment():this.commentService.disableAreaComment()}catch{}}set _pinCursorImage(e){try{this.commentService.setPinCursorImage(e||"")}catch{}}set allowedElementIds(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.commentService.setAllowedElementIds(i)}catch{}}set allowedElementClassNames(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.commentService.setAllowedElementClassNames(i)}catch{}}set allowedElementQuerySelectors(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.commentService.setAllowedElementQuerySelectors(i)}catch{}}set _commentPinHighlighter(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableCommentPinHighlighter():this.commentService.disableCommentPinHighlighter()}catch{}}set _customReactions(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.commentService.setCustomReactions(i)}catch{}}set customStatus(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.commentService.setCustomStatuses(i)}set customListDataOnAnnotation(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.commentService.createCustomListDataOnAnnotation(i)}set customListDataOnComment(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.autocompleteService.create(i)}set customPriority(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.customFilterService.setCustomPriorityFilters(i)}set _customAutocompleteSearch(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableCustomAutocompleteSearch():this.commentService.disableCustomAutocompleteSearch()}catch{}}set customCategory(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.customFilterService.setCustomCategories(i)}set composerMode(e){this.commentService.setComposerMode(e)}set autoCategorize(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.commentService.setEnableAutoCategorize(!!i)}catch(i){this.loggingService.catch("Error in CommentsContainerComponent set autoCategorize: ",i)}}set isDarkMode(e){this._darkAttribute=e,this.checkDarkMode(),this.commentService.setCommentContainerDarkMode(e===""||e==="true")}constructor(e,i,r,a,s,m,p,h,_,E,D,L){this.analyticsService=e,this.authService=i,this.domService=r,this.commentService=a,this.commentPinPortalService=s,this.commentTextPortalService=m,this.customFilterService=p,this.loggingService=h,this.elementRef=_,this.autocompleteService=E,this.contactService=D,this.recorderAnnotationService=L,this.onCommentAdd=new Ae,this.onSignIn=new Ae,this.onUpgrade=new Ae,this.onCustomPinInject=new Ae,this.onCommentUpdate=new Ae,this.onCommentAccept=new Ae,this.onCommentReject=new Ae,this.onSidebarButtonOnCommentDialogClick=new Ae,this.onCommentSelectionChange=new Ae,this.onCopyLink=new Ae,this.subscriptions=[],this.selectedAnnotationsMap={},this.commentAnnotationFocused=!1,this.enableGhostComments=!1,this.resolvedCommentsOnDom=!1,this.scrollToComment=!1,this.componentConfigSignal=Te({addCommentMode:!1,commentPinAnnotations:[],multiThreadCommentPinAnnotations:[],commentPinAnnotationsForStreamView:[],commentsOnDom:!1,inboxMode:!1,isFirstComponent:!0,minimapEnabled:!1,minimapPosition:"right",persistentCommentMode:!1,persistentModeBanner:!1,privateCommentModeEnabled:!1,selectedCommentAnnotation:void 0,shadowDOM:!0,streamMode:!1,user:null,darkMode:!1,disableCommentMode:this.disableCommentMode.bind(this),persistentCommentShadowDOM:!0}),this.veltId=Pn(),this.veltElement=!0,this.componentId="velt-comments-container";try{this.loggingService.log("%c[WB] Creating CLASS: CommentsContainerComponent","color: blue;"),this._darkAttribute=this.elementRef.nativeElement.getAttribute("dark");let H=new URL(window.location.href);this.focusCommentAnnotationId=H.searchParams.get(j.URL_PARAMS.COMMENT_ID),this.commentService.setCommentAddedEmitter(this.onCommentAdd)}catch(H){this.loggingService.catch("Error in CommentsContainerComponent constructor: ",H)}}ngOnInit(){try{this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;"),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentsContainerComponent ngOnInit:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentsContainerComponent setupA11yAttributes:",e)}}ngOnChanges(e){try{e&&Object.keys(e).forEach(i=>{this.componentConfigSignal.update(r=>(r=T(I({},r),{[i]:e[i].currentValue}),r))})}catch(i){this.loggingService.catch("Error in SubtitlesComponent ngOnChanges: ",i)}}ngAfterViewInit(){try{let e=document.querySelector(j.TAGS.SNIPPYLY_COMMENTS),i=document.querySelector(j.TAGS.VELT_COMMENTS);document.querySelector(`${j.TAGS.VELT_COMMENTS}[${j.ATTRIBUTES.VELT_IS_FIRST_COMPONENT}]`)||(i?this.veltId===i?.getAttribute(j.ATTRIBUTES.VELT_ID)&&(this.componentConfigSignal.update(a=>(a=T(I({},a),{isFirstComponent:!0}),a)),i?.setAttribute(j.ATTRIBUTES.VELT_IS_FIRST_COMPONENT,"true"),this.initComponent()):this.veltId===e?.getAttribute(j.ATTRIBUTES.VELT_ID)&&(this.componentConfigSignal.update(a=>(a=T(I({},a),{isFirstComponent:!0}),a)),e?.setAttribute(j.ATTRIBUTES.VELT_IS_FIRST_COMPONENT,"true"),this.initComponent()))}catch(e){this.loggingService.catch("Error in CommentsContainerComponent AfterViewInit: ",e)}}initComponent(){try{this.commentService.addAreaContainerTag(),this.subscriptions.push(this.authService.getUser$().pipe(Fe(e=>!!e)).subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{user:e}),i)),e&&this.setCommentInstalledInAnalytics()},e=>{this.loggingService.catch("Error in getUser: ",e)})),this.subscriptions.push(this.commentService.getStreamMode$().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{streamMode:e}),i))},e=>{this.loggingService.catch("Error in CommentsContainerComponent getStreamMode$ subscription: ",e)})),this.subscriptions.push(this.commentService.getInboxMode$().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{inboxMode:e}),i))},e=>{this.loggingService.catch("Error in CommentsContainerComponent getInboxMode$ subscription: ",e)})),this.subscriptions.push(this.commentService.getMinimap$().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{minimapEnabled:e}),i))},e=>{this.loggingService.catch("Error in CommentsContainerComponent getMinimap$ subscription: ",e)})),this.subscriptions.push(this.commentService.addCommentModeChange().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{addCommentMode:e}),i))},e=>{this.loggingService.catch("Error in CommentsContainerComponent addCommentModeChange subscription: ",e)})),this.subscriptions.push(this.commentService.persistentCommentModeChange().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{persistentCommentMode:e}),i))},e=>{this.loggingService.catch("Error in CommentsContainerComponent persistentCommentModeChange subscription: ",e)})),this.subscriptions.push(this.commentService.persistentModeBannerChange().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{persistentModeBanner:e}),i))},e=>{this.loggingService.catch("Error in CommentsContainerComponent persistentModeBannerChange subscription: ",e)})),this.subscriptions.push(this.commentService.getPrivateCommentMode$().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{privateCommentModeEnabled:e}),i))},e=>{this.loggingService.catch("Error in CommentsContainerComponent getPrivateCommentMode$ subscription: ",e)})),this.subscriptions.push(this.commentService.getScrollToComment$().subscribe(e=>{this.scrollToComment=e},e=>{this.loggingService.catch("Error in CommentsContainerComponent getScrollToComment$ subscription: ",e)})),this.subscriptions.push(this.commentService.getSignInButtonClick$().subscribe(()=>{this.onSignIn.emit()},e=>{this.loggingService.catch("Error in CommentsContainerComponent getSignInButtonClick$ subscription: ",e)})),this.subscriptions.push(this.commentService.getUpgradeButtonClick$().subscribe(()=>{this.onUpgrade.emit()},e=>{this.loggingService.catch("Error in CommentsContainerComponent getUpgradeButtonClick$ subscription: ",e)})),this.subscriptions.push(this.domService.getSelectedAnnotationsMap$().subscribe(e=>{this.selectedAnnotationsMap=e},e=>{this.loggingService.catch("Error in CommentsContainerComponent getSidebarVisibility$ subscription: ",e)})),this.subscriptions.push(this.commentPinPortalService.getCustomPinEvents$().subscribe(e=>{this.onCustomPinInject.emit(e)},e=>{this.loggingService.catch("Error in CommentsContainerComponent getCustomPinEvents$ subscription: ",e)})),this.subscriptions.push(this.commentService.commentUpdated$.subscribe(e=>{this.onCommentUpdate.emit(e)},e=>{this.loggingService.catch("Error in CommentsContainerComponent commentUpdated$ subscription: ",e)})),this.subscriptions.push(this.commentService.commentAccepted$.subscribe(e=>{this.onCommentAccept.emit(e)},e=>{this.loggingService.catch("Error in CommentsContainerComponent commentAccepted$ subscription: ",e)})),this.subscriptions.push(this.commentService.commentRejected$.subscribe(e=>{this.onCommentReject.emit(e)},e=>{this.loggingService.catch("Error in CommentsContainerComponent commentRejected$ subscription: ",e)})),this.subscriptions.push(this.commentService.getSidebarButtonOnCommentDialogClick$().subscribe(e=>{this.onSidebarButtonOnCommentDialogClick.emit(e)},e=>{this.loggingService.catch("Error in CommentsContainerComponent getSidebarButtonOnCommentDialogClick$ subscription: ",e)})),this.subscriptions.push(this.commentService.onCommentSelectionChange$().subscribe(e=>{this.onCommentSelectionChange.emit(e)},e=>{this.loggingService.catch("Error in CommentsContainerComponent onCommentSelectionChange$ subscription: ",e)})),this.subscriptions.push(this.commentService.getCopyLink$().subscribe(e=>{this.onCopyLink.emit(e)},e=>{this.loggingService.catch("Error in CommentsContainerComponent getCopyLink$ subscription: ",e)})),this.getAllCommentsOnCurrentDocument()}catch(e){this.loggingService.catch("Error in CommentsContainerComponent initComponent: ",e)}}getAllCommentsOnCurrentDocument(){this.loggingService.log("%c[WB] Calling FUNCTION: getAllCommentsOnCurrentDocument","color: green;");try{this.subscriptions.push(this.commentService.getCommentsOnDom$().pipe(he(e=>(this.componentConfigSignal.update(i=>(i=T(I({},i),{commentsOnDom:e}),i)),this.componentConfigSignal().commentsOnDom?Rn([this.commentService.getAllCommentAnnotations({detectGhostComments:!0,addFilterCommentsOnDomCheck:!0,analytics:{enabled:!0,properties:{source:"internal",sourceId:"commentsContainer"}}}),this.commentService.getAllMultiThreadCommentAnnotations(void 0,void 0,void 0,!0)]).pipe(ce(([i,r])=>[...i||[],...r||[]]),he(i=>this.commentService.getEnableGhostComments$().pipe(ce(r=>(this.enableGhostComments=r,i)))),he(i=>this.commentService.getCommentsOnDom$().pipe(ce(r=>(this.componentConfigSignal.update(a=>(a=T(I({},a),{commentsOnDom:r}),a)),i)))),he(i=>this.commentService.getResolvedCommentsOnDom$().pipe(ce(r=>(this.resolvedCommentsOnDom=r,i)))),he(i=>this.domService.getSelectedAnnotationsMap$().pipe(ce(r=>({filteredAnnotations:i||[],selectedAnnotationsMap:r||{}}))))):se({filteredAnnotations:[],selectedAnnotationsMap:{}})))).subscribe(e=>{try{this.loggingService.log(e),this.componentConfigSignal.update(s=>(s=T(I({},s),{commentPinAnnotations:e?.filteredAnnotations}),s)),this.commentService.setCommentAnnotationsFromCommentsContainer(this.componentConfigSignal().commentPinAnnotations);let i;this.componentConfigSignal().commentPinAnnotations.forEach(s=>{this.selectedAnnotationsMap[s?.annotationId]&&(s?.multiThreadAnnotationId||(i=s))}),this.componentConfigSignal.update(s=>(s=T(I({},s),{selectedCommentAnnotation:i}),s));let r=this.componentConfigSignal().commentPinAnnotations.filter(s=>s.targetElement&&s?.position);r=r.filter(s=>{let m=!0;return s?.ghostComment?.type===Ws.DIFFERENT_DEVICE&&!s?.ghostComment?.isSameGroup&&(e.selectedAnnotationsMap[s.annotationId]||(m=!1)),s?.ghostComment&&!this.enableGhostComments&&(m=!1),!this.resolvedCommentsOnDom&&!(this.commentService.getFilterCommentsOnDom()&&this.commentService.getCommentsFromSidebarMap())&&s.status!==void 0&&s.status.type==="terminal"&&(e.selectedAnnotationsMap[s.annotationId]||(m=!1)),m}),this.commentPinPortalService.checkPinsToRemove(r),r.forEach(s=>{this.commentPinPortalService.setCommentPin(s)});let a=this.componentConfigSignal().commentPinAnnotations.filter(s=>s.targetTextRange);a=a.filter(s=>!(!this.resolvedCommentsOnDom&&!(this.commentService.getFilterCommentsOnDom()&&this.commentService.getCommentsFromSidebarMap())&&s.status!==void 0&&s.status.type==="terminal"&&!e.selectedAnnotationsMap[s.annotationId])),this.commentTextPortalService.updateTextCommentAnnotations(a),this.componentConfigSignal.update(s=>(s=T(I({},s),{commentPinAnnotationsForStreamView:this.componentConfigSignal().commentPinAnnotations.slice()}),s)),this.focusCommentAnnotation()}catch(i){this.loggingService.catch("Error in CommentsContainerComponent getAllCommentsOnCurrentDocument inside subscription: ",i)}},e=>{this.loggingService.catch("Error in CommentsContainerComponent getAllCommentsOnCurrentDocument subscription: ",e)}))}catch(e){this.loggingService.catch("Error in CommentsContainerComponent getAllCommentsOnCurrentDocument: ",e)}}ngOnDestroy(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnDestroy","color: green;");try{this.unsubscribe(),this.commentService.setContextProvider(null),this.commentService.setCommentAddedEmitter(null),this.componentConfigSignal().isFirstComponent&&this.commentService.setCommentAnnotationsFromCommentsContainer([])}catch(e){this.loggingService.catch("Error in CommentsContainerComponent ondestroy: ",e)}}unsubscribe(){this.loggingService.log("%c[WB] Calling FUNCTION: unsubscribe","color: green;");try{this.subscriptions.map(e=>{e.unsubscribe()}),this.subscriptions=[]}catch(e){this.loggingService.catch("Error in CommentsContainerComponent unsubscribe: ",e)}}handleCommentPinSlotChanged(e){try{let i=e.target;if(i.assignedElements().length>0){let r=i.assignedElements()[0];this.commentPinPortalService.setCommentPinOverrideTemplate(r)}}catch(i){this.loggingService.catch("Error in CommentsContainerComponent handleCommentPinSlotChanged: ")}}focusCommentAnnotation(){if(this.focusCommentAnnotationId&&!this.commentAnnotationFocused){let e=this.componentConfigSignal().commentPinAnnotations.find(i=>i.annotationId===this.focusCommentAnnotationId);e&&(this.commentAnnotationFocused=!0,sessionStorage.setItem(j.SESSION_STORAGE.SNIPPYLY_AUTO_SELECT_ANNOTATION_ID,e.annotationId),this.selectedAnnotationsMap[e.annotationId]||this.domService.toggleAnnotationSelection(e),setTimeout(()=>{let i=null;e.targetElement||e.areaAnnotationId?i=document.getElementById(`comment-pin-container-${e.annotationId}`):(i=document.querySelector(`[data-velt-id='${e.annotationId}']`),sessionStorage.setItem(j.SESSION_STORAGE.SNIPPYLY_AUTO_SELECT_ANNOTATION_ID,e.annotationId)),i||(i=document.querySelector(`${j.TAGS.VELT_COMMENT_TEXT}[${j.ATTRIBUTES.ANNOTATION_ID}="${e.annotationId}"]`)),i&&this.scrollToComment&&i.scrollIntoView({behavior:"auto",block:"center",inline:"nearest"})},100))}}setCommentInstalledInAnalytics(){try{this.analyticsService.setInstalledFeature(ke.COMMENT)}catch(e){this.loggingService.catch("Error in CommentsContainerComponent setCommentInstalledInAnalytics: ",e)}}disableCommentMode(){try{this.commentService.disableAddCommentMode()}catch(e){this.loggingService.catch("Error in CommentsContainerComponent disableCommentMode: ",e)}}checkDarkMode(){try{this._darkAttribute===""?this.componentConfigSignal.update(e=>(e=T(I({},e),{darkMode:!0}),e)):this.componentConfigSignal.update(e=>(e=T(I({},e),{darkMode:!1}),e))}catch(e){this.loggingService.catch("Error in CommentsContainerComponent checkDarkMode: ",e)}}};o.\u0275fac=function(i){return new(i||o)(u(Ze),u(He),u(Ne),u(we),u(z9),u(l9),u(zo),u(y),u(k),u(el),u(Ci),u(ji))},o.\u0275cmp=O({type:o,selectors:[["app-comments-container"]],hostVars:2,hostBindings:function(i,r){i&2&&x("data-velt-id",r.veltId)("data-velt-element",r.veltElement)},inputs:{textMode:"textMode",popoverMode:"popoverMode",popoverTriangleComponent:"popoverTriangleComponent",collapsedComments:"collapsedComments",shortUserName:"shortUserName",readOnly:"readOnly",deleteThreadWithFirstComment:"deleteThreadWithFirstComment",resolveStatusAccessAdminOnly:"resolveStatusAccessAdminOnly",svgAsImg:"svgAsImg",commentToNearestAllowedElement:"commentToNearestAllowedElement",floatingCommentDialog:"floatingCommentDialog",moderatorMode:"moderatorMode",_streamMode:[0,"streamMode","_streamMode"],atHereLabel:"atHereLabel",_atHereEnabled:[0,"atHereEnabled","_atHereEnabled"],_deleteReplyConfirmation:[0,"deleteReplyConfirmation","_deleteReplyConfirmation"],_expandMentionGroups:[0,"expandMentionGroups","_expandMentionGroups"],_showMentionGroupsFirst:[0,"showMentionGroupsFirst","_showMentionGroupsFirst"],_showMentionGroupsOnly:[0,"showMentionGroupsOnly","_showMentionGroupsOnly"],_fullExpanded:[0,"fullExpanded","_fullExpanded"],_draftMode:[0,"draftMode","_draftMode"],atHereDescription:"atHereDescription",_persistentCommentMode:[0,"persistentCommentMode","_persistentCommentMode"],_seenByUsers:[0,"seenByUsers","_seenByUsers"],signInButton:"signInButton",upgradeButton:"upgradeButton",attachments:"attachments",recordings:"recordings",reactions:"reactions",deviceInfo:"deviceInfo",commentIndex:"commentIndex",dialogOnHover:"dialogOnHover",dialogOnTargetElementClick:"dialogOnTargetElementClick",priority:"priority",status:"status",resolveButton:"resolveButton",_inboxMode:[0,"inboxMode","_inboxMode"],_suggestionMode:[0,"suggestionMode","_suggestionMode"],_mobileMode:[0,"mobileMode","_mobileMode"],_inlineCommentMode:[0,"inlineCommentMode","_inlineCommentMode"],_privateCommentMode:[0,"privateCommentMode","_privateCommentMode"],_minimap:[0,"minimap","_minimap"],_minimapPosition:[0,"minimapPosition","_minimapPosition"],_ghostComments:[0,"ghostComments","_ghostComments"],_ghostCommentsIndicator:[0,"ghostCommentsIndicator","_ghostCommentsIndicator"],_commentsOnDom:[0,"commentsOnDom","_commentsOnDom"],_resolvedCommentsOnDom:[0,"resolvedCommentsOnDom","_resolvedCommentsOnDom"],_filterCommentsOnDom:[0,"filterCommentsOnDom","_filterCommentsOnDom"],_bubbleOnPin:[0,"bubbleOnPin","_bubbleOnPin"],_bubbleOnPinHover:[0,"bubbleOnPinHover","_bubbleOnPinHover"],_multiThreadMode:[0,"multiThreadMode","_multiThreadMode"],_multiThread:[0,"multiThread","_multiThread"],_commentTool:[0,"commentTool","_commentTool"],_sidebarButtonOnCommentDialog:[0,"sidebarButtonOnCommentDialog","_sidebarButtonOnCommentDialog"],_deviceIndicatorOnCommentPins:[0,"deviceIndicatorOnCommentPins","_deviceIndicatorOnCommentPins"],_scrollToComment:[0,"scrollToComment","_scrollToComment"],_userMentions:[0,"userMentions","_userMentions"],_deleteOnBackspace:[0,"deleteOnBackspace","_deleteOnBackspace"],_hotkey:[0,"hotkey","_hotkey"],_recordingSummary:[0,"recordingSummary","_recordingSummary"],_recordingTranscription:[0,"recordingTranscription","_recordingTranscription"],_recordingCountdown:[0,"recordingCountdown","_recordingCountdown"],_unreadIndicatorMode:[0,"unreadIndicatorMode","_unreadIndicatorMode"],_enterKeyToSubmit:[0,"enterKeyToSubmit","_enterKeyToSubmit"],_pinShadowDOM:[0,"pinShadowDom","_pinShadowDOM"],_dialogShadowDOM:[0,"dialogShadowDom","_dialogShadowDOM"],_persistentCommentShadowDOM:[0,"persistentCommentShadowDom","_persistentCommentShadowDOM"],_shadowDOM:[0,"shadowDom","_shadowDOM"],_textCommentToolShadowDOM:[0,"textCommentToolShadowDom","_textCommentToolShadowDOM"],_pinDarkMode:[0,"pinDarkMode","_pinDarkMode"],_textCommentToolDarkMode:[0,"textCommentToolDarkMode","_textCommentToolDarkMode"],_textCommentToolbarDarkMode:[0,"textCommentToolbarDarkMode","_textCommentToolbarDarkMode"],_textCommentToolbarShadowDOM:[0,"textCommentToolbarShadowDom","_textCommentToolbarShadowDOM"],_changeDetectionInCommentMode:[0,"changeDetectionInCommentMode","_changeDetectionInCommentMode"],_areaComment:[0,"areaComment","_areaComment"],_pinCursorImage:[0,"pinCursorImage","_pinCursorImage"],allowedElementIds:"allowedElementIds",allowedElementClassNames:"allowedElementClassNames",allowedElementQuerySelectors:"allowedElementQuerySelectors",_commentPinHighlighter:[0,"commentPinHighlighter","_commentPinHighlighter"],_customReactions:[0,"customReactions","_customReactions"],customStatus:"customStatus",customListDataOnAnnotation:"customListDataOnAnnotation",customListDataOnComment:"customListDataOnComment",customPriority:"customPriority",_customAutocompleteSearch:[0,"customAutocompleteSearch","_customAutocompleteSearch"],customCategory:"customCategory",streamViewContainerId:"streamViewContainerId",composerMode:"composerMode",autoCategorize:"autoCategorize",isDarkMode:[0,"darkMode","isDarkMode"]},outputs:{onCommentAdd:"onCommentAdd",onSignIn:"onSignIn",onUpgrade:"onUpgrade",onCustomPinInject:"onCustomPinInject",onCommentUpdate:"onCommentUpdate",onCommentAccept:"onCommentAccept",onCommentReject:"onCommentReject",onSidebarButtonOnCommentDialogClick:"onSidebarButtonOnCommentDialogClick",onCommentSelectionChange:"onCommentSelectionChange",onCopyLink:"onCopyLink"},standalone:!1,features:[Xe],decls:1,vars:1,consts:[["commentsDataRef",""],[4,"ngIf"],[2,"display","none"],["id","comment-pin-slot","name","comment-pin",3,"slotchange"],[3,"componentConfigSignal"],[4,"ngIf","ngIfElse"],[4,"ngTemplateOutlet"],[3,"commentPinAnnotations","streamViewContainerId",4,"ngIf"],[3,"darkMode","commentAnnotation",4,"ngIf"],[3,"commentAnnotations","user","position",4,"ngIf"],[3,"commentPinAnnotations","streamViewContainerId"],[3,"darkMode","commentAnnotation"],[3,"commentAnnotations","user","position"]],template:function(i,r){i&1&&g(0,K$t,5,5,"ng-container",1),i&2&&c("ngIf",r.componentConfigSignal())},dependencies:[Z,vt,tce,Pfe,Mfe,G9,tn,BC,de],encapsulation:2,changeDetection:0});let n=o;return n})();var Z$t=["sidebarRef"],X$t=n=>({componentConfigSignal:n}),Q$t=(n,o)=>({condition:n,data:o}),J$t=(n,o)=>({componentConfigSignal:n,sidebarRef:o}),eHt=(n,o)=>({template:n,context:o});function tHt(n,o){if(n&1&&(C(0,"div",5,0),w(2,"app-comment-sidebar-skeleton",6)(3,"app-comment-sidebar-panel",7)(4,"app-comment-sidebar-focused-thread",8),S()),n&2){let t=pe(1),e=l(3).ngIf,i=l();ge("s-overflow-hidden",e.moreFiltersVisible)("velt-sidebar--more-filters-visible",e.moreFiltersVisible),x("aria-expanded",e.sidebarVisible),d(2),c("componentConfigSignal",i.componentConfigSignal),d(),c("sidebarRef",t)("componentConfigSignal",i.componentConfigSignal),d(),c("componentConfigSignal",i.componentConfigSignal)("sidebarRef",t)}}function nHt(n,o){if(n&1){let t=q();f(0),C(1,"div",3),A(2,"translate"),G("click",function(i){N(t);let r=l(3);return F(r.onClick(i))}),g(3,tHt,5,10,"div",4),S(),v()}if(n&2){let t=l(2).ngIf,e=l();d(),ge("mobile",t.isPhone)("visible",t.sidebarVisible||t.embedMode||t.floatingMode)("floating",t.floatingMode)("embed",t.embedMode)("page",t.pageMode),c("ngClass",t.position),x("data-testid",e.componentId)("aria-label",P(2,14,"Comments sidebar")),d(2),c("veltDynamicTemplate",R(19,eHt,e.template,R(16,J$t,e.componentConfigSignal,e.sidebarRef)))}}function iHt(n,o){if(n&1&&(f(0),g(1,nHt,4,22,"ng-container",1),v()),n&2){let t=l().ngIf;d(),c("ngIf",t)}}function oHt(n,o){if(n&1&&(f(0),g(1,iHt,2,1,"ng-container",2),v()),n&2){let t=l();d(),c("veltIf",R(3,Q$t,t.conditionSignal(),M(1,X$t,t.componentConfigSignal)))}}var Rfe=(()=>{let o=class o extends nt{constructor(e,i,r,a){super(e,i,void 0,void 0,void 0,a,r),this.elementRef=e,this.themeService=i,this.loggingService=r,this.dynamicDataService=a,this.onWrapperClick=new Ae,this.componentId="velt-comments-sidebar-wrapper",super.initializeComponentConfigSignal(new We)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentsSidebarWrapperComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentsSidebarWrapperComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in setupA11yAttributes:",e)}}onClick(e){try{this.onWrapperClick.emit(e)}catch{}}};o.\u0275fac=function(i){return new(i||o)(u(k),u(Ye),u(y),u(b))},o.\u0275cmp=O({type:o,selectors:[["velt-comments-sidebar-wrapper-internal"]],viewQuery:function(i,r){if(i&1&&ot(Z$t,7),i&2){let a;Qe(a=Je())&&(r.sidebarRef=a.first)}},outputs:{onWrapperClick:"onWrapperClick"},standalone:!1,features:[U([b]),B],decls:1,vars:1,consts:[["sidebarRef",""],[4,"ngIf"],[4,"veltIf"],["data-velt-element","true","data-velt-comment-disabled","true","role","complementary",1,"velt-sidebar-container",3,"click","ngClass"],["class","velt-sidebar","role","region",3,"s-overflow-hidden","velt-sidebar--more-filters-visible",4,"veltDynamicTemplate"],["role","region",1,"velt-sidebar"],[3,"componentConfigSignal"],[3,"sidebarRef","componentConfigSignal"],[3,"componentConfigSignal","sidebarRef"]],template:function(i,r){i&1&&g(0,oHt,2,6,"ng-container",1),i&2&&c("ngIf",r.componentConfigSignal())},dependencies:[Br,Z,ne,mh,ch,HC,ae,de],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}[_nghost-%COMP%]{--velt-green: var(--velt-light-mode-green);--velt-magenta: var(--velt-light-mode-magenta);--velt-amber: var(--velt-light-mode-amber);--velt-purple: var(--velt-light-mode-purple);--velt-cyan: var(--velt-light-mode-cyan);--velt-orange: var(--velt-light-mode-orange);--velt-black: var(--velt-light-mode-black);--velt-white: var(--velt-light-mode-white);--velt-gray: var(--velt-light-mode-gray);--velt-error: var(--velt-light-mode-error);--velt-error-hover: var(--velt-light-mode-error-hover);--velt-error-foreground: var(--velt-light-mode-error-foreground);--velt-error-light: var(--velt-light-mode-error-light);--velt-error-transparent: var(--velt-light-mode-error-transparent);--velt-warning: var(--velt-light-mode-warning);--velt-warning-hover: var(--velt-light-mode-warning-hover);--velt-warning-foreground: var(--velt-light-mode-warning-foreground);--velt-warning-light: var(--velt-light-mode-warning-light);--velt-warning-transparent: var(--velt-light-mode-warning-transparent);--velt-success: var(--velt-light-mode-success);--velt-success-hover: var(--velt-light-mode-success-hover);--velt-success-foreground: var(--velt-light-mode-success-foreground);--velt-success-light: var(--velt-light-mode-success-light);--velt-success-transparent: var(--velt-light-mode-success-transparent);--velt-accent: var(--velt-light-mode-accent);--velt-accent-text: var(--velt-light-mode-accent-text);--velt-accent-hover: var(--velt-light-mode-accent-hover);--velt-accent-foreground: var(--velt-light-mode-accent-foreground);--velt-accent-light: var(--velt-light-mode-accent-light);--velt-accent-transparent: var(--velt-light-mode-accent-transparent);--velt-text-0: var(--velt-light-mode-text-0);--velt-text-1: var(--velt-light-mode-text-1);--velt-text-2: var(--velt-light-mode-text-2);--velt-text-3: var(--velt-light-mode-text-3);--velt-text-4: var(--velt-light-mode-text-4);--velt-text-5: var(--velt-light-mode-text-5);--velt-text-6: var(--velt-light-mode-text-6);--velt-text-7: var(--velt-light-mode-text-7);--velt-text-8: var(--velt-light-mode-text-8);--velt-text-9: var(--velt-light-mode-text-9);--velt-text-10: var(--velt-light-mode-text-10);--velt-text-11: var(--velt-light-mode-text-11);--velt-text-12: var(--velt-light-mode-text-12);--velt-background-0: var(--velt-light-mode-background-0);--velt-background-1: var(--velt-light-mode-background-1);--velt-background-2: var(--velt-light-mode-background-2);--velt-background-3: var(--velt-light-mode-background-3);--velt-background-4: var(--velt-light-mode-background-4);--velt-background-5: var(--velt-light-mode-background-5);--velt-background-6: var(--velt-light-mode-background-6);--velt-background-7: var(--velt-light-mode-background-7);--velt-background-8: var(--velt-light-mode-background-8);--velt-background-9: var(--velt-light-mode-background-9);--velt-background-10: var(--velt-light-mode-background-10);--velt-border-0: var(--velt-light-mode-border-0);--velt-border-1: var(--velt-light-mode-border-1);--velt-border-2: var(--velt-light-mode-border-2);--velt-border-3: var(--velt-light-mode-border-3);--velt-border-4: var(--velt-light-mode-border-4);--velt-border-5: var(--velt-light-mode-border-5);--velt-border-6: var(--velt-light-mode-border-6);--velt-border-7: var(--velt-light-mode-border-7);--velt-border-8: var(--velt-light-mode-border-8);--velt-border-9: var(--velt-light-mode-border-9);--velt-border-10: var(--velt-light-mode-border-10);--velt-background-transparent: var(--velt-light-mode-background-transparent);--velt-border-transparent: var(--velt-light-mode-border-transparent);--velt-animation-transparent: var(--velt-light-mode-animation-transparent)}[dark][_nghost-%COMP%]{--velt-green: var(--velt-dark-mode-green);--velt-magenta: var(--velt-dark-mode-magenta);--velt-amber: var(--velt-dark-mode-amber);--velt-purple: var(--velt-dark-mode-purple);--velt-cyan: var(--velt-dark-mode-cyan);--velt-orange: var(--velt-dark-mode-orange);--velt-black: var(--velt-dark-mode-black);--velt-white: var(--velt-dark-mode-white);--velt-gray: var(--velt-dark-mode-gray);--velt-error: var(--velt-dark-mode-error);--velt-error-hover: var(--velt-dark-mode-error-hover);--velt-error-foreground: var(--velt-dark-mode-error-foreground);--velt-error-light: var(--velt-dark-mode-error-light);--velt-error-transparent: var(--velt-dark-mode-error-transparent);--velt-warning: var(--velt-dark-mode-warning);--velt-warning-hover: var(--velt-dark-mode-warning-hover);--velt-warning-foreground: var(--velt-dark-mode-warning-foreground);--velt-warning-light: var(--velt-dark-mode-warning-light);--velt-warning-transparent: var(--velt-dark-mode-warning-transparent);--velt-success: var(--velt-dark-mode-success);--velt-success-hover: var(--velt-dark-mode-success-hover);--velt-success-foreground: var(--velt-dark-mode-success-foreground);--velt-success-light: var(--velt-dark-mode-success-light);--velt-success-transparent: var(--velt-dark-mode-success-transparent);--velt-accent: var(--velt-dark-mode-accent);--velt-accent-text: var(--velt-dark-mode-accent-text);--velt-accent-hover: var(--velt-dark-mode-accent-hover);--velt-accent-foreground: var(--velt-dark-mode-accent-foreground);--velt-accent-light: var(--velt-dark-mode-accent-light);--velt-accent-transparent: var(--velt-dark-mode-accent-transparent);--velt-text-0: var(--velt-dark-mode-text-0);--velt-text-1: var(--velt-dark-mode-text-1);--velt-text-2: var(--velt-dark-mode-text-2);--velt-text-3: var(--velt-dark-mode-text-3);--velt-text-4: var(--velt-dark-mode-text-4);--velt-text-5: var(--velt-dark-mode-text-5);--velt-text-6: var(--velt-dark-mode-text-6);--velt-text-7: var(--velt-dark-mode-text-7);--velt-text-8: var(--velt-dark-mode-text-8);--velt-text-9: var(--velt-dark-mode-text-9);--velt-text-10: var(--velt-dark-mode-text-10);--velt-text-11: var(--velt-dark-mode-text-11);--velt-text-12: var(--velt-dark-mode-text-12);--velt-background-0: var(--velt-dark-mode-background-0);--velt-background-1: var(--velt-dark-mode-background-1);--velt-background-2: var(--velt-dark-mode-background-2);--velt-background-3: var(--velt-dark-mode-background-3);--velt-background-4: var(--velt-dark-mode-background-4);--velt-background-5: var(--velt-dark-mode-background-5);--velt-background-6: var(--velt-dark-mode-background-6);--velt-background-7: var(--velt-dark-mode-background-7);--velt-background-8: var(--velt-dark-mode-background-8);--velt-background-9: var(--velt-dark-mode-background-9);--velt-background-10: var(--velt-dark-mode-background-10);--velt-border-0: var(--velt-dark-mode-border-0);--velt-border-1: var(--velt-dark-mode-border-1);--velt-border-2: var(--velt-dark-mode-border-2);--velt-border-3: var(--velt-dark-mode-border-3);--velt-border-4: var(--velt-dark-mode-border-4);--velt-border-5: var(--velt-dark-mode-border-5);--velt-border-6: var(--velt-dark-mode-border-6);--velt-border-7: var(--velt-dark-mode-border-7);--velt-border-8: var(--velt-dark-mode-border-8);--velt-border-9: var(--velt-dark-mode-border-9);--velt-border-10: var(--velt-dark-mode-border-10);--velt-background-transparent: var(--velt-dark-mode-background-transparent);--velt-border-transparent: var(--velt-dark-mode-border-transparent);--velt-animation-transparent: var(--velt-dark-mode-animation-transparent)}.velt-sidebar-container[_ngcontent-%COMP%]{height:100vh;width:calc((26rem + 0px) * var(--velt-base-rem-unit));position:fixed;top:0;padding:var(--velt-spacing-lg);box-sizing:border-box;z-index:999999997}.velt-sidebar-container.left[_ngcontent-%COMP%]{left:-100%;transition:width .5s ease-in-out,left .5s ease-in-out}.velt-sidebar-container.left.visible[_ngcontent-%COMP%]{left:0}.velt-sidebar-container.right[_ngcontent-%COMP%]{right:-100%;transition:width .5s ease-in-out,right .5s ease-in-out}.velt-sidebar-container.right.visible[_ngcontent-%COMP%]{right:0}.velt-sidebar-container.mobile[_ngcontent-%COMP%]{width:100%;height:100%;box-sizing:border-box;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px)}.velt-sidebar-container.embed[_ngcontent-%COMP%]{width:100%;height:100%;position:unset;border:0}.velt-sidebar-container.floating[_ngcontent-%COMP%]{height:90vh;position:unset;border:0;padding:0;width:calc((22.5rem + 0px) * var(--velt-base-rem-unit))}.velt-sidebar-container.floating.embed[_ngcontent-%COMP%]{width:100%;height:100%}.velt-sidebar-container.page[_ngcontent-%COMP%] .velt-sidebar[_ngcontent-%COMP%]{padding-bottom:0}.velt-sidebar-container[_ngcontent-%COMP%] *[_ngcontent-%COMP%]{box-sizing:border-box}.velt-sidebar-container[_ngcontent-%COMP%] .velt-sidebar[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:var(--velt-spacing-lg);font-weight:400;font-size:var(--velt-font-size-sm);line-height:21px;align-items:center;background:var(--velt-background-0);border-radius:var(--velt-border-radius-lg);width:100%;overflow-x:hidden;position:relative;height:100%;border:1px solid var(--velt-border-5)}.velt-sidebar-container[_ngcontent-%COMP%] .velt-sidebar[_ngcontent-%COMP%] app-comment-sidebar-filter[_ngcontent-%COMP%]{position:absolute;top:0;left:0;width:100%;height:100%;-webkit-user-select:none;user-select:none;pointer-events:none}.velt-sidebar-container[_ngcontent-%COMP%] .velt-sidebar.velt-sidebar--more-filters-visible[_ngcontent-%COMP%] app-comment-sidebar-filter[_ngcontent-%COMP%]{pointer-events:initial;-webkit-user-select:initial;user-select:initial}.velt-sidebar-container[_ngcontent-%COMP%] .velt-sidebar[_ngcontent-%COMP%]::-webkit-scrollbar{display:none;width:0;height:0}.velt-sidebar-container[_ngcontent-%COMP%] .velt-sidebar[_ngcontent-%COMP%]:not(.s-overflow-hidden){overflow-y:auto}[_nghost-%COMP%] velt-comments-sidebar-wireframe{width:100%;height:100%;display:flex;flex-direction:column;gap:var(--velt-spacing-lg)}"],changeDetection:0});let n=o;return n})();var aHt=["sidebarOverlay"],sHt=["virtualScrollViewportRef"],lHt=["host"],cHt=n=>["snippyly-sidebar-panel",n];function mHt(n,o){n&1&&Ue(0)}function dHt(n,o){if(n&1&&(C(0,"velt-shadow-dom-internal"),g(1,mHt,1,0,"ng-container",7),S()),n&2){l(3);let t=pe(3);d(),c("ngTemplateOutlet",t)}}function pHt(n,o){if(n&1&&(f(0),g(1,dHt,2,1,"velt-shadow-dom-internal",6),v()),n&2){l(2);let t=pe(3),e=l();d(),c("ngIf",!e.template&&e.sidebarShadowDOM)("ngIfElse",t)}}function gHt(n,o){n&1&&Ue(0)}function uHt(n,o){if(n&1&&(C(0,"velt-shadow-dom-internal"),g(1,gHt,1,0,"ng-container",7),S()),n&2){l(5);let t=pe(3);d(),c("ngTemplateOutlet",t)}}function hHt(n,o){if(n&1&&(C(0,"div",11),g(1,uHt,2,1,"velt-shadow-dom-internal",6),S()),n&2){let t=l(4).ngIf,e=pe(3),i=l();ge("dark",t.darkMode),d(),c("ngIf",!i.template&&i.sidebarShadowDOM)("ngIfElse",e)}}function fHt(n,o){if(n&1&&g(0,hHt,2,4,"div",10),n&2){let t=l(3).ngIf;c("ngIf",t==null?null:t.sidebarVisible)}}function vHt(n,o){if(n&1&&(w(0,"div",8,2),g(2,fHt,1,1,"ng-template",9,3,De)),n&2){let t=pe(1),e=l(2).ngIf;d(2),c("cdkConnectedOverlayOrigin",t)("cdkConnectedOverlayOpen",!0)("cdkConnectedOverlayDisableClose",!0)("cdkConnectedOverlayPanelClass",M(4,cHt,e.darkMode?"dark":""))}}function CHt(n,o){if(n&1&&g(0,pHt,2,2,"ng-container",6)(1,vHt,4,6,"ng-template",null,1,De),n&2){let t=pe(2),e=l().ngIf;c("ngIf",e.embedMode||e.floatingMode)("ngIfElse",t)}}function _Ht(n,o){if(n&1){let t=q();C(0,"velt-comments-sidebar-wrapper-internal",12),A(1,"translate"),G("onWrapperClick",function(i){N(t);let r=l(2);return F(r.onClick(i))}),S()}if(n&2){let t=l().ngIf,e=l();c("componentConfigSignal",e.componentConfigSignal)("template",e.template)("darkMode",t.darkMode),x("data-testid",e.componentId)("aria-label",P(1,6,"Comments sidebar"))("aria-modal",!0)}}function yHt(n,o){if(n&1&&(f(0),g(1,CHt,3,2,"ng-template",5)(2,_Ht,2,8,"ng-template",null,0,De),v()),n&2){let t=o.ngIf;d(),c("ngIf",t.isFirstComponent||t.floatingMode)}}var W9=(()=>{let o=class o extends nt{set _pageMode(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.componentConfigSignal.update(r=>(r=T(I({},r),{pageMode:i}),r))}catch(i){this.loggingService.catch("Error in CommentsSidebarComponent _pageMode: ",i)}}set _filterCount(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.componentConfigSignal.update(r=>(r=T(I({},r),{filterCount:i}),r))}catch(i){this.loggingService.catch("Error in CommentsSidebarComponent _filterCount: ",i)}}set _customActions(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableSidebarCustomActions():this.commentService.disableSidebarCustomActions()}catch(i){this.loggingService.catch("Error in CommentsSidebarComponent _pageMode: ",i)}}set focusedThreadMode(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableFocusedThreadMode():this.commentService.disableFocusedThreadMode()}catch(i){this.loggingService.catch("Error in CommentsSidebarComponent _pageMode: ",i)}}set _sortData(e){try{this.componentConfigSignal.update(i=>(i=T(I({},i),{sortData:e}),i))}catch(i){this.loggingService.catch("Error in CommentsSidebarComponent _sortData: ",i)}}set enableUrlNavigation(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableSidebarUrlNavigation():this.commentService.disableSidebarUrlNavigation()}set urlNavigation(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableSidebarUrlNavigation():this.commentService.disableSidebarUrlNavigation()}set _queryParamsComments(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i?this.commentService.enableQueryParamsComments():this.commentService.disableQueryParamsComments()}catch(i){this.loggingService.catch("Error in CommentsSidebarComponent _queryParamsComments: ",i)}}set _currentLocationSuffix(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.componentConfigSignal.update(r=>(r=T(I({},r),{currentLocationSuffix:!!i}),r))}catch{}}set _filterOptionLayout(e){try{this.componentConfigSignal.update(i=>(i=T(I({},i),{filterOptionLayout:e}),i))}catch{}}set _filterConfig(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i&&typeof i=="object"&&this.updateFilterConfig(i)}catch{}}set _groupConfig(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i&&typeof i=="object"&&this.componentConfigSignal.update(r=>(r=T(I({},r),{groupConfig:i}),r.groupConfig?.enable||(r.groupBy=null),r))}catch{}}set _filters(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i&&typeof i=="object"&&this.commentService.setCommentSidebarFilters(i)}catch{}}set _systemFiltersOperator(e){try{e&&this.commentService.setCommentSidebarSystemFiltersOperator(e)}catch{}}set _excludeLocationIds(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),i&&typeof i=="object"&&this.commentService.setExcludeLocationIdsFromSidebar(i)}catch{}}set _fullExpanded(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.componentConfigSignal.update(r=>(r=T(I({},r),{fullExpanded:!!i}),r))}catch{}}set _sidebarShadowDOM(e){try{let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.componentConfigSignal.update(r=>(r=T(I({},r),{shadowDom:i}),r)),i?this.commentService.enableSidebarShadowDOM():this.commentService.disableSidebarShadowDOM()}catch{}}constructor(e,i,r,a,s,m,p,h,_,E,D,L,H,K,oe,ue,be){super(p,be,void 0,r),this.analyticsService=e,this.authService=i,this.commentService=r,this.configService=a,this.domService=s,this.docService=m,this.elementRef=p,this.iamService=h,this.loggingService=_,this.breakpointObserver=E,this.customFilterService=D,this.translateService=L,this.cd=H,this.wireframeService=K,this.renderer=oe,this.dynamicComponentService=ue,this.themeService=be,this.embedMode=null,this.floatingMode=!1,this.dialogVariant="sidebar",this.focusedThreadDialogVariant="sidebar",this.filterPanelLayout="bottomSheet",this.pageModeComposerVariant="sidebar",this.searchPlaceholder="Search comments",this.openSidebar=new Ae,this.onSidebarOpen=new Ae,this.onSidebarCommentClick=new Ae,this.onSidebarCommentClickEvent=new Ae,this.onCommentClick=new Ae,this.onSidebarClose=new Ae,this.onCommentNavigationButtonClick=new Ae,this.subscriptions=[],this.locations={},this.commentAccessMode=Qi,this.commentReadAnalyticsCalled=!0,this.peopleTypes={all:"All",other:"Other"},this.pageTypes={all:"All",other:"Other"},this.unsetType={id:"unset",name:"Not set"},this.objectKeys=Object.keys,this.filteredGroupedCommentAnnotationsObj={},this.filteredGroupedCommentAnnotations=[],this.veltId=Pn(),this.veltElement=!0,this.defaultFilterConfig={location:{name:"Pages",enable:!0,multiSelection:!0,enableGrouping:!0},document:{name:"Documents",enable:!1,multiSelection:!0,enableGrouping:!1},people:{name:"Author",enable:!0,multiSelection:!0,enableGrouping:!0},assigned:{name:"Assigned",enable:!0,multiSelection:!0,enableGrouping:!0},tagged:{name:"Tagged",enable:!0,multiSelection:!0,enableGrouping:!0},priority:{name:"Priority",enable:!0,multiSelection:!0,enableGrouping:!1},status:{name:"Status",enable:!1,multiSelection:!0,enableGrouping:!1},category:{name:"Category",enable:!0,multiSelection:!0,enableGrouping:!1},commentType:{name:"Comment Type",enable:!0,multiSelection:!0,enableGrouping:!1},version:{name:"Versions",enable:!0,multiSelection:!1,enableGrouping:!1}},this.defaultGroupConfig={enable:!0,name:"Group By"},this.isUserGlobalContact=!1,this.resolvedCommentsOnDom=!1,this.position="right",this.commentRefId="",this.showDefault=!0,this.componentConfigSignal=Te({embedMode:this.embedMode,floatingMode:this.floatingMode,pageMode:!1,currentLocationSuffix:!1,queryParamsComments:!1,variant:this.variant,dialogVariant:this.dialogVariant,focusedThreadDialogVariant:this.focusedThreadDialogVariant,pageModeComposerVariant:this.pageModeComposerVariant,fullExpanded:!1,systemFiltersOperator:hc.AND,annotations:[],filteredCommentPinAnnotations:[],selectedAnnotationsMap:{},commentAnnotationsCountByFilters:{page:{},document:{},status:{},people:{},tagged:{},assigned:{},version:{},priority:{},commentCategory:{},accessMode:{}},noCommentsFound:!1,noCommentsFoundForAppliedFilters:!1,pageCommentAnnotation:new Ro,commentCategoryMap:j.CommentCategoryMap,virtualScrollData:[],isFirstComponent:!1,searchPlaceholder:this.searchPlaceholder,enableAutoCategorize:!1,filterConfig:JSON.parse(JSON.stringify(this.defaultFilterConfig)),filters:{pages:[],documents:[],statuses:[],statusIds:[],people:[],assigned:[],tagged:[],versions:[],versionIds:[],priorities:[],priorityIds:[],categories:[],categoryIds:[],accessModes:[],input:null},moreFiltersVisible:!1,groupByOptions:{},groupBy:null,peopleFilters:[],assignedFilters:[],taggedFilters:[],enablePriority:!1,enableStatus:!0,appliedFiltersCount:0,priorities:[],statuses:[],accessModes:[{id:Qi.PUBLIC,name:"Public"},{id:Qi.PRIVATE,name:"Private"}],filterOptionLayout:"checkbox",filterCount:!0,sidebarVisible:!1,pages:{},documents:{},showAllPages:!1,showAllDocuments:!1,versions:[],groupConfig:JSON.parse(JSON.stringify(this.defaultGroupConfig)),user:null,currentPage:null,currentDocument:null,isUserAdmin:!1,isPhone:!1,darkMode:!1,skeletonLoading:!0,shadowDom:void 0,position:this.position,filterPanelLayout:this.filterPanelLayout,customActionsState:{},readOnly:!1,trackByCategoryId:this.trackByCategoryId.bind(this),trackByPriorityId:this.trackByPriorityId.bind(this),trackByAccessModeId:this.trackByAccessModeId.bind(this),trackByPageKey:this.trackByPageKey.bind(this),trackByDocumentKey:this.trackByDocumentKey.bind(this),trackByPeople:this.trackByPeople.bind(this),trackByVersion:this.trackByVersion.bind(this),trackByGroupByOptionKey:this.trackByGroupByOptionKey.bind(this),onCommentAnnotationClick:this.onCommentAnnotationClick.bind(this),saveComment:this.saveComment.bind(this),trackCommentPinAnnotations:this.trackCommentPinAnnotations.bind(this),updateFilter:this.updateFilter.bind(this),toggleGroupedCommentAnnotations:this.toggleGroupedCommentAnnotations.bind(this),changeGroupBy:this.changeGroupBy.bind(this),closeSidebar:this.closeSidebar.bind(this),toggleMoreFilters:this.toggleMoreFilters.bind(this),savePageComment:this.savePageComment.bind(this),sortComments:this.sortComments.bind(this),goBackToAllComments:this.goBackToAllComments.bind(this),minimalFilterDropdownOpen:!1,minimalActionsDropdownOpen:!1,toggleMinimalFilterDropdown:this.toggleMinimalFilterDropdown.bind(this),unreadCommentsMap:null,minimalFilter:"all",filterCommentsByReadStatus:this.filterCommentsByReadStatus.bind(this),selectedMinimalFilterDropdownOption:{sorting:"date",filter:"all"},locationFilterDropdownOpen:!1,toggleLocationFilterDropdown:this.toggleLocationFilterDropdown.bind(this),documentFilterDropdownOpen:!1,toggleDocumentFilterDropdown:this.toggleDocumentFilterDropdown.bind(this),closeDocumentFilterDropdown:this.closeDocumentFilterDropdown.bind(this),markAllCommentAnnotationsAsRead:this.markAllCommentAnnotationsAsRead.bind(this),markAllCommentAnnotationsAsResolved:this.markAllCommentAnnotationsAsResolved.bind(this),toggleMinimalActionsDropdown:this.toggleMinimalActionsDropdown.bind(this),toggleCustomAction:this.toggleCustomAction.bind(this),focusedThreadMode:!1,focusedAnnotation:null,navigateToComment:this.navigateToComment.bind(this),resetFilters:this.resetFilters.bind(this),filterSearch:this.filterSearch.bind(this)}),this.sidebarShadowDOM=!1,this.dataAvailable=!1,this.componentId="velt-comments-sidebar";try{this.subscriptions.push(super.onDarkModeChange().subscribe(qe=>{this.componentConfigSignal.update(Re=>(Re=T(I({},Re),{darkMode:qe}),Re))})),this.loggingService.log("%c[WB] Creating CLASS: CommentsSidebarComponent","color: blue;"),this.componentConfigSignal.update(qe=>(qe=T(I({},qe),{groupBy:qe.groupByOptions.page}),qe.pageCommentAnnotation.isPageAnnotation=!0,qe)),this.updateGroupByOptions(),this.subscriptions.push(this.commentService.getSidebarShadowDOM$().subscribe(qe=>{this.sidebarShadowDOM=qe})),this.subscriptions.push(this.commentService.getFocusedThreadMode$().subscribe(qe=>{this.componentConfigSignal.update(Re=>(Re=T(I({},Re),{focusedThreadMode:qe}),Re))})),this.subscriptions.push(this.commentService.getReadOnly$().subscribe(qe=>{this.componentConfigSignal.update(Re=>(Re=T(I({},Re),{readOnly:qe}),Re))})),this.subscriptions.push(this.commentService.getQueryParamsComments$().subscribe(qe=>{this.componentConfigSignal.update(Re=>(Re=T(I({},Re),{queryParamsComments:qe}),Re)),this.setPages(),this.setDocuments()})),this.subscriptions.push(this.commentService.getUnreadCommentsMap$().subscribe(qe=>{this.componentConfigSignal.update(Re=>(Re=T(I({},Re),{unreadCommentsMap:qe}),Re))})),this.subscriptions.push(this.breakpointObserver.observe(Oi.XSmall).subscribe(qe=>{qe.matches?this.componentConfigSignal.update(Re=>(Re=T(I({},Re),{isPhone:!0}),Re)):this.componentConfigSignal.update(Re=>(Re=T(I({},Re),{isPhone:!1}),Re))},qe=>{this.loggingService.catch("Error in CommentsSidebarComponent breakpointObserver subscription: ",qe)})),this.subscriptions.push(this.customFilterService.customStatusMap$.subscribe(qe=>{this.statusMap=qe,this.componentConfigSignal.update(Re=>(Re=T(I({},Re),{statuses:Object.values(qe)}),Re)),this.pruneStaleStatuses()})),this.subscriptions.push(this.customFilterService.customPriorityMap$.subscribe(qe=>{this.priorityMap=qe,this.componentConfigSignal.update(Re=>(Re=T(I({},Re),{priorities:[...Object.values(qe),{id:"unset",name:"Not set",color:"#FFFFFF"}]}),Re)),this.pruneStalePriorities()})),this.subscriptions.push(this.customFilterService.customCategoryMap$.subscribe(qe=>{this.componentConfigSignal.update(Re=>(Re=T(I({},Re),{commentCategoryMap:T(I({},qe),{other:{id:"other",name:"Other",color:"#00C48C"}})}),Re)),this.pruneStaleCategories()}));let Le=sessionStorage.getItem(j.SESSION_STORAGE.VELT_COMMENT_SIDEBAR_CUSTOM_ACTIONS_STATE);Le&&this.componentConfigSignal.update(qe=>(qe=T(I({},qe),{customActionsState:JSON.parse(Le)}),qe))}catch(Le){this.loggingService.catch("Error in CommentsSidebarComponent constructor: ",Le)}}ngOnInit(){try{if(this.setupA11yAttributes(),sessionStorage.getItem(j.SESSION_STORAGE.SNIPPYLY_COMMENT_SIDEBAR_FILTERS)){let e=JSON.parse(sessionStorage.getItem(j.SESSION_STORAGE.SNIPPYLY_COMMENT_SIDEBAR_FILTERS));delete e?.input,e?.people?.length&&e.people.find(i=>typeof i=="string")&&(e.people=[]),e?.pages?.length&&e.pages?.forEach(i=>{i?.id||(i.id=i.displayName)}),sessionStorage.getItem(j.SESSION_STORAGE.VELT_COMMENT_SIDEBAR_FILTERS_RESET)||(e.pages=[],sessionStorage.setItem(j.SESSION_STORAGE.VELT_COMMENT_SIDEBAR_FILTERS_RESET,"true")),this.componentConfigSignal.update(i=>(i=T(I({},i),{filters:e}),i)),this.pruneStaleStatuses(),this.pruneStalePriorities(),this.pruneStaleCategories()}if(sessionStorage.getItem(j.SESSION_STORAGE.SNIPPYLY_COMMENT_SIDEBAR_GROUP_BY)){let e=sessionStorage.getItem(j.SESSION_STORAGE.SNIPPYLY_COMMENT_SIDEBAR_GROUP_BY);e&&this.componentConfigSignal.update(i=>(i=I({},i),Object.keys(i.groupByOptions).forEach(r=>{i.groupByOptions[r]===e&&(i.groupBy=e)}),i))}}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent OnInit: ",e)}try{let e="velt-comments-sidebar-wireframe";this.variant&&(e+=`---${this.variant}`),this.subscriptions.push(this.wireframeService.getWireframe$(e).subscribe(i=>{if(i){this.commentRefId="comment-sidebar";let r=document.createElement(i.tagName);r.innerHTML=i.innerHTML,this.template=r}}))}catch(e){this.loggingService.catch("Error in CommentDialogComponent OnInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy(),this.subscriptions.forEach(e=>{e.unsubscribe()}),this.getAllCommentAnnotationsSubscription&&this.getAllCommentAnnotationsSubscription.unsubscribe(),this.componentConfigSignal.update(e=>(e=T(I({},e),{minimalFilterDropdownOpen:!1}),e)),this.commentService.setCommentsFromSidebarMap(null)}catch{}}ngAfterViewInit(){try{if(this.floatingMode)this.initComponent();else{let e=document.querySelector(j.TAGS.SNIPPYLY_COMMENTS_SIDEBAR),i=document.querySelector(j.TAGS.VELT_COMMENTS_SIDEBAR);i?this.veltId===i?.getAttribute(j.ATTRIBUTES.VELT_ID)&&(this.componentConfigSignal.update(r=>(r=T(I({},r),{isFirstComponent:!0}),r)),setTimeout(()=>{this.sidebarOverlay?.overlayRef?.hostElement&&(this.sidebarOverlay.overlayRef.hostElement.style.zIndex="1001")},100),this.initComponent()):this.veltId===e?.getAttribute(j.ATTRIBUTES.VELT_ID)&&(this.componentConfigSignal.update(r=>(r=T(I({},r),{isFirstComponent:!0}),r)),setTimeout(()=>{this.sidebarOverlay?.overlayRef?.hostElement&&(this.sidebarOverlay.overlayRef.hostElement.style.zIndex="1001")},100),this.initComponent())}}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent AfterViewInit: ",e)}}ngOnChanges(e){try{super.ngOnChanges(e),e&&Object.keys(e).forEach(i=>{this.componentConfigSignal.update(r=>(r=T(I({},r),{[i]:e[i].currentValue}),r))})}catch(i){this.loggingService.catch("Error in CommentsSidebarComponent ngOnChanges: ",i)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent setupA11yAttributes:",e)}}onClick(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: onClick","color: green;");let i=e?.target?.tagName?.toLowerCase();i!==j.TAGS.VELT_COMMENT_DIALOG&&i!==j.TAGS.SNIPPYLY_COMMENT_DIALOG&&!e?.target?.closest(j.TAGS.VELT_COMMENT_DIALOG)&&!e?.target?.closest(j.TAGS.SNIPPYLY_COMMENT_DIALOG)&&this.domService.resetSelectedAnnotationsMap()}catch(i){this.loggingService.catch("Error in CommentsSidebarComponent onClick: ",i)}}pruneStaleStatuses(){try{this.statusMap!==void 0&&this.componentConfigSignal.update(e=>(e=I({},e),e.filters.statuses=e.filters.statuses.filter(i=>i.id in this.statusMap),e.filters.statusIds=e.filters.statuses?.map(i=>i?.id),e))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent filterStaleStatuses: ",e)}}pruneStalePriorities(){try{this.priorityMap!==void 0&&this.componentConfigSignal.update(e=>(e=I({},e),e.filters.priorities=e.filters.priorities.filter(i=>i.id in this.priorityMap),e.filters.priorityIds=e.filters.priorities?.map(i=>i.id),e))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent filterStalePriorities: ",e)}}pruneStaleCategories(){try{this.componentConfigSignal().commentCategoryMap!==void 0&&this.componentConfigSignal.update(e=>(e=I({},e),e.filters.categories=e.filters.categories?.filter(i=>i.id in e.commentCategoryMap),e.filters.categoryIds=e.filters.categories?.map(i=>i.id),e))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent filterStaleCategories: ",e)}}trackByAnnotationGroup(e,i){return i?.displayName}trackByAnnotationId(e,i){return i?.annotationId}trackByCategoryId(e,i){return i?.value?.id||e}trackByPriorityId(e,i){return i?.id||e}trackByAccessModeId(e,i){return i?.id||e}trackByPageKey(e,i){return i?.key||e}trackByDocumentKey(e,i){return i?.key||e}trackByPeople(e,i){return i?.id||e}trackByVersion(e,i){return i?.id||e}trackByGroupByOptionKey(e,i){return i?.key||e}initComponent(){try{this.subscriptions.push(this.authService.getUser$().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{user:e}),i)),this.componentConfigSignal().user&&(this.setCommentSidebarInstalledInAnalytics(),this.setCommentSidebarEmbedModeInAnalytics(),this.setCommentSidebarFloatingModeInAnalytics())},e=>{this.loggingService.catch("Error in CommentsSidebarComponent getUser$ subscription: ",e)})),this.subscriptions.push(this.docService.getDocumentPaths$().subscribe(e=>{this.documentPaths=e,this.getAllCommentsOnCurrentDocument()},e=>{this.loggingService.catch("Error in CommentsSidebarComponent getDocumentPaths$ subscription: ",e)})),this.subscriptions.push(this.commentService.getSidebarCustomActionEventData().subscribe(e=>{e&&(this.componentConfigSignal.update(i=>(i=T(I({},i),{customActionsState:e.actions}),i)),sessionStorage.setItem(j.SESSION_STORAGE.VELT_COMMENT_SIDEBAR_CUSTOM_ACTIONS_STATE,JSON.stringify(e.actions)))})),this.subscriptions.push(this.docService.getLocation$().subscribe(e=>{this.location=e;let i=this.commentService.getCommentSidebarFilters(),r=i?I({},i):{version:[]};this.location?.location?.version?r.version=[{id:this.location.location.version?.id,name:this.location.location.version?.name}]:r?.version||(r.version=[]),this.commentService.setCommentSidebarFilters(r),this.setPages(),this.filteredGroupedCommentAnnotationsObj={}},e=>{this.loggingService.catch("Error in CommentsSidebarComponent getLocation$ subscription: ",e)})),this.subscriptions.push(this.docService.getLocations$().subscribe(e=>{this.locations=e,this.filteredGroupedCommentAnnotationsObj={}})),this.subscriptions.push(this.commentService.getEnableStatus$().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{enableStatus:e}),i))})),this.subscriptions.push(this.commentService.getEnablePriority$().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{enablePriority:e}),i))},e=>{this.loggingService.catch("Error in CommentsSidebarComponent getEnablePriority$ subscription: ",e)})),this.subscriptions.push(this.commentService.getEnableAutoCategorize$().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{enableAutoCategorize:e}),i))})),this.subscriptions.push(this.commentService.getSidebarVisibility$().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{sidebarVisible:e}),i)),this.componentConfigSignal().sidebarVisible&&(this.commentReadAnalyticsCalled=!1,setTimeout(()=>{Object.keys(this.componentConfigSignal().selectedAnnotationsMap).length&&this.goToAnnotationInSidebar(this.componentConfigSignal().selectedAnnotationsMap[Object.keys(this.componentConfigSignal().selectedAnnotationsMap)[0]])},500)),this.componentConfigSignal().sidebarVisible?(this.getAllCommentsOnCurrentDocument(),this.commentService.setCommentsFromSidebarMap(this.componentConfigSignal().filteredCommentPinAnnotations)):(this.getAllCommentAnnotationsSubscription&&this.getAllCommentAnnotationsSubscription.unsubscribe(),this.commentService.setCommentsFromSidebarMap(null))},e=>{this.loggingService.catch("Error in CommentsSidebarComponent getSidebarVisibility$ subscription: ",e)})),this.subscriptions.push(this.commentService.getCommentSidebarFilters$().subscribe(e=>{this.mergeClientFilters(e)})),this.subscriptions.push(this.commentService.getCommentSidebarSystemFiltersOperator$().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{systemFiltersOperator:e}),i)),this.filterCommentAnnotations()})),this.subscriptions.push(this.commentService.getOpenSidebar$().subscribe(e=>{this.openSidebar.emit(e),this.onSidebarOpen.emit(e)},e=>{this.loggingService.catch("Error in CommentsSidebarComponent getOpenSidebar$ subscription: ",e)})),this.subscriptions.push(this.domService.getSelectedAnnotationsMap$().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{selectedAnnotationsMap:e}),i)),Object.keys(this.componentConfigSignal().selectedAnnotationsMap).length===1&&!this.commentService.showFloatingComments()&&this.commentService.setSidebarVisibility(!0)},e=>{this.loggingService.catch("Error in CommentsSidebarComponent getSidebarVisibility$ subscription: ",e)})),this.subscriptions.push(this.domService.onDocumentClick$().subscribe(e=>{try{if(this.componentConfigSignal().sidebarVisible&&e&&!this.elementRef?.nativeElement?.contains(e?.target)){let i=document.querySelectorAll(".cdk-overlay-container");Array.from(i).some(a=>a?.contains(e?.target))||!this.embedMode&&!this.commentService.isSidebarOpenedByCustomTrigger()&&(e?.target?.hasAttribute(j.ATTRIBUTES.VELT_DOWNLOAD_BUTTON)||(this.closeSidebar(),e?.stopPropagation()))}}catch(i){this.loggingService.catch("Error in CommentsSidebarComponent onDocumentClick: ",i)}},e=>{this.loggingService.catch("Error in CommentsSidebarComponent onDocumentClick$ subscription: ",e)})),this.subscriptions.push(this.iamService.isUserAdmin$().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{isUserAdmin:e}),i))},e=>{this.loggingService.catch("Error in CommentsSidebarComponent isUserAdmin$ subscription: ",e)})),this.getAllCommentsOnCurrentDocument(),this.subscriptions.push(this.commentService.getSidebarCustomData().subscribe(e=>{this.updateVirtualScrollData(e)}))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent initComponent: ",e)}}updateVirtualScrollData(e){try{if(this.commentService.getSidebarCustomActionsValue()){let i=[];this.componentConfigSignal.update(a=>(a=I({},a),a.virtualScrollData=[],a)),e?.data?.forEach((a,s)=>{e?.options?.grouping!==!1&&this.componentConfigSignal.update(m=>(m=I({},m),m.virtualScrollData.push({type:"group",data:{displayName:a?.groupName,isExpanded:a?.isExpanded===void 0&&s===0||a?.isExpanded,annotations:a?.annotations}}),m)),(a?.isExpanded===void 0&&s===0||a?.isExpanded)&&a?.annotations?.forEach(m=>{this.componentConfigSignal.update(p=>(p=I({},p),p.virtualScrollData.push({type:"annotation",data:m}),p))}),i.push(...a?.annotations||[])}),this.componentConfigSignal.update(a=>(a=T(I({},a),{noCommentsFoundForAppliedFilters:!this.componentConfigSignal().virtualScrollData?.length}),a)),(this.componentConfigSignal().embedMode||this.componentConfigSignal().sidebarVisible)&&this.commentService.setCommentsFromSidebarMap(i),this.cd.markForCheck();let r=this.virtualScrollViewportRef?.elementRef?.nativeElement;r&&(r.scrollTop=0)}}catch(i){this.loggingService.catch("Error in CommentsSidebarComponent updateVirtualScrollData: ",i)}}updateVirtualScrollDataGroupToggle(e){try{if(this.commentService.getSidebarCustomActionsValue()){this.componentConfigSignal.update(r=>(r=I({},r),r.virtualScrollData=[],r)),e?.forEach(r=>{r.type==="group"&&(this.componentConfigSignal.update(a=>(a=I({},a),a.virtualScrollData.push(r),a)),r?.data?.isExpanded&&r?.data?.annotations.forEach(a=>{this.componentConfigSignal.update(s=>(s=I({},s),s.virtualScrollData.push({type:"annotation",data:a}),s))}))}),this.componentConfigSignal.update(r=>(r=T(I({},r),{noCommentsFoundForAppliedFilters:!this.componentConfigSignal().virtualScrollData?.length}),r)),this.cd.markForCheck();let i=this.virtualScrollViewportRef?.elementRef?.nativeElement;i&&(i.scrollTop=0)}}catch(i){this.loggingService.catch("Error in CommentsSidebarComponent updateVirtualScrollDataGroupToggle: ",i)}}getAllCommentsOnCurrentDocument(){this.loggingService.log("%c[WB] Calling FUNCTION: getAllCommentsOnCurrentDocument","color: green;");try{this.getAllCommentAnnotationsSubscription&&this.getAllCommentAnnotationsSubscription.unsubscribe(),this.componentConfigSignal.update(e=>(e=T(I({},e),{skeletonLoading:!0}),e)),this.getAllCommentAnnotationsSubscription=this.commentService.getAllCommentAnnotations({excludeDomChanges:!0,skipPositionCalculation:!0,fromCommentSidebar:!0,analytics:{enabled:!0,properties:{source:"internal",sourceId:"commentsSidebar"}}}).pipe(ce(e=>(e||this.componentConfigSignal.update(i=>(i=T(I({},i),{skeletonLoading:!0}),i)),e)),Fe(e=>!!e),ce(e=>e?.filter(i=>i?.comments?.length)),he(e=>this.commentService.getExcludeLocationIdsFromSidebar$().pipe(ce(i=>i?.length&&e?.length?e.filter(r=>r?.location?.id?!i.includes(r.location.id):!0):e))),he(e=>this.commentService.getResolvedCommentsOnDom$().pipe(ce(i=>(this.resolvedCommentsOnDom!==i&&(this.resolvedCommentsOnDom=i,i&&this.setResolvedStatusInFilter()),e))))).subscribe(e=>{if(this.dataAvailable=!0,this.componentConfigSignal.update(i=>{if(i=T(I({},i),{skeletonLoading:!1}),i.annotations=e?.filter(r=>!r?.isPageAnnotation||r?.comments?.length)||[],i.sortData==="asc"?i.annotations=i.annotations?.sort((r,a)=>r.lastUpdated-a.lastUpdated):i.sortData==="none"?i.annotations=i.annotations?.sort((r,a)=>a.createdAt-r.createdAt):i.annotations=i.annotations?.sort((r,a)=>a.lastUpdated-r.lastUpdated),i?.focusedAnnotation?.annotationId){let r=e?.find(a=>a.annotationId===i?.focusedAnnotation?.annotationId);r&&(i.focusedAnnotation=r)}return i}),this.setPages(),this.setDocuments(),this.setVersions(),this.setPeople(),this.filterCommentAnnotations(),this.updateAnnotationCountsByFilter(),this.componentConfigSignal().annotations?.length){let i=sessionStorage.getItem(j.SESSION_STORAGE.SNIPPYLY_SELECTED_ANNOTATION_ID);if(i){sessionStorage.removeItem(j.SESSION_STORAGE.SNIPPYLY_SELECTED_ANNOTATION_ID),this.commentService.setSidebarVisibility(!0);let r=this.componentConfigSignal().annotations.find(a=>a.annotationId===i);r&&this.goToAnnotation(r)}this.componentConfigSignal().sidebarVisible&&!this.commentReadAnalyticsCalled&&this.setCommentReadInAnalytics()}this.componentConfigSignal.update(i=>(i=T(I({},i),{noCommentsFound:!this.componentConfigSignal().annotations?.length}),i))},e=>{this.loggingService.catch("Error in CommentsSidebarComponent getAllCommentsOnCurrentDocument subscription: ",e),this.componentConfigSignal.update(i=>(i=T(I({},i),{skeletonLoading:!1}),i))})}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent getAllCommentsOnCurrentDocument: ",e)}}mergeClientFilters(e){try{if(Object.keys(e||{})?.length){if(e?.location&&(e?.location?.length?(this.componentConfigSignal.update(i=>(i=T(I({},i),{filters:T(I({},i.filters),{pages:[]})}),i)),e?.location?.forEach(i=>{if(i?.id&&(this.componentConfigSignal().filters?.pages||this.componentConfigSignal.update(a=>(a=T(I({},a),{filters:T(I({},a.filters),{pages:[]})}),a)),!this.componentConfigSignal().filters.pages.find(a=>a.id===i.id))){let a=this.docService.genarateLocationId(i);this.componentConfigSignal.update(s=>(s=T(I({},s),{filters:T(I({},s.filters),{pages:[...s.filters.pages,{id:i.id,displayName:i.displayName,locationIds:[a],selected:!0}]})}),s))}})):this.componentConfigSignal.update(i=>(i=T(I({},i),{filters:T(I({},i.filters),{pages:[]})}),i)),this.updatePageSelectedState()),e?.document&&(e?.document?.length?(this.componentConfigSignal.update(i=>(i=T(I({},i),{filters:T(I({},i.filters),{documents:[]})}),i)),e?.document?.forEach(i=>{(i?.id||i?.documentName)&&(this.componentConfigSignal().filters?.documents||this.componentConfigSignal.update(a=>(a=T(I({},a),{filters:T(I({},a.filters),{documents:[]})}),a)),this.componentConfigSignal().filters.documents.find(a=>a.id===i.id||a.documentName===i.documentName)||this.componentConfigSignal.update(a=>(a=T(I({},a),{filters:T(I({},a.filters),{documents:[...a.filters.documents,{id:i.id||i.documentName,documentName:i.documentName||i.id,selected:!0}]})}),a)))})):this.componentConfigSignal.update(i=>(i=T(I({},i),{filters:T(I({},i.filters),{documents:[]})}),i)),this.updateDocumentSelectedState()),e?.priority)if(e?.priority?.length){let i=e.priority;this.componentConfigSignal.update(r=>(r=T(I({},r),{filters:T(I({},r.filters),{priorities:r.priorities.filter(a=>i.includes(a.id)),priorityIds:i})}),r))}else this.componentConfigSignal.update(i=>(i=T(I({},i),{filters:T(I({},i.filters),{priorities:[],priorityIds:[]})}),i));if(e?.category)if(e?.category?.length){if(this.componentConfigSignal().commentCategoryMap){let i=e.category;this.componentConfigSignal.update(r=>(r=T(I({},r),{filters:T(I({},r.filters),{categories:Object.values(r.commentCategoryMap).filter(a=>i.includes(a.id)),categoryIds:i})}),r))}}else this.componentConfigSignal.update(i=>(i=T(I({},i),{filters:T(I({},i.filters),{categories:[],categoryIds:[]})}),i));if(e?.status)if(e?.status?.length){let i=e.status;this.componentConfigSignal.update(r=>(r=T(I({},r),{filters:T(I({},r.filters),{statuses:r.statuses.filter(a=>i.includes(a.id)),statusIds:i})}),r))}else this.componentConfigSignal.update(i=>(i=T(I({},i),{filters:T(I({},i.filters),{statuses:[],statusIds:[]})}),i));else sessionStorage.getItem(j.SESSION_STORAGE.SNIPPYLY_COMMENT_SIDEBAR_FILTERS)||this.setDefaultStatuses();if(e?.people){if(e?.people?.length){let i=[],r=this.componentConfigSignal().user;r&&e.people.find(s=>s.userId&&s.userId===r?.userId||s.email&&s.email===r?.email)&&i.push({id:r.userSnippylyId,name:r.name||r.email||r.userId||"",userId:r.userId,email:r.email}),e.people.forEach(a=>{if(a?.userId||a?.email){let s=this.componentConfigSignal().peopleFilters.find(m=>a.userId&&m?.user?.userId===a.userId||a.email&&m?.user?.email===a.email);if(s&&s?.user?.userSnippylyId!==r?.userSnippylyId)i.push({id:s?.user?.userSnippylyId,name:s?.user?.name,userId:s?.user?.userId,email:s?.user?.email});else{let m="",p=this.configService.getApiKey(),h=a.userId;p&&h&&(m=ym(p,h)),m!==r?.userSnippylyId&&i.push({id:m,name:a.name||a.email||a.userId,userId:a.userId,email:a.email})}}}),this.componentConfigSignal.update(a=>(a=T(I({},a),{filters:T(I({},a.filters),{people:i})}),a))}else this.componentConfigSignal.update(i=>(i=T(I({},i),{filters:T(I({},i.filters),{people:[]})}),i));this.setPeople(),this.updatePeopleSelectedState()}if(e?.assigned){if(e?.assigned?.length){let i=[],r=this.componentConfigSignal().user;r&&e.assigned.find(s=>s.userId&&s.userId===r?.userId||s.email&&s.email===r?.email)&&i.push({id:r.userSnippylyId,name:r.name||r.email||r.userId||"",userId:r.userId,email:r.email}),e.assigned.forEach(a=>{if(a?.userId||a?.email){let s=this.componentConfigSignal().assignedFilters.find(m=>a.userId&&m?.user?.userId===a.userId||a.email&&m?.user?.email===a.email);if(s&&s?.user?.userSnippylyId!==r?.userSnippylyId)i.push({id:s?.user?.userSnippylyId,name:s?.user?.name,userId:s?.user?.userId,email:s?.user?.email});else{let m="",p=this.configService.getApiKey(),h=a.userId;p&&h&&(m=ym(p,h)),m!==r?.userSnippylyId&&i.push({id:m,name:a.name||a.email||a.userId,userId:a.userId,email:a.email})}}}),this.componentConfigSignal.update(a=>(a=T(I({},a),{filters:T(I({},a.filters),{assigned:i})}),a))}else this.componentConfigSignal.update(i=>(i=T(I({},i),{filters:T(I({},i.filters),{assigned:[]})}),i));this.setPeople(),this.updatePeopleSelectedState()}if(e?.tagged){if(e?.tagged?.length){let i=[],r=this.componentConfigSignal().user;r&&e.tagged.find(s=>s.userId&&s.userId===r?.userId||s.email&&s.email===r?.email)&&i.push({id:r.userSnippylyId,name:r.name||r.email||r.userId||"",userId:r.userId,email:r.email}),e.tagged.forEach(a=>{if(a?.userId||a?.email){let s=this.componentConfigSignal().taggedFilters.find(m=>a.userId&&m?.user?.userId===a.userId||a.email&&m?.user?.email===a.email);if(s&&s?.user?.userSnippylyId!==r?.userSnippylyId)i.push({id:s?.user?.userSnippylyId,name:s?.user?.name,userId:s?.user?.userId,email:s?.user?.email});else{let m="",p=this.configService.getApiKey(),h=a.userId;p&&h&&(m=ym(p,h)),m!==r?.userSnippylyId&&i.push({id:m,name:a.name||a.email||a.userId,userId:a.userId,email:a.email})}}}),this.componentConfigSignal.update(a=>(a=T(I({},a),{filters:T(I({},a.filters),{tagged:i})}),a))}else this.componentConfigSignal.update(i=>(i=T(I({},i),{filters:T(I({},i.filters),{tagged:[]})}),i));this.setPeople(),this.updatePeopleSelectedState()}e?.version&&(e?.version?.length?this.componentConfigSignal.update(i=>(i=T(I({},i),{filters:T(I({},i.filters),{versions:e.version?.map(r=>({id:r.id,name:r.name||r.id}))||[],versionIds:e.version?.map(r=>r.id)||[]})}),i)):this.componentConfigSignal.update(i=>(i=T(I({},i),{filters:T(I({},i.filters),{versions:[],versionIds:[]})}),i)),this.setVersions()),this.filterCommentAnnotations(),this.updateAnnotationCountsByFilter(),this.setFiltersToStorage()}}catch(i){this.loggingService.catch("Error in CommentsSidebarComponent mergeClientFilters: ",i)}}onCommentAnnotationClick(e){try{let i=zn(e);this.componentConfigSignal().focusedThreadMode?this.componentConfigSignal.update(r=>(r=T(I({},r),{focusedAnnotation:e}),r)):this.navigateToComment(e,!1),this.emitOnSidebarCommentClick(i)}catch(i){this.loggingService.catch("Error in CommentsSidebarComponent onCommentAnnotationClick: ",i)}}navigateToComment(e,i=!0){try{if(i){let r=zn(e);this.emitOnCommentNavigationButtonClick(r)}if(this.commentService.getSidebarUrlNavigation()&&i)if(e?.pageInfo?.url&&e.pageInfo?.url!==window.location.href){sessionStorage.setItem(j.SESSION_STORAGE.SNIPPYLY_SELECTED_ANNOTATION_ID,e.annotationId);let r=e.pageInfo.url;try{let a=window.location.origin,s=new URL(e.pageInfo.url).origin;a!==s&&(r=r.replace(s,a))}catch(a){this.loggingService.catch("Error in CommentsSidebarComponent onCommentAnnotationClick in comparing url domains: ",a)}window.location.href===r?this.goToAnnotation(e,i):window.location.href=r}else this.goToAnnotation(e,i);else this.goToAnnotation(e,i)}catch(r){this.loggingService.catch("Error in CommentsSidebarComponent navigateToComment: ",r)}}goToAnnotation(e,i=!0){try{this.componentConfigSignal().selectedAnnotationsMap[e.annotationId]||e?.targetTextRange&&sessionStorage.setItem(j.SESSION_STORAGE.SNIPPYLY_AUTO_SELECT_ANNOTATION_ID,e?.annotationId),i?this.domService.toggleAnnotationSelection(e,void 0,void 0,!0):this.domService.toggleAnnotationSelection(e,void 0,"sidebarShowReplies",!0),i&&setTimeout(()=>{let r=null;e.targetElement||e.areaAnnotationId?r=document.getElementById(`comment-pin-container-${e.annotationId}`):r=document.querySelector(`[data-velt-id='${e.annotationId}']`),r||(r=document.querySelector(`${j.TAGS.VELT_COMMENT_TEXT}[${j.ATTRIBUTES.ANNOTATION_ID}="${e.annotationId}"]`)),r&&r.scrollIntoView({behavior:"auto",block:"center",inline:"nearest"})},100)}catch(r){this.loggingService.catch("Error in CommentsSidebarComponent goToAnnotation: ",r)}}goToAnnotationInSidebar(e){try{let i=document.getElementById(`sidebar-${e.annotationId}`);i&&i.scrollIntoView({behavior:"smooth",block:"center",inline:"center"})}catch(i){this.loggingService.catch("Error in CommentsSidebarComponent goToAnnotationInSidebar: ",i)}}saveComment(e,i){this.commentService.saveComment(e,i)}getDisplayNameFromPageInfo(e){try{return this.componentConfigSignal().queryParamsComments&&e&&e?.queryParams?`${e?.path||""}${e?.queryParams||""}`:e?.path||""}catch{return""}}setPages(){try{this.componentConfigSignal.update(a=>T(I({},a),{pages:{},currentPage:void 0}));let e=new Map,i={};this.componentConfigSignal().annotations.forEach(a=>{let s=a.locationId||a.documentParamsId;if(!s){i.other||(i.other={locationIds:[],displayName:"Others",id:"other"});return}let m=a?.location?.locationName||a?.documentParams?.locationName||this.getDisplayNameFromPageInfo(a?.pageInfo)||"",p=a?.location?.id||m;e.has(s)||(i[p]||(i[p]={locationIds:[],displayName:m,id:p}),e.set(s,p),i[p].locationIds.push(s))}),this.componentConfigSignal.update(a=>{let s=this.location?.locationId,m;if(s){let p=e.get(s);p&&(m=i[p].displayName)}else i.other&&(m="Others");return T(I({},a),{pages:i,currentPage:m})}),this.updateLocationInStorage(),this.componentConfigSignal().annotations?.length&&!sessionStorage.getItem(j.SESSION_STORAGE.SNIPPYLY_COMMENT_SIDEBAR_FILTERS)&&(this.updateFilter({key:"pages",value:null},!0),this.setDefaultStatuses()),this.updatePageSelectedState()}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent setPages: ",e)}}setDocuments(){try{this.componentConfigSignal.update(a=>T(I({},a),{documents:{},currentDocument:void 0}));let e=new Map,i={};this.componentConfigSignal().annotations.forEach(a=>{let s=a?.metadata?.clientDocumentId?.toString(),m=a?.metadata?.documentId?.toString(),h=this.docService.getDocumentMetadata(m)?.documentName;if(!s){i.other||(i.other={id:"other",documentName:"Others"});return}if(e.has(s))return;let _=s;i[_]||(i[_]={id:s,documentName:h||s}),e.set(s,_)}),this.componentConfigSignal.update(a=>{let s=this.documentPaths?.clientDocumentId?.toString(),m;if(s){let p=e.get(s);p&&(m=i[p].id)}else i.other&&(m="other");return T(I({},a),{documents:i,currentDocument:m})}),this.componentConfigSignal().annotations?.length&&!sessionStorage.getItem(j.SESSION_STORAGE.SNIPPYLY_COMMENT_SIDEBAR_FILTERS)&&this.updateFilter({key:"documents",value:null},!0),this.updateDocumentSelectedState()}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent setDocuments: ",e)}}setDefaultStatuses(){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDefaultStatuses","color: green;"),this.componentConfigSignal.update(e=>(e=T(I({},e),{filters:T(I({},e.filters),{statuses:[this.customFilterService.defaultStatus,...this.customFilterService.ongoingStatuses],statusIds:[this.customFilterService.defaultStatus?.id,...this.customFilterService.ongoingStatuses.map(i=>i?.id)]})}),e))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent setDefaultStatuses: ",e)}}setResolvedStatusInFilter(){try{this.loggingService.log("%c[WB] Calling FUNCTION: setResolvedStatusInFilter","color: green;"),this.componentConfigSignal().filters.statuses?.length&&this.customFilterService.resolvedStatus&&(this.componentConfigSignal().filters.statuses.find(i=>i?.id===this.customFilterService.resolvedStatus.id)||this.componentConfigSignal.update(i=>(i=T(I({},i),{filters:T(I({},i.filters),{statuses:[...i.filters.statuses,this.customFilterService.resolvedStatus],statusIds:[...i.filters.statuses.map(r=>r?.id),this.customFilterService.resolvedStatus.id]})}),i)))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent setResolvedStatusInFilter: ",e)}}trackCommentPinAnnotations(e,i){return i?.type==="group"?i?.data?.displayName:i?.type==="annotation"?i?.data?.annotationId:e}updateCurrentLocationIdInStorage(){try{this.location?.locationId&&this.componentConfigSignal().filters?.pages?.length&&this.componentConfigSignal.update(e=>(e=I({},e),e.filters.pages.forEach(i=>{i?.displayName===e.currentPage&&(i?.locationIds?.includes(this.location?.locationId)||i.locationIds.push(this.location?.locationId))}),e))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent updateCurrentLocationIdInStorage: ",e)}}updateLocationInStorage(){try{this.componentConfigSignal.update(e=>(e=I({},e),e.filters.pages.forEach(i=>{e.pages[i.displayName]&&(i.locationIds=e.pages[i.displayName].locationIds?.slice())}),e))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent updateLocationInStorage: ",e)}}updatePageSelectedState(){try{this.componentConfigSignal.update(e=>(e=I({},e),Object.values(e.pages).forEach(i=>{let r=e.filters?.pages?.find(a=>a.id===i?.id);r?(i.selected=!0,r.displayName||(r.displayName=i.displayName)):i.selected=!1}),e))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent updatePageSelectedState: ",e)}}setVersions(){try{let e=[];this.componentConfigSignal().annotations&&this.componentConfigSignal.update(i=>(i=I({},i),i.annotations.forEach(r=>{r?.location?.version&&(e.find(a=>a.id===r?.location?.version?.id)||e.push(r?.location?.version))}),i)),this.componentConfigSignal().filters?.versions?.length&&this.componentConfigSignal.update(i=>(i=I({},i),i.filters.versions.forEach(r=>{e.find(a=>a.id===r?.id)||r?.id!=="unset"&&e.push(r)}),i)),this.componentConfigSignal.update(i=>(i=I({},i),i.versions=e?.sort((r,a)=>r?.id?.localeCompare(a?.id)),i.versions.push({id:"unset",name:"Not set"}),i)),this.componentConfigSignal().annotations?.length&&!this.componentConfigSignal().versions?.length&&this.updateFilter({key:"versions",value:null},!0)}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent setVersions: ",e)}}setPeople(){try{let e=[],i=[],r=[],a=this.componentConfigSignal().user;a?.userSnippylyId&&(e.push({id:a.userSnippylyId,name:a.name||a.email||a.userId||"",user:a}),i.push({id:a.userSnippylyId,name:a.name||a.email||a.userId||"",user:a}),r.push({id:a.userSnippylyId,name:a.name||a.email||a.userId||"",user:a})),this.componentConfigSignal().annotations&&this.componentConfigSignal.update(s=>(s=I({},s),s.annotations.forEach(m=>{m?.from?.userSnippylyId&&s.user?.userSnippylyId!==m?.from?.userSnippylyId&&!e.find(p=>p.id===m?.from?.userSnippylyId)&&e.push({id:m?.from?.userSnippylyId,name:`${m?.from?.name||m?.from?.email}`,user:m?.from}),m?.assignedTo?.userSnippylyId&&s.user?.userSnippylyId!==m?.assignedTo?.userSnippylyId&&!i.find(p=>p.id===m?.assignedTo?.userSnippylyId)&&i.push({id:m?.assignedTo?.userSnippylyId,name:`${m?.assignedTo?.name||m?.assignedTo?.email}`,user:m?.assignedTo}),m?.comments?.forEach(p=>{p?.taggedUserContacts?.forEach(h=>{h?.contact?.userSnippylyId&&s.user?.userSnippylyId!==h?.contact?.userSnippylyId&&!r.find(_=>_.id===h?.contact?.userSnippylyId)&&r.push({id:h?.contact?.userSnippylyId,name:`${h?.contact?.name||h?.contact?.email}`,user:h?.contact})})})}),s)),this.componentConfigSignal().filters?.people?.length&&this.componentConfigSignal.update(s=>(s=I({},s),s.filters.people.forEach(m=>{e.find(p=>p.id===m?.id)||m?.id!=="other"&&e.push(m)}),s.filters.assigned.forEach(m=>{i.find(p=>p.id===m?.id)||m?.id!=="other"&&i.push(m)}),s.filters.tagged.forEach(m=>{r.find(p=>p.id===m?.id)||m?.id!=="other"&&r.push(m)}),s)),this.componentConfigSignal.update(s=>(s=T(I({},s),{peopleFilters:e,assignedFilters:i,taggedFilters:r}),s)),this.componentConfigSignal().annotations?.length&&(sessionStorage.getItem(j.SESSION_STORAGE.SNIPPYLY_COMMENT_SIDEBAR_FILTERS)||(this.updateFilter({key:"people",value:null},!0),this.updateFilter({key:"assigned",value:null},!0),this.updateFilter({key:"tagged",value:null},!0))),this.updatePeopleSelectedState()}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent setPeople: ",e)}}updatePeopleSelectedState(){try{this.componentConfigSignal.update(e=>(e=I({},e),e.peopleFilters.forEach(i=>{let r=e.filters?.people?.find(a=>a.id===i?.id||a?.userId&&a?.userId===i?.user?.userId||a?.email&&a?.email===i?.user?.email);r?(i.selected=!0,r?.id||(r.id=i?.user?.userSnippylyId)):i.selected=!1}),e.assignedFilters.forEach(i=>{let r=e.filters?.assigned?.find(a=>a.id===i?.id||a?.userId&&a?.userId===i?.user?.userId||a?.email&&a?.email===i?.user?.email);r?(i.selected=!0,r?.id||(r.id=i?.user?.userSnippylyId)):i.selected=!1}),e.taggedFilters.forEach(i=>{let r=e.filters?.tagged?.find(a=>a.id===i?.id||a?.userId&&a?.userId===i?.user?.userId||a?.email&&a?.email===i?.user?.email);r?(i.selected=!0,r?.id||(r.id=i?.user?.userSnippylyId)):i.selected=!1}),e))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent updatePeopleSelectedState: ",e)}}updateFilterConfig(e){try{if(e){let i=JSON.parse(JSON.stringify(this.defaultFilterConfig));Object.keys(i).forEach(r=>{e[r]&&(i[r]=e[r])}),this.componentConfigSignal.update(r=>(r=T(I({},r),{filterConfig:i}),r))}else this.componentConfigSignal.update(i=>(i=T(I({},i),{filterConfig:JSON.parse(JSON.stringify(this.defaultFilterConfig))}),i));this.updateGroupByOptions(),this.filterCommentAnnotations()}catch(i){this.loggingService.catch("Error in CommentsSidebarComponent updateFilterConfig: ",i)}}updateGroupByOptions(){try{let e={};this.componentConfigSignal.update(r=>(r=I({},r),Object.keys(r.filterConfig).forEach(a=>{let s=r.filterConfig[a];s.enableGrouping&&(e[a]=s.name)}),r.groupByOptions=JSON.parse(JSON.stringify(e)),r));let i=!1;this.componentConfigSignal().groupBy&&Object.keys(this.componentConfigSignal().groupByOptions).forEach(r=>{this.componentConfigSignal().groupByOptions[r]===this.componentConfigSignal().groupBy&&(i=!0)}),(!this.componentConfigSignal().groupBy||!i)&&this.componentConfigSignal.update(r=>(r=T(I({},r),{groupBy:Object.values(r.groupByOptions)[0]}),r))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent updateGroupByOptions: ",e)}}updateFilter(e,i=!1){let{key:r,value:a}=e;try{if(r)switch(r){case"statuses":if(i)this.componentConfigSignal.update(p=>(p=T(I({},p),{filters:T(I({},p.filters),{statuses:[],statusIds:[]})}),p)),this.resolvedCommentsOnDom=!0;else{let p=this.componentConfigSignal().filters?.statuses||[];p.find(h=>h.id===a.id)?this.componentConfigSignal.update(h=>(h=I({},h),h.filters.statuses=p.filter(_=>_.id!==a.id),h)):this.componentConfigSignal.update(h=>(h=I({},h),h.filters.statuses=[...p,a],h)),this.componentConfigSignal.update(h=>(h=T(I({},h),{filters:T(I({},h.filters),{statusIds:h.filters.statuses.map(_=>_?.id)})}),h))}break;case"pages":let s=this.componentConfigSignal().filters.pages||[];if(i)this.componentConfigSignal.update(p=>(p=T(I({},p),{filters:T(I({},p.filters),{pages:[]})}),p));else{let p=a?.id||a?.displayName;s.find(h=>h?.id===p||h?.displayName===p)?this.componentConfigSignal.update(h=>(h=I({},h),h.filters.pages=s.filter(_=>_?.id!==p&&_?.displayName!==p),h)):this.componentConfigSignal().filterConfig?.location?.multiSelection?this.componentConfigSignal.update(h=>(h=I({},h),h.filters.pages=[...s,a],h)):this.componentConfigSignal.update(h=>(h=I({},h),h.filters.pages=[a],h))}this.sortPageFilters(),this.updatePageSelectedState();break;case"documents":let m=this.componentConfigSignal().filters.documents||[];if(i)this.componentConfigSignal.update(p=>(p=T(I({},p),{filters:T(I({},p.filters),{documents:[]})}),p));else{let p=a?.id;m.find(h=>h?.id===p)?this.componentConfigSignal.update(h=>(h=I({},h),h.filters.documents=m.filter(_=>_?.id!==p),h)):this.componentConfigSignal.update(h=>(h=I({},h),h.filterConfig?.document?.multiSelection?h.filters.documents=[...m,a]:h.filters.documents=[a],h))}this.updateDocumentSelectedState();break;case"people":this.componentConfigSignal.update(p=>{p=I({},p);let h=p.filters.people||[];return i?p.filters.people=[]:h.find(_=>_?.id===a?.id)?p.filters.people=h.filter(_=>_?.id!==a?.id):p.filterConfig?.people?.multiSelection?p.filters.people=[...h,a]:p.filters.people=[a],p}),this.updatePeopleSelectedState();break;case"tagged":this.componentConfigSignal.update(p=>{p=I({},p);let h=p.filters.tagged||[];return i?p.filters.tagged=[]:h.find(_=>_?.id===a?.id)?p.filters.tagged=h.filter(_=>_?.id!==a?.id):p.filterConfig?.tagged?.multiSelection?p.filters.tagged=[...h,a]:p.filters.tagged=[a],p}),this.updatePeopleSelectedState();break;case"assigned":this.componentConfigSignal.update(p=>{p=I({},p);let h=p.filters.assigned||[];return i?p.filters.assigned=[]:h.find(_=>_?.id===a?.id)?p.filters.assigned=h.filter(_=>_?.id!==a?.id):p.filterConfig?.assigned?.multiSelection?p.filters.assigned=[...h,a]:p.filters.assigned=[a],p}),this.updatePeopleSelectedState();break;case"categories":this.componentConfigSignal.update(p=>{p=I({},p);let h=p.filters.categories||[];return i?p.filters.categories=[]:h.find(_=>_.id===a.id)?p.filters.categories=h.filter(_=>_!==a):p.filterConfig?.category?.multiSelection?p.filters.categories=[...h,a]:p.filters.categories=[a],p.filters.categoryIds=p.filters.categories?.map(_=>_.id),p});break;case"priorities":this.componentConfigSignal.update(p=>{p=I({},p);let h=p.filters.priorities||[];return i?p.filters.priorities=[]:h.find(_=>_.id===a.id)?p.filters.priorities=h.filter(_=>_.id!==a.id):p.filterConfig?.priority?.multiSelection?p.filters.priorities=[...h,a]:p.filters.priorities=[a],p.filters.priorityIds=p.filters.priorities?.map(_=>_.id),p});break;case"accessModes":this.componentConfigSignal.update(p=>{p=I({},p);let h=p.filters.accessModes||[];return i?p.filters.accessModes=[]:h.find(_=>_===a.id)?p.filters.accessModes=h.filter(_=>_!==a.id):p.filterConfig?.commentType?.multiSelection?p.filters.accessModes=[...h,a.id]:p.filters.accessModes=[a.id],p});break;case"versions":this.componentConfigSignal.update(p=>{p=I({},p);let h=p.filters.versions||[];return i?p.filters.versions=[]:h.find(_=>_.id===a.id)?p.filters.versions=h.filter(_=>_.id!==a.id):p.filterConfig?.version?.multiSelection?p.filters.versions=[...h,a]:p.filters.versions=[a],p.filters.versionIds=p.filters.versions?.map(_=>_?.id),p});break;default:this.componentConfigSignal.update(p=>(p=T(I({},p),{filters:T(I({},p.filters),{[r]:a})}),p));break}this.filterCommentAnnotations(),this.setFiltersToStorage()}catch(s){this.loggingService.catch("Error in CommentsSidebarComponent updateFilter: ",s)}}sortPageFilters(){try{this.componentConfigSignal.update(e=>(e=I({},e),e.filters?.pages?.sort((i,r)=>i?.displayName===e.currentPage?-1:r?.displayName===e.currentPage?1:i?.displayName?.localeCompare(r?.displayName)),e))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent sortPageFilters: ",e)}}updateAnnotationCountsByFilter(){try{if(!this.componentConfigSignal().filterCount)return;this.setAnnotationsCountPerPage(),this.setAnnotationsCountPerDocument(),this.setAnnotationsCountPerStatus(),this.setAnnotationsCountPerPeople(),this.setAnnotationsCountPerVersion(),this.setAnnotationsCountPerPriority(),this.setAnnotationsCountPerCommentCategory(),this.setAnnotationsCountPerAccessMode()}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent updateAnnotationCountsByFilter: ",e)}}setAnnotationsCountPerPage(){try{this.componentConfigSignal().pages&&this.componentConfigSignal.update(e=>(e=I({},e),Object.values(e.pages).forEach(i=>{e.commentAnnotationsCountByFilters.page[i.displayName]=this.filterAnnotationsByPage(i,e.annotations)?.length}),e))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent setAnnotationsCountPerPage: ",e)}}setAnnotationsCountPerDocument(){try{this.componentConfigSignal().documents&&this.componentConfigSignal.update(e=>(e=I({},e),Object.values(e.documents).forEach(i=>{e.commentAnnotationsCountByFilters.document[i.id]=this.filterAnnotationsByDocument(i,e.annotations)?.length}),e))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent setAnnotationsCountPerDocument: ",e)}}setAnnotationsCountPerStatus(){try{let e=this.componentConfigSignal();[this.customFilterService.defaultStatus,...this.customFilterService.ongoingStatuses,this.customFilterService.resolvedStatus].forEach(i=>{e.commentAnnotationsCountByFilters.status[i.id]=this.filterAnnotationsByStatus(i,e.annotations)?.length}),this.componentConfigSignal.update(i=>(i=T(I({},i),{commentAnnotationsCountByFilters:I({},i.commentAnnotationsCountByFilters)}),i))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent setAnnotationsCountPerStatus: ",e)}}setAnnotationsCountPerPeople(){try{this.componentConfigSignal.update(e=>(e=I({},e),e.peopleFilters?.forEach(i=>{e.commentAnnotationsCountByFilters.people[i.id]=this.filterAnnotationsByPeople(i,e.annotations)?.length}),e.taggedFilters?.forEach(i=>{e.commentAnnotationsCountByFilters.tagged[i.id]=this.filterAnnotationsByTagged(i,e.annotations)?.length}),e.assignedFilters?.forEach(i=>{e.commentAnnotationsCountByFilters.assigned[i.id]=this.filterAnnotationsByAssigned(i,e.annotations)?.length}),e))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent setAnnotationsCountPerPerson: ",e)}}setAnnotationsCountPerPriority(){try{this.componentConfigSignal.update(e=>(e=I({},e),e.priorities.forEach(i=>{e.commentAnnotationsCountByFilters.priority[i.id]=this.filterAnnotationsByPriority(i,e.annotations)?.length}),e))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent setAnnotationsCountPerPriority: ",e)}}setAnnotationsCountPerCommentCategory(){try{this.componentConfigSignal.update(e=>(e=I({},e),Object.values(e.commentCategoryMap).forEach(i=>{e.commentAnnotationsCountByFilters.commentCategory[i.id]=this.filterAnnotationsByCommentCategory(i,e.annotations)?.length}),e))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent setAnnotationsCountPerCommentCategory: ",e)}}setAnnotationsCountPerAccessMode(){try{this.componentConfigSignal.update(e=>(e=I({},e),e.accessModes.forEach(i=>{e.commentAnnotationsCountByFilters.accessMode[i.id]=this.filterAnnotationsByAccessMode(i.id,e.annotations)?.length}),e))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent setAnnotationsCountPerAccessMode: ",e)}}setAnnotationsCountPerVersion(){try{this.componentConfigSignal.update(e=>(e=I({},e),e.versions.forEach(i=>{e.commentAnnotationsCountByFilters.version[i.id]=this.filterAnnotationsByVersion(i,e.annotations)?.length}),e))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent setAnnotationsCountPerVersion: ",e)}}filterCommentAnnotations(){try{let e=this.componentConfigSignal(),i=!1,r=e.annotations.slice(),a=[],s=e.systemFiltersOperator;s===hc.AND?a=e.annotations.slice():a=[],e.appliedFiltersCount=0;let m=!1,p=new Set,h=_=>{try{s===hc.AND?a=a.filter(E=>_.some(D=>D.annotationId===E.annotationId)):_.forEach(E=>{p.add(E.annotationId)}),m=!0}catch{}};if(e.enablePriority&&e.filterConfig?.priority?.enable&&e.filters.priorities?.length){let _=[];e.filters.priorities?.forEach(E=>{_=[..._,...this.filterAnnotationsByPriority(E,r)]}),h(_),e.appliedFiltersCount++}if(e.filterConfig?.location?.enable&&e.filters.pages?.length){let _=[];e.filters.pages?.forEach(E=>{_=[..._,...this.filterAnnotationsByPage(E,r)]}),h(_),e.appliedFiltersCount++}if(e.filters.documents?.length){let _=[];e.filters.documents?.forEach(E=>{_=[..._,...this.filterAnnotationsByDocument(E,r)]}),h(_),e.appliedFiltersCount++}if(e.filterConfig?.people?.enable&&e.filters.people?.length){let _=[];e.filters.people?.forEach(E=>{_=[..._,...this.filterAnnotationsByPeople(E,r)]}),h(_),e.appliedFiltersCount++}if(e.filterConfig?.tagged?.enable&&e.filters.tagged?.length){let _=[];e.filters.tagged?.forEach(E=>{_=[..._,...this.filterAnnotationsByTagged(E,r)]}),h(_),e.appliedFiltersCount++}if(e.filterConfig?.assigned?.enable&&e.filters.assigned?.length){let _=[];e.filters.assigned?.forEach(E=>{_=[..._,...this.filterAnnotationsByAssigned(E,r)]}),h(_),e.appliedFiltersCount++}if(e.enableAutoCategorize&&e.filterConfig?.category?.enable&&e.filters.categories?.length){let _=[];e.filters.categories?.forEach(E=>{_=[..._,...this.filterAnnotationsByCommentCategory(E,r)]}),h(_),e.appliedFiltersCount++}if(e.isUserAdmin&&e.filterConfig?.commentType?.enable&&e.filters.accessModes?.length){let _=[];e.filters.accessModes?.forEach(E=>{_=[..._,...this.filterAnnotationsByAccessMode(E,r)]}),h(_),e.appliedFiltersCount++}if(e.filterConfig?.version?.enable&&e.filters.versions?.length){let _=[];e.filters.versions?.forEach(E=>{_=[..._,...this.filterAnnotationsByVersion(E,r)]}),h(_),e.appliedFiltersCount++}if(e.enableStatus&&e.filters.statuses?.length){let _=[];e.filters.statuses?.forEach(E=>{E.id===this.customFilterService.resolvedStatus.id&&(i=!0),_=[..._,...this.filterAnnotationsByStatus(E,r)]}),h(_)}s!==hc.AND&&(m?a=r.filter(_=>p.has(_.annotationId)):a=r),e.filters.input&&(a=this.filterAnnotationsByInput(e.filters.input,a)),e.minimalFilter&&(!i&&e.minimalFilter==="resolved"&&(a=e.annotations.slice()),a=a.filter(_=>{switch(e.minimalFilter){case"all":return!i&&!this.resolvedCommentsOnDom?_.status?.id!==this.customFilterService.resolvedStatus.id:!0;case"read":return!this.componentConfigSignal().unreadCommentsMap?.[_.annotationId]&&_.status?.id!==this.customFilterService.resolvedStatus.id;case"unread":return!!this.componentConfigSignal().unreadCommentsMap?.[_.annotationId]&&_.status?.id!==this.customFilterService.resolvedStatus.id||!!this.componentConfigSignal().selectedAnnotationsMap[_.annotationId];case"resolved":return _.status?.id===this.customFilterService.resolvedStatus.id;default:return!0}})),this.componentConfigSignal.update(_=>(_=T(I(I({},_),e),{filteredCommentPinAnnotations:a}),_)),this.commentService.getSidebarCustomActionsValue()||(this.componentConfigSignal().embedMode||this.componentConfigSignal().sidebarVisible)&&this.commentService.setCommentsFromSidebarMap(a),this.groupFilteredCommentAnnotations(),this.componentConfigSignal().sortData||this.sortComments(this.componentConfigSignal().selectedMinimalFilterDropdownOption.sorting)}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent filterCommentAnnotations: ",e)}}toggleGroupedCommentAnnotations(e){try{e.isExpanded=!e.isExpanded,this.commentService.getSidebarCustomActionsValue()?(this.componentConfigSignal.update(i=>(i=I({},i),i)),this.updateVirtualScrollDataGroupToggle(this.componentConfigSignal().virtualScrollData)):this.setSidebarGroupedAnnotationsData()}catch(i){this.loggingService.catch("Error in CommentsSidebarComponent toggleGroupedCommentAnnotations: ",i)}}changeGroupBy(e){try{this.componentConfigSignal.update(i=>(i=I({},i),e?e===i.groupBy?i.groupBy=null:i.groupBy=e:i.groupBy=null,i)),sessionStorage.setItem(j.SESSION_STORAGE.SNIPPYLY_COMMENT_SIDEBAR_GROUP_BY,this.componentConfigSignal().groupBy||""),this.groupFilteredCommentAnnotations()}catch(i){this.loggingService.catch("Error in CommentsSidebarComponent changeGroupBy: ",i)}}groupFilteredCommentAnnotations(){try{let e=this.filteredGroupedCommentAnnotationsObj,i=this.componentConfigSignal(),r=i.systemFiltersOperator===hc.AND;switch(i.groupBy){case i.groupByOptions.people:let a=i.filters.people?.length&&r?i.filters.people:i.peopleFilters;this.filteredGroupedCommentAnnotationsObj={},a.forEach(H=>{let K=this.filterAnnotationsByPeople(H,this.componentConfigSignal().filteredCommentPinAnnotations),oe=i.user?.userSnippylyId===H.id;K?.length&&(this.filteredGroupedCommentAnnotationsObj[H.id]={displayName:oe?"Me":H.name,annotations:K,isExpanded:e[H.id]?e[H.id]?.isExpanded:!0})}),this.filteredGroupedCommentAnnotations=[],i.peopleFilters.forEach(H=>{this.filteredGroupedCommentAnnotationsObj[H.id]&&this.filteredGroupedCommentAnnotations.push(this.filteredGroupedCommentAnnotationsObj[H.id])});break;case i.groupByOptions.assigned:let s=i.filters.assigned?.length&&r?i.filters.assigned:i.assignedFilters;this.filteredGroupedCommentAnnotationsObj={},s.forEach(H=>{let K=this.filterAnnotationsByAssigned(H,this.componentConfigSignal().filteredCommentPinAnnotations),oe=i.user?.userSnippylyId===H.id;K?.length&&(this.filteredGroupedCommentAnnotationsObj[H.id]={displayName:oe?"Me":H.name,annotations:K,isExpanded:e[H.id]?e[H.id]?.isExpanded:!0})}),this.filteredGroupedCommentAnnotations=[],i.assignedFilters.forEach(H=>{this.filteredGroupedCommentAnnotationsObj[H.id]&&this.filteredGroupedCommentAnnotations.push(this.filteredGroupedCommentAnnotationsObj[H.id])});break;case i.groupByOptions.tagged:let m=i.filters.tagged?.length&&r?i.filters.tagged:i.taggedFilters;this.filteredGroupedCommentAnnotationsObj={},m.forEach(H=>{let K=this.filterAnnotationsByTagged(H,this.componentConfigSignal().filteredCommentPinAnnotations),oe=i.user?.userSnippylyId===H.id;K?.length&&(this.filteredGroupedCommentAnnotationsObj[H.id]={displayName:oe?"Me":H.name,annotations:K,isExpanded:e[H.id]?e[H.id]?.isExpanded:!0})}),this.filteredGroupedCommentAnnotations=[],i.taggedFilters.forEach(H=>{this.filteredGroupedCommentAnnotationsObj[H.id]&&this.filteredGroupedCommentAnnotations.push(this.filteredGroupedCommentAnnotationsObj[H.id])});break;case i.groupByOptions.page:case i.groupByOptions.location:i=this.componentConfigSignal();let p=i.filters.pages?.length&&r?i.filters.pages:Object.values(i.pages||{});p?.sort((H,K)=>H?.displayName===i.currentPage?-1:K?.displayName===i.currentPage?1:0),this.filteredGroupedCommentAnnotationsObj={},p.forEach(H=>{let K=H?.displayName===i?.currentPage;this.locations&&Object.keys(this.locations||{}).forEach(ue=>{let be=this.locations[ue]?.location;be?.id&&be?.id===H?.id&&(K=!0)});let oe=this.filterAnnotationsByPage(H,this.componentConfigSignal().filteredCommentPinAnnotations);if((H.id||H?.displayName)&&oe?.length){let ue=H.id||H?.displayName||"";this.filteredGroupedCommentAnnotationsObj[ue]={displayName:H.displayName,annotations:oe,isExpanded:e[ue]?e[ue]?.isExpanded:!!K}}}),this.filteredGroupedCommentAnnotations=[];let h=i?.filterConfig?.location?.order||[];if(h?.length){let H=K=>{let oe=h.indexOf(K?.id);return oe===-1?1/0:oe};p.sort((K,oe)=>{let ue=H(K),be=H(oe);return ue!==be?ue-be:p.indexOf(K)-p.indexOf(oe)})}p.forEach(H=>{let K=H.id||H?.displayName||"";K&&this.filteredGroupedCommentAnnotationsObj[K]&&this.filteredGroupedCommentAnnotations.push(this.filteredGroupedCommentAnnotationsObj[K])}),this.componentConfigSignal.update(H=>(H=I(I({},H),i),H));break;case i.groupByOptions.priority:let _=i.filters.priorities?.length&&r?i.filters.priorities:i.priorities;this.filteredGroupedCommentAnnotationsObj={},_.forEach(H=>{let K=this.filterAnnotationsByPriority(H,this.componentConfigSignal().filteredCommentPinAnnotations);K?.length&&(this.filteredGroupedCommentAnnotationsObj[H.id]={displayName:H.name,annotations:K,isExpanded:e[H.id]?e[H.id]?.isExpanded:!0})}),this.filteredGroupedCommentAnnotations=[],i.priorities.forEach(H=>{this.filteredGroupedCommentAnnotationsObj[H.id]&&this.filteredGroupedCommentAnnotations.push(this.filteredGroupedCommentAnnotationsObj[H.id])}),this.componentConfigSignal.update(H=>(H=I(I({},H),i),H));break;case i.groupByOptions.category:let E=i.filters.categories?.length&&r?i.filters.categories:Object.values(i.commentCategoryMap||{});this.filteredGroupedCommentAnnotationsObj={},E.forEach(H=>{let K=this.filterAnnotationsByCommentCategory(H,this.componentConfigSignal().filteredCommentPinAnnotations);K?.length&&(this.filteredGroupedCommentAnnotationsObj[H.id]={displayName:H.name,annotations:K,isExpanded:e[H.id]?e[H.id]?.isExpanded:!0})}),this.filteredGroupedCommentAnnotations=[],E.forEach(H=>{this.filteredGroupedCommentAnnotationsObj[H.id]&&this.filteredGroupedCommentAnnotations.push(this.filteredGroupedCommentAnnotationsObj[H.id])}),this.componentConfigSignal.update(H=>(H=I(I({},H),i),H));break;case i.groupByOptions.document:i=this.componentConfigSignal();let D=i.filters.documents?.length&&r?i.filters.documents:Object.values(i.documents||{});D?.sort((H,K)=>H?.id===i.currentDocument?-1:K?.id===i.currentDocument?1:0),this.filteredGroupedCommentAnnotationsObj={},D.forEach(H=>{let K=H?.id===i?.currentDocument,oe=this.filterAnnotationsByDocument(H,this.componentConfigSignal().filteredCommentPinAnnotations);if(H.id&&oe?.length){let ue=H.id||"";this.filteredGroupedCommentAnnotationsObj[ue]={displayName:H.documentName||H.id||"",annotations:oe,isExpanded:e[ue]?e[ue]?.isExpanded:!!K}}}),this.filteredGroupedCommentAnnotations=[];let L=i?.filterConfig?.document?.order||[];if(L?.length){let H=K=>{let oe=L.indexOf(K?.id);return oe===-1?1/0:oe};D.sort((K,oe)=>{let ue=H(K),be=H(oe);return ue!==be?ue-be:D.indexOf(K)-D.indexOf(oe)})}D.forEach(H=>{let K=H.id;K&&this.filteredGroupedCommentAnnotationsObj[K]&&this.filteredGroupedCommentAnnotations.push(this.filteredGroupedCommentAnnotationsObj[K])}),this.componentConfigSignal.update(H=>(H=I(I({},H),i),H));break;default:this.filteredGroupedCommentAnnotationsObj={},this.filteredGroupedCommentAnnotationsObj={[this.pageTypes.all]:{displayName:this.pageTypes.all,annotations:this.componentConfigSignal().filteredCommentPinAnnotations,isExpanded:e[this.pageTypes.all]?e[this.pageTypes.all]?.isExpanded:!0}},this.filteredGroupedCommentAnnotations=[this.filteredGroupedCommentAnnotationsObj[this.pageTypes.all]];break}this.setSidebarGroupedAnnotationsData()}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent groupFilteredCommentAnnotations: ",e)}}setSidebarGroupedAnnotationsData(){try{if(this.commentService.getSidebarCustomActionsValue())this.commentService.getSidebarCustomActionsValue()&&this.dataAvailable&&(this.commentService.getSidebarCustomActionEventDataOnInitValue()?this.commentService.setSidebarCustomActionEventDataAllChanges(this.componentConfigSignal().customActionsState,this.componentConfigSignal().annotations,this.componentConfigSignal().unreadCommentsMap,this.componentConfigSignal().filteredCommentPinAnnotations):this.commentService.setSidebarCustomActionEventDataOnInit(this.componentConfigSignal().customActionsState,this.componentConfigSignal().annotations,this.componentConfigSignal().unreadCommentsMap,this.componentConfigSignal().filteredCommentPinAnnotations));else{let e=this.filteredGroupedCommentAnnotations.length===1&&this.filteredGroupedCommentAnnotations[0].displayName==="Others";this.componentConfigSignal.update(r=>(r=I({},r),r.virtualScrollData=[],r)),this.filteredGroupedCommentAnnotations.forEach(r=>{!e&&r.annotations?.length&&this.componentConfigSignal.update(a=>(a=I({},a),a.virtualScrollData.push({type:"group",data:r}),a)),(r.isExpanded||e)&&r.annotations.forEach(a=>{this.componentConfigSignal.update(s=>(s=I({},s),s.virtualScrollData.push({type:"annotation",data:a}),s))})}),this.componentConfigSignal.update(r=>(r=T(I({},r),{noCommentsFoundForAppliedFilters:!this.componentConfigSignal().virtualScrollData?.length}),r)),this.cd.markForCheck();let i=this.virtualScrollViewportRef?.elementRef?.nativeElement;i&&(i.scrollTop=0)}}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent setSidebarGroupedAnnotationsData: ",e)}}filterAnnotationsByPage(e,i){try{return i?.filter(r=>e?.locationIds?.length?r?.locationId?r?.location?.id===e?.id||e?.locationIds?.includes(r?.locationId):r?.documentParams?.id===e?.id||e?.locationIds?.includes(r?.documentParamsId):!r?.locationId&&!r?.documentParamsId)}catch(r){return this.loggingService.catch("Error in CommentsSidebarComponent filterAnnotationsByPage: ",r),[]}}filterAnnotationsByStatus(e,i){try{return i.filter(r=>r?.status?.id===e.id)}catch(r){return this.loggingService.catch("Error in CommentsSidebarComponent filterAnnotationsByStatus: ",r),[]}}filterAnnotationsByPeople(e,i){try{return e.id?i.filter(r=>r?.from?.userSnippylyId===e?.id||r?.from?.userId===e?.id||r?.from?.email===e?.id):i}catch(r){return this.loggingService.catch("Error in CommentsSidebarComponent filterAnnotationsByPeople: ",r),[]}}filterAnnotationsByTagged(e,i){try{return e.id===this.componentConfigSignal().user?.userSnippylyId?i.filter(r=>{let a=!1;return r.comments.forEach(s=>{s.taggedUserContacts?.forEach(m=>{m?.contact?.userSnippylyId===this.componentConfigSignal().user?.userSnippylyId&&(a=!0)})}),a}):i.filter(r=>r?.comments?.some(a=>a?.taggedUserContacts?.some(s=>s?.contact?.userSnippylyId===e?.id)))}catch(r){return this.loggingService.catch("Error in CommentsSidebarComponent filterAnnotationsByTagged: ",r),[]}}filterAnnotationsByAssigned(e,i){try{return e.id===this.componentConfigSignal().user?.userSnippylyId?i.filter(r=>r?.assignedTo?.userId===this.componentConfigSignal().user?.userId):i.filter(r=>r?.assignedTo?.userSnippylyId===e?.id)}catch(r){return this.loggingService.catch("Error in CommentsSidebarComponent filterAnnotationsByAssigned: ",r),[]}}filterAnnotationsByPriority(e,i){try{return e.id==="unset"?i.filter(r=>!r?.priority):i.filter(r=>r?.priority?.id===e.id)}catch(r){return this.loggingService.catch("Error in CommentsSidebarComponent filterAnnotationsByPriority: ",r),[]}}filterAnnotationsByCommentCategory(e,i){try{switch(e?.id){case"other":return i?.filter(r=>!r?.commentCategories?.length||r?.commentCategories?.find(a=>a?.id===e?.id))}return i?.filter(r=>(r?.commentCategories||[])?.find(a=>a?.id===e?.id))}catch(r){return this.loggingService.catch("Error in CommentsSidebarComponent filterAnnotationsByCommentCategory: ",r),[]}}filterAnnotationsByAccessMode(e,i){try{return e===Qi.PRIVATE?i.filter(r=>r?.iam?.accessMode===Qi.PRIVATE):i.filter(r=>!r?.iam?.accessMode||r?.iam?.accessMode===Qi.PUBLIC)}catch(r){return this.loggingService.catch("Error in CommentsSidebarComponent filterAnnotationsByAccessMode: ",r),[]}}filterAnnotationsByVersion(e,i){try{return e.id==="unset"?i.filter(r=>!r?.location?.version):i.filter(r=>r?.location?.version?.id===e.id)}catch(r){return this.loggingService.catch("Error in CommentsSidebarComponent filterAnnotationsByVersion: ",r),[]}}filterAnnotationsByInput(e,i){try{return i.filter(r=>{let a=!1;for(let s=0;s<r?.comments?.length;s++){let m=r?.comments[s];if(m?.commentText?.toLowerCase().includes(e.toLowerCase())){a=!0;break}else if(m?.from?.name?.toLowerCase().includes(e.toLowerCase())){a=!0;break}}return a})}catch(r){return this.loggingService.catch("Error in CommentsSidebarComponent filterAnnotationsByInput: ",r),[]}}closeSidebar(){try{this.commentService.setSidebarVisibility(!1,!1,!0),this.onSidebarClose.emit()}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent closeSidebar: ",e)}}emitOnSidebarCommentClick(e){try{let i=this.documentPaths?.clientDocumentId,r=e?.location;r||(r=e?.documentParams);let a={};e.context&&(a=e.context),this.onSidebarCommentClick.emit({documentId:i,location:r,targetElementId:e?.targetElementId,context:a,annotation:e}),this.onSidebarCommentClickEvent.emit({documentId:i,location:r,targetElementId:e?.targetElementId,context:a,annotation:e}),this.onCommentClick.emit({documentId:i,location:r,targetElementId:e?.targetElementId,context:a,annotation:e}),this.commentService.onSidebarCommentClick({documentId:i,location:r,targetElementId:e?.targetElementId,context:a,annotation:e})}catch(i){this.loggingService.catch("Error in CommentsSidebarComponent onSidebarCommentClick: ",i)}}emitOnCommentNavigationButtonClick(e){try{let i=this.documentPaths?.clientDocumentId,r=e?.location;r||(r=e?.documentParams);let a={};e.context&&(a=e.context),this.onCommentNavigationButtonClick.emit({documentId:i,location:r,targetElementId:e?.targetElementId,context:a,annotation:e})}catch(i){this.loggingService.catch("Error in CommentsSidebarComponent emitOnCommentNavigationButtonClick: ",i)}}setFiltersToStorage(){try{let e=JSON.parse(JSON.stringify(this.componentConfigSignal().filters));delete e?.input;let i=JSON.stringify(e);sessionStorage.setItem(j.SESSION_STORAGE.SNIPPYLY_COMMENT_SIDEBAR_FILTERS,i)}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent setFiltersToStorage: ",e)}}setCommentSidebarInstalledInAnalytics(){try{this.analyticsService.setInstalledFeature(Bu.COMMENT_SIDEBAR)}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent setCommentSidebarInstalledInAnalytics: ",e)}}setCommentSidebarEmbedModeInAnalytics(){try{this.componentConfigSignal().embedMode&&this.analyticsService.trackEvent(X.Events.Comments.COMMENT_SIDEBAR_EMBED_MODE_ENABLED,{commentMode:this.commentService.getCommentMode()})}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent setCommentSidebarEmbedModeInAnalytics: ",e)}}setCommentSidebarFloatingModeInAnalytics(){try{this.componentConfigSignal().floatingMode&&this.analyticsService.trackEvent(X.Events.Comments.COMMENT_SIDEBAR_FLOATING_MODE_ENABLED,{commentMode:this.commentService.getCommentMode()})}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent setCommentSidebarFloatingModeInAnalytics: ",e)}}setCommentReadInAnalytics(){try{this.loggingService.log("%c[WB] Calling FUNCTION: setCommentReadInAnalytics","color: green;"),this.commentReadAnalyticsCalled||(this.commentReadAnalyticsCalled=!0,this.analyticsService.trackEvent(X.Events.Comments.COMMENT_READ,{uiLocation:"sidebar",commentMode:this.commentService.getCommentMode(),readType:"hover"}))}catch(e){this.loggingService.catch("Error in CommentDialogComponent setCommentReadInAnalytics: ",e)}}toggleMoreFilters(e){this.componentConfigSignal.update(i=>(i=T(I({},i),{moreFiltersVisible:!i.moreFiltersVisible}),i)),e&&e?.scrollTo({top:0})}savePageComment(e){try{let i=e?.updatedComment;i&&this.commentService.addComment(void 0,void 0,void 0,void 0,!0,[i],void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,e?.annotation?.assignedTo),this.componentConfigSignal.update(r=>(r=I({},r),r.pageCommentAnnotation=new Ro,r.pageCommentAnnotation.isPageAnnotation=!0,r))}catch(i){this.loggingService.catch("Error in CommentsSidebarComponent savePageComment: ",i)}}sortComments(e){try{this.componentConfigSignal.update(i=>{let r=[...i.virtualScrollData];return r.sort((a,s)=>{if(a.type==="annotation"&&s.type==="annotation"){if(e==="date"){let m=new Date(a.data.lastUpdated).getTime();return new Date(s.data.lastUpdated).getTime()-m}else if(e==="unread"){let m=i.unreadCommentsMap?.[a.data.annotationId]||0,p=i.unreadCommentsMap?.[s.data.annotationId]||0;if(m>0&&p===0)return-1;if(m===0&&p>0)return 1;let h=new Date(a.data.lastUpdated).getTime();return new Date(s.data.lastUpdated).getTime()-h}}return 0}),i=T(I({},i),{virtualScrollData:r}),i}),this.componentConfigSignal.update(i=>(i=T(I({},i),{selectedMinimalFilterDropdownOption:T(I({},i.selectedMinimalFilterDropdownOption),{sorting:e})}),i))}catch(i){this.loggingService.catch("Error in CommentsSidebarComponent sortComments: ",i)}}toggleMinimalFilterDropdown(){try{this.componentConfigSignal.update(e=>(e=T(I({},e),{minimalFilterDropdownOpen:!e.minimalFilterDropdownOpen}),e))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent toggleMinimalFilterDropdown: ",e)}}filterCommentsByReadStatus(e){try{this.componentConfigSignal.update(i=>(i=T(I({},i),{minimalFilter:e,selectedMinimalFilterDropdownOption:T(I({},i.selectedMinimalFilterDropdownOption),{filter:e})}),i)),this.filterCommentAnnotations()}catch(i){this.loggingService.catch("Error in CommentsSidebarComponent filterCommentsByReadStatus: ",i)}}resetFilters(){try{this.componentConfigSignal.update(e=>(e=T(I({},e),{minimalFilter:"all",customActionsState:{all:!0},filters:{statuses:[],statusIds:[],pages:[],documents:[],people:[],assigned:[],tagged:[],versions:[],categories:[],priorities:[],accessModes:[],input:"",versionIds:[],priorityIds:[],categoryIds:[]},selectedMinimalFilterDropdownOption:T(I({},e.selectedMinimalFilterDropdownOption),{filter:"all"})}),e)),this.resolvedCommentsOnDom=!1,this.filterCommentsByReadStatus("all"),this.updateFilter({key:"pages",value:null},!0),this.updateFilter({key:"documents",value:null},!0),this.updateFilter({key:"people",value:null},!0),this.updateFilter({key:"assigned",value:null},!0),this.updateFilter({key:"tagged",value:null},!0),this.updateFilter({key:"statuses",value:null},!0),this.updateFilter({key:"priorities",value:null},!0),this.updateFilter({key:"categories",value:null},!0),this.updateFilter({key:"versions",value:null},!0),sessionStorage.removeItem(j.SESSION_STORAGE.VELT_COMMENT_SIDEBAR_CUSTOM_ACTIONS_STATE)}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent resetFilters: ",e)}}toggleLocationFilterDropdown(){try{this.componentConfigSignal.update(e=>(e=T(I({},e),{locationFilterDropdownOpen:!e.locationFilterDropdownOpen}),e))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent toggleLocationFilterDropdown: ",e)}}toggleDocumentFilterDropdown(){try{this.componentConfigSignal.update(e=>(e=T(I({},e),{documentFilterDropdownOpen:!e.documentFilterDropdownOpen}),e))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent toggleDocumentFilterDropdown: ",e)}}closeDocumentFilterDropdown(){try{this.componentConfigSignal.update(e=>(e=T(I({},e),{documentFilterDropdownOpen:!1}),e))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent closeDocumentFilterDropdown: ",e)}}toggleMinimalActionsDropdown(){try{this.componentConfigSignal.update(e=>(e=T(I({},e),{minimalActionsDropdownOpen:!e.minimalActionsDropdownOpen}),e))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent toggleMinimalActionsDropdown: ",e)}}markAllCommentAnnotationsAsRead(){try{this.commentService.setCommentAnnotationsAsRead(this.componentConfigSignal().filteredCommentPinAnnotations)}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent setCommentAnnotationsAsRead: ",e)}}markAllCommentAnnotationsAsResolved(){try{this.commentService.setCommentAnnotationsAsResolved(this.componentConfigSignal().filteredCommentPinAnnotations)}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent markAllCommentAnnotationsAsResolved: ",e)}}toggleCustomAction(e,i){try{i==="toggle"?(this.componentConfigSignal.update(r=>(r=T(I({},r),{customActionsState:{[e]:!r.customActionsState[e]}}),r)),sessionStorage.setItem(j.SESSION_STORAGE.VELT_COMMENT_SIDEBAR_CUSTOM_ACTIONS_STATE,JSON.stringify(this.componentConfigSignal().customActionsState)),this.commentService.setSidebarCustomActionEventData(this.componentConfigSignal().customActionsState,this.componentConfigSignal().annotations,this.componentConfigSignal().unreadCommentsMap,this.componentConfigSignal().filteredCommentPinAnnotations)):(this.commentService.setSidebarCustomActionEventData({[e]:!0},this.componentConfigSignal().annotations,this.componentConfigSignal().unreadCommentsMap,this.componentConfigSignal().filteredCommentPinAnnotations),sessionStorage.setItem(j.SESSION_STORAGE.VELT_COMMENT_SIDEBAR_CUSTOM_ACTIONS_STATE,JSON.stringify({[e]:!0})))}catch(r){this.loggingService.catch("Error in CommentsSidebarComponent toggleCustomAction: ",r)}}goBackToAllComments(){try{this.componentConfigSignal.update(e=>(e=T(I({},e),{focusedAnnotation:null}),e))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent goBackToAllComments: ",e)}}filterSearch(e,i){try{let r=this.componentConfigSignal();if(!r?.peopleFilters)return;let a,s;switch(i){case"people":a=r.peopleFilters,!e||e===""?s=a:s=a.filter(m=>m?.name?.toLowerCase().includes(e.toLowerCase()));break;case"assigned":a=r.assignedFilters,!e||e===""?s=a:s=a.filter(m=>m?.name?.toLowerCase().includes(e.toLowerCase()));break;case"tagged":a=r.taggedFilters,!e||e===""?s=a:s=a.filter(m=>m?.name?.toLowerCase().includes(e.toLowerCase()));break;case"pages":a=r.pages,!e||e===""?s=r.pages:(s={},Object.keys(a).filter(p=>p.toLowerCase().includes(e.toLowerCase())).forEach(p=>{s[p]=a[p]}));break;case"documents":a=r.documents,!e||e===""?s=r.documents:(s={},Object.keys(a).filter(p=>a[p]?.documentName?.toLowerCase().includes(e.toLowerCase())).forEach(p=>{s[p]=a[p]}));break;case"statuses":a=r.statuses,!e||e===""?s=a:s=a.filter(m=>m.name.toLowerCase().includes(e.toLowerCase()));break;case"priorities":a=r.priorities,!e||e===""?s=a:s=a.filter(m=>m.name.toLowerCase().includes(e.toLowerCase()));break;case"categories":a=r.commentCategoryMap,!e||e===""?s=r.commentCategoryMap:(s={},Object.keys(a).filter(p=>p.toLowerCase().includes(e.toLowerCase())).forEach(p=>{s[p]=a[p]}));break;case"versions":a=r.versions,!e||e===""?s=r.versions:s=a.filter(m=>m.name.toLowerCase().includes(e.toLowerCase()));break}return s}catch(r){return this.loggingService.catch("Error in CommentsSidebarComponent filterPeople: ",r),[]}}updateDocumentSelectedState(){try{this.componentConfigSignal.update(e=>(e=I({},e),Object.values(e.documents).forEach(i=>{let r=e.filters?.documents?.find(a=>a.id===i?.id);r?(i.selected=!0,r.documentName||(r.documentName=i.documentName)):i.selected=!1}),e))}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent updateDocumentSelectedState: ",e)}}filterAnnotationsByDocument(e,i){try{return i?.filter(r=>e?.id&&e.id!=="other"?r?.metadata?.clientDocumentId?.toString()===e.id:!r?.metadata?.clientDocumentId)}catch(r){return this.loggingService.catch("Error in CommentsSidebarComponent filterAnnotationsByDocument: ",r),[]}}};o.\u0275fac=function(i){return new(i||o)(u(Ze),u(He),u(we),u(jt),u(Ne),u(lt),u(k),u(fn),u(y),u(po),u(zo),u(tl),u(Kt),u(ze),u(Wi),u(r_),u(Ye))},o.\u0275cmp=O({type:o,selectors:[["app-comments-sidebar"]],viewQuery:function(i,r){if(i&1&&(ot(aHt,5),ot(sHt,5),ot(lHt,7)),i&2){let a;Qe(a=Je())&&(r.sidebarOverlay=a.first),Qe(a=Je())&&(r.virtualScrollViewportRef=a.first),Qe(a=Je())&&(r.hostElement=a.first)}},hostVars:2,hostBindings:function(i,r){i&2&&x("data-velt-id",r.veltId)("data-velt-element",r.veltElement)},inputs:{embedMode:"embedMode",floatingMode:"floatingMode",_pageMode:[0,"pageMode","_pageMode"],_filterCount:[0,"filterCount","_filterCount"],_customActions:[0,"customActions","_customActions"],focusedThreadMode:"focusedThreadMode",_sortData:[0,"sortData","_sortData"],enableUrlNavigation:"enableUrlNavigation",urlNavigation:"urlNavigation",_queryParamsComments:[0,"queryParamsComments","_queryParamsComments"],_currentLocationSuffix:[0,"currentLocationSuffix","_currentLocationSuffix"],_filterOptionLayout:[0,"filterOptionLayout","_filterOptionLayout"],_filterConfig:[0,"filterConfig","_filterConfig"],_groupConfig:[0,"groupConfig","_groupConfig"],_filters:[0,"filters","_filters"],_systemFiltersOperator:[0,"systemFiltersOperator","_systemFiltersOperator"],_excludeLocationIds:[0,"excludeLocationIds","_excludeLocationIds"],_fullExpanded:[0,"fullExpanded","_fullExpanded"],dialogVariant:"dialogVariant",focusedThreadDialogVariant:"focusedThreadDialogVariant",filterPanelLayout:"filterPanelLayout",pageModeComposerVariant:"pageModeComposerVariant",searchPlaceholder:"searchPlaceholder",_sidebarShadowDOM:[0,"shadowDom","_sidebarShadowDOM"],variant:"variant",position:"position"},outputs:{openSidebar:"openSidebar",onSidebarOpen:"onSidebarOpen",onSidebarCommentClick:"sidebarCommentClick",onSidebarCommentClickEvent:"onSidebarCommentClick",onCommentClick:"onCommentClick",onSidebarClose:"onSidebarClose",onCommentNavigationButtonClick:"onCommentNavigationButtonClick"},standalone:!1,features:[B,Xe],decls:1,vars:1,consts:[["sidebarRef",""],["defaultSidebarMode",""],["sidebarTrigger","cdkOverlayOrigin"],["sidebarOverlay","cdkConnectedOverlay"],[4,"ngIf"],[3,"ngIf"],[4,"ngIf","ngIfElse"],[4,"ngTemplateOutlet"],["cdkOverlayOrigin",""],["cdkConnectedOverlay","",3,"cdkConnectedOverlayOrigin","cdkConnectedOverlayOpen","cdkConnectedOverlayDisableClose","cdkConnectedOverlayPanelClass"],["class","velt-comments-sidebar-container",3,"dark",4,"ngIf"],[1,"velt-comments-sidebar-container"],["role","dialog",3,"onWrapperClick","componentConfigSignal","template","darkMode"]],template:function(i,r){i&1&&g(0,yHt,4,1,"ng-container",4),i&2&&c("ngIf",r.componentConfigSignal())},dependencies:[Z,vt,Vn,An,tn,Rfe,de],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}[_nghost-%COMP%]{width:100%} .snippyly-sidebar-panel .viewport .cdk-virtual-scroll-content-wrapper{max-width:100%}.s-overflow-hidden[_ngcontent-%COMP%]{overflow:hidden}"],changeDetection:0});let n=o;return n})();var SHt=["*"];function bHt(n,o){if(n&1&&w(0,"snippyly-user-avatar",12),n&2){let t=l(3);c("user",t.cursorUser)}}function IHt(n,o){if(n&1&&w(0,"video",13),n&2){let t=l(3);ge("flip",t.selfCursorPointer),c("srcObject",t.stream)("volume",t.selfCursorPointer?0:1)}}function EHt(n,o){if(n&1&&w(0,"audio",13),n&2){let t=l(3);c("srcObject",t.stream)("volume",t.selfCursorPointer?0:1)}}function xHt(n,o){if(n&1&&(C(0,"div",6)(1,"div",7)(2,"div",8),g(3,bHt,1,1,"snippyly-user-avatar",9)(4,IHt,1,4,"video",10)(5,EHt,1,2,"audio",11),S()()()),n&2){let t=l(2);d(),rt("background",t.cursorUser==null?null:t.cursorUser.color)("border",t.gainVolume&&t.lightenedColor?t.getGainAnimationBorderStyle():""),d(2),c("ngIf",!(t.huddleState!=null&&t.huddleState.videoState)),d(),c("ngIf",t.huddleState==null?null:t.huddleState.videoState),d(),c("ngIf",(t.huddleState==null?null:t.huddleState.audioState)&&!(t.huddleState!=null&&t.huddleState.videoState))}}function THt(n,o){if(n&1){let t=q();C(0,"div",14)(1,"img",15),G("error",function(){N(t);let i=l(3);return F(i.onImageLoadError())}),S()()}if(n&2){let t=l(3);rt("background-color",t.cursorUser.color),ge("user-presence-text-container-comment-border",t.cursorUser.comment),d(),c("src",t.cursorUser==null?null:t.cursorUser.photoUrl,dn)}}function DHt(n,o){if(n&1&&(C(0,"p",20),te(1),A(2,"translate"),S()),n&2){let t,e=l(5);rt("color",e.getTextColor(e.cursorUser==null?null:e.cursorUser.color)),d(),ve(" ",P(2,3,e.cursorUser.name||(!(e.cursorUser==null||e.cursorUser.email==null||(t=e.cursorUser.email.split("@"))==null)&&t.length?e.cursorUser==null||e.cursorUser.email==null?null:e.cursorUser.email.split("@")[0]:e.cursorUser==null?null:e.cursorUser.email)),"")}}function wHt(n,o){if(n&1&&(C(0,"p",21),te(1),A(2,"translate"),S()),n&2){let t=l(5);d(),je(P(2,1,t.cursorUser.comment))}}function OHt(n,o){if(n&1&&(C(0,"div",17),g(1,DHt,3,5,"p",18)(2,wHt,3,3,"p",19),S()),n&2){let t=l(4);rt("background-color",t.cursorUser.color),ge("user-presence-text-container-comment-border",t.cursorUser.comment)("px-3",t.cursorUser.comment)("py-2",t.cursorUser.comment),d(),c("ngIf",t.cursorUser.name||(t.cursorUser==null?null:t.cursorUser.email)),d(),c("ngIf",t.cursorUser.comment)}}function AHt(n,o){n&1&&(C(0,"div",22),w(1,"velt-skeleton-loader-internal",23),S())}function PHt(n,o){if(n&1&&g(0,OHt,3,10,"div",16)(1,AHt,2,0,"ng-template",null,2,De),n&2){let t=pe(2),e=l(3);c("ngIf",e.cursorUser.name||(e.cursorUser==null?null:e.cursorUser.email)||e.cursorUser.comment)("ngIfElse",t)}}function MHt(n,o){if(n&1&&g(0,THt,2,5,"ng-template",5)(1,PHt,3,2,"ng-template",null,1,De),n&2){let t=pe(2),e=l(2);c("ngIf",e.avatarMode&&!e.showInitial)("ngIfElse",t)}}function kHt(n,o){if(n&1&&(C(0,"div",4),Rt(1),g(2,xHt,6,7,"ng-template",5)(3,MHt,3,2,"ng-template",null,0,De),S()),n&2){let t=pe(4),e=l();rt("top",e.cursorUser==null||e.cursorUser.position==null?null:e.cursorUser.position.top,"px")("left",e.cursorUser==null||e.cursorUser.position==null?null:e.cursorUser.position.left,"px"),ge("no-transition",e.selfCursorPointer),d(2),c("ngIf",e.stream&&((e.huddleState==null?null:e.huddleState.audioState)||(e.huddleState==null?null:e.huddleState.videoState)))("ngIfElse",t)}}var Nfe=(()=>{let o=class o{get cursorUser(){return this._cursorUser}set cursorUser(e){this._cursorUser=e,e?.color&&(this.lightenedColor=lre(e?.color,80))}get stream(){return this._stream}set stream(e){this._stream=e,e&&this.startGainAnimation(e),this.huddleService.updateHuddleCursorAvailableByAttendeeId(this.cursorUser.userSnippylyId,!!this.stream)}constructor(e,i){this.huddleService=e,this.loggingService=i,this.selfCursorPointer=!1,this.avatarMode=!1,this.showInitial=!1,this.veltElement=!0}ngOnInit(){}ngAfterViewInit(){}startGainAnimation(e){try{let i=new AudioContext,r=i.createMediaStreamSource(e),a=i.createAnalyser();r.connect(a);let s=new Uint8Array(a.frequencyBinCount),m=()=>{a.getByteFrequencyData(s);let p=s.reduce((h,_)=>h+_,0)/s.length;this.gainVolume=p,this.gainAnimationId=requestAnimationFrame(m)};this.gainAnimationId=requestAnimationFrame(m)}catch(i){this.loggingService.catch("Error in CursorPointerComponent startGainAnimation: ",i)}}stopGainAnimation(){try{this.gainAnimationId!==void 0&&cancelAnimationFrame(this.gainAnimationId),this.gainVolume=void 0}catch(e){this.loggingService.catch("Error in CursorPointerComponent stopGainAnimation: ",e)}}getOutlineSizeByGainAmount(){try{if(this.gainVolume!==void 0)return sre(0,5,Math.min(1,this.gainVolume/15))}catch(e){this.loggingService.catch("Error in CursorPointerComponent getOutlineSizeByGainAmount: ",e)}return 0}getGainAnimationBorderStyle(){return this.getOutlineSizeByGainAmount()+"px solid "+(this.lightenedColor||"white")+" !important"}onImageLoadError(){this.loggingService.log("%c[WB] Calling FUNCTION: onImageLoadError","color: green;");try{this.showInitial=!0}catch(e){this.loggingService.catch("Error in CursorPointerComponent onImageLoadError: ",e)}}getTextColor(e){return e?cre(e):"#141416"}ngOnDestroy(){try{this.stopGainAnimation(),this.stream=void 0}catch(e){this.loggingService.catch("Error in CursorPointerComponent ngOnDestroy: ",e)}}};o.\u0275fac=function(i){return new(i||o)(u(pr),u(y))},o.\u0275cmp=O({type:o,selectors:[["snippyly-cursor-pointer"]],hostVars:1,hostBindings:function(i,r){i&2&&x("data-velt-element",r.veltElement)},inputs:{cursorUser:"cursorUser",selfCursorPointer:"selfCursorPointer",avatarMode:"avatarMode",huddleState:"huddleState",stream:"stream"},standalone:!1,ngContentSelectors:SHt,decls:1,vars:1,consts:[["cursorRef",""],["defaultModeRef",""],["loadingTemplateRef",""],["part","container","class","user-presence-pointer",3,"no-transition","top","left",4,"ngIf"],["part","container",1,"user-presence-pointer"],[3,"ngIf","ngIfElse"],[1,"s-cursor-video-spacing"],["part","huddle-avatar-container",1,"s-cursor-video-container"],[1,"s-cursor-video-block"],[3,"user",4,"ngIf"],["playsinline","","autoplay","true",3,"srcObject","flip","volume",4,"ngIf"],["playsinline","","autoplay","true",3,"srcObject","volume",4,"ngIf"],[3,"user"],["playsinline","","autoplay","true",3,"srcObject","volume"],["part","avatar-container",1,"user-avatar-container"],[3,"error","src"],["part","label-container","class","user-presence-text-container",3,"backgroundColor","user-presence-text-container-comment-border","px-3","py-2",4,"ngIf","ngIfElse"],["part","label-container",1,"user-presence-text-container"],["part","label","class","user-presence-name small mb-0",3,"color",4,"ngIf"],["class","user-presence-comment mb-0",4,"ngIf"],["part","label",1,"user-presence-name","small","mb-0"],[1,"user-presence-comment","mb-0"],[1,"user-presence-text-container-loading"],["height","24px","width","80px","borderRadius","24px"]],template:function(i,r){i&1&&(Vt(),g(0,kHt,5,8,"div",3)),i&2&&c("ngIf",r.cursorUser==null?null:r.cursorUser.position)},dependencies:[Z,Hn,Io,de],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}*[_ngcontent-%COMP%]{box-sizing:border-box;margin:0;padding:0;-webkit-tap-highlight-color:rgba(255,255,255,0);outline:none;height:unset;width:unset;text-align:left;line-height:1.5;color:#000}*[_ngcontent-%COMP%]:empty{display:revert}.user-presence-pointer[_ngcontent-%COMP%]{position:fixed;z-index:var(--velt-cursor-z-index);-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-o-user-select:none;user-select:none;filter:brightness(110%) saturate(110%);transition:top linear 75ms,left linear 75ms}.user-presence-pointer.no-transition[_ngcontent-%COMP%]{transition:none}.user-presence-text-container[_ngcontent-%COMP%]{transform:translate(calc((1.2rem + 0px) * var(--velt-base-rem-unit))) translateY(calc((-.7rem + 0px) * var(--velt-base-rem-unit)));padding:calc((.4rem + 0px) * var(--velt-base-rem-unit));box-shadow:0 1px 4px #10101036;border-radius:12px;filter:brightness(110%) saturate(110%)}.user-presence-text-container-loading[_ngcontent-%COMP%]{transform:translate(calc((1.2rem + 0px) * var(--velt-base-rem-unit))) translateY(calc((-.7rem + 0px) * var(--velt-base-rem-unit)))}.user-presence-text-container-comment-border[_ngcontent-%COMP%]{border-bottom-left-radius:calc((1.3rem + 0px) * var(--velt-base-rem-unit));border-bottom-right-radius:calc((1.3rem + 0px) * var(--velt-base-rem-unit));border-top-right-radius:calc((1.3rem + 0px) * var(--velt-base-rem-unit));margin-top:calc((-.5rem + 0px) * var(--velt-base-rem-unit))}.user-presence-name[_ngcontent-%COMP%]{margin:0;font-size:calc((.7rem + 0px) * var(--velt-base-rem-unit));color:#fff}.user-avatar-container[_ngcontent-%COMP%]{width:calc((var(--legacy-velt-cursor-avatar-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-cursor-avatar-size) + 0px) * var(--velt-base-rem-unit));box-shadow:0 1px 4px #10101036;transform:translate(calc((1.2rem + 0px) * var(--velt-base-rem-unit))) translateY(calc((-.7rem + 0px) * var(--velt-base-rem-unit)));padding:calc((.08rem + 0px) * var(--velt-base-rem-unit));border-radius:100%}.user-avatar-container[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;border-radius:100%}.s-cursor-video-spacing[_ngcontent-%COMP%]{width:calc((var(--legacy-velt-cursor-video-size) + 16px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-cursor-video-size) + 16px) * var(--velt-base-rem-unit));display:flex;justify-content:center;align-items:center;position:absolute;top:calc((.4rem + 0px) * var(--velt-base-rem-unit));left:calc((.4rem + 0px) * var(--velt-base-rem-unit));background:transparent}.s-cursor-video-container[_ngcontent-%COMP%]{width:calc((var(--legacy-velt-cursor-video-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-cursor-video-size) + 0px) * var(--velt-base-rem-unit));box-sizing:content-box;padding:calc((.15rem + 0px) * var(--velt-base-rem-unit));border-radius:calc((10rem + 0px) * var(--velt-base-rem-unit));box-shadow:0 1px 4px #10101036}.s-cursor-video-container[_ngcontent-%COMP%] .s-cursor-video-block[_ngcontent-%COMP%]{position:relative;width:100%;height:100%}.s-cursor-video-container[_ngcontent-%COMP%] snippyly-user-avatar[_ngcontent-%COMP%]{position:absolute;--legacy-velt-avatar-size: var(--legacy-velt-cursor-video-size);--legacy-velt-avatar-user-initial-font-size: 1.5rem}.s-cursor-video-container[_ngcontent-%COMP%] snippyly-user-avatar[_ngcontent-%COMP%] .s-user-avatar-container[_ngcontent-%COMP%]{width:calc((var(--legacy-velt-cursor-video-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-cursor-video-size) + 0px) * var(--velt-base-rem-unit));border-radius:0;max-width:100%;max-height:100%}.s-cursor-video-container[_ngcontent-%COMP%] snippyly-user-avatar[_ngcontent-%COMP%] .s-user-avatar-container[_ngcontent-%COMP%] .s-user-avatar-initial[_ngcontent-%COMP%]:after{font-size:calc((2rem + 0px) * var(--velt-base-rem-unit))}.s-cursor-video-container[_ngcontent-%COMP%] video[_ngcontent-%COMP%]{width:100%;height:100%;border-radius:calc((10rem + 0px) * var(--velt-base-rem-unit));object-fit:cover}"],changeDetection:0});let n=o;return n})();function NHt(n,o){if(n&1&&(C(0,"snippyly-cursor-pointer",5)(1,"slot",6),le(),C(2,"svg",7)(3,"g",8),w(4,"path",9)(5,"path",10),S(),C(6,"defs")(7,"filter",11),w(8,"feFlood",12)(9,"feColorMatrix",13)(10,"feOffset",14)(11,"feGaussianBlur",15)(12,"feColorMatrix",16)(13,"feBlend",17)(14,"feBlend",18),S()()()()()),n&2){let t=l().$implicit,e=l(2).ngIf,i=l();c("cursorUser",t)("avatarMode",i.avatarMode)("huddleState",e.huddleOnCursorModeByAttendeeId[t==null?null:t.userSnippylyId]?e.attendeesByUserId[t==null?null:t.userSnippylyId]==null?null:e.attendeesByUserId[t==null?null:t.userSnippylyId].state:void 0)("stream",e.huddleOnCursorModeByAttendeeId[t==null?null:t.userSnippylyId]?e.remoteStreamsByUserId[t==null?null:t.userSnippylyId]==null?null:e.remoteStreamsByUserId[t==null?null:t.userSnippylyId].webcam:void 0),d(4),x("fill",t.color),d(),x("fill",t.color)}}function FHt(n,o){if(n&1&&(f(0),g(1,NHt,15,6,"snippyly-cursor-pointer",4),v()),n&2){let t=o.$implicit;d(),c("ngIf",t==null?null:t.position)}}function LHt(n,o){if(n&1&&(C(0,"snippyly-cursor-pointer",19)(1,"slot",6),le(),C(2,"svg",7)(3,"g",8),w(4,"path",9)(5,"path",10),S(),C(6,"defs")(7,"filter",11),w(8,"feFlood",12)(9,"feColorMatrix",13)(10,"feOffset",14)(11,"feGaussianBlur",15)(12,"feColorMatrix",16)(13,"feBlend",17)(14,"feBlend",18),S()()()()()),n&2){let t=l(2).ngIf,e=l();c("cursorUser",t.currentCursorUser)("selfCursorPointer",!0)("avatarMode",e.avatarMode)("huddleState",t.huddleOnCursorMode?t.attendeesByUserId[t.currentCursorUser==null?null:t.currentCursorUser.userSnippylyId]==null?null:t.attendeesByUserId[t.currentCursorUser==null?null:t.currentCursorUser.userSnippylyId].state:void 0)("stream",t.localStream),d(4),x("fill",t.currentCursorUser.color),d(),x("fill",t.currentCursorUser.color)}}function BHt(n,o){if(n&1&&g(0,FHt,2,1,"ng-container",2)(1,LHt,15,7,"snippyly-cursor-pointer",3),n&2){let t=l().ngIf,e=l();c("ngForOf",t.cursorUsers)("ngForTrackBy",e.trackById),d(),c("ngIf",t.huddleJoined&&t.huddleOnCursorMode&&t.currentCursorUser)}}function VHt(n,o){if(n&1&&(f(0),g(1,BHt,2,3,"ng-template",1),v()),n&2){let t=o.ngIf;d(),c("ngIf",t.isFirstComponent&&!(t.user!=null&&t.user.isAnonymous))}}var $H=(()=>{let o=class o{get inactivityTime(){return this._inactivityTime}set inactivityTime(e){try{isNaN(e)?this.loggingService.catch("Error in Cursor set inactivityTime: ","inactivity-time value is not a number."):(this._inactivityTime=e,this.cursorService.setInactivityTime(this._inactivityTime))}catch(i){this.loggingService.catch("Error in Cursor set inactivityTime: ",i)}}get allowedElementIds(){return this._allowedElementIds}set allowedElementIds(e){try{this._allowedElementIds=typeof e=="string"?JSON.parse(e):e,this.cursorService.setAllowedElementIds(this._allowedElementIds)}catch(i){this.loggingService.catch("Error in Cursor set allowedElementIds: ",i)}}constructor(e,i,r,a,s,m){this.analyticsService=e,this.authService=i,this.cursorService=r,this.domService=a,this.huddleService=s,this.loggingService=m,this.avatarMode=!1,this.onCursorUsersChanged=new Ae,this.onCursorUserChange=new Ae,this.subscriptions=[],this.constants=j,this.showInitials={},this.componentConfigSignal=Te({isFirstComponent:!1,user:void 0,cursorUsers:[],huddleOnCursorModeByAttendeeId:{},attendeesByUserId:{},remoteStreamsByUserId:{},huddleOnCursorMode:!1,huddleJoined:!1,currentCursorUser:new Kv,localStream:void 0}),this.veltId=Pn(),this.veltElement=!0,this._inactivityTime=5,this._allowedElementIds=[],this.loggingService.log("%c[WB] Creating CLASS: CursorComponent","color: blue;")}ngOnInit(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;")}ngAfterViewInit(){try{let e=document.querySelector(j.TAGS.SNIPPYLY_CURSOR),i=document.querySelector(j.TAGS.VELT_CURSOR);i?this.veltId===i?.getAttribute(j.ATTRIBUTES.VELT_ID)&&(this.componentConfigSignal.update(r=>(r=T(I({},r),{isFirstComponent:!0}),r)),this.initComponent()):this.veltId===e?.getAttribute(j.ATTRIBUTES.VELT_ID)&&(this.componentConfigSignal.update(r=>(r=T(I({},r),{isFirstComponent:!0}),r)),this.initComponent())}catch(e){this.loggingService.catch("Error in CursorComponent AfterViewInit: ",e)}}initComponent(){try{this.cursorService.checkCursorTagAvailable(),this.subscriptions.push(this.authService.getUser$().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{user:e}),i)),this.componentConfigSignal().user&&this.setCursorInstalledInAnalytics()},e=>{this.loggingService.catch("Error in CursorComponent getUser$ subscription: ",e)})),this.subscriptions.push(this.huddleService.getHuddleJoined$().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{huddleJoined:e}),i))})),this.subscriptions.push(this.huddleService.getHuddleOnCursorMode$().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{huddleOnCursorMode:e}),i))},e=>{this.loggingService.catch("Error in CursorComponent getHuddleOnCursorMode$ subscription: ",e)})),this.subscriptions.push(this.huddleService.localStream$.subscribe(e=>{e?this.componentConfigSignal.update(i=>(i=T(I({},i),{localStream:e}),i)):this.componentConfigSignal.update(i=>(i=T(I({},i),{localStream:void 0}),i))})),this.subscriptions.push(this.huddleService.getRemoteStreamsByUserId$().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{remoteStreamsByUserId:e}),i))},e=>{this.loggingService.catch("Error in CursorComponent getRemoteStreamsByUserId$ subscription: ",e)})),this.subscriptions.push(this.huddleService.getHuddleAttendees$().subscribe(e=>{let i={};e?i=e.reduce((r,a)=>(r[a.userSnippylyId]=a,r),{}):i={},this.componentConfigSignal.update(r=>(r=T(I({},r),{attendeesByUserId:i}),r))},e=>{this.loggingService.catch("Error in CursorComponent getAttendees$ subscription: ",e)})),this.subscriptions.push(this.huddleService.getHuddleOnCursorModeByAttendeeId$().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{huddleOnCursorModeByAttendeeId:e}),i))})),this.subscriptions.push(this.domService.onWindowPointerMove$().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{currentCursorUser:T(I({},i.currentCursorUser),{position:{left:(e?.clientX||0)-2,top:(e?.clientY||0)-2}})}),i))},e=>{this.loggingService.catch("Error in CursorComponent onWindowPointerMove$ subscription: ",e)})),this.getCurrentCursorUser(),this.getLiveCursorsOnCurrentDocument()}catch(e){this.loggingService.catch("Error in CursorComponent initComponent: ",e)}}ngOnDestroy(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnDestroy","color: green;");try{this.unsubscribe()}catch(e){this.loggingService.catch("Error in CursorComponent ondestroy: ",e)}}unsubscribe(){this.loggingService.log("%c[WB] Calling FUNCTION: unsubscribe","color: green;");try{this.subscriptions.map(e=>{e.unsubscribe()}),this.subscriptions=[]}catch(e){this.loggingService.catch("Error in CursorComponent unsubscribe: ",e)}}getLiveCursorsOnCurrentDocument(){this.loggingService.log("%c[WB] Calling FUNCTION: getLiveCursorsOnCurrentDocument","color: green;");try{this.subscriptions.push(this.cursorService.getLiveCursorsOnCurrentDocument().pipe(Fe(e=>!!e)).subscribe(e=>{this.loggingService.log(e),e&&(this.componentConfigSignal.update(i=>(i=T(I({},i),{cursorUsers:e}),i)),this.onCursorUsersChanged.emit(e),this.onCursorUserChange.emit(e))},e=>{this.loggingService.catch("Error in CursorComponent getLiveCursorsOnCurrentDocument subscription: ",e)}))}catch(e){this.loggingService.catch("Error in CursorComponent getLiveCursorsOnCurrentDocument: ",e)}}getCurrentCursorUser(){this.loggingService.log("%c[WB] Calling FUNCTION: getCurrentCursorUser","color: green;");try{this.subscriptions.push(this.cursorService.getCursorUser().pipe(Fe(e=>!!e)).subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{currentCursorUser:T(I({},e),{position:i.currentCursorUser?.position})}),i))},e=>{this.loggingService.catch("Error in CursorComponent getCurrentCursorUser subscription: ",e)}))}catch(e){this.loggingService.catch("Error in CursorComponent getCurrentCursorUser: ",e)}}trackById(e,i){return i?.userId}onImageLoadError(e){this.loggingService.log("%c[WB] Calling FUNCTION: onImageLoadError","color: green;");try{this.showInitials[e.userId]=!0}catch(i){this.loggingService.catch("Error in CursorComponent onImageLoadError: ",i)}}setCursorInstalledInAnalytics(){try{this.analyticsService.setInstalledFeature(ke.CURSOR)}catch(e){this.loggingService.catch("Error in CursorComponent setCursorInstalledInAnalytics: ",e)}}};o.\u0275fac=function(i){return new(i||o)(u(Ze),u(He),u(a0),u(Ne),u(pr),u(y))},o.\u0275cmp=O({type:o,selectors:[["app-cursor"]],hostVars:2,hostBindings:function(i,r){i&2&&x("data-velt-id",r.veltId)("data-velt-element",r.veltElement)},inputs:{avatarMode:"avatarMode",inactivityTime:"inactivityTime",allowedElementIds:"allowedElementIds"},outputs:{onCursorUsersChanged:"cursorUsersChanged",onCursorUserChange:"onCursorUserChange"},standalone:!1,decls:1,vars:1,consts:[[4,"ngIf"],[3,"ngIf"],[4,"ngFor","ngForOf","ngForTrackBy"],[3,"cursorUser","selfCursorPointer","avatarMode","huddleState","stream",4,"ngIf"],[3,"cursorUser","avatarMode","huddleState","stream",4,"ngIf"],[3,"cursorUser","avatarMode","huddleState","stream"],["name","cursor"],["width","24","height","24","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg",1,"cursor-icon"],["filter","url(#filter0_d_6047_31299)"],["d","M7.68749 16.5142L5.42791 5.15177C5.26065 4.31067 6.16027 3.66301 6.90484 4.08848L16.8788 9.78786C17.6558 10.2319 17.503 11.3948 16.6376 11.623L12.3849 12.7447C12.1377 12.8098 11.9249 12.9672 11.7902 13.1844L9.51802 16.8464C9.03968 17.6174 7.86445 17.4041 7.68749 16.5142Z","fill","#625DF5"],["d","M4.93751 5.24929L7.19709 16.6118C7.46253 17.9466 9.22538 18.2664 9.94288 17.11L12.215 13.448C12.2824 13.3394 12.3888 13.2607 12.5124 13.2281L16.7651 12.1065C18.0632 11.7642 18.2924 10.0198 17.1268 9.35374L7.15291 3.65436C6.03605 3.01615 4.68662 3.98765 4.93751 5.24929Z","stroke","white","stroke-linecap","square"],["id","filter0_d_6047_31299","x","0.588557","y","0.405717","width","21.6129","height","23.0055","filterUnits","userSpaceOnUse","color-interpolation-filters","sRGB"],["flood-opacity","0","result","BackgroundImageFix"],["in","SourceAlpha","type","matrix","values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0","result","hardAlpha"],["dy","1.1"],["stdDeviation","1.2"],["type","matrix","values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.17 0"],["mode","normal","in2","BackgroundImageFix","result","effect1_dropShadow_6047_31299"],["mode","normal","in","SourceGraphic","in2","effect1_dropShadow_6047_31299","result","shape"],[3,"cursorUser","selfCursorPointer","avatarMode","huddleState","stream"]],template:function(i,r){i&1&&g(0,VHt,2,1,"ng-container",0),i&2&&c("ngIf",r.componentConfigSignal())},dependencies:[ht,Z,Nfe],styles:[`html{--velt-base-rem-unit: 1}*[data-snippyly-element=true],*[data-velt-element=true]{font-family:var(--velt-default-font-family)}velt-wireframe{display:none!important}*{box-sizing:border-box;margin:0;padding:0;-webkit-tap-highlight-color:rgba(255,255,255,0);outline:none;height:unset;width:unset;text-align:left;line-height:1.5;color:#000;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit));pointer-events:none!important}*:empty{display:revert}.cursor-icon path{stroke:#fff;stroke-width:1px;stroke-linejoin:round}
416
416
  `],encapsulation:3,changeDetection:0});let n=o;return n})();function UHt(n,o){if(n&1&&(C(0,"span",7),te(1),A(2,"translate"),S()),n&2){let t=l(2).ngIf;d(),ve(" ",t.user!=null&&t.user.name?t.user==null||t.user.name==null?null:t.user.name.charAt(0):P(2,1,t.user==null||t.user.email==null?null:t.user.email.charAt(0)),"")}}function jHt(n,o){if(n&1){let t=q();C(0,"img",8),G("error",function(){N(t);let i=l(3);return F(i.onImageLoadError())}),S()}if(n&2){let t=l(2).ngIf;c("src",t.user.photoUrl,dn)}}function $Ht(n,o){if(n&1&&(C(0,"div",3)(1,"span",4),A(2,"translate"),g(3,UHt,3,3,"span",5)(4,jHt,1,1,"ng-template",null,0,De),S(),w(6,"audio",6),S()),n&2){let t=pe(5),e=l().ngIf;d(),rt("color",e.user.color+" !important")("background-color",e.user.color+" !important"),c("title",P(2,8,(e.user==null?null:e.user.name)||(e.user==null?null:e.user.email))),d(2),c("ngIf",e.showInitial)("ngIfElse",t),d(3),c("srcObject",e.remoteAudioStream)}}function HHt(n,o){if(n&1&&(f(0),g(1,$Ht,7,10,"div",2),v()),n&2){let t=o.ngIf;d(),c("ngIf",t.user)}}var Ffe=(()=>{let o=class o{constructor(e){this.loggingService=e,this.veltElement=!0,this.componentConfigSignal=Te({user:this.user,showInitial:!1,remoteAudioStream:this.remoteAudioStream})}ngOnInit(){}ngOnChanges(e){try{this.loggingService.log("%c[WB] Calling AudioHuddleUserComponent FUNCTION: ngOnChanges","color: green;"),e&&Object.keys(e).forEach(i=>{this.componentConfigSignal.update(r=>(r=T(I({},r),{[i]:e[i].currentValue}),r))})}catch(i){this.loggingService.catch("Error in AudioHuddleUserComponent ngOnChanges: ",i)}}onImageLoadError(){this.loggingService.log("%c[WB] Calling FUNCTION: onImageLoadError","color: green;");try{this.componentConfigSignal.update(e=>(e=T(I({},e),{showInitial:!0}),e))}catch(e){this.loggingService.catch("Error in AudioHuddleUserComponent onImageLoadError: ",e)}}};o.\u0275fac=function(i){return new(i||o)(u(y))},o.\u0275cmp=O({type:o,selectors:[["snippyly-audio-huddle-user"]],hostVars:1,hostBindings:function(i,r){i&2&&x("data-velt-element",r.veltElement)},inputs:{user:"user",remoteAudioStream:"remoteAudioStream"},standalone:!1,features:[Xe],decls:1,vars:1,consts:[["showAvatarImgRef",""],[4,"ngIf"],["class","audio-huddle-user photo-container",4,"ngIf"],[1,"audio-huddle-user","photo-container"],["velt-ignore-change-detection","true",1,"audio-huddle-user",3,"title"],["class","audio-huddle-user-initial",4,"ngIf","ngIfElse"],["autoplay","true",3,"srcObject"],[1,"audio-huddle-user-initial"],["referrerpolicy","no-referrer","loading","lazy",1,"audio-huddle-user-image",3,"error","src"]],template:function(i,r){i&1&&g(0,HHt,2,1,"ng-container",1),i&2&&c("ngIf",r.componentConfigSignal())},dependencies:[Z,de],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}.audio-huddle-user[_ngcontent-%COMP%]{display:none!important}.photo-container[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;width:40px;height:40px;box-sizing:border-box;background-clip:padding-box;border-radius:50%;padding:calc((.5rem + 0px) * var(--velt-base-rem-unit))!important;transition:top .12s ease-in-out,width .12s ease-in-out,height .12s ease-in-out}.photo-container[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;border-radius:50%;object-fit:cover}*[_ngcontent-%COMP%]{box-sizing:border-box;-webkit-tap-highlight-color:rgba(255,255,255,0)!important;outline:none!important;margin:0!important;padding:0!important;height:unset;width:unset;text-align:left!important;line-height:1.5!important;color:#000!important;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))}*[_ngcontent-%COMP%]:empty{display:revert!important}.s-presence-container[_ngcontent-%COMP%]{display:inline-flex;flex-direction:row-reverse;align-items:center}.audio-huddle-user[_ngcontent-%COMP%]{position:relative;box-shadow:0 0 0 3px;border-radius:50%;overflow:hidden;width:calc((2rem + 0px) * var(--velt-base-rem-unit));height:calc((2rem + 0px) * var(--velt-base-rem-unit));min-width:calc((2rem + 0px) * var(--velt-base-rem-unit));min-height:calc((2rem + 0px) * var(--velt-base-rem-unit));display:flex;align-items:center;justify-content:center}.audio-huddle-user.more-users[_ngcontent-%COMP%]{background:#4578a7;box-shadow:0 0 0 3px #4578a7}.audio-huddle-user[_ngcontent-%COMP%]:not(:last-child):not(.more-users){margin-left:calc((-.5rem + 0px) * var(--velt-base-rem-unit))!important}.audio-huddle-user-image[_ngcontent-%COMP%]{width:100%;height:100%;display:block;object-fit:cover}.audio-huddle-user-image-small[_ngcontent-%COMP%]{width:calc((1.6rem + 0px) * var(--velt-base-rem-unit));height:100%;display:block;object-fit:cover}.audio-huddle-user-initial[_ngcontent-%COMP%]{color:#fff}.away[_ngcontent-%COMP%]{filter:grayscale(1)}"],changeDetection:0});let n=o;return n})();function GHt(n,o){if(n&1){let t=q();C(0,"div",18),G("click",function(){let i=N(t).$implicit,r=l(2);return F(r.selectAudioDevice(i))}),te(1),A(2,"translate"),S()}if(n&2){let t=o.$implicit,e=l(2);ge("selected",t.deviceId===(e.selectedAudioDevice==null?null:e.selectedAudioDevice.deviceId)),d(),ve(" ",P(2,3,t.label)," ")}}function WHt(n,o){if(n&1&&(C(0,"div",12)(1,"div",13),te(2),A(3,"translate"),S(),te(4),A(5,"translate"),C(6,"div",14)(7,"div",15),g(8,GHt,3,5,"div",16),S(),te(9),A(10,"translate"),le(),C(11,"svg",4),w(12,"path",17),S()()()),n&2){let t=l();d(2),je(P(3,4,"Audio")),d(2),ve(" ",P(5,6,"Microphone")," "),d(4),c("ngForOf",t.audioDevices),d(),ve(" ",P(10,8,t.selectedAudioDevice==null?null:t.selectedAudioDevice.label)," ")}}function qHt(n,o){if(n&1){let t=q();C(0,"div",18),G("click",function(){let i=N(t).$implicit,r=l(2);return F(r.selectVideoDevice(i))}),te(1),A(2,"translate"),S()}if(n&2){let t=o.$implicit,e=l(2);ge("selected",t.deviceId===(e.selectedVideoDevice==null?null:e.selectedVideoDevice.deviceId)),d(),ve(" ",P(2,3,t.label)," ")}}function YHt(n,o){if(n&1&&(C(0,"div",12)(1,"div",13),te(2),A(3,"translate"),S(),te(4),A(5,"translate"),C(6,"div",14)(7,"div",15),g(8,qHt,3,5,"div",16),S(),te(9),A(10,"translate"),le(),C(11,"svg",4),w(12,"path",17),S()()()),n&2){let t=l();d(2),je(P(3,4,"Video")),d(2),ve(" ",P(5,6,"Camera")," "),d(4),c("ngForOf",t.videoDevices),d(),ve(" ",P(10,8,t.selectedVideoDevice==null?null:t.selectedVideoDevice.label)," ")}}var Lfe=(()=>{let o=class o{constructor(e,i,r){this.loggingService=e,this.dialogRef=i,this.devices=[],this.audioDevices=[],this.videoDevices=[],this.settingsVisible={audio:!0,video:!0},this.defaultMediaSourceOptions=yc(),this.veltElement=!0;try{r&&(this.selectedAudioDevice=r.selectedAudioDevice,this.selectedVideoDevice=r.selectedVideoDevice,r.settingsVisible&&(this.settingsVisible=r.settingsVisible)),this.getDevices()}catch(a){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent constructor: ",a)}}ngOnInit(){try{this.dialogRef.addPanelClass("snippyly-media-source-options-dialog")}catch(e){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent ngOnInit: ",e)}}getDevices(){return Q(this,null,function*(){try{if(new ei().getBrowserName()?.toLowerCase()==="safari")try{let i=yield navigator.mediaDevices.getUserMedia({audio:!0,video:!0});i&&i.getTracks().forEach(r=>r.stop())}catch(i){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent getDevices getUserMedia catch: ",i)}navigator.mediaDevices.enumerateDevices().then(i=>{if(this.devices=i.filter(r=>r.kind==="audioinput"||r.kind==="videoinput"),this.audioDevices=this.devices.filter(r=>r.kind==="audioinput"),this.videoDevices=this.devices.filter(r=>r.kind==="videoinput"),this.audioDevices.length>0&&!this.selectedAudioDevice){if(this.defaultMediaSourceOptions?.selectedAudioDevice?.deviceId){let r=this.audioDevices.find(a=>a.deviceId===this.defaultMediaSourceOptions?.selectedAudioDevice?.deviceId);r&&(this.selectedAudioDevice=r)}this.selectedAudioDevice||(this.selectedAudioDevice=this.audioDevices[0])}if(this.videoDevices.length>0&&!this.selectedVideoDevice){if(this.defaultMediaSourceOptions?.selectedVideoDevice?.deviceId){let r=this.videoDevices.find(a=>a.deviceId===this.defaultMediaSourceOptions?.selectedVideoDevice?.deviceId);r&&(this.selectedVideoDevice=r)}this.selectedVideoDevice||(this.selectedVideoDevice=this.videoDevices[0])}}).catch(i=>{this.loggingService.catch("Error in MediaSourceOptionsDialogComponent getDevices enumerateDevices catch: ",i)})}catch(e){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent getDevices: ",e)}})}selectAudioDevice(e){try{this.selectedAudioDevice=e}catch(i){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent selectAudioDevice: ",i)}}selectVideoDevice(e){try{this.selectedVideoDevice=e}catch(i){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent selectVideoDevice: ",i)}}saveChanges(){try{let e={};this.settingsVisible.audio&&(e.selectedAudioDevice=this.selectedAudioDevice),this.settingsVisible.video&&(e.selectedVideoDevice=this.selectedVideoDevice),localStorage.setItem(j.LOCAL_STORAGE.SNIPPYLY_DEFAULT_MEDIA_SOURCE_OPTIONS,JSON.stringify(e||{})),this.closeDialog(e)}catch(e){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent saveChanges: ",e)}}closeDialog(e){try{this.dialogRef.close(e)}catch(i){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent closeDialog: ",i)}}};o.\u0275fac=function(i){return new(i||o)(u(y),u(Xo),u(bl,8))},o.\u0275cmp=O({type:o,selectors:[["snippyly-media-source-options-dialog"]],hostVars:1,hostBindings:function(i,r){i&2&&x("data-velt-element",r.veltElement)},standalone:!1,decls:17,vars:10,consts:[["mediaSourceOptionsDialogRef",""],[1,"s-video-settings-modal",3,"pointerdown","pointerup","click","snippylyOverlay","snippylyOverlayZIndex"],[1,"s-video-header"],[1,"s-video-header-name"],["width","24","height","24","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg"],["d","M19.5 12C19.5 11.77 19.49 11.55 19.47 11.32L21.33 9.91C21.73 9.61 21.84 9.05 21.59 8.61L19.72 5.38C19.47 4.94 18.93 4.76 18.47 4.96L16.32 5.87C15.95 5.61 15.56 5.38 15.15 5.19L14.86 2.88C14.8 2.38 14.37 2 13.87 2H10.14C9.63 2 9.2 2.38 9.14 2.88L8.85 5.19C8.44 5.38 8.05 5.61 7.68 5.87L5.53 4.96C5.07 4.76 4.53 4.94 4.28 5.38L2.41 8.62C2.16 9.06 2.27 9.61 2.67 9.92L4.53 11.33C4.51 11.55 4.5 11.77 4.5 12C4.5 12.23 4.51 12.45 4.53 12.68L2.67 14.09C2.27 14.39 2.16 14.95 2.41 15.39L4.28 18.62C4.53 19.06 5.07 19.24 5.53 19.04L7.68 18.13C8.05 18.39 8.44 18.62 8.85 18.81L9.14 21.12C9.2 21.62 9.63 22 10.13 22H13.86C14.36 22 14.79 21.62 14.85 21.12L15.14 18.81C15.55 18.62 15.94 18.39 16.31 18.13L18.46 19.04C18.92 19.24 19.46 19.06 19.71 18.62L21.58 15.39C21.83 14.95 21.72 14.4 21.32 14.09L19.46 12.68C19.49 12.45 19.5 12.23 19.5 12ZM12.04 15.5C10.11 15.5 8.54 13.93 8.54 12C8.54 10.07 10.11 8.5 12.04 8.5C13.97 8.5 15.54 10.07 15.54 12C15.54 13.93 13.97 15.5 12.04 15.5Z","fill","white"],[1,"s-icon-button",3,"click"],["width","20","height","20","viewBox","0 0 20 20","fill","none","xmlns","http://www.w3.org/2000/svg"],["fill-rule","evenodd","clip-rule","evenodd","d","M4.41076 4.41058C4.7362 4.08514 5.26384 4.08514 5.58928 4.41058L10 8.82133L14.4108 4.41058C14.7362 4.08514 15.2638 4.08514 15.5893 4.41058C15.9147 4.73602 15.9147 5.26366 15.5893 5.58909L11.1785 9.99984L15.5893 14.4106C15.9147 14.736 15.9147 15.2637 15.5893 15.5891C15.2638 15.9145 14.7362 15.9145 14.4108 15.5891L10 11.1783L5.58928 15.5891C5.26384 15.9145 4.7362 15.9145 4.41076 15.5891C4.08533 15.2637 4.08533 14.736 4.41076 14.4106L8.82151 9.99984L4.41076 5.58909C4.08533 5.26366 4.08533 4.73602 4.41076 4.41058Z","fill","white"],["class","s-video-settings-modal-item",4,"ngIf"],[1,"s-flex-fill"],[1,"s-button","s-primary","s-save-button",3,"click"],[1,"s-video-settings-modal-item"],[1,"s-heading"],[1,"s-input","dropdown"],[1,"dropdown-content"],["class","dropdown-item",3,"selected","click",4,"ngFor","ngForOf"],["fill-rule","evenodd","clip-rule","evenodd","d","M16.2071 9.79289C15.8166 9.40237 15.1834 9.40237 14.7929 9.79289L12 12.5858L9.20711 9.79289C8.81658 9.40237 8.18342 9.40237 7.79289 9.79289C7.40237 10.1834 7.40237 10.8166 7.79289 11.2071L11.2929 14.7071C11.6834 15.0976 12.3166 15.0976 12.7071 14.7071L16.2071 11.2071C16.5976 10.8166 16.5976 10.1834 16.2071 9.79289Z","fill","#80808A"],[1,"dropdown-item",3,"click"]],template:function(i,r){if(i&1){let a=q();C(0,"div",1,0),G("pointerdown",function(m){return N(a),F(m.stopPropagation())})("pointerup",function(m){return N(a),F(m.stopPropagation())})("click",function(m){return N(a),F(m.stopPropagation())}),C(2,"div",2)(3,"div",3),le(),C(4,"svg",4),w(5,"path",5),S(),te(6),A(7,"translate"),S(),mt(),C(8,"div",6),G("click",function(){return N(a),F(r.closeDialog())}),le(),C(9,"svg",7),w(10,"path",8),S()()(),g(11,WHt,13,10,"div",9)(12,YHt,13,10,"div",9),mt(),w(13,"div",10),C(14,"div",11),G("click",function(){return N(a),F(r.saveChanges())}),te(15),A(16,"translate"),S()()}if(i&2){let a=pe(1);c("snippylyOverlay",a)("snippylyOverlayZIndex",3e3),d(6),ve(" ",P(7,6,"Settings")," "),d(5),c("ngIf",r.settingsVisible==null?null:r.settingsVisible.audio),d(),c("ngIf",r.settingsVisible==null?null:r.settingsVisible.video),d(3),je(P(16,8,"Save changes"))}},dependencies:[ht,Z,Fo,de],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}*[_ngcontent-%COMP%]{box-sizing:border-box;-webkit-tap-highlight-color:rgba(255,255,255,0)!important;outline:none!important;margin:0!important;padding:0!important;line-height:1.5!important;color:#000!important;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))}*[_ngcontent-%COMP%]:not(svg,rect,circle,ellipse,line,polyline,polygon,path,text,g,use,image,defs,hr){height:unset;width:unset}*[_ngcontent-%COMP%]:empty:not(svg,rect,circle,ellipse,line,polyline,polygon,path,text,g,use,image,defs,hr){display:revert!important}.s-video-settings-modal[_ngcontent-%COMP%], .s-video-header[_ngcontent-%COMP%], .s-video-header-name[_ngcontent-%COMP%], .s-video-settings-modal-item[_ngcontent-%COMP%], .s-input[_ngcontent-%COMP%]{display:flex!important;color:#fff!important}.s-video-settings-modal-item[_ngcontent-%COMP%]{flex-direction:column!important;align-items:flex-start!important;justify-content:flex-start!important;width:100%!important;color:#91919c!important;font-size:calc((.8rem + 0px) * var(--velt-base-rem-unit))!important;gap:calc((1rem + 0px) * var(--velt-base-rem-unit))!important}.s-video-settings-modal[_ngcontent-%COMP%]{flex-direction:column!important;align-items:flex-end!important;padding:calc((2rem + 0px) * var(--velt-base-rem-unit))!important;gap:calc((2rem + 0px) * var(--velt-base-rem-unit))!important;background:#141416!important;border-radius:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;width:calc((40rem + 0px) * var(--velt-base-rem-unit))!important;border:2px solid #303034!important}.s-video-header[_ngcontent-%COMP%]{justify-content:space-between!important;width:100%!important;align-items:center!important}.s-video-header-name[_ngcontent-%COMP%]{gap:calc((.5rem + 0px) * var(--velt-base-rem-unit))!important;font-weight:600!important;font-size:calc((1.2rem + 0px) * var(--velt-base-rem-unit))!important;display:flex!important;align-items:center!important}.s-button[_ngcontent-%COMP%]{display:flex!important;align-items:center!important;justify-content:center!important;padding:calc((1rem + 0px) * var(--velt-base-rem-unit)) calc((2rem + 0px) * var(--velt-base-rem-unit))!important;border-radius:calc((4rem + 0px) * var(--velt-base-rem-unit))!important;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;transition:.1s ease!important;cursor:pointer!important}.s-primary[_ngcontent-%COMP%]{background:#625df5!important;color:#fff!important}.s-primary[_ngcontent-%COMP%]:hover{background:#4f4bbf!important}.s-video-settings-modal-item[_ngcontent-%COMP%] .s-heading[_ngcontent-%COMP%]{font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;color:#fff!important;padding:calc((.5rem + 0px) * var(--velt-base-rem-unit)) 0!important}.s-input[_ngcontent-%COMP%]{position:relative!important;padding:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;color:#91919c!important;width:100%!important;justify-content:space-between!important;border-radius:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;border:2px solid #303034!important;align-items:center!important;cursor:pointer!important;transition:.2s ease!important}.s-input[_ngcontent-%COMP%]:hover{background:#303034!important}.dropdown[_ngcontent-%COMP%] .dropdown-content[_ngcontent-%COMP%]{position:absolute!important;top:0!important;right:0!important;z-index:1!important}.dropdown-content[_ngcontent-%COMP%]{width:100%!important;overflow:hidden!important;display:flex!important;flex-direction:column!important;justify-content:flex-start!important;align-items:flex-start!important;border-radius:calc((.9rem + 0px) * var(--velt-base-rem-unit))!important;border:2px solid #303034!important;color:#91919c!important;background:#141416!important;cursor:pointer!important;visibility:hidden!important;opacity:0!important;transition:all .1s ease!important}.dropdown[_ngcontent-%COMP%]:hover .dropdown-content[_ngcontent-%COMP%]{visibility:visible!important;opacity:1!important}.dropdown-item[_ngcontent-%COMP%]{padding:calc((1.2rem + 0px) * var(--velt-base-rem-unit)) calc((1rem + 0px) * var(--velt-base-rem-unit))!important;width:100%!important;display:flex!important;justify-content:flex-start!important;align-items:center!important;gap:calc((.5rem + 0px) * var(--velt-base-rem-unit))!important;transition:all .1s ease!important;color:#91919c!important}.dropdown-item.selected[_ngcontent-%COMP%]{color:#fff!important}.dropdown-item[_ngcontent-%COMP%]:hover{background:#303034!important;color:#fff!important}.s-icon-button[_ngcontent-%COMP%]{padding:calc((.5rem + 0px) * var(--velt-base-rem-unit))!important;display:flex!important;align-items:center!important;justify-content:center!important;border-radius:100px!important;cursor:pointer!important}.s-icon-button[_ngcontent-%COMP%] svg[_ngcontent-%COMP%] path[_ngcontent-%COMP%]{fill:#777e91!important}.s-icon-button[_ngcontent-%COMP%]:hover{background:#222226!important}.s-icon-button[_ngcontent-%COMP%]:hover svg[_ngcontent-%COMP%] path[_ngcontent-%COMP%]{fill:#fff!important}.s-flex-fill[_ngcontent-%COMP%]{flex-grow:1!important} .snippyly-media-source-options-dialog mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface{background-color:transparent!important;padding:0!important;margin:0!important;border-radius:calc((1rem + 0px) * var(--velt-base-rem-unit))!important}@media screen and (max-width: 768px){.s-video-settings-modal[_ngcontent-%COMP%]{width:calc(.8 * var(--legacy-velt-viewport-width))!important}}@media screen and (max-width: 425px){ .snippyly-media-source-options-dialog{width:calc(1 * var(--legacy-velt-viewport-width))!important;max-width:calc(1 * var(--legacy-velt-viewport-width))!important} .snippyly-media-source-options-dialog mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface{width:calc(1 * var(--legacy-velt-viewport-width))!important;height:calc(1 * var(--legacy-velt-viewport-height))!important;border-radius:calc((0rem + 0px) * var(--velt-base-rem-unit))!important} .snippyly-media-source-options-dialog mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface .s-video-settings-modal{width:calc(1 * var(--legacy-velt-viewport-width))!important;height:calc(1 * var(--legacy-velt-viewport-height))!important;border-radius:0!important} .snippyly-media-source-options-dialog mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface .s-save-button{width:100%!important}}"],changeDetection:0});let n=o;return n})();var Bfe=(()=>{let o=class o{constructor(e,i,r,a,s,m,p,h){this.authService=e,this.configService=i,this.contactService=r,this.docService=a,this.commonDbService=s,this.databaseService=m,this.loggingService=p,this.notificationService=h,this.documentUsers$=new Ce([]);try{this.databaseService.getDb().pipe(Fe(_=>!!_),tt(1)).subscribe(_=>{_&&(this.db=_,this.subscribeUsersFromDocument())}),this.authService.getUser$().subscribe(_=>{if(_?.email){this.subscribeUsersFromDocument();let E=Pt(_.email);_?.organizationId&&(E=Pt(_.userId)),this.getDocumentUserByIdFromDb(E).then(D=>{D&&(D.user.name=_.name,D.user.photoUrl=_.photoUrl,this.updateDocumentUser(D))}).catch(D=>{this.loggingService.catch("Error in DocumentUserAccessService getDocumentUserByIdFromDb:",D)})}},_=>{this.loggingService.catch("Error in DocumentUserAccessService getUser$:",_)})}catch(_){this.loggingService.catch("Error in DocService constructor:",_)}}getDocumentUserByIdFromDb(e){return Q(this,null,function*(){try{let i=this.docService.getDocumentPaths();return i?(yield this.commonDbService.dbListener({feature:"documentUser",properties:{documentId:i?.documentId,organizationId:i?.organizationId,isCollection:!1,id:e}}).pipe(tt(1)).toPromise())?.data:void 0}catch(i){this.loggingService.catch("Error in DocService getDocumentUserById:",i);return}})}subscribeUsersFromDocument(){try{this.documentUsersSubscription&&this.documentUsersSubscription.unsubscribe(),this.documentUsersSubscription=this.authService.getUser$().pipe(he(e=>e?this.docService.getDocumentPaths$().pipe(Fe(i=>!!i),he(i=>this.commonDbService.dbListener({feature:"allDocumentUsers",properties:{documentId:i?.documentId,organizationId:i?.organizationId,isCollection:!0}}).pipe(ce(r=>r?.data?Object.values(r?.data):[])))):se([]))).subscribe(e=>{this.documentUsers$.next(e)},e=>{this.loggingService.catch("Error in DocService subscribeUsersFromDocument subscription:",e)})}catch(e){this.loggingService.catch("Error in DocService subscribeUsersFromDocument:",e)}}getDocumentUsers$(){return this.documentUsers$.asObservable()}addDocumentUser(e){try{let i=this.authService.getUser();if(i){if(this.configService.getSF()){if(e?.role?.name===go.ADMIN)this.contactService.addGlobalContact(e.user);else if(e?.role?.name===go.COMMENTER){let a=i.groupId;if(a){let s=JSON.parse(JSON.stringify(e.user));s.visibility="group",this.contactService.setLoggedInUserGroupContacts(a,[s])}}}e.id=Pt(e?.user?.email),e.invitedBy=i,e.invitedDate=this.timestamp;let r=this.docService.getDocumentPaths();r&&this.commonDbService.updateData({feature:"documentUserAccess",properties:{id:e.id,documentId:r?.documentId??"",organizationId:r?.organizationId??""},data:JSON.parse(JSON.stringify(e))}),this.updateNotificationsDatabase(e)}else this.loggingService.error("Error in DocService addDocumentUser: User not found")}catch(i){this.loggingService.catch("Error in DocService addDocumentUser:",i)}}updateDocumentUser(e,i={}){try{let r=this.authService.getUser();if(r){e.updatedBy=r,e.updatedDate=this.timestamp;let a=this.docService.getDocumentPaths();this.commonDbService.updateData({feature:"documentUserAccess",properties:{id:e.id,documentId:a?.documentId??"",organizationId:a?.organizationId??""},data:JSON.parse(JSON.stringify(e))}),this.updateNotificationsDatabase(e)}}catch(r){this.loggingService.catch("Error in DocumentUserAccessService updateDocumentUser:",r)}}removeDocumentUser(e){try{let i=this.docService.getDocumentPaths();this.commonDbService.deleteData({feature:"documentUserAccess",properties:{id:e.id,documentId:i?.documentId??"",organizationId:i?.organizationId??""}})}catch(i){this.loggingService.catch("Error in DocumentUserAccessService removeDocumentUser:",i)}}updateNotificationsDatabase(e={}){try{let i=I({notificationSource:"user"},e);this.notificationService.updateNotificationDatabase(i)}catch(i){this.loggingService.catch("Error in DocumentUserAccessService updateNotificationsDatabase: ",i)}}get timestamp(){return this.commonDbService.getServerTimestamp()}};o.\u0275fac=function(i){return new(i||o)(J(He),J(jt),J(Ci),J(lt),J(Tn),J(hn),J(y),J(vn))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var ZHt=["triggerTemplate"],XHt=["tooltipTemplate"],QHt=["trigger"],JHt=["overlay"],ezt=()=>["snippyly-overlay-panel","snippyly-reaction-dialog-overlay-panel"];function tzt(n,o){n&1&&Ue(0)}function nzt(n,o){n&1&&Ue(0)}function izt(n,o){if(n&1){let t=q();C(0,"div",6,2),G("pointerenter",function(){N(t);let i=l();return F(i.showTooltip())})("pointerleave",function(){N(t);let i=l();return F(i.hideTooltip())}),g(2,nzt,1,0,"ng-container",4),S()}if(n&2){let t=pe(1),e=l();c("snippylyOverlay",t)("snippylyOverlayZIndex",2e3),x("data-velt-element",!0),d(2),c("ngTemplateOutlet",e.tooltipTemplate)}}var $m=(()=>{let o=class o{constructor(e){this.loggingService=e,this.positions=[],this.disableClose=!0,this.disabled=!1,this.componentConfigSignal=Te({disabled:!1,tooltipVisible:!1,overlayPositions:[]}),this.veltElement=!0}ngOnInit(){}ngOnChanges(e){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnChanges","color: green;");try{e&&Object.keys(e).forEach(i=>{this.componentConfigSignal.update(r=>(r=T(I({},r),{[i]:e[i].currentValue}),r))}),e.positions&&this.componentConfigSignal.update(i=>(i=T(I({},i),{overlayPositions:this.positions.map(r=>new fi({originX:r.originX,originY:r.originY},{overlayX:r.overlayX,overlayY:r.overlayY}))}),i))}catch(i){this.loggingService.catch("Error in OverlayTooltipComponent ngOnChanges: ",i)}}showTooltip(){this.loggingService.log("%c[WB] Calling FUNCTION: showTooltip","color: green;");try{this.hideTooltipTimeout&&clearTimeout(this.hideTooltipTimeout),this.componentConfigSignal.update(e=>(e=T(I({},e),{tooltipVisible:!0}),e))}catch(e){this.loggingService.catch("Error in OverlayTooltipComponent showTooltip: ",e)}}hideTooltip(){this.loggingService.log("%c[WB] Calling FUNCTION: hideTooltip","color: green;");try{this.hideTooltipTimeout&&clearTimeout(this.hideTooltipTimeout),this.hideTooltipTimeout=setTimeout(()=>{this.componentConfigSignal.update(e=>(e=T(I({},e),{tooltipVisible:!1}),e))},200)}catch(e){this.loggingService.catch("Error in OverlayTooltipComponent hideTooltip: ",e)}}ngOnDestroy(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnDestroy","color: green;");try{this.hideTooltip()}catch(e){this.loggingService.catch("Error in OverlayTooltipComponent ngOnDestroy: ",e)}}};o.\u0275fac=function(i){return new(i||o)(u(y))},o.\u0275cmp=O({type:o,selectors:[["app-overlay-tooltip"]],contentQueries:function(i,r,a){if(i&1&&(ks(a,ZHt,7),ks(a,XHt,7)),i&2){let s;Qe(s=Je())&&(r.triggerTemplate=s.first),Qe(s=Je())&&(r.tooltipTemplate=s.first)}},viewQuery:function(i,r){if(i&1&&(ot(QHt,5),ot(JHt,5)),i&2){let a;Qe(a=Je())&&(r.trigger=a.first),Qe(a=Je())&&(r.overlay=a.first)}},hostVars:1,hostBindings:function(i,r){i&2&&x("data-velt-element",r.veltElement)},inputs:{positions:"positions",disableClose:"disableClose",disabled:"disabled"},standalone:!1,features:[Xe],decls:5,vars:8,consts:[["trigger","cdkOverlayOrigin"],["overlay","cdkConnectedOverlay"],["overlayContent",""],["cdkOverlayOrigin","",3,"pointerenter","pointerleave"],[4,"ngTemplateOutlet"],["cdkConnectedOverlay","",3,"cdkConnectedOverlayOrigin","cdkConnectedOverlayPanelClass","cdkConnectedOverlayOpen","cdkConnectedOverlayPositions","cdkConnectedOverlayGrowAfterOpen","cdkConnectedOverlayDisableClose"],["data-velt-comment-disabled","true",3,"pointerenter","pointerleave","snippylyOverlay","snippylyOverlayZIndex"]],template:function(i,r){if(i&1){let a=q();C(0,"div",3,0),G("pointerenter",function(){return N(a),F(r.showTooltip())})("pointerleave",function(){return N(a),F(r.hideTooltip())}),g(2,tzt,1,0,"ng-container",4),S(),g(3,izt,3,4,"ng-template",5,1,De)}if(i&2){let a=pe(1);d(2),c("ngTemplateOutlet",r.triggerTemplate),d(),c("cdkConnectedOverlayOrigin",a)("cdkConnectedOverlayPanelClass",Nt(7,ezt))("cdkConnectedOverlayOpen",!r.componentConfigSignal().disabled&&r.componentConfigSignal().tooltipVisible)("cdkConnectedOverlayPositions",r.componentConfigSignal().overlayPositions)("cdkConnectedOverlayGrowAfterOpen",!0)("cdkConnectedOverlayDisableClose",r.disableClose)}},dependencies:[vt,Vn,An,Fo],encapsulation:2,changeDetection:0});let n=o;return n})();var ozt=["matAutocomplete"],rzt=["matAutocompleteTrigger"],azt=["autocompletePanelInput"],szt=["viewport"],lzt=n=>({componentConfigSignal:n}),czt=(n,o)=>({condition:n,data:o}),JD=n=>({$implicit:n}),HH=n=>({$implicit:n,isNewContact:!0});function mzt(n,o){if(n&1){let t=q();C(0,"input",9,2),G("keyup",function(i){return N(t),F(i.stopPropagation())})("keydown",function(i){return N(t),F(i.stopPropagation())})("keyup.escape",function(i){return N(t),l().closePanel(),F(i.stopPropagation())})("input",function(i){return N(t),l().handleInput(i),F(i.stopPropagation())}),S()}if(n&2){let t=l(),e=pe(4);c("placeholder",t.placeholder||"")("matAutocomplete",e)("matAutocompleteDisabled",!t.enableOnFocus)("matAutocompletePosition",t.position),x("aria-label",t.placeholder||"Search")("aria-autocomplete","list")("aria-controls",t.componentId+"-input")("data-testid",t.componentId+"-input")}}function dzt(n,o){n&1&&Ue(0)}function pzt(n,o){if(n&1){let t=q();C(0,"mat-option",17),G("pointerdown",function(i){return N(t),i.stopPropagation(),F(i.preventDefault())})("pointerup",function(i){let r=N(t).$implicit,a=l(3);return i.stopPropagation(),a.onOptionClick(r),F(i.preventDefault())}),g(1,dzt,1,0,"ng-container",18),S()}if(n&2){let t=o.$implicit,e=o.index,i=l(3),r=pe(7);c("disabled",t==null?null:t.disabled)("value",t),x("id","velt-option-"+e)("aria-disabled",t==null?null:t.disabled)("data-testid",i.componentId+"-"+e),d(),c("ngTemplateOutlet",r)("ngTemplateOutletContext",M(7,JD,t))}}function gzt(n,o){n&1&&Ue(0)}function uzt(n,o){if(n&1){let t=q();C(0,"mat-option",19),G("pointerdown",function(i){return N(t),i.stopPropagation(),F(i.preventDefault())})("pointerup",function(i){return N(t),i.stopPropagation(),F(i.preventDefault())}),g(1,gzt,1,0,"ng-container",18),S()}if(n&2){let t,e=l(3),i=pe(7);c("value",e.componentConfigSignal().newUserContact),x("id","velt-new-contact-option")("aria-label","New contact: "+((t=e.componentConfigSignal().newUserContact)==null||t.contact==null?null:t.contact.email))("data-testid",e.componentId+"-new-contact"),d(),c("ngTemplateOutlet",i)("ngTemplateOutletContext",M(6,HH,e.componentConfigSignal().newUserContact))}}function hzt(n,o){if(n&1&&(C(0,"cdk-virtual-scroll-viewport",14,3),g(2,pzt,2,9,"mat-option",15),A(3,"async"),g(4,uzt,2,8,"mat-option",16),S()),n&2){let t,e=l(2);d(2),c("cdkVirtualForOf",P(3,3,e.componentConfigSignal().filteredUserContacts$))("cdkVirtualForTrackBy",e.trackByUserContact),d(2),c("ngIf",(t=e.componentConfigSignal().newUserContact)==null||t.contact==null?null:t.contact.email)}}function fzt(n,o){n&1&&Ue(0)}function vzt(n,o){if(n&1){let t=q();C(0,"mat-option",17),G("pointerdown",function(i){return N(t),i.stopPropagation(),F(i.preventDefault())})("pointerup",function(i){let r=N(t).$implicit,a=l(5);return i.stopPropagation(),a.onOptionClick(r),F(i.preventDefault())}),g(1,fzt,1,0,"ng-container",18),S()}if(n&2){let t=o.$implicit,e=o.index,i=l(5),r=pe(7);c("disabled",t.disabled)("value",t),x("id","velt-option-user-"+e)("aria-disabled",t.disabled)("data-testid",i.componentId+"-user-"+e),d(),c("ngTemplateOutlet",r)("ngTemplateOutletContext",M(7,JD,t))}}function Czt(n,o){if(n&1&&(f(0),g(1,vzt,2,9,"mat-option",23),v()),n&2){let t=l(4);d(),c("ngForOf",t.componentConfigSignal().contactsWithoutGroup)("ngForTrackBy",t.trackByUserContact)}}function _zt(n,o){if(n&1){let t=q();C(0,"mat-option",26),G("pointerdown",function(i){return N(t),i.stopPropagation(),F(i.preventDefault())})("pointerup",function(i){return N(t),i.stopPropagation(),F(i.preventDefault())}),w(1,"velt-autocomplete-group-option-internal",27),S()}if(n&2){let t=l(),e=t.$implicit,i=t.index,r=l(4);c("disabled",!0)("value",null),x("id","velt-option-group-"+i)("data-testid",r.componentId+"-group-"+i),d(),c("componentConfigSignal",r.componentConfigSignal)("group",e)}}function yzt(n,o){n&1&&Ue(0)}function Szt(n,o){if(n&1){let t=q();C(0,"mat-option",28),G("pointerdown",function(i){return N(t),i.stopPropagation(),F(i.preventDefault())})("pointerup",function(i){let r=N(t).$implicit,a=l(5);return i.stopPropagation(),a.onOptionClick(r),F(i.preventDefault())}),C(1,"div",29),g(2,yzt,1,0,"ng-container",18),S()()}if(n&2){let t=o.$implicit,e=o.index,i=l().index,r=l(4),a=pe(7);c("disabled",t.disabled)("value",t),x("id","velt-option-group-"+i+"-member-"+e)("aria-disabled",t.disabled)("data-testid",r.componentId+"-group-"+i+"-member-"+e),d(2),c("ngTemplateOutlet",a)("ngTemplateOutletContext",M(7,JD,t))}}function bzt(n,o){if(n&1&&(f(0),g(1,_zt,2,6,"mat-option",24)(2,Szt,3,9,"mat-option",25),v()),n&2){let t=o.$implicit;d(),c("ngIf",t==null||t.members==null?null:t.members.length),d(),c("ngForOf",t.members)}}function Izt(n,o){if(n&1){let t=q();C(0,"mat-option",31),G("pointerdown",function(i){return N(t),i.stopPropagation(),F(i.preventDefault())})("pointerup",function(i){return N(t),i.stopPropagation(),F(i.preventDefault())}),w(1,"velt-autocomplete-group-option-internal",32),S()}if(n&2){let t=l(5);c("disabled",!0)("value",null),x("id","velt-option-ungrouped")("data-testid",t.componentId+"-ungrouped"),d(),c("componentConfigSignal",t.componentConfigSignal)("groupName","Ungrouped")}}function Ezt(n,o){n&1&&Ue(0)}function xzt(n,o){if(n&1){let t=q();C(0,"mat-option",17),G("pointerdown",function(i){return N(t),i.stopPropagation(),F(i.preventDefault())})("pointerup",function(i){let r=N(t).$implicit,a=l(5);return i.stopPropagation(),a.onOptionClick(r),F(i.preventDefault())}),g(1,Ezt,1,0,"ng-container",18),S()}if(n&2){let t=o.$implicit,e=o.index,i=l(5),r=pe(7);c("disabled",t.disabled)("value",t),x("id","velt-option-user-"+e)("aria-disabled",t.disabled)("data-testid",i.componentId+"-user-"+e),d(),c("ngTemplateOutlet",r)("ngTemplateOutletContext",M(7,JD,t))}}function Tzt(n,o){if(n&1&&(f(0),g(1,Izt,2,6,"mat-option",30)(2,xzt,2,9,"mat-option",23),v()),n&2){let t,e,i=l(4);d(),c("ngIf",(t=i.componentConfigSignal())==null||t.contactsWithoutGroup==null?null:t.contactsWithoutGroup.length),d(),c("ngForOf",(e=i.componentConfigSignal())==null?null:e.contactsWithoutGroup)("ngForTrackBy",i.trackByUserContact)}}function Dzt(n,o){if(n&1&&(f(0),g(1,Czt,2,2,"ng-container",21)(2,bzt,3,2,"ng-container",22)(3,Tzt,3,3,"ng-container",21),v()),n&2){let t=l(3);d(),c("ngIf",!t.componentConfigSignal().showMentionGroupsOnly&&!t.componentConfigSignal().showMentionGroupsFirst),d(),c("ngForOf",t.componentConfigSignal().groups),d(),c("ngIf",!t.componentConfigSignal().showMentionGroupsOnly&&t.componentConfigSignal().showMentionGroupsFirst)}}function wzt(n,o){n&1&&Ue(0)}function Ozt(n,o){if(n&1){let t=q();C(0,"mat-option",19),G("pointerdown",function(i){return N(t),i.stopPropagation(),F(i.preventDefault())})("pointerup",function(i){return N(t),i.stopPropagation(),F(i.preventDefault())}),g(1,wzt,1,0,"ng-container",18),S()}if(n&2){let t,e=l(3),i=pe(7);c("value",e.componentConfigSignal().newUserContact),x("id","velt-new-contact-option")("aria-label","New contact: "+((t=e.componentConfigSignal().newUserContact)==null||t.contact==null?null:t.contact.email))("data-testid",e.componentId+"-new-contact"),d(),c("ngTemplateOutlet",i)("ngTemplateOutletContext",M(6,HH,e.componentConfigSignal().newUserContact))}}function Azt(n,o){if(n&1&&(C(0,"div",20),g(1,Dzt,4,3,"ng-container",21),A(2,"async"),g(3,Ozt,2,8,"mat-option",16),S()),n&2){let t,e=l(2);d(),c("ngIf",P(2,2,e.componentConfigSignal().filteredUserContacts$)),d(2),c("ngIf",(t=e.componentConfigSignal().newUserContact)==null||t.contact==null?null:t.contact.email)}}function Pzt(n,o){n&1&&Ue(0)}function Mzt(n,o){if(n&1){let t=q();C(0,"mat-option",17),G("pointerdown",function(i){return N(t),i.stopPropagation(),F(i.preventDefault())})("pointerup",function(i){let r=N(t).$implicit,a=l(3);return i.stopPropagation(),a.onOptionClick(r),F(i.preventDefault())}),g(1,Pzt,1,0,"ng-container",18),S()}if(n&2){let t=o.$implicit,e=o.index,i=l(3),r=pe(7);c("disabled",t==null?null:t.disabled)("value",t),x("id","velt-option-"+e)("aria-disabled",t==null?null:t.disabled)("data-testid",i.componentId+"-"+e),d(),c("ngTemplateOutlet",r)("ngTemplateOutletContext",M(7,JD,t))}}function kzt(n,o){n&1&&Ue(0)}function Rzt(n,o){if(n&1){let t=q();C(0,"mat-option",19),G("pointerdown",function(i){return N(t),i.stopPropagation(),F(i.preventDefault())})("pointerup",function(i){return N(t),i.stopPropagation(),F(i.preventDefault())}),g(1,kzt,1,0,"ng-container",18),S()}if(n&2){let t,e=l(3),i=pe(7);c("value",e.componentConfigSignal().newUserContact),x("id","velt-new-contact-option")("aria-label","New contact: "+((t=e.componentConfigSignal().newUserContact)==null||t.contact==null?null:t.contact.email))("data-testid",e.componentId+"-new-contact"),d(),c("ngTemplateOutlet",i)("ngTemplateOutletContext",M(6,HH,e.componentConfigSignal().newUserContact))}}function Nzt(n,o){if(n&1&&(C(0,"div",33),g(1,Mzt,2,9,"mat-option",23),A(2,"async"),g(3,Rzt,2,8,"mat-option",16),S()),n&2){let t,e=l(2);d(),c("ngForOf",P(2,3,e.componentConfigSignal().filteredUserContacts$))("ngForTrackBy",e.trackByUserContact),d(2),c("ngIf",(t=e.componentConfigSignal().newUserContact)==null||t.contact==null?null:t.contact.email)}}function Fzt(n,o){if(n&1&&(C(0,"div",10),g(1,hzt,5,5,"cdk-virtual-scroll-viewport",11),A(2,"async"),g(3,Azt,4,4,"div",12)(4,Nzt,4,5,"div",13),A(5,"async"),S()),n&2){let t,e,i=l();ge("s-comment-autocomplete-panel-dark",i.darkMode),x("data-testid",i.componentId+"-options-container"),d(),c("ngIf",(!i.componentConfigSignal().expandMentionGroups||(i.selectedAutocompleteData==null?null:i.selectedAutocompleteData.type)!=="contact")&&(((t=P(2,6,i.componentConfigSignal().filteredUserContacts$))==null?null:t.length)||0)>6),d(2),c("ngIf",i.componentConfigSignal().expandMentionGroups&&(i.selectedAutocompleteData==null?null:i.selectedAutocompleteData.type)==="contact"),d(),c("ngIf",(!i.componentConfigSignal().expandMentionGroups||(i.selectedAutocompleteData==null?null:i.selectedAutocompleteData.type)!=="contact")&&(((e=P(5,8,i.componentConfigSignal().filteredUserContacts$))==null?null:e.length)||0)<=6)}}function Lzt(n,o){if(n&1&&w(0,"velt-autocomplete-option-internal",34),n&2){let t=o.$implicit,e=o.isNewContact,i=l();c("componentConfigSignal",i.componentConfigSignal)("selectorItem",t)("isNewContact",e)}}var dg=(()=>{let o=class o extends nt{get trigger(){return this._trigger}set trigger(e){this._trigger=e,this.setTriggerToMatAutocomplete(),this.trigger&&(this.trigger.autocompleteDisabled=!this.enableOnFocus,this.trigger._handleInput=this.handleInput.bind(this))}get triggerElement(){return this._triggerElement}set triggerElement(e){if(this._triggerElement=e,this.triggerElement){let i=new k(this.triggerElement);this.trigger=new Cb(i,this.overlay,this.viewContainerRef,{run:r=>r(),runOutsideAngular:r=>r()},this.cd,null,this.directionality,null,document,this.viewportRuler)}}get enableOnFocus(){return this._enableOnFocus}set enableOnFocus(e){this._enableOnFocus=e,this.trigger&&(this.trigger.autocompleteDisabled=!this.enableOnFocus)}get excludeContacts(){return this._excludeContacts}set excludeContacts(e){this._excludeContacts=e,this.filterOptions()}constructor(e,i,r,a,s,m,p,h,_,E,D,L,H,K,oe){super(s,D,void 0,void 0,void 0,L,a),this.authService=e,this.autocompleteService=i,this.contactService=r,this.loggingService=a,this.elementRef=s,this.overlay=m,this.viewContainerRef=p,this.cd=h,this.directionality=_,this.viewportRuler=E,this.themeService=D,this.dynamicDataService=L,this.commentActionsService=H,this.commentService=K,this.metadataService=oe,this.type="contact",this._enableOnFocus=!1,this.position="auto",this._excludeContacts=[],this.showAtHere=!1,this.optionSelected=new Ae,this.atHereSelected=new Ae,this.userContactOptionSelected=new Ae,this.customOptionSelected=new Ae,this.groupOptionSelected=new Ae,this.enterPressed=new Ae,this.userContacts=[],this.user=null,this.inputFilterFormControl=new Vne,this.oldText="",this.newText="",this.wordIndex=-1,this.deviceInfo=new ei,this.userDocumentContacts=[],this.organizationGroups=[],this.subscriptions=[],this.veltId=Pn(),this.veltElement=!0,this.componentConfigSignal=Te({filteredUserContacts$:se([]),trackByUserContact:this.trackByUserContact.bind(this),onOptionClick:this.onOptionClick.bind(this),newUserContactError:void 0,newUserContact:void 0,customAutocompleteSearch:!1,expandMentionGroups:!1,showMentionGroupsFirst:!1,showMentionGroupsOnly:!1}),this.hereUserContact={name:"here",email:"",userId:"here",visibility:"here"},this.atHereDescription=null,this.dataList=[],this.autocompleteDataMap={},this.atHereEnabled=!1,this.componentId="velt-autocomplete-panel",this.MAX_VISIBLE_ITEMS=10,this.ITEM_SIZE=55;try{this.subscriptions.push(this.commentService.getCustomAutocompleteSearch$().subscribe(ue=>{this.componentConfigSignal.update(be=>(be=T(I({},be),{customAutocompleteSearch:ue}),be))})),this.subscriptions.push(this.authService.getUser$().subscribe(ue=>{this.user=ue,this.filterOptions()})),this.subscriptions.push(this.autocompleteService.getAutocompleteDataMap$().subscribe(ue=>{this.autocompleteDataMap=ue,this.filterOptions()})),this.subscriptions.push(this.inputFilterFormControl.valueChanges.pipe(rr(150),qt()).subscribe(()=>{this.filterOptions()}))}catch(ue){this.loggingService.catch("Error in AutocompletePanelComponent ngOnInit:",ue)}}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes(),this.type==="contact"?this.selectedAutocompleteData={hotkey:"",type:"contact",data:[]}:this.selectedAutocompleteData=void 0,this.subscriptions.push(this.contactService.getAtHereLabel().subscribe(e=>{this.hereUserContact.name=e})),this.subscriptions.push(this.contactService.getAtHereDescription().subscribe(e=>{this.atHereDescription=e})),this.subscriptions.push(this.contactService.getUserContacts$(this.metadata).subscribe(e=>{this.userContacts=e?.slice(),this.atHereEnabled&&(this.userContacts?.find(i=>i?.visibility=="here")||this.userContacts.unshift(this.hereUserContact)),this.filterOptions()})),this.subscriptions.push(this.contactService.getAtHereEnabled$().subscribe(e=>{this.atHereEnabled=e,e?this.userContacts?.find(i=>i?.visibility=="here")||this.userContacts.unshift(this.hereUserContact):this.userContacts=this.userContacts.filter(i=>i?.visibility!=="here"),this.filterOptions()})),this.subscriptions.push(this.contactService.getOrganizationGroups$().subscribe(e=>{this.organizationGroups=e,this.filterOptions()})),this.subscriptions.push(this.commentService.getExpandMentionGroups$().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{expandMentionGroups:e}),i))})),this.subscriptions.push(this.commentService.getShowMentionGroupsFirst$().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{showMentionGroupsFirst:e}),i))})),this.subscriptions.push(this.commentService.getShowMentionGroupsOnly$().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{showMentionGroupsOnly:e}),i))})),this.subscriptions.push(this.contactService.getUserDocumentContacts$().subscribe(e=>{this.userDocumentContacts=e,this.filterOptions()}))}catch(e){this.loggingService.catch("Error in AutocompletePanelComponent ngOnInit: ",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("role","listbox"),e.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in AutocompletePanelComponent setupA11yAttributes:",e)}}ngAfterViewInit(){try{this.setTriggerToMatAutocomplete(),requestAnimationFrame(()=>{if(this.autocompletePanelInput?.nativeElement){this.autocompletePanelInput.nativeElement.focus();let e=this.getViewport();if(e){let i=this.ITEM_SIZE*this.MAX_VISIBLE_ITEMS;e.style.height=`${i}px`,e.style.maxHeight=`${i}px`}this.openPanelOptimized()}this.triggerElement?this.subscriptions.push(ri(this.triggerElement,"blur").subscribe(()=>{requestAnimationFrame(()=>this.closePanel())})):this.autocompletePanelInput&&this.subscriptions.push(ri(this.autocompletePanelInput.nativeElement,"blur").subscribe(()=>{requestAnimationFrame(()=>this.closePanel())}))})}catch(e){this.loggingService.catch("Error in ngAfterViewInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy(),this.subscriptions.forEach(e=>e.unsubscribe())}catch(e){this.loggingService.catch("Error in AutocompletePanelComponent ngOnDestroy:",e)}}filterOptions(){try{if(this.selectedAutocompleteData)if(this.selectedAutocompleteData.type==="contact"){let e=this.inputFilterFormControl.value,i=new Wp,r=e?.toLowerCase()?.trim();i.email=r;let a=new RegExp(j.REGEX_EMAIL).test("@"+i?.email),s=this.userContacts.slice();this.componentConfigSignal().customAutocompleteSearch||(e?s=this._filter(i):s=this.userContacts.slice()),this.atHereEnabled&&this.hereUserContact?.name?.includes(r)&&!s?.find(D=>D?.userId=="here")&&(s=[this.hereUserContact,...s]),s=s.filter(D=>!this.excludeContacts?.find(L=>L?.email===D?.email));let m=e?this._filterGroup(e):this.organizationGroups,p=s.map(D=>{let L=!1;return D.visibility==="here"&&(this.atHereDescription?(D.email=`${this.atHereDescription}`,D.description=this.atHereDescription):this.user?.organizationId&&(D.email=`${this.userDocumentContacts?.length||0} members`,D.description=`${this.userDocumentContacts?.length||0} members`)),{type:"contact",contact:D,disabled:L}}),h=m.map(D=>({type:"group",group:D})),_=[...p,...h];if(this.componentConfigSignal().expandMentionGroups){let D=[],L={},H=new Map;_.forEach(ue=>{if(ue.contact?.userId){let be=Pt(ue.contact?.userId);H.set(be,ue),L[ue.contact?.userId]=!1}});let K=new Map;this.organizationGroups.forEach(ue=>{K.set(ue.metadata.clientGroupId,{id:ue.metadata.clientGroupId,name:ue.metadata.groupName,members:[],userIds:Object.keys(ue.users||{})})}),K.forEach(ue=>{ue.userIds.forEach(be=>{let Le=H.get(be);Le&&(ue.members.push(Le),Le.contact?.userId&&(L[Le.contact.userId]=!0))})}),_.forEach(ue=>{ue.type==="contact"&&ue.contact?.userId&&!L[ue.contact?.userId]&&D.push(ue)});let oe=Array.from(K.values());this.componentConfigSignal.update(ue=>T(I({},ue),{filteredUserContacts$:se(_),newUserContactError:a?void 0:"Invalid email",newUserContact:_.length?void 0:{type:"contact",contact:i},contactsWithoutGroup:D,groups:oe}))}else this.componentConfigSignal.update(D=>T(I({},D),{filteredUserContacts$:se(_),newUserContactError:a?void 0:"Invalid email",newUserContact:_.length?void 0:{type:"contact",contact:i}}));let E=this.getViewport();if(E){let D=this.ITEM_SIZE*this.MAX_VISIBLE_ITEMS;E.style.height=`${D}px`,E.style.maxHeight=`${D}px`}this.openPanelOptimized(),this.cd.markForCheck()}else{let e=this.inputFilterFormControl.value,i=this.autocompleteDataMap?.[this.selectedAutocompleteData?.hotkey]?.data?.slice()||[];this.componentConfigSignal().customAutocompleteSearch||(e?i=this._filterCustom(e):i=this.selectedAutocompleteData?.data?.slice()||[]);let r=i.map(s=>({type:"custom",custom:s}));this.componentConfigSignal.update(s=>T(I({},s),{filteredUserContacts$:se(r)}));let a=this.getViewport();if(a){let s=this.ITEM_SIZE*this.MAX_VISIBLE_ITEMS;a.style.height=`${s}px`,a.style.maxHeight=`${s}px`}this.openPanelOptimized(),this.cd.markForCheck()}}catch(e){this.loggingService.catch("Error in AutocompletePanelComponent filterOptions: ",e)}}displayFn(e){try{return e?.name||e?.email||""}catch(i){return this.loggingService.catch("Error in AutocompletePanelComponent displayFn: ",i),""}}trackByUserContact(e,i){try{return i.type==="contact"?i.contact?.userId||i.contact?.email||e.toString():i.group?.metadata?.groupId||e.toString()}catch(r){return this.loggingService.catch("Error in AutocompletePanelComponent trackByUserContact: ",r),""}}setTriggerToMatAutocomplete(){try{this.matAutocomplete&&this.trigger&&(this.trigger.autocomplete=this.matAutocomplete)}catch(e){this.loggingService.catch("Error in AutocompletePanelComponent setTriggerToMatAutocomplete: ",e)}}handleInput(e){try{if(e?.target?.hasAttribute("contenteditable")){let i="";if(["safari","firefox"].includes(this.deviceInfo?.browserName?.toLowerCase()))e?.data===" "&&this.closePanel(),!this.trigger?.panelOpen&&!this.autocompleteDataMap[e?.data||""]&&(this.oldText=e.target.innerText),this.newText=e.target.innerText,i=this.getWordAtCursorForSafari();else{let r=this.autocompleteDataMap?Object.keys(this.autocompleteDataMap):["@"];i=DU(e?.target,r)}if(e?.target?.innerHTML.length===1&&(this.selectedAutocompleteData=void 0),i){let r=i.charAt(0);if((!this.selectedAutocompleteData||this.autocompleteDataMap[r])&&(this.selectedAutocompleteData=this.autocompleteDataMap[r]),this.selectedAutocompleteData){this.trigger?.panelOpen||(this.openPanelOptimized(),this.filterOptions());let a=i.substring(1);this.inputFilterFormControl.setValue(a);let s=!1;if(this.componentConfigSignal().customAutocompleteSearch&&(this.trigger?.panelOpen?r===this.selectedAutocompleteData.hotkey&&(s=!0):s=!0,s)){let m={event:e,searchText:a,type:this.selectedAutocompleteData?.type};this.commentActionsService.autocompleteSearch(m)}}else this.inputFilterFormControl.setValue(i)}else this.inputFilterFormControl.setValue(""),this.trigger?.panelOpen&&(this.trigger.closePanel(),this.selectedAutocompleteData=void 0)}else{let i=e?.target?.value;if(this.inputFilterFormControl.setValue(i),!this.matAutocompleteTrigger?.panelOpen&&(this.openPanelOptimized(),this.componentConfigSignal().customAutocompleteSearch)){let r={event:e,searchText:i,type:this.selectedAutocompleteData?.type};this.commentActionsService.autocompleteSearch(r)}}e.stopPropagation()}catch(i){this.loggingService.catch("Error in AutocompletePanelComponent handleInput: ",i)}}getWordAtCursorForSafari(){try{let e=this.oldText?.split(/\s+/)?.filter(a=>a),i=this.newText?.split(/\s+/)?.filter(a=>a);this.wordIndex=-1;let r="";return i?.forEach((a,s)=>{e[s]!==a&&(r=a,this.wordIndex=s)}),r}catch(e){return this.loggingService.catch("Error in AutocompletePanelComponent getWordAtCursorForSafari: ",e),""}}onOptionSelected(e){try{if(this.enterPressed.emit(),this.selectedAutocompleteData)if(e.option.value?.type==="group"){let i=e.option.value.group;this.autocompletePanelInput?.nativeElement&&(this.autocompletePanelInput.nativeElement.value=""),this.inputFilterFormControl.setValue(null);let r=this.trigger?this.trigger._element?.nativeElement:null,a=this.replaceWordAtCursor(r,i?.metadata?.groupName);a&&this.groupOptionSelected.emit({text:a,groupId:i?.metadata?.groupId,clientGroupId:i?.metadata?.clientGroupId})}else if(this.selectedAutocompleteData.type==="contact"){let i=e.option.value.contact;if(i?.visibility=="here"){this.autocompletePanelInput?.nativeElement&&(this.autocompletePanelInput.nativeElement.value=""),this.inputFilterFormControl.setValue(null);let r=this.trigger?this.trigger._element?.nativeElement:null;this.replaceWordAtCursor(r,i?.name),this.atHereSelected.emit(i)}else if(!i?.email||new RegExp(j.REGEX_EMAIL).test("@"+i?.email)){this.addContact(),this.autocompletePanelInput?.nativeElement&&(this.autocompletePanelInput.nativeElement.value=""),this.inputFilterFormControl.setValue(null);let a=this.trigger?this.trigger._element?.nativeElement:null,s=i?.name||i?.email,m=this.replaceWordAtCursor(a,s);this.optionSelected.emit(i),this.userContactOptionSelected.emit({text:m,userId:i.userId,contact:i}),this.callbackOnOptionSelected(i)}}else{let i=e.option.value.custom;this.autocompletePanelInput?.nativeElement&&(this.autocompletePanelInput.nativeElement.value=""),this.inputFilterFormControl.setValue(null);let r=this.trigger?this.trigger._element?.nativeElement:null,a=this.replaceWordAtCursor(r,i.name);a&&this.customOptionSelected.emit({text:a,custom:i})}this.closePanel()}catch(i){this.loggingService.catch("Error in AutocompletePanelComponent onOptionSelected: ",i)}}onOptionClick(e){try{if(this.selectedAutocompleteData)if(this.selectedAutocompleteData.type==="custom"){let i=e.custom;if(i){this.autocompletePanelInput?.nativeElement&&(this.autocompletePanelInput.nativeElement.value=""),this.inputFilterFormControl.setValue(null);let r=this.trigger?this.trigger._element?.nativeElement:null,a=this.replaceWordAtCursor(r,i.name);a&&this.customOptionSelected.emit({text:a,custom:i}),this.closePanel()}}else if(e?.type==="group"){let i=e.group;if(i){this.autocompletePanelInput?.nativeElement&&(this.autocompletePanelInput.nativeElement.value=""),this.inputFilterFormControl.setValue(null);let r=this.trigger?this.trigger._element?.nativeElement:null,a=this.replaceWordAtCursor(r,i?.metadata?.groupName);a&&this.groupOptionSelected.emit({text:a,groupId:i?.metadata?.groupId,clientGroupId:i?.metadata?.clientGroupId}),this.closePanel()}}else{let i=e.contact;if(i)if(i?.visibility==="here"){this.autocompletePanelInput?.nativeElement&&(this.autocompletePanelInput.nativeElement.value=""),this.inputFilterFormControl.setValue(null);let r=this.trigger?this.trigger._element?.nativeElement:null;this.replaceWordAtCursor(r,i.name),this.atHereSelected.emit(i),this.closePanel()}else{if(!i?.email||new RegExp(j.REGEX_EMAIL).test("@"+i?.email)){this.addContact(),this.autocompletePanelInput?.nativeElement&&(this.autocompletePanelInput.nativeElement.value=""),this.inputFilterFormControl.setValue(null);let a=this.trigger?this.trigger._element?.nativeElement:null,s=i?.name||i?.email,m=this.replaceWordAtCursor(a,s);this.optionSelected.emit(i),this.userContactOptionSelected.emit({text:m,userId:i.userId,contact:i}),this.callbackOnOptionSelected(i)}this.closePanel()}}}catch(i){this.loggingService.catch("Error in AutocompletePanelComponent onOptionClick: ",i)}}addContact(){try{this.componentConfigSignal().newUserContact?.contact&&(this.contactService.addUserContact(this.componentConfigSignal().newUserContact?.contact),this.componentConfigSignal.update(e=>(e=T(I({},e),{newUserContact:void 0}),e)))}catch(e){this.loggingService.catch("Error in AutocompletePanelComponent addContact: ",e)}}replaceWordAtCursor(e,i){try{let r="";if(e){let a=s=>{let m=s.charAt(0);return this.selectedAutocompleteData?.hotkey===m?m:""};if(["safari","firefox"].includes(this.deviceInfo?.browserName?.toLowerCase())){let s=this.newText?.split(/\s+/)?.filter(_=>_),m=s[this.wordIndex];r=(a(m||"")||"")+i,s[this.wordIndex]=r;let h=s.join(" ");e.innerText=h}else{let s=this.autocompleteDataMap?Object.keys(this.autocompleteDataMap):["@"],m=DU(e,s);r=(a(m||"")||"")+i,Qoe(e,r,s)}}return r}catch(r){return this.loggingService.catch("Error in AutocompletePanelComponent replaceWordAtCursor: ",r),""}}_filter(e){try{let i=e.email?.toLowerCase();return this.userContacts?.filter(r=>r?.email?.includes(i)||r?.name?.toLowerCase()?.includes(i)||r?.organizationName?.toLowerCase()?.includes(i))}catch(i){return this.loggingService.catch("Error in AutocompletePanelComponent _filter: ",i),[]}}_filterCustom(e){try{return this.selectedAutocompleteData?.data?.filter(i=>i.name?.toLowerCase()?.includes(e?.toLowerCase()))||[]}catch(i){return this.loggingService.catch("Error in AutocompletePanelComponent _filterCustom: ",i),[]}}_filterGroup(e){try{return this.organizationGroups?.filter(i=>i?.metadata?.groupName?.toLowerCase()?.includes(e?.toLowerCase()))}catch(i){return this.loggingService.catch("Error in AutocompletePanelComponent _filterGroup: ",i),[]}}setAutocompletePosition(){try{this.matAutocompleteTrigger&&(this.matAutocompleteTrigger.position=this.position)}catch(e){this.loggingService.catch("Error in AutocompletePanelComponent setAutocompletePosition: ",e)}}callbackOnOptionSelected(e){try{this.contactService.onContactSelected(e)}catch(i){this.loggingService.catch("Error in AutocompletePanelComponent callbackOnOptionSelected: ",i)}}getViewport(){try{return this.matAutocompleteTrigger?._overlayRef?.overlayElement?.querySelector("cdk-virtual-scroll-viewport")||null}catch(e){return this.loggingService.catch("Error in AutocompletePanelComponent getViewport: ",e),null}}openPanelOptimized(){try{this.trigger?requestAnimationFrame(()=>{this.trigger?.openPanel(),this.trigger?.updatePosition()}):this.matAutocompleteTrigger&&(this.matAutocompleteTrigger?.panelOpen||requestAnimationFrame(()=>{this.matAutocompleteTrigger?.openPanel(),this.matAutocompleteTrigger?.updatePosition()})),setTimeout(()=>{this.viewport?.scrollToIndex(1),this.viewport?.scrollToIndex(0)},50)}catch(e){this.loggingService.catch("Error in AutocompletePanelComponent openPanelOptimized: ",e)}}closePanel(){try{this.trigger?(this.trigger.closePanel(),this.inputFilterFormControl.setValue("")):this.matAutocompleteTrigger&&this.matAutocompleteTrigger.closePanel(),this.type!=="contact"&&(this.selectedAutocompleteData=void 0)}catch(e){this.loggingService.catch("Error in AutocompletePanelComponent closePanel: ",e)}}};o.\u0275fac=function(i){return new(i||o)(u(He),u(el),u(Ci),u(y),u(k),u(Bi),u(Si),u(Kt),u(Vr),u(Bs),u(Ye),u(b),u(ii),u(we),u(Mm))},o.\u0275cmp=O({type:o,selectors:[["velt-autocomplete-panel-internal"]],viewQuery:function(i,r){if(i&1&&(ot(ozt,5),ot(rzt,5),ot(azt,5),ot(szt,5)),i&2){let a;Qe(a=Je())&&(r.matAutocomplete=a.first),Qe(a=Je())&&(r.matAutocompleteTrigger=a.first),Qe(a=Je())&&(r.autocompletePanelInput=a.first),Qe(a=Je())&&(r.viewport=a.first)}},hostVars:2,hostBindings:function(i,r){i&2&&x("data-velt-id",r.veltId)("data-velt-element",r.veltElement)},inputs:{type:"type",trigger:[0,"autocompletePanelTrigger","trigger"],triggerElement:[0,"autocompletePanelTriggerElement","triggerElement"],hideInput:"hideInput",placeholder:"placeholder",metadata:"metadata",enableOnFocus:"enableOnFocus",position:[0,"autocompletePanelPosition","position"],excludeContacts:"excludeContacts",showAtHere:"showAtHere"},outputs:{optionSelected:"optionSelected",atHereSelected:"atHereSelected",userContactOptionSelected:"userContactOptionSelected",customOptionSelected:"customOptionSelected",groupOptionSelected:"groupOptionSelected",enterPressed:"enterPressed"},standalone:!1,features:[U([b]),B],decls:8,vars:17,consts:[["matAutocomplete","matAutocomplete"],["userContactRef",""],["autocompletePanelInput","","matAutocompleteTrigger","matAutocompleteTrigger"],["viewport",""],["role","combobox",1,"velt-autocomplete-panel"],[1,"velt-autocomplete-panel--input"],["type","text","autofocus","","autofocus","",3,"placeholder","matAutocomplete","matAutocompleteDisabled","matAutocompletePosition","keyup","keydown","keyup.escape","input",4,"ngIf"],["role","listbox",1,"velt-autocomplete-panel--autocomplete",3,"optionSelected","autoActiveFirstOption","hideSingleSelectionIndicator","snippylyOverlay","snippylyOverlayZIndex","displayWith"],["class","velt-autocomplete-panel--container",3,"s-comment-autocomplete-panel-dark",4,"veltIf"],["type","text","autofocus","","autofocus","",3,"keyup","keydown","keyup.escape","input","placeholder","matAutocomplete","matAutocompleteDisabled","matAutocompletePosition"],[1,"velt-autocomplete-panel--container"],["itemSize","55","minBufferPx","350","maxBufferPx","600","templateCacheSize","350","class","velt-autocomplete-panel--viewport",4,"ngIf"],["class","velt-autocomplete-panel--expanded-groups",4,"ngIf"],["class","velt-autocomplete-panel--normal-viewport",4,"ngIf"],["itemSize","55","minBufferPx","350","maxBufferPx","600","templateCacheSize","350",1,"velt-autocomplete-panel--viewport"],[3,"disabled","value","pointerdown","pointerup",4,"cdkVirtualFor","cdkVirtualForOf","cdkVirtualForTrackBy"],[3,"value","pointerdown","pointerup",4,"ngIf"],[3,"pointerdown","pointerup","disabled","value"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[3,"pointerdown","pointerup","value"],[1,"velt-autocomplete-panel--expanded-groups"],[4,"ngIf"],[4,"ngFor","ngForOf"],[3,"disabled","value","pointerdown","pointerup",4,"ngFor","ngForOf","ngForTrackBy"],["class","velt-group-option",3,"disabled","value","pointerdown","pointerup",4,"ngIf"],["class","velt-group-member-option",3,"disabled","value","pointerdown","pointerup",4,"ngFor","ngForOf"],[1,"velt-group-option",3,"pointerdown","pointerup","disabled","value"],[3,"componentConfigSignal","group"],[1,"velt-group-member-option",3,"pointerdown","pointerup","disabled","value"],[1,"velt-group-member"],["class","velt-group-header-ungrouped",3,"disabled","value","pointerdown","pointerup",4,"ngIf"],[1,"velt-group-header-ungrouped",3,"pointerdown","pointerup","disabled","value"],[3,"componentConfigSignal","groupName"],[1,"velt-autocomplete-panel--normal-viewport"],[3,"componentConfigSignal","selectorItem","isNewContact"]],template:function(i,r){if(i&1){let a=q();C(0,"div",4)(1,"div",5),g(2,mzt,3,8,"input",6),S()(),C(3,"mat-autocomplete",7,0),G("optionSelected",function(m){return N(a),F(r.onOptionSelected(m))}),g(5,Fzt,6,10,"div",8),S(),g(6,Lzt,1,3,"ng-template",null,1,De)}if(i&2){let a=pe(4);x("data-testid",r.componentId)("aria-expanded",r.trigger==null?null:r.trigger.panelOpen)("aria-haspopup",!0)("aria-controls",r.componentId),d(),x("data-testid",r.componentId+"-input-container"),d(),c("ngIf",!r.hideInput),d(),c("autoActiveFirstOption",!0)("hideSingleSelectionIndicator",!0)("snippylyOverlay",a)("snippylyOverlayZIndex",2147483627)("displayWith",r.displayFn),d(2),c("veltIf",R(14,czt,r.conditionSignal(),M(12,lzt,r.componentConfigSignal)))}},dependencies:[ht,Z,vt,sN,U1,gf,cS,c6,mS,Fo,p0,WC,ae,BR],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}[_nghost-%COMP%], .velt-autocomplete-panel--autocomplete{--velt-green: var(--velt-light-mode-green);--velt-magenta: var(--velt-light-mode-magenta);--velt-amber: var(--velt-light-mode-amber);--velt-purple: var(--velt-light-mode-purple);--velt-cyan: var(--velt-light-mode-cyan);--velt-orange: var(--velt-light-mode-orange);--velt-black: var(--velt-light-mode-black);--velt-white: var(--velt-light-mode-white);--velt-gray: var(--velt-light-mode-gray);--velt-error: var(--velt-light-mode-error);--velt-error-hover: var(--velt-light-mode-error-hover);--velt-error-foreground: var(--velt-light-mode-error-foreground);--velt-error-light: var(--velt-light-mode-error-light);--velt-error-transparent: var(--velt-light-mode-error-transparent);--velt-warning: var(--velt-light-mode-warning);--velt-warning-hover: var(--velt-light-mode-warning-hover);--velt-warning-foreground: var(--velt-light-mode-warning-foreground);--velt-warning-light: var(--velt-light-mode-warning-light);--velt-warning-transparent: var(--velt-light-mode-warning-transparent);--velt-success: var(--velt-light-mode-success);--velt-success-hover: var(--velt-light-mode-success-hover);--velt-success-foreground: var(--velt-light-mode-success-foreground);--velt-success-light: var(--velt-light-mode-success-light);--velt-success-transparent: var(--velt-light-mode-success-transparent);--velt-accent: var(--velt-light-mode-accent);--velt-accent-text: var(--velt-light-mode-accent-text);--velt-accent-hover: var(--velt-light-mode-accent-hover);--velt-accent-foreground: var(--velt-light-mode-accent-foreground);--velt-accent-light: var(--velt-light-mode-accent-light);--velt-accent-transparent: var(--velt-light-mode-accent-transparent);--velt-text-0: var(--velt-light-mode-text-0);--velt-text-1: var(--velt-light-mode-text-1);--velt-text-2: var(--velt-light-mode-text-2);--velt-text-3: var(--velt-light-mode-text-3);--velt-text-4: var(--velt-light-mode-text-4);--velt-text-5: var(--velt-light-mode-text-5);--velt-text-6: var(--velt-light-mode-text-6);--velt-text-7: var(--velt-light-mode-text-7);--velt-text-8: var(--velt-light-mode-text-8);--velt-text-9: var(--velt-light-mode-text-9);--velt-text-10: var(--velt-light-mode-text-10);--velt-text-11: var(--velt-light-mode-text-11);--velt-text-12: var(--velt-light-mode-text-12);--velt-background-0: var(--velt-light-mode-background-0);--velt-background-1: var(--velt-light-mode-background-1);--velt-background-2: var(--velt-light-mode-background-2);--velt-background-3: var(--velt-light-mode-background-3);--velt-background-4: var(--velt-light-mode-background-4);--velt-background-5: var(--velt-light-mode-background-5);--velt-background-6: var(--velt-light-mode-background-6);--velt-background-7: var(--velt-light-mode-background-7);--velt-background-8: var(--velt-light-mode-background-8);--velt-background-9: var(--velt-light-mode-background-9);--velt-background-10: var(--velt-light-mode-background-10);--velt-border-0: var(--velt-light-mode-border-0);--velt-border-1: var(--velt-light-mode-border-1);--velt-border-2: var(--velt-light-mode-border-2);--velt-border-3: var(--velt-light-mode-border-3);--velt-border-4: var(--velt-light-mode-border-4);--velt-border-5: var(--velt-light-mode-border-5);--velt-border-6: var(--velt-light-mode-border-6);--velt-border-7: var(--velt-light-mode-border-7);--velt-border-8: var(--velt-light-mode-border-8);--velt-border-9: var(--velt-light-mode-border-9);--velt-border-10: var(--velt-light-mode-border-10);--velt-background-transparent: var(--velt-light-mode-background-transparent);--velt-border-transparent: var(--velt-light-mode-border-transparent);--velt-animation-transparent: var(--velt-light-mode-animation-transparent)}[dark][_nghost-%COMP%], .velt-autocomplete-panel--autocomplete:has(>.s-comment-autocomplete-panel-dark){--velt-green: var(--velt-dark-mode-green);--velt-magenta: var(--velt-dark-mode-magenta);--velt-amber: var(--velt-dark-mode-amber);--velt-purple: var(--velt-dark-mode-purple);--velt-cyan: var(--velt-dark-mode-cyan);--velt-orange: var(--velt-dark-mode-orange);--velt-black: var(--velt-dark-mode-black);--velt-white: var(--velt-dark-mode-white);--velt-gray: var(--velt-dark-mode-gray);--velt-error: var(--velt-dark-mode-error);--velt-error-hover: var(--velt-dark-mode-error-hover);--velt-error-foreground: var(--velt-dark-mode-error-foreground);--velt-error-light: var(--velt-dark-mode-error-light);--velt-error-transparent: var(--velt-dark-mode-error-transparent);--velt-warning: var(--velt-dark-mode-warning);--velt-warning-hover: var(--velt-dark-mode-warning-hover);--velt-warning-foreground: var(--velt-dark-mode-warning-foreground);--velt-warning-light: var(--velt-dark-mode-warning-light);--velt-warning-transparent: var(--velt-dark-mode-warning-transparent);--velt-success: var(--velt-dark-mode-success);--velt-success-hover: var(--velt-dark-mode-success-hover);--velt-success-foreground: var(--velt-dark-mode-success-foreground);--velt-success-light: var(--velt-dark-mode-success-light);--velt-success-transparent: var(--velt-dark-mode-success-transparent);--velt-accent: var(--velt-dark-mode-accent);--velt-accent-text: var(--velt-dark-mode-accent-text);--velt-accent-hover: var(--velt-dark-mode-accent-hover);--velt-accent-foreground: var(--velt-dark-mode-accent-foreground);--velt-accent-light: var(--velt-dark-mode-accent-light);--velt-accent-transparent: var(--velt-dark-mode-accent-transparent);--velt-text-0: var(--velt-dark-mode-text-0);--velt-text-1: var(--velt-dark-mode-text-1);--velt-text-2: var(--velt-dark-mode-text-2);--velt-text-3: var(--velt-dark-mode-text-3);--velt-text-4: var(--velt-dark-mode-text-4);--velt-text-5: var(--velt-dark-mode-text-5);--velt-text-6: var(--velt-dark-mode-text-6);--velt-text-7: var(--velt-dark-mode-text-7);--velt-text-8: var(--velt-dark-mode-text-8);--velt-text-9: var(--velt-dark-mode-text-9);--velt-text-10: var(--velt-dark-mode-text-10);--velt-text-11: var(--velt-dark-mode-text-11);--velt-text-12: var(--velt-dark-mode-text-12);--velt-background-0: var(--velt-dark-mode-background-0);--velt-background-1: var(--velt-dark-mode-background-1);--velt-background-2: var(--velt-dark-mode-background-2);--velt-background-3: var(--velt-dark-mode-background-3);--velt-background-4: var(--velt-dark-mode-background-4);--velt-background-5: var(--velt-dark-mode-background-5);--velt-background-6: var(--velt-dark-mode-background-6);--velt-background-7: var(--velt-dark-mode-background-7);--velt-background-8: var(--velt-dark-mode-background-8);--velt-background-9: var(--velt-dark-mode-background-9);--velt-background-10: var(--velt-dark-mode-background-10);--velt-border-0: var(--velt-dark-mode-border-0);--velt-border-1: var(--velt-dark-mode-border-1);--velt-border-2: var(--velt-dark-mode-border-2);--velt-border-3: var(--velt-dark-mode-border-3);--velt-border-4: var(--velt-dark-mode-border-4);--velt-border-5: var(--velt-dark-mode-border-5);--velt-border-6: var(--velt-dark-mode-border-6);--velt-border-7: var(--velt-dark-mode-border-7);--velt-border-8: var(--velt-dark-mode-border-8);--velt-border-9: var(--velt-dark-mode-border-9);--velt-border-10: var(--velt-dark-mode-border-10);--velt-background-transparent: var(--velt-dark-mode-background-transparent);--velt-border-transparent: var(--velt-dark-mode-border-transparent);--velt-animation-transparent: var(--velt-dark-mode-animation-transparent)}*[_ngcontent-%COMP%]{box-sizing:border-box;-webkit-tap-highlight-color:rgba(255,255,255,0);outline:none;margin:0;padding:0;line-height:1.5;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit));font-family:var(--velt-default-font-family)}*[_ngcontent-%COMP%]:empty:not(svg,rect,circle,ellipse,line,polyline,polygon,path,text,g,use,image,defs,hr){display:revert}.velt-autocomplete-panel[_ngcontent-%COMP%]{position:relative;width:100%}.velt-autocomplete-panel--input[_ngcontent-%COMP%]{width:100%}.velt-autocomplete-panel--input[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{width:100%;padding:8px;border-radius:var(--velt-border-radius-sm);background:var(--velt-background-0);color:var(--velt-text-1);font-size:14px;line-height:1.5;outline:none}.velt-autocomplete-panel--input[_ngcontent-%COMP%] input[_ngcontent-%COMP%]:focus{border-color:var(--velt-border-4)} .mat-mdc-autocomplete-panel{background:var(--velt-background-0)} .velt-autocomplete-panel--autocomplete{background:var(--velt-background-0);border:1px solid var(--velt-border-2);border-radius:var(--velt-border-radius-sm);box-shadow:0 2px 4px #0000001a;max-height:256px;overflow:auto} .velt-autocomplete-panel--autocomplete::-webkit-scrollbar{display:none;width:0;height:0} .velt-autocomplete-panel--autocomplete::-webkit-scrollbar{width:0;height:0} .velt-autocomplete-panel--autocomplete::-webkit-scrollbar-button{width:0;height:0} .velt-autocomplete-panel--autocomplete.mat-mdc-autocomplete-panel .mat-mdc-option.mdc-list-item{font-size:14px;line-height:1.5;height:auto;padding:8px 16px;background:var(--velt-background-0)} .velt-autocomplete-panel--autocomplete.mat-mdc-autocomplete-panel .mat-mdc-option.mdc-list-item:hover:not(.mdc-list-item--disabled){background:var(--velt-background-2)} .velt-autocomplete-panel--autocomplete.mat-mdc-autocomplete-panel .mat-mdc-option.mdc-list-item.mat-mdc-option-active{background:var(--velt-background-3)} .velt-autocomplete-panel--autocomplete.mat-mdc-autocomplete-panel .mat-mdc-option.mdc-list-item .mdc-list-item__primary-text{color:var(--velt-text-1)} .velt-autocomplete-panel--autocomplete .cdk-virtual-scroll-viewport{height:100%;width:100%;max-height:256px;background:var(--velt-background-0)} .velt-autocomplete-panel--autocomplete .velt-autocomplete-panel--container{background:var(--velt-background-0)} .cdk-overlay-pane{z-index:1000!important} .cdk-overlay-container .cdk-overlay-connected-position-bounding-box .cdk-overlay-pane .mat-mdc-autocomplete-panel{background:var(--velt-background-0);border:1px solid var(--velt-border-2);border-radius:var(--velt-border-radius-sm);box-shadow:0 2px 4px #0000001a}.velt-autocomplete-panel--viewport[_ngcontent-%COMP%]{height:256px;width:100%;background:var(--velt-background-0);scrollbar-width:none}.velt-autocomplete-panel--expanded-groups[_ngcontent-%COMP%]{max-height:256px;width:100%;overflow-y:auto;background:var(--velt-background-0);scrollbar-width:none}.velt-autocomplete-panel--expanded-groups[_ngcontent-%COMP%] .velt-group-option[_ngcontent-%COMP%]{overflow:hidden;color:var(--velt-text-6, #666);text-overflow:ellipsis;font-size:12px;font-style:normal;font-weight:400;line-height:normal;text-transform:uppercase;padding:4px 12px;border-top:1px solid var(--velt-border-2);margin-top:12px}.velt-autocomplete-panel--expanded-groups[_ngcontent-%COMP%] .velt-group-option[_ngcontent-%COMP%]:first-child{border-top:none;margin-top:0}.velt-autocomplete-panel--expanded-groups[_ngcontent-%COMP%] .velt-group-toggle[_ngcontent-%COMP%]{font-size:10px;color:var(--velt-text-2)}.velt-autocomplete-panel--expanded-groups[_ngcontent-%COMP%] .velt-group-member-option[_ngcontent-%COMP%]{padding-left:28px;background-color:var(--velt-background-0)}.velt-autocomplete-panel--expanded-groups[_ngcontent-%COMP%] .velt-group-member[_ngcontent-%COMP%]{width:100%}"],changeDetection:0});let n=o;return n})();function Bzt(n,o){if(n&1){let t=q();f(0),C(1,"div",23)(2,"div",24),te(3),S(),C(4,"div",25),G("click",function(){let i=N(t).$implicit,r=l();return F(r.removeSelectedUserToInvite(i))}),le(),C(5,"svg",26),w(6,"path",7),S()()(),v()}if(n&2){let t=o.$implicit;d(3),je((t==null||t.user==null?null:t.user.name)||(t==null||t.user==null?null:t.user.email))}}function Vzt(n,o){if(n&1){let t=q();f(0),C(1,"div",31),G("click",function(){let i=N(t).$implicit,r=l(2);return F(r.selectRole(i))}),le(),C(2,"svg",32),w(3,"path",33),S(),mt(),C(4,"div")(5,"h4"),te(6),A(7,"translate"),S(),C(8,"p"),te(9),A(10,"translate"),S()()(),v()}if(n&2){let t=o.$implicit,e=o.first,i=l(2);d(),ge("border-top",!e),d(),rt("visibility",(i.selectedUserRole==null?null:i.selectedUserRole.id)===(t==null?null:t.id)?"visible":"hidden"),d(4),je(P(7,6,t==null?null:t.name)),d(3),je(P(10,8,t==null?null:t.description))}}function Uzt(n,o){if(n&1&&(C(0,"div",27)(1,"div",28),g(2,Vzt,11,10,"ng-container",12),S(),te(3),A(4,"translate"),le(),C(5,"svg",29),w(6,"path",30),S()()),n&2){let t=l();ge("disabled",!t.isUserAdmin),d(2),c("ngForOf",t.userRoles),d(),ve(" ",P(4,4,t.selectedUserRole==null?null:t.selectedUserRole.name)," ")}}function jzt(n,o){n&1&&(le(),C(0,"svg",32),w(1,"path",44),S())}function $zt(n,o){if(n&1&&(C(0,"div",41),te(1),A(2,"translate"),g(3,jzt,2,0,"svg",43),S()),n&2){let t=l().$implicit,e=l(2);d(),ve(" ",P(2,2,t==null||t.role==null?null:t.role.name)," "),d(2),c("ngIf",e.isUserAdmin&&(t==null||t.user==null?null:t.user.email)!==(e.user==null?null:e.user.email))}}function Hzt(n,o){if(n&1){let t=q();C(0,"div",28)(1,"div",45),G("click",function(){N(t);let i=l().$implicit,r=l(2);return F(r.removeUser(i))}),te(2),A(3,"translate"),S()()}n&2&&(d(2),ve(" ",P(3,1,"Remove")," "))}function zzt(n,o){if(n&1&&(f(0),C(1,"div",38)(2,"div",39),w(3,"snippyly-user-avatar",40),te(4),S(),C(5,"div",41)(6,"app-overlay-tooltip",42),g(7,$zt,4,4,"ng-template",null,1,De)(9,Hzt,4,3,"ng-template",null,2,De),S()()(),v()),n&2){let t=o.$implicit,e=l(2);d(3),c("user",t==null?null:t.user)("background","#625DF5"),d(),ve(" ",(t==null||t.user==null?null:t.user.name)||(t==null||t.user==null?null:t.user.email)," "),d(2),c("disabled",!(e.isUserAdmin&&(t==null||t.user==null?null:t.user.email)!==(e.user==null?null:e.user.email)))}}function Gzt(n,o){n&1&&(f(0),C(1,"div"),te(2),A(3,"translate"),S(),v()),n&2&&(d(2),je(P(3,1,"No users are added.")))}function Wzt(n,o){if(n&1&&(C(0,"div",34)(1,"div",35),te(2),A(3,"translate"),S(),g(4,zzt,11,4,"ng-container",36)(5,Gzt,4,3,"ng-container",37),S()),n&2){let t=l();d(2),je(P(3,4,"People on this project")),d(2),c("ngForOf",t.documentUsers)("ngForTrackBy",t.trackByDocumentUserId),d(),c("ngIf",!(t.documentUsers!=null&&t.documentUsers.length))}}function qzt(n,o){if(n&1&&(f(0),C(1,"div",38)(2,"div",39),w(3,"snippyly-user-avatar",40),te(4),A(5,"translate"),S()(),v()),n&2){let t=o.$implicit;d(3),c("user",t)("background","#625DF5"),d(),ve(" ",P(5,3,(t==null?null:t.name)||(t==null?null:t.email))," ")}}function Yzt(n,o){if(n&1&&(C(0,"div",38)(1,"div",39),w(2,"snippyly-user-avatar",40),te(3),A(4,"translate"),S(),C(5,"div",27),te(6),A(7,"translate"),S()()),n&2){let t=l().$implicit;d(2),c("user",t)("background","#625DF5"),d(),ve(" ",P(4,4,(t==null?null:t.name)||(t==null?null:t.email))," "),d(3),ve(" ",P(7,6,"Invited")," ")}}function Kzt(n,o){if(n&1&&(f(0),g(1,Yzt,8,8,"div",46),v()),n&2){let t=o.$implicit,e=l(2);d(),c("ngIf",!e.huddleUsersByEmailMap[t==null?null:t.email])}}function Zzt(n,o){if(n&1&&(C(0,"div",34)(1,"div",35),te(2),A(3,"translate"),S(),g(4,qzt,6,5,"ng-container",36)(5,Kzt,2,1,"ng-container",36),S()),n&2){let t=l();d(2),je(P(3,5,"People on this huddle")),d(2),c("ngForOf",t.huddleUsers)("ngForTrackBy",t.trackByHuddleUserId),d(),c("ngForOf",t.huddleInvitees)("ngForTrackBy",t.trackByHuddleInviteeId)}}function Xzt(n,o){if(n&1){let t=q();C(0,"div",47)(1,"div",48),te(2),A(3,"translate"),S(),C(4,"div",49)(5,"div",28)(6,"div",31),G("click",function(){N(t);let i=l();return F(i.changeDocumentAccessType(i.DocumentAccessTypes.PUBLIC))}),le(),C(7,"svg",32),w(8,"path",33),S(),mt(),C(9,"div")(10,"h3"),te(11),A(12,"translate"),A(13,"titlecase"),S(),C(14,"p"),te(15),A(16,"translate"),S()()(),C(17,"div",45),G("click",function(){N(t);let i=l();return F(i.changeDocumentAccessType(i.DocumentAccessTypes.RESTRICTED))}),le(),C(18,"svg",32),w(19,"path",33),S(),mt(),C(20,"div")(21,"h3"),te(22),A(23,"translate"),A(24,"titlecase"),S(),C(25,"p"),te(26),A(27,"translate"),S()()()(),le(),C(28,"svg",32),w(29,"path",50)(30,"path",51)(31,"path",52),S(),mt(),C(32,"div",53)(33,"h3"),te(34),A(35,"translate"),A(36,"titlecase"),S(),C(37,"p"),te(38),A(39,"translate"),S()()()()}if(n&2){let t=l();d(2),je(P(3,11,"General access")),d(5),rt("visibility",!t.documentAccessType||t.documentAccessType===t.DocumentAccessTypes.PUBLIC?"visible":"hidden"),d(4),je(P(13,15,P(12,13,t.DocumentAccessTypes.PUBLIC))),d(4),je(P(16,17,t.documentAccessTypeMap[t.DocumentAccessTypes.PUBLIC]==null?null:t.documentAccessTypeMap[t.DocumentAccessTypes.PUBLIC].description)),d(3),rt("visibility",t.documentAccessType===t.DocumentAccessTypes.RESTRICTED?"visible":"hidden"),d(4),je(P(24,21,P(23,19,t.DocumentAccessTypes.RESTRICTED))),d(4),je(P(27,23,t.documentAccessTypeMap[t.DocumentAccessTypes.RESTRICTED]==null?null:t.documentAccessTypeMap[t.DocumentAccessTypes.RESTRICTED].description)),d(8),je(P(36,27,P(35,25,t.documentAccessType||t.DocumentAccessTypes.PUBLIC))),d(4),ve("",P(39,29,t.documentAccessTypeMap[t.documentAccessType?t.documentAccessType:t.DocumentAccessTypes.PUBLIC]==null?null:t.documentAccessTypeMap[t.documentAccessType?t.documentAccessType:t.DocumentAccessTypes.PUBLIC].description)," ")}}function Qzt(n,o){n&1&&(le(),C(0,"svg",54),w(1,"path",55),S())}function Jzt(n,o){n&1&&(le(),C(0,"svg",56),w(1,"path",57),S())}var Ufe=(()=>{let o=class o{constructor(e,i,r,a,s,m,p,h,_,E,D){this.analyticsService=e,this.authService=i,this.configService=r,this.docService=a,this.documentUserAccessService=s,this.huddleService=m,this.loggingService=p,this.iamService=h,this.toastService=_,this.dialogRef=E,this.usersToInvite=[],this.documentUsers=[],this.huddleInvitees=[],this.huddleUsers=[],this.huddleUsersByEmailMap={},this.userRoles=[],this.excludeContacts=[],this.linkCopied=!1,this.hideAccessControlDropdown=!1,this.subscriptions=[],this.title="Share project",this.placeholder="Add email address",this.documentAccessType="",this.DocumentAccessTypes=pi,this.isUserAdmin=!1,this.documentAccessTypeMap=j.DocumentAccessTypeMap,this.documentUserAccessList=!0,this.veltElement=!0;try{D&&(this.hideAccessControlDropdown=!!D.hideAccessControlDropdown,this.type=D.type,this.source=D.source,D.title&&(this.title=D.title),D.placeholder&&(this.placeholder=D.placeholder),this.documentUserAccessList=!!D.documentUserAccessList,this.inviteUrl=D.inviteUrl),this.subscriptions.push(this.authService.getUser$().subscribe(L=>{this.user=L})),this.subscriptions.push(this.iamService.isUserAdmin$().subscribe(L=>{this.isUserAdmin=L})),this.subscriptions.push(this.configService.getSF$().subscribe(L=>{L?this.documentAccessTypeMap=j.DocumentAccessTypeMapSF:this.documentAccessTypeMap=j.DocumentAccessTypeMap})),this.type!=="invite"&&this.subscriptions.push(this.documentUserAccessService.getDocumentUsers$().subscribe(L=>{this.documentUsers=L,this.updateExcludeContacts()})),this.type!=="invite"&&this.subscriptions.push(this.iamService.getRoles$().subscribe(L=>{this.userRoles=L,this.userRoles?.length&&(this.selectedUserRole=this.userRoles?.find(H=>H.name===go.COMMENTER))})),this.type!=="invite"&&this.subscriptions.push(this.iamService.getDocumentIAM$().subscribe(L=>{this.documentAccessType=this.docService.getDocumentAccessType(L)})),this.type==="invite"&&(this.subscriptions.push(this.huddleService.getHuddleAttendees$().subscribe(L=>{this.huddleUsers=L,this.huddleUsersByEmailMap={},L.forEach(H=>{H.email&&(this.huddleUsersByEmailMap[H.email]=H)})})),this.subscriptions.push(this.huddleService.getHuddleInvitees$().subscribe(L=>{this.huddleInvitees=L})))}catch(L){this.loggingService.catch("Error in UserInviteDialogComponent constructor: ",L)}}ngOnInit(){try{this.dialogRef.addPanelClass("snippyly-user-invite-dialog"),this.userRoles?.length&&(this.selectedUserRole=this.userRoles?.find(e=>e.name===go.COMMENTER))}catch(e){this.loggingService.catch("Error in UserInviteDialogComponent ngOnInit: ",e)}}updateExcludeContacts(){try{this.excludeContacts=[],this.excludeContacts.push(...this.documentUsers.map(e=>e.user)),this.excludeContacts.push(...this.usersToInvite.map(e=>e.user))}catch(e){this.loggingService.catch("Error in UserInviteDialogComponent updateExcludeContacts: ",e)}}trackByDocumentUserId(e,i){return i.id}trackByHuddleUserId(e,i){return i.userSnippylyId||i.userId}trackByHuddleInviteeId(e,i){return i.userId||i.email}selectRole(e){try{this.selectedUserRole=e}catch(i){this.loggingService.catch("Error in UserInviteDialogComponent selectRole: ",i)}}onUserSelected(e){try{let i=new sM;i.id=e.email?Pt(e.email):Pt(e.userId),i.user=e,this.usersToInvite.find(r=>r.id===i.id)||this.usersToInvite.push(i),this.updateExcludeContacts()}catch(i){this.loggingService.catch("Error in UserInviteDialogComponent onUserSelected: ",i)}}inviteSelectedUsers(){try{if(this.usersToInvite?.length)if(this.type==="invite"){let e=this.usersToInvite.map(i=>i.user);this.analyticsService.trackEvent(X.Events.InviteDialog.USER_INVITED,{source:this.source}),this.huddleService.inviteUsers(e),this.toastService.setToast({message:"Invitation sent!",type:"success",duration:2e3})}else{this.usersToInvite.forEach(a=>{this.selectedUserRole&&(a.role=this.selectedUserRole)});let e=this.usersToInvite.filter(a=>a.role?.name===go.ADMIN).map(a=>a.user.email),i=this.usersToInvite.filter(a=>a.role?.name===go.COMMENTER).map(a=>a.user.email),r={actionType:fU.INVITE,userInvite:{admin:e?.length?{emails:e,emailProperties:{url:this.getInviteUrl()}}:void 0,commenter:i?.length?{emails:i,clientDocumentId:this.docService.getDocumentPaths()?.clientDocumentId,documentId:this.docService.getDocumentPaths()?.documentId,clientOrganizationId:this.user?.clientOrganizationId,organizationId:this.user?.organizationId,emailProperties:{url:this.getInviteUrl()}}:void 0}};this.documentUserAccessService.updateNotificationsDatabase(r),this.toastService.setToast({message:"Invitation sent!",type:"success",duration:2e3})}this.usersToInvite=[]}catch(e){this.loggingService.catch("Error in UserInviteDialogComponent inviteSelectedUsers: ",e)}}removeSelectedUserToInvite(e){try{this.usersToInvite=this.usersToInvite.filter(i=>i.id!==e.id),this.updateExcludeContacts()}catch(i){this.loggingService.catch("Error in UserInviteDialogComponent removeSelectedUserToInvite: ",i)}}updateUserRole(e,i){try{let r=e?.role?.name,a=i?.name;e.role=i,this.documentUserAccessService.updateDocumentUser(e,{oldAccess:r,newAccess:a})}catch(r){this.loggingService.catch("Error in UserInviteDialogComponent updateUserRole: ",r)}}removeUser(e){try{this.analyticsService.trackEvent(X.Events.ShareDialog.DOCUMENT_USER_ACCESS_REMOVED,{targetUserId:e?.user?.userId,targetUserEmail:e?.user?.email,roleType:e?.role?.name}),this.documentUserAccessService.removeDocumentUser(e),this.toastService.setToast({message:"User removed!",type:"success",duration:2e3})}catch(i){this.loggingService.catch("Error in UserInviteDialogComponent removeUser: ",i)}}getInviteUrl(){try{return this.inviteUrl||window.location.href}catch(e){return this.loggingService.catch("Error in UserInviteDialogComponent getInviteUrl: ",e),""}}copyLink(){try{let e=this.getInviteUrl();this.linkCopied=!0,bs(e),setTimeout(()=>{this.linkCopied=!1},2e3),this.type==="invite"?this.analyticsService.trackEvent(X.Events.InviteDialog.INVITE_LINK_COPIED,{source:this.source}):this.type==="share"&&this.analyticsService.trackEvent(X.Events.ShareDialog.SHARE_LINK_COPIED)}catch(e){this.loggingService.catch("Error in UserInviteDialogComponent copyLink: ",e)}}changeDocumentAccessType(e){try{this.documentAccessType!==e&&(this.analyticsService.trackEvent(X.Events.ShareDialog.DOCUMENT_ACCESS_CHANGED,{oldAccessType:this.documentAccessType,newAccessType:e}),this.docService.changeDocumentAccessType(e),this.toastService.setToast({message:"Access changed to '"+e+"'.",type:"success",duration:2e3}))}catch(i){this.loggingService.catch("Error in UserInviteDialogComponent changeDocumentAccessType: ",i)}}closeDialog(){try{this.dialogRef.close()}catch(e){this.loggingService.catch("Error in UserInviteDialogComponent closeDialog: ",e)}}ngOnDestroy(){try{this.subscriptions.forEach(e=>e.unsubscribe())}catch(e){this.loggingService.catch("Error in UserInviteDialogComponent ngOnDestroy: ",e)}}};o.\u0275fac=function(i){return new(i||o)(u(Ze),u(He),u(jt),u(lt),u(Bfe),u(pr),u(y),u(fn),u(Rm),u(Xo),u(bl,8))},o.\u0275cmp=O({type:o,selectors:[["snippyly-user-invite-dialog"]],hostVars:1,hostBindings:function(i,r){i&2&&x("data-velt-element",r.veltElement)},standalone:!1,decls:32,vars:27,consts:[["userSelectorRef",""],["triggerTemplate",""],["tooltipTemplate",""],[1,"s-video-settings-modal",3,"click","pointerdown","pointerup"],[1,"s-video-header"],[1,"s-video-header-name"],["width","20","height","20","viewBox","0 0 20 20","fill","none","xmlns","http://www.w3.org/2000/svg",1,"s-cursor-pointer",3,"click"],["fill-rule","evenodd","clip-rule","evenodd","d","M4.41076 4.41058C4.7362 4.08514 5.26384 4.08514 5.58928 4.41058L10 8.82133L14.4108 4.41058C14.7362 4.08514 15.2638 4.08514 15.5893 4.41058C15.9147 4.73602 15.9147 5.26366 15.5893 5.58909L11.1785 9.99984L15.5893 14.4106C15.9147 14.736 15.9147 15.2637 15.5893 15.5891C15.2638 15.9145 14.7362 15.9145 14.4108 15.5891L10 11.1783L5.58928 15.5891C5.26384 15.9145 4.7362 15.9145 4.41076 15.5891C4.08533 15.2637 4.08533 14.736 4.41076 14.4106L8.82151 9.99984L4.41076 5.58909C4.08533 5.26366 4.08533 4.73602 4.41076 4.41058Z","fill","#80808A"],[1,"s-video-settings-modal-item"],[1,"s-input"],[1,"s-input-chip-list-container"],[1,"s-chip-list"],[4,"ngFor","ngForOf"],[1,"s-input-user-selector",3,"optionSelected","placeholder","enableOnFocus"],["class","s-role dropdown",3,"disabled",4,"ngIf"],["class","s-video-settings-modal-item s-people-list-container",4,"ngIf"],["class","s-general-access-container",4,"ngIf"],[1,"s-buttons-wrap"],[1,"s-button","s-secondary",3,"click"],["width","20","height","20","viewBox","0 0 20 20","fill","none","xmlns","http://www.w3.org/2000/svg",4,"ngIf"],["width","20","height","20","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg",4,"ngIf"],[1,"s-flex-fill"],[1,"s-button","s-primary",3,"click"],[1,"s-chip"],[1,"s-chip-user"],[1,"s-chip-remove",3,"click"],["width","14","height","14","viewBox","0 0 20 20","fill","none","xmlns","http://www.w3.org/2000/svg"],[1,"s-role","dropdown"],[1,"dropdown-content"],["width","24","height","24","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg",1,"dropdown-icon"],["fill-rule","evenodd","clip-rule","evenodd","d","M7.79289 9.79289C8.18342 9.40237 8.81658 9.40237 9.20711 9.79289L12 12.5858L14.7929 9.79289C15.1834 9.40237 15.8166 9.40237 16.2071 9.79289C16.5976 10.1834 16.5976 10.8166 16.2071 11.2071L12.7071 14.7071C12.3166 15.0976 11.6834 15.0976 11.2929 14.7071L7.79289 11.2071C7.40237 10.8166 7.40237 10.1834 7.79289 9.79289Z","fill","#D4D6DF"],[1,"dropdown-item",3,"click"],["width","24","height","24","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg"],["fill-rule","evenodd","clip-rule","evenodd","d","M18.7071 7.29289C19.0976 7.68342 19.0976 8.31658 18.7071 8.70711L10.7071 16.7071C10.3166 17.0976 9.68342 17.0976 9.29289 16.7071L5.29289 12.7071C4.90237 12.3166 4.90237 11.6834 5.29289 11.2929C5.68342 10.9024 6.31658 10.9024 6.70711 11.2929L10 14.5858L17.2929 7.29289C17.6834 6.90237 18.3166 6.90237 18.7071 7.29289Z","fill","#80808A"],[1,"s-video-settings-modal-item","s-people-list-container"],[1,"s-people-list-title"],[4,"ngFor","ngForOf","ngForTrackBy"],[4,"ngIf"],[1,"s-user"],[1,"s-user-info"],[1,"s-flex",3,"user","background"],[1,"s-role"],[3,"disabled"],["width","24","height","24","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg",4,"ngIf"],["fill-rule","evenodd","clip-rule","evenodd","d","M16.2071 9.79289C15.8166 9.40237 15.1834 9.40237 14.7929 9.79289L12 12.5858L9.20711 9.79289C8.81658 9.40237 8.18342 9.40237 7.79289 9.79289C7.40237 10.1834 7.40237 10.8166 7.79289 11.2071L11.2929 14.7071C11.6834 15.0976 12.3166 15.0976 12.7071 14.7071L16.2071 11.2071C16.5976 10.8166 16.5976 10.1834 16.2071 9.79289Z","fill","#404044"],[1,"dropdown-item","border-top",3,"click"],["class","s-user",4,"ngIf"],[1,"s-general-access-container"],[1,"s-general-access-title"],[1,"s-button","s-secondary","s-document-access-btn","dropdown"],["fill-rule","evenodd","clip-rule","evenodd","d","M12 11C10.2274 11 8.64844 11.0646 7.35838 11.1466C6.13471 11.2243 5.19379 12.158 5.10597 13.373C5.0435 14.2373 5 15.1481 5 16C5 16.8519 5.0435 17.7627 5.10597 18.627C5.19379 19.842 6.13471 20.7757 7.35838 20.8534C8.64844 20.9354 10.2274 21 12 21C13.7726 21 15.3516 20.9354 16.6416 20.8534C17.8653 20.7757 18.8062 19.842 18.894 18.627C18.9565 17.7627 19 16.8519 19 16C19 15.1481 18.9565 14.2373 18.894 13.373C18.8062 12.158 17.8653 11.2243 16.6416 11.1466C15.3516 11.0646 13.7726 11 12 11ZM7.2315 9.15059C5.01376 9.29156 3.27137 11.0124 3.11117 13.2288C3.04652 14.1234 3 15.085 3 16C3 16.915 3.04652 17.8766 3.11118 18.7712C3.27137 20.9876 5.01376 22.7084 7.23151 22.8494C8.55778 22.9337 10.1795 23 12 23C13.8205 23 15.4422 22.9337 16.7685 22.8494C18.9862 22.7084 20.7286 20.9876 20.8888 18.7712C20.9535 17.8766 21 16.915 21 16C21 15.085 20.9535 14.1234 20.8888 13.2288C20.7286 11.0124 18.9862 9.29156 16.7685 9.15059C15.4422 9.06629 13.8205 9 12 9C10.1795 9 8.55778 9.06629 7.2315 9.15059Z","fill","#777E91"],["fill-rule","evenodd","clip-rule","evenodd","d","M13 16.7324C13.5978 16.3866 14 15.7403 14 15C14 13.8954 13.1046 13 12 13C10.8954 13 10 13.8954 10 15C10 15.7403 10.4022 16.3866 11 16.7324V18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18V16.7324Z","fill","#777E91"],["fill-rule","evenodd","clip-rule","evenodd","d","M7 6C7 3.23858 9.23858 1 12 1C14.7614 1 17 3.23858 17 6V10C17 10.5523 16.5523 11 16 11C15.4477 11 15 10.5523 15 10V6C15 4.34315 13.6569 3 12 3C10.3431 3 9 4.34315 9 6V10C9 10.5523 8.55228 11 8 11C7.44772 11 7 10.5523 7 10V6Z","fill","#777E91"],[1,"s-document-access-btn-content"],["width","20","height","20","viewBox","0 0 20 20","fill","none","xmlns","http://www.w3.org/2000/svg"],["fill-rule","evenodd","clip-rule","evenodd","d","M6.49027 2.50491C6.46607 2.50996 6.34731 2.53007 6.22635 2.54966C5.17052 2.72053 4.19457 3.45245 3.69214 4.45019C3.56689 4.69886 3.43711 5.08311 3.37864 5.3784C3.31829 5.68302 3.31829 14.3108 3.37864 14.6154C3.52088 15.3336 3.85013 15.9526 4.36233 16.4647C4.76978 16.8722 5.22723 17.1555 5.75266 17.3256C6.23219 17.4809 6.32453 17.4891 7.59205 17.4891H8.76711L8.88599 17.4104C9.06906 17.2893 9.14407 17.146 9.14407 16.9173C9.14407 16.6887 9.06909 16.5453 8.88611 16.4242L8.76728 16.3455L7.6068 16.3286C6.3852 16.3109 6.35854 16.3081 5.96566 16.1588C5.43291 15.9564 4.86723 15.3934 4.67143 14.8707C4.49992 14.4129 4.51091 14.747 4.51091 9.9969C4.51091 5.24677 4.49992 5.58091 4.67143 5.12308C4.88025 4.56564 5.45367 4.01728 6.0476 3.80712C6.46364 3.65989 6.4966 3.65865 9.67189 3.66895C12.8862 3.67939 12.6707 3.6688 13.1239 3.83838C13.3521 3.92374 13.6919 4.15074 13.8939 4.35272C14.0958 4.5547 14.3228 4.89447 14.4082 5.12264C14.5641 5.53916 14.5639 5.53763 14.5816 6.87392L14.5983 8.13484L14.6679 8.24677C14.7061 8.30835 14.791 8.39412 14.8563 8.43737C14.9554 8.50291 15.0078 8.51605 15.1701 8.51605C15.3324 8.51605 15.3848 8.50291 15.4839 8.43737C15.5492 8.39412 15.6341 8.30835 15.6723 8.24677L15.7419 8.13484V6.85925C15.7419 5.89002 15.7321 5.53438 15.7012 5.3784C15.4231 3.97403 14.4078 2.9182 13.0001 2.56948C12.7554 2.50887 12.6941 2.50764 9.64257 2.50177C7.93299 2.49849 6.51446 2.4999 6.49027 2.50491ZM10.1326 4.86732C10.0008 4.90764 9.81429 5.10144 9.77661 5.23721C9.75922 5.29976 9.74547 5.6244 9.74538 5.97344C9.74517 6.73161 9.7789 6.93488 9.97026 7.32843C10.0835 7.56132 10.1471 7.64839 10.358 7.85928C10.5687 8.06997 10.6561 8.13387 10.8888 8.24715C11.3004 8.44752 11.4993 8.4781 12.3174 8.46675L12.9899 8.4574L13.1087 8.37872C13.2923 8.25712 13.3667 8.11437 13.3667 7.88344C13.3667 7.72342 13.3533 7.6705 13.288 7.57182C13.2448 7.50646 13.159 7.42162 13.0974 7.38336C12.9898 7.31647 12.9581 7.31319 12.2817 7.29876C11.6484 7.28524 11.5646 7.27759 11.4445 7.22234C11.2497 7.13276 11.1074 6.99491 11.0146 6.80594C10.9336 6.64091 10.9327 6.63267 10.9182 5.93556C10.904 5.25876 10.9008 5.2275 10.8339 5.11986C10.6956 4.89741 10.3918 4.788 10.1326 4.86732ZM15.7049 9.14973C15.3168 9.21439 14.8688 9.42637 14.5091 9.71547C14.1903 9.97168 12.9551 11.227 12.785 11.4677C12.6151 11.708 12.4379 12.0846 12.3662 12.3575C12.2934 12.6347 12.2934 13.2178 12.3662 13.4864C12.4763 13.8923 12.7739 14.3816 12.9941 14.5185C13.1571 14.6198 13.4451 14.6146 13.6071 14.5074C13.7916 14.3853 13.8652 14.2433 13.8652 14.0094C13.8652 13.8346 13.8552 13.8007 13.7698 13.6869C13.7174 13.6169 13.6316 13.474 13.5792 13.3691C13.4922 13.1949 13.4842 13.1559 13.4861 12.9146C13.4901 12.4126 13.6018 12.2459 14.588 11.2695C15.3768 10.4885 15.479 10.4117 15.8541 10.3176C16.4471 10.1688 17.0959 10.642 17.1542 11.2659C17.1867 11.6138 17.0539 11.95 16.7418 12.3102C16.554 12.527 16.5067 12.6446 16.5261 12.8468C16.5522 13.1185 16.7716 13.3292 17.0627 13.362C17.163 13.3733 17.2272 13.3595 17.3476 13.3006C17.6751 13.1404 18.1188 12.4832 18.2617 11.9469C18.4137 11.3768 18.3213 10.7383 18.0102 10.209C17.8837 9.99361 17.4606 9.57059 17.2452 9.444C16.7724 9.16618 16.2292 9.06241 15.7049 9.14973ZM14.7568 12.1471C14.6858 12.1846 14.588 12.2715 14.5396 12.3402C14.4628 12.4494 14.4517 12.4903 14.4517 12.6643C14.4517 12.846 14.4612 12.8773 14.5601 13.021C14.869 13.4698 14.893 13.8775 14.6373 14.3344C14.5091 14.5636 13.051 16.0217 12.8218 16.15C12.3282 16.4261 11.818 16.3718 11.4502 16.0041C11.1691 15.723 11.0679 15.3616 11.1645 14.9843C11.2245 14.75 11.3364 14.5523 11.5457 14.3107C11.7336 14.0939 11.7808 13.9764 11.7614 13.7742C11.7353 13.5024 11.5159 13.2917 11.2249 13.259C11.1245 13.2476 11.0603 13.2615 10.9399 13.3204C10.6125 13.4806 10.1687 14.1377 10.0258 14.674C9.87388 15.2442 9.96627 15.8826 10.2773 16.4119C10.4039 16.6273 10.8269 17.0504 11.0423 17.177C11.5716 17.488 12.2101 17.5804 12.7802 17.4284C13.0265 17.3628 13.41 17.1783 13.6407 17.0145C13.8608 16.858 14.9432 15.8056 15.2867 15.4139C15.9653 14.64 16.1624 13.7239 15.8293 12.8919C15.562 12.2242 15.1512 11.9389 14.7568 12.1471Z","fill","#80808A"],["width","20","height","20","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg"],["fill-rule","evenodd","clip-rule","evenodd","d","M18.7071 7.29289C19.0976 7.68342 19.0976 8.31658 18.7071 8.70711L10.7071 16.7071C10.3166 17.0976 9.68342 17.0976 9.29289 16.7071L5.29289 12.7071C4.90237 12.3166 4.90237 11.6834 5.29289 11.2929C5.68342 10.9024 6.31658 10.9024 6.70711 11.2929L10 14.5858L17.2929 7.29289C17.6834 6.90237 18.3166 6.90237 18.7071 7.29289Z","fill","#ABABB5"]],template:function(i,r){if(i&1){let a=q();C(0,"div",3),G("click",function(m){return N(a),F(m.stopPropagation())})("pointerdown",function(m){return N(a),F(m.stopPropagation())})("pointerup",function(m){return N(a),F(m.stopPropagation())}),C(1,"div",4)(2,"div",5),te(3),A(4,"translate"),S(),le(),C(5,"svg",6),G("click",function(){return N(a),F(r.closeDialog())}),w(6,"path",7),S()(),mt(),C(7,"div",8),te(8),A(9,"translate"),C(10,"div",9)(11,"div",10)(12,"div",11),g(13,Bzt,7,1,"ng-container",12),S(),C(14,"velt-autocomplete-panel-internal",13,0),A(16,"translate"),G("optionSelected",function(m){return N(a),F(r.onUserSelected(m))}),S()(),g(17,Uzt,7,6,"div",14),S()(),g(18,Wzt,6,6,"div",15)(19,Zzt,6,7,"div",15)(20,Xzt,40,31,"div",16),C(21,"div",17)(22,"div",18),G("click",function(){return N(a),F(r.copyLink())}),g(23,Qzt,2,0,"svg",19)(24,Jzt,2,0,"svg",20),te(25),A(26,"translate"),A(27,"translate"),S(),w(28,"div",21),C(29,"div",22),G("click",function(){return N(a),F(r.inviteSelectedUsers())}),te(30),A(31,"translate"),S()()()}i&2&&(d(3),ve(" ",P(4,15,r.title)," "),d(5),ve(" ",P(9,17,"Invite users")," "),d(5),c("ngForOf",r.usersToInvite),d(),c("placeholder",P(16,19,r.placeholder))("enableOnFocus",!1),d(3),c("ngIf",!r.hideAccessControlDropdown),d(),c("ngIf",r.documentUserAccessList&&(r.documentUsers==null?null:r.documentUsers.length)),d(),c("ngIf",(r.huddleInvitees==null?null:r.huddleInvitees.length)||(r.huddleUsers==null?null:r.huddleUsers.length)),d(),c("ngIf",r.isUserAdmin&&!r.hideAccessControlDropdown),d(3),c("ngIf",!r.linkCopied),d(),c("ngIf",r.linkCopied),d(),ve(" ",r.linkCopied?P(26,21,"Link Copied!"):P(27,23,"Copy Link")," "),d(4),ge("s-disabled",!(r.usersToInvite!=null&&r.usersToInvite.length)),d(),je(P(31,25,"Send invite")))},dependencies:[ht,Z,Hn,$m,dg,VR,de],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}*[_ngcontent-%COMP%]{box-sizing:border-box;-webkit-tap-highlight-color:rgba(255,255,255,0)!important;outline:none!important;margin:0!important;padding:0!important;line-height:1.5!important;color:#dcdde0!important;font-size:calc((.8rem + 0px) * var(--velt-base-rem-unit))}*[_ngcontent-%COMP%]:not(svg,rect,circle,ellipse,line,polyline,polygon,path,text,g,use,image,defs,hr){height:unset;width:unset}*[_ngcontent-%COMP%]:empty:not(svg,rect,circle,ellipse,line,polyline,polygon,path,text,g,use,image,defs,hr){display:revert!important}*[_ngcontent-%COMP%]{box-sizing:border-box}.s-video-settings-modal[_ngcontent-%COMP%], .s-video-header[_ngcontent-%COMP%], .s-video-header-name[_ngcontent-%COMP%], .s-video-settings-modal-item[_ngcontent-%COMP%], .s-input[_ngcontent-%COMP%], .s-buttons-wrap[_ngcontent-%COMP%], .s-role[_ngcontent-%COMP%], .s-user[_ngcontent-%COMP%], .s-user-info[_ngcontent-%COMP%]{display:flex!important;align-items:center!important;color:#fff!important}.s-video-settings-modal-item[_ngcontent-%COMP%]{flex-direction:column!important;align-items:flex-start!important;justify-content:flex-start!important;width:100%!important;color:#ababb5!important;font-size:.8rem!important;gap:1rem!important}.s-people-list-container[_ngcontent-%COMP%]{overflow:auto!important}.s-people-list-container[_ngcontent-%COMP%] .s-people-list-title[_ngcontent-%COMP%]{position:sticky!important;top:0!important;background:#141416!important;width:100%!important;z-index:1!important}.s-video-settings-modal[_ngcontent-%COMP%]{flex-direction:column!important;align-items:flex-end!important;padding:2rem!important;gap:2rem!important;background:#141416!important;border-radius:1rem!important;max-width:42rem!important;width:80vw!important;border:2px solid #303034!important;overflow:auto!important;max-height:80vh!important}.s-video-header[_ngcontent-%COMP%]{justify-content:space-between!important;width:100%!important}.s-video-header-name[_ngcontent-%COMP%]{gap:.5rem!important;font-weight:600!important;font-size:1.2rem!important}.s-button[_ngcontent-%COMP%]{display:flex!important;align-items:center!important;justify-content:center!important;padding:calc((.5rem + 0px) * var(--velt-base-rem-unit)) calc((2rem + 0px) * var(--velt-base-rem-unit))!important;border-radius:calc((4rem + 0px) * var(--velt-base-rem-unit))!important;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;transition:.1s ease!important;cursor:pointer!important}.s-primary[_ngcontent-%COMP%]{background:#625df5!important;color:#fff!important}.s-primary[_ngcontent-%COMP%]:not(.s-disabled):hover{background:#4f4bbf!important}.s-disabled[_ngcontent-%COMP%]{background:#939393!important;cursor:not-allowed!important}.s-secondary[_ngcontent-%COMP%]{border:2px solid #303034!important;border-radius:.5rem!important;color:#ababb5!important;gap:.5rem!important}.s-secondary[_ngcontent-%COMP%]:hover{background:#303034!important;color:#fff!important}.s-video-settings-modal-item[_ngcontent-%COMP%] .s-heading[_ngcontent-%COMP%]{font-size:1rem!important;color:#fff!important;padding:.5rem 0!important}.s-input[_ngcontent-%COMP%]{padding:1rem!important;color:#ababb5!important;width:100%!important;justify-content:space-between!important;border-radius:1rem!important;border:2px solid #303034!important;align-items:center!important;cursor:pointer!important;transition:.2s ease!important}.s-input[_ngcontent-%COMP%]:hover{background:#303034!important}.s-buttons-wrap[_ngcontent-%COMP%]{width:100%!important;justify-content:space-between!important;align-items:stretch!important;gap:calc((1rem + 0px) * var(--velt-base-rem-unit))!important}.s-user[_ngcontent-%COMP%]{width:100%!important;justify-content:space-between!important}.s-user-info[_ngcontent-%COMP%]{color:#ababb5!important;gap:.75rem!important}.s-user[_ngcontent-%COMP%] .s-role[_ngcontent-%COMP%]{color:#404044!important}.s-role[_ngcontent-%COMP%]{position:relative!important;cursor:pointer!important}.dropdown[_ngcontent-%COMP%] .dropdown-content[_ngcontent-%COMP%]{position:absolute!important;top:100%!important;right:0!important;z-index:10!important}.dropdown[_ngcontent-%COMP%] .dropdown-content.top[_ngcontent-%COMP%]{top:auto!important;bottom:2rem!important}.dropdown-content[_ngcontent-%COMP%]{min-width:max-content!important;overflow:hidden!important;flex-direction:column!important;justify-content:flex-start!important;align-items:flex-start!important;border-radius:.5rem!important;border:1px solid #303034!important;font-style:normal!important;font-weight:400!important;font-size:1em!important;line-height:1em!important;color:#ababb5!important;background:#141416!important;cursor:pointer!important;transition:.2s ease!important}.dropdown-content[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{color:#ababb5!important}.dropdown[_ngcontent-%COMP%] .dropdown-content[_ngcontent-%COMP%]{display:none!important;visibility:hidden!important;opacity:0!important}.dropdown[_ngcontent-%COMP%] .dropdown-icon[_ngcontent-%COMP%]{width:24px!important;min-width:24px!important}.dropdown.disabled[_ngcontent-%COMP%] .dropdown-icon[_ngcontent-%COMP%]{display:none!important}.dropdown[_ngcontent-%COMP%]:not(.disabled):hover .dropdown-content[_ngcontent-%COMP%]{display:flex!important;visibility:visible!important;opacity:1!important}.dropdown-item[_ngcontent-%COMP%]{padding:1em 2rem 1rem 1rem!important;width:100%!important;display:flex!important;justify-content:flex-start!important;align-items:center!important;gap:1em!important;line-height:1rem!important;border-radius:0!important}.dropdown-item[_ngcontent-%COMP%]:hover{background:#303034!important}.dropdown-item[_ngcontent-%COMP%] h4[_ngcontent-%COMP%]{color:#fff!important;margin:0!important}.dropdown-item[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0!important}.border-top[_ngcontent-%COMP%]{outline:solid 1px #303034!important}.s-flex-fill[_ngcontent-%COMP%]{flex-grow:1!important}.s-input-chip-list-container[_ngcontent-%COMP%]{display:flex;width:100%!important;gap:8px!important;flex-wrap:wrap!important;align-items:center!important}.s-input-chip-list-container[_ngcontent-%COMP%] .s-chip-list[_ngcontent-%COMP%]{display:flex!important;gap:8px!important;flex-wrap:wrap!important}.s-input-chip-list-container[_ngcontent-%COMP%] .s-chip-list[_ngcontent-%COMP%] .s-chip[_ngcontent-%COMP%]{padding:8px 16px!important;background:#222226!important;color:#dcdde0!important;border-radius:100px!important;display:flex!important;align-items:center!important;gap:8px!important}.s-input-chip-list-container[_ngcontent-%COMP%] .s-chip-list[_ngcontent-%COMP%] .s-chip[_ngcontent-%COMP%] .s-chip-remove[_ngcontent-%COMP%]{display:flex!important;cursor:pointer!important}.s-input-chip-list-container[_ngcontent-%COMP%] velt-autocomplete-panel-internal.s-input-user-selector[_ngcontent-%COMP%]{flex-basis:250px!important}.s-general-access-container[_ngcontent-%COMP%]{display:flex!important;flex-direction:column!important;width:100%!important;gap:8px!important}.s-general-access-container[_ngcontent-%COMP%] .s-document-access-btn-content[_ngcontent-%COMP%]{position:relative!important}.s-general-access-container[_ngcontent-%COMP%] .s-document-access-btn-content[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{font-size:calc((.9rem + 0px) * var(--velt-base-rem-unit))!important}.s-general-access-container[_ngcontent-%COMP%] .s-document-access-btn[_ngcontent-%COMP%]{position:relative!important;padding:calc((.5rem + 0px) * var(--velt-base-rem-unit)) calc((1rem + 0px) * var(--velt-base-rem-unit))!important;gap:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;width:100%!important;justify-content:flex-start!important}.s-general-access-container[_ngcontent-%COMP%] .s-document-access-btn[_ngcontent-%COMP%] .dropdown-content[_ngcontent-%COMP%]{left:0!important;top:auto!important;bottom:100%!important}.s-general-access-container[_ngcontent-%COMP%] .s-document-access-btn[_ngcontent-%COMP%] *[_ngcontent-%COMP%]{color:#ababb5!important} .snippyly-user-invite-dialog mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface{background-color:transparent!important;padding:0!important;margin:0!important;border-radius:20px!important} .snippyly-user-invite-dialog mat-dialog-container velt-autocomplete-panel-internal.s-input-user-selector{flex-grow:1!important} .snippyly-user-invite-dialog mat-dialog-container velt-autocomplete-panel-internal.s-input-user-selector input{background:transparent!important;border:0!important;outline:0!important;color:#fff!important}@media screen and (max-width: 425px){ .snippyly-user-invite-dialog{width:100vw!important;max-width:100vw!important;height:100vh!important} .snippyly-user-invite-dialog mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface{border-radius:0!important} .snippyly-user-invite-dialog .s-video-settings-modal{width:100vw!important;height:100vh!important;max-width:100vw!important;max-height:100vh!important;border-radius:0!important} .snippyly-user-invite-dialog .s-chip-user{word-break:break-all!important}}"],changeDetection:0});let n=o;return n})();function eGt(n,o){n&1&&(C(0,"div",4),le(),C(1,"svg",5)(2,"g"),w(3,"path",6)(4,"path",7)(5,"path",8),S()()())}function tGt(n,o){if(n&1){let t=q();C(0,"div")(1,"slot",9),G("slotchange",function(){N(t);let i=l();return F(i.onButtonSlotChange())}),C(2,"div",10),le(),C(3,"svg",11),w(4,"path",12),S()()()()}}var ew=(()=>{let o=class o extends nt{set _disabled(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.disabled=i}set _documentUserAccessList(e){let i=e;typeof e=="string"&&(i=JSON.parse(e)),this.documentUserAccessList=i}constructor(e,i,r,a,s,m){super(s,r,void 0,void 0,void 0,m,i),this.analyticsService=e,this.loggingService=i,this.themeService=r,this.dialog=a,this.elementRef=s,this.dynamicDataService=m,this.type="share",this.disabled=!1,this.documentUserAccessList=!0,this.hideAccessControlDropdown=!1,this.accessControlDropdown=!0,this.veltElement=!0,this.customButtonAdded=!1}ngOnDestroy(){try{super.ngOnDestroy()}catch{}}onButtonSlotChange(){this.customButtonAdded=!0}openInviteDialog(){try{this.disabled||(this.type==="share"&&this.analyticsService.trackEvent(X.Events.ShareDialog.SHARE_BUTTON_CLICKED),this.dialog.open(Ufe,{backdropClass:"s-background-blur-1",data:{title:this.title,placeholder:this.placeholder,hideAccessControlDropdown:this.hideAccessControlDropdown||!this.accessControlDropdown,type:this.type,source:this.source,documentUserAccessList:this.documentUserAccessList,inviteUrl:this.inviteUrl}}))}catch(e){this.loggingService.catch("Error in UserInviteToolComponent openInviteDialog: ",e)}}};o.\u0275fac=function(i){return new(i||o)(u(Ze),u(y),u(Ye),u(Ki),u(k),u(b))},o.\u0275cmp=O({type:o,selectors:[["snippyly-user-invite-tool-internal"]],hostVars:1,hostBindings:function(i,r){i&2&&x("data-velt-element",r.veltElement)},inputs:{type:"type",source:"source",title:"title",placeholder:"placeholder",inviteUrl:"inviteUrl",_disabled:[0,"disabled","_disabled"],_documentUserAccessList:[0,"documentUserAccessList","_documentUserAccessList"],hideAccessControlDropdown:"hideAccessControlDropdown",accessControlDropdown:"accessControlDropdown"},standalone:!1,features:[U([b]),B],decls:4,vars:3,consts:[["part","container",1,"s-user-invite-tool-container","s-cursor-pointer",3,"click"],[1,"s-user-invite-tool-default",3,"ngSwitch"],["class","s-user-invite-tool-button",4,"ngSwitchCase"],[4,"ngSwitchCase"],[1,"s-user-invite-tool-button"],["width","32","height","32","viewBox","0 0 32 32","fill","none","xmlns","http://www.w3.org/2000/svg"],["d","M19.3589 13.3008C17.3965 13.3008 15.6521 14.2519 14.5622 15.7174C14.1206 15.6247 13.6692 15.5768 13.2136 15.5768C9.6054 15.5768 6.66992 18.5123 6.66992 22.1205C6.66992 22.5918 7.05207 22.974 7.52344 22.974H14.67C15.7651 24.3594 17.4599 25.25 19.3589 25.25C22.6533 25.25 25.3335 22.5698 25.3335 19.2754C25.3335 15.981 22.6533 13.3008 19.3589 13.3008ZM8.45235 21.2669C8.85669 19.0058 10.8378 17.2839 13.2136 17.2839C13.3823 17.2839 13.5501 17.2933 13.7166 17.3104C13.5016 17.9261 13.3843 18.5873 13.3843 19.2754C13.3843 19.9735 13.505 20.6437 13.726 21.2669H8.45235ZM19.3589 23.543C17.0057 23.543 15.0913 21.6286 15.0913 19.2754C15.0913 16.9223 17.0057 15.0078 19.3589 15.0078C21.712 15.0078 23.6265 16.9223 23.6265 19.2754C23.6265 21.6286 21.712 23.543 19.3589 23.543Z","fill","white"],["d","M13.2132 13.8716C15.182 13.8716 16.7837 12.2699 16.7837 10.3011C16.7837 8.33224 15.182 6.73047 13.2132 6.73047C11.2443 6.73047 9.64258 8.33224 9.64258 10.3011C9.64258 12.2699 11.2443 13.8716 13.2132 13.8716ZM13.2132 8.4375C14.2408 8.4375 15.0767 9.2735 15.0767 10.3011C15.0767 11.3286 14.2408 12.1645 13.2132 12.1645C12.1856 12.1645 11.3496 11.3286 11.3496 10.3011C11.3496 9.2735 12.1856 8.4375 13.2132 8.4375Z","fill","white"],["d","M21.0664 18.4219H20.2129V17.5684C20.2129 17.097 19.8308 16.7148 19.3594 16.7148C18.888 16.7148 18.5059 17.097 18.5059 17.5684V18.4219H17.6523C17.181 18.4219 16.7988 18.804 16.7988 19.2754C16.7988 19.7468 17.181 20.1289 17.6523 20.1289H18.5059V20.9824C18.5059 21.4538 18.888 21.836 19.3594 21.836C19.8308 21.836 20.2129 21.4538 20.2129 20.9824V20.1289H21.0664C21.5378 20.1289 21.9199 19.7468 21.9199 19.2754C21.9199 18.804 21.5378 18.4219 21.0664 18.4219Z","fill","white"],["name","button",3,"slotchange"],["part","button-container",1,"action-btn"],["part","button-icon","width","24","height","24","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg",1,"action-btn-icon"],["d","M8.57143 9.42858H7.71429C7.25963 9.42858 6.82359 9.60919 6.5021 9.93068C6.18061 10.2522 6 10.6882 6 11.1429V18C6 18.4547 6.18061 18.8907 6.5021 19.2122C6.82359 19.5337 7.25963 19.7143 7.71429 19.7143H16.2857C16.7404 19.7143 17.1764 19.5337 17.4979 19.2122C17.8194 18.8907 18 18.4547 18 18V11.1429C18 10.6882 17.8194 10.2522 17.4979 9.93068C17.1764 9.60919 16.7404 9.42858 16.2857 9.42858H15.4286M12 13.7143V4.28572M12 4.28572L9.42857 6.85715M12 4.28572L14.5714 6.85715","stroke","currentColor","stroke-width","1.25","stroke-linecap","round","stroke-linejoin","round"]],template:function(i,r){i&1&&(C(0,"div",0),G("click",function(){return r.openInviteDialog()}),C(1,"div",1),g(2,eGt,6,0,"div",2)(3,tGt,5,0,"div",3),S()()),i&2&&(d(),c("ngSwitch",r.type),d(),c("ngSwitchCase","invite"),d(),c("ngSwitchCase","share"))},dependencies:[Li,Yi],styles:[`html{--velt-base-rem-unit: 1}*[data-snippyly-element=true],*[data-velt-element=true]{font-family:var(--velt-default-font-family)}velt-wireframe{display:none!important}:host{display:inline-flex!important}.s-user-invite-tool-container{display:inline-block!important}.s-user-invite-tool-button{display:flex!important}.action-btn{display:inline-flex;justify-content:center;align-items:center;padding:6px!important;border-radius:var(--legacy-velt-tool-border-radius);border:var(--legacy-velt-tool-border);background-color:var(--legacy-velt-tool-bg-color);color:var(--legacy-velt-tool-icon-color);cursor:pointer}.action-btn .action-btn-label{font-size:calc((.9rem + 0px) * var(--velt-base-rem-unit))!important;padding-right:4px!important;font-weight:700!important;color:currentColor!important}.action-btn .action-btn-icon{width:calc((var(--legacy-velt-tool-icon-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-tool-icon-size) + 0px) * var(--velt-base-rem-unit));color:currentColor}.action-btn .toolbar-icon-dropdown-arrow{width:16px;height:16px;color:currentColor}.action-btn:focus{border-radius:var(--legacy-velt-tool-focus-border-radius);border:var(--legacy-velt-tool-focus-border);background-color:var(--legacy-velt-tool-focus-bg-color);color:var(--legacy-velt-tool-focus-icon-color)}.action-btn:focus .action-btn-icon{width:calc((var(--legacy-velt-tool-focus-icon-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-tool-focus-icon-size) + 0px) * var(--velt-base-rem-unit))}.action-btn:focus .toolbar-icon-dropdown-arrow{color:var(--legacy-velt-tool-focus-icon-color)}.action-btn:hover{border-radius:var(--legacy-velt-tool-hover-border-radius);border:var(--legacy-velt-tool-hover-border);background-color:var(--legacy-velt-tool-hover-bg-color);color:var(--legacy-velt-tool-hover-icon-color)}.action-btn:hover .action-btn-icon{width:calc((var(--legacy-velt-tool-hover-icon-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-tool-hover-icon-size) + 0px) * var(--velt-base-rem-unit))}.action-btn:hover .toolbar-icon-dropdown-arrow{color:var(--legacy-velt-tool-hover-icon-color)}.action-btn:active,.action-btn.active{border-radius:var(--legacy-velt-tool-active-border-radius);border:var(--legacy-velt-tool-active-border);background-color:var(--legacy-velt-tool-active-bg-color);color:var(--legacy-velt-tool-active-icon-color)}.action-btn:active .action-btn-icon,.action-btn.active .action-btn-icon{width:calc((var(--legacy-velt-tool-active-icon-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-tool-active-icon-size) + 0px) * var(--velt-base-rem-unit))}.action-btn:active .toolbar-icon-dropdown-arrow,.action-btn.active .toolbar-icon-dropdown-arrow{color:var(--legacy-velt-tool-active-icon-color)}
417
417
  `],encapsulation:3,changeDetection:0});let n=o;return n})();var iGt=["*"];function oGt(n,o){if(n&1&&(f(0),le(),C(1,"svg",7),w(2,"path",8)(3,"path",9),S(),v()),n&2){let t=l(2);d(),x("data-testid",t.componentId+"-video-icon")}}function rGt(n,o){if(n&1&&(f(0),le(),C(1,"svg",7),w(2,"path",10)(3,"path",9),S(),v()),n&2){let t=l(2);d(),x("data-testid",t.componentId+"-audio-icon")}}function aGt(n,o){if(n&1){let t=q();f(0),C(1,"div",3),G("click",function(){N(t);let i=l();return F(i.openPermissionDeniedDialog())}),le(),C(2,"svg",4),w(3,"rect",5)(4,"path",6),S(),mt(),f(5,0),g(6,oGt,4,1,"ng-container",1)(7,rGt,4,1,"ng-container",1),v(),S(),v()}if(n&2){let t=l();d(),ge("thread-mode",t.mode==="thread"),x("aria-expanded",!1)("data-testid",t.componentId+"-denied"),d(),x("data-testid",t.componentId+"-info-icon"),d(3),c("ngSwitch",t.type),d(),c("ngSwitchCase","video"),d(),c("ngSwitchCase","audio")}}function sGt(n,o){n&1&&(f(0),Rt(1),v())}var s_=(()=>{let o=class o extends nt{constructor(e,i,r,a){super(a,r),this.devicePermissionService=e,this.loggingService=i,this.themeService=r,this.elementRef=a,this.type="audio",this.state=null,this.mode=null,this.veltElement=!0,this.subscriptions=[],this.componentId="velt-device-permission-button",this.loggingService.log("%c[WB] Creating CLASS: DevicePermissionButtonComponent","color: blue;")}ngOnInit(){try{this.loggingService.log("%c[WB] Calling DevicePermissionButtonComponent FUNCTION: ngOnInit","color: green;"),this.subscriptions.push(this.devicePermissionService.getPermissionState$(this.type).subscribe(e=>{this.state=e})),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in DevicePermissionButtonComponent onInit: ",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","button"),e.setAttribute("aria-label",`Device permission button for ${this.type}`)}catch(e){this.loggingService.catch("Error in DevicePermissionButtonComponent setupA11yAttributes:",e)}}openPermissionDeniedDialog(){try{this.loggingService.log("%c[WB] Calling DevicePermissionButtonComponent FUNCTION: openPermissionDeniedDialog","color: green;"),this.devicePermissionService.openDevicePermissionDeniedDialog(this.type,{darkMode:this.darkMode})}catch(e){this.loggingService.catch("Error in DevicePermissionButtonComponent openPermissionDeniedDialog: ",e)}}ngOnDestroy(){try{super.ngOnDestroy(),this.subscriptions.forEach(e=>{e.unsubscribe()})}catch{}}};o.\u0275fac=function(i){return new(i||o)(u(Pm),u(y),u(Ye),u(k))},o.\u0275cmp=O({type:o,selectors:[["app-device-permission-button"]],hostVars:1,hostBindings:function(i,r){i&2&&x("data-velt-element",r.veltElement)},inputs:{type:"type",state:"state",mode:"mode"},standalone:!1,features:[B],ngContentSelectors:iGt,decls:3,vars:2,consts:[[3,"ngSwitch"],[4,"ngSwitchCase"],[4,"ngSwitchDefault"],["role","button","tabindex","0","aria-label","Camera or microphone access is blocked. Click to learn how to enable it",1,"velt-device-permission-button--denied",3,"click"],["width","12","height","12","viewBox","0 0 12 12","fill","none","xmlns","http://www.w3.org/2000/svg","aria-hidden","true","role","img",1,"velt-device-permission-button--info-icon"],["width","12","height","12","rx","6","fill","currentColor"],["d","M6 9.495V9.5M6 7V2.5","stroke","white","stroke-width","1.25","stroke-linecap","round","stroke-linejoin","round"],["width","28","height","28","viewBox","0 0 28 28","fill","none","xmlns","http://www.w3.org/2000/svg","aria-hidden","true","role","img"],["d","M20.9375 17.6068C21.1017 17.5503 21.2442 17.444 21.345 17.3027C21.4459 17.1614 21.5 16.9921 21.5 16.8184V11.1818C21.4999 11.0398 21.4636 10.9002 21.3944 10.7762C21.3252 10.6522 21.2255 10.5479 21.1047 10.4733C20.9839 10.3986 20.846 10.3561 20.7042 10.3497C20.5623 10.3433 20.4212 10.3733 20.2942 10.4368L16.5 12.3334V13.1668V10.6667C16.5 10.2246 16.3244 9.80072 16.0118 9.48816C15.6993 9.17559 15.2754 9 14.8333 9H12.3333M16.5 16.5V17.3333C16.5 17.7754 16.3244 18.1993 16.0118 18.5118C15.6993 18.8244 15.2754 19 14.8333 19H8.16667C7.72464 19 7.30072 18.8244 6.98816 18.5118C6.67559 18.1993 6.5 17.7754 6.5 17.3333V10.6667C6.5 10.2246 6.67559 9.80072 6.98816 9.48816C7.30072 9.17559 7.72464 9 8.16667 9H9","stroke","currentColor","stroke-opacity","0.52","stroke-width","1.25","stroke-linecap","round","stroke-linejoin","round"],["d","M6.5 6.5L21.5 21.5","stroke","currentColor","stroke-width","1.25","stroke-linecap","round","stroke-linejoin","round"],["d","M11.5013 8.1665C11.5013 7.50346 11.7647 6.86758 12.2335 6.39874C12.7024 5.9299 13.3383 5.6665 14.0013 5.6665C14.6643 5.6665 15.3002 5.9299 15.7691 6.39874C16.2379 6.86758 16.5013 7.50346 16.5013 8.1665V12.3332C16.5013 12.58 16.4648 12.8254 16.393 13.0615M14.7263 14.7282C14.3527 14.8414 13.9578 14.8655 13.5732 14.7987C13.1885 14.7318 12.8249 14.5758 12.5114 14.3432C12.198 14.1105 11.9433 13.8077 11.7679 13.459C11.5925 13.1102 11.5012 12.7252 11.5013 12.3348V11.5015M8.16797 12.3332C8.16779 13.386 8.45252 14.4192 8.99198 15.3232C9.53144 16.2273 10.3055 16.9685 11.2321 17.4683C12.1587 17.9681 13.2033 18.2078 14.2551 18.162C15.3069 18.1162 16.3267 17.7866 17.2063 17.2082M18.873 15.5415C19.5012 14.5896 19.835 13.4737 19.833 12.3332M10.668 21.4998H17.3346M14.0013 18.1665V21.4998","stroke","currentColor","stroke-opacity","0.52","stroke-width","1.25","stroke-linecap","round","stroke-linejoin","round"]],template:function(i,r){i&1&&(Vt(),f(0,0),g(1,aGt,8,8,"ng-container",1)(2,sGt,2,0,"ng-container",2),v()),i&2&&(c("ngSwitch",r.state),d(),c("ngSwitchCase","denied"))},dependencies:[Li,Yi,pd],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}[_nghost-%COMP%]{--velt-green: var(--velt-light-mode-green);--velt-magenta: var(--velt-light-mode-magenta);--velt-amber: var(--velt-light-mode-amber);--velt-purple: var(--velt-light-mode-purple);--velt-cyan: var(--velt-light-mode-cyan);--velt-orange: var(--velt-light-mode-orange);--velt-black: var(--velt-light-mode-black);--velt-white: var(--velt-light-mode-white);--velt-gray: var(--velt-light-mode-gray);--velt-error: var(--velt-light-mode-error);--velt-error-hover: var(--velt-light-mode-error-hover);--velt-error-foreground: var(--velt-light-mode-error-foreground);--velt-error-light: var(--velt-light-mode-error-light);--velt-error-transparent: var(--velt-light-mode-error-transparent);--velt-warning: var(--velt-light-mode-warning);--velt-warning-hover: var(--velt-light-mode-warning-hover);--velt-warning-foreground: var(--velt-light-mode-warning-foreground);--velt-warning-light: var(--velt-light-mode-warning-light);--velt-warning-transparent: var(--velt-light-mode-warning-transparent);--velt-success: var(--velt-light-mode-success);--velt-success-hover: var(--velt-light-mode-success-hover);--velt-success-foreground: var(--velt-light-mode-success-foreground);--velt-success-light: var(--velt-light-mode-success-light);--velt-success-transparent: var(--velt-light-mode-success-transparent);--velt-accent: var(--velt-light-mode-accent);--velt-accent-text: var(--velt-light-mode-accent-text);--velt-accent-hover: var(--velt-light-mode-accent-hover);--velt-accent-foreground: var(--velt-light-mode-accent-foreground);--velt-accent-light: var(--velt-light-mode-accent-light);--velt-accent-transparent: var(--velt-light-mode-accent-transparent);--velt-text-0: var(--velt-light-mode-text-0);--velt-text-1: var(--velt-light-mode-text-1);--velt-text-2: var(--velt-light-mode-text-2);--velt-text-3: var(--velt-light-mode-text-3);--velt-text-4: var(--velt-light-mode-text-4);--velt-text-5: var(--velt-light-mode-text-5);--velt-text-6: var(--velt-light-mode-text-6);--velt-text-7: var(--velt-light-mode-text-7);--velt-text-8: var(--velt-light-mode-text-8);--velt-text-9: var(--velt-light-mode-text-9);--velt-text-10: var(--velt-light-mode-text-10);--velt-text-11: var(--velt-light-mode-text-11);--velt-text-12: var(--velt-light-mode-text-12);--velt-background-0: var(--velt-light-mode-background-0);--velt-background-1: var(--velt-light-mode-background-1);--velt-background-2: var(--velt-light-mode-background-2);--velt-background-3: var(--velt-light-mode-background-3);--velt-background-4: var(--velt-light-mode-background-4);--velt-background-5: var(--velt-light-mode-background-5);--velt-background-6: var(--velt-light-mode-background-6);--velt-background-7: var(--velt-light-mode-background-7);--velt-background-8: var(--velt-light-mode-background-8);--velt-background-9: var(--velt-light-mode-background-9);--velt-background-10: var(--velt-light-mode-background-10);--velt-border-0: var(--velt-light-mode-border-0);--velt-border-1: var(--velt-light-mode-border-1);--velt-border-2: var(--velt-light-mode-border-2);--velt-border-3: var(--velt-light-mode-border-3);--velt-border-4: var(--velt-light-mode-border-4);--velt-border-5: var(--velt-light-mode-border-5);--velt-border-6: var(--velt-light-mode-border-6);--velt-border-7: var(--velt-light-mode-border-7);--velt-border-8: var(--velt-light-mode-border-8);--velt-border-9: var(--velt-light-mode-border-9);--velt-border-10: var(--velt-light-mode-border-10);--velt-background-transparent: var(--velt-light-mode-background-transparent);--velt-border-transparent: var(--velt-light-mode-border-transparent);--velt-animation-transparent: var(--velt-light-mode-animation-transparent)}[dark][_nghost-%COMP%]{--velt-green: var(--velt-dark-mode-green);--velt-magenta: var(--velt-dark-mode-magenta);--velt-amber: var(--velt-dark-mode-amber);--velt-purple: var(--velt-dark-mode-purple);--velt-cyan: var(--velt-dark-mode-cyan);--velt-orange: var(--velt-dark-mode-orange);--velt-black: var(--velt-dark-mode-black);--velt-white: var(--velt-dark-mode-white);--velt-gray: var(--velt-dark-mode-gray);--velt-error: var(--velt-dark-mode-error);--velt-error-hover: var(--velt-dark-mode-error-hover);--velt-error-foreground: var(--velt-dark-mode-error-foreground);--velt-error-light: var(--velt-dark-mode-error-light);--velt-error-transparent: var(--velt-dark-mode-error-transparent);--velt-warning: var(--velt-dark-mode-warning);--velt-warning-hover: var(--velt-dark-mode-warning-hover);--velt-warning-foreground: var(--velt-dark-mode-warning-foreground);--velt-warning-light: var(--velt-dark-mode-warning-light);--velt-warning-transparent: var(--velt-dark-mode-warning-transparent);--velt-success: var(--velt-dark-mode-success);--velt-success-hover: var(--velt-dark-mode-success-hover);--velt-success-foreground: var(--velt-dark-mode-success-foreground);--velt-success-light: var(--velt-dark-mode-success-light);--velt-success-transparent: var(--velt-dark-mode-success-transparent);--velt-accent: var(--velt-dark-mode-accent);--velt-accent-text: var(--velt-dark-mode-accent-text);--velt-accent-hover: var(--velt-dark-mode-accent-hover);--velt-accent-foreground: var(--velt-dark-mode-accent-foreground);--velt-accent-light: var(--velt-dark-mode-accent-light);--velt-accent-transparent: var(--velt-dark-mode-accent-transparent);--velt-text-0: var(--velt-dark-mode-text-0);--velt-text-1: var(--velt-dark-mode-text-1);--velt-text-2: var(--velt-dark-mode-text-2);--velt-text-3: var(--velt-dark-mode-text-3);--velt-text-4: var(--velt-dark-mode-text-4);--velt-text-5: var(--velt-dark-mode-text-5);--velt-text-6: var(--velt-dark-mode-text-6);--velt-text-7: var(--velt-dark-mode-text-7);--velt-text-8: var(--velt-dark-mode-text-8);--velt-text-9: var(--velt-dark-mode-text-9);--velt-text-10: var(--velt-dark-mode-text-10);--velt-text-11: var(--velt-dark-mode-text-11);--velt-text-12: var(--velt-dark-mode-text-12);--velt-background-0: var(--velt-dark-mode-background-0);--velt-background-1: var(--velt-dark-mode-background-1);--velt-background-2: var(--velt-dark-mode-background-2);--velt-background-3: var(--velt-dark-mode-background-3);--velt-background-4: var(--velt-dark-mode-background-4);--velt-background-5: var(--velt-dark-mode-background-5);--velt-background-6: var(--velt-dark-mode-background-6);--velt-background-7: var(--velt-dark-mode-background-7);--velt-background-8: var(--velt-dark-mode-background-8);--velt-background-9: var(--velt-dark-mode-background-9);--velt-background-10: var(--velt-dark-mode-background-10);--velt-border-0: var(--velt-dark-mode-border-0);--velt-border-1: var(--velt-dark-mode-border-1);--velt-border-2: var(--velt-dark-mode-border-2);--velt-border-3: var(--velt-dark-mode-border-3);--velt-border-4: var(--velt-dark-mode-border-4);--velt-border-5: var(--velt-dark-mode-border-5);--velt-border-6: var(--velt-dark-mode-border-6);--velt-border-7: var(--velt-dark-mode-border-7);--velt-border-8: var(--velt-dark-mode-border-8);--velt-border-9: var(--velt-dark-mode-border-9);--velt-border-10: var(--velt-dark-mode-border-10);--velt-background-transparent: var(--velt-dark-mode-background-transparent);--velt-border-transparent: var(--velt-dark-mode-border-transparent);--velt-animation-transparent: var(--velt-dark-mode-animation-transparent)}.velt-device-permission-button--denied[_ngcontent-%COMP%]{padding:var(--velt-spacing-md);display:flex;align-items:center;justify-content:center;border-radius:var(--velt-border-radius-full);cursor:pointer;background:var(--velt-error-transparent);position:relative;color:var(--velt-error)}.velt-device-permission-button--denied.thread-mode[_ngcontent-%COMP%]{background:none;padding:var(--velt-spacing-2xs)}.velt-device-permission-button--info-icon[_ngcontent-%COMP%]{position:absolute;top:1px;right:1px}"],changeDetection:0});let n=o;return n})();function cGt(n,o){if(n&1){let t=q();C(0,"div",22),G("click",function(){N(t);let i=l().$implicit,r=l(2);return F(r.followUser(i))}),w(1,"snippyly-user-avatar",23),S()}if(n&2){let t=l().$implicit,e=l().ngIf;ge("s-current-user",(e.user==null?null:e.user.userSnippylyId)===(t==null?null:t.userSnippylyId)),d(),c("user",t)}}function mGt(n,o){if(n&1&&(f(0),g(1,cGt,2,3,"div",21),v()),n&2){let t=o.index,e=l().ngIf;d(),c("ngIf",t<e.maxAttendees)}}function dGt(n,o){if(n&1&&(C(0,"button"),te(1),S()),n&2){let t=l().ngIf;d(),je("+"+((t.attendees==null?null:t.attendees.length)-t.maxAttendees))}}function pGt(n,o){n&1&&(le(),C(0,"svg",24),w(1,"path",25),S())}function gGt(n,o){n&1&&(le(),C(0,"svg",26),w(1,"path",27)(2,"path",28),S())}function uGt(n,o){n&1&&(le(),C(0,"svg",29),w(1,"path",30),S())}function hGt(n,o){n&1&&(le(),C(0,"svg",26)(1,"g"),w(2,"path",31)(3,"path",28),S(),C(4,"defs")(5,"clipPath",32),w(6,"rect",33),S()()())}function fGt(n,o){n&1&&(f(0),le(),C(1,"svg",26)(2,"g"),w(3,"path",35)(4,"path",36)(5,"path",37)(6,"path",38)(7,"path",28),S(),C(8,"defs")(9,"clipPath",39),w(10,"rect",33),S()()(),v())}function vGt(n,o){n&1&&(le(),C(0,"svg",26)(1,"g"),w(2,"path",40)(3,"path",41)(4,"path",37)(5,"path",38)(6,"path",28),S(),C(7,"defs")(8,"clipPath",42),w(9,"rect",33),S()()())}function CGt(n,o){n&1&&(le(),C(0,"svg",26),w(1,"path",43)(2,"path",44)(3,"path",45)(4,"path",46),S())}function _Gt(n,o){if(n&1&&g(0,vGt,10,0,"svg",11)(1,CGt,5,0,"svg",11),n&2){let t=l(2).ngIf;c("ngIf",!t.screenSharingState),d(),c("ngIf",t.screenSharingState)}}function yGt(n,o){if(n&1){let t=q();C(0,"button",8),G("click",function(){N(t);let i=l(2);return F(i.onToggleScreenSharingClick())}),C(1,"div",9),te(2),A(3,"translate"),A(4,"translate"),S(),g(5,fGt,11,0,"ng-container",34)(6,_Gt,2,2,"ng-template",null,0,De),S()}if(n&2){let t=pe(7),e=l().ngIf;d(2),ve("",e.screenSharingState?P(3,3,"Stop sharing"):P(4,5,"Share screen")," "),d(3),c("ngIf",e.screenSharingDisabled)("ngIfElse",t)}}function SGt(n,o){n&1&&(le(),C(0,"svg",26),w(1,"path",47),S())}function bGt(n,o){n&1&&(le(),C(0,"svg",26),w(1,"path",48),S())}function IGt(n,o){if(n&1){let t=q();C(0,"button",8),G("click",function(){N(t);let i=l(2);return F(i.onToggleHuddleCursorModeClick())}),g(1,SGt,2,0,"svg",11)(2,bGt,2,0,"svg",11),S()}if(n&2){let t=l().ngIf;d(),c("ngIf",!t.huddleOnCursorMode),d(),c("ngIf",t.huddleOnCursorMode)}}function EGt(n,o){if(n&1){let t=q();C(0,"button",8),G("click",function(){N(t);let i=l(2);return F(i.toggleMessagesPanel())}),C(1,"div",9),te(2),A(3,"translate"),S(),le(),C(4,"svg",17),w(5,"path",49),S()()}n&2&&(d(2),je(P(3,1,"Chat with everyone")))}function xGt(n,o){if(n&1){let t=q();f(0),C(1,"div",2)(2,"div",3)(3,"div",4),g(4,mGt,2,1,"ng-container",5)(5,dGt,2,1,"button",1),S(),C(6,"div",6)(7,"app-device-permission-button",7)(8,"button",8),G("click",function(){N(t);let i=l();return F(i.onToggleAudioClick())}),C(9,"div",9),te(10),A(11,"translate"),A(12,"translate"),S(),g(13,pGt,2,0,"svg",10)(14,gGt,3,0,"svg",11),S()(),C(15,"app-device-permission-button",12)(16,"button",8),G("click",function(){N(t);let i=l();return F(i.onToggleVideoClick())}),C(17,"div",9),te(18),A(19,"translate"),A(20,"translate"),S(),g(21,uGt,2,0,"svg",13)(22,hGt,7,0,"svg",11),S()(),g(23,yGt,8,7,"button",14)(24,IGt,3,2,"button",14),w(25,"snippyly-user-invite-tool-internal",15),A(26,"translate"),A(27,"translate"),g(28,EGt,6,3,"button",14),C(29,"button",16),G("click",function(){N(t);let i=l();return F(i.openMediaSourceOptionsDialog())}),C(30,"div",9),te(31),A(32,"translate"),A(33,"translate"),S(),le(),C(34,"svg",17),w(35,"path",18),S()()(),mt(),C(36,"div",19)(37,"button",20),G("click",function(){N(t);let i=l();return F(i.onLeaveClick())}),te(38),A(39,"translate"),S()()()(),v()}if(n&2){let t=o.ngIf,e=l();d(4),c("ngForOf",t.attendees)("ngForTrackBy",e.trackByAttendeeId),d(),c("ngIf",(t.attendees==null?null:t.attendees.length)>t.maxAttendees),d(2),c("darkMode",!0),d(3),ve("",t.audioState?P(11,20,"Click to mute"):P(12,22,"Click to unmute")," "),d(3),c("ngIf",t.audioState),d(),c("ngIf",!t.audioState),d(),c("darkMode",!0),d(3),ve("",t.videoState?P(19,24,"Turn off video"):P(20,26,"Turn on video")," "),d(3),c("ngIf",t.videoState),d(),c("ngIf",!t.videoState),d(),c("ngIf",t.screenSharingSupported),d(),c("ngIf",!t.hideHuddleOnCursor),d(),c("title",P(26,28,"Invite users to join this huddle"))("placeholder",P(27,30,"Please select a contact to invite"))("hideAccessControlDropdown",!0),d(3),c("ngIf",t.chatEnabled),d(),c("disabled",!t.audioState&&!t.videoState),d(2),je(!t.audioState&&!t.videoState?P(32,32,"Enable audio or video to change the settings"):P(33,34,"Change audio/video settings")),d(7),je(P(39,36,"Leave"))}}var jfe=(()=>{let o=class o{constructor(e,i,r,a,s,m){this.analyticsService=e,this.configService=i,this.flockService=r,this.huddleService=a,this.loggingService=s,this.dialog=m,this.attendees=[],this.toggleAudio=new Ae,this.toggleVideo=new Ae,this.toggleScreenSharing=new Ae,this.leave=new Ae,this.subscriptions=[],this.veltElement=!0,this.componentConfigSignal=Te({attendees:this.attendees,maxAttendees:4,audioState:this.audioState,videoState:this.videoState,chatEnabled:!1,huddleOnCursorMode:!1,hideHuddleOnCursor:!1,screenSharingState:this.screenSharingState,screenSharingDisabled:this.screenSharingDisabled,screenSharingSupported:!!navigator?.mediaDevices?.getDisplayMedia,user:this.user})}ngOnInit(){try{this.subscriptions.push(this.configService.getConfig$().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{hideHuddleOnCursor:!e?.featureAllowList?.find(r=>r===ke.CURSOR)}),i))},e=>{this.loggingService.catch("Error in HuddleMenuPanelComponent getConfig$: ",e)})),this.subscriptions.push(this.huddleService.getHuddleOnCursorMode$().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{huddleOnCursorMode:e}),i))},e=>{this.loggingService.catch("Error in HuddleMenuPanelComponent getHuddleOnCursorMode$: ",e)})),this.subscriptions.push(this.huddleService.getChatEnabled$().subscribe(e=>{this.componentConfigSignal.update(i=>(i=T(I({},i),{chatEnabled:e}),i))},e=>{this.loggingService.catch("Error in HuddleMenuPanelComponent getChatEnabled$: ",e)}))}catch(e){this.loggingService.catch("Error in HuddleMenuPanelComponent ngOnInit: ",e)}}ngOnChanges(e){try{this.loggingService.log("%c[WB] Calling HuddleMenuPanelComponent FUNCTION: ngOnChanges","color: green;"),e&&Object.keys(e).forEach(i=>{this.componentConfigSignal.update(r=>(r=T(I({},r),{[i]:e[i].currentValue}),r))})}catch(i){this.loggingService.catch("Error in HuddleMenuPanelComponent ngOnChanges: ",i)}}trackByAttendeeId(e,i){return i?.userId}onToggleAudioClick(){try{this.analyticsService.trackEvent(X.Events.Huddle.HUDDLE_AUDIO_BUTTON_CLICKED,{huddleType:this.huddleService.getInitialHuddleType(),totalUsers:this.huddleService.getHuddleAttendees()?.length||0,totalUserHuddleDuration:this.huddleService.getTotalUserHuddleDuration(),huddleSnippylyUserIds:this.huddleService.getHuddleAttendees()?.map(e=>e?.userSnippylyId),huddleClientUserIds:this.huddleService.getHuddleAttendees()?.map(e=>e?.userId)}),this.toggleAudio.emit()}catch(e){this.loggingService.catch("Error in HuddleMenuPanelComponent onToggleAudioClick: ",e)}}onToggleVideoClick(){try{this.analyticsService.trackEvent(X.Events.Huddle.HUDDLE_VIDEO_BUTTON_CLICKED,{huddleType:this.huddleService.getInitialHuddleType(),totalUsers:this.huddleService.getHuddleAttendees()?.length||0,totalUserHuddleDuration:this.huddleService.getTotalUserHuddleDuration(),huddleSnippylyUserIds:this.huddleService.getHuddleAttendees()?.map(e=>e?.userSnippylyId),huddleClientUserIds:this.huddleService.getHuddleAttendees()?.map(e=>e?.userId)}),this.toggleVideo.emit()}catch(e){this.loggingService.catch("Error in HuddleMenuPanelComponent onToggleVideoClick: ",e)}}onToggleScreenSharingClick(){try{this.analyticsService.trackEvent(X.Events.Huddle.HUDDLE_SCREENSHARING_BUTTON_CLICKED,{huddleType:this.huddleService.getInitialHuddleType(),totalUsers:this.huddleService.getHuddleAttendees()?.length||0,totalUserHuddleDuration:this.huddleService.getTotalUserHuddleDuration(),huddleSnippylyUserIds:this.huddleService.getHuddleAttendees()?.map(e=>e?.userSnippylyId),huddleClientUserIds:this.huddleService.getHuddleAttendees()?.map(e=>e?.userId)}),this.toggleScreenSharing.emit()}catch(e){this.loggingService.catch("Error in HuddleMenuPanelComponent onToggleScreenSharingClick: ",e)}}onToggleHuddleCursorModeClick(){try{this.componentConfigSignal().huddleOnCursorMode?this.huddleService.disableHuddleOnCursorMode():this.huddleService.enableHuddleOnCursorMode()}catch(e){this.loggingService.catch("Error in HuddleMenuPanelComponent onToggleHuddleCursorModeClick: ",e)}}openMediaSourceOptionsDialog(){try{this.subscriptions.push(this.dialog.open(Lfe,{data:{settingsVisible:{audio:this.componentConfigSignal().audioState,video:this.componentConfigSignal().videoState}}}).afterClosed().pipe(tt(1)).subscribe(e=>{e&&(this.componentConfigSignal().audioState&&this.huddleService.toggleLocalStreamAudio(!0),this.componentConfigSignal().videoState&&this.huddleService.toggleLocalStreamVideo(!0))}))}catch(e){this.loggingService.catch("Error in HuddleMenuPanelComponent mediaSourceOptionsDialog: ",e)}}onLeaveClick(){this.leave.emit()}toggleMessagesPanel(){try{this.loggingService.log("%c[WB] Calling FUNCTION: toggleMessagesPanel","color: green;"),this.huddleService.toggleMessagesPanel()}catch(e){this.loggingService.catch("Error in HuddleMenuPanelComponent toggleMessagesPanel: ",e)}}followUser(e){try{this.huddleService.getFlockModeOnAvatarClick()&&this.flockService.getFlockMode()&&this.componentConfigSignal().user?.userSnippylyId!==e.userSnippylyId&&this.flockService.setFlockLeader(e.userSnippylyId,e.name)}catch(i){this.loggingService.catch("Error in HuddleMenuPanelComponent followUser: ",i)}}ngOnDestroy(){try{this.subscriptions.forEach(e=>e?.unsubscribe())}catch(e){this.loggingService.catch("Error in HuddleMenuPanelComponent ngOnDestroy: ",e)}}};o.\u0275fac=function(i){return new(i||o)(u(Ze),u(jt),u(Ac),u(pr),u(y),u(Ki))},o.\u0275cmp=O({type:o,selectors:[["snippyly-huddle-menu-panel"]],hostVars:1,hostBindings:function(i,r){i&2&&x("data-velt-element",r.veltElement)},inputs:{stream:"stream",selected:"selected",isRemoteStream:"isRemoteStream",user:"user",audioState:"audioState",videoState:"videoState",screenSharingState:"screenSharingState",screenSharingDisabled:"screenSharingDisabled",attendees:"attendees"},outputs:{toggleAudio:"toggleAudio",toggleVideo:"toggleVideo",toggleScreenSharing:"toggleScreenSharing",leave:"leave"},standalone:!1,features:[Xe],decls:1,vars:1,consts:[["screenSharingToggleBtnRef",""],[4,"ngIf"],[1,"reply-div","input-text-wrap"],[1,"action-menu"],[1,"pins-wrap"],[4,"ngFor","ngForOf","ngForTrackBy"],[1,"actions-wrap"],["type","audio",3,"darkMode"],[1,"action__button","tooltip",3,"click"],[1,"tooltiptext"],["width","20","height","20","viewBox","0 0 13 19","fill","none","xmlns","http://www.w3.org/2000/svg",4,"ngIf"],["width","20","height","20","viewBox","0 0 20 20","fill","none","xmlns","http://www.w3.org/2000/svg",4,"ngIf"],["type","video",3,"darkMode"],["width","20","height","20","viewBox","0 0 19 11","fill","none","xmlns","http://www.w3.org/2000/svg",4,"ngIf"],["class","action__button tooltip",3,"click",4,"ngIf"],["type","invite","source","Huddle",3,"title","placeholder","hideAccessControlDropdown"],[1,"action__button","tooltip",3,"click","disabled"],["width","24","height","24","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg"],["d","M19.5 12C19.5 11.77 19.49 11.55 19.47 11.32L21.33 9.91C21.73 9.61 21.84 9.05 21.59 8.61L19.72 5.38C19.47 4.94 18.93 4.76 18.47 4.96L16.32 5.87C15.95 5.61 15.56 5.38 15.15 5.19L14.86 2.88C14.8 2.38 14.37 2 13.87 2H10.14C9.63003 2 9.20003 2.38 9.14003 2.88L8.85003 5.19C8.44003 5.38 8.05003 5.61 7.68003 5.87L5.53003 4.96C5.07003 4.76 4.53003 4.94 4.28003 5.38L2.41003 8.62C2.16003 9.06 2.27003 9.61 2.67003 9.92L4.53003 11.33C4.51003 11.55 4.50003 11.77 4.50003 12C4.50003 12.23 4.51003 12.45 4.53003 12.68L2.67003 14.09C2.27003 14.39 2.16003 14.95 2.41003 15.39L4.28003 18.62C4.53003 19.06 5.07003 19.24 5.53003 19.04L7.68003 18.13C8.05003 18.39 8.44003 18.62 8.85003 18.81L9.14003 21.12C9.20003 21.62 9.63003 22 10.13 22H13.86C14.36 22 14.79 21.62 14.85 21.12L15.14 18.81C15.55 18.62 15.94 18.39 16.31 18.13L18.46 19.04C18.92 19.24 19.46 19.06 19.71 18.62L21.58 15.39C21.83 14.95 21.72 14.4 21.32 14.09L19.46 12.68C19.49 12.45 19.5 12.23 19.5 12ZM12.04 15.5C10.11 15.5 8.54003 13.93 8.54003 12C8.54003 10.07 10.11 8.5 12.04 8.5C13.97 8.5 15.54 10.07 15.54 12C15.54 13.93 13.97 15.5 12.04 15.5Z","fill","#fff"],[1,"buttons-wrap"],[1,"secondary",3,"click"],["class","pin2",3,"s-current-user","click",4,"ngIf"],[1,"pin2",3,"click"],[1,"huddle-menu-panel-user-avatar",3,"user"],["width","20","height","20","viewBox","0 0 13 19","fill","none","xmlns","http://www.w3.org/2000/svg"],["fill-rule","evenodd","clip-rule","evenodd","d","M5.77526 0.888917C4.98766 1.03653 4.34477 1.39041 3.76525 1.99544C3.26289 2.51988 2.94255 3.10884 2.75974 3.84431C2.69679 4.09753 2.6908 4.39635 2.6908 7.29276C2.6908 10.7979 2.68044 10.6352 2.94799 11.327C3.299 12.2346 4.07584 13.0561 4.94368 13.4374C5.82412 13.8243 6.82444 13.8531 7.71552 13.5173C8.69181 13.1494 9.53872 12.2934 9.92297 11.2862C10.1713 10.6354 10.1631 10.7714 10.1631 7.29276C10.1631 3.78764 10.1735 3.95032 9.90592 3.25855C9.62932 2.54335 9.02923 1.81042 8.38767 1.40419C7.61998 0.918084 6.64549 0.725873 5.77526 0.888917ZM6.9551 2.18212C7.80033 2.36379 8.55484 3.08137 8.82443 3.95997C8.91085 4.24162 8.9112 4.25479 8.9112 7.29276C8.9112 10.3307 8.91085 10.3439 8.82443 10.6256C8.578 11.4287 7.92854 12.0994 7.15071 12.3538C6.92897 12.4264 6.7875 12.4431 6.40739 12.4415C6.00213 12.4398 5.89869 12.425 5.65097 12.3333C5.00401 12.0936 4.49038 11.6376 4.2051 11.0497C3.92221 10.4667 3.92452 10.4977 3.92452 7.29276C3.92452 4.09736 3.92315 4.11587 4.19825 3.55135C4.71228 2.49645 5.83136 1.94067 6.9551 2.18212ZM0.537139 8.64006C0.373453 8.71677 0.215048 8.92183 0.182929 9.09861C0.133831 9.36895 0.199086 10.6794 0.283042 11.1082C0.737953 13.4317 2.32631 15.2803 4.50075 16.017C4.75328 16.1025 5.14915 16.2055 5.38044 16.2458L5.801 16.3192V16.9744V17.6296L5.06042 17.6421C4.38416 17.6536 4.31046 17.6619 4.21195 17.738C4.00671 17.8964 3.94271 18.0255 3.94271 18.2809C3.94271 18.5363 4.00679 18.6655 4.21206 18.8237C4.31804 18.9055 4.36006 18.907 6.42696 18.907C8.49385 18.907 8.53586 18.9055 8.64185 18.8237C8.84712 18.6655 8.9112 18.5363 8.9112 18.2809C8.9112 18.0255 8.8472 17.8964 8.64196 17.738C8.54346 17.6619 8.46975 17.6536 7.79349 17.6421L7.05291 17.6296V16.9744V16.3192L7.47347 16.2469C9.74567 15.8564 11.6474 14.1569 12.3699 11.8711C12.6066 11.1222 12.6648 10.7131 12.6659 9.79054C12.6668 9.05017 12.6614 8.98828 12.5862 8.8841C12.4332 8.67197 12.3081 8.60568 12.0605 8.60568C11.8131 8.60568 11.6881 8.67181 11.5348 8.88378C11.4622 8.9842 11.4515 9.07453 11.4282 9.79025C11.4001 10.6516 11.3449 11.0079 11.1515 11.5749C10.8931 12.3325 10.527 12.9264 9.95298 13.5192C9.22696 14.2689 8.41181 14.7274 7.405 14.9524C6.91168 15.0626 5.87256 15.0542 5.38588 14.936C4.37192 14.6897 3.6185 14.2601 2.90093 13.5192C2.32689 12.9264 1.96079 12.3325 1.70239 11.5749C1.50901 11.0079 1.45377 10.6516 1.42568 9.79025C1.39755 8.92635 1.3871 8.88689 1.13621 8.69342C1.00672 8.5936 0.695505 8.56589 0.537139 8.64006Z","fill","#FF7162"],["width","20","height","20","viewBox","0 0 20 20","fill","none","xmlns","http://www.w3.org/2000/svg"],["fill-rule","evenodd","clip-rule","evenodd","d","M9.77526 0.888917C8.98766 1.03653 8.34477 1.39041 7.76525 1.99544C7.26289 2.51988 6.94255 3.10884 6.75974 3.84431C6.69679 4.09753 6.6908 4.39635 6.6908 7.29276C6.6908 10.7979 6.68044 10.6352 6.94799 11.327C7.299 12.2346 8.07584 13.0561 8.94368 13.4374C9.82412 13.8243 10.8244 13.8531 11.7155 13.5173C12.6918 13.1494 13.5387 12.2934 13.923 11.2862C14.1713 10.6354 14.1631 10.7714 14.1631 7.29276C14.1631 3.78764 14.1735 3.95032 13.9059 3.25855C13.6293 2.54335 13.0292 1.81042 12.3877 1.40419C11.62 0.918084 10.6455 0.725873 9.77526 0.888917ZM10.9551 2.18212C11.8003 2.36379 12.5548 3.08137 12.8244 3.95997C12.9108 4.24162 12.9112 4.25479 12.9112 7.29276C12.9112 10.3307 12.9108 10.3439 12.8244 10.6256C12.578 11.4287 11.9285 12.0994 11.1507 12.3538C10.929 12.4264 10.7875 12.4431 10.4074 12.4415C10.0021 12.4398 9.89869 12.425 9.65097 12.3333C9.00401 12.0936 8.49038 11.6376 8.2051 11.0497C7.92221 10.4667 7.92452 10.4977 7.92452 7.29276C7.92452 4.09736 7.92315 4.11587 8.19825 3.55135C8.71228 2.49645 9.83136 1.94067 10.9551 2.18212ZM4.53714 8.64006C4.37345 8.71677 4.21505 8.92183 4.18293 9.09861C4.13383 9.36895 4.19909 10.6794 4.28304 11.1082C4.73795 13.4317 6.32631 15.2803 8.50075 16.017C8.75328 16.1025 9.14915 16.2055 9.38044 16.2458L9.801 16.3192V16.9744V17.6296L9.06042 17.6421C8.38416 17.6536 8.31046 17.6619 8.21195 17.738C8.00671 17.8964 7.94271 18.0255 7.94271 18.2809C7.94271 18.5363 8.00679 18.6655 8.21206 18.8237C8.31804 18.9055 8.36006 18.907 10.427 18.907C12.4938 18.907 12.5359 18.9055 12.6418 18.8237C12.8471 18.6655 12.9112 18.5363 12.9112 18.2809C12.9112 18.0255 12.8472 17.8964 12.642 17.738C12.5435 17.6619 12.4697 17.6536 11.7935 17.6421L11.0529 17.6296V16.9744V16.3192L11.4735 16.2469C13.7457 15.8564 15.6474 14.1569 16.3699 11.8711C16.6066 11.1222 16.6648 10.7131 16.6659 9.79054C16.6668 9.05017 16.6614 8.98828 16.5862 8.8841C16.4332 8.67197 16.3081 8.60568 16.0605 8.60568C15.8131 8.60568 15.6881 8.67181 15.5348 8.88378C15.4622 8.9842 15.4515 9.07453 15.4282 9.79025C15.4001 10.6516 15.3449 11.0079 15.1515 11.5749C14.8931 12.3325 14.527 12.9264 13.953 13.5192C13.227 14.2689 12.4118 14.7274 11.405 14.9524C10.9117 15.0626 9.87256 15.0542 9.38588 14.936C8.37192 14.6897 7.6185 14.2601 6.90093 13.5192C6.32689 12.9264 5.96079 12.3325 5.70239 11.5749C5.50901 11.0079 5.45377 10.6516 5.42568 9.79025C5.39755 8.92636 5.3871 8.88689 5.13621 8.69342C5.00672 8.5936 4.69551 8.56589 4.53714 8.64006Z","fill","white"],["d","M19 1L1 19","stroke","#FF7162","stroke-width","1.4","stroke-linecap","round"],["width","20","height","20","viewBox","0 0 19 11","fill","none","xmlns","http://www.w3.org/2000/svg"],["fill-rule","evenodd","clip-rule","evenodd","d","M2.55139 0.23203C1.68754 0.455725 1.06855 1.0239 0.766641 1.87017L0.666016 2.15221V5.58961V9.027L0.766892 9.30905C1.0535 10.1102 1.64038 10.6751 2.43987 10.9192L2.70863 11.0013H7.1343H11.56L11.8467 10.9053C12.6234 10.645 13.2099 10.0654 13.47 9.30122C13.56 9.03659 13.5637 8.9921 13.5769 8.03104C13.5844 7.48324 13.6004 7.03508 13.6125 7.03508C13.661 7.03508 15.0857 7.85713 15.8518 8.32715C16.7188 8.85908 16.9126 8.93887 17.338 8.93887C18.0692 8.93887 18.7509 8.40866 18.947 7.6873C19.0174 7.42849 19.0165 3.7478 18.946 3.48726C18.7883 2.90449 18.278 2.40845 17.7016 2.27772C17.4483 2.22025 17.0895 2.2339 16.8373 2.31054C16.6848 2.35687 16.3699 2.52617 15.9107 2.80867C15.3288 3.16675 13.6405 4.14414 13.6039 4.14414C13.5979 4.14414 13.5847 3.71184 13.5747 3.18343C13.5543 2.10543 13.5363 1.99899 13.2916 1.50796C13.0166 0.956034 12.475 0.494788 11.8467 0.277192L11.56 0.177913L7.18806 0.170686C2.95948 0.163705 2.80747 0.165715 2.55139 0.23203ZM11.3211 1.83643C11.5404 1.90052 11.7306 2.05381 11.8398 2.25463L11.9183 2.399V5.57293V8.74683L11.8268 8.92184C11.7122 9.14091 11.4929 9.30852 11.2552 9.35869C11.0123 9.40995 3.20786 9.41115 2.98224 9.35999C2.74243 9.30559 2.53297 9.14483 2.42553 8.93266L2.33236 8.74873V5.58961V2.43048L2.42553 2.24656C2.52985 2.04059 2.7435 1.87225 2.96604 1.82078C3.04208 1.80318 4.88581 1.78753 7.11882 1.78556C10.641 1.78245 11.1578 1.78873 11.3211 1.83643ZM17.3116 5.59366V7.28997L17.2309 7.23801C16.8358 6.98339 15.6936 6.30427 15.1359 5.99233C14.7573 5.78052 14.4468 5.5987 14.4461 5.5883C14.4453 5.57787 14.7874 5.37536 15.2062 5.13827C15.6251 4.90114 16.258 4.52634 16.6128 4.30536C16.9675 4.08438 17.2699 3.90215 17.2847 3.90045C17.2995 3.89876 17.3116 4.6607 17.3116 5.59366Z","fill","#FF7162"],["fill-rule","evenodd","clip-rule","evenodd","d","M3.55139 4.23203C2.68754 4.45573 2.06855 5.0239 1.76664 5.87017L1.66602 6.15221V9.58961V13.027L1.76689 13.309C2.0535 14.1102 2.64038 14.6751 3.43987 14.9192L3.70863 15.0013H8.1343H12.56L12.8467 14.9053C13.6234 14.645 14.2099 14.0654 14.47 13.3012C14.56 13.0366 14.5637 12.9921 14.5769 12.031C14.5844 11.4832 14.6004 11.0351 14.6125 11.0351C14.661 11.0351 16.0857 11.8571 16.8518 12.3271C17.7188 12.8591 17.9126 12.9389 18.338 12.9389C19.0692 12.9389 19.7509 12.4087 19.947 11.6873C20.0174 11.4285 20.0165 7.7478 19.946 7.48726C19.7883 6.90449 19.278 6.40845 18.7016 6.27772C18.4483 6.22025 18.0895 6.2339 17.8373 6.31054C17.6848 6.35687 17.3699 6.52617 16.9107 6.80867C16.3288 7.16675 14.6405 8.14414 14.6039 8.14414C14.5979 8.14414 14.5847 7.71184 14.5747 7.18343C14.5543 6.10543 14.5363 5.99899 14.2916 5.50796C14.0166 4.95603 13.475 4.49479 12.8467 4.27719L12.56 4.17791L8.18806 4.17069C3.95948 4.16371 3.80747 4.16571 3.55139 4.23203ZM12.3211 5.83643C12.5404 5.90052 12.7306 6.05381 12.8398 6.25463L12.9183 6.399V9.57293V12.7468L12.8268 12.9218C12.7122 13.1409 12.4929 13.3085 12.2552 13.3587C12.0123 13.4099 4.20786 13.4111 3.98224 13.36C3.74243 13.3056 3.53297 13.1448 3.42553 12.9327L3.33236 12.7487V9.58961V6.43048L3.42553 6.24656C3.52985 6.04059 3.7435 5.87225 3.96604 5.82078C4.04208 5.80318 5.88581 5.78753 8.11882 5.78556C11.641 5.78245 12.1578 5.78873 12.3211 5.83643ZM18.3116 9.59366V11.29L18.2309 11.238C17.8358 10.9834 16.6936 10.3043 16.1359 9.99233C15.7573 9.78052 15.4468 9.5987 15.4461 9.5883C15.4453 9.57787 15.7874 9.37536 16.2062 9.13827C16.6251 8.90114 17.258 8.52634 17.6128 8.30536C17.9675 8.08438 18.2699 7.90215 18.2847 7.90045C18.2995 7.89876 18.3116 8.6607 18.3116 9.59366Z","fill","white"],["id","clip0_2334_10689"],["width","20","height","20","fill","white"],[4,"ngIf","ngIfElse"],["d","M7.50016 15H9.16683V16.6667H10.8335V15H12.5002V16.6667H13.3335C13.7937 16.6667 14.1668 17.0398 14.1668 17.5C14.1668 17.9602 13.7937 18.3333 13.3335 18.3333H6.66683C6.20659 18.3333 5.8335 17.9602 5.8335 17.5C5.8335 17.0398 6.20659 16.6667 6.66683 16.6667H7.50016V15Z","fill","white"],["fill-rule","evenodd","clip-rule","evenodd","d","M3.33317 5L3.33317 11.6667C3.33317 12.5871 4.07936 13.3333 4.99984 13.3333L14.9998 13.3333C15.9203 13.3333 16.6665 12.5871 16.6665 11.6667L16.6665 5C16.6665 4.07953 15.9203 3.33333 14.9998 3.33333L4.99984 3.33333C4.07936 3.33333 3.33317 4.07953 3.33317 5ZM1.6665 11.6667C1.6665 13.5076 3.15889 15 4.99984 15L14.9998 15C16.8408 15 18.3332 13.5076 18.3332 11.6667L18.3332 5C18.3332 3.15905 16.8408 1.66667 14.9998 1.66667L4.99984 1.66667C3.15889 1.66667 1.6665 3.15905 1.6665 5L1.6665 11.6667Z","fill","white"],["d","M5.83333 5C5.3731 5 5 5.3731 5 5.83333C5 6.29357 5.3731 6.66667 5.83333 6.66667H11.6667C12.1269 6.66667 12.5 6.29357 12.5 5.83333C12.5 5.3731 12.1269 5 11.6667 5H5.83333Z","fill","white"],["d","M5.83333 8.33333C5.3731 8.33333 5 8.70643 5 9.16667C5 9.6269 5.3731 10 5.83333 10H7.5C7.96024 10 8.33333 9.6269 8.33333 9.16667C8.33333 8.70643 7.96024 8.33333 7.5 8.33333H5.83333Z","fill","white"],["id","clip0_2260_32847"],["d","M7.50065 15H9.16732V16.6667H10.834V15H12.5007V16.6667H13.334C13.7942 16.6667 14.1673 17.0398 14.1673 17.5C14.1673 17.9602 13.7942 18.3333 13.334 18.3333H6.66732C6.20708 18.3333 5.83398 17.9602 5.83398 17.5C5.83398 17.0398 6.20708 16.6667 6.66732 16.6667H7.50065V15Z","fill","white"],["fill-rule","evenodd","clip-rule","evenodd","d","M3.33268 5L3.33268 11.6667C3.33268 12.5871 4.07887 13.3333 4.99935 13.3333L14.9993 13.3333C15.9198 13.3333 16.666 12.5871 16.666 11.6667L16.666 5C16.666 4.07953 15.9198 3.33333 14.9993 3.33333L4.99935 3.33333C4.07887 3.33333 3.33268 4.07953 3.33268 5ZM1.66602 11.6667C1.66602 13.5076 3.1584 15 4.99935 15L14.9993 15C16.8403 15 18.3327 13.5076 18.3327 11.6667L18.3327 5C18.3327 3.15905 16.8403 1.66667 14.9993 1.66667L4.99935 1.66667C3.1584 1.66667 1.66602 3.15905 1.66602 5L1.66602 11.6667Z","fill","white"],["id","clip0_2305_6167"],["d","M7.50016 15H9.16683V16.6667H10.8335V15H12.5002V16.6667H13.3335C13.7937 16.6667 14.1668 17.0398 14.1668 17.5C14.1668 17.9602 13.7937 18.3333 13.3335 18.3333H6.66683C6.20659 18.3333 5.8335 17.9602 5.8335 17.5C5.8335 17.0398 6.20659 16.6667 6.66683 16.6667H7.50016V15Z","fill","#FF7162"],["fill-rule","evenodd","clip-rule","evenodd","d","M3.33317 5L3.33317 11.6667C3.33317 12.5871 4.07936 13.3333 4.99984 13.3333L14.9998 13.3333C15.9203 13.3333 16.6665 12.5871 16.6665 11.6667L16.6665 5C16.6665 4.07953 15.9203 3.33333 14.9998 3.33333L4.99984 3.33333C4.07936 3.33333 3.33317 4.07953 3.33317 5ZM1.6665 11.6667C1.6665 13.5076 3.15889 15 4.99984 15L14.9998 15C16.8408 15 18.3332 13.5076 18.3332 11.6667L18.3332 5C18.3332 3.15905 16.8408 1.66667 14.9998 1.66667L4.99984 1.66667C3.15889 1.66667 1.6665 3.15905 1.6665 5L1.6665 11.6667Z","fill","#FF7162"],["d","M5.83333 5C5.3731 5 5 5.3731 5 5.83333C5 6.29357 5.3731 6.66667 5.83333 6.66667H11.6667C12.1269 6.66667 12.5 6.29357 12.5 5.83333C12.5 5.3731 12.1269 5 11.6667 5H5.83333Z","fill","#FF7162"],["d","M5.83333 8.33333C5.3731 8.33333 5 8.70643 5 9.16667C5 9.6269 5.3731 10 5.83333 10H7.5C7.96024 10 8.33333 9.6269 8.33333 9.16667C8.33333 8.70643 7.96024 8.33333 7.5 8.33333H5.83333Z","fill","#FF7162"],["d","M4.69231 5.29805L6.9519 16.6605C7.26158 18.2178 9.31823 18.591 10.1553 17.2418L12.4275 13.5798C12.4611 13.5255 12.5143 13.4861 12.5761 13.4699L16.8289 12.3482C18.3433 11.9488 18.6107 9.91372 17.2509 9.13668L7.27695 3.4373C5.97394 2.69272 4.3996 3.82614 4.69231 5.29805Z","stroke","#E5E5E9","stroke-width","1.5","stroke-linecap","square"],["d","M4.69231 5.29805L6.9519 16.6605C7.26158 18.2178 9.31823 18.591 10.1553 17.2418L12.4275 13.5798C12.4611 13.5255 12.5143 13.4861 12.5761 13.4699L16.8289 12.3482C18.3433 11.9488 18.6107 9.91372 17.2509 9.13668L7.27695 3.4373C5.97394 2.69272 4.3996 3.82614 4.69231 5.29805Z","stroke","#FF7162","stroke-width","1.5","stroke-linecap","square"],["fill-rule","evenodd","clip-rule","evenodd","d","M13.8325 2.04946C17.7809 2.65969 20.8233 5.37592 21.8636 9.21997C22.1983 10.457 22.1983 12.6637 21.8636 13.9007C20.922 17.3797 18.4001 19.9016 14.921 20.8432C14.2284 21.0307 13.7495 21.0787 12.5807 21.0777C10.9937 21.0764 10.2354 20.9338 8.89576 20.3847L8.17885 20.0909L5.96793 20.6411C3.89884 21.156 3.73807 21.1807 3.46234 21.0259C2.91579 20.7191 2.9196 20.4879 3.50969 18.1292L4.05124 15.965L3.75679 15.2466C3.20719 13.9056 3.06459 13.1477 3.06328 11.5603C3.06231 10.3914 3.11031 9.9126 3.29775 9.21997C4.23324 5.76343 6.77214 3.21049 10.1836 2.29591C10.9867 2.08059 13.1072 1.93745 13.8325 2.04946ZM10.2766 4.07773C8.99188 4.49235 8.06085 5.06677 7.07399 6.05364C5.60817 7.51946 4.87896 9.14649 4.77653 11.1793C4.71394 12.4216 4.88419 13.4239 5.34355 14.5187C5.50236 14.8972 5.68807 15.3419 5.7561 15.5069C5.85962 15.7577 5.81488 16.0697 5.48277 17.4105C5.26419 18.2927 5.09471 19.0236 5.10603 19.035C5.11735 19.0463 5.8483 18.8768 6.73045 18.6582C8.0713 18.3261 8.38328 18.2814 8.63408 18.3849C8.7991 18.4529 9.24377 18.6386 9.62225 18.7974C10.7171 19.2568 11.7194 19.427 12.9617 19.3645C14.9945 19.262 16.6215 18.5328 18.0873 17.067C19.0668 16.0875 19.6379 15.1663 20.0725 13.8644C20.3166 13.1336 20.3512 12.8471 20.3512 11.5603C20.3512 10.2736 20.3166 9.98706 20.0725 9.25621C19.6379 7.95433 19.0668 7.0331 18.0873 6.05364C16.4266 4.39297 14.6419 3.68684 12.3085 3.76717C11.4187 3.79787 10.8968 3.87755 10.2766 4.07773Z","fill","#fff"]],template:function(i,r){i&1&&g(0,xGt,40,38,"ng-container",1),i&2&&c("ngIf",r.componentConfigSignal())},dependencies:[ht,Z,Hn,ew,s_,de],styles:['html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}*[_ngcontent-%COMP%]{box-sizing:border-box;-webkit-tap-highlight-color:rgba(255,255,255,0)!important;outline:none!important;margin:0!important;padding:0!important;text-align:left!important;line-height:1.5!important;color:#000!important;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))}*[_ngcontent-%COMP%]:empty{display:revert!important}*[_ngcontent-%COMP%]:not(svg *){height:unset;width:unset}.s-presence-avatar-initial[_ngcontent-%COMP%]{color:#fff!important}.pin2[_ngcontent-%COMP%]{position:relative!important;display:flex!important;justify-content:center!important;align-items:center!important;width:2.25em!important;height:2.25em!important;background:linear-gradient(145deg,#6941ff,#ff5f7a,#ffa113)!important;border-radius:2em!important;overflow:hidden!important;margin-left:-.5em!important;transition:transform .2s ease}.pin2[_ngcontent-%COMP%]:not(.s-current-user){cursor:pointer!important}.pin2[_ngcontent-%COMP%]:hover{z-index:2!important;transform:scale(1.1)!important}.modal-author__image[_ngcontent-%COMP%]{width:2em!important;height:2em!important;background-size:cover!important;border-radius:50%!important;border:1px solid!important}.pins-wrap[_ngcontent-%COMP%]{position:relative!important;display:flex!important;width:max-content!important;justify-content:center!important;align-items:center!important;margin-left:.5em!important}button[_ngcontent-%COMP%]{background:#e6e8ec00!important;transition:.5s!important;font-style:normal!important;font-weight:600!important;font-size:14px!important;line-height:1em!important;outline:0!important;border:0!important;color:#fff!important}button[_ngcontent-%COMP%]:hover{background:#23262f!important;cursor:pointer!important}.action-menu[_ngcontent-%COMP%]{position:relative!important;display:flex!important;width:max-content!important;justify-content:center!important;gap:1em!important}.buttons-wrap[_ngcontent-%COMP%]{display:flex!important;align-items:center!important;justify-content:flex-start!important;gap:.25em!important}.primary[_ngcontent-%COMP%]{color:#fff!important;padding:.5em .75em!important;background:#625df580!important;border-radius:5.6em!important}.secondary[_ngcontent-%COMP%]:hover{background:#625df5!important;border:2px solid rgb(98,93,245)!important}.secondary[_ngcontent-%COMP%]:focus{background:#625df5!important;outline:0!important}.secondary[_ngcontent-%COMP%]:active{background:#3b3893!important}.secondary[_ngcontent-%COMP%]{padding:.5em .75em!important;border-radius:5.6em!important;border:2px solid #E6E8EC!important}.line-div[_ngcontent-%COMP%]{border-top:1px solid #e6e8ec!important;width:100%!important}.reply-div[_ngcontent-%COMP%], .single-comment-disable-div[_ngcontent-%COMP%]{display:flex!important;flex-direction:column!important;align-items:center!important;justify-content:flex-start!important}.value-div[_ngcontent-%COMP%]{gap:.25em!important}.modal-div[_ngcontent-%COMP%]{position:relative!important;display:flex!important;flex-direction:column!important;gap:1em!important;border-radius:.75em!important;background-color:#fff!important;box-sizing:border-box!important;width:max-content!important;text-align:left!important;font-size:14px!important;color:#141416!important}.modal-header[_ngcontent-%COMP%]{display:flex!important;justify-content:flex-end!important;gap:.75em!important}.modal-header__button[_ngcontent-%COMP%]{border:0!important;border-radius:50%!important;width:2em!important;height:2em!important;flex-shrink:0!important;display:flex!important;align-items:center!important;justify-content:center!important}.modal-messages[_ngcontent-%COMP%]{display:flex!important;flex-direction:column!important;gap:1em!important}.modal-author[_ngcontent-%COMP%]{display:flex!important;align-items:center!important;gap:.25em!important}.modal-author__image[_ngcontent-%COMP%]{width:2em!important;height:2em!important;background-color:#d3d3d3!important;background-size:cover!important;border-radius:50%!important}.modal-author__name[_ngcontent-%COMP%]{flex-grow:1!important;font-style:normal!important;font-weight:600!important;font-size:16px!important;line-height:1.5!important;color:#141416!important}.modal-author__last-message[_ngcontent-%COMP%]{font-style:normal!important;font-weight:400!important;font-size:12px!important;line-height:1.5!important;display:flex!important;align-items:center!important;text-align:right!important;color:#777e91!important}.modal-author__text[_ngcontent-%COMP%]{flex-grow:1!important;padding-left:2.6em!important}.action__button[_ngcontent-%COMP%]{border:0!important;border-radius:50%!important;width:2.4em!important;height:2.4em!important;flex-shrink:0!important;display:flex!important;align-items:center!important;justify-content:center!important}.action__button[_ngcontent-%COMP%]:disabled{cursor:not-allowed!important}.action__button[_ngcontent-%COMP%]:disabled svg[_ngcontent-%COMP%] path[_ngcontent-%COMP%]{fill:#777e91!important}.actions-wrap[_ngcontent-%COMP%]{position:relative!important;height:2.4em!important;display:flex!important;flex-direction:line!important;align-items:center!important;justify-content:flex-start!important;gap:.25em!important}.input-text-wrap[_ngcontent-%COMP%]{width:max-content!important;height:100%!important;border-radius:.5em!important;background-color:#141416!important;border:0!important;box-sizing:border-box!important;position:relative!important;box-shadow:0 0 24px -2px #ffffff61;padding:calc((.5rem + 0px) * var(--velt-base-rem-unit)) calc((1rem + 0px) * var(--velt-base-rem-unit))!important;border-radius:calc((25rem + 0px) * var(--velt-base-rem-unit))!important}.input-text[_ngcontent-%COMP%]{font-style:normal!important;font-weight:400!important;font-size:14px!important;line-height:1.5em!important;padding:.25em!important;width:100%!important;height:100%!important;background-color:#fcfcfd!important;box-sizing:border-box!important;outline:0!important;overflow:hidden!important}.tooltip[_ngcontent-%COMP%]{position:relative!important;display:flex!important;flex-direction:column!important}.tooltip-link[_ngcontent-%COMP%]{font-style:normal!important;font-weight:400!important;font-size:12px!important;line-height:1.5em!important}.tooltip[_ngcontent-%COMP%] .tooltiptext[_ngcontent-%COMP%]{visibility:hidden!important;block-size:auto!important;width:max-content!important;top:135%!important;background-color:#000!important;color:#fff!important;text-align:left!important;padding:6px 12px!important;border-radius:6px!important;font-style:normal!important;font-weight:400!important;font-size:14px!important;line-height:2em!important;position:absolute!important;z-index:1!important;opacity:0!important;transition:opacity .5s!important}.tooltip[_ngcontent-%COMP%]:hover .tooltiptext[_ngcontent-%COMP%]{visibility:visible!important;opacity:1!important}.tooltip[_ngcontent-%COMP%] .tooltiptext[_ngcontent-%COMP%]:after{content:" "!important;position:absolute!important;top:0!important;left:50%!important;width:12px!important;height:12px!important;background-color:#000!important;border-radius:4px!important;transform:translate(-50%,-41%) rotate(45deg)!important;transform-origin:center!important} snippyly-user-avatar.huddle-menu-panel-user-avatar{display:flex} snippyly-user-avatar.huddle-menu-panel-user-avatar .s-user-avatar-initial{font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))!important} snippyly-user-avatar.huddle-menu-panel-user-avatar .s-user-avatar-image{border:1px solid black!important;border-radius:50%!important}'],changeDetection:0});let n=o;return n})();var $fe=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.dragDrop=i,this.currentX=0,this.currentY=0,this.destroy$=new Ke,this.subscriptions=[],this.loggingService.log("%c[WB] Creating CLASS: DraggableOverlayDirective","color: blue;")}ngOnInit(){try{this.loggingService.log("%c[WB] Calling DraggableOverlayDirective FUNCTION: ngOnInit","color: green;"),this.setupDraggableOverlay()}catch(e){this.loggingService.catch("Error in DraggableOverlayDirective ngOnInit: ",e)}}setupDraggableOverlay(){try{if(this.loggingService.log("%c[WB] Calling DraggableOverlayDirective FUNCTION: setupDraggableOverlay","color: green;"),this.connectedOverlay&&this.connectedOverlay.overlayRef){let e=this.connectedOverlay.overlayRef.overlayElement;this.dragRef=this.dragDrop.createDrag(e),this.subscriptions.push(this.dragRef.moved.pipe(ao(this.destroy$)).subscribe(i=>{let r=this.connectedOverlay?.overlayRef.getConfig().positionStrategy;this.updatePosition(r,i.distance.x,i.distance.y)},i=>{this.loggingService.catch("Error in DraggableOverlayDirective dragRef.moved subscription: ",i)})),this.dragRef.ended.pipe(ao(this.destroy$)).subscribe(i=>{this.currentX+=i.distance.x,this.currentY+=i.distance.y},i=>{this.loggingService.catch("Error in DraggableOverlayDirective dragRef.ended subscription: ",i)})}}catch(e){this.loggingService.catch("Error in DraggableOverlayDirective setupDraggableOverlay: ",e)}}updatePosition(e,i,r){try{if(e){let a=this.currentX+i,s=this.currentY+r;e.withDefaultOffsetX(a).withDefaultOffsetY(s),this.connectedOverlay?.overlayRef?.updatePosition()}}catch{}}cleanupDraggableOverlay(){try{this.loggingService.log("%c[WB] Calling DraggableOverlayDirective FUNCTION: cleanupDraggableOverlay","color: green;"),this.dragRef&&this.dragRef.dispose()}catch(e){this.loggingService.catch("Error in DraggableOverlayDirective cleanupDraggableOverlay: ",e)}}ngOnDestroy(){try{this.loggingService.log("%c[WB] Calling DraggableOverlayDirective FUNCTION: ngOnDestroy","color: green;"),this.cleanupDraggableOverlay(),this.destroy$.next(),this.destroy$.complete(),this.subscriptions.forEach(e=>{e.unsubscribe()})}catch(e){this.loggingService.catch("Error in DraggableOverlayDirective ngOnDestroy: ",e)}}};o.\u0275fac=function(i){return new(i||o)(u(y),u(lA))},o.\u0275dir=Bt({type:o,selectors:[["","veltDraggableOverlay",""]],inputs:{connectedOverlay:[0,"veltDraggableOverlay","connectedOverlay"]},standalone:!1});let n=o;return n})();var wGt=()=>["snippyly-overlay-panel","snippyly-huddle-menu-panel-overlay-panel"],OGt=()=>["snippyly-overlay-panel","snippyly-huddle-banner-panel"];function AGt(n,o){if(n&1){let t=q();C(0,"div",20),G("click",function(){N(t);let i=l(2);return F(i.onHuddleToolClick("audio"))}),C(1,"slot",21),G("slotchange",function(){N(t);let i=l(2);return F(i.onButtonSlotChange())}),C(2,"div",22),le(),C(3,"svg",23),w(4,"path",24),S()()()()}}function PGt(n,o){if(n&1){let t=q();C(0,"div",20),G("click",function(){N(t);let i=l(2);return F(i.onHuddleToolClick("video"))}),C(1,"slot",21),G("slotchange",function(){N(t);let i=l(2);return F(i.onButtonSlotChange())}),C(2,"div",22),le(),C(3,"svg",25),w(4,"path",26)(5,"path",27),S()()()()}}function MGt(n,o){if(n&1){let t=q();C(0,"div",20),G("click",function(){N(t);let i=l(3);return F(i.onHuddleToolClick("presentation"))}),C(1,"slot",21),G("slotchange",function(){N(t);let i=l(3);return F(i.onButtonSlotChange())}),C(2,"div",22),le(),C(3,"svg",23),w(4,"path",28),S()()()()}}function kGt(n,o){n&1&&g(0,MGt,5,0,"div",7),n&2&&c("ngSwitchCase","presentation")}function RGt(n,o){if(n&1){let t=q();C(0,"div",29,4)(2,"slot",21),G("slotchange",function(){N(t);let i=l(2);return F(i.onButtonSlotChange())}),C(3,"div",30),le(),C(4,"svg",31),w(5,"path",24),S(),C(6,"svg",32),w(7,"path",33),S()()()()}if(n&2){let t=pe(1);l();let e=pe(8);c("matMenuTriggerFor",e),d(3),ge("active",t==null?null:t.menuOpen)}}function NGt(n,o){if(n&1){let t=q();C(0,"div",11),G("click",function(){N(t);let i=l(2);return F(i.onHuddleToolClick("presentation"))}),le(),C(1,"svg",12),w(2,"path",34),S(),mt(),C(3,"span"),te(4),A(5,"translate"),S()()}if(n&2){let t=l().ngIf;c("disabled",t.disabled),d(4),je(P(5,2,"Screen Huddle"))}}function FGt(n,o){if(n&1){let t=q();C(0,"snippyly-huddle-menu-panel",36),G("toggleAudio",function(){N(t);let i=l(3);return F(i.toggleAudio())})("toggleVideo",function(){N(t);let i=l(3);return F(i.toggleVideo())})("toggleScreenSharing",function(){N(t);let i=l(3);return F(i.toggleScreenSharing())})("leave",function(){N(t);let i=l(3);return F(i.dropCall())}),S()}if(n&2){let t=l(2).ngIf,e=pe(24);c("veltDraggableOverlay",e)("attendees",t.huddleAttendees)("user",t.user)("audioState",t.localStreamState==null?null:t.localStreamState.audioState)("videoState",t.localStreamState==null?null:t.localStreamState.videoState)("screenSharingState",t.localStreamState==null?null:t.localStreamState.screenSharingState)}}function LGt(n,o){if(n&1&&g(0,FGt,1,6,"snippyly-huddle-menu-panel",35),n&2){let t=l().ngIf;c("ngIf",t.meetingJoined)}}function BGt(n,o){if(n&1){let t=q();C(0,"div",38)(1,"div")(2,"div"),le(),C(3,"svg",39),w(4,"path",40),S()(),mt(),C(5,"div")(6,"h3",41),te(7),A(8,"translate"),A(9,"translate"),A(10,"translate"),S(),C(11,"p",42),te(12),A(13,"translate"),S(),C(14,"div",43)(15,"button",44),G("click",function(){N(t);let i=l(3);return F(i.onJoinButtonClick())}),te(16,"Join"),S(),C(17,"button",45),G("click",function(){N(t);let i=l(3);return F(i.removeBanner())}),te(18,"Cancel"),S()()(),C(19,"div"),le(),C(20,"svg",46),G("click",function(){N(t);let i=l(3);return F(i.removeBanner())}),w(21,"path",47),S()()()()}if(n&2){let t=l(2).ngIf;d(7),gr("",(t.huddleAttendees==null?null:t.huddleAttendees.length)===1?P(8,3,"1 person is"):(t.huddleAttendees==null?null:t.huddleAttendees.length)+" "+P(9,5,"people are")," ",P(10,7,"on a call now"),""),d(5),je(P(13,9,"You can join the call"))}}function VGt(n,o){if(n&1&&g(0,BGt,22,11,"div",37),n&2){let t=l().ngIf;c("ngIf",t.isFirstComponent&&!t.meetingJoined&&!t.bannerRemoved&&(t.huddleAttendees==null?null:t.huddleAttendees.length))}}function UGt(n,o){if(n&1){let t=q();f(0),C(1,"div",6,0),g(3,AGt,5,0,"div",7)(4,PGt,6,0,"div",7)(5,kGt,1,1,"ng-template",8)(6,RGt,8,3,"div",9),S(),C(7,"mat-menu",10,1)(9,"div",11),G("click",function(){N(t);let i=l();return F(i.onHuddleToolClick("audio"))}),le(),C(10,"svg",12),w(11,"path",13),S(),mt(),C(12,"span"),te(13),A(14,"translate"),S()(),C(15,"div",11),G("click",function(){N(t);let i=l();return F(i.onHuddleToolClick("video"))}),le(),C(16,"svg",12),w(17,"path",14)(18,"path",15),S(),mt(),C(19,"span"),te(20),A(21,"translate"),S()(),g(22,NGt,6,4,"div",16),S(),g(23,LGt,1,1,"ng-template",17,2,De),w(25,"div",18,3),g(27,VGt,1,1,"ng-template",19,2,De),v()}if(n&2){let t=o.ngIf,e=pe(2),i=pe(26),r=l();d(),c("ngSwitch",t.type),d(2),c("ngSwitchCase","audio"),d(),c("ngSwitchCase","video"),d(),c("ngIf",t.screenSharingSupported),d(),c("ngSwitchCase","all"),d(3),c("disabled",t.disabled),d(4),je(P(14,21,"Audio Huddle")),d(2),c("disabled",t.disabled),d(5),je(P(21,23,"Video Huddle")),d(2),c("ngIf",t.screenSharingSupported),d(),c("cdkConnectedOverlayOrigin",e)("cdkConnectedOverlayOpen",t.meetingJoined&&t.joinedHuddleToolComponentId===r.veltId)("cdkConnectedOverlayPanelClass",Nt(25,wGt))("cdkConnectedOverlayBackdropClass","snippyly-overlay-backdrop")("cdkConnectedOverlayGrowAfterOpen",!0)("cdkConnectedOverlayPositions",t.positions)("cdkConnectedOverlayDisableClose",!0),d(4),c("cdkConnectedOverlayOrigin",i)("cdkConnectedOverlayOpen",t.isFirstComponent&&!t.meetingJoined&&!t.bannerRemoved&&!!(t.huddleAttendees!=null&&t.huddleAttendees.length))("cdkConnectedOverlayPanelClass",Nt(26,OGt))("cdkConnectedOverlayPositions",t.positions)}}var zH=(()=>{let o=class o extends nt{constructor(e,i,r,a,s,m,p){super(p,m),this.analyticsService=e,this.authService=i,this.huddleService=r,this.iamService=a,this.loggingService=s,this.themeService=m,this.elementRef=p,this.type="audio",this.remoteStreams=[],this.huddleStarted=!1,this.initialHuddleType="audio",this.customButtonAdded=!1,this.subscriptions=[],this.veltId=Pn(),this.veltElement=!0,this.componentConfigSignal=Te({type:this.type,screenSharingSupported:!!navigator?.mediaDevices?.getDisplayMedia,disabled:!1,meetingJoined:!1,joinedHuddleToolComponentId:null,positions:j.OVERLAY_POSITIONS.map(h=>new fi({originX:h.originX,originY:h.originY},{overlayX:h.overlayX,overlayY:h.overlayY})),user:null,localStreamState:{},huddleAttendees:[],isFirstComponent:!1,bannerRemoved:!1}),this.subscriptions.push(this.authService.getUser$().pipe(Fe(h=>!!h)).subscribe(h=>{h&&(this.componentConfigSignal.update(_=>T(I({},_),{user:h})),this.checkToAutoJoinHuddle())},h=>{this.loggingService.catch("Error in getUser: ",h)})),this.subscriptions.push(this.huddleService.getRemoteStream().subscribe(h=>{try{h||(this.remoteStreams=[])}catch(_){this.loggingService.catch("Error in HuddleToolComponent getRemoteStream:",_)}},h=>{this.loggingService.catch("Error in getRemoteStream: ",h)})),this.subscriptions.push(this.huddleService.getLocalStreamState().subscribe(h=>{this.componentConfigSignal.update(_=>T(I({},_),{localStreamState:h}))},h=>{this.loggingService.catch("Error in getLocalStreamState: ",h)})),this.subscriptions.push(this.huddleService.getHuddleToolComponentId().subscribe(h=>{this.componentConfigSignal.update(_=>T(I({},_),{joinedHuddleToolComponentId:h}))},h=>{this.loggingService.catch("Error in getHuddleToolComponentId: ",h)})),this.subscriptions.push(this.iamService.getFeaturesAccessLevel$().subscribe(h=>{this.componentConfigSignal.update(_=>T(I({},_),{disabled:!!h?.all?.disabled}))})),this.getHuddleAttendees()}ngOnInit(){}ngOnChanges(e){try{super.ngOnChanges(e),e&&Object.keys(e).forEach(i=>{this.componentConfigSignal.update(r=>(r=T(I({},r),{[i]:e[i].currentValue}),r))})}catch(i){this.loggingService.catch("Error in HuddleToolComponent ngOnChanges: ",i)}}ngAfterViewInit(){try{let e=document.querySelector(j.TAGS.SNIPPYLY_HUDDLE_TOOL),i=document.querySelector(j.TAGS.VELT_HUDDLE_TOOL);i||e?i?this.veltId===i?.getAttribute(j.ATTRIBUTES.VELT_ID)&&(this.componentConfigSignal.update(r=>T(I({},r),{isFirstComponent:!0})),this.checkToAutoJoinHuddle()):this.veltId===e?.getAttribute(j.ATTRIBUTES.VELT_ID)&&(this.componentConfigSignal.update(r=>T(I({},r),{isFirstComponent:!0})),this.checkToAutoJoinHuddle()):(document.querySelector(j.TAGS.SNIPPYLY_PLUGIN)||document.querySelector(j.TAGS.SUPERFLOW_TOOLBAR))&&(this.componentConfigSignal.update(r=>T(I({},r),{isFirstComponent:!0})),this.checkToAutoJoinHuddle())}catch(e){this.loggingService.catch("Error in HuddleToolComponent AfterViewInit: ",e)}}onButtonSlotChange(){this.customButtonAdded=!0}checkToAutoJoinHuddle(){try{if(this.componentConfigSignal().user&&this.componentConfigSignal().isFirstComponent){let e=sessionStorage.getItem(j.SESSION_STORAGE.SNIPPYLY_HUDDLE_DATA);if(e&&!this.huddleStarted){let i=JSON.parse(e).type;this.joinHuddle(i)}}}catch(e){this.loggingService.catch("Error in checkToAutoJoinHuddle: ",e)}}getHuddleAttendees(){this.subscriptions.push(this.huddleService.getHuddleAttendees$().subscribe(e=>{try{e?(this.componentConfigSignal.update(i=>T(I({},i),{huddleAttendees:e.slice()})),this.huddleStarted=!!e?.length,(this.componentConfigSignal().meetingJoined||!this.componentConfigSignal().huddleAttendees?.length)&&this.componentConfigSignal.update(i=>T(I({},i),{bannerRemoved:!1})),this.componentConfigSignal.update(i=>T(I({},i),{meetingJoined:!!e.find(r=>r?.userSnippylyId===this.componentConfigSignal().user?.userSnippylyId)})),this.componentConfigSignal().huddleAttendees?.length&&(this.initialHuddleType=this.componentConfigSignal().huddleAttendees[0].initialHuddleType)):(this.huddleStarted=!1,this.componentConfigSignal.update(i=>T(I({},i),{meetingJoined:!1})),this.componentConfigSignal.update(i=>T(I({},i),{bannerRemoved:!1})),this.componentConfigSignal.update(i=>T(I({},i),{huddleAttendees:[]})),this.initialHuddleType="audio")}catch(i){this.loggingService.catch("Error in HuddleToolComponent getHuddleAttendees:",i)}}))}onHuddleToolClick(e){try{if(this.analyticsService.trackEvent(X.Events.Huddle.HUDDLE_TOOL_CLICKED,{huddleType:e,toolType:this.customButtonAdded?`custom - ${this.componentConfigSignal().type}`:`default - ${this.componentConfigSignal().type}`}),this.componentConfigSignal().disabled){this.loggingService.catch("Huddle feature is disabled.");return}this.joinHuddle(e)}catch(i){this.loggingService.catch("Error in HuddleToolComponent onHuddleToolClick:",i)}}onJoinButtonClick(){try{this.analyticsService.trackEvent(X.Events.Huddle.HUDDLE_JOIN_BUTTON_CLICKED,{huddleType:this.initialHuddleType,huddleSnippylyUserIds:this.huddleService.getHuddleAttendees()?.map(e=>e?.userSnippylyId),huddleClientUserIds:this.huddleService.getHuddleAttendees()?.map(e=>e?.userId)}),this.joinHuddle(void 0)}catch(e){this.loggingService.catch("Error in HuddleToolComponent onJoinButtonClick:",e)}}joinHuddle(e){return Q(this,null,function*(){try{e?this.huddleStarted||(this.initialHuddleType=e||"audio"):e=this.initialHuddleType||"audio";let i=this.huddleService.getHuddleSessionData();if(this.componentConfigSignal().meetingJoined&&(yield this.dropCall(),yield Rp(1e3)),!this.componentConfigSignal().meetingJoined)if(this.componentConfigSignal().user&&!this.componentConfigSignal().meetingJoined){this.huddleService.setHuddleToolComponentId(this.veltId);let r=j.HUDDLE_TYPE_CONFIGS[e],a=JSON.parse(JSON.stringify(r));r&&(a.audio=i?!!i.audio:r.audio,a.video=i?!!i.video:r.video,a.presentation=i?!!i.presentation:r.presentation,yield this.huddleService.setLocalStream(I({},a)),(i?i?.presentation:r.presentation)&&!this.huddleStarted?yield this.huddleService.setScreenSharingStream():a.presentation=!1,this.huddleService.updateHuddleSessionData("","",I({type:e},a)),this.componentConfigSignal.update(s=>T(I({},s),{meetingJoined:!0})),this.huddleService.joinHuddle(this.initialHuddleType),this.componentConfigSignal().huddleAttendees?.length?(this.analyticsService.trackEvent(X.Events.Huddle.HUDDLE_JOINED,{huddleType:this.initialHuddleType,totalUsers:this.huddleService.getHuddleAttendees()?.length||0,totalUserHuddleDuration:this.huddleService.getTotalUserHuddleDuration(),huddleSnippylyUserIds:this.huddleService.getHuddleAttendees()?.map(s=>s?.userSnippylyId),huddleClientUserIds:this.huddleService.getHuddleAttendees()?.map(s=>s?.userId)}),this.huddleService.updateNotificationsDatabase({actionType:N6.JOINED})):(this.huddleService.clearHuddleInvitees(),this.analyticsService.trackEvent(X.Events.Huddle.HUDDLE_CREATED,{huddleType:this.initialHuddleType,totalUsers:this.huddleService.getHuddleAttendees()?.length||0,totalUserHuddleDuration:this.huddleService.getTotalUserHuddleDuration(),huddleSnippylyUserIds:this.huddleService.getHuddleAttendees()?.map(s=>s?.userSnippylyId),huddleClientUserIds:this.huddleService.getHuddleAttendees()?.map(s=>s?.userId)}),this.huddleService.updateNotificationsDatabase({actionType:N6.CREATED})))}else this.componentConfigSignal().user||this.loggingService.catch("Velt sdk not authenticated.")}catch(i){this.loggingService.catch("Error in HuddleToolComponent joinHuddle:",i)}})}toggleAudio(){try{this.huddleService.updateHuddleSessionData("audio",!this.componentConfigSignal().localStreamState?.audioState),this.huddleService.toggleLocalStreamAudio()}catch(e){this.loggingService.catch("Error in HuddleToolComponent toggleAudio:",e)}}toggleVideo(){try{this.huddleService.updateHuddleSessionData("video",!this.componentConfigSignal().localStreamState?.videoState),this.huddleService.toggleLocalStreamVideo()}catch(e){this.loggingService.catch("Error in HuddleToolComponent toggleVideo:",e)}}toggleScreenSharing(){return Q(this,null,function*(){try{this.huddleService.updateHuddleSessionData("presentation",!this.componentConfigSignal().localStreamState?.screenSharingState),yield this.huddleService.toggleLocalScreenSharing()}catch(e){this.loggingService.catch("Error in HuddleToolComponent toggleScreenSharing:",e)}})}dropCall(){return Q(this,null,function*(){try{this.componentConfigSignal.update(e=>T(I({},e),{huddleAttendees:[]})),yield this.huddleService.dropCall(),yield this.huddleService.removeLocalStream(),yield this.huddleService.removeAttendee()}catch(e){this.loggingService.catch("Error in HuddleToolComponent dropCall:",e)}})}copyUrl(){bs(window.location.href)}removeBanner(){try{this.componentConfigSignal.update(e=>T(I({},e),{bannerRemoved:!0}))}catch(e){this.loggingService.catch("Error in HuddleToolComponent removeBanner:",e)}}ngOnDestroy(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnDestroy","color: green;");try{super.ngOnDestroy(),this.unsubscribe()}catch(e){this.loggingService.catch("Error in HuddleToolComponent ondestroy: ",e)}}unsubscribe(){this.loggingService.log("%c[WB] Calling FUNCTION: unsubscribe","color: green;");try{this.subscriptions.map(e=>{e.unsubscribe()}),this.subscriptions=[]}catch(e){this.loggingService.catch("Error in HuddleToolComponent unsubscribe: ",e)}}};o.\u0275fac=function(i){return new(i||o)(u(Ze),u(He),u(pr),u(fn),u(y),u(Ye),u(k))},o.\u0275cmp=O({type:o,selectors:[["snippyly-huddle-tool"]],hostVars:2,hostBindings:function(i,r){i&2&&x("data-velt-id",r.veltId)("data-velt-element",r.veltElement)},inputs:{type:"type"},standalone:!1,features:[B,Xe],decls:1,vars:1,consts:[["trigger","cdkOverlayOrigin"],["allMenu","matMenu"],["overlay","cdkConnectedOverlay"],["huddleBannerTrigger","cdkOverlayOrigin"],["allMenuTrigger","matMenuTrigger"],[4,"ngIf"],["part","container","cdkOverlayOrigin","",1,"huddle-tool-container",3,"ngSwitch"],[3,"click",4,"ngSwitchCase"],[3,"ngIf"],[3,"matMenuTriggerFor",4,"ngSwitchCase"],[1,"velt-menu","huddle-all-menu-panel"],["mat-menu-item","",3,"click","disabled"],["width","25","height","24","viewBox","0 0 25 24","fill","none","xmlns","http://www.w3.org/2000/svg"],["d","M5.5 14.625C5.5 14.1609 5.68437 13.7158 6.01256 13.3876C6.34075 13.0594 6.78587 12.875 7.25 12.875H8.125C8.58913 12.875 9.03425 13.0594 9.36244 13.3876C9.69063 13.7158 9.875 14.1609 9.875 14.625V17.25C9.875 17.7141 9.69063 18.1592 9.36244 18.4874C9.03425 18.8156 8.58913 19 8.125 19H7.25C6.78587 19 6.34075 18.8156 6.01256 18.4874C5.68437 18.1592 5.5 17.7141 5.5 17.25V14.625ZM5.5 14.625V12C5.5 10.1435 6.2375 8.36301 7.55025 7.05025C8.86301 5.7375 10.6435 5 12.5 5C14.3565 5 16.137 5.7375 17.4497 7.05025C18.7625 8.36301 19.5 10.1435 19.5 12V14.625M19.5 14.625C19.5 14.1609 19.3156 13.7158 18.9874 13.3876C18.6592 13.0594 18.2141 12.875 17.75 12.875H16.875C16.4109 12.875 15.9658 13.0594 15.6376 13.3876C15.3094 13.7158 15.125 14.1609 15.125 14.625V17.25C15.125 17.7141 15.3094 18.1592 15.6376 18.4874C15.9658 18.8156 16.4109 19 16.875 19H17.75C18.2141 19 18.6592 18.8156 18.9874 18.4874C19.3156 18.1592 19.5 17.7141 19.5 17.25V14.625Z","stroke","#8F95B2","stroke-width","1.25","stroke-linecap","round","stroke-linejoin","round"],["d","M15.1667 10.2228L19.2138 8.19966C19.3493 8.13195 19.4998 8.09999 19.6511 8.10681C19.8024 8.11362 19.9495 8.15899 20.0783 8.23859C20.2072 8.3182 20.3135 8.42941 20.3873 8.56167C20.4611 8.69394 20.4999 8.84286 20.5 8.99432V15.0068C20.4999 15.1582 20.4611 15.3072 20.3873 15.4394C20.3135 15.5717 20.2072 15.6829 20.0783 15.7625C19.9495 15.8421 19.8024 15.8875 19.6511 15.8943C19.4998 15.9011 19.3493 15.8691 19.2138 15.8014L15.1667 13.7783V10.2228Z","stroke","#8F95B2","stroke-width","1.25","stroke-linecap","round","stroke-linejoin","round"],["d","M4.5 8.44445C4.5 7.97295 4.6873 7.52077 5.0207 7.18737C5.3541 6.85397 5.80628 6.66667 6.27778 6.66667H13.3889C13.8604 6.66667 14.3126 6.85397 14.646 7.18737C14.9794 7.52077 15.1667 7.97295 15.1667 8.44445V15.5556C15.1667 16.0271 14.9794 16.4792 14.646 16.8126C14.3126 17.146 13.8604 17.3333 13.3889 17.3333H6.27778C5.80628 17.3333 5.3541 17.146 5.0207 16.8126C4.6873 16.4792 4.5 16.0271 4.5 15.5556V8.44445Z","stroke","#8F95B2","stroke-width","1.25","stroke-linecap","round","stroke-linejoin","round"],["mat-menu-item","",3,"disabled","click",4,"ngIf"],["cdkConnectedOverlay","",3,"cdkConnectedOverlayOrigin","cdkConnectedOverlayOpen","cdkConnectedOverlayPanelClass","cdkConnectedOverlayBackdropClass","cdkConnectedOverlayGrowAfterOpen","cdkConnectedOverlayPositions","cdkConnectedOverlayDisableClose"],["cdkOverlayOrigin",""],["cdkConnectedOverlay","",3,"cdkConnectedOverlayOrigin","cdkConnectedOverlayOpen","cdkConnectedOverlayPanelClass","cdkConnectedOverlayPositions"],[3,"click"],["name","button",3,"slotchange"],["part","button-container",1,"action-btn"],["part","button-icon","viewBox","0 0 25 24","fill","none","xmlns","http://www.w3.org/2000/svg",1,"action-btn-icon"],["d","M5.5 14.625C5.5 14.1609 5.68437 13.7158 6.01256 13.3876C6.34075 13.0594 6.78587 12.875 7.25 12.875H8.125C8.58913 12.875 9.03425 13.0594 9.36244 13.3876C9.69063 13.7158 9.875 14.1609 9.875 14.625V17.25C9.875 17.7141 9.69063 18.1592 9.36244 18.4874C9.03425 18.8156 8.58913 19 8.125 19H7.25C6.78587 19 6.34075 18.8156 6.01256 18.4874C5.68437 18.1592 5.5 17.7141 5.5 17.25V14.625ZM5.5 14.625V12C5.5 10.1435 6.2375 8.36301 7.55025 7.05025C8.86301 5.7375 10.6435 5 12.5 5C14.3565 5 16.137 5.7375 17.4497 7.05025C18.7625 8.36301 19.5 10.1435 19.5 12V14.625M19.5 14.625C19.5 14.1609 19.3156 13.7158 18.9874 13.3876C18.6592 13.0594 18.2141 12.875 17.75 12.875H16.875C16.4109 12.875 15.9658 13.0594 15.6376 13.3876C15.3094 13.7158 15.125 14.1609 15.125 14.625V17.25C15.125 17.7141 15.3094 18.1592 15.6376 18.4874C15.9658 18.8156 16.4109 19 16.875 19H17.75C18.2141 19 18.6592 18.8156 18.9874 18.4874C19.3156 18.1592 19.5 17.7141 19.5 17.25V14.625Z","stroke","currentColor","stroke-width","1.25","stroke-linecap","round","stroke-linejoin","round"],["part","button-icon","width","25","height","24","viewBox","0 0 25 24","fill","none","xmlns","http://www.w3.org/2000/svg",1,"action-btn-icon"],["d","M15.1667 10.2228L19.2138 8.19966C19.3493 8.13195 19.4998 8.09999 19.6511 8.10681C19.8024 8.11362 19.9495 8.15899 20.0783 8.23859C20.2072 8.3182 20.3135 8.42941 20.3873 8.56167C20.4611 8.69394 20.4999 8.84286 20.5 8.99432V15.0068C20.4999 15.1582 20.4611 15.3072 20.3873 15.4394C20.3135 15.5717 20.2072 15.6829 20.0783 15.7625C19.9495 15.8421 19.8024 15.8875 19.6511 15.8943C19.4998 15.9011 19.3493 15.8691 19.2138 15.8014L15.1667 13.7783V10.2228Z","stroke","currentColor","stroke-width","1.25","stroke-linecap","round","stroke-linejoin","round"],["d","M4.5 8.44445C4.5 7.97295 4.6873 7.52077 5.0207 7.18737C5.3541 6.85397 5.80628 6.66667 6.27778 6.66667H13.3889C13.8604 6.66667 14.3126 6.85397 14.646 7.18737C14.9794 7.52077 15.1667 7.97295 15.1667 8.44445V15.5556C15.1667 16.0271 14.9794 16.4792 14.646 16.8126C14.3126 17.146 13.8604 17.3333 13.3889 17.3333H6.27778C5.80628 17.3333 5.3541 17.146 5.0207 16.8126C4.6873 16.4792 4.5 16.0271 4.5 15.5556V8.44445Z","stroke","currentColor","stroke-width","1.25","stroke-linecap","round","stroke-linejoin","round"],["d","M19 12V14.1667C19 14.3582 18.9239 14.5419 18.7885 14.6773C18.653 14.8128 18.4693 14.8889 18.2778 14.8889H6.72222C6.53068 14.8889 6.34698 14.8128 6.21153 14.6773C6.07609 14.5419 6 14.3582 6 14.1667V6.94444C6 6.75289 6.07609 6.56919 6.21153 6.43375C6.34698 6.2983 6.53068 6.22221 6.72222 6.22221H13.2222M8.88889 17.7778H16.1111M10.3333 14.8889V17.7778M14.6667 14.8889V17.7778M16.1111 6.22221H19M19 6.22221V9.1111M19 6.22221L15.3889 9.83333","stroke","currentColor","stroke-width","1.25","stroke-linecap","round","stroke-linejoin","round"],[3,"matMenuTriggerFor"],["part","button-container",1,"action-btn","action-dropdown"],["part","button-icon","viewBox","0 0 25 24","fill","none","xmlns","http://www.w3.org/2000/svg",1,"action-btn-icon","action-dropdown-icon"],["width","16","height","16","viewBox","0 0 16 16","fill","none","xmlns","http://www.w3.org/2000/svg",1,"toolbar-icon-dropdown-arrow"],["fill-rule","evenodd","clip-rule","evenodd","d","M12.2071 5.79289C11.8166 5.40237 11.1834 5.40237 10.7929 5.79289L8 8.58579L5.20711 5.79289C4.81658 5.40237 4.18342 5.40237 3.79289 5.79289C3.40237 6.18342 3.40237 6.81658 3.79289 7.20711L7.29289 10.7071C7.68342 11.0976 8.31658 11.0976 8.70711 10.7071L12.2071 7.20711C12.5976 6.81658 12.5976 6.18342 12.2071 5.79289Z","fill","currentColor"],["d","M19 12V14.1667C19 14.3582 18.9239 14.5419 18.7885 14.6773C18.653 14.8128 18.4693 14.8889 18.2778 14.8889H6.72222C6.53068 14.8889 6.34698 14.8128 6.21153 14.6773C6.07609 14.5419 6 14.3582 6 14.1667V6.94444C6 6.75289 6.07609 6.56919 6.21153 6.43375C6.34698 6.2983 6.53068 6.22221 6.72222 6.22221H13.2222M8.88889 17.7778H16.1111M10.3333 14.8889V17.7778M14.6667 14.8889V17.7778M16.1111 6.22221H19M19 6.22221V9.1111M19 6.22221L15.3889 9.83333","stroke","#8F95B2","stroke-width","1.25","stroke-linecap","round","stroke-linejoin","round"],[3,"veltDraggableOverlay","attendees","user","audioState","videoState","screenSharingState","toggleAudio","toggleVideo","toggleScreenSharing","leave",4,"ngIf"],[3,"toggleAudio","toggleVideo","toggleScreenSharing","leave","veltDraggableOverlay","attendees","user","audioState","videoState","screenSharingState"],["class","huddle-banner",4,"ngIf"],[1,"huddle-banner"],["width","24","height","24","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg"],["d","M12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM12 17C11.45 17 11 16.55 11 16V12C11 11.45 11.45 11 12 11C12.55 11 13 11.45 13 12V16C13 16.55 12.55 17 12 17ZM13 9H11V7H13V9Z","fill","#625DF5"],[1,"title"],[1,"subtitle"],[1,"action-btn-container"],[1,"join-btn",3,"click"],[1,"cancel-btn",3,"click"],["width","24","height","24","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg",1,"close-btn",3,"click"],["fill-rule","evenodd","clip-rule","evenodd","d","M5.29289 5.29289C5.68342 4.90237 6.31658 4.90237 6.70711 5.29289L12 10.5858L17.2929 5.29289C17.6834 4.90237 18.3166 4.90237 18.7071 5.29289C19.0976 5.68342 19.0976 6.31658 18.7071 6.70711L13.4142 12L18.7071 17.2929C19.0976 17.6834 19.0976 18.3166 18.7071 18.7071C18.3166 19.0976 17.6834 19.0976 17.2929 18.7071L12 13.4142L6.70711 18.7071C6.31658 19.0976 5.68342 19.0976 5.29289 18.7071C4.90237 18.3166 4.90237 17.6834 5.29289 17.2929L10.5858 12L5.29289 6.70711C4.90237 6.31658 4.90237 5.68342 5.29289 5.29289Z","fill","#777E91"]],template:function(i,r){i&1&&g(0,UGt,29,27,"ng-container",5),i&2&&c("ngIf",r.componentConfigSignal())},dependencies:[Z,Li,Yi,Vn,An,Il,Gs,wp,jfe,$fe,de],styles:[`html{--velt-base-rem-unit: 1}*[data-snippyly-element=true],*[data-velt-element=true]{font-family:var(--velt-default-font-family)}velt-wireframe{display:none!important}*{box-sizing:border-box;-webkit-tap-highlight-color:rgba(255,255,255,0)!important;outline:none!important;margin:0!important;padding:0!important;text-align:left!important;line-height:1.5!important;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))}*:empty{display:revert!important}.huddle-tool-container{width:max-content}.icon-btn{border:1px solid #2d2d2d;border-radius:100%;width:40px!important;height:40px!important;display:flex;align-items:center;justify-content:center;color:#2d2d2d!important;fill:#2d2d2d!important;cursor:pointer}.icon-btn:hover{background:#fff5}.icon-btn.background-red{background:red!important;border-color:red!important;color:#fff!important;fill:#fff!important}.icon-btn.background-royalblue{background:#4169e1!important;border-color:#4169e1!important}.icon-btn:before{content:""}.drop-call-btn{transform:rotate(135deg)!important}.action-btn{display:inline-flex;justify-content:center;align-items:center;padding:6px!important;border-radius:var(--legacy-velt-tool-border-radius);border:var(--legacy-velt-tool-border);background-color:var(--legacy-velt-tool-bg-color);color:var(--legacy-velt-tool-icon-color);cursor:pointer}.action-btn .action-btn-label{font-size:calc((.9rem + 0px) * var(--velt-base-rem-unit))!important;padding-right:4px!important;font-weight:700!important;color:currentColor!important}.action-btn .action-btn-icon{width:calc((var(--legacy-velt-tool-icon-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-tool-icon-size) + 0px) * var(--velt-base-rem-unit));color:currentColor}.action-btn .toolbar-icon-dropdown-arrow{width:16px;height:16px;color:currentColor}.action-btn:focus{border-radius:var(--legacy-velt-tool-focus-border-radius);border:var(--legacy-velt-tool-focus-border);background-color:var(--legacy-velt-tool-focus-bg-color);color:var(--legacy-velt-tool-focus-icon-color)}.action-btn:focus .action-btn-icon{width:calc((var(--legacy-velt-tool-focus-icon-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-tool-focus-icon-size) + 0px) * var(--velt-base-rem-unit))}.action-btn:focus .toolbar-icon-dropdown-arrow{color:var(--legacy-velt-tool-focus-icon-color)}.action-btn:hover{border-radius:var(--legacy-velt-tool-hover-border-radius);border:var(--legacy-velt-tool-hover-border);background-color:var(--legacy-velt-tool-hover-bg-color);color:var(--legacy-velt-tool-hover-icon-color)}.action-btn:hover .action-btn-icon{width:calc((var(--legacy-velt-tool-hover-icon-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-tool-hover-icon-size) + 0px) * var(--velt-base-rem-unit))}.action-btn:hover .toolbar-icon-dropdown-arrow{color:var(--legacy-velt-tool-hover-icon-color)}.action-btn:active,.action-btn.active{border-radius:var(--legacy-velt-tool-active-border-radius);border:var(--legacy-velt-tool-active-border);background-color:var(--legacy-velt-tool-active-bg-color);color:var(--legacy-velt-tool-active-icon-color)}.action-btn:active .action-btn-icon,.action-btn.active .action-btn-icon{width:calc((var(--legacy-velt-tool-active-icon-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-tool-active-icon-size) + 0px) * var(--velt-base-rem-unit))}.action-btn:active .toolbar-icon-dropdown-arrow,.action-btn.active .toolbar-icon-dropdown-arrow{color:var(--legacy-velt-tool-active-icon-color)}
418
418
  `],encapsulation:3,changeDetection:0});let n=o;return n})();function jGt(n,o){if(n&1&&(C(0,"span",11),te(1),A(2,"translate"),S()),n&2){let t=l(2).ngIf;d(),ve(" ",t.user!=null&&t.user.name?t.user==null||t.user.name==null?null:t.user.name.charAt(0):P(2,1,t.user==null||t.user.email==null?null:t.user.email.charAt(0)),"")}}function $Gt(n,o){if(n&1){let t=q();C(0,"img",12),G("error",function(){N(t);let i=l(3);return F(i.onImageLoadError())}),S()}if(n&2){let t=l(2).ngIf;c("src",t.user==null?null:t.user.photoUrl,dn)}}function HGt(n,o){if(n&1&&(C(0,"span"),te(1),A(2,"translate"),S()),n&2){let t=l(2).ngIf;d(),je(t.isRemoteStream?t.user==null||t.user.name==null?null:t.user.name.split(" ")[0]:P(2,1,"You"))}}function zGt(n,o){n&1&&(le(),C(0,"svg",15),w(1,"path",16),S())}function GGt(n,o){n&1&&(le(),C(0,"svg",17),w(1,"path",18)(2,"path",19),S())}function WGt(n,o){if(n&1&&(f(0),g(1,zGt,2,0,"svg",13)(2,GGt,3,0,"svg",14),v()),n&2){let t=l(2).ngIf;d(),c("ngIf",t.audioState),d(),c("ngIf",!t.audioState)}}function qGt(n,o){n&1&&(le(),C(0,"svg",15),w(1,"path",16),S())}function YGt(n,o){n&1&&(le(),C(0,"svg",17),w(1,"path",18)(2,"path",19),S())}function KGt(n,o){n&1&&(le(),C(0,"svg",23),w(1,"path",24),S())}function ZGt(n,o){n&1&&(le(),C(0,"svg",17)(1,"g"),w(2,"path",25)(3,"path",19),S()())}function XGt(n,o){if(n&1){let t=q();C(0,"div",20),G("click",function(i){return N(t),F(i.stopPropagation())}),C(1,"div",21),G("click",function(){N(t);let i=l(3);return F(i.onToggleAudioClick())}),g(2,qGt,2,0,"svg",13)(3,YGt,3,0,"svg",14),S(),C(4,"div",21),G("click",function(){N(t);let i=l(3);return F(i.onToggleVideoClick())}),g(5,KGt,2,0,"svg",22)(6,ZGt,4,0,"svg",14),S()()}if(n&2){let t=l(2).ngIf;d(2),c("ngIf",t.audioState),d(),c("ngIf",!t.audioState),d(2),c("ngIf",t.videoState),d(),c("ngIf",!t.videoState)}}function QGt(n,o){if(n&1){let t=q();C(0,"div",20),G("click",function(i){return N(t),F(i.stopPropagation())}),C(1,"div",21),G("click",function(){N(t);let i=l(3);return F(i.onToggleHuddleOnCursor())}),le(),C(2,"svg",17),w(3,"path",26),S()()()}}function JGt(n,o){if(n&1){let t=q();C(0,"div",3),G("click",function(){N(t);let i=l(2);return F(i.toggleSelection())}),C(1,"div",4),w(2,"video",5),C(3,"div",6)(4,"span",7),A(5,"translate"),g(6,jGt,3,3,"span",8)(7,$Gt,1,1,"ng-template",null,0,De),S()(),C(9,"div",9),g(10,HGt,3,3,"span",1)(11,WGt,3,2,"ng-container",1),S()(),g(12,XGt,7,4,"div",10)(13,QGt,4,0,"div",10),S()}if(n&2){let t=pe(8),e=l().ngIf,i=l();ge("local-stream",!e.isRemoteStream)("video-off",!e.videoState)("speaking",e.audioState)("selected",i.selected),d(2),ge("flip",!e.isRemoteStream),c("srcObject",e.isRemoteStream?e.remoteVideoStream:e.stream)("muted",e.isRemoteStream?null:"muted")("volume",e.isRemoteStream?1:0),d(2),rt("color",(e.user==null?null:e.user.color)+" !important")("background-color",(e.user==null?null:e.user.color)+" !important"),c("title",P(5,24,(e.user==null?null:e.user.name)||(e.user==null?null:e.user.email))),d(2),c("ngIf",e.showInitials)("ngIfElse",t),d(4),c("ngIf",e.user==null?null:e.user.name),d(),c("ngIf",e.isRemoteStream),d(),c("ngIf",!e.isRemoteStream),d(),c("ngIf",e.isRemoteStream)}}function eWt(n,o){if(n&1&&(f(0),g(1,JGt,14,26,"div",2),v()),n&2){let t=o.ngIf;d(),c("ngIf",t.isRemoteStream?t.remoteVideoStream:t.stream)}}var Hfe=(()=>{let o=class o{get remoteStream(){return this._remoteStream}set remoteStream(e){this._remoteStream=e}constructor(e){this.loggingService=e,this.toggleAudio=new Ae,this.toggleVideo=new Ae,this.toggleHuddleOnCursor=new Ae,this.veltElement=!0,this.componentConfigSignal=Te({isRemoteStream:this.isRemoteStream,remoteVideoStream:this.remoteVideoStream,stream:this.stream,videoState:this.videoState,audioState:this.audioState,user:this.user,selected:this.selected,showInitials:!1})}ngOnChanges(e){try{this.loggingService.log("%c[WB] Calling VideoHuddleUserComponent FUNCTION: ngOnChanges","color: green;"),e&&Object.keys(e).forEach(i=>{this.componentConfigSignal.update(r=>(r=T(I({},r),{[i]:e[i].currentValue}),r))})}catch(i){this.loggingService.catch("Error in VideoHuddleUserComponent ngOnChanges: ",i)}}onToggleAudioClick(){this.toggleAudio.emit()}onToggleVideoClick(){this.toggleVideo.emit()}toggleSelection(){this.componentConfigSignal.update(e=>(e.selected=!e.selected,e))}onImageLoadError(){this.loggingService.log("%c[WB] Calling FUNCTION: onImageLoadError","color: green;");try{this.componentConfigSignal.update(e=>(e=T(I({},e),{showInitials:!0}),e))}catch(e){this.loggingService.catch("Error in VideoHuddleUserComponent onImageLoadError: ",e)}}onToggleHuddleOnCursor(){this.loggingService.log("%c[WB] Calling FUNCTION: onToggleHuddleOnCursor","color: green;");try{this.toggleHuddleOnCursor.emit()}catch(e){this.loggingService.catch("Error in VideoHuddleUserComponent onToggleHuddleOnCursor: ",e)}}};o.\u0275fac=function(i){return new(i||o)(u(y))},o.\u0275cmp=O({type:o,selectors:[["snippyly-video-huddle-user"]],hostVars:1,hostBindings:function(i,r){i&2&&x("data-velt-element",r.veltElement)},inputs:{stream:"stream",selected:"selected",isRemoteStream:"isRemoteStream",user:"user",audioState:"audioState",videoState:"videoState",remoteStream:"remoteStream",remoteVideoStream:"remoteVideoStream"},outputs:{toggleAudio:"toggleAudio",toggleVideo:"toggleVideo",toggleHuddleOnCursor:"toggleHuddleOnCursor"},standalone:!1,features:[Xe],decls:1,vars:1,consts:[["showAvatarImgRef",""],[4,"ngIf"],["class","video-huddle-block",3,"local-stream","video-off","speaking","selected","click",4,"ngIf"],[1,"video-huddle-block",3,"click"],[1,"video-player-container"],["playsinline","","autoplay","true",3,"srcObject","muted","volume"],[1,"user-profile-container"],["velt-ignore-change-detection","true",1,"s-presence-avatar",3,"title"],["class","s-presence-avatar-initial",4,"ngIf","ngIfElse"],[1,"video-player-overlay"],["class","video-huddle-actions-panel",3,"click",4,"ngIf"],[1,"s-presence-avatar-initial"],["referrerpolicy","no-referrer","loading","lazy",1,"s-presence-avatar-image",3,"error","src"],["width","13","height","19","viewBox","0 0 13 19","fill","none","xmlns","http://www.w3.org/2000/svg",4,"ngIf"],["width","20","height","20","viewBox","0 0 20 20","fill","none","xmlns","http://www.w3.org/2000/svg",4,"ngIf"],["width","13","height","19","viewBox","0 0 13 19","fill","none","xmlns","http://www.w3.org/2000/svg"],["fill-rule","evenodd","clip-rule","evenodd","d","M5.77526 0.888917C4.98766 1.03653 4.34477 1.39041 3.76525 1.99544C3.26289 2.51988 2.94255 3.10884 2.75974 3.84431C2.69679 4.09753 2.6908 4.39635 2.6908 7.29276C2.6908 10.7979 2.68044 10.6352 2.94799 11.327C3.299 12.2346 4.07584 13.0561 4.94368 13.4374C5.82412 13.8243 6.82444 13.8531 7.71552 13.5173C8.69181 13.1494 9.53872 12.2934 9.92297 11.2862C10.1713 10.6354 10.1631 10.7714 10.1631 7.29276C10.1631 3.78764 10.1735 3.95032 9.90592 3.25855C9.62932 2.54335 9.02923 1.81042 8.38767 1.40419C7.61998 0.918084 6.64549 0.725873 5.77526 0.888917ZM6.9551 2.18212C7.80033 2.36379 8.55484 3.08137 8.82443 3.95997C8.91085 4.24162 8.9112 4.25479 8.9112 7.29276C8.9112 10.3307 8.91085 10.3439 8.82443 10.6256C8.578 11.4287 7.92854 12.0994 7.15071 12.3538C6.92897 12.4264 6.7875 12.4431 6.40739 12.4415C6.00213 12.4398 5.89869 12.425 5.65097 12.3333C5.00401 12.0936 4.49038 11.6376 4.2051 11.0497C3.92221 10.4667 3.92452 10.4977 3.92452 7.29276C3.92452 4.09736 3.92315 4.11587 4.19825 3.55135C4.71228 2.49645 5.83136 1.94067 6.9551 2.18212ZM0.537139 8.64006C0.373453 8.71677 0.215048 8.92183 0.182929 9.09861C0.133831 9.36895 0.199086 10.6794 0.283042 11.1082C0.737953 13.4317 2.32631 15.2803 4.50075 16.017C4.75328 16.1025 5.14915 16.2055 5.38044 16.2458L5.801 16.3192V16.9744V17.6296L5.06042 17.6421C4.38416 17.6536 4.31046 17.6619 4.21195 17.738C4.00671 17.8964 3.94271 18.0255 3.94271 18.2809C3.94271 18.5363 4.00679 18.6655 4.21206 18.8237C4.31804 18.9055 4.36006 18.907 6.42696 18.907C8.49385 18.907 8.53586 18.9055 8.64185 18.8237C8.84712 18.6655 8.9112 18.5363 8.9112 18.2809C8.9112 18.0255 8.8472 17.8964 8.64196 17.738C8.54346 17.6619 8.46975 17.6536 7.79349 17.6421L7.05291 17.6296V16.9744V16.3192L7.47347 16.2469C9.74567 15.8564 11.6474 14.1569 12.3699 11.8711C12.6066 11.1222 12.6648 10.7131 12.6659 9.79054C12.6668 9.05017 12.6614 8.98828 12.5862 8.8841C12.4332 8.67197 12.3081 8.60568 12.0605 8.60568C11.8131 8.60568 11.6881 8.67181 11.5348 8.88378C11.4622 8.9842 11.4515 9.07453 11.4282 9.79025C11.4001 10.6516 11.3449 11.0079 11.1515 11.5749C10.8931 12.3325 10.527 12.9264 9.95298 13.5192C9.22696 14.2689 8.41181 14.7274 7.405 14.9524C6.91168 15.0626 5.87256 15.0542 5.38588 14.936C4.37192 14.6897 3.6185 14.2601 2.90093 13.5192C2.32689 12.9264 1.96079 12.3325 1.70239 11.5749C1.50901 11.0079 1.45377 10.6516 1.42568 9.79025C1.39755 8.92635 1.3871 8.88689 1.13621 8.69342C1.00672 8.5936 0.695505 8.56589 0.537139 8.64006Z","fill","#FF7162"],["width","20","height","20","viewBox","0 0 20 20","fill","none","xmlns","http://www.w3.org/2000/svg"],["fill-rule","evenodd","clip-rule","evenodd","d","M9.77526 0.888917C8.98766 1.03653 8.34477 1.39041 7.76525 1.99544C7.26289 2.51988 6.94255 3.10884 6.75974 3.84431C6.69679 4.09753 6.6908 4.39635 6.6908 7.29276C6.6908 10.7979 6.68044 10.6352 6.94799 11.327C7.299 12.2346 8.07584 13.0561 8.94368 13.4374C9.82412 13.8243 10.8244 13.8531 11.7155 13.5173C12.6918 13.1494 13.5387 12.2934 13.923 11.2862C14.1713 10.6354 14.1631 10.7714 14.1631 7.29276C14.1631 3.78764 14.1735 3.95032 13.9059 3.25855C13.6293 2.54335 13.0292 1.81042 12.3877 1.40419C11.62 0.918084 10.6455 0.725873 9.77526 0.888917ZM10.9551 2.18212C11.8003 2.36379 12.5548 3.08137 12.8244 3.95997C12.9108 4.24162 12.9112 4.25479 12.9112 7.29276C12.9112 10.3307 12.9108 10.3439 12.8244 10.6256C12.578 11.4287 11.9285 12.0994 11.1507 12.3538C10.929 12.4264 10.7875 12.4431 10.4074 12.4415C10.0021 12.4398 9.89869 12.425 9.65097 12.3333C9.00401 12.0936 8.49038 11.6376 8.2051 11.0497C7.92221 10.4667 7.92452 10.4977 7.92452 7.29276C7.92452 4.09736 7.92315 4.11587 8.19825 3.55135C8.71228 2.49645 9.83136 1.94067 10.9551 2.18212ZM4.53714 8.64006C4.37345 8.71677 4.21505 8.92183 4.18293 9.09861C4.13383 9.36895 4.19909 10.6794 4.28304 11.1082C4.73795 13.4317 6.32631 15.2803 8.50075 16.017C8.75328 16.1025 9.14915 16.2055 9.38044 16.2458L9.801 16.3192V16.9744V17.6296L9.06042 17.6421C8.38416 17.6536 8.31046 17.6619 8.21195 17.738C8.00671 17.8964 7.94271 18.0255 7.94271 18.2809C7.94271 18.5363 8.00679 18.6655 8.21206 18.8237C8.31804 18.9055 8.36006 18.907 10.427 18.907C12.4938 18.907 12.5359 18.9055 12.6418 18.8237C12.8471 18.6655 12.9112 18.5363 12.9112 18.2809C12.9112 18.0255 12.8472 17.8964 12.642 17.738C12.5435 17.6619 12.4697 17.6536 11.7935 17.6421L11.0529 17.6296V16.9744V16.3192L11.4735 16.2469C13.7457 15.8564 15.6474 14.1569 16.3699 11.8711C16.6066 11.1222 16.6648 10.7131 16.6659 9.79054C16.6668 9.05017 16.6614 8.98828 16.5862 8.8841C16.4332 8.67197 16.3081 8.60568 16.0605 8.60568C15.8131 8.60568 15.6881 8.67181 15.5348 8.88378C15.4622 8.9842 15.4515 9.07453 15.4282 9.79025C15.4001 10.6516 15.3449 11.0079 15.1515 11.5749C14.8931 12.3325 14.527 12.9264 13.953 13.5192C13.227 14.2689 12.4118 14.7274 11.405 14.9524C10.9117 15.0626 9.87256 15.0542 9.38588 14.936C8.37192 14.6897 7.6185 14.2601 6.90093 13.5192C6.32689 12.9264 5.96079 12.3325 5.70239 11.5749C5.50901 11.0079 5.45377 10.6516 5.42568 9.79025C5.39755 8.92636 5.3871 8.88689 5.13621 8.69342C5.00672 8.5936 4.69551 8.56589 4.53714 8.64006Z","fill","white"],["d","M19 1L1 19","stroke","#FF7162","stroke-width","1.4","stroke-linecap","round"],[1,"video-huddle-actions-panel",3,"click"],[1,"video-huddle-action-button",3,"click"],["width","19","height","11","viewBox","0 0 19 11","fill","none","xmlns","http://www.w3.org/2000/svg",4,"ngIf"],["width","19","height","11","viewBox","0 0 19 11","fill","none","xmlns","http://www.w3.org/2000/svg"],["fill-rule","evenodd","clip-rule","evenodd","d","M2.55139 0.23203C1.68754 0.455725 1.06855 1.0239 0.766641 1.87017L0.666016 2.15221V5.58961V9.027L0.766892 9.30905C1.0535 10.1102 1.64038 10.6751 2.43987 10.9192L2.70863 11.0013H7.1343H11.56L11.8467 10.9053C12.6234 10.645 13.2099 10.0654 13.47 9.30122C13.56 9.03659 13.5637 8.9921 13.5769 8.03104C13.5844 7.48324 13.6004 7.03508 13.6125 7.03508C13.661 7.03508 15.0857 7.85713 15.8518 8.32715C16.7188 8.85908 16.9126 8.93887 17.338 8.93887C18.0692 8.93887 18.7509 8.40866 18.947 7.6873C19.0174 7.42849 19.0165 3.7478 18.946 3.48726C18.7883 2.90449 18.278 2.40845 17.7016 2.27772C17.4483 2.22025 17.0895 2.2339 16.8373 2.31054C16.6848 2.35687 16.3699 2.52617 15.9107 2.80867C15.3288 3.16675 13.6405 4.14414 13.6039 4.14414C13.5979 4.14414 13.5847 3.71184 13.5747 3.18343C13.5543 2.10543 13.5363 1.99899 13.2916 1.50796C13.0166 0.956034 12.475 0.494788 11.8467 0.277192L11.56 0.177913L7.18806 0.170686C2.95948 0.163705 2.80747 0.165715 2.55139 0.23203ZM11.3211 1.83643C11.5404 1.90052 11.7306 2.05381 11.8398 2.25463L11.9183 2.399V5.57293V8.74683L11.8268 8.92184C11.7122 9.14091 11.4929 9.30852 11.2552 9.35869C11.0123 9.40995 3.20786 9.41115 2.98224 9.35999C2.74243 9.30559 2.53297 9.14483 2.42553 8.93266L2.33236 8.74873V5.58961V2.43048L2.42553 2.24656C2.52985 2.04059 2.7435 1.87225 2.96604 1.82078C3.04208 1.80318 4.88581 1.78753 7.11882 1.78556C10.641 1.78245 11.1578 1.78873 11.3211 1.83643ZM17.3116 5.59366V7.28997L17.2309 7.23801C16.8358 6.98339 15.6936 6.30427 15.1359 5.99233C14.7573 5.78052 14.4468 5.5987 14.4461 5.5883C14.4453 5.57787 14.7874 5.37536 15.2062 5.13827C15.6251 4.90114 16.258 4.52634 16.6128 4.30536C16.9675 4.08438 17.2699 3.90215 17.2847 3.90045C17.2995 3.89876 17.3116 4.6607 17.3116 5.59366Z","fill","#FF7162"],["fill-rule","evenodd","clip-rule","evenodd","d","M3.55139 4.23203C2.68754 4.45573 2.06855 5.0239 1.76664 5.87017L1.66602 6.15221V9.58961V13.027L1.76689 13.309C2.0535 14.1102 2.64038 14.6751 3.43987 14.9192L3.70863 15.0013H8.1343H12.56L12.8467 14.9053C13.6234 14.645 14.2099 14.0654 14.47 13.3012C14.56 13.0366 14.5637 12.9921 14.5769 12.031C14.5844 11.4832 14.6004 11.0351 14.6125 11.0351C14.661 11.0351 16.0857 11.8571 16.8518 12.3271C17.7188 12.8591 17.9126 12.9389 18.338 12.9389C19.0692 12.9389 19.7509 12.4087 19.947 11.6873C20.0174 11.4285 20.0165 7.7478 19.946 7.48726C19.7883 6.90449 19.278 6.40845 18.7016 6.27772C18.4483 6.22025 18.0895 6.2339 17.8373 6.31054C17.6848 6.35687 17.3699 6.52617 16.9107 6.80867C16.3288 7.16675 14.6405 8.14414 14.6039 8.14414C14.5979 8.14414 14.5847 7.71184 14.5747 7.18343C14.5543 6.10543 14.5363 5.99899 14.2916 5.50796C14.0166 4.95603 13.475 4.49479 12.8467 4.27719L12.56 4.17791L8.18806 4.17069C3.95948 4.16371 3.80747 4.16571 3.55139 4.23203ZM12.3211 5.83643C12.5404 5.90052 12.7306 6.05381 12.8398 6.25463L12.9183 6.399V9.57293V12.7468L12.8268 12.9218C12.7122 13.1409 12.4929 13.3085 12.2552 13.3587C12.0123 13.4099 4.20786 13.4111 3.98224 13.36C3.74243 13.3056 3.53297 13.1448 3.42553 12.9327L3.33236 12.7487V9.58961V6.43048L3.42553 6.24656C3.52985 6.04059 3.7435 5.87225 3.96604 5.82078C4.04208 5.80318 5.88581 5.78753 8.11882 5.78556C11.641 5.78245 12.1578 5.78873 12.3211 5.83643ZM18.3116 9.59366V11.29L18.2309 11.238C17.8358 10.9834 16.6936 10.3043 16.1359 9.99233C15.7573 9.78052 15.4468 9.5987 15.4461 9.5883C15.4453 9.57787 15.7874 9.37536 16.2062 9.13827C16.6251 8.90114 17.258 8.52634 17.6128 8.30536C17.9675 8.08438 18.2699 7.90215 18.2847 7.90045C18.2995 7.89876 18.3116 8.6607 18.3116 9.59366Z","fill","white"],["d","M4.69231 5.29805L6.9519 16.6605C7.26158 18.2178 9.31823 18.591 10.1553 17.2418L12.4275 13.5798C12.4611 13.5255 12.5143 13.4861 12.5761 13.4699L16.8289 12.3482C18.3433 11.9488 18.6107 9.91372 17.2509 9.13668L7.27695 3.4373C5.97394 2.69272 4.3996 3.82614 4.69231 5.29805Z","stroke","#E5E5E9","stroke-width","1.5","stroke-linecap","square"]],template:function(i,r){i&1&&g(0,eWt,2,1,"ng-container",1),i&2&&c("ngIf",r.componentConfigSignal())},dependencies:[Z,de],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}*[_ngcontent-%COMP%]{-webkit-tap-highlight-color:rgba(255,255,255,0)!important;outline:none!important;margin:0!important;padding:0!important;text-align:left!important;line-height:1.5!important;color:#000!important;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))}*[_ngcontent-%COMP%]:empty{display:revert!important}*[_ngcontent-%COMP%]:not(svg *){height:unset;width:unset}.video-huddle-block[_ngcontent-%COMP%] video[_ngcontent-%COMP%]{width:100%!important;height:100%!important;pointer-events:none!important}.video-huddle-block[_ngcontent-%COMP%] svg[_ngcontent-%COMP%]{width:20px!important;height:20px!important}.video-huddle-block[_ngcontent-%COMP%] .video-player-container[_ngcontent-%COMP%]{position:relative!important}.video-huddle-block[_ngcontent-%COMP%] .video-player-container[_ngcontent-%COMP%] .video-player-overlay[_ngcontent-%COMP%]{width:100%!important;height:100%!important;position:absolute!important;top:0!important;background:#56565670!important;border-radius:100%!important;display:none!important;flex-direction:column;justify-content:center;align-items:center}.video-huddle-block[_ngcontent-%COMP%] .video-player-container[_ngcontent-%COMP%] .video-player-overlay[_ngcontent-%COMP%] > *[_ngcontent-%COMP%]{margin:calc((.5rem + 0px) * var(--velt-base-rem-unit))!important;color:#fff!important}.video-huddle-block[_ngcontent-%COMP%] .video-player-container[_ngcontent-%COMP%]:hover .video-player-overlay[_ngcontent-%COMP%], .video-huddle-block.video-off[_ngcontent-%COMP%] .user-profile-container[_ngcontent-%COMP%]{display:flex!important}.video-huddle-block.video-off[_ngcontent-%COMP%] video[_ngcontent-%COMP%]{display:none!important}.video-huddle-block[_ngcontent-%COMP%] .user-profile-container[_ngcontent-%COMP%]{width:100%!important;height:100%!important;display:none!important;align-items:center!important;justify-content:center!important;background:#232323!important;border-radius:50%!important}.s-presence-avatar[_ngcontent-%COMP%]{position:relative!important;box-shadow:0 0 0 3px!important;border-radius:50%!important;overflow:hidden!important;width:100%!important;height:100%!important;min-width:100%!important;min-height:100%!important;display:flex!important;align-items:center!important;justify-content:center!important}.s-presence-avatar.more-users[_ngcontent-%COMP%]{background:#4578a7!important;box-shadow:0 0 0 3px #4578a7!important}.attendees-container[_ngcontent-%COMP%]{display:inline-flex!important;flex-direction:row-reverse!important;align-items:center!important;margin:0 16px 0 8px!important}.s-presence-avatar[_ngcontent-%COMP%]:not(:last-child):not(.more-users){margin-left:calc((-.5rem + 0px) * var(--velt-base-rem-unit))!important}.s-presence-avatar-image[_ngcontent-%COMP%]{width:100%!important;height:100%!important;display:block!important;object-fit:cover!important}.s-presence-avatar-image-small[_ngcontent-%COMP%]{width:calc((1.6rem + 0px) * var(--velt-base-rem-unit))!important;height:100%!important;display:block!important;object-fit:cover!important}.s-presence-avatar-initial[_ngcontent-%COMP%]{color:#fff!important;font-size:calc((3rem + 0px) * var(--velt-base-rem-unit))!important}"],changeDetection:0});let n=o;return n})();var nWt=(n,o,t)=>({large:n,medium:o,small:t});function iWt(n,o){if(n&1){let t=q();C(0,"div",3),w(1,"video",4),C(2,"div",5)(3,"div",6),G("click",function(){N(t);let i=l(2);return F(i.onToggleScreenSharing())}),te(4),A(5,"translate"),S()()()}if(n&2){let t=l().ngIf;d(),c("srcObject",t.stream)("volume",0),d(3),je(P(5,3,"Stop Sharing"))}}function oWt(n,o){if(n&1){let t=q();C(0,"div",7),w(1,"video",4),C(2,"div",5)(3,"div"),te(4),A(5,"translate"),S(),C(6,"div",8),le(),C(7,"svg",9),G("click",function(){N(t);let i=l(2);return F(i.changeViewportSize("large"))}),w(8,"path",10)(9,"path",11),S(),C(10,"svg",12),G("click",function(){N(t);let i=l(2);return F(i.changeViewportSize("medium"))}),w(11,"path",13)(12,"path",14),S(),C(13,"svg",15),G("click",function(){N(t);let i=l(2);return F(i.changeViewportSize("small"))}),w(14,"path",16)(15,"path",17),S()()()()}if(n&2){let t=l().ngIf;c("ngClass",$e(13,nWt,t.viewportSize==="large",t.viewportSize==="medium",t.viewportSize==="small")),d(),c("srcObject",t.stream)("volume",0),d(3),gr("",(t.user==null?null:t.user.name)||(t.user==null?null:t.user.email)," ",P(5,11,"is sharing now."),""),d(3),ge("selected",t.viewportSize==="large"),d(3),ge("selected",t.viewportSize==="medium"),d(3),ge("selected",t.viewportSize==="small")}}function rWt(n,o){if(n&1&&(f(0),g(1,iWt,6,5,"div",1)(2,oWt,16,17,"div",2),v()),n&2){let t=o.ngIf;d(),c("ngIf",t.stream&&!t.isRemoteStream),d(),c("ngIf",t.stream&&t.isRemoteStream)}}var zfe=(()=>{let o=class o{constructor(e){this.loggingService=e,this.isRemoteStream=!1,this.toggleScreenSharing=new Ae,this.viewportSizeChange=new Ae,this.veltElement=!0,this.componentConfigSignal=Te({stream:this.stream,isRemoteStream:this.isRemoteStream,viewportSize:"small",user:this.user})}ngOnChanges(e){try{this.loggingService.log("%c[WB] Calling ScreenSharingHuddleComponent FUNCTION: ngOnChanges","color: green;"),e&&Object.keys(e).forEach(i=>{this.componentConfigSignal.update(r=>(r=T(I({},r),{[i]:e[i].currentValue}),r))})}catch(i){this.loggingService.catch("Error in ScreenSharingHuddleComponent ngOnChanges: ",i)}}changeViewportSize(e){this.componentConfigSignal.update(i=>T(I({},i),{viewportSize:e})),this.viewportSizeChange.emit(this.componentConfigSignal().viewportSize)}onToggleScreenSharing(){this.toggleScreenSharing.emit()}};o.\u0275fac=function(i){return new(i||o)(u(y))},o.\u0275cmp=O({type:o,selectors:[["snippyly-screen-sharing-huddle"]],hostVars:1,hostBindings:function(i,r){i&2&&x("data-velt-element",r.veltElement)},inputs:{user:"user",stream:"stream",isRemoteStream:"isRemoteStream"},outputs:{toggleScreenSharing:"toggleScreenSharing",viewportSizeChange:"viewportSizeChange"},standalone:!1,features:[Xe],decls:1,vars:1,consts:[[4,"ngIf"],["class","screen-sharing-container local-screen-sharing-container",4,"ngIf"],["class","screen-sharing-container remote-screen-sharing-container",3,"ngClass",4,"ngIf"],[1,"screen-sharing-container","local-screen-sharing-container"],["autoplay","","muted","true","playsinline","",3,"srcObject","volume"],[1,"screen-sharing-overlay"],[1,"stop-sharing-btn",3,"click"],[1,"screen-sharing-container","remote-screen-sharing-container",3,"ngClass"],[1,"screen-sharing-resize-container"],["width","21","height","20","viewBox","0 0 21 20","fill","none","xmlns","http://www.w3.org/2000/svg",3,"click"],["d","M18.0006 2.5H3.00065C2.08018 2.5 1.33398 3.24619 1.33398 4.16667V13.3333C1.33398 14.2538 2.08018 15 3.00065 15H5.06885C5.33962 15 5.59351 14.8684 5.74966 14.6472L8.45823 10.8101C9.45427 9.39904 11.547 9.39904 12.5431 10.8101L15.2516 14.6472C15.4078 14.8684 15.6617 15 15.9324 15H18.0006C18.9211 15 19.6673 14.2538 19.6673 13.3333V4.16667C19.6673 3.24619 18.9211 2.5 18.0006 2.5Z"],["d","M6.50021 16.1684L9.83354 11.724C10.1669 11.2795 10.8335 11.2795 11.1669 11.724L14.5002 16.1684C14.9122 16.7178 14.5202 17.5017 13.8335 17.5017H7.16688C6.48017 17.5017 6.08819 16.7178 6.50021 16.1684Z"],["width","15","height","12","viewBox","0 0 15 12","fill","none","xmlns","http://www.w3.org/2000/svg",3,"click"],["d","M13.6364 0.167969H1.36364C0.610521 0.167969 0 0.748339 0 1.46426V8.59387C0 9.3098 0.610521 9.89017 1.36364 9.89017H3.0558C3.27734 9.89017 3.48507 9.78785 3.61283 9.61579L5.82893 6.63136C6.64387 5.53387 8.35613 5.53387 9.17107 6.63136L11.3872 9.61579C11.5149 9.78785 11.7227 9.89017 11.9442 9.89017H13.6364C14.3895 9.89017 15 9.3098 15 8.59387V1.46426C15 0.748339 14.3895 0.167969 13.6364 0.167969Z"],["d","M4.22745 10.7981L6.95472 7.34129C7.22745 6.99561 7.7729 6.99561 8.04563 7.34129L10.7729 10.7981C11.11 11.2254 10.7893 11.8351 10.2274 11.8351H4.7729C4.21105 11.8351 3.89034 11.2254 4.22745 10.7981Z"],["width","11","height","10","viewBox","0 0 11 10","fill","none","xmlns","http://www.w3.org/2000/svg",3,"click"],["d","M9.59091 0.832031H1.40909C0.907014 0.832031 0.5 1.24658 0.5 1.75795V6.85053C0.5 7.36191 0.907014 7.77646 1.40909 7.77646H2.5372C2.68489 7.77646 2.82338 7.70337 2.90855 7.58048L4.38595 5.44874C4.92925 4.66482 6.07075 4.66482 6.61405 5.44874L8.09145 7.58048C8.17662 7.70337 8.31511 7.77646 8.4628 7.77646H9.59091C10.093 7.77646 10.5 7.36191 10.5 6.85053V1.75795C10.5 1.24658 10.093 0.832031 9.59091 0.832031Z"],["d","M3.3183 8.42384L5.13648 5.95472C5.3183 5.7078 5.68193 5.7078 5.86375 5.95472L7.68193 8.42384C7.90667 8.72905 7.69286 9.16458 7.3183 9.16458H3.68193C3.30737 9.16458 3.09356 8.72905 3.3183 8.42384Z"]],template:function(i,r){i&1&&g(0,rWt,3,2,"ng-container",0),i&2&&c("ngIf",r.componentConfigSignal())},dependencies:[Br,Z,de],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}*[_ngcontent-%COMP%]{box-sizing:border-box;-webkit-tap-highlight-color:rgba(255,255,255,0)!important;outline:none!important;margin:0!important;padding:0!important;text-align:left!important;line-height:1.5!important;color:#000!important;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))}*[_ngcontent-%COMP%]:empty{display:revert!important}*[_ngcontent-%COMP%]:not(svg *){height:unset;width:unset}[_nghost-%COMP%]{position:fixed;bottom:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;right:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;z-index:2147483607!important}.screen-sharing-container.local-screen-sharing-container[_ngcontent-%COMP%]{width:326px!important;height:216px!important;padding:calc((1.5rem + 0px) * var(--velt-base-rem-unit))!important;background:#fff!important;box-shadow:0 1px 4px #00000029!important;border-radius:20px!important;position:relative!important;overflow:hidden!important}.screen-sharing-container.local-screen-sharing-container[_ngcontent-%COMP%] *[_ngcontent-%COMP%]{color:#fff!important}.screen-sharing-container.local-screen-sharing-container[_ngcontent-%COMP%] .screen-sharing-overlay[_ngcontent-%COMP%]{position:absolute!important;width:100%!important;height:100%!important;top:0!important;background:#fff!important;display:none!important;align-items:center;justify-content:center;color:#fff!important;background:#000000b3!important;left:0!important;font-size:calc((1.5rem + 0px) * var(--velt-base-rem-unit))!important}.screen-sharing-container.local-screen-sharing-container[_ngcontent-%COMP%]:hover .screen-sharing-overlay[_ngcontent-%COMP%]{display:flex!important}.screen-sharing-container.local-screen-sharing-container[_ngcontent-%COMP%] .stop-sharing-btn[_ngcontent-%COMP%]{cursor:pointer!important}.screen-sharing-container.remote-screen-sharing-container[_ngcontent-%COMP%]{width:30vw!important;height:20vh!important;padding:calc((1.5rem + 0px) * var(--velt-base-rem-unit))!important;background:#fff!important;box-shadow:0 1px 4px #00000029!important;border-radius:20px!important;position:relative!important;overflow:hidden!important;transition:width .2s ease-in-out,height .2s ease-in-out}.screen-sharing-container.remote-screen-sharing-container[_ngcontent-%COMP%] *[_ngcontent-%COMP%]{color:#fff!important;text-align:center!important}.screen-sharing-container.remote-screen-sharing-container[_ngcontent-%COMP%] .screen-sharing-overlay[_ngcontent-%COMP%]{position:absolute!important;width:100%!important;height:100%!important;top:0!important;background:#fff!important;display:none!important;align-items:center;justify-content:center;color:#fff!important;background:#000000b3!important;left:0!important;font-size:calc((1.5rem + 0px) * var(--velt-base-rem-unit))!important;flex-direction:column}.screen-sharing-container.remote-screen-sharing-container[_ngcontent-%COMP%] .screen-sharing-overlay[_ngcontent-%COMP%] .screen-sharing-resize-container[_ngcontent-%COMP%]{margin-top:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;background:#000;padding:calc((.5rem + 0px) * var(--velt-base-rem-unit)) calc((1rem + 0px) * var(--velt-base-rem-unit))!important;border-radius:calc((.5rem + 0px) * var(--velt-base-rem-unit))!important;display:flex!important;align-items:center;justify-content:center}.screen-sharing-container.remote-screen-sharing-container[_ngcontent-%COMP%] .screen-sharing-overlay[_ngcontent-%COMP%] .screen-sharing-resize-container[_ngcontent-%COMP%] > svg[_ngcontent-%COMP%]{margin:calc((.5rem + 0px) * var(--velt-base-rem-unit))!important;cursor:pointer!important;fill:#b1b5c4!important}.screen-sharing-container.remote-screen-sharing-container[_ngcontent-%COMP%] .screen-sharing-overlay[_ngcontent-%COMP%] .screen-sharing-resize-container[_ngcontent-%COMP%] > svg.selected[_ngcontent-%COMP%]{fill:#fff!important}.screen-sharing-container.remote-screen-sharing-container[_ngcontent-%COMP%]:hover .screen-sharing-overlay[_ngcontent-%COMP%]{display:flex!important}.screen-sharing-container.remote-screen-sharing-container.medium[_ngcontent-%COMP%]{width:60vw!important;height:60vh!important}.screen-sharing-container.remote-screen-sharing-container.large[_ngcontent-%COMP%]{width:calc(100vw - 5rem)!important;height:calc(100vh - 5rem)!important}video[_ngcontent-%COMP%]{width:100%!important;height:100%!important;border-radius:8px!important}"],changeDetection:0});let n=o;return n})();var pg=(()=>{let o=class o{constructor(e){this.translateService=e}transform(e,...i){try{let a=(new Date().getTime()-new Date(e).getTime())/1e3;if(a<1)return this.translateService.translate("now");let s={y:31536e3,mo:2592e3,w:604800,d:86400,h:3600,m:60,s:1};for(let m in s){let p=Math.floor(a/s[m]);if(p>0)return`${p}${this.translateService.translate(m)}`}return e}catch{return e}}};o.\u0275fac=function(i){return new(i||o)(u(tl,16))},o.\u0275pipe=Hi({name:"timeAgo",type:o,pure:!0,standalone:!1});let n=o;return n})();var gg=(()=>{let o=class o{constructor(e,i){this.domService=e,this.sanitizer=i}transform(e,i=!0){try{let r=i?this.domService.sanitizeHtml(e):e;return this.sanitizer.bypassSecurityTrustHtml(r)}catch{return e}}};o.\u0275fac=function(i){return new(i||o)(u(Ne,16),u(Ls,16))},o.\u0275pipe=Hi({name:"safeHtml",type:o,pure:!0,standalone:!1});let n=o;return n})();function sWt(n,o){if(n&1&&(C(0,"div",21),te(1),A(2,"translate"),A(3,"translate"),S()),n&2){let t=l().$implicit,e=l().ngIf;d(),ve(" ",(t==null||t.from==null?null:t.from.userId)===(e.user==null?null:e.user.userId)?P(2,1,"Me"):P(3,3,(t==null||t.from==null?null:t.from.name)||(t==null||t.from==null?null:t.from.email))," ")}}function lWt(n,o){n&1&&w(0,"velt-skeleton-loader-internal",22)}function cWt(n,o){if(n&1&&(f(0),C(1,"div",15),w(2,"snippyly-user-avatar",16),C(3,"div",17),g(4,sWt,4,5,"div",18)(5,lWt,1,0,"ng-template",null,1,De),C(7,"div",19),te(8),A(9,"timeAgo"),S(),w(10,"div",20),A(11,"translate"),A(12,"safeHtml"),S()(),v()),n&2){let t=o.$implicit,e=pe(6),i=l().ngIf;d(2),c("user",t==null?null:t.from),d(2),c("ngIf",(t==null||t.from==null?null:t.from.userId)===(i.user==null?null:i.user.userId)||(t==null||t.from==null?null:t.from.name)||(t==null||t.from==null?null:t.from.email))("ngIfElse",e),d(4),je(P(9,5,t==null?null:t.timestamp)),d(2),c("innerHTML",P(12,9,P(11,7,(t==null?null:t.message)||"")),Gi)}}function mWt(n,o){if(n&1){let t=q();f(0),C(1,"div",3)(2,"div",4,0)(4,"div",5)(5,"div"),te(6),A(7,"translate"),S(),C(8,"div"),le(),C(9,"svg",6),G("click",function(){N(t);let i=l();return F(i.toggleMessagesPanel())}),w(10,"path",7),S()()(),mt(),C(11,"div",8),g(12,cWt,13,11,"ng-container",9),S(),C(13,"div",10)(14,"textarea",11),A(15,"translate"),Lr("ngModelChange",function(i){let r=N(t).ngIf;return qr(r.message,i)||(r.message=i),F(i)}),G("keydown.enter",function(i){N(t);let r=l();return i.preventDefault(),F(r.sendMessage())}),S(),C(16,"button",12),G("click",function(){N(t);let i=l();return F(i.sendMessage())}),le(),C(17,"svg",13),w(18,"path",14),S()()()()(),v()}if(n&2){let t=o.ngIf,e=l();d(),ge("visible",t.messagesPanelVisible)("mobile",t.isPhone),d(5),je(P(7,10,"In-call messages")),d(6),c("ngForOf",t.messages)("ngForTrackBy",e.trackByMessageId),d(2),v1("placeholder",P(15,12,"Type here...")),Fr("ngModel",t.message),d(2),c("disabled",!(t.message!=null&&t.message.trim()))}}var qfe=(()=>{let o=class o{constructor(e,i,r,a){this.authService=e,this.huddleService=i,this.loggingService=r,this.breakpointObserver=a,this.subscriptions=[],this.componentConfigSignal=Te({isPhone:!1,user:null,messages:[],message:"",messagesPanelVisible:!1});try{this.loggingService.log("%c[WB] Creating CLASS: HuddleMessagesPanelComponent","color: blue;"),this.subscriptions.push(this.huddleService.getMessages$().subscribe(s=>{s.sort((m,p)=>m?.timestamp-p?.timestamp),this.componentConfigSignal.update(m=>T(I({},m),{messages:s}))})),this.subscriptions.push(this.huddleService.getMessagesPanelVisible$().subscribe(s=>{this.componentConfigSignal.update(m=>T(I({},m),{messagesPanelVisible:s}))})),this.subscriptions.push(this.authService.getUser$().subscribe(s=>{this.componentConfigSignal.update(m=>T(I({},m),{user:s}))})),this.subscriptions.push(this.breakpointObserver.observe(Oi.XSmall).subscribe(s=>{s.matches?this.componentConfigSignal.update(m=>T(I({},m),{isPhone:!0})):this.componentConfigSignal.update(m=>T(I({},m),{isPhone:!1}))},s=>{this.loggingService.catch("Error in HuddleMessagesPanelComponent breakpointObserver subscription: ",s)}))}catch(s){this.loggingService.catch("Error in HuddleMessagesPanelComponent constructor: ",s)}}ngOnInit(){}trackByMessageId(e,i){return i.id||e}highlightLinks(e){this.loggingService.log("%c[WB] Calling FUNCTION: highlightLinks","color: green;");try{return e&&(e=e?.replaceAll("&amp;","&")),e.replaceAll(j.REGEX_URL,r=>new RegExp(j.REGEX_EMAIL).test("@"+r)?r:`<a class="message-link" href="${r}" target="_blank">${r}</a>`)}catch(i){return this.loggingService.catch("Error in HuddleMessagesPanelComponent highlightLinks: ",i),""}}sendMessage(){this.loggingService.log("%c[WB] Calling FUNCTION: sendMessage","color: green;");try{let e=this.componentConfigSignal().message?.trim();if(!e)return;e=this.highlightLinks(e),this.huddleService.sendMessage(e),this.componentConfigSignal.update(i=>T(I({},i),{message:""}))}catch(e){this.loggingService.catch("Error in HuddleMessagesPanelComponent sendMessage: ",e)}}toggleMessagesPanel(){try{this.loggingService.log("%c[WB] Calling FUNCTION: toggleMessagesPanel","color: green;"),this.huddleService.toggleMessagesPanel()}catch(e){this.loggingService.catch("Error in HuddleMessagesPanelComponent toggleMessagesPanel: ",e)}}ngOnDestroy(){try{this.loggingService.log("%c[WB] Calling FUNCTION: onDestroy","color: green;"),this.subscriptions.forEach(e=>e.unsubscribe())}catch(e){this.loggingService.catch("Error in HuddleMessagesPanelComponent ngOnDestroy: ",e)}}};o.\u0275fac=function(i){return new(i||o)(u(He),u(pr),u(y),u(po))},o.\u0275cmp=O({type:o,selectors:[["velt-huddle-messages-panel-internal"]],standalone:!1,decls:1,vars:1,consts:[["sidebarRef",""],["loadingTemplateRef",""],[4,"ngIf"],["part","container","data-velt-element","true","data-velt-comment-disabled","true",1,"s-sidebar-container"],[1,"s-sidebar"],[1,"v-huddle-messages-header"],["width","24","height","24","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg",1,"v-huddle-message-panel-close-btn",3,"click"],["fill-rule","evenodd","clip-rule","evenodd","d","M5.29289 5.29289C5.68342 4.90237 6.31658 4.90237 6.70711 5.29289L12 10.5858L17.2929 5.29289C17.6834 4.90237 18.3166 4.90237 18.7071 5.29289C19.0976 5.68342 19.0976 6.31658 18.7071 6.70711L13.4142 12L18.7071 17.2929C19.0976 17.6834 19.0976 18.3166 18.7071 18.7071C18.3166 19.0976 17.6834 19.0976 17.2929 18.7071L12 13.4142L6.70711 18.7071C6.31658 19.0976 5.68342 19.0976 5.29289 18.7071C4.90237 18.3166 4.90237 17.6834 5.29289 17.2929L10.5858 12L5.29289 6.70711C4.90237 6.31658 4.90237 5.68342 5.29289 5.29289Z","fill","#777E91"],[1,"v-huddle-messages-container"],[4,"ngFor","ngForOf","ngForTrackBy"],[1,"v-huddle-message-box-container"],["name","message","rows","1",1,"v-huddle-message-box-input",3,"ngModelChange","keydown.enter","placeholder","ngModel"],[1,"v-huddle-message-box-send-btn",3,"click","disabled"],["width","24","height","24","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg"],["d","M20.8089 10.1394L4.6724 3.15546C3.9926 2.8612 3.22459 2.99065 2.66814 3.49311C2.1117 3.99565 1.87896 4.76995 2.06084 5.51382L3.49713 11.3888H10.5294C10.853 11.3888 11.1154 11.6625 11.1154 12C11.1154 12.3375 10.853 12.6112 10.5294 12.6112H3.49713L2.06084 18.4862C1.87896 19.2301 2.11166 20.0044 2.66814 20.5069C3.22572 21.0104 3.99381 21.1382 4.67244 20.8445L20.8089 13.8606C21.5436 13.5426 22 12.8297 22 12C22 11.1703 21.5436 10.4574 20.8089 10.1394Z","fill","#777E90"],[1,"v-huddle-message-block"],[3,"user"],[1,"v-huddle-message-block-right"],["class","v-huddle-message-block-user",4,"ngIf","ngIfElse"],[1,"v-huddle-message-block-time"],[1,"v-huddle-message-block-message",3,"innerHTML"],[1,"v-huddle-message-block-user"],["height","20px","width","80px","borderRadius","20px"]],template:function(i,r){i&1&&g(0,mWt,19,14,"ng-container",2),i&2&&c("ngIf",r.componentConfigSignal())},dependencies:[ht,Z,da,Wa,wa,Hn,Io,pg,gg,de],styles:[`html{--velt-base-rem-unit: 1}*[data-snippyly-element=true],*[data-velt-element=true]{font-family:var(--velt-default-font-family)}velt-wireframe{display:none!important}:host{--velt-green: var(--velt-light-mode-green);--velt-magenta: var(--velt-light-mode-magenta);--velt-amber: var(--velt-light-mode-amber);--velt-purple: var(--velt-light-mode-purple);--velt-cyan: var(--velt-light-mode-cyan);--velt-orange: var(--velt-light-mode-orange);--velt-black: var(--velt-light-mode-black);--velt-white: var(--velt-light-mode-white);--velt-gray: var(--velt-light-mode-gray);--velt-error: var(--velt-light-mode-error);--velt-error-hover: var(--velt-light-mode-error-hover);--velt-error-foreground: var(--velt-light-mode-error-foreground);--velt-error-light: var(--velt-light-mode-error-light);--velt-error-transparent: var(--velt-light-mode-error-transparent);--velt-warning: var(--velt-light-mode-warning);--velt-warning-hover: var(--velt-light-mode-warning-hover);--velt-warning-foreground: var(--velt-light-mode-warning-foreground);--velt-warning-light: var(--velt-light-mode-warning-light);--velt-warning-transparent: var(--velt-light-mode-warning-transparent);--velt-success: var(--velt-light-mode-success);--velt-success-hover: var(--velt-light-mode-success-hover);--velt-success-foreground: var(--velt-light-mode-success-foreground);--velt-success-light: var(--velt-light-mode-success-light);--velt-success-transparent: var(--velt-light-mode-success-transparent);--velt-accent: var(--velt-light-mode-accent);--velt-accent-text: var(--velt-light-mode-accent-text);--velt-accent-hover: var(--velt-light-mode-accent-hover);--velt-accent-foreground: var(--velt-light-mode-accent-foreground);--velt-accent-light: var(--velt-light-mode-accent-light);--velt-accent-transparent: var(--velt-light-mode-accent-transparent);--velt-text-0: var(--velt-light-mode-text-0);--velt-text-1: var(--velt-light-mode-text-1);--velt-text-2: var(--velt-light-mode-text-2);--velt-text-3: var(--velt-light-mode-text-3);--velt-text-4: var(--velt-light-mode-text-4);--velt-text-5: var(--velt-light-mode-text-5);--velt-text-6: var(--velt-light-mode-text-6);--velt-text-7: var(--velt-light-mode-text-7);--velt-text-8: var(--velt-light-mode-text-8);--velt-text-9: var(--velt-light-mode-text-9);--velt-text-10: var(--velt-light-mode-text-10);--velt-text-11: var(--velt-light-mode-text-11);--velt-text-12: var(--velt-light-mode-text-12);--velt-background-0: var(--velt-light-mode-background-0);--velt-background-1: var(--velt-light-mode-background-1);--velt-background-2: var(--velt-light-mode-background-2);--velt-background-3: var(--velt-light-mode-background-3);--velt-background-4: var(--velt-light-mode-background-4);--velt-background-5: var(--velt-light-mode-background-5);--velt-background-6: var(--velt-light-mode-background-6);--velt-background-7: var(--velt-light-mode-background-7);--velt-background-8: var(--velt-light-mode-background-8);--velt-background-9: var(--velt-light-mode-background-9);--velt-background-10: var(--velt-light-mode-background-10);--velt-border-0: var(--velt-light-mode-border-0);--velt-border-1: var(--velt-light-mode-border-1);--velt-border-2: var(--velt-light-mode-border-2);--velt-border-3: var(--velt-light-mode-border-3);--velt-border-4: var(--velt-light-mode-border-4);--velt-border-5: var(--velt-light-mode-border-5);--velt-border-6: var(--velt-light-mode-border-6);--velt-border-7: var(--velt-light-mode-border-7);--velt-border-8: var(--velt-light-mode-border-8);--velt-border-9: var(--velt-light-mode-border-9);--velt-border-10: var(--velt-light-mode-border-10);--velt-background-transparent: var(--velt-light-mode-background-transparent);--velt-border-transparent: var(--velt-light-mode-border-transparent);--velt-animation-transparent: var(--velt-light-mode-animation-transparent)}:host[dark]{--velt-green: var(--velt-dark-mode-green);--velt-magenta: var(--velt-dark-mode-magenta);--velt-amber: var(--velt-dark-mode-amber);--velt-purple: var(--velt-dark-mode-purple);--velt-cyan: var(--velt-dark-mode-cyan);--velt-orange: var(--velt-dark-mode-orange);--velt-black: var(--velt-dark-mode-black);--velt-white: var(--velt-dark-mode-white);--velt-gray: var(--velt-dark-mode-gray);--velt-error: var(--velt-dark-mode-error);--velt-error-hover: var(--velt-dark-mode-error-hover);--velt-error-foreground: var(--velt-dark-mode-error-foreground);--velt-error-light: var(--velt-dark-mode-error-light);--velt-error-transparent: var(--velt-dark-mode-error-transparent);--velt-warning: var(--velt-dark-mode-warning);--velt-warning-hover: var(--velt-dark-mode-warning-hover);--velt-warning-foreground: var(--velt-dark-mode-warning-foreground);--velt-warning-light: var(--velt-dark-mode-warning-light);--velt-warning-transparent: var(--velt-dark-mode-warning-transparent);--velt-success: var(--velt-dark-mode-success);--velt-success-hover: var(--velt-dark-mode-success-hover);--velt-success-foreground: var(--velt-dark-mode-success-foreground);--velt-success-light: var(--velt-dark-mode-success-light);--velt-success-transparent: var(--velt-dark-mode-success-transparent);--velt-accent: var(--velt-dark-mode-accent);--velt-accent-text: var(--velt-dark-mode-accent-text);--velt-accent-hover: var(--velt-dark-mode-accent-hover);--velt-accent-foreground: var(--velt-dark-mode-accent-foreground);--velt-accent-light: var(--velt-dark-mode-accent-light);--velt-accent-transparent: var(--velt-dark-mode-accent-transparent);--velt-text-0: var(--velt-dark-mode-text-0);--velt-text-1: var(--velt-dark-mode-text-1);--velt-text-2: var(--velt-dark-mode-text-2);--velt-text-3: var(--velt-dark-mode-text-3);--velt-text-4: var(--velt-dark-mode-text-4);--velt-text-5: var(--velt-dark-mode-text-5);--velt-text-6: var(--velt-dark-mode-text-6);--velt-text-7: var(--velt-dark-mode-text-7);--velt-text-8: var(--velt-dark-mode-text-8);--velt-text-9: var(--velt-dark-mode-text-9);--velt-text-10: var(--velt-dark-mode-text-10);--velt-text-11: var(--velt-dark-mode-text-11);--velt-text-12: var(--velt-dark-mode-text-12);--velt-background-0: var(--velt-dark-mode-background-0);--velt-background-1: var(--velt-dark-mode-background-1);--velt-background-2: var(--velt-dark-mode-background-2);--velt-background-3: var(--velt-dark-mode-background-3);--velt-background-4: var(--velt-dark-mode-background-4);--velt-background-5: var(--velt-dark-mode-background-5);--velt-background-6: var(--velt-dark-mode-background-6);--velt-background-7: var(--velt-dark-mode-background-7);--velt-background-8: var(--velt-dark-mode-background-8);--velt-background-9: var(--velt-dark-mode-background-9);--velt-background-10: var(--velt-dark-mode-background-10);--velt-border-0: var(--velt-dark-mode-border-0);--velt-border-1: var(--velt-dark-mode-border-1);--velt-border-2: var(--velt-dark-mode-border-2);--velt-border-3: var(--velt-dark-mode-border-3);--velt-border-4: var(--velt-dark-mode-border-4);--velt-border-5: var(--velt-dark-mode-border-5);--velt-border-6: var(--velt-dark-mode-border-6);--velt-border-7: var(--velt-dark-mode-border-7);--velt-border-8: var(--velt-dark-mode-border-8);--velt-border-9: var(--velt-dark-mode-border-9);--velt-border-10: var(--velt-dark-mode-border-10);--velt-background-transparent: var(--velt-dark-mode-background-transparent);--velt-border-transparent: var(--velt-dark-mode-border-transparent);--velt-animation-transparent: var(--velt-dark-mode-animation-transparent)}.s-sidebar-container{height:100vh;width:calc((22rem + 0px) * var(--velt-base-rem-unit));position:fixed;top:0;right:-100%;padding:calc((1rem + 0px) * var(--velt-base-rem-unit));box-sizing:border-box;z-index:999999997;transition:width .5s ease-in-out,right .5s ease-in-out}.s-sidebar-container.mobile{width:100%!important;height:100%!important;box-sizing:border-box!important;-webkit-backdrop-filter:blur(2px)!important;backdrop-filter:blur(2px)!important}.s-sidebar-container.visible{right:0}.s-sidebar-container .s-sidebar{background:var(--velt-background-0);padding:calc((1rem + 0px) * var(--velt-base-rem-unit));border-radius:var(--velt-border-radius-lg);width:100%;overflow-x:hidden;box-sizing:border-box;position:relative;height:100%;border:1px solid var(--velt-border-5);display:flex;flex-direction:column;justify-content:space-between;gap:calc((.5rem + 0px) * var(--velt-base-rem-unit))}.s-sidebar-container .s-sidebar::-webkit-scrollbar{display:none;width:0;height:0}.s-sidebar-container .s-sidebar:not(.s-overflow-hidden){overflow-y:auto}.s-sidebar-container .v-huddle-message-panel-close-btn{cursor:pointer}.s-sidebar-container .v-huddle-messages-header{display:flex;justify-content:space-between}.s-sidebar-container .v-huddle-messages-container{overflow:auto;flex-grow:1}.s-sidebar-container .v-huddle-messages-container::-webkit-scrollbar{display:none;width:0;height:0}.s-sidebar-container .v-huddle-message-block{display:flex;gap:calc((1rem + 0px) * var(--velt-base-rem-unit));margin-bottom:calc((1rem + 0px) * var(--velt-base-rem-unit))}.s-sidebar-container .v-huddle-message-block .v-huddle-message-block-time{font-size:calc((.5rem + 0px) * var(--velt-base-rem-unit));color:gray;margin-bottom:calc((.25rem + 0px) * var(--velt-base-rem-unit))}.s-sidebar-container .v-huddle-message-block .v-huddle-message-block-message{font-size:calc((.75rem + 0px) * var(--velt-base-rem-unit));word-break:break-word;white-space:pre-wrap}.s-sidebar-container .v-huddle-message-box-container{display:flex;gap:calc((1rem + 0px) * var(--velt-base-rem-unit));align-items:center}.s-sidebar-container .v-huddle-message-box-container .v-huddle-message-box-input{padding:calc((.75rem + 0px) * var(--velt-base-rem-unit));border-radius:8px;border:0;outline:0;background:#f7f7f7;flex-grow:1;font-family:var(--velt-default-font-family);resize:none}.s-sidebar-container .v-huddle-message-box-container .v-huddle-message-box-send-btn{background:transparent;border:0;outline:0;border-radius:100%;width:32px;height:32px;display:flex;align-items:center;justify-content:center;padding:0;cursor:pointer;opacity:1}.s-sidebar-container .v-huddle-message-box-container .v-huddle-message-box-send-btn[disabled]{opacity:.5;cursor:not-allowed}