@veltdev/sdk-dev 4.4.0-beta.47 → 4.4.0-beta.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/velt.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var SNIPPYLY_VERSION = '4.4.0-beta.
|
|
1
|
+
var SNIPPYLY_VERSION = '4.4.0-beta.49';
|
|
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 Pfe=Object.create;var Dw=Object.defineProperty,kfe=Object.defineProperties,Rfe=Object.getOwnPropertyDescriptor,Nfe=Object.getOwnPropertyDescriptors,Ffe=Object.getOwnPropertyNames,ww=Object.getOwnPropertySymbols,fz=Object.getPrototypeOf,f9=Object.prototype.hasOwnProperty,vz=Object.prototype.propertyIsEnumerable,Lfe=Reflect.get;var hz=(n,o,t)=>o in n?Dw(n,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[o]=t,I=(n,o)=>{for(var t in o||={})f9.call(o,t)&&hz(n,t,o[t]);if(ww)for(var t of ww(o))vz.call(o,t)&&hz(n,t,o[t]);return n},T=(n,o)=>kfe(n,Nfe(o));var v9=(n,o)=>{var t={};for(var e in n)f9.call(n,e)&&o.indexOf(e)<0&&(t[e]=n[e]);if(n!=null&&ww)for(var e of ww(n))o.indexOf(e)<0&&vz.call(n,e)&&(t[e]=n[e]);return t};var Bfe=(n,o)=>()=>(o||n((o={exports:{}}).exports,o),o.exports),Aw=(n,o)=>{for(var t in o)Dw(n,t,{get:o[t],enumerable:!0})},Vfe=(n,o,t,e)=>{if(o&&typeof o=="object"||typeof o=="function")for(let i of Ffe(o))!f9.call(n,i)&&i!==t&&Dw(n,i,{get:()=>o[i],enumerable:!(e=Rfe(o,i))||e.enumerable});return n};var Cz=(n,o,t)=>(t=n!=null?Pfe(fz(n)):{},Vfe(o||!n||!n.__esModule?Dw(t,"default",{value:n,enumerable:!0}):t,n));var Pd=(n,o,t)=>Lfe(fz(n),t,o);var ee=(n,o,t)=>new Promise((e,i)=>{var r=c=>{try{s(t.next(c))}catch(p){i(p)}},a=c=>{try{s(t.throw(c))}catch(p){i(p)}},s=c=>c.done?e(c.value):Promise.resolve(c.value).then(r,a);s((t=t.apply(n,o)).next())});var RH=Bfe((Yqi,kH)=>{"use strict";var Ct={};Ct.generateIdentifier=function(){return Math.random().toString(36).substring(2,12)};Ct.localCName=Ct.generateIdentifier();Ct.splitLines=function(n){return n.trim().split(`
|
|
@@ -380,7 +380,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
380
380
|
</svg>
|
|
381
381
|
`},o.GIF_PATHS={CAT_JAM:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/emojis%2Fcatjam.gif?alt=media&token=9868b4ec-0031-4751-bb2e-47bf0f9d9583"},o.\u0275fac=function(i){return new(i||o)(J(Fe),J(y),J(Os))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var er=(()=>{let o=class o{constructor(e,i,r,a,s,c,p,h,_,E,A){this.afAuth=e,this.analyticsService=i,this.authService=r,this.configService=a,this.databaseService=s,this.commonDbService=c,this.docService=p,this.domService=h,this.emojiService=_,this.iamService=E,this.loggingService=A,this.documentPaths=null,this.db=Ci(),this.reactionAnnotationById$=new fe({}),this.customReactions$=new fe({}),this.darkMode$=new fe(null),this.loggingService.log("%c[WB] Creating CLASS: ReactionService","color: blue;"),this.analyticsService.setReactionService(this),this.authService.setReactionService(this),this.databaseService.getDb().pipe(Ne(V=>!!V),Je(1)).subscribe(V=>{V&&(this.db=V,this.getAllReactionAnnotations(void 0,void 0,!0).subscribe())},V=>{this.loggingService.catch("Error in ReactionService getDb subscription: ",V)})}clearCache(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCache in ReactionService","color: green;");try{this.reactionAnnotationById$.next({}),this.customReactions$.next({}),this.documentPaths=null}catch(e){this.loggingService.catch("Error in ReactionService clearCache: ",e)}}getAllReactionAnnotations(e,i,r,a,s){this.loggingService.log("%c[WB] Calling FUNCTION: getAllReactionAnnotations","color: green;");let c,p;try{if(e&&(p=`${fn(e)}`),i&&typeof i=="object"){let h=Xo(i);c=fn(JSON.stringify(h))}}catch(h){this.loggingService.catch("Error in ReactionService getAllReactionAnnotations: ",h)}return Wn(this.afAuth).pipe(Ne(h=>!!h),ge(h=>this.isFeatureAllowed({firebaseUser:h,annotations:[],filteredAnnotations:[]})),ge(h=>h.featureAllowed?this.iamService.isUserAllowed$().pipe(ce(_=>(h.featureAllowed=_,h))):re(h)),ge(h=>h.featureAllowed?re(h).pipe(ge(_=>this.docService.getDocumentPaths$().pipe(ce(E=>(this.documentPaths=E,_.documentPaths=E,_)))),ge(_=>p?this.getDataFromDocumentIds([p]).pipe(ce(E=>(_.annotations=E||[],I({},_)))):this.docService.getDocumentIds$().pipe(ge(E=>{let A=E?.length>0?E.map(V=>V.documentId):[this.documentPaths?.documentId??""];return this.getDataFromDocumentIds(A).pipe(ce(V=>(_.annotations=V||[],I({},_))))}))),ge(_=>this.docService.getLocation$().pipe(ce(E=>(_.location=E,_)))),ge(_=>this.docService.getLocations$().pipe(ce(E=>(_.customLocations=E,_)))),ce(_=>{if(_.filteredAnnotations=[],p&&!c)return _.filteredAnnotations=_.annotations?.slice(),_;{let E=[];return c?E.push(c):(E.push(_?.location?.locationId),E.push(...Object.values(_?.customLocations||[]).map(A=>A.locationId))),_.filteredAnnotations=this.filterAnnotationsByLocationIds(_?.annotations,E),_}}),ge(_=>r?re(_):_?.annotations?.length?this.domService.onWindowResize$().pipe(ce(()=>_)):re(_)),ge(_=>r?re(_):re(_)),ce(_=>_),ge(_=>_?.filteredAnnotations?re(_?.filteredAnnotations||[]):re([]))):re([])),Kt(_o))}isFeatureAllowed(e){return this.configService.getConfig$().pipe(Ne(i=>!!i),ce(i=>T(I({},e),{config:i})),ge(i=>this.authService.getUser$().pipe(ce(r=>T(I({},i),{user:r})))),ge(i=>Zi(i.config,i.user,Re.REACTION)?re(T(I({},i),{featureAllowed:!0})):(this.loggingService.warn("Reaction feature is not allowed."),re(T(I({},i),{featureAllowed:!1})))))}getDataFromDocumentIds(e,i){return this.getDataFromDocuments({documentIds:e,filters:i})}getDataFromDocuments(e){if(this.configService?.getApiKey()){let{documentIds:i,filters:r}=e;if(i?.some(p=>!p)||!this.documentPaths)return re([]);let a=this.docService.getFolderConfig(),s=re([]),c={useCollectionGroup:!0,isCollection:!0,useQuery:!0};if(this.commonDbService.shouldUseFirestore()||(c.documentId=i?.length?i[0]:void 0,c.organizationId=this.documentPaths?.organizationId),a?.veltFolderId&&a?.allDocuments)s=this.commonDbService.dbListener({feature:"allReactions",properties:T(I({},c),{firestoreQuery:[Fi(mt("metadata.apiKey","==",this.configService?.getApiKey()),mt("metadata.veltFolderId","==",a?.veltFolderId),mt("metadata.organizationId","==",this.documentPaths?.organizationId))]})});else{let p=[];for(let h=0;h<(i?.length??0);h+=U.LISTENER_BATCH_SIZE)p.push(i?.slice(h,h+U.LISTENER_BATCH_SIZE)??[]);s=Dn(p.map(h=>this.commonDbService.dbListener({feature:"allReactions",properties:T(I({},c),{firestoreQuery:[Fi(mt("metadata.apiKey","==",this.configService?.getApiKey()),mt("metadata.documentId","in",h),mt("metadata.organizationId","==",this.documentPaths?.organizationId),...a?.veltFolderId?[mt("metadata.veltFolderId","==",a?.veltFolderId)]:[])]})}).pipe($r()))).pipe(ce(h=>ca(h)))}return s.pipe(ce(p=>({data:p?.data,operation:p?.operation})),ce(({data:p,operation:h})=>{let _=[];return p&&(_=Object.values(p??{}).filter(E=>typeof E=="object")),_?.forEach(E=>{this.sanitizeReactionAnnotation(E)}),{data:_,operation:h}}),ce(({data:p,operation:h})=>{if(!i)return{data:p,documentMap:{},operation:h};let _=p.reduce((E,A)=>{let V=A.metadata?.documentId;return V&&(E[V]||(E[V]=[]),E[V].push(A)),E},{});return{data:p,documentMap:_,operation:h}}),ce(({data:p,documentMap:h,operation:_})=>{if(!r)if(_?.type==="removed"){if(_?.ids?.length){let E=this.reactionAnnotationById$.value;_?.ids?.forEach(A=>{delete E?.[A]}),this.reactionAnnotationById$.next(E)}}else Object.entries(h??{}).forEach(([E,A])=>{this.setReactionAnnotationsByOrganizationIdAndDocumentId({organizationId:this.documentPaths?.organizationId,documentId:E,annotations:A})});return p}),Ln(p=>(this.loggingService.catch("Error in ReactionService getDataFromDocumentId: ",p),re([]))))}else return re([])}setReactionAnnotationsByOrganizationIdAndDocumentId({organizationId:e,documentId:i,annotations:r,queryHash:a}){try{if(i){e||(e=U.NO_ORGANIZATION_ID),a||(a=U.DEFAULT_QUERY_HASH);let s={};r?.forEach(p=>{p?.annotationId&&(s[p?.annotationId]=p)});let c=I(I({},this.reactionAnnotationById$.value),s);this.reactionAnnotationById$.next(c)}}catch(s){this.loggingService.catch("Error in ReactionService setReactionAnnotationsByOrganizationIdAndDocumentId:",s)}}getReactionAnnotationsByOrganizationIdAndDocumentId({organizationId:e,documentId:i}){try{let r={};return Object.values(this.reactionAnnotationById$.value??{}).forEach(a=>{a?.metadata?.documentId==i&&a?.metadata?.organizationId==e&&(r[a?.annotationId]=a)}),Object.values(r)}catch(r){return this.loggingService.catch("Error in ReactionService getReactionAnnotationsByOrganizationIdAndDocumentId:",r),[]}}getLocations$(){return this.docService.getLocation$().pipe(ge(e=>this.docService.getLocations$().pipe(ce(i=>({location:e,locations:i})))),ce(e=>{let i=[];return i.push(e?.location?.locationId),i.push(...Object.values(e.locations||[]).map(r=>r.locationId)),i||[]}))}filterAnnotationsByLocationIds(e,i){try{return e.filter(r=>i.includes(r.locationId))}catch(r){return this.loggingService.catch("Error in ReactionService filterAnnotationsByLocations:",r),[]}}getAnnotationById(e,i){try{let r=this.reactionAnnotationById$.value?.[e];if(r){let{documentId:a,organizationId:s}=i||{};if(a&&r.metadata?.documentId!==a||s&&r.metadata?.organizationId!==s)return}return r}catch(r){this.loggingService.catch("Error in ReactionService getAnnotationById: ",r);return}}getBaseMetadataFromReactionAnnotationId(e){try{let i=this.reactionAnnotationById$.value?.[e];return i?i.metadata:void 0}catch(i){this.loggingService.catch("Error in ReactionService getBaseMetadataFromReactionAnnotationId: ",i);return}}getReactionAnnotationByAnnotationId(e,i){try{return this.reactionAnnotationById$.pipe(ce(()=>this.getAnnotationById(e,i)),ge(r=>r?re(r):re(r)))}catch(r){return this.loggingService.catch("Error in ReactionService getReactionAnnotationByAnnotationId: ",r),re(void 0)}}getReactionAnnotationsBySectionId(e){try{return this.reactionAnnotationById$.pipe(ge(i=>this.docService.getDocumentPaths$().pipe(ce(r=>({documentPaths:r,sectionId:e,reactionAnnotationsMap:i})))),ge(i=>{let r=cr(e,["id","data-id"]);if(r){let a=this.docService.getAdditionLocationFromElement(r);if(a){let s=this.docService.genarateLocationId(a);return this.docService.getLocations$().pipe(ce(c=>{let h=Object.values(c||{}).find(_=>_.locationId===s||a?.id&&_.location.id===a.id);return T(I({},i),{additionalLocation:h,locationOnElement:!!a})}))}}return re(T(I({},i),{additionalLocation:null,element:r}))}),ge(i=>i?.locationOnElement?re(i):this.docService.getLocation$().pipe(ce(r=>T(I({},i),{location:r})))),ce(({documentPaths:i,location:r,additionalLocation:a,locationOnElement:s,element:c})=>{let p=null,h=this.docService.getAdditionalDocumentIdFromElement(c),_=h?this.docService.generateDocumentId(h):i?.documentId,E=i?.organizationId;if(_){let A=this.getReactionAnnotationsByOrganizationIdAndDocumentId({organizationId:E,documentId:_});if(A){p=[];for(let V of A)V?.targetElementId===e&&(s?a&&Ou({location:a?.location,locationId:a?.locationId},{location:V.location,locationId:V.locationId})&&p.push(V):r?Ou({location:r?.location,locationId:r?.locationId},{location:V.location,locationId:V.locationId})&&p.push(V):V?.locationId||p.push(V))}}return p}))}catch(i){return this.loggingService.catch("Error in ReactionService getReactionAnnotationsBySectionId: ",i),re(null)}}addOrUpdateReaction(e,i,r,a,s,c,p,h){return ee(this,null,function*(){try{let _=i?.map(E=>this.getAnnotationById(E)).find(E=>E?.icon===e);if(_){if(!p||p==="delete")return yield this.updateUserInReaction(_)}else if(!p||p==="add")return yield this.addReaction(void 0,e,r,a,s,c,h)}catch(_){this.loggingService.catch("Error in ReactionService addOrUpdateReaction: ",_)}})}addReaction(e,i,r,a,s,c,p){return ee(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: addReaction","color: green;");try{let h=this.authService.getUser();if(h)if(h.isReadOnly||h.isAnonymous)this.loggingService.catch("Anonymous/Readonly users cannot add reactions.");else{let _=new vM;if(_.from=h,_.lastUpdated=this.timestamp,_.reactions=[],_.reactions.push({from:h,lastUpdated:this.timestamp}),a&&(_.targetElementId=a),s&&(_.commentAnnotationId=s),this.setLocationToReactionAnnotation(_),_.pageInfo=_i(),_.pageInfo&&(_.pageInfo.screenWidth=this.domService.getCurrentWindowSizeValue()?.screenWidth),i)if(_.icon=i,c)_.iconUrl=c?.url,_.iconEmoji=c?.emoji;else{let E=this.customReactions$.value;if(E){let A=E[i];A?.url&&(_.iconUrl=A?.url),A?.emoji&&(_.iconEmoji=A?.emoji)}}return r&&(_.location={},_.location=I({},r),_.locationId=this.docService.genarateLocationId(_.location)),yield this.saveReactionToDb(_)}}catch(h){this.loggingService.catch("Error in ReactionService addReaction: ",h)}})}setLocationToReactionAnnotation(e){try{let i=this.docService.getLocation();i?(e.locationId=i.locationId,e.location=i.location):(delete e.locationId,delete e.location);try{let r;e.targetElement?.xpath?r=this.domService.getElementFromXPath(e.targetElement.xpath):e.targetElementId&&(r=cr(e.targetElementId,["id","data-id"]));let a=this.docService.getAdditionLocationFromElement(r);if(a){let s=this.docService.addLocation(a);s&&(e.locationId=s.locationId,e.location=s.location)}}catch{}}catch(i){this.loggingService.catch("Error in ReactionService setLocationToReactionAnnotation:",i)}}getElementForReactionAnnotation(e){try{let i;return e.targetElementId&&(i=cr(e.targetElementId,["id","data-id"])),i}catch(i){return this.loggingService.catch("Error in ReactionService getElementForReactionAnnotation: ",i),null}}saveReactionToDb(e){return ee(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: saveReactionToDb","color: green;");try{if(this.authService.getUser()){let i=yield this.docService.getDocumentPaths$().pipe(Ne(a=>!!a),Je(1)).toPromise();if(!i)throw new Error("Document paths not found.");this.documentPaths=i,this.loggingService.log(this.documentPaths);let r=yield this.databaseService.getDb().pipe(Ne(a=>!!a),Je(1)).toPromise();if(!r)throw new Error("Database not found.");if(this.db=r,this.loggingService.log(this.db),this.documentPaths?.reaction){let a=on(this.db,`${this.documentPaths.reaction}`);if(e.annotationId=this.commonDbService.generateDocumentId(),e.pageInfo,!e?.metadata?.documentId){e?.metadata||(e.metadata={});let h=this.getElementForReactionAnnotation(e),_=this.docService.getBaseMetadata("reaction",{commentAnnotationId:e.commentAnnotationId,element:h});e.metadata=I(I({},e?.metadata),_)}let s=JSON.parse(JSON.stringify(e));s.position=null;let{documentId:c,organizationId:p}=this.getDocumentIdAndOrganizationIdFromReactionAnnotation(e);return yield this.commonDbService.setData({feature:"reaction",properties:{id:e.annotationId,documentId:c,organizationId:p},data:s}),s}else return}}catch(i){this.loggingService.catch("Error in ReactionService saveReactionToDb: ",i)}})}getDocumentIdAndOrganizationIdFromReactionAnnotation(e){try{return{documentId:e?.metadata?.documentId,organizationId:e?.metadata?.organizationId}}catch(i){return this.loggingService.catch("Error in ReactionService getDocumentIdAndOrganizationIdFromReactionAnnotation: ",i),{}}}updateUserInReaction(e){return ee(this,null,function*(){try{let i=this.authService.getUser();if(i)return e?.reactions||(e.reactions=[]),e?.reactions?.find(a=>a?.from?.userId===i?.userId)?e.reactions=e?.reactions?.filter(a=>a?.from?.userId!==i?.userId):e.reactions.push({from:i,lastUpdated:this.timestamp}),e.reactions.length?yield this.updateReaction(e):yield this.deleteReactionPinAnnotation(e?.annotationId),e}catch(i){this.loggingService.catch("Error in ReactionService updateUserInReaction: ",i)}})}removeUserFromReaction(e){this.loggingService.log("%c[WB] Calling FUNCTION: removeUserFromReaction","color: green;");try{let i=this.authService.getUser();i&&(e?.reactions||(e.reactions=[]),e.reactions=e?.reactions?.filter(r=>r?.from?.userId!==i?.userId),this.updateReaction(e))}catch(i){this.loggingService.catch("Error in ReactionService removeUserFromReaction: ",i)}}updateReaction(e,i,r){return ee(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: updateReaction","color: green;");try{if(this.authService.getUser()){if(e?.targetElement?.xpath){let p=this.domService.getXPath(e.targetElement.xpath);if(p){let h=p.iterateNext();h&&(xo(h)||(e.targetElement=null))}}let a=JSON.parse(JSON.stringify(e));if(a.position=null,a.lastUpdated=this.timestamp,!a?.metadata?.documentId){a?.metadata||(a.metadata={});let p=this.docService.getBaseMetadata("reaction",{commentAnnotationId:e.commentAnnotationId});a.metadata=I(I({},a?.metadata),p)}let{documentId:s,organizationId:c}=a?.metadata||{};return r?yield this.commonDbService.updateData({feature:"reaction",properties:{id:e.annotationId,documentId:s,organizationId:c},data:JSON.parse(JSON.stringify(a))}):yield this.commonDbService.setData({feature:"reaction",properties:{id:e.annotationId,documentId:s,organizationId:c},data:JSON.parse(JSON.stringify(a))}),a}}catch(a){this.loggingService.catch("Error in ReactionService updateReaction: ",a)}})}deleteReactionPinAnnotation(e,i){return ee(this,null,function*(){try{let r=this.getAnnotationById(e),{documentId:a,organizationId:s}=this.getDocumentIdAndOrganizationIdFromReactionAnnotation(r);yield this.commonDbService.deleteData({feature:"reaction",properties:{id:e,documentId:a,organizationId:s}})}catch(r){this.loggingService.catch("Error in ReactionService deleteReactionPinAnnotation: ",r)}})}setCustomReactions(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setCustomReactions","color: green;"),this.customReactions$.next(e),this.emojiService.setEmojiList(e)}catch(i){this.loggingService.catch("Error in ReactionService setCustomReactions: ",i)}}enableDarkMode(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: enableDarkMode","color: green;"),this.darkMode$.value===!0)return;this.darkMode$.next(!0)}catch(e){this.loggingService.catch("Error in ReactionService enableDarkMode: ",e)}}disableDarkMode(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: disableDarkMode","color: green;"),this.darkMode$.value===!1)return;this.darkMode$.next(!1)}catch(e){this.loggingService.catch("Error in ReactionService disableDarkMode: ",e)}}getDarkMode(){return this.darkMode$.value}getDarkMode$(){return this.darkMode$.asObservable()}sanitizeReactionAnnotation(e){try{e&&(e.iconUrl&&(e.iconUrl=this.domService.sanitizeHtml(e.iconUrl)),e.iconEmoji&&(e.iconEmoji=this.domService.sanitizeHtml(e.iconEmoji)),e.icon&&(e.icon=this.domService.sanitizeHtml(e.icon)))}catch(i){this.loggingService.catch("Error in ReactionService sanitizeReactionAnnotation: ",i)}}get timestamp(){return this.commonDbService.getServerTimestamp()}};o.\u0275fac=function(i){return new(i||o)(J(vi),J(Qe),J(je),J($t),J(pn),J(bn),J(lt),J(Fe),J(hc),J(gn),J(y))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Ise=(()=>{let o=class o{constructor(e,i){this.domService=e,this.loggingService=i,this.keyEventSubject$=new et;try{this.loggingService.log("%c[WB] Creating CLASS: HotkeyService","color: blue;"),this.keyEvent$=this.keyEventSubject$.asObservable().pipe(Eg()),this.domService.onWindowKeydown$().subscribe(r=>{this.keyEventSubject$.next(r)})}catch(r){this.loggingService.catch("Error in HotkeyService constructor: ",r)}}getKeyPressEvent(e,i={}){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getKeyPressEvent","color: green;"),this.keyEvent$.pipe(Ne(r=>r?.key===e),Ne(r=>!(!!i?.includeCtrl!==r.ctrlKey||!!i?.includeAlt!==r.altKey||!!i?.includeShift!==r.shiftKey||!!i?.includeMeta!==r.metaKey)),Ne(()=>this.isNoInputFocused()))}catch(r){return this.loggingService.catch("Error in HotkeyService getKeyPressEvent: ",r),new Ft}}isNoInputFocused(){try{let e=document.activeElement;for(;e&&e?.tagName!=="BODY";){if(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e?.isContentEditable)return!1;e=e?.parentElement}return!0}catch(e){return this.loggingService.catch("Error in HotkeyService isNoInputFocused: ",e),!1}}};o.\u0275fac=function(i){return new(i||o)(J(Fe),J(y))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Ye=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.configService=i,this.darkMode$=new fe(!1)}setDarkMode(e){try{let i=document.documentElement;if(!i)return;e?i.setAttribute(U.ATTRIBUTES.VELT_THEME,"dark"):i.removeAttribute(U.ATTRIBUTES.VELT_THEME),this.darkMode$.next(e)}catch(i){this.loggingService.catch("Error in theme service setDarkMode: ",i)}}getDarkMode$(){return this.darkMode$.asObservable()}updateListenerOnConfigChange(){try{this.configService.getConfig$().subscribe(e=>{if(e&&e.usePrefersColorScheme){this.enablePrefersColorScheme();return}this.disablePrefersColorScheme()})}catch(e){this.loggingService.catch("Error in theme service updateListenerOnConfigChange: ",e)}}enablePrefersColorScheme(){try{if(this.disablePrefersColorScheme(),!window.matchMedia)return;this.darkModeQuery=window.matchMedia("(prefers-color-scheme: dark)"),this.setDarkMode(this.darkModeQuery.matches),this.darkModeQueryListener=e=>{this.setDarkMode(e.matches)},this.darkModeQuery.addEventListener("change",this.darkModeQueryListener)}catch(e){this.loggingService.catch("Error in theme service enablePrefersColorScheme: ",e)}}disablePrefersColorScheme(){try{this.darkModeQuery&&this.darkModeQueryListener&&this.darkModeQuery.removeEventListener("change",this.darkModeQueryListener)}catch(e){this.loggingService.catch("Error in theme service disablePrefersColorScheme: ",e)}}};o.\u0275fac=function(i){return new(i||o)(J(y),J($t))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();function YPe(n,o){n&1&&(oe(),C(0,"svg",16),w(1,"rect",17)(2,"path",18)(3,"path",19)(4,"rect",20)(5,"path",21),S())}function KPe(n,o){n&1&&(oe(),C(0,"svg",16),w(1,"rect",22)(2,"path",23)(3,"path",19)(4,"rect",20)(5,"path",21),S())}function ZPe(n,o){if(n&1&&(f(0),C(1,"div",6)(2,"div",7),g(3,YPe,6,0,"svg",8)(4,KPe,6,0,"ng-template",null,1,xe),S(),C(6,"div",9),te(7),D(8,"translate"),w(9,"br"),te(10),D(11,"translate"),S(),C(12,"div",10)(13,"p"),te(14),D(15,"translate"),oe(),C(16,"svg",11),w(17,"path",12)(18,"path",13)(19,"path",14)(20,"path",15),S(),te(21),D(22,"translate"),S(),ct(),C(23,"p"),te(24),D(25,"translate"),S()()(),v()),n&2){let t=de(5),e=l();d(3),m("ngIf",e.darkMode)("ngIfElse",t),d(4),ve(" ",O(8,7,"Allow mic permission to"),""),d(3),ve("",O(11,9,"enable your audio")," "),d(4),ve(" ",O(15,11,"1. Click the")," "),d(7),ve(" ",O(22,13,"page info icon in your browser\u2019s address bar")," "),d(3),ve(" ",O(25,15,"2. Turn on Microphone")," ")}}function XPe(n,o){n&1&&(oe(),C(0,"svg",16),w(1,"rect",17)(2,"path",24)(3,"path",19)(4,"rect",20)(5,"path",21),S())}function QPe(n,o){n&1&&(oe(),C(0,"svg",16),w(1,"rect",22)(2,"path",25)(3,"path",19)(4,"rect",20)(5,"path",21),S())}function JPe(n,o){if(n&1&&(f(0),C(1,"div",6)(2,"div",7),g(3,XPe,6,0,"svg",8)(4,QPe,6,0,"ng-template",null,2,xe),S(),C(6,"div",9),te(7),D(8,"translate"),w(9,"br"),te(10),D(11,"translate"),S(),C(12,"div",10)(13,"p"),te(14),D(15,"translate"),oe(),C(16,"svg",11),w(17,"path",12)(18,"path",13)(19,"path",14)(20,"path",15),S(),te(21),D(22,"translate"),S(),ct(),C(23,"p"),te(24),D(25,"translate"),S()()(),v()),n&2){let t=de(5),e=l();d(3),m("ngIf",e.darkMode)("ngIfElse",t),d(4),ve(" ",O(8,7,"Allow camera permission"),""),d(3),ve("",O(11,9,"to enable your video")," "),d(4),ve(" ",O(15,11,"1. Click the")," "),d(7),ve(" ",O(22,13,"page info icon in your browser\u2019s address bar")," "),d(3),ve(" ",O(25,15,"2. Turn on Camera")," ")}}var DM=(()=>{let o=class o{constructor(e,i,r,a,s){this.loggingService=e,this.themeService=i,this.elementRef=r,this.matDialogRef=a,this.data=s,this.veltElement=!0,this.darkMode=!0;try{this.loggingService.log("%c[WB] Creating CLASS: DevicePermissionDeniedDialogComponent","color: blue;"),this.type=this.data?.type,[!0,!1].includes(this.data?.darkMode)&&(this.darkMode=this.data?.darkMode)}catch(c){this.loggingService.catch("Error in DevicePermissionDeniedDialogComponent constructor: ",c)}}ngOnDestroy(){}};o.\u0275fac=function(i){return new(i||o)(u(y),u(Ye),u(N),u(Ko,8),u(cl,8))},o.\u0275cmp=M({type:o,selectors:[["velt-device-permission-denied-dialog-internal"]],hostVars:1,hostBindings:function(i,r){i&2&&x("data-velt-element",r.veltElement)},inputs:{type:"type"},standalone:!1,decls:5,vars:5,consts:[["devicePermissionDialogRef",""],["defaultAudioIcon",""],["defaultVideoIcon",""],[1,"velt-device-permission-denied-dialog--container",3,"snippylyOverlay","snippylyOverlayZIndex"],[3,"ngSwitch"],[4,"ngSwitchCase"],[1,"velt-device-permission-denied-dialog"],[1,"velt-device-permission-denied-dialog--icon"],["width","61","height","60","viewBox","0 0 61 60","fill","none","xmlns","http://www.w3.org/2000/svg",4,"ngIf","ngIfElse"],[1,"velt-device-permission-denied-dialog--header"],[1,"velt-device-permission-denied-dialog--content"],["width","13","height","12","viewBox","0 0 13 12","fill","none","xmlns","http://www.w3.org/2000/svg",1,"velt-device-permission-denied-dialog--page-info-icon"],["d","M4.375 2.5C4.375 3.53553 3.53553 4.375 2.5 4.375C1.46447 4.375 0.625 3.53553 0.625 2.5C0.625 1.46447 1.46447 0.625 2.5 0.625C3.53553 0.625 4.375 1.46447 4.375 2.5Z","stroke","currentColor","stroke-opacity","0.6","stroke-width","1.25"],["d","M5 2.5H12.5","stroke","currentColor","stroke-opacity","0.6","stroke-width","1.25"],["d","M0 8.75H7.5","stroke","currentColor","stroke-opacity","0.6","stroke-width","1.25"],["d","M11.875 8.75C11.875 9.78553 11.0355 10.625 10 10.625C8.96447 10.625 8.125 9.78553 8.125 8.75C8.125 7.71447 8.96447 6.875 10 6.875C11.0355 6.875 11.875 7.71447 11.875 8.75Z","stroke","currentColor","stroke-opacity","0.6","stroke-width","1.25"],["width","61","height","60","viewBox","0 0 61 60","fill","none","xmlns","http://www.w3.org/2000/svg"],["x","0.5","y","4","width","56","height","56","rx","28","fill","white","fill-opacity","0.04"],["d","M23.5026 20.333C23.5026 19.0069 24.0294 17.7352 24.9671 16.7975C25.9048 15.8598 27.1765 15.333 28.5026 15.333C29.8287 15.333 31.1005 15.8598 32.0381 16.7975C32.9758 17.7352 33.5026 19.0069 33.5026 20.333V28.6663C33.5027 29.1599 33.4297 29.6508 33.2859 30.123M29.9526 33.4563C29.2054 33.6828 28.4155 33.7311 27.6463 33.5973C26.8771 33.4636 26.1499 33.1516 25.5229 32.6863C24.8959 32.2211 24.3866 31.6154 24.0358 30.9179C23.685 30.2204 23.5024 29.4504 23.5026 28.6697V27.003M16.8359 28.6663C16.8356 30.7719 17.405 32.8383 18.484 34.6465C19.5629 36.4546 21.111 37.9371 22.9642 38.9366C24.8174 39.9362 26.9066 40.4156 29.0102 40.324C31.1137 40.2324 33.1533 39.5732 34.9126 38.4163M38.2459 35.083C39.5023 33.1791 40.1701 30.9474 40.1659 28.6663M21.8359 46.9997H35.1693M28.5026 40.333V46.9997","stroke","white","stroke-opacity","0.52","stroke-width","2.5","stroke-linecap","round","stroke-linejoin","round"],["d","M13.5 17L43.5 47","stroke","currentColor","stroke-width","2.5","stroke-linecap","round","stroke-linejoin","round"],["x","36.5","width","24","height","24","rx","12","fill","currentColor"],["d","M48.5 18.99V19M48.5 14V5","stroke","white","stroke-width","2.5","stroke-linecap","round","stroke-linejoin","round"],["x","0.5","y","4","width","56","height","56","rx","28","fill","black","fill-opacity","0.04"],["d","M23.5026 20.333C23.5026 19.0069 24.0294 17.7352 24.9671 16.7975C25.9048 15.8598 27.1765 15.333 28.5026 15.333C29.8287 15.333 31.1005 15.8598 32.0381 16.7975C32.9758 17.7352 33.5026 19.0069 33.5026 20.333V28.6663C33.5027 29.1599 33.4297 29.6508 33.2859 30.123M29.9526 33.4563C29.2054 33.6828 28.4155 33.7311 27.6463 33.5973C26.8771 33.4636 26.1499 33.1516 25.5229 32.6863C24.8959 32.2211 24.3866 31.6154 24.0358 30.9179C23.685 30.2204 23.5024 29.4504 23.5026 28.6697V27.003M16.8359 28.6663C16.8356 30.7719 17.405 32.8383 18.484 34.6465C19.5629 36.4546 21.111 37.9371 22.9642 38.9366C24.8174 39.9362 26.9066 40.4156 29.0102 40.324C31.1137 40.2324 33.1533 39.5732 34.9126 38.4163M38.2459 35.083C39.5023 33.1791 40.1701 30.9474 40.1659 28.6663M21.8359 46.9997H35.1693M28.5026 40.333V46.9997","stroke","black","stroke-opacity","0.52","stroke-width","2.5","stroke-linecap","round","stroke-linejoin","round"],["d","M42.375 39.2135C42.7034 39.1007 42.9883 38.8881 43.19 38.6054C43.3917 38.3227 43.5001 37.9841 43.5 37.6369V26.3635C43.4998 26.0795 43.4271 25.8003 43.2888 25.5523C43.1504 25.3043 42.9509 25.0958 42.7093 24.9465C42.4677 24.7973 42.192 24.7122 41.9083 24.6994C41.6246 24.6867 41.3424 24.7466 41.0883 24.8735L33.5 28.6669V30.3335V25.3333C33.5 24.4493 33.1488 23.6014 32.5237 22.9763C31.8986 22.3512 31.0507 22 30.1667 22H25.1667M33.5 37V38.6667C33.5 39.5507 33.1488 40.3986 32.5237 41.0237C31.8986 41.6488 31.0507 42 30.1667 42H16.8333C15.9493 42 15.1014 41.6488 14.4763 41.0237C13.8512 40.3986 13.5 39.5507 13.5 38.6667V25.3333C13.5 24.4493 13.8512 23.6014 14.4763 22.9763C15.1014 22.3512 15.9493 22 16.8333 22H18.5","stroke","white","stroke-opacity","0.52","stroke-width","2.5","stroke-linecap","round","stroke-linejoin","round"],["d","M42.375 39.2135C42.7034 39.1007 42.9883 38.8881 43.19 38.6054C43.3917 38.3227 43.5001 37.9841 43.5 37.6369V26.3635C43.4998 26.0795 43.4271 25.8003 43.2888 25.5523C43.1504 25.3043 42.9509 25.0958 42.7093 24.9465C42.4677 24.7973 42.192 24.7122 41.9083 24.6994C41.6246 24.6867 41.3424 24.7466 41.0883 24.8735L33.5 28.6669V30.3335V25.3333C33.5 24.4493 33.1488 23.6014 32.5237 22.9763C31.8986 22.3512 31.0507 22 30.1667 22H25.1667M33.5 37V38.6667C33.5 39.5507 33.1488 40.3986 32.5237 41.0237C31.8986 41.6488 31.0507 42 30.1667 42H16.8333C15.9493 42 15.1014 41.6488 14.4763 41.0237C13.8512 40.3986 13.5 39.5507 13.5 38.6667V25.3333C13.5 24.4493 13.8512 23.6014 14.4763 22.9763C15.1014 22.3512 15.9493 22 16.8333 22H18.5","stroke","currentColor","stroke-opacity","0.52","stroke-width","2.5","stroke-linecap","round","stroke-linejoin","round"]],template:function(i,r){if(i&1&&(C(0,"div",3,0),f(2,4),g(3,ZPe,26,17,"ng-container",5)(4,JPe,26,17,"ng-container",5),v(),S()),i&2){let a=de(1);m("snippylyOverlay",a)("snippylyOverlayZIndex",3e3),d(2),m("ngSwitch",r.type),d(),m("ngSwitchCase","audio"),d(),m("ngSwitchCase","video")}},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-denied-dialog--panel mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface{padding:0;background-color:transparent;box-shadow:none;overflow:unset}.velt-device-permission-denied-dialog[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:var(--velt-spacing-lg);align-items:center;justify-content:center;padding:4rem;box-sizing:border-box;word-break:break-word;max-width:600px;max-height:400px;text-align:center;background-color:var(--velt-background-0);border-radius:var(--velt-border-radius-2xl);box-shadow:0 calc((4rem + 0px) * var(--velt-base-rem-unit)) calc((4rem + 0px) * var(--velt-base-rem-unit)) calc((-3rem + 0px) * var(--velt-base-rem-unit)) #1f2f461f}.velt-device-permission-denied-dialog[_ngcontent-%COMP%] .velt-device-permission-denied-dialog--icon[_ngcontent-%COMP%]{color:var(--velt-error)}.velt-device-permission-denied-dialog[_ngcontent-%COMP%] .velt-device-permission-denied-dialog--header[_ngcontent-%COMP%]{font-size:var(--velt-font-size-lg);font-weight:600;line-height:36px;letter-spacing:-.02em;text-align:center;color:var(--velt-text-0)}.velt-device-permission-denied-dialog[_ngcontent-%COMP%] .velt-device-permission-denied-dialog--content[_ngcontent-%COMP%]{font-size:var(--velt-font-size-sm);font-weight:400;line-height:21px;text-align:center;color:var(--velt-text-0)}.velt-device-permission-denied-dialog[_ngcontent-%COMP%] .velt-device-permission-denied-dialog--content[_ngcontent-%COMP%] .velt-device-permission-denied-dialog--page-info-icon[_ngcontent-%COMP%]{margin-left:var(--velt-spacing-sm);margin-right:var(--velt-spacing-sm);color:var(--velt-error)}"],changeDetection:0});let n=o;return n})();var hm=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.matDialog=i,this.audioPermissionState$=new fe(null),this.videoPermissionState$=new fe(null);try{this.loggingService.log("%c[WB] Creating CLASS: DevicePermissionService","color: blue;"),this.checkPermissions()}catch(r){this.loggingService.catch("Error in DevicePermissionService constructor: ",r)}}checkPermissions(){try{this.loggingService.log("%c[WB] Calling DevicePermissionService FUNCTION: checkPermissions","color: green;"),new Jn().browserName!=="Firefox"&&(navigator.permissions.query({name:"microphone"}).then(i=>{this.audioPermissionState$.next(i.state),i.onchange=()=>{this.audioPermissionState$.next(i.state)}}).catch(i=>{}),navigator.permissions.query({name:"camera"}).then(i=>{this.videoPermissionState$.next(i.state),i.onchange=()=>{this.videoPermissionState$.next(i.state)}}).catch(i=>{}))}catch(e){this.loggingService.catch("Error in DevicePermissionService checkPermissions: ",e)}}getPermissionState$(e){try{switch(this.loggingService.log("%c[WB] Calling DevicePermissionService FUNCTION: getPermissionState$","color: green;"),e){case"audio":return this.getAudioPermissionState$();case"video":return this.getVideoPermissionState$();default:return re(null)}}catch(i){return this.loggingService.catch("Error in DevicePermissionService getPermissionState$: ",i),re(null)}}getAudioPermissionState$(){return this.audioPermissionState$.asObservable()}getVideoPermissionState$(){return this.videoPermissionState$.asObservable()}openDevicePermissionDeniedDialog(e,i){try{this.loggingService.log("%c[WB] Calling DevicePermissionService FUNCTION: openDevicePermissionDeniedDialog","color: green;"),this.matDialog.open(DM,{panelClass:"velt-device-permission-denied-dialog--panel",backdropClass:["velt-device-permission-denied-dialog--backdrop","s-background-blur-1"],data:I({type:e},i||{})})}catch(r){this.loggingService.catch("Error in DevicePermissionService openDevicePermissionDeniedDialog: ",r)}}};o.\u0275fac=function(i){return new(i||o)(J(y),J(Wi))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var e9e=()=>["video","screen"];function t9e(n,o){if(n&1&&w(0,"app-recording-preview-steps-dialog-video",4),n&2){let t=l(2);m("componentConfigSignal",t.componentConfigSignal)}}function n9e(n,o){if(n&1&&w(0,"app-recording-preview-steps-dialog-audio",4),n&2){let t=l(2);m("componentConfigSignal",t.componentConfigSignal)}}function i9e(n,o){if(n&1&&(f(0),C(1,"div",2,0),g(3,t9e,1,1,"app-recording-preview-steps-dialog-video",3)(4,n9e,1,1,"app-recording-preview-steps-dialog-audio",3),S(),v()),n&2){let t=o.ngIf,e=de(2),i=l();d(),m("snippylyOverlay",e)("snippylyOverlayZIndex",2e3),x("aria-label","Recording preview - "+t.type+" mode")("data-testid",i.componentId),d(2),m("ngIf",kt(6,e9e).includes(t.type)),d(),m("ngIf",t.type==="audio")}}var AM=(()=>{let o=class o{constructor(e,i,r,a,s,c,p){this.loggingService=e,this.recorderService=i,this.dialog=r,this.devicePermissionService=a,this.dialogRef=s,this.elementRef=c,this.data=p,this.darkMode=!1,this.shadowDom=!0,this.startCountdownFrom=3,this.defaultMediaSourceOptions=ac(),this.recordingCountdownEnabled=!1,this.subscriptions=[],this.veltElement=!0,this.componentId="velt-recording-preview-steps-dialog",this.componentConfigSignal=be({closeDialog:this.closeDialog.bind(this),startCountdown:this.startCountdown.bind(this),toggleAudio:this.toggleAudio.bind(this),toggleVideo:this.toggleVideo.bind(this),toggleSettings:this.toggleSettings.bind(this),cancelCountdown:this.cancelCountdown.bind(this),updateMediaConfig:this.updateMediaConfig.bind(this),handleOverlayClick:this.handleOverlayClick.bind(this),countdownStarted:!1,mediaConfig:{audio:{enabled:!1},video:{enabled:!1}},mediaState:{audio:{enabled:!1},video:{enabled:!1}},type:"video",countdown:this.startCountdownFrom,mediaStream:void 0,isSettingsOpen:!1,darkMode:this.darkMode,shadowDom:this.shadowDom});try{this.devicePermissionService.getPermissionState$("video").subscribe(h=>{this.componentConfigSignal.update(_=>(_=T(I({},_),{mediaState:T(I({},_.mediaState),{video:{enabled:h!=="denied"}})}),_))}),this.devicePermissionService.getPermissionState$("audio").subscribe(h=>{this.componentConfigSignal.update(_=>(_=T(I({},_),{mediaState:T(I({},_.mediaState),{audio:{enabled:h!=="denied"}})}),_))}),this.subscriptions.push(this.recorderService.getRecordingCountdownEnabled$().subscribe(h=>{this.recordingCountdownEnabled=h})),p&&(p.type&&this.componentConfigSignal.update(h=>(h=T(I({},h),{type:p.type}),h)),p.recordingCountdown!==void 0&&(this.recordingCountdownEnabled=!!p.recordingCountdown),p.mediaConfig&&(p.mediaConfig?.audio?.enabled&&!p.mediaConfig?.audio?.deviceId&&(p.mediaConfig.audio.deviceId=this.defaultMediaSourceOptions?.selectedAudioDevice?.deviceId),p.mediaConfig?.video?.enabled&&!p.mediaConfig?.video?.deviceId&&(p.mediaConfig.video.deviceId=this.defaultMediaSourceOptions?.selectedVideoDevice?.deviceId),p?.darkMode?this.elementRef.nativeElement.setAttribute("dark",""):this.elementRef.nativeElement.removeAttribute("dark"),this.componentConfigSignal.update(h=>(h=T(I({},h),{shadowDom:p?.shadowDom!==!1,darkMode:p.darkMode||!1}),h)),this.updateMediaConfig(p.mediaConfig)))}catch(h){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent constructor: ",h)}}ngOnInit(){try{this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent ngOnInit:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","dialog"),e.setAttribute("aria-label","Recording preview steps dialog")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent 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 RecordingPreviewStepsDialogComponent ngOnChanges: ",i)}}ngAfterViewInit(){try{this.dialogRef.addPanelClass("snippyly-recording-preview-steps-dialog"),this.dialogRef.disableClose=!0}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent ngAfterViewInit: ",e)}}toggleSettings(e){try{e.stopPropagation(),this.componentConfigSignal.update(i=>(i=T(I({},i),{isSettingsOpen:!i.isSettingsOpen}),i))}catch(i){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent toggleSettings: ",i)}}toggleAudio(){try{this.componentConfigSignal().mediaConfig.audio||this.componentConfigSignal.update(r=>(r=T(I({},r),{mediaConfig:T(I({},r.mediaConfig),{audio:{enabled:!0}})}),r));let e=!this.componentConfigSignal().mediaConfig.audio?.enabled;this.componentConfigSignal.update(r=>(r=T(I({},r),{mediaConfig:T(I({},r.mediaConfig),{audio:{enabled:e}})}),r));let i=this.componentConfigSignal().mediaStream?.getAudioTracks()[0];i?i.enabled=e:e&&(this.componentConfigSignal.update(r=>(r=T(I({},r),{mediaConfig:T(I({},r.mediaConfig),{audio:T(I({},r.mediaConfig.audio),{deviceId:this.defaultMediaSourceOptions?.selectedAudioDevice?.deviceId})})}),r)),this.updateMediaConfig(this.componentConfigSignal().mediaConfig))}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent toggleAudio: ",e)}}toggleVideo(){try{this.componentConfigSignal.update(e=>(e=I({},e),e.mediaConfig.video||(e.mediaConfig.video={enabled:!0}),e.mediaConfig.video.enabled=!e.mediaConfig.video.enabled,e.mediaConfig.video.deviceId=this.defaultMediaSourceOptions?.selectedVideoDevice?.deviceId,e)),this.updateMediaConfig(this.componentConfigSignal().mediaConfig)}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent toggleVideo: ",e)}}updateMediaConfig(e){try{this.stopMediaStream(),this.getMediaStream(e)}catch(i){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent updateMediaConfig: ",i)}}getMediaStream(e){try{if(!navigator.mediaDevices){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent getMediaStream: ","No media devices");return}if(!navigator.mediaDevices.getUserMedia){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent getMediaStream: ","No getUserMedia");return}if(e.audio?.enabled||e.video?.enabled){let i={};e.audio?.enabled&&(i.audio={deviceId:e.audio.deviceId}),e.video?.enabled&&(i.video={deviceId:e.video.deviceId}),navigator.mediaDevices.getUserMedia(i).then(r=>{this.componentConfigSignal.update(a=>(a=T(I({},a),{mediaConfig:e,mediaStream:r}),a))}).catch(r=>{this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent getMediaStream catch: ",r)})}else this.componentConfigSignal.update(i=>(i=T(I({},i),{mediaStream:void 0,mediaConfig:e}),i))}catch(i){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent getMediaStream: ",i)}}stopMediaStream(){try{this.componentConfigSignal.update(e=>(e=I({},e),e.mediaStream?.getTracks().forEach(i=>{i.stop()}),e.mediaStream=void 0,e))}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent stopMediaStream: ",e)}}startCountdown(){return ee(this,null,function*(){try{if(this.componentConfigSignal().type==="screen"){let e=yield navigator.mediaDevices.getDisplayMedia();this.componentConfigSignal.update(i=>(i=I({},i),i.mediaConfig.screen={enabled:!0,stream:e},i)),e?.getTracks().forEach(i=>{i&&(i.onended=()=>{this.cancelCountdown()})})}this.recordingCountdownEnabled?(this.componentConfigSignal.update(e=>(e=T(I({},e),{countdownStarted:!0}),e)),this.countdownInterval=setInterval(()=>{this.componentConfigSignal().countdown>1?this.componentConfigSignal.update(e=>(e=T(I({},e),{countdown:e.countdown-1}),e)):this.closeDialog(this.componentConfigSignal().mediaConfig)},1e3)):this.closeDialog(this.componentConfigSignal().mediaConfig)}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent startCountdown: ",e)}})}cancelCountdown(){try{if(this.componentConfigSignal.update(e=>(e=T(I({},e),{countdownStarted:!1,countdown:this.startCountdownFrom}),e)),this.clearInterval(),this.componentConfigSignal().type==="screen"){let e=this.componentConfigSignal().mediaConfig.screen?.stream;e&&e.getTracks().forEach(i=>{i.stop()}),this.componentConfigSignal.update(i=>(i=I({},i),i.mediaConfig.screen=void 0,i))}}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent cancelCountdown: ",e)}}closeDialog(e){return ee(this,null,function*(){try{this.clearInterval(),this.stopMediaStream(),this.dialogRef.close(e)}catch(i){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent closeDialog: ",i)}})}handleOverlayClick(e){try{this.componentConfigSignal.update(i=>(i=T(I({},i),{isSettingsOpen:!1}),i)),e.stopPropagation()}catch(i){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent handleOverlayClick: ",i)}}clearInterval(){try{this.countdownInterval&&(clearInterval(this.countdownInterval),this.countdownInterval=void 0)}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent clearInterval: ",e)}}ngOnDestroy(){try{this.clearInterval(),this.stopMediaStream(),this.subscriptions.forEach(e=>{e?.unsubscribe()})}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogComponent ngOnDestroy: ",e)}}};o.\u0275fac=function(i){return new(i||o)(u(y),u(yi),u(Wi),u(hm),u(Ko),u(N),u(cl,8))},o.\u0275cmp=M({type:o,selectors:[["snippyly-recording-preview-steps-dialog"]],hostVars:1,hostBindings:function(i,r){i&2&&x("data-velt-element",r.veltElement)},inputs:{darkMode:"darkMode",shadowDom:"shadowDom"},standalone:!1,features:[qe],decls:1,vars:1,consts:[["recordingPreviewDialogRef",""],[4,"ngIf"],["role","dialog","aria-modal","true",3,"snippylyOverlay","snippylyOverlayZIndex"],[3,"componentConfigSignal",4,"ngIf"],[3,"componentConfigSignal"]],template:function(i,r){i&1&&g(0,i9e,5,7,"ng-container",1),i&2&&m("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%]{--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)} .snippyly-recording-preview-steps-dialog mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface{background:transparent;padding:0;margin:0;border-radius:var(--velt-border-radius-lg)}"],changeDetection:0});let n=o;return n})();var yi=(()=>{let o=class o{constructor(e,i,r,a,s,c,p){this.analyticsService=e,this.loggingService=i,this.matDialog=r,this.storageService=a,this.docService=s,this.databaseService=c,this.domService=p,this.recorderStatusSubject$=new fe(null),this.recorderDurationSubject$=new fe(null),this.darkMode$=new fe(null),this.shadowDom$=new fe(null),this.recordingDurations=[],this.chunks=[],this.recordingCountdownEnabled$=new fe(!0),this.recorderInitData$=new et,this.recordedRawData$=new et,this.recordedData$=new et,this.onInitRecording$=new fe(null),this.onRecordingAttributeRemovedFromBodySubject$=new et,this.videoEditor$=new fe(!1),this.settingsEmbedded$=new fe(!1),this.autoOpenVideoEditor$=new fe(!1),this.playVideoInFullScreen$=new fe(void 0),this.recordedDataStream=[],this.documentPaths=null,this.db=Ci(),this.uploadPromises=[],this.chunkUrls$=new fe({}),this.onInitRecording$.subscribe(h=>{h?this.setRecordingAttributeAtBody():this.removeRecordingAttributeFromBody()}),this.databaseService.getDb().pipe(Ne(h=>!!h),Je(1)).subscribe(h=>{h&&(this.db=h,this.getDocumentPaths())},h=>{this.loggingService.catch("Error in RecorderAnnotationService getDb subscription: ",h)})}getDocumentPaths(){this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentPaths","color: green;");try{this.docService.getDocumentPaths$().pipe(In(e=>{this.documentPaths=e})).subscribe(()=>{},e=>{this.loggingService.catch("Error in getDocumentPaths subscription: ",e)})}catch(e){this.loggingService.catch("Error in CursorService getDocumentPaths: ",e)}}setRecordedDataStream(e){this.recordedDataStream=e}getRecordedDataStream(){return this.recordedDataStream}setRecordingAttributeAtBody(){try{let e=this.onInitRecording$.getValue();e&&(document.body.setAttribute(U.ATTRIBUTES.VELT_ONGOING_RECORDING,e.type),e?.isCommentRecording&&document.body.setAttribute(U.ATTRIBUTES.VELT_COMMENT_RECORDING,"true"))}catch(e){this.loggingService.catch("Error in RecorderService setRecordingAttributeAtBody: ",e)}}removeRecordingAttributeFromBody(){try{document.body.removeAttribute(U.ATTRIBUTES.VELT_ONGOING_RECORDING),document.body.removeAttribute(U.ATTRIBUTES.VELT_COMMENT_RECORDING),this.onRecordingAttributeRemovedFromBodySubject$.next()}catch(e){this.loggingService.catch("Error in RecorderService removeRecordingAttributeFromBody: ",e)}}onRecordingAttributeRemovedFromBody$(){return this.onRecordingAttributeRemovedFromBodySubject$.asObservable()}getRecorderInitData(){return this.recorderInitData$.asObservable()}onInitRecording(){return this.onInitRecording$.asObservable()}onRecordedData(){return this.recordedData$.asObservable()}setRecordedData(e){this.recordedData$.next(e)}initRecording(e,i,r,a,s,c,p,h){return ee(this,null,function*(){try{let _={};switch(e){case"audio":_.audio={enabled:!0};break;case"video":_.video={enabled:!0},_.audio={enabled:!0};break;case"screen":_.screen={enabled:!0},_.video={enabled:!1},_.audio={enabled:!1};break;default:break}this.matDialog.open(AM,{data:{type:e,mediaConfig:_,darkMode:[!0,!1].includes(a)?a:this.darkMode$.value,shadowDom:s,recordingCountdown:h}}).afterClosed().subscribe(E=>{if(E){let A={};switch(e){case"audio":A.audio={enabled:!0,deviceId:E.audio?.deviceId},A.audio=E.audio;break;case"video":A.video={enabled:!0,deviceId:E.video?.deviceId},A.audio={enabled:!0,deviceId:E.audio?.deviceId},A.video=E.video,A.audio=E.audio;break;case"screen":A.screen={enabled:!0},A.audio=E.audio,A.video=E.video,A.screen=E.screen;break;default:break}this.onInitRecording$.next({type:e,panelId:i,mediaConfig:A,isCommentRecording:r,darkMode:[!0,!1].includes(a)?a:!!this.darkMode$.value,shadowDom:s,commentAnnotationId:c,clientDocumentId:p})}},E=>{this.loggingService.catch("Error in RecorderService initRecording afterClosed: ",E)})}catch(_){this.loggingService.catch("Error in RecorderService initRecording: ",_)}})}startRecording(e,i){return ee(this,null,function*(){try{this.loggingService.log("[startRecording] Starting with config:",e,"mediaConfig:",i);let r=new MediaStream,a=yield this.getBrowserSpecificOptions();return yield this.collectMediaTracks(r,e,i),yield this.initializeMediaRecorder(r,a),this.setupRecorderData(e,r),r}catch(r){return this.loggingService.catch("Error in RecorderService startRecording: ",r),Promise.reject(r)}})}getBrowserSpecificOptions(){return ee(this,null,function*(){try{let e={},i=this.getSupportedMimeTypes();if(i.length>0){let r=i.find(a=>a.includes("mp4")&&a.includes("h264"))||i.find(a=>a.includes("mp4"))||i[0];e.mimeType=r}return this.isSafari()?(e.videoBitsPerSecond=25e5,e.audioBitsPerSecond=128e3):(e.videoBitsPerSecond=1e6,e.audioBitsPerSecond=128e3),e}catch(e){return this.loggingService.catch("Error in RecorderService getBrowserSpecificOptions: ",e),{}}})}collectMediaTracks(e,i,r){return ee(this,null,function*(){try{if(i.type.screen&&r?.screen?.stream&&r.screen.stream.getTracks().forEach(a=>{e.addTrack(a),a.onended=()=>this.stopRecording()}),i?.type.audio||i?.type.video){let a=this.buildMediaConstraints(i,r),s=yield navigator.mediaDevices.getUserMedia(a);if(s)if(this.isSafari()){if(i?.type.audio&&(yield this.adjustSafariAudioTrack(e,s)),i?.type.video){let c=s.getVideoTracks();if(c.length>0){let p=c[0];p.enabled=!0;let h=p.clone();e.addTrack(h),r&&r.video&&(r.video.track=p)}}}else s.getTracks().forEach(c=>e.addTrack(c))}}catch(a){this.loggingService.catch("Error in RecorderService collectMediaTracks: ",a);return}})}buildMediaConstraints(e,i){try{let r={audio:e.type.audio?{deviceId:i?.audio?.deviceId?{ideal:i.audio.deviceId}:void 0,sampleRate:48e3,echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}:!1,video:e.type.video?{deviceId:i?.video?.deviceId?{ideal:i.video.deviceId}:void 0,width:{ideal:1280},height:{ideal:720},frameRate:{ideal:20},aspectRatio:{ideal:1.777777778},facingMode:"user"}:!1};if(this.isSafari()&&e.type.video){let a=r.video;a.width={min:640,ideal:1280,max:1920},a.height={min:360,ideal:720,max:1080},a.frameRate={min:15,ideal:20,max:30}}return r}catch(r){return this.loggingService.catch("Error in RecorderService buildMediaConstraints: ",r),{}}}adjustSafariAudioTrack(e,i){return ee(this,null,function*(){try{let r=i.getAudioTracks()[0];if(r.getSettings().sampleRate!==48e3){this.loggingService.log("[startRecording] Adjusting audio sample rate for Safari");let s=yield navigator.mediaDevices.getUserMedia({audio:{sampleRate:48e3}});e.addTrack(s.getAudioTracks()[0])}else e.addTrack(r)}catch(r){this.loggingService.catch("Error in RecorderService adjustSafariAudioTrack: ",r);return}})}initializeMediaRecorder(e,i){return ee(this,null,function*(){try{this.mediaRecorder=new MediaRecorder(e,i),this.chunks=[],this.chunkUrls$.next({}),this.uploadPromises=[];let r=0;if(this.isSafari()){let s=e.getVideoTracks();s.length>0&&s.forEach(c=>{c.contentHint="detail",c.enabled=!0})}this.mediaRecorder.addEventListener("dataavailable",s=>{if(s.data?.size>0){let c=r++;this.chunks.push(s.data);let p=`recording_${new Date().getTime()}_${Math.random().toString(36).substring(2,9)}`,h=s.data,_=this.uploadChunk(h,p,c);this.uploadPromises||(this.uploadPromises=[]),this.uploadPromises.push({promise:_,index:c}),_.then(E=>{this.chunkUrls$.next(T(I({},this.chunkUrls$.value),{[c]:E}))}).catch(E=>{console.error("Chunk upload failed",E)})}}),this.mediaRecorder.addEventListener("stop",()=>this.onStopRecording()),this.mediaRecorder.start(4e3)}catch(r){this.loggingService.catch("Error in RecorderService initializeMediaRecorder: ",r);return}})}uploadChunk(e,i,r){return ee(this,null,function*(){try{let a="video/mp4",c=`chunk_${r}_${new Date().getTime()}.mp4`,p=new File([e],c,{type:a});return yield this.uploadChunkToStorage(p,i,r)}catch(a){throw this.loggingService.catch("Error in RecorderService uploadChunk: ",a),a}})}uploadChunkToStorage(e,i,r){try{if(!this.documentPaths?.documentId)throw new Error("Document ID is required for chunk upload");let a=this.documentPaths?.organizationId,s=this.documentPaths?.documentId,c=`${U.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${U.FIREBASE_PARTIAL_PATH_RECORDER}/${i}`;return a&&(c=`${U.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${a}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${U.FIREBASE_PARTIAL_PATH_RECORDER}/${i}`),this.storageService.uploadChunk(c,e,r)}catch(a){throw this.loggingService.catch("Error in RecorderService uploadChunkToStorage: ",a),a}}setupRecorderData(e,i){try{return this.recorderInitData=new pM,this.recorderStatusSubject$.next("started"),this.isSafari()&&e.type.video&&(this.loggingService.log("[setupRecorderData] Applying Safari-specific stream handling"),i.getVideoTracks().forEach(r=>{r.enabled=!0;try{r.applyConstraints({width:{ideal:1280},height:{ideal:720},frameRate:{min:15,ideal:20}})}catch(a){this.loggingService.catch("Error applying constraints to video track in Safari:",a)}})),this.recorderInitData.stream=i,this.recorderInitData.status=this.recorderStatusSubject$.asObservable(),this.recorderInitData.type=this.determineRecorderType(e),this.recorderInitData.recordedTime=this.recorderDurationSubject$.asObservable(),this.recorderInitData.recordedRawData$=this.recordedRawData$.asObservable(),this.recordingDurations=[{start:new Date().getTime()}],this.startTimer(),this.recorderInitData$.next(this.recorderInitData),this.recorderInitData}catch(r){return this.loggingService.catch("Error in RecorderService setupRecorderData: ",r),null}}determineRecorderType(e){try{return e.type.video?"video":e.type.screen?"screen":(e.type.audio,"audio")}catch(i){return this.loggingService.catch("Error in RecorderService determineRecorderType: ",i),"audio"}}timeout(e){return new Promise(i=>setTimeout(i,e))}pauseRecording(){try{this.recorderStatusSubject$.next("paused"),this.mediaRecorder.pause(),this.recordingDurations?.length&&(this.recordingDurations[this.recordingDurations.length-1].end=new Date().getTime()),this.stopTimer()}catch(e){this.loggingService.catch("Error in RecorderService pauseRecording: ",e)}}resumeRecording(){try{this.recorderStatusSubject$.next("resumed"),this.mediaRecorder.resume(),this.recordingDurations.push({start:new Date().getTime()}),this.startTimer()}catch(e){this.loggingService.catch("Error in RecorderService resumeRecording: ",e)}}stopRecording(){try{this.mediaRecorder?.state!=="inactive"?(this.mediaRecorder.stop(),this.removeRecordingAttributeFromBody()):this.clearRecording()}catch(e){this.loggingService.catch("Error in RecorderService stopRecording: ",e)}}onStopRecording(){return ee(this,null,function*(){try{this.loggingService.log("[onStopRecording] Starting, current chunks:",this.chunks.length),this.recordingDurations?.length&&(this.recordingDurations[this.recordingDurations?.length-1].end=new Date().getTime()),this.stopTimer(),this.recorderStatusSubject$.next("stopped"),this.recorderInitData?.stream?.getTracks().forEach(i=>{i.stop()}),yield this.timeout(100);let e=new gM;if(this.chunks.length>0){let i=this.recorderInitData?.type==="audio"?"audio/mp4":"video/mp4";if(this.loggingService.log("[onStopRecording] Creating blob with type:",i),e.blob=new Blob(this.chunks,{type:i}),this.loggingService.log("[onStopRecording] Blob created, size:",e.blob.size),e.blob.size===0)throw new Error("Recorded blob has zero size");if(e.url=URL.createObjectURL(e.blob),e.type=this.recorderInitData?.type,e.recordedTime=this.recorderDurationSubject$.value,e?.type!=="audio")try{yield this.timeout(200);let r=yield Lie(e.blob,3);r&&(e.thumbnail=yield Bie(r))}catch(r){this.loggingService.catch("Error in RecorderService onStopRecording getVideoCover: ",r)}this.recordedRawData$.next(e)}else throw new Error("No data chunks recorded")}catch(e){this.loggingService.catch("Error in RecorderService onStopRecording: ",e),this.recordedRawData$.error(e)}})}clearRecording(){return ee(this,null,function*(){try{this.loggingService.log("%c[WB] Calling RecorderService FUNCTION: clearRecording","color: green;"),this.recorderStatusSubject$.next(null),this.recorderDurationSubject$.next(null),this.onInitRecording$.next(null),this.recordingDurations=[],this.domService.resetRecordingInProgress(),this.mediaRecorder=null,this.recorderInitData?.stream?.getTracks()?.forEach(e=>{e.stop()}),this.recorderInitData=null,this.recorderInitData$.next(null),this.chunks=[],this.chunkUrls$.next({}),this.stopTimer()}catch(e){this.loggingService.catch("Error in RecorderService clearRecording: ",e)}})}startTimer(){try{this.stopTimer(),this.durationInterval=setInterval(()=>{this.calculateRecordedTime()},1e3)}catch(e){this.loggingService.catch("Error in RecorderService startTimer: ",e)}}stopTimer(){try{this.durationInterval&&clearInterval(this.durationInterval)}catch(e){this.loggingService.catch("Error in RecorderService stopTimer: ",e)}}calculateRecordedTime(){try{if(this?.recordingDurations?.length){let e=0;this.recordingDurations.forEach(i=>{i.end?e+=i?.end-i.start:e+=new Date().getTime()-i.start;let r={};r.duration=e,r.display=this.convertMillisecondsToTime(e),this.recorderDurationSubject$.next(r)})}else this.recorderDurationSubject$.next(null)}catch(e){this.loggingService.catch("Error in RecorderService calculateRecordedTime: ",e)}}convertMillisecondsToTime(e){try{let i=Math.floor(e/1e3),r=Math.floor(i/60),a=Math.floor(r/60);return i=i%60,r=r%60,`${a?a.toString().padStart(2,"0")+":":""}${r.toString().padStart(2,"0")}:${i.toString().padStart(2,"0")}`}catch(i){return this.loggingService.catch("Error in RecorderService convertMillisecondsToTime: ",i),""}}getRecorderStatus$(){return this.recorderDurationSubject$.asObservable()}enableRecordingCountdown(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: enableRecordingCountdown","color: green;"),this.recordingCountdownEnabled$.value===!0)return;this.recordingCountdownEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in RecorderService enableRecordingCountdown: ",e)}}disableRecordingCountdown(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: disableRecordingCountdown","color: green;"),this.recordingCountdownEnabled$.value===!1)return;this.recordingCountdownEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in RecorderService disableRecordingCountdown: ",e)}}getRecordingCountdownEnabled$(){return this.recordingCountdownEnabled$.asObservable()}enableDarkMode(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: enableDarkMode","color: green;"),this.darkMode$.value===!0)return;this.darkMode$.next(!0)}catch(e){this.loggingService.catch("Error in RecorderService enableDarkMode: ",e)}}disableDarkMode(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: disableDarkMode","color: green;"),this.darkMode$.value===!1)return;this.darkMode$.next(!1)}catch(e){this.loggingService.catch("Error in RecorderService disableDarkMode: ",e)}}getDarkMode(){return this.darkMode$.value}getDarkMode$(){return this.darkMode$.asObservable()}enableShadowDom(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: enableShadowDom","color: green;"),this.shadowDom$.value===!0)return;this.shadowDom$.next(!0)}catch(e){this.loggingService.catch("Error in RecorderService enableShadowDom: ",e)}}disableShadowDom(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: disableShadowDom","color: green;"),this.shadowDom$.value===!1)return;this.shadowDom$.next(!1)}catch(e){this.loggingService.catch("Error in RecorderService disableShadowDom: ",e)}}getShadowDom(){return this.shadowDom$.value}getShadowDom$(){return this.shadowDom$.asObservable()}isSafari(){try{this.loggingService.log("%c[WB] Calling FUNCTION: isSafari","color: green;");let e=navigator.userAgent.toLowerCase();return e.includes("safari")&&!e.includes("chrome")&&!e.includes("android")}catch(e){return this.loggingService.catch("Error in RecorderService isSafari: ",e),!1}}getSupportedMimeTypes(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getSupportedMimeTypes","color: green;"),["video/mp4;codecs=h264,aac","video/mp4","audio/mp4","video/webm;codecs=vp9,opus","video/webm;codecs=vp8,opus","video/webm;codecs=h264,opus","video/webm"].filter(i=>MediaRecorder.isTypeSupported(i))}catch(e){return this.loggingService.catch("Error in RecorderService getSupportedMimeTypes: ",e),[]}}enableVideoEditor(){try{if(this.videoEditor$.value===!0)return;this.videoEditor$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enableVideoEditor: ",e)}}disableVideoEditor(){try{if(this.videoEditor$.value===!1)return;this.videoEditor$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disableVideoEditor: ",e)}}getVideoEditor$(){return this.videoEditor$.asObservable()}getVideoEditor(){return this.videoEditor$.value}waitForChunksUpload(){return ee(this,null,function*(){try{if(this.uploadPromises.length===0)return{};let e=this.uploadPromises.map(i=>i.promise);return yield Promise.all(e),this.chunkUrls$.value}catch(e){return this.loggingService.catch("Error in RecorderService waitForChunksUpload: ",e),this.chunkUrls$.value}})}getChunkUrls$(){return this.chunkUrls$.asObservable()}getChunkUrls(){return this.chunkUrls$.value}setRecorderActionsService(e){try{this.recorderActionsService=e}catch(i){this.loggingService.catch("Error in RecorderAnnotationService setRecorderActionsService: ",i)}}enableSettingsEmbedded(){try{if(this.settingsEmbedded$.value===!0)return;this.settingsEmbedded$.next(!0)}catch(e){this.loggingService.catch("Error in RecorderService enableSettingsEmbedded: ",e)}}disableSettingsEmbedded(){try{if(this.settingsEmbedded$.value===!1)return;this.settingsEmbedded$.next(!1)}catch(e){this.loggingService.catch("Error in RecorderService disableSettingsEmbedded: ",e)}}getSettingsEmbedded$(){return this.settingsEmbedded$.asObservable()}getSettingsEmbedded(){return this.settingsEmbedded$.value}enableAutoOpenVideoEditor(){try{if(this.autoOpenVideoEditor$.value===!0)return;this.autoOpenVideoEditor$.next(!0)}catch(e){this.loggingService.catch("Error in RecorderService enableAutoOpenVideoEditor: ",e)}}disableAutoOpenVideoEditor(){try{if(this.autoOpenVideoEditor$.value===!1)return;this.autoOpenVideoEditor$.next(!1)}catch(e){this.loggingService.catch("Error in RecorderService disableAutoOpenVideoEditor: ",e)}}getAutoOpenVideoEditor$(){return this.autoOpenVideoEditor$.asObservable()}getAutoOpenVideoEditor(){return this.autoOpenVideoEditor$.value}enablePlayVideoInFullScreen(){try{if(this.playVideoInFullScreen$.value===!0)return;this.playVideoInFullScreen$.next(!0)}catch(e){this.loggingService.catch("Error in RecorderService enablePlayVideoInFullScreen: ",e)}}disablePlayVideoInFullScreen(){try{if(this.playVideoInFullScreen$.value===!1)return;this.playVideoInFullScreen$.next(!1)}catch(e){this.loggingService.catch("Error in RecorderService disablePlayVideoInFullScreen: ",e)}}getPlayVideoInFullScreen$(){return this.playVideoInFullScreen$.asObservable()}getPlayVideoInFullScreen(){return this.playVideoInFullScreen$.value}};o.\u0275fac=function(i){return new(i||o)(J(Qe),J(y),J(Wi),J(Bp),J(lt),J(pn),J(Fe))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Xa=(()=>{let o=class o{constructor(e,i,r,a,s,c,p,h,_){this.afAuth=e,this.authService=i,this.configService=r,this.databaseService=a,this.docService=s,this.commonDbService=c,this.iamService=p,this.loggingService=h,this.notificationService=_,this.documentPaths=null,this.db=Ci(),this.views$=new fe({}),this.commentViews$=new fe({}),this.documentViews$=new fe({}),this.locationViews$=new fe({}),this.commentViewsByOrganizationIdAndDocumentId$=new fe({}),this.documentViewsByOrganizationIdAndDocumentId$=new fe({}),this.locationViewsByOrganizationIdAndLocationId$=new fe({}),this.documentViewsEnabled$=new fe(!1),this.documentViewsSetByDocumentId={},this.loggingService.log("%c[WB] Creating CLASS: ViewsService","color: blue;");try{this.authService.setViewsService(this),this.databaseService.getDb().pipe(Ne(E=>!!E),Je(1)).subscribe(E=>{E&&(this.db=E,this.subscribeViewsData().subscribe(),this.getNotificationFeatureViews$().subscribe(A=>{this.notificationService.setNotificationViews(A)}),this.authService.getUser$().pipe(Ne(A=>!!A),ge(A=>this.documentViewsEnabled$.pipe(Ne(V=>V),ce(()=>A))),ge(A=>this.docService.getDocumentPaths$().pipe(Go(null),Vi(),ce(([V,G])=>(V?.documentId!==G?.documentId&&this.views$.next({}),G)),ce(V=>(this.documentPaths=V,this.setDocumentAsRead({documentId:this.documentPaths?.documentId??"",clientDocumentId:this.documentPaths?.clientDocumentId??""}),{_user:A,_documentPaths:V})),ge(V=>this.docService.getDocumentIds$().pipe(ge(G=>(G?.length&&(G.find(X=>X.documentId===this.documentPaths?.documentId)||G.push({documentId:this.documentPaths?.documentId??"",clientDocumentId:this.documentPaths?.clientDocumentId??""}),G.forEach(X=>{this.setDocumentAsRead({documentId:X.documentId,clientDocumentId:X.clientDocumentId})})),re(V))))))),ge(A=>this.docService.getDocumentMetadata$().pipe(Ne(V=>!!V),ce(V=>T(I({},A),{_documentMetadata:V}))))).subscribe(),this.authService.getUser$().pipe(Ne(A=>!!A),ge(A=>this.documentViewsEnabled$.pipe(Ne(V=>V),ce(()=>A))),ge(A=>this.docService.getLocation$().pipe(Ne(V=>!!V))),ge(A=>this.docService.getDocumentIds$().pipe(ge(V=>(V.find(G=>G.documentId===this.documentPaths?.documentId)||V.push({documentId:this.documentPaths?.documentId??"",clientDocumentId:this.documentPaths?.clientDocumentId??""}),V.forEach(G=>{this.setLocationAsRead({documentId:G.documentId,clientDocumentId:G.clientDocumentId})}),re(A)))))).subscribe())},E=>{this.loggingService.catch("Error in ViewsService getDb subscription: ",E)})}catch(E){this.loggingService.catch("Error in ViewsService constructor: ",E)}}clearCache(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCache in ViewsService","color: green;");try{this.documentPaths=null,this.documentViews$.next({}),this.views$.next({}),this.commentViews$.next({}),this.locationViews$.next({}),this.commentViewsByOrganizationIdAndDocumentId$.next({}),this.documentViewsByOrganizationIdAndDocumentId$.next({}),this.locationViewsByOrganizationIdAndLocationId$.next({})}catch(e){this.loggingService.catch("Error in ViewsService clearCache: ",e)}}subscribeViewsData(e,i){this.loggingService.log("%c[WB] Calling FUNCTION: subscribeViewsData","color: green;");let r,a;try{if(e&&(a=fn(e)),i&&typeof i=="object"){let s=Xo(i);r=fn(JSON.stringify(s))}}catch(s){this.loggingService.catch("Error in ViewsService subscribeViewsData: ",s)}return Wn(this.afAuth).pipe(Ne(s=>!!s),ge(s=>this.isFeatureAllowed({firebaseUser:s})),ge(s=>s.featureAllowed?this.iamService.isUserAllowed$().pipe(ce(c=>(s.featureAllowed=c,s))):re(s)),ge(s=>s.featureAllowed?re(s).pipe(ge(c=>this.docService.getDocumentPaths$().pipe(ce(p=>(this.documentPaths=p,c.documentPaths=p,c)))),ge(c=>a?this.getDataFromDocumentIds([a]):this.docService.getDocumentIds$().pipe(ge(p=>{let h=p?.length>0?p.map(_=>_.documentId):[this.documentPaths?.documentId??""];return this.getDataFromDocumentIds(h)})))):re([])))}isFeatureAllowed(e){return this.configService.getConfig$().pipe(Ne(i=>!!i),ce(i=>T(I({},e),{config:i})),ge(i=>this.authService.getUser$().pipe(ce(r=>T(I({},i),{user:r})))),ge(i=>i.user?re(T(I({},i),{featureAllowed:!0})):re(T(I({},i),{featureAllowed:!1}))))}getDataFromDocumentIds(e,i){return this.getDataFromDocuments({documentIds:e,filters:i})}getCommentViewsById(e){try{return this.commentViews$.value?.[e]?this.commentViews$.value?.[e]:void 0}catch(i){this.loggingService.catch("Error in ViewsService getCommentViewsById: ",i);return}}getDocumentViewsById(e){try{return this.documentViews$.value?.[e]}catch(i){this.loggingService.catch("Error in ViewsService getDocumentViewsById: ",i);return}}getLocationViewsById(e){try{return this.locationViews$.value?.[e]}catch(i){this.loggingService.catch("Error in ViewsService getLocationViewsById: ",i);return}}getDataFromDocuments(e){if(this.configService?.getApiKey()){let{documentIds:i,filters:r}=e;return i?.some(a=>!a)||!this.documentPaths?re([]):this.documentViewsEnabled$.pipe(ge(a=>a?Dn([this.getCommentViewsDataFromDocuments(i),this.getDocumentViewsDataFromDocuments(i),this.getLocationViewsDataFromDocuments(i)]):Dn([this.getCommentViewsDataFromDocuments(i)])))}else return re(null)}getCommentViewsDataFromDocuments(e){let i=this.docService.getFolderConfig(),r=re([]),a={useCollectionGroup:!0,isCollection:!0,useQuery:!0};if(this.commonDbService.shouldUseFirestore()||(a.documentId=e?.length?e[0]:void 0,a.organizationId=this.documentPaths?.organizationId),i?.veltFolderId&&i?.allDocuments)r=this.commonDbService.dbListener({feature:"allCommentViews",properties:T(I({},a),{firestoreQuery:[Fi(mt("metadata.apiKey","==",this.configService?.getApiKey()),mt("metadata.veltFolderId","==",i?.veltFolderId),mt("metadata.organizationId","==",this.documentPaths?.organizationId))]})});else{let s=[];for(let c=0;c<(e?.length??0);c+=U.LISTENER_BATCH_SIZE)s.push(e?.slice(c,c+U.LISTENER_BATCH_SIZE)??[]);r=Dn(s.map(c=>this.commonDbService.dbListener({feature:"allCommentViews",properties:T(I({},a),{firestoreQuery:[Fi(mt("metadata.apiKey","==",this.configService?.getApiKey()),mt("metadata.documentId","in",c),mt("metadata.organizationId","==",this.documentPaths?.organizationId),...i?.veltFolderId?[mt("metadata.veltFolderId","==",i?.veltFolderId)]:[])]})}).pipe($r()))).pipe(ce(c=>ca(c)))}return r.pipe(ce(s=>({data:s?.data,operation:s?.operation})),ce(({data:s,operation:c})=>{let p={};return e?(Object.entries(s??{}).forEach(([h,_])=>{let E=_.metadata?.documentId;E&&(p[E]||(p[E]={}),p[E][h]=_)}),{data:s,documentMap:p,operation:c}):{data:s,documentMap:p,operation:c}}),ce(({data:s,documentMap:c,operation:p})=>{if(p?.type==="removed"){if(p?.ids?.length){let h=this.commentViews$.value;p?.ids?.forEach(_=>{delete h?.[_]}),this.commentViews$.next(h)}}else Object.entries(c??{}).forEach(([h,_])=>{this.setCommentViewsByOrganizationIdAndDocumentId({organizationId:this.documentPaths?.organizationId,documentId:h,commentViews:_})})}))}getDocumentViewsDataFromDocuments(e){let i=this.docService.getFolderConfig(),r=re([]),a={useCollectionGroup:!0,isCollection:!0,useQuery:!0};if(this.commonDbService.shouldUseFirestore()||(a.documentId=e?.length?e[0]:void 0,a.organizationId=this.documentPaths?.organizationId),i?.veltFolderId&&i?.allDocuments)r=this.commonDbService.dbListener({feature:"allDocumentViews",properties:T(I({},a),{firestoreQuery:[Fi(mt("metadata.apiKey","==",this.configService?.getApiKey()),mt("metadata.veltFolderId","==",i?.veltFolderId),mt("metadata.organizationId","==",this.documentPaths?.organizationId))]})});else{let s=[];for(let c=0;c<(e?.length??0);c+=U.LISTENER_BATCH_SIZE)s.push(e?.slice(c,c+U.LISTENER_BATCH_SIZE)??[]);r=Dn(s.map(c=>this.commonDbService.dbListener({feature:"allDocumentViews",properties:T(I({},a),{firestoreQuery:[Fi(mt("metadata.apiKey","==",this.configService?.getApiKey()),mt("metadata.documentId","in",c),mt("metadata.organizationId","==",this.documentPaths?.organizationId),...i?.veltFolderId?[mt("metadata.veltFolderId","==",i?.veltFolderId)]:[])]})}).pipe($r()))).pipe(ce(c=>ca(c)))}return r.pipe(ce(s=>({data:s?.data,operation:s?.operation})),ce(({data:s,operation:c})=>{let p={};return e?(Object.entries(s??{}).forEach(([h,_])=>{let E=_.metadata?.documentId;E&&(p[E]||(p[E]={}),p[E][h]=_)}),{data:s,documentMap:p,operation:c}):{data:s,documentMap:p,operation:c}}),ce(({data:s,documentMap:c,operation:p})=>{if(p?.type==="removed"){if(p?.ids?.length){let h=this.documentViews$.value;p?.ids?.forEach(_=>{delete h?.[_]}),this.documentViews$.next(h)}}else Object.entries(c??{}).forEach(([h,_])=>{this.setDocumentViewsByOrganizationIdAndDocumentId({organizationId:this.documentPaths?.organizationId,documentId:h,documentViews:_})})}))}getLocationViewsDataFromDocuments(e){let i=this.docService.getFolderConfig(),r=re([]),a={useCollectionGroup:!0,isCollection:!0,useQuery:!0};if(this.commonDbService.shouldUseFirestore()||(a.documentId=e?.length?e[0]:void 0,a.organizationId=this.documentPaths?.organizationId),i?.veltFolderId&&i?.allDocuments)r=this.commonDbService.dbListener({feature:"allLocationViews",properties:T(I({},a),{firestoreQuery:[Fi(mt("metadata.apiKey","==",this.configService?.getApiKey()),mt("metadata.veltFolderId","==",i?.veltFolderId),mt("metadata.organizationId","==",this.documentPaths?.organizationId))]})});else{let s=[];for(let c=0;c<(e?.length??0);c+=U.LISTENER_BATCH_SIZE)s.push(e?.slice(c,c+U.LISTENER_BATCH_SIZE)??[]);r=Dn(s.map(c=>this.commonDbService.dbListener({feature:"allLocationViews",properties:T(I({},a),{firestoreQuery:[Fi(mt("metadata.apiKey","==",this.configService?.getApiKey()),mt("metadata.documentId","in",c),mt("metadata.organizationId","==",this.documentPaths?.organizationId),...i?.veltFolderId?[mt("metadata.veltFolderId","==",i?.veltFolderId)]:[])]})}).pipe($r()))).pipe(ce(c=>ca(c)))}return r.pipe(ce(s=>({data:s?.data,operation:s?.operation})),ce(({data:s,operation:c})=>{let p={};return e?(Object.entries(s??{}).forEach(([h,_])=>{let E=_.metadata?.documentId;E&&(p[E]||(p[E]={}),p[E][h]=_)}),{data:s,documentMap:p,operation:c}):{data:s,documentMap:p,operation:c}}),ce(({data:s,documentMap:c,operation:p})=>{if(p?.type==="removed"){if(p?.ids?.length){let h=this.locationViews$.value;p?.ids?.forEach(_=>{delete h?.[_]}),this.locationViews$.next(h)}}else Object.entries(c??{}).forEach(([h,_])=>{this.setLocationViewsByOrganizationIdAndDocumentId({organizationId:this.documentPaths?.organizationId,documentId:h,locationViews:_})})}))}setViewsData(e){try{this.views$.next(I(I({},this.views$.getValue()),e||{}))}catch(i){this.loggingService.catch("Error in ViewsService setViewsData:",i)}}setCommentViewsByOrganizationIdAndDocumentId({organizationId:e,documentId:i,commentViews:r,queryHash:a}){try{if(r||(r={}),i){e||(e=U.NO_ORGANIZATION_ID),a||(a=U.DEFAULT_QUERY_HASH);let s=I(I({},this.commentViews$.value),r);this.commentViews$.next(s),this.commentViewsByOrganizationIdAndDocumentId$.next(T(I({},this.commentViewsByOrganizationIdAndDocumentId$.value),{[e]:T(I({},this.commentViewsByOrganizationIdAndDocumentId$.value[e]),{[i]:T(I({},this.commentViewsByOrganizationIdAndDocumentId$.value[e]?.[i]),{[a]:r})})}))}}catch(s){this.loggingService.catch("Error in CommentService setCommentAnnotationsByOrganizationIdAndDocumentId:",s)}}setDocumentViewsByOrganizationIdAndDocumentId({organizationId:e,documentId:i,documentViews:r,queryHash:a}){try{if(r||(r={}),i){e||(e=U.NO_ORGANIZATION_ID),a||(a=U.DEFAULT_QUERY_HASH);let s=I(I({},this.documentViews$.value),r);this.documentViews$.next(s),this.documentViewsByOrganizationIdAndDocumentId$.next(T(I({},this.documentViewsByOrganizationIdAndDocumentId$.value),{[e]:T(I({},this.documentViewsByOrganizationIdAndDocumentId$.value[e]),{[i]:T(I({},this.documentViewsByOrganizationIdAndDocumentId$.value[e]?.[i]),{[a]:r})})}))}}catch(s){this.loggingService.catch("Error in CommentService setCommentAnnotationsByOrganizationIdAndDocumentId:",s)}}setLocationViewsByOrganizationIdAndDocumentId({organizationId:e,documentId:i,locationViews:r,queryHash:a}){try{if(r||(r={}),i){e||(e=U.NO_ORGANIZATION_ID),a||(a=U.DEFAULT_QUERY_HASH);let s=I(I({},this.locationViews$.value),r);this.locationViews$.next(s),this.locationViewsByOrganizationIdAndLocationId$.next(T(I({},this.locationViewsByOrganizationIdAndLocationId$.value),{[e]:T(I({},this.locationViewsByOrganizationIdAndLocationId$.value[e]),{[i]:T(I({},this.locationViewsByOrganizationIdAndLocationId$.value[e]?.[i]),{[a]:r})})}))}}catch(s){this.loggingService.catch("Error in CommentService setCommentAnnotationsByOrganizationIdAndDocumentId:",s)}}getCommentFeatureViews$(){return this.commentViews$.pipe(Kt((e,i)=>JSON.stringify(e||{})===JSON.stringify(i||{})))}setCommentAnnotationAsRead(e){return ee(this,null,function*(){try{if(this.authService.getUser()&&e?.annotationId){let r=this.getCommentViewsById(e.annotationId)??(yield this.commonDbService?.getData({feature:"commentViews",properties:{id:e.annotationId,documentId:e.metadata?.documentId??this.documentPaths?.documentId??"",organizationId:e?.metadata?.organizationId??this.documentPaths?.organizationId??""}})),a=this.updateCommentAnnotationViews(e,r||{});this.commonDbService.setData({feature:"commentViews",properties:{id:e.annotationId,documentId:e.metadata?.documentId??this.documentPaths?.documentId??"",organizationId:e?.metadata?.organizationId??this.documentPaths?.organizationId??""},data:a})}}catch(i){this.loggingService.catch("Error in ViewsService setCommentAnnotationAsRead:",i)}})}updateCommentAnnotationViews(e,i){try{let r=this.authService.getUser(),a={views:{},comments:{}};if(r){let s={},c=i?.comments||{},p=new Date().getTime()+this.commonDbService.getOffset();e.comments?.forEach(_=>{c[_.commentId]||(c[_.commentId]={views:{}}),c[_.commentId].views||(c[_.commentId].views={}),c[_.commentId].views[r.userSnippylyId]||(c[_.commentId].views[r.userSnippylyId]={},c[_.commentId].views[r.userSnippylyId].timestamp=p)});let h=new Set(e.comments?.map(_=>_.commentId+""));if(Object.keys(c??{}).forEach(_=>{h.has(_)||delete c[_]}),e.comments?.length){let _=c[e.comments[0].commentId]?.views||{};Object.keys(_??{}).filter(A=>e.comments?.every(V=>c[V.commentId]?.views?.[A])).forEach(A=>{s[A]={timestamp:_[A].timestamp}})}a.views=s,a.comments=c}return e?.metadata?a.metadata=e.metadata:a.metadata=this.docService.getBaseMetadata(),a}catch(r){return this.loggingService.catch("Error in ViewsService updateCommentAnnotationViews:",r),{views:{},comments:{}}}}deleteCommentAnnotationViews(a,s){return ee(this,arguments,function*(e,{documentId:i,organizationId:r}){try{yield this.commonDbService.deleteData({feature:"commentViews",properties:{id:e.annotationId,documentId:i,organizationId:r}})}catch(c){this.loggingService.catch("Error in ViewsService deleteCommentAnnotationViews:",c)}})}getNotificationFeatureViews$(){return this.views$.pipe(Kt((e,i)=>JSON.stringify(e?.notification||{})===JSON.stringify(i?.notification||{})))}setNotificationsAsRead(e){try{let i=this.authService.getUser();if(i){let r=new Date().getTime()+this.commonDbService.getOffset();e.forEach(a=>{this.commonDbService.updateData({feature:"notificationViewsTimestamp",properties:{id:a,user:i.userSnippylyId,documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??""},data:{timestamp:r}})})}}catch(i){this.loggingService.catch("Error in ViewsService setNotificationAsRead:",i)}}getDocumentViews$(){return this.views$.pipe(Kt((e,i)=>JSON.stringify(e?.documentViews||{})===JSON.stringify(i?.documentViews||{})))}getUniqueViewsByUser(e){try{return this.enableDocumentViews(),this.docService.getDocumentPaths$().pipe(ge(i=>(this.documentPaths=i,e?this.locationViews$.pipe(ce(r=>{let a=Object.keys(r||{}).find(s=>r?.[s]?.location?.id===e);return a?r?.[a]?.users||{}:{}})):this.documentViews$.pipe(ce(r=>{let a=this.documentPaths?.documentId;return a?r?.[a]?.users||{}:{}})))),Kt(_o))}catch(i){return this.loggingService.catch("Error in ViewsService getUniqueViewsByUser:",i),re({})}}getUniqueViewsByDate(e){try{return this.enableDocumentViews(),this.docService.getDocumentPaths$().pipe(ge(i=>(this.documentPaths=i,e?this.locationViews$.pipe(ce(r=>{let a=Object.keys(r||{}).find(s=>r?.[s]?.location?.id===e);return a?r?.[a]?.day||{}:{}})):this.documentViews$.pipe(ce(r=>{let a=this.documentPaths?.documentId;return a?r?.[a]?.day||{}:{}})))))}catch(i){return this.loggingService.catch("Error in ViewsService getUniqueViewsByDate:",i),re({})}}enableDocumentViews(){try{if(this.documentViewsEnabled$.value===!0)return;this.documentViewsEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in ViewsService enableDocumentViews:",e)}}disableDocumentViews(){try{if(this.documentViewsEnabled$.value===!1)return;this.documentViewsEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in ViewsService disableDocumentViews:",e)}}setDocumentAsRead(r){return ee(this,arguments,function*({documentId:e,clientDocumentId:i}){try{let a=this.authService.getUser();if(a&&e){if(this.documentViewsSetByDocumentId[e])return;this.documentViewsSetByDocumentId[e]=!0;let s=new Date().getTime()+this.commonDbService.getOffset(),c=new Date().toISOString().split("T")[0],p=this.getDocumentViewsById(e);if(p){let h=new Date().toISOString().split("T")[0];p?.users[a.userSnippylyId]||(p.users[a.userSnippylyId]={}),p.users[a.userSnippylyId][h]={timestamp:this.timestamp},p?.day[h]||(p.day[h]={}),p.day[h][a.userSnippylyId]={timestamp:this.timestamp},p.metadata=this.docService.getBaseMetadata("documentViews",{clientDocumentId:i}),this.commonDbService.updateData({feature:"documentViews",properties:{id:e,date:h,user:a.userSnippylyId,documentId:e,organizationId:this.documentPaths?.organizationId??""},data:p})}else this.commonDbService.updateData({feature:"documentDayViews",properties:{id:e,date:c,user:a.userSnippylyId,documentId:e,organizationId:this.documentPaths?.organizationId??"",skipFirestore:!0},data:{timestamp:s}}),this.commonDbService.updateData({feature:"documentUsersViews",properties:{id:e,user:a.userSnippylyId,date:c,documentId:e,organizationId:this.documentPaths?.organizationId??"",skipFirestore:!0},data:{timestamp:s}}),this.commonDbService.updateData({feature:"documentMetadataViews",properties:{id:e,documentId:e,organizationId:this.documentPaths?.organizationId??"",skipFirestore:!0},data:this.docService.getBaseMetadata("documentViews",{clientDocumentId:i})}),this.docService.getDocumentMetadata$(e).pipe(Ne(h=>h!==null),Je(1)).subscribe(()=>{let h={day:{[c]:{[a.userSnippylyId]:{timestamp:s}}},users:{[a.userSnippylyId]:{[c]:{timestamp:s}}},metadata:this.docService.getBaseMetadata("documentViews",{clientDocumentId:i})};this.commonDbService.updateData({feature:"documentViews",properties:{id:e,date:c,user:a.userSnippylyId,documentId:e,organizationId:this.documentPaths?.organizationId??"",skipRtdb:!0},data:h})});this.checkAndTriggerNotification(a)}}catch(a){this.loggingService.catch("Error in ViewsService setDocumentAsRead:",a)}})}checkAndTriggerNotification(e){try{this.getUniqueViewsByUser().pipe(Je(1)).subscribe(i=>{if(Object.keys(i??{}).length===2){let r=this.docService.getDocumentMetadata();if(r?.creator?.email&&r?.creator?.email!==e.email){let a=[r.creator.email];this.updateNotificationsDatabase(pV.FIRST_VIEWED,{documentViews:{emails:a}})}}})}catch(i){this.loggingService.catch("Error in checkAndTriggerNotification:",i)}}setLocationAsRead(r){return ee(this,arguments,function*({documentId:e,clientDocumentId:i}){try{let a=this.authService.getUser(),s=this.docService.getLocation(),c=s?.locationId,p=s?.location;if(a&&c&&p){let h=new Date().getTime()+this.commonDbService.getOffset(),_=new Date().toISOString().split("T")[0],E=this.getLocationViewsById(c);if(E){let A=new Date().toISOString().split("T")[0];E?.users[a.userSnippylyId]||(E.users[a.userSnippylyId]={}),E.users[a.userSnippylyId][A]={timestamp:this.timestamp},E?.day[A]||(E.day[A]={}),E.day[A][a.userSnippylyId]={timestamp:this.timestamp},E.metadata=this.docService.getBaseMetadata("locationViews",{clientDocumentId:i}),this.commonDbService.updateData({feature:"location",data:E,properties:{id:c,documentId:e,organizationId:this.documentPaths?.organizationId??""}})}else{this.commonDbService.updateData({feature:"locationViews",data:p,properties:{id:c,documentId:e,organizationId:this.documentPaths?.organizationId??"",skipFirestore:!0}}),this.commonDbService.updateData({feature:"locationUsersViews",properties:{id:c,user:a.userSnippylyId,date:_,documentId:e,organizationId:this.documentPaths?.organizationId??"",skipFirestore:!0},data:{timestamp:h}}),this.commonDbService.updateData({feature:"locationDayViews",properties:{id:c,date:_,user:a.userSnippylyId,documentId:e,organizationId:this.documentPaths?.organizationId??"",skipFirestore:!0},data:{timestamp:h}}),this.commonDbService.updateData({feature:"locationMetadataViews",properties:{id:c,documentId:e,organizationId:this.documentPaths?.organizationId??"",skipFirestore:!0},data:this.docService.getBaseMetadata("locationViews",{clientDocumentId:i})});let A={day:{[_]:{[a.userSnippylyId]:{timestamp:h}}},users:{[a.userSnippylyId]:{[_]:{timestamp:h}}},metadata:this.docService.getBaseMetadata("locationViews",{clientDocumentId:i}),location:p};this.commonDbService.updateData({feature:"location",data:A,properties:{id:c,documentId:e,organizationId:this.documentPaths?.organizationId??"",skipRtdb:!0}})}}}catch(a){this.loggingService.catch("Error in ViewsService setLocationAsRead:",a)}})}updateNotificationsDatabase(e,i={}){try{let r=I({actionType:e,notificationSource:"documentViews"},i);this.notificationService.updateNotificationDatabase(r)}catch(r){this.loggingService.catch("Error in CommentService updateNotificationsDatabase: ",r)}}get timestamp(){return this.commonDbService.getServerTimestamp()}};o.\u0275fac=function(i){return new(i||o)(J(vi),J(je),J($t),J(pn),J(lt),J(bn),J(gn),J(y),J(Vn))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var fm=(()=>{let o=class o{constructor(e,i,r){this.docService=e,this.loggingService=i,this.authService=r;try{this.loggingService.log("%c[WB] Creating CLASS: MetadataService","color: blue;")}catch(a){this.loggingService.catch("Error in MetadataService constructor: ",a)}}getGlobalMetadata(){return ee(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 i=this.docService.getOrganizationMetadata(this.docService.getOrganizationConfig()?.organizationId),r=this.docService.getDocumentMetadataOfAvailableDocuments(),a=this.docService.getLocation();i&&(i=JSON.parse(JSON.stringify(i)),delete i?.organizationId,i.organizationId=i?.clientOrganizationId,delete i?.clientOrganizationId,delete i?.pageInfo),r&&(r=JSON.parse(JSON.stringify(r)),r.forEach(_=>{delete _?.locations,delete _?.location,delete _?.locationId,delete _?.pageInfo,delete _?.documentId,_.documentId=_?.clientDocumentId,delete _?.clientDocumentId,delete _?.veltFolderId,_?.clientOrganizationId&&(_.organizationId=_?.clientOrganizationId,delete _?.clientOrganizationId)}));let s=[];a&&(a=JSON.parse(JSON.stringify(a)),a?.location&&s.push(a?.location));let c=this.docService.getLocations();c&&Object.values(c).forEach(_=>{_?.location&&s.push(_?.location)});let p=this.docService.getFolderConfig()?.folderId;return{organization:i,documents:r,locations:s,folderId:p}}catch(e){return this.loggingService.catch("Error in MetadataService getGlobalMetadata: ",e),{}}})}};o.\u0275fac=function(i){return new(i||o)(J(lt),J(y),J(je))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Gv=(()=>{let o=class o{constructor(e,i,r){this.coreActionsService=e,this.loggingService=i,this.metadataService=r,this.buttonClickSubject$=new et,this.buttonToggleMap$=new fe({}),this.contextDataMapping={commentAnnotation:{source:["componentConfigSignal","annotation"],target:"commentAnnotation"},unreadCommentsMap:{source:["componentConfigSignal","unreadCommentsMap"],target:"unreadCommentAnnotationsMap"},comment:{source:["commentObj"],target:"comment"},index:{source:["i"],target:"index"},allAnnotations:{source:["componentConfigSignal","annotations"],target:"commentAnnotations"},systemFilteredAnnotations:{source:["componentConfigSignal","filteredCommentPinAnnotations"],target:"systemFilteredAnnotations"},notification:{source:["notification"],target:"notification"},allNotifications:{source:["componentConfigSignal","notificationsInSession"],target:"notifications"}}}buttonClick(s){return ee(this,arguments,function*({id:e,type:i,groupId:r,contextData:a}){try{this.buttonToggle(e,void 0,i,r);let c=this.extractButtonData(a),p=this.createButtonContext(e,i,r),h=yield this.metadataService.getGlobalMetadata(),_=T(I({buttonContext:p},c),{metadata:h});this.buttonClickSubject$.next(_),this.coreActionsService.triggerAction(gd.VELT_BUTTON_CLICK,_)}catch(c){this.loggingService.catch("Error in ButtonService buttonClick: ",c)}})}buttonActive({id:e,type:i,groupId:r,contextData:a}){try{let s=this.buttonToggleMap$.value?.[r||"ungrouped"]?.[e]||!0;this.buttonToggle(e,s,i,r)}catch(s){this.loggingService.catch("Error in ButtonService buttonClick: ",s)}}buttonToggle(e,i,r,a){try{let s=this.buttonToggleMap$.value,c=this.createNewToggleMap(s,e,i,r,a);this.buttonToggleMap$.next(c)}catch(s){this.loggingService.catch("Error in ButtonService buttonToggle: ",s)}}extractButtonData(e){try{let i={};return Object.entries(this.contextDataMapping).forEach(([r,a])=>{let s=this.getNestedValue(e,a.source);s!==void 0&&(i[a.target]=s)}),i}catch(i){return this.loggingService.catch("Error in ButtonService extractContextData: ",i),{}}}getNestedValue(e,i){try{let r=e;for(let a of i){if(r?.[a]===void 0)return;Pi(r[a])?r=r[a]():r=r[a]}return r}catch(r){this.loggingService.catch("Error in ButtonService getNestedValue: ",r);return}}createButtonContext(e,i,r){try{let a={type:i,selections:this.buttonToggleMap$.value,clickedButtonId:e};return(i==="single-select"||i==="multi-select")&&r?T(I({},a),{groupId:r}):a}catch(a){return this.loggingService.catch("Error in ButtonService createButtonMetadata: ",a),{}}}createNewToggleMap(e,i,r,a,s){try{let c=I({},e);return a==="button-toggle"?T(I({},c),{ungrouped:T(I({},c.ungrouped),{[i]:r??!c.ungrouped?.[i]})}):a==="single-select"&&s?T(I({},c),{[s]:{[i]:r??!0}}):a==="multi-select"&&s?T(I({},c),{[s]:T(I({},c[s]),{[i]:r??!c[s]?.[i]})}):c}catch(c){return this.loggingService.catch("Error in ButtonService createNewToggleMap: ",c),{}}}buttonClickSubject(){return this.buttonClickSubject$.asObservable()}buttonToggleMap(){return this.buttonToggleMap$.asObservable()}resetVeltButtonState(e){return ee(this,null,function*(){try{if(e){let{id:s,group:c}=e,p=JSON.parse(JSON.stringify(this.buttonToggleMap$.value||{}));c&&s?delete p?.[c]?.[s]:c?delete p?.[c]:s&&Object.keys(p).forEach(h=>{Object.keys(p[h]).forEach(_=>{_===s&&delete p?.[h]?.[_]})}),this.buttonToggleMap$.next(p)}else this.buttonToggleMap$.next({});let i={selections:this.buttonToggleMap$.value},r=yield this.metadataService.getGlobalMetadata(),a={buttonContext:i,metadata:r};this.coreActionsService.triggerAction(gd.VELT_BUTTON_CLICK,a)}catch(i){this.loggingService.catch("Error in ButtonService resetVeltButtonState: ",i)}})}buttonToggleMapValue(){return this.buttonToggleMap$.value}};o.\u0275fac=function(i){return new(i||o)(J(Np),J(y),J(fm))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Te=(()=>{let o=class o{constructor(e,i,r,a,s,c,p,h,_,E,A,V,G,X,he,Ie,Pe,Be,We,ke,we,Ee,Me,Ce,ue,Le){this.analyticsService=e,this.areaService=i,this.commonDbService=r,this.configService=a,this.docService=s,this.databaseService=c,this.authService=p,this.domService=h,this.afAuth=_,this.avatarService=E,this.contactService=A,this.storageService=V,this.functions=G,this.dialog=X,this.iamService=he,this.loggingService=Ie,this.notificationService=Pe,this.customFilterService=Be,this.reactionService=We,this.hotkeyService=ke,this.recorderService=we,this.viewsService=Ee,this.buttonService=Me,this.metadataService=Ce,this.commonDbUtilsService=ue,this.attachmentResolverService=Le,this.customPinsById=new Map,this.commentAdded$=new et,this.commentUpdated$=new et,this.commentAccepted$=new et,this.commentRejected$=new et,this.commentAnnotationDeleted$=new et,this.multiThreadCommentAnnotationDeleted$=new et,this.commentAnnotationById$=new fe(null),this.multiThreadCommentAnnotationById$=new fe(null),this.ghostCommentAnnotationMap$=new fe({}),this.unreadCommentsMap$=new fe(null),this.documentPaths=null,this.db=Ci(),this.user=null,this.customCategoryMap=U.CommentCategoryMap,this.allowedElementIds$=new fe([]),this.allowedElementClassNames$=new fe([]),this.allowedElementQuerySelectors$=new fe([]),this.addCommentMode$=new fe(!1),this.persistentCommentMode$=new fe(!1),this.seenByUsers$=new fe(!0),this.deleteReplyConfirmation$=new fe(!1),this.persistentModeBanner$=new fe(!0),this.commentAddedEmitter=null,this.commentContextProvider=null,this.textCommentMode$=new fe(!0),this.sidebarVisible$=new fe(!1),this.sidebarOpenedByCustomTrigger$=new fe(!1),this.floatingCommentsEnabled$=new fe(!0),this.moderatorMode$=new fe(!1),this.streamMode$=new fe(!1),this.enableSignInButton$=new fe(!1),this.enableUpgradeButton$=new fe(!1),this.onSignInClick$=new et,this.onUpgradeClick$=new et,this.enableAttachment$=new fe(!0),this.enableReactions$=new fe(!0),this.allowedRecordings$=new fe(["audio","video","screen"]),this.openSidebar$=new et,this.showScreenSizeInfo$=new fe(!1),this.showCommentIndex$=new fe(!1),this.popoverMode$=new fe(!1),this.popoverTriangleComponent$=new fe(!0),this.draftMode$=new fe(!0),this.enableDialogOnHover$=new fe(!0),this.enableDialogOnTargetElementClick$=new fe(!1),this.enablePriority$=new fe(!1),this.enableStatus$=new fe(!0),this.enableResolve$=new fe(!0),this.enableGhostComments$=new fe(!1),this.enableGhostCommentsMessage$=new fe(!0),this.inboxMode$=new fe(!1),this.enableAutoCategorize$=new fe(!1),this.commentContainerDarkMode$=new fe(!1),this.suggestionMode$=new fe(!1),this.mobileMode$=new fe(!0),this.inlineCommentMode$=new fe(!1),this.minimap$=new fe(!1),this.commentsOnDom$=new fe(!0),this.commentToolEnabled$=new fe(!0),this.totalMediaLength$=new fe(0),this.sidebarUrlNavigationEnabled$=new fe(!1),this.detectionStrategy$=new fe(jO.DEFAULT),this.sidebarButtonOnCommentDialogVisible$=new fe(!1),this.sidebarButtonOnCommentDialogClick$=new et,this.commentNavigationButtonClick$=new et,this.deviceIndicatorOnCommentPins$=new fe(!1),this.sidebarCommentClick$=new et,this.privateCommentMode$=new fe(!1),this.scrollToComment$=new fe(!0),this.userMentions$=new fe(!0),this.deleteOnBackspace$=new fe(!0),this.hotkeyEnabled$=new fe(!1),this.recordingSummaryEnabled$=new fe(!0),this.unreadIndicatorMode$=new fe(wu.MINIMAL),this.composerMode$=new fe(Du.DEFAULT),this.enterKeyToSubmit$=new fe(!1),this.resolvedCommentsOnDom$=new fe(!1),this.bubbleOnPinEnabled$=new fe(!1),this.bubbleOnPinHoverEnabled$=new fe(!0),this.excludeLocationIdsFromSidebar$=new fe([]),this.multiThread$=new fe(!1),this.shortUserName$=new fe(!0),this.collapsedComments$=new fe(!1),this.fullExpanded$=new fe(!1),this.queryParamsComments$=new fe(!1),this.resolveStatusAccessAdminOnly$=new fe(!1),this.svgAsImg$=new fe(!1),this.commentToNearestAllowedElement$=new fe(!1),this.pinShadowDOM$=new fe(!0),this.dialogShadowDOM$=new fe(!0),this.textCommentToolShadowDOM$=new fe(!0),this.pinDarkMode$=new fe(null),this.textCommentToolDarkMode$=new fe(null),this.textCommentToolbarDarkMode$=new fe(null),this.textCommentToolbarShadowDOM$=new fe(!0),this.sidebarShadowDOM$=new fe(!0),this.changeDetectionInCommentMode$=new fe(!1),this.commentSelectionChange$=new et,this.commentSidebarFilters$=new fe({}),this.bubbleCommentAnnotationIds$=new fe([]),this.updateCommentDialogPositionTriggerSubject$=new fe(void 0),this.areaCommentEnabled$=new fe(!0),this.commentPinCursorImage$=new fe(""),this.commentAnnotationsFromCommentsContainer$=new fe([]),this.customChipDropdownData$=new fe(null),this.originalCommentAnnotationsByDocumentId$=new fe({}),this.draftCommentAnnotationsByAnnotationId$=new fe(null),this.draftMultiThreadCommentAnnotationsByAnnotationId$=new fe({}),this.copyLink$=new fe(""),this.addCommentDragMode=!1,this.dragSubscriptions=[],this.hotkeySubscriptions=[],this.sidebarData$=new fe(null),this.sidebarCustomActionEventData$=new fe(null),this.sidebarCustomActionEventDataAllChanges$=new fe(null),this.sidebarCustomActionEventDataOnInit$=new fe(null),this.customActions$=new fe(!1),this.focusedThreadMode$=new fe(!1),this.customStatusesShown$=new fe(!1),this.readOnly$=new fe(!1),this.customAutocompleteSearch$=new fe(!1),this.deleteThreadWithFirstComment$=new fe(!0),this.transformContext$=new fe(null),this.expandMentionGroups$=new fe(!1),this.showMentionGroupsFirst$=new fe(!1),this.showMentionGroupsOnly$=new fe(!1),this.loggingService.log("%c[WB] Creating CLASS: CommentService","color: blue;"),this.analyticsService.setCommentService(this),this.notificationService.setCommentService(this),this.docService.setCommentService(this),this.authService.setCommentService(this),this.docService.getDocumentPaths$().pipe(Vi()).subscribe(([Se,Ut])=>{Se?.documentId!==Ut?.documentId&&this.unreadCommentsMap$.next(null)},Se=>{this.loggingService.catch("Error in CommentService getDocumentPaths$ subscription: ",Se)}),this.authService.getUser$().subscribe(Se=>{Se||this.resetCacheData()},Se=>{this.loggingService.catch("Error in CommentService getUser$ subscription: ",Se)}),this.databaseService.getDb().pipe(Ne(Se=>!!Se),Je(1)).subscribe(Se=>{Se&&(this.db=Se,this.getDocumentPaths())},Se=>{this.loggingService.catch("Error in CommentService getDb subscription: ",Se)}),this.domService.onWindowPointerMove$().subscribe(Se=>{if(this.addCommentMode$.value){let Ut=!0;if(this.addCommentDragMode)this.domService.removeClassFromElement(document.body,"show-pin-cursor");else{let Gt=this.domService.getBackgroundElement(Se.clientX,Se.clientY,!0,!0);if(Gt)if(this.isElementInsideAllowedElements(Gt))if(fd(Se.target))this.domService.removeClassFromElement(document.body,"show-pin-cursor");else{this.domService.addClassToElement(document.body,"show-pin-cursor"),this.hightlightElement&&this.hightlightElement!==Gt&&this.domService.removeHighlightFromElement(this.hightlightElement),this.hightlightElement=Gt;let Dt=this.domService.getSelectedAnnotationsMap("comment")||{},It=this.commentPinCursorImage$.value||U.CURSOR.COMMENT_PIN;this.domService.highlightElement(this.hightlightElement,It,!!Object.keys(Dt)?.length),Ut=!1}else this.domService.removeClassFromElement(document.body,"show-pin-cursor")}this.hightlightElement&&Ut&&(this.domService.removeHighlightFromElement(this.hightlightElement),this.hightlightElement=null)}},Se=>{this.loggingService.catch("Error in CommentService onWindowPointerMove$ subscription: ",Se)}),this.domService.onWindowKeyupEsc$().subscribe(Se=>{if(this.addCommentMode$.value){let Ut=this.domService.getSelectedAnnotationsMap("comment")||{};Object.keys(Ut)?.length?this.domService.resetSelectedAnnotationsMap():this.disableAddCommentMode()}},Se=>{this.loggingService.catch("Error in CommentService onWindowKeyupEsc$ subscription: ",Se)}),this.domService.onDocumentClick$().subscribe(Se=>{if(Se?.target&&!Ui(Se?.target)){let Ut=this.domService.getSelectedAnnotationsMap("comment")||{};if(Ut=I(I({},Ut),this.domService.getSelectedAnnotationsMap("multiThread")||{}),Object.keys(Ut)?.length&&(this.domService.resetSelectedAnnotationsMap(),this.persistentCommentMode$?.value)){this.addCommentMode$.value&&this.detectToAddAreaComment(),Se.preventDefault(),Se.stopPropagation();return}}if(Se&&this.addCommentMode$.value&&!fd(Se.target)){let Ut=!1;if(this.addCommentDragMode)Se.preventDefault(),Se.stopPropagation(),this.addCommentDragMode=!1;else if(!this.domService.getDraftCommentAnnotationDialogs()?.length){let Gt=this.domService.getBackgroundElement(Se.clientX,Se.clientY);(this.persistentCommentMode$?.value&&this.domService.getBackgroundVeltElement(Se.clientX,Se.clientY)||Se?.target&&Ui(Se?.target))&&(Gt=null),Gt&&(this.isElementInsideAllowedElements(Gt)||this.getCommentToNearestAllowedElement())&&(Ut=this.isElementInsideManualCommentContainer(Gt),Ut||(Se.preventDefault(),Se.stopPropagation(),this.addComment(Se)))}this.persistentCommentMode$?.value?this.detectToAddAreaComment():Ut||this.disableAddCommentMode()}},Se=>{this.loggingService.catch("Error in CommentService onDocumentClick$ subscription: ",Se)}),this.addCommentMode$.subscribe(Se=>{this.hightlightElement&&this.domService.removeHighlightFromElement(this.hightlightElement),Se?(this.domService.addClassToElement(document.body,"snippyly-add-comment-mode"),this.detectToAddAreaComment(),this.addIframeContainerStaticAttribute()):(this.removeIframeContainerStaticAttribute(),this.domService.removeClassFromElement(document.body,"snippyly-add-comment-mode"),this.domService.removeClassFromElement(document.body,"show-pin-cursor"),this.dragSubscriptions.forEach(Ut=>Ut.unsubscribe()))},Se=>{this.loggingService.catch("Error in CommentService addCommentMode$ subscription: ",Se)}),this.domService.onWindowKeyupBackspace$().subscribe(Se=>{this.getDeleteOnBackspace()&&this.deleteCommentPinAnnotations("keyupBackspace")},Se=>{this.loggingService.catch("Error in CommentService onWindowKeyupBackspace$ subscription: ",Se)}),this.domService.onWindowKeyupDelete$().subscribe(Se=>{this.deleteCommentPinAnnotations("keyupDelete")},Se=>{this.loggingService.catch("Error in CommentService onWindowKeyupDelete$ subscription: ",Se)}),this.domService.getDeleteCommmentAnnotations$().subscribe(Se=>{Se?.length&&(Se?.filter(Gt=>!["tag","recorder","rewriter","arrow","area","multiThread"].includes(Gt.type))).forEach(Gt=>ee(this,null,function*(){yield this.deleteCommentPinAnnotation(Gt)}))},Se=>{this.loggingService.catch("Error in CommentService onWindowKeyupDelete$ subscription: ",Se)}),this.getPopoverMode$().subscribe(Se=>{Se?document?.body?.setAttribute(U.ATTRIBUTES.VELT_POPOVER_MODE,"true"):document?.body?.removeAttribute(U.ATTRIBUTES.VELT_POPOVER_MODE)},Se=>{this.loggingService.catch("Error in CommentService getPopoverMode subscription: ",Se)}),this.customFilterService.customCategoryMap$.subscribe(Se=>{this.customCategoryMap=Se},Se=>{this.loggingService.catch("Error in CommentService customCategoryMap$ subscription: ",Se)}),this.hotkeyEnabled$.subscribe(Se=>{Se?this.subscribeHotkeyEvents():this.unsubscribeHotkeyEvents()},Se=>{this.loggingService.catch("Error in CommentService hotkeyEnabled$ subscription: ",Se)}),this.domService.getSelectedAnnotationsMap$().pipe(Vi()).subscribe(([Se,Ut])=>{try{let Gt=Object.values(Se||{}).filter(It=>!["tag","recorder","rewriter","arrow","area"].includes(It.type)),Dt=Object.values(Ut||{}).filter(It=>!["tag","recorder","rewriter","arrow","area"].includes(It.type));Gt?.forEach(It=>{Dt?.find(Nt=>Nt.annotationId===It.annotationId)||this.commentSelectionChange$.next({annotation:$n(It),selected:!1})}),Dt?.forEach(It=>{Gt?.find(Nt=>Nt.annotationId===It.annotationId)||this.commentSelectionChange$.next({annotation:$n(It),selected:!0})})}catch(Gt){this.loggingService.catch("Error in CommentService getSelectedAnnotationsMap$: ",Gt)}},Se=>{this.loggingService.catch("Error in CommentService getSelectedAnnotationsMap$ subscription: ",Se)})}clearCache(){try{this.loggingService.log("%c[WB] Calling FUNCTION: clearCache in CommentService","color: green;"),this.commentAnnotationById$.next(null),this.draftCommentAnnotationsByAnnotationId$.next(null),this.multiThreadCommentAnnotationById$.next({}),this.draftMultiThreadCommentAnnotationsByAnnotationId$.next({}),this.customAutocompleteSearch$.next(!1),this.hightlightElement=null,this.addCommentMode$.next(!1),this.unreadCommentsMap$.next(null),this.documentPaths=null}catch(e){this.loggingService.catch("Error in CommentService clearCache: ",e)}}setCommentActionsService(e){try{this.commentActionsService=e}catch(i){this.loggingService.catch("Error in CommentService setCommentActionsService: ",i)}}detectToAddAreaComment(){try{let e=this.areaService.getAreaEnabled(),i=this.getAreaCommentEnabled();if(e&&i){let r,a,s,c=null,p=null;this.dragSubscriptions.forEach(h=>h.unsubscribe()),this.dragSubscriptions.push(this.domService.onWindowMouseDown$().pipe(Ne(h=>!Ui(h?.target)),Je(1)).subscribe(h=>{c=null,p=null,this.dragSubscriptions.push(this.domService.getClickAndDragPointsObservable().subscribe(_=>{if(c===null){let E=_?.startPoint?.event?.target,A=Ui(E),V=fd(E),G=this.isElementInsideAllowedElements(E);c=!A&&!V&&G}if(c){this.addCommentDragMode=!0,r=_.startPoint,a=_.curPoint;let E=_?.curPoint?.event?.target,A=Ui(E),V=fd(E),G=this.isElementInsideAllowedElements(E);p=!A&&!V&&G,p?s=this.domService.drawRectangle(r,a):s?.remove()}})),this.domService.onWindowPointerUp$().pipe(xs(1),Je(1)).subscribe(_=>{if(a={x:_.clientX,y:_.clientY},r&&a&&(s?.remove(),c&&p)){let E=[{x:r.x-window.scrollX,y:r.y-window.scrollY},{x:a.x,y:a.y}];this.addComment(_,void 0,E)}this.dragSubscriptions.forEach(E=>E.unsubscribe())})}))}}catch(e){this.loggingService.catch("Error in CommentService detectToAddAreaComment: ",e)}}resetCacheData(){try{this.loggingService.log("%c[WB] Calling CommentService FUNCTION: resetCacheData","color: green;"),this.commentAnnotationById$.next(null),this.draftCommentAnnotationsByAnnotationId$.next(null),this.multiThreadCommentAnnotationById$.next({}),this.draftMultiThreadCommentAnnotationsByAnnotationId$.next({})}catch(e){this.loggingService.catch("Error in CommentService resetCacheData: ",e)}}addAreaContainerTag(){try{if(!(document.querySelector(U.TAGS.VELT_AREAS)||document.querySelector(U.TAGS.SNIPPYLY_AREAS))){let i=document.createElement(U.TAGS.VELT_AREAS);document.body.appendChild(i)}}catch(e){this.loggingService.catch("Error in CommentService addAreaContainerTag: ",e)}}addIframeContainerStaticAttribute(){try{document.querySelectorAll(`[${U.ATTRIBUTES.VELT_IFRAME_CONTAINER}]`).forEach(i=>{window.getComputedStyle(i).position==="static"&&i.setAttribute(U.ATTRIBUTES.VELT_IFRAME_CONTAINER_STATIC,"true")})}catch(e){this.loggingService.catch("Error in CommentService addIframeContainerStaticAttribute: ",e)}}removeIframeContainerStaticAttribute(){try{document.querySelectorAll(`[${U.ATTRIBUTES.VELT_IFRAME_CONTAINER_STATIC}]`).forEach(i=>{i.removeAttribute(U.ATTRIBUTES.VELT_IFRAME_CONTAINER_STATIC)})}catch(e){this.loggingService.catch("Error in CommentService removeIframeContainerStaticAttribute: ",e)}}subscribeHotkeyEvents(){try{this.loggingService.log("%c[WB] Calling FUNCTION: subscribeHotkeyEvents","color: green;"),this.unsubscribeHotkeyEvents(),this.hotkeySubscriptions.push(this.hotkeyService.getKeyPressEvent("c").subscribe(e=>{e&&!this.addCommentMode$.value&&this.enableAddCommentMode()},e=>{this.loggingService.catch("Error in CommentService hotkeyService.getKeyPressEvent subscription: ",e)}))}catch(e){this.loggingService.catch("Error in CommentService subscribeHotkeyEvents: ",e)}}unsubscribeHotkeyEvents(){try{this.loggingService.log("%c[WB] Calling FUNCTION: unsubscribeHotkeyEvents","color: green;"),this.hotkeySubscriptions.forEach(e=>e?.unsubscribe())}catch(e){this.loggingService.catch("Error in CommentService unsubscribeHotkeyEvents: ",e)}}setCommentAddedEmitter(e){try{this.commentAddedEmitter=e}catch(i){this.loggingService.catch("Error in CommentService setCommentAddedEmitter: ",i)}}setContextProvider(e){try{this.commentContextProvider=e}catch(i){this.loggingService.catch("Error in CommentService setContextProvider: ",i)}}getDocumentPaths(){this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentPaths","color: green;"),this.docService.getDocumentPaths$()}getAnonymousAvatarImage(){return this.loggingService.log("%c[WB] Calling FUNCTION: getAnonymousAvatarImage","color: green;"),this.avatarService.generateUserImage()}setAllowedElementIds(e){try{this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{allowedElementIds:e}}),this.allowedElementIds$.next(e||[])}catch(i){this.loggingService.catch("Error in CommentService setAllowedElementIds: ",i)}}getAllowedElementIds(){return this.allowedElementIds$.asObservable()}setAllowedElementClassNames(e){try{this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{allowedElementClassNames:e}}),this.allowedElementClassNames$.next(e||[])}catch(i){this.loggingService.catch("Error in CommentService setAllowedElementClassNames: ",i)}}getAllowedElementClassNames(){return this.allowedElementClassNames$.asObservable()}setAllowedElementQuerySelectors(e){try{this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{allowedElementQuerySelectors:e}}),this.allowedElementQuerySelectors$.next(e||[])}catch(i){this.loggingService.catch("Error in CommentService setAllowedElementQuerySelectors: ",i)}}getAllowedElementQuerySelectors(){return this.allowedElementQuerySelectors$.asObservable()}getAnnotationsCount(e){try{return Wn(this.afAuth).pipe(Ne(i=>!!i),ge(i=>this.isFeatureAllowed({firebaseUser:i,annotations:[],filteredAnnotations:[]})),ge(i=>i.featureAllowed?this.iamService.isUserAllowed$().pipe(ce(r=>(i.featureAllowed=r,i))):re(i)),ge(i=>i.featureAllowed?re(i).pipe(ge(r=>this.docService.getDocumentPaths$().pipe(ce(a=>(this.documentPaths=a,r.documentPaths=a,r)))),ge(()=>e?.documentIds?.length?re(e?.documentIds.map(r=>({clientDocumentId:r,documentId:`${fn(r)}`}))):this.docService.getDocumentIds$().pipe(ce(r=>r?.length>0?r:[{documentId:this.documentPaths?.documentId??"",clientDocumentId:this.documentPaths?.clientDocumentId||""}]))),ge(r=>{let a=this.authService.getUser()?.userSnippylyId,s=this.documentPaths?.organizationId,c=r?.length>0?r.map(A=>A.documentId):[this.documentPaths?.documentId??""];if(c.some(A=>!A)||!this.documentPaths)return re();let p=this.docService.getFolderConfig(),h=re(),_=re(),E={useCollectionGroup:!0,isCollection:!0,useQuery:!0};if(p?.veltFolderId&&p?.allDocuments)h=this.commonDbService.dbListener({feature:"allComments",properties:T(I({},E),{firestoreQuery:[Fi(mt("metadata.apiKey","==",this.configService?.getApiKey()),mt("metadata.organizationId","==",s),mt("metadata.veltFolderId","==",p?.veltFolderId),...e?.statusIds?[mt("status.id","in",e.statusIds)]:[]),Wa("lastUpdated","desc"),Wa("createdAt","desc")]})}).pipe(ce(A=>A?.data)),_=this.commonDbService.dbListener({feature:"allCommentViews",properties:T(I({},E),{firestoreQuery:[Fi(mt("metadata.apiKey","==",this.configService?.getApiKey()),mt("metadata.organizationId","==",s),mt("metadata.veltFolderId","==",p?.veltFolderId))]})}).pipe(ce(A=>A?.data));else{let A=[];for(let V=0;V<(c?.length??0);V+=U.LISTENER_BATCH_SIZE)A.push(c?.slice(V,V+U.LISTENER_BATCH_SIZE)??[]);h=Dn(A.map(V=>this.commonDbService.dbListener({feature:"allComments",properties:T(I({},E),{firestoreQuery:[Fi(mt("metadata.apiKey","==",this.configService?.getApiKey()),mt("metadata.organizationId","==",s),mt("metadata.documentId","in",V),...e?.statusIds?[mt("status.id","in",e.statusIds)]:[],...p?.veltFolderId?[mt("metadata.veltFolderId","==",p?.veltFolderId)]:[]),Wa("lastUpdated","desc"),Wa("createdAt","desc")]})}).pipe($r()))).pipe(ce(V=>ca(V)?.data)),_=Dn(A.map(V=>this.commonDbService.dbListener({feature:"allCommentViews",properties:T(I({},E),{firestoreQuery:[Fi(mt("metadata.apiKey","==",this.configService?.getApiKey()),mt("metadata.organizationId","==",s),mt("metadata.documentId","in",V),...p?.veltFolderId?[mt("metadata.veltFolderId","==",p?.veltFolderId)]:[])]})}).pipe($r()))).pipe(ce(V=>ca(V)?.data))}return Dn([h,_]).pipe(ge(([A,V])=>!A||!V?re(null):re([A,V]).pipe(ce(([G,X])=>{let he=Object.values(G||{});e?.locationIds?.length&&(he=he.filter(ke=>e.locationIds?.includes(ke.location?.id??"")));let Ie={};he.forEach(ke=>{Ie[ke.annotationId]=ke});let Pe={};Object.entries(X||{}).forEach(([ke,we])=>{Ie[ke]&&(we?.views?.[a]||(Pe[ke]=we))});let Be=he.reduce((ke,we)=>{let Ee=we?.metadata?.clientDocumentId;return Ee&&(ke[Ee]||(ke[Ee]=[]),ke[Ee].push(we)),ke},{}),We=Object.values(Pe).reduce((ke,we)=>{let Ee=we?.metadata?.clientDocumentId;return Ee&&(ke[Ee]||(ke[Ee]=[]),ke[Ee].push(we)),ke},{});return r.reduce((ke,{clientDocumentId:we})=>{ke?.data||(ke.data={});let Ee=Be[we]?.length??0,Me=We[we]?.length??0;return ke.data[we]={total:Ee,unread:Me},ke},{data:{}})}),Ln(G=>(this.loggingService.catch("Error in CommentService getAnnotationsCount: ",G),re(null))))))})):re(null)),ce(i=>i||{data:null}),Kt(_o))}catch(i){return this.loggingService.catch("Error in CommentService getAnnotationsCount: ",i),re({data:null})}}getAllCommentAnnotations({customClientDocumentId:e,params:i,excludeDomChanges:r,detectGhostComments:a,skipPositionCalculation:s,query:c,fromCommentSidebar:p,analytics:h}){this.loggingService.log("%c[WB] Calling FUNCTION: getAllCommentAnnotations","color: green;");let _,E,A;h?.enabled&&this.analyticsService.trackEvent(h?.eventName||Z.Events.Comments.GET_ALL_COMMENT_ANNOTATIONS_TRIGGERED_INTERNAL,h?.properties);try{if(e&&(A=`${fn(e)}`),i&&typeof i=="object"){let V=Xo(i);E=V?.id,_=fn(JSON.stringify(V))}}catch(V){this.loggingService.catch("Error in CommentService getAllCommentAnnotations: ",V)}return Wn(this.afAuth).pipe(Ne(V=>!!V),ge(V=>this.isFeatureAllowed({firebaseUser:V,annotations:[],filteredAnnotations:[]})),ge(V=>V.featureAllowed?this.iamService.isUserAllowed$().pipe(ce(G=>(V.featureAllowed=G,V))):re(V)),ge(V=>V.featureAllowed?re(V).pipe(ge(G=>this.docService.getDocumentPaths$().pipe(ce(X=>(this.documentPaths=X,G.documentPaths=X,G)))),ge(G=>c?.documentIds?.length||A?this.getDataFromDocumentIds({documentIds:A?[A]:c?.documentIds?.map(X=>`${fn(X)}`),organizationId:this.documentPaths?.organizationId,query:c}).pipe(ce(X=>({res:G,data:X}))):this.docService.getDocumentIds$().pipe(ge(X=>{let he=X?.length>0?X.map(Ie=>Ie.documentId):[this.documentPaths?.documentId??""];return this.getDataFromDocumentIds({documentIds:he.length>0?he:[A??""],organizationId:this.documentPaths?.organizationId,query:c}).pipe(ce(Ie=>({res:G,data:Ie})))}))),ge(G=>G?.data?(G.res.annotations=G.data||[],re(G.res).pipe(ge(X=>this.docService.getLocation$().pipe(ce(he=>(X.location=he,X)))),ge(X=>this.docService.getLocations$().pipe(ce(he=>(X.customLocations=he,X)))),ge(X=>this.docService.getExcludedLocationIds$().pipe(ce(he=>(X.excludedLocationIds=he,X)))),ce(X=>{if(X.filteredAnnotations=[],c)return X.filteredAnnotations=X.annotations?.slice(),X;if(A&&!_||p)return X.filteredAnnotations=X.annotations?.slice(),X?.excludedLocationIds?.length&&(X.filteredAnnotations=X.filteredAnnotations?.filter(he=>he?.location?.id?!X.excludedLocationIds.includes(he.location.id):!0)),X;{let he=[],Ie=[];return _?(he.push(_),E&&Ie.push(E)):(he.push(X?.location?.locationId),he.push(...Object.values(X?.customLocations||[]).map(Pe=>Pe.locationId)),X?.location?.location?.id&&Ie.push(X?.location?.location?.id),Ie.push(...Object.values(X?.customLocations||{}).map(Pe=>Pe.location?.id).filter(Pe=>!!Pe))),X.filteredAnnotations=this.filterAnnotationsByLocationIds(X?.annotations,he,Ie),X?.excludedLocationIds?.length&&(X.filteredAnnotations=X.filteredAnnotations?.filter(Pe=>Pe?.location?.id?!X.excludedLocationIds.includes(Pe.location.id):!0)),X}}),ge(X=>this.iamService.isUserAdmin$().pipe(ce(he=>(he||(X.filteredAnnotations=X.filteredAnnotations?.filter(Ie=>Ie?.iam?.accessMode!==Yi.PRIVATE)),X)))),ge(X=>this.draftCommentAnnotationsByAnnotationId$.pipe(ce(he=>(X.filteredAnnotations=X.filteredAnnotations?.filter(Ie=>!Ie.isDraft),he&&X.filteredAnnotations.push(...Object.values(he)),X)))),ge(X=>r?re(X):X?.annotations?.length&&(!this.getPopoverMode()||this.getPopoverTriangleComponent())?this.domService.onWindowResize$().pipe(ce(()=>X)):re(X)),ge(X=>r?re(X):this.addCommentMode$.pipe(ge(he=>he&&!this.getChangeDetectionInCommentMode()?re(X):X?.annotations?.length&&(!this.getPopoverMode()||this.getPopoverTriangleComponent())?this.domService.onDomChange$("CommentService getAllCommentAnnotations").pipe(ce(()=>X)):re(X)))),ce(X=>(s||(!this.getPopoverMode()||this.getPopoverTriangleComponent())&&(X.filteredAnnotations=X.filteredAnnotations?.map(he=>{let Ie=Object.assign({},he);return this.calculateCommentAnnotationPosition(Ie,a),Ie})),X)),ge(X=>X?.annotations?.length?this.viewsService.getCommentFeatureViews$().pipe(ce(he=>(this.updateUnreadAnnotationsMap(X?.annotations,he),X))):re(X)),ge(X=>X?.filteredAnnotations?re(X?.filteredAnnotations||[]):re([])))):re(null))):re(null)),Kt((V,G)=>_o(V,G)))}getAllMultiThreadCommentAnnotations(e,i,r,a,s){this.loggingService.log("%c[WB] Calling FUNCTION: getAllMultiThreadCommentAnnotations","color: green;");let c,p;try{if(e&&(p=fn(e)),i&&typeof i=="object"){let h=Xo(i);c=fn(JSON.stringify(h))}}catch(h){this.loggingService.catch("Error in CommentService getAllMultiThreadCommentAnnotations: ",h)}return Wn(this.afAuth).pipe(Ne(h=>!!h),ge(h=>this.isFeatureAllowed({firebaseUser:h,annotations:[],filteredAnnotations:[]})),ge(h=>h.featureAllowed?this.iamService.isUserAllowed$().pipe(ce(_=>(h.featureAllowed=_,h))):re(h)),ge(h=>h.featureAllowed?re(h).pipe(ge(_=>this.docService.getDocumentPaths$().pipe(ce(E=>(this.documentPaths=E,_.documentPaths=E,_)))),ge(_=>p?this.getMultiThreadDataFromDocumentIds([p]).pipe(ce(E=>({res:_,data:E}))):this.docService.getDocumentIds$().pipe(ge(E=>{let A=E?.length>0?E.map(V=>V.documentId):[this.documentPaths?.documentId??""];return this.getMultiThreadDataFromDocumentIds(A.length>0?A:[`${p}`]).pipe(ce(V=>({res:_,data:V})))}))),ge(({res:_,data:E})=>E?(_.annotations=E||[],re(_).pipe(ge(A=>this.docService.getLocation$().pipe(ce(V=>(A.location=V,A)))),ge(A=>this.docService.getLocations$().pipe(ce(V=>(A.customLocations=V,A)))),ge(A=>this.docService.getExcludedLocationIds$().pipe(ce(V=>(A.excludedLocationIds=V,A)))),ce(A=>{if(A.filteredAnnotations=[],p&&!c)return A.filteredAnnotations=A.annotations?.slice(),A?.excludedLocationIds?.length&&(A.filteredAnnotations=A.filteredAnnotations?.filter(V=>V?.location?.id?!A.excludedLocationIds.includes(V.location.id):!0)),A;{let V=[],G=[];return c?V.push(c):(V.push(A?.location?.locationId),V.push(...Object.values(A?.customLocations||[]).map(X=>X.locationId)),A?.location?.location?.id&&G.push(A?.location?.location?.id),G.push(...Object.values(A?.customLocations||{}).map(X=>X.location?.id).filter(X=>!!X))),A.filteredAnnotations=this.filterAnnotationsByLocationIds(A?.annotations,V,G),A?.excludedLocationIds?.length&&(A.filteredAnnotations=A.filteredAnnotations?.filter(X=>X?.location?.id?!A.excludedLocationIds.includes(X.location.id):!0)),A}}),ge(A=>this.draftMultiThreadCommentAnnotationsByAnnotationId$.pipe(ce(V=>(A.filteredAnnotations=A.filteredAnnotations?.filter(G=>!G.isDraft),V&&A.filteredAnnotations.push(...Object.values(V)),A)))),ge(A=>r?re(A):A?.annotations?.length&&(!this.getPopoverMode()||this.getPopoverTriangleComponent())?this.domService.onWindowResize$().pipe(ce(()=>A)):re(A)),ge(A=>r?re(A):this.addCommentMode$.pipe(ge(V=>V&&!this.getChangeDetectionInCommentMode()?re(A):A?.annotations?.length&&(!this.getPopoverMode()||this.getPopoverTriangleComponent())?this.domService.onDomChange$("CommentService getAllMultiThreadCommentAnnotations").pipe(ce(()=>A)):re(A)))),ce(A=>(s||(!this.getPopoverMode()||this.getPopoverTriangleComponent())&&(A.filteredAnnotations=A.filteredAnnotations?.map(V=>{let G=Object.assign({},V);return this.calculateCommentAnnotationPosition(G,a),G})),A)),ge(A=>A?.filteredAnnotations?re(A?.filteredAnnotations||[]):re([])))):re(null))):re(null)),Kt(_o))}isFeatureAllowed(e){return this.configService.getConfig$().pipe(Ne(i=>!!i),ce(i=>T(I({},e),{config:i})),ge(i=>this.authService.getUser$().pipe(ce(r=>(this.user=r,T(I({},i),{user:r}))))),ge(i=>Zi(i.config,i.user,Re.COMMENT)?re(T(I({},i),{featureAllowed:!0})):(this.loggingService.warn("Comment feature is not allowed."),re(T(I({},i),{featureAllowed:!1})))))}getDataFromDocuments(e){let{documentIds:i,organizationId:r,query:a}=e;if(!this.configService?.getApiKey())return re([]);if(i?.some(A=>!A)||!this.documentPaths)return re([]);let s,c,p,h=[];if(a)a?.folderId&&(s=ul(a?.folderId)),c=a?.allDocuments,a?.locationId&&(h=[...h,a?.locationId]),a?.locationIds?.length&&(h=[...h,...a?.locationIds]),p=a?.statusIds;else{let A=this.docService.getFolderConfig();s=A?.veltFolderId,c=A?.allDocuments,A?.locationId&&(h=[...h,A?.locationId])}let _=re([]),E={useCollectionGroup:!0,isCollection:!0,useQuery:!0};if(this.commonDbService.shouldUseFirestore()||(E.documentId=i?.length?i[0]:void 0,E.organizationId=this.documentPaths?.organizationId),c)_=this.commonDbService.dbListener({feature:"allComments",properties:T(I({},E),{firestoreQuery:[Fi(mt("metadata.apiKey","==",this.configService?.getApiKey()),mt("metadata.organizationId","==",r??this.documentPaths?.organizationId),...s?[mt("metadata.veltFolderId","==",s)]:[],...p?[mt("status.id","in",p)]:[],...h?.length?[mt("location.id","in",h)]:[]),Wa("lastUpdated","desc"),Wa("createdAt","desc")]})});else{let A=[];for(let V=0;V<(i?.length??0);V+=U.LISTENER_BATCH_SIZE)A.push(i?.slice(V,V+U.LISTENER_BATCH_SIZE)??[]);_=Dn(A.map(V=>this.commonDbService.dbListener({feature:"allComments",properties:T(I({},E),{firestoreQuery:[Fi(mt("metadata.apiKey","==",this.configService?.getApiKey()),mt("metadata.organizationId","==",r??this.documentPaths?.organizationId),mt("metadata.documentId","in",V),...p?[mt("status.id","in",p)]:[],...s?[mt("metadata.veltFolderId","==",s)]:[],...h?.length?[mt("location.id","in",h)]:[]),Wa("lastUpdated","desc"),Wa("createdAt","desc")]})}).pipe($r()))).pipe(ce(V=>ca(JSON.parse(JSON.stringify(V)))))}return _.pipe(ge(A=>A?.data?re(A).pipe(ge(V=>this.commonDbUtilsService.mergeLocationMetadataWithData$({data:V,feature:"allComments"}).pipe(ce(G=>({data:Object.values(G?.data||{}).filter(X=>typeof X=="object"),operation:G?.operation})))),ce(({data:V,operation:G})=>{let X=V.reduce((he,Ie)=>{let Pe=Ie.metadata?.documentId;return Pe&&(he[Pe]||(he[Pe]=[]),he[Pe].push(Ie)),he},{});return{data:V,documentMap:X,operation:G}}),ce(({data:V,documentMap:G,operation:X})=>p?{data:V,documentMap:G,operation:X}:(V?.length&&(V?.forEach(he=>{this.sanitizeCommentAnnotation(he)}),this.setAnnotationIndex(V),this.updateAnnotationsForSelectAllContentMode(V),V.forEach(he=>{this.customFilterService.convertLegacyAnnotationStatus(he),this.customFilterService.convertLegacyPriority(he),this.customFilterService.convertLegacyCategory(he)})),{data:V,documentMap:G,operation:X})),Ln(V=>(this.loggingService.catch("Error in CommentService getDataFromDocuments: ",V),re([]))),In(({documentMap:V})=>{p||Object.entries(V??{}).forEach(([G,X])=>{this.setOriginalCommentAnnotationsByAnnotationId(JSON.parse(JSON.stringify(X)))})}),ce(({data:V,documentMap:G,operation:X})=>({data:this.filterUserDraftComments(V),documentMap:G,operation:X})),ce(({data:V,documentMap:G,operation:X})=>({data:this.removeDraftFlags(V),documentMap:G,operation:X})),ge(({data:V,documentMap:G,operation:X})=>p?re({data:V,documentMap:G,operation:X}):this.mergeDraftAnnotations(V).pipe(ce(he=>({data:he,documentMap:G,operation:X})))),ce(({data:V,documentMap:G,operation:X})=>{if(!p)if(X?.type==="removed"){if(X?.ids?.length){let he=this.commentAnnotationById$.value??{};X?.ids?.forEach(Ie=>{delete he?.[Ie]}),this.commentAnnotationById$.next(he)}}else Object.entries(G??{}).length?Object.entries(G??{}).forEach(([Ie,Pe])=>{this.setCommentAnnotationsByOrganizationIdAndDocumentId({organizationId:this.documentPaths?.organizationId,documentId:Ie,annotations:Pe})}):this.commentAnnotationById$.value||this.commentAnnotationById$.next({});return V})):re(null)))}fetchCommentAnnotations(e){return ee(this,null,function*(){try{let i=this.authService.getUser();if(!i)return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),{data:[],hasMore:!1};let r=this.configService?.getApiKey(),a=e?.organizationId??i?.clientOrganizationId,s=hd(a??""),c=[];e?.allDocuments||(c=e?.documentIds?.map(G=>ud(G??""))??this.docService.getDocumentIds()?.map(G=>G.documentId));let p=[];if(p.push(mt("metadata.organizationId","==",s)),p.push(mt("metadata.apiKey","==",r)),e?.folderId){let G=ul(e?.folderId);p.push(mt("metadata.veltFolderId","==",G))}if(e?.locationId&&p.push(mt("location.id","==",e?.locationId)),c?.length&&p.push(mt("metadata.documentId","in",c)),e?.resolvedBy){if(e?.order==="asc")throw new Error("Order by resolvedBy is not supported in ascending order.");p.push(mt("resolvedByUserId","==",e?.resolvedBy))}if(e?.mentionedUserIds?.length){if(e?.order==="asc")throw new Error("Order by mentionedUserIds is not supported in ascending order.");p.push(mt("mentionedUserIds","array-contains-any",e?.mentionedUserIds))}if(e?.userIds?.length){if(e?.order==="asc")throw new Error("Order by userIds is not supported in ascending order.");p.push(mt("from.userId","in",e?.userIds))}if(e?.statusIds?.length){if(e?.order==="asc")throw new Error("Order by status id is not supported in ascending order.");p.push(mt("status.id","in",e?.statusIds))}let h=new Date().getTime();if(e?.createdAfter&&p.push(mt("createdAt",">=",e?.createdAfter)),e?.createdBefore&&p.push(mt("createdAt","<=",e?.createdBefore??h)),e?.updatedAfter&&p.push(mt("lastUpdated",">=",e?.updatedAfter??h)),e?.updatedBefore&&p.push(mt("lastUpdated","<=",e?.updatedBefore??h)),p.push(Wa("lastUpdated",e?.order??"desc"),Wa("createdAt",e?.order??"desc")),e?.pageToken){let G=yield fV(e?.pageToken??"","veltencrypttoken","veltencrypttoken");p.push($ae(parseInt(G,10),"lastUpdated"))}let _=e?.pageSize??100;p.push(Nv(_+1));let E=yield this.commonDbService.queryData({feature:"allComments",properties:{useCollectionGroup:!0,isCollection:!0,useQuery:!0,firestoreQuery:p,apiKey:r??"",organizationId:s}}),A=E.length>_;E=E.slice(0,_);let V=E?.reduce((G,X)=>(G[X?.annotationId]=X,G),{});return V=yield this.commonDbUtilsService.formatResponse({feature:"allComments",data:V,shouldAwait:!0}),V=this.commonDbUtilsService.mergeUsersWithData({feature:"allComments",data:V}),{data:Object.values(V??{}),hasMore:A}}catch(i){throw this.loggingService.catch("Error in CommentService fetchCommentAnnotations:",i),i}})}filterUserDraftComments(e){let i=this.authService.getUser();return e.filter(r=>(r.comments=r?.comments?.filter(a=>a?.from?.userId===i?.userId||!a?.isDraft),!!r?.comments?.length))}removeDraftFlags(e){return e.forEach(i=>delete i.isDraft),e}mergeDraftAnnotations(e){return this.draftCommentAnnotationsByAnnotationId$.pipe(ce(i=>{let r=i||{};return e?.filter(a=>{r?.[a?.annotationId]&&delete r[a?.annotationId]}),r}),ce(i=>{if(i){let r=e.slice();return r.push(...Object.values(i)),r}return e}))}getDataFromDocumentIds({documentIds:e,organizationId:i,query:r}){return this.getDataFromDocuments({documentIds:e,organizationId:i,query:r})}getMultiThreadDataFromDocumentIds(e){return this.getMultiThreadDataFromDocuments({documentIds:e})}getMultiThreadDataFromDocuments(e){if(this.configService?.getApiKey()){let{documentIds:i}=e;if(i?.some(c=>!c)||!this.documentPaths)return re([]);let r=this.docService.getFolderConfig(),a=re([]),s={useCollectionGroup:!0,isCollection:!0,useQuery:!0};if(this.commonDbService.shouldUseFirestore()||(s.documentId=i?.length?i[0]:void 0,s.organizationId=this.documentPaths?.organizationId),r?.veltFolderId&&r?.allDocuments)a=this.commonDbService.dbListener({feature:"allMultiThreads",properties:T(I({},s),{firestoreQuery:[Fi(mt("metadata.apiKey","==",this.configService?.getApiKey()),mt("metadata.organizationId","==",this.documentPaths?.organizationId),mt("metadata.veltFolderId","==",r?.veltFolderId))]})});else{let c=[];for(let p=0;p<(i?.length??0);p+=U.LISTENER_BATCH_SIZE)c.push(i?.slice(p,p+U.LISTENER_BATCH_SIZE)??[]);a=Dn(c.map(p=>this.commonDbService.dbListener({feature:"allMultiThreads",properties:T(I({},s),{firestoreQuery:[Fi(mt("metadata.apiKey","==",this.configService?.getApiKey()),mt("metadata.organizationId","==",this.documentPaths?.organizationId),mt("metadata.documentId","in",p),...r?.veltFolderId?[mt("metadata.veltFolderId","==",r?.veltFolderId)]:[])]})}).pipe($r()))).pipe(ce(p=>ca(p)))}return a.pipe(ge(c=>c?.data?re(c).pipe(ce(p=>({data:p?.data,operation:p?.operation})),ce(({data:p,operation:h})=>{let _=[];return p&&(_=Object.values(p??{}).filter(E=>typeof E=="object")),{data:_,operation:h}}),Ln(p=>(this.loggingService.catch("Error in CommentService getMultiThreadDataFromDocumentId: ",p),re({data:[],operation:null}))),ce(({data:p,operation:h})=>{p.forEach(E=>{delete E.isDraft});let _=p.reduce((E,A)=>{let V=A.metadata?.documentId;return V&&(E[V]||(E[V]=[]),E[V].push(A)),E},{});return{data:p,documentMap:_,operation:h}}),ge(({data:p,documentMap:h,operation:_})=>{let E=[];return this.commentAnnotationById$.pipe(ge(()=>this.domService.getSelectedAnnotationsMap$().pipe(ce(A=>({selectedAnnotationsMap:A})))),ce(({selectedAnnotationsMap:A})=>{let V={};return Object.keys(h??{}).forEach(G=>{let X=this.getCommentAnnotationsByOrganizationIdAndDocumentId({organizationId:this.documentPaths?.organizationId,documentId:G});X&&X?.forEach(he=>{V[he?.annotationId]=he})}),E=p.filter(G=>{let X=!1;if(G?.commentAnnotations){for(let he in G?.commentAnnotations)if(V?.[he]&&V?.[he]?.status?.id!==this.customFilterService.resolvedStatus.id){X=!0;break}}return X}),E.forEach(G=>{Object.keys(G?.commentAnnotations||{}).forEach(X=>{G.commentAnnotationsMap||(G.commentAnnotationsMap={}),G.commentAnnotationsMap[X]=V?.[X]})}),{data:E,operation:_}}))}),ge(({data:p,operation:h})=>this.draftMultiThreadCommentAnnotationsByAnnotationId$.pipe(ce(_=>{let E=_||{};return p?.filter(A=>{E?.[A?.annotationId]&&delete E[A?.annotationId]}),E}),ce(_=>{if(_){let E=p.slice();return E.push(...Object.values(_)),{data:E,operation:h}}return{data:p,operation:h}}))),ce(({data:p,operation:h})=>{let _=p.reduce((E,A)=>{let V=A.metadata?.documentId;return V&&(E[V]||(E[V]=[]),E[V].push(A)),E},{});if(h?.type==="removed"){if(h?.ids?.length){let E=this.multiThreadCommentAnnotationById$.value;h?.ids?.forEach(A=>{delete E?.[A]}),this.multiThreadCommentAnnotationById$.next(E)}}else Object.keys(_??{}).forEach(E=>{this.setMultiThreadCommentAnnotationsByOrganizationIdAndDocumentId({organizationId:this.documentPaths?.organizationId,documentId:E,annotations:_[E]})});return p})):re(null)))}else return re([])}updateUnreadAnnotationsMap(e,i){try{let r=new Date(U.UNREAD_COMMENTS_CHECK_FROM_DATE)?.getTime(),a=e.filter(s=>s?.lastUpdated>r);if(i){let s={},c=!1;a.forEach(p=>{let h=0,_=i?.[p?.annotationId];if(_){let E=_?.comments;E&&p?.comments?.forEach(A=>{!E?.[A?.commentId]?.views?.[this.user?.userSnippylyId]&&this.user?.userSnippylyId!==A?.from?.userSnippylyId&&h++})}h?h!==s?.[p?.annotationId]&&(s[p?.annotationId]=h,c=!0):s?.[p?.annotationId]&&(delete s[p?.annotationId],c=!0)}),this.unreadCommentsMap$.next(s)}}catch(r){this.loggingService.catch("Error in CommentService updateUnreadAnnotationsMap:",r)}}updateAnnotationsForSelectAllContentMode(e){try{e.forEach(i=>{if(i?.selectAllContent&&i?.targetElementId){let r=cr(i.targetElementId,["id","data-id"]);if(r){let a=r.textContent;a&&(i.targetTextRange={commonAncestorContainer:this.domService.getXPath(r),text:a,occurrence:1},delete i?.targetElement)}}})}catch(i){this.loggingService.catch("Error in CommentService updateAnnotationsForSelectAllContentMode:",i)}}setCommentAnnotationsByOrganizationIdAndDocumentId({organizationId:e,documentId:i,annotations:r,queryHash:a}){try{if(i){e||(e=U.NO_ORGANIZATION_ID),a||(a=U.DEFAULT_QUERY_HASH);let s={};r?.forEach(p=>{p?.annotationId&&(s[p?.annotationId]=p)});let c=I(I({},this.commentAnnotationById$.value??{}),s);this.commentAnnotationById$.next(c)}}catch(s){this.loggingService.catch("Error in CommentService setCommentAnnotationsByOrganizationIdAndDocumentId:",s)}}getCommentAnnotationsByOrganizationIdAndDocumentId$({organizationId:e,documentId:i}){try{return this.commentAnnotationById$.pipe(ce(()=>this.getCommentAnnotationsByOrganizationIdAndDocumentId({organizationId:e,documentId:i})))}catch(r){return this.loggingService.catch("Error in CommentService getCommentAnnotationsByOrganizationIdAndDocumentId$:",r),re([])}}getCommentAnnotationsByOrganizationIdAndDocumentId({organizationId:e,documentId:i}){try{let r=null;this.commentAnnotationById$.value&&(r={},Object.values(this.commentAnnotationById$.value).forEach(s=>{s?.metadata?.documentId==i&&s?.metadata?.organizationId==e&&(r[s?.annotationId]=s)}));let a=this.draftCommentAnnotationsByAnnotationId$.value;return a&&(r===null&&(r={}),Object.values(a).forEach(s=>{s?.metadata?.documentId===i&&s?.metadata?.organizationId===e&&!r[s?.annotationId]&&(r[s?.annotationId]=s)})),r?Object.values(r):null}catch(r){return this.loggingService.catch("Error in CommentService getCommentAnnotationsByOrganizationIdAndDocumentId:",r),[]}}getCommentAnnotationsOnCurrentOrganizationAndDocument$(){return this.docService.getDocumentPaths$().pipe(ge(e=>e?.documentId?this.getCommentAnnotationsByOrganizationIdAndDocumentId$({organizationId:e.organizationId,documentId:e.documentId}):re([])))}getCommentAnnotationsOnCurrentOrganizationAndDocument(){try{let e=this.docService.getDocumentPaths();return e?.documentId?this.getCommentAnnotationsByOrganizationIdAndDocumentId({organizationId:e?.organizationId,documentId:e?.documentId}):[]}catch(e){return this.loggingService.catch("Error in CommentService getCommentAnnotationsOnCurrentOrganizationAndDocument:",e),[]}}setOriginalCommentAnnotationsByAnnotationId(e){try{let i={};e?.forEach(r=>{r?.annotationId&&(i[r?.annotationId]=r)}),this.originalCommentAnnotationsByDocumentId$.next(I(I({},this.originalCommentAnnotationsByDocumentId$.value),i))}catch(i){this.loggingService.catch("Error in CommentService setOriginalCommentAnnotationsByAnnotationId:",i)}}setMultiThreadCommentAnnotationsByOrganizationIdAndDocumentId({organizationId:e,documentId:i,annotations:r,queryHash:a}){try{if(i){e||(e=U.NO_ORGANIZATION_ID),a||(a=U.DEFAULT_QUERY_HASH);let s={};r.forEach(p=>{p?.annotationId&&(s[p?.annotationId]=p)});let c=I(I({},this.multiThreadCommentAnnotationById$.value),s);this.multiThreadCommentAnnotationById$.next(c)}}catch(s){this.loggingService.catch("Error in CommentService setMultiThreadCommentAnnotationsByOrganizationIdAndDocumentId:",s)}}getMultiThreadCommentAnnotationsByOrganizationIdAndDocumentId$({organizationId:e,documentId:i}){return this.multiThreadCommentAnnotationById$.pipe(ce(()=>this.getMultiThreadCommentAnnotationsByOrganizationIdAndDocumentId({organizationId:e,documentId:i})))}getMultiThreadCommentAnnotationsByOrganizationIdAndDocumentId({organizationId:e,documentId:i}){try{let r={};Object.values(this.multiThreadCommentAnnotationById$.value??{}).forEach(s=>{s?.metadata?.documentId==i&&s?.metadata?.organizationId==e&&(r[s?.annotationId]=s)});let a=this.draftMultiThreadCommentAnnotationsByAnnotationId$.value;return a&&Object.values(a??{}).forEach(s=>{s?.metadata?.documentId===i&&s?.metadata?.organizationId===e&&!r[s?.annotationId]&&(r[s?.annotationId]=s)}),Object.values(r)}catch(r){return this.loggingService.catch("Error in CommentService getMultiThreadCommentAnnotationsByOrganizationIdAndDocumentId:",r),[]}}getMultiThreadCommentAnnotationsOnCurrentOrganizationAndDocument$(){return this.docService.getDocumentPaths$().pipe(ge(e=>e?.documentId?this.getMultiThreadCommentAnnotationsByOrganizationIdAndDocumentId$({organizationId:e.organizationId,documentId:e.documentId}):re([])))}getMultiThreadCommentAnnotationsOnCurrentOrganizationAndDocument(){try{let e=this.docService.getDocumentPaths();return this.getMultiThreadCommentAnnotationsByOrganizationIdAndDocumentId({organizationId:e?.organizationId,documentId:e?.documentId})}catch(e){return this.loggingService.catch("Error in CommentService getMultiThreadCommentAnnotationsOnCurrentOrganizationAndDocument:",e),[]}}getLocations$(){return this.docService.getLocation$().pipe(ge(e=>this.docService.getLocations$().pipe(ce(i=>({location:e,locations:i})))),ce(e=>{let i=[];return i.push(e?.location?.locationId),i.push(...Object.values(e.locations||[]).map(r=>r.locationId)),i||[]}))}filterAnnotationsByLocationIds(e,i,r){try{return e.filter(a=>i.includes(a.locationId)||r?.includes(a?.location?.id)||i?.find(s=>s==a?.location?.id)||r?.find(s=>s==a?.locationId+""))}catch(a){return this.loggingService.catch("Error in CommentService filterAnnotationsByLocations:",a),[]}}setAnnotationIndex(e){try{e.forEach((i,r)=>{i?.annotationId&&(i.annotationIndex=r+1)})}catch(i){this.loggingService.catch("Error in CommentService setAnnotationIndex:",i)}}calculateCommentAnnotationPosition(e,i){try{if(e.multiThreadAnnotationId)return;if(e.targetElementId){let r=cr(e.targetElementId,["id","data-id"]);if(r&&this.domService.isElementVisible(r)){let a=r.getAttribute(U.ATTRIBUTES.VELT_COMMENT_TYPE),s=!0;if(a)switch(a){case"popover":s=!0;break;default:s=!1;break}else{let c=document.querySelector(`${U.TAGS.VELT_INLINE_COMMENTS_SECTION}[${U.ATTRIBUTES.TARGET_INLINE_COMMENT_ELEMENT_ID}="${e.targetElementId}"], ${U.TAGS.VELT_INLINE_COMMENTS_SECTION}[${U.ATTRIBUTES.TARGET_COMMENT_ELEMENT_ID}="${e.targetElementId}"], ${U.TAGS.VELT_INLINE_COMMENTS_SECTION}[${U.ATTRIBUTES.TARGET_ELEMENT_ID}="${e.targetElementId}"]`);c&&r?.contains(c)&&(s=!1)}s?e.targetElement={xpath:this.domService.getXPath(r),fXpath:this.domService.getXPath(r,!0),cfXpath:this.domService.getXPath(r,!0,!0),topPercentage:e.targetElement?.topPercentage||50,leftPercentage:e.targetElement?.leftPercentage||90}:e.targetElement=null}else e.targetElement=null}if(e.targetElement){e.position=null,e.ghostComment=null;let r=e.targetElement?.xpath;if(r){let a=this.domService.getElementFromXPath(r);this.domService.isXpathWithId(r)||((!a||!this.domService.isElementVisible(a))&&e.targetElement?.cfXpath&&(r=e.targetElement?.cfXpath,a=this.domService.getElementFromXPath(r)),this.getDetectionStrategy()===jO.DYNAMIC_ID&&(!a||!this.domService.isElementVisible(a))&&(r=e.targetElement?.fXpath,r&&(a=this.domService.getElementFromXPath(r)))),(!a||!this.domService.isElementVisible(a))&&i&&(e.ghostComment={},this.setGhostCommentMessage(e),e.ghostComment.targetElement=this.getGhostCommentTargetElement(e),e?.ghostComment?.targetElement?.xpath&&(a=this.domService.getElementFromXPath(e?.ghostComment?.targetElement?.xpath)));let c=!1;if(e?.locationId){let p=this.docService.getLocation();if(!Ou({location:p?.location,locationId:p?.locationId},{location:e?.location,locationId:e?.locationId})){let h=this.docService.getAdditionLocationFromElement(a),_=h?this.docService.genarateLocationId(h):void 0;e?.location?.id&&e?.location?.id===h?.id||_&&_===e?.locationId?c=!1:c=!0}}if(c&&(e.ghostComment=null),!c&&a&&xo(a)&&!a?.closest(".cdk-overlay-container")&&a?.getBoundingClientRect()){let h=this.popoverMode$?.value?0:e.targetElement?.topPercentage,_=this.popoverMode$?.value?100:e.targetElement?.leftPercentage,{height:E,width:A}=Ep(a);e.position={top:E*(h||0)/100,left:A*(_||0)/100};let V=window.getComputedStyle(a).transform;if(V&&V!=="none")try{let G=new DOMMatrixReadOnly(V),X=Math.sqrt(G.a*G.a+G.b*G.b)||1,he=Math.sqrt(G.c*G.c+G.d*G.d)||1;(Math.abs(X-1)>.01||Math.abs(he-1)>.01)&&(e.position.parentScaleX=X,e.position.parentScaleY=he)}catch{}if(this.transformContext$.value){let{containerSelector:G,transforms:X}=this.transformContext$.value,he=document.querySelector(G);he&&he.contains(a)&&(e.position.transformContext=X)}}!c&&i&&!e?.position&&!e?.ghostComment&&(e.ghostComment={},this.setGhostCommentMessage(e),e.ghostComment.targetElement=e.targetElement)}}i&&(e.ghostComment?this.addAnnotationToGhostCommentAnnotationMap(e):this.removeAnnotationFromGhostCommentAnnotationMap(e))}catch(r){this.loggingService.catch("Error in CommentService calculateCommentAnnotationPosition:",r)}}addComment(e,i,r,a,s,c=[],p,h,_,E,A,V,G,X,he,Ie,Pe,Be){this.loggingService.log("%c[WB] Calling FUNCTION: addComment","color: green;");try{let We=this.authService.getUser();if(We)if(We.isReadOnly||We.isAnonymous)this.loggingService.catch("Anonymous/Readonly users cannot add comments.");else{let ke=new ko;Pe&&(ke=I(I({},ke),Pe)),ke.comments=[],Pe?.comments?.length&&(ke.comments=Pe.comments.map(Ut=>{let Gt=new pc;return Gt=I(I({},Gt),Ut),Gt.from=We,Gt.lastUpdated=new Date,Gt.createdAt=this.timestamp,Gt})),ke.from=We,ke.color=ke?.color||U.DEFAULT_ANNOTATION_COLOR,ke.lastUpdated=this.timestamp,ke.createdAt=this.timestamp,ke.sourceId=he,ke.assignedTo=Pe?.assignedTo||Ie,ke.customList=Pe?.customList||[];let{topPositionX:we,topPositionY:Ee}=this.domService.getTopLeftPosition();ke.positionX=we,ke.positionY=Ee;let Me=this.domService.getCurrentWindowSizeValue();if(ke.screenWidth=Me.screenWidth,ke.screenHeight=Me.screenHeight,ke.screenScrollHeight=Me.screenScrollHeight,ke.taggedElementPath="",e&&(ke.targetElement=this.domService.getTargetElementForCursorPosition(e,!0,!0,!0,Ut=>{if(this.getSvgAsImg()){let Gt=Ut?.closest(`[${U.ATTRIBUTES.VELT_COMMENT_CONTAINER}]`);Gt&&Gt instanceof HTMLElement&&(Ut=Gt)}if(this.getPopoverMode()){let Gt=Ut?.closest(`[${U.ATTRIBUTES.VELT_TARGET_COMMENT_ELEMENT_ID}]`);if(Gt&&Gt instanceof HTMLElement)return Gt}return Ut}),this.getCommentToNearestAllowedElement()&&ke.targetElement?.xpath)){let Ut=this.domService.getElementFromXPath(ke.targetElement.xpath);if(Ut&&!this.isElementInsideAllowedElements(Ut)){let Gt=this.getNearestAllowedElement(Ut);if(Gt)ke.targetElement.xpath=this.domService.getXPath(Gt),ke.targetElement.fXpath=this.domService.getXPath(Gt,!0),ke.targetElement.cfXpath=this.domService.getXPath(Gt,!0,!0);else return}}if(i&&(ke.targetTextRange=i),ke?.targetElement?.xpath){let Ut=this.domService.getXPath(ke.targetElement.xpath);if(Ut){let Gt=Ut.iterateNext();Gt&&(xo(Gt)||(ke.targetElement=null))}}this.customFilterService.defaultStatus&&!Pe?.status&&(ke.status=this.customFilterService.defaultStatus),ke.pageInfo=_i(),ke.pageInfo&&(ke.pageInfo.screenWidth=this.domService.getCurrentWindowSizeValue()?.screenWidth);let Ce=this.docService.getClientDocumentId(),ue=this.docService.getLocation()?.location;if(this.commentContextProvider!==null){let Ut=this.commentContextProvider(Ce,ue);Ut&&(ke.context=Ut)}if(a){ke.sourceId=a?.sourceId;let Ut=a?.targetElement,Gt=a?.commentData;if(Ut?.targetText)ke.targetTextRange={commonAncestorContainer:"/html/body",text:Ut.targetText,occurrence:Ut?.occurrence||1};else if(Ut?.elementId)if(ke.targetElementId=Ut.elementId,Ut?.selectAllContent)ke.selectAllContent=!!Ut?.selectAllContent;else{let It=cr(Ut.elementId,["id","data-id"]);It?ke.targetElement={xpath:this.domService.getXPath(It),fXpath:this.domService.getXPath(It,!0),cfXpath:this.domService.getXPath(It,!0,!0),topPercentage:50,leftPercentage:90}:ke.targetElement={xpath:"/html/body",fXpath:"/html/body",cfXpath:"/html/body",topPercentage:50,leftPercentage:90}}a?.status&&(ke.status=a.status),a?.context&&(ke.context=a.context),ke.comments||(ke.comments=[]);let Dt=this.authService.getUser();Gt?.forEach(It=>{let Nt=new pc;Nt.commentText=It.commentText,Nt.commentHtml=It.commentHtml,Nt.replaceContentHtml=It.replaceContentHtml,Nt.replaceContentText=It.replaceContentText,Nt.from=Dt,ke.comments.push(Nt)})}if(s&&(ke.isPageAnnotation=!0),c?.length&&(ke.comments=c),p&&(ke.commentType="chart",ke.metadata=p),_?.sourceId&&(ke.sourceId=_.sourceId),ke?.targetElement?.xpath&&!_){let Ut=this.domService.getElementFromXPath(ke.targetElement.xpath);Ut&&(_=this.getInlineCommentSectionConfig(Ut))}_?.targetInlineCommentElementId&&(ke.targetInlineCommentElementId=_?.targetInlineCommentElementId,ke.targetElementId=_.targetInlineCommentElementId,_?.config?.id&&(ke.inlineCommentSectionConfig=_?.config));let Le=!ke?.comments?.length,Se=a?.openComment===!1;this.getPrivateCommentMode()&&(ke?.iam||(ke.iam=new RS),ke.iam.accessMode=Yi.PRIVATE),E&&(ke.context=E.context,ke.commentType="manual",delete ke.targetElement),A&&(ke.targetElementId=A.targetElementId,ke.targetElement=A.targetElement),this.saveCommentToDb(ke,r,Le,Se,h,V,G,Be,X)}}catch(We){this.loggingService.catch("Error in CommentService addComment: ",We)}}setLocationToCommentAnnotation(e){try{let i=this.docService.getLocation();i?(e.locationId=i.locationId,e.location=i.location):(delete e.locationId,delete e.location);try{let r;e.targetElement?.xpath?r=this.domService.getElementFromXPath(e.targetElement.xpath):e.targetElementId?r=cr(e.targetElementId,["id","data-id"]):e.targetTextRange?.commonAncestorContainer&&(r=this.domService.getElementFromXPath(e.targetTextRange.commonAncestorContainer));let a=this.docService.getAdditionLocationFromElement(r);if(a){let s=this.docService.addLocation(a);s&&(e.locationId=s.locationId,e.location=s.location)}}catch{}}catch(i){this.loggingService.catch("Error in CommentService setLocationToCommentAnnotation:",i)}}getElementForCommentAnnotation(e){try{let i;return e.targetElement?.xpath?i=this.domService.getElementFromXPath(e.targetElement.xpath):e.targetElementId?i=cr(e.targetElementId,["id","data-id"]):e.targetTextRange?.commonAncestorContainer&&(i=this.domService.getElementFromXPath(e.targetTextRange.commonAncestorContainer)),i}catch(i){return this.loggingService.catch("Error in CommentService getElementForCommentAnnotation: ",i),null}}saveCommentToDb(e,i,r=!1,a=!1,s,c,p,h,_){this.loggingService.log("%c[WB] Calling FUNCTION: saveCommentToDb","color: green;");try{this.authService.getUser()&&this.authService.isFeatureAllowed(Re.COMMENT)&&this.docService.getDocumentPaths$().pipe(Ne(E=>!!E),Je(1),ge(E=>(this.documentPaths=E,this.loggingService.log(this.documentPaths),this.databaseService.getDb().pipe(Ne(A=>!!A),Je(1),ge(A=>ee(this,null,function*(){if(this.db=A,this.loggingService.log(this.db),this.documentPaths?.comment){let V=on(this.db,`${this.documentPaths?.comment}`);e.annotationId=this.commonDbService.generateDocumentId();let G=this.docService.getClientDocumentId(),X=this.docService.getLocation()?.location;if(p)e.multiThreadAnnotationId=p;else if(this.getMultiThread()){let we=om();e.targetElementId&&(we=om(e.targetElementId),e?.location?.id?we=om([e?.location?.id,e.targetElementId]):e?.locationId&&(we=om([e?.locationId+"",e.targetElementId]))),e.multiThreadAnnotationId=we}let he={addContext:we=>{this.analyticsService.trackEvent(Z.Events.Comments.COMMENT_ADD_CONTEXT_TRIGGERED,{annotationId:e.annotationId,commentType:this.getCommentType(e),commentMode:this.getCommentMode(),context:we}),e.context=we,we?.commentType==="manual"&&(e.commentType="manual",delete e.targetElement),e?.annotationId&&this.updateCommentAnnotationContext(e.annotationId,we)},documentId:G,location:X,annotation:$n(e),targetAnnotationId:e?.annotationId,targetCommentId:e?.comments?.length?e?.comments[0]?.commentId:void 0};e?.targetElement?.xpath?he.elementRef={xpath:e.targetElement.xpath}:he.elementRef=void 0,this.commentAddedEmitter!==null&&"emit"in this.commentAddedEmitter&&this.commentAddedEmitter.emit(he),this.commentAdded$.next(he),_&&_(he);let Ie=yield this.commentActionsService?.getAddCommentAnnotationEventFromCommentAddEventData(he);Ie&&this.commentActionsService?.triggerAddCommentAnnotationEvent(Ie),this.setLocationToCommentAnnotation(e);let Pe=this.getElementForCommentAnnotation(e),Be=this.docService.getBaseMetadata("comment",{element:Pe,multiThreadAnnotationId:e.multiThreadAnnotationId});if(!Be?.apiKey)return;if(e?.metadata||(e.metadata={}),e.metadata=I(I({},e.metadata),Be),s&&typeof s=="object"&&(e.locationId=h||this.docService.genarateLocationId(s),e.location=s,this.docService.addLocation(s)),r)window.localStorage.setItem(U.LOCAL_STORAGE.SNIPPYLY_QUEUED_COMMENT,JSON.stringify(e));else{let we=window.localStorage.getItem(U.LOCAL_STORAGE.SNIPPYLY_QUEUED_COMMENT);we&&JSON.parse(we).annotationId===e.annotationId&&e.comments!==void 0&&e.comments.length>0&&window.localStorage.removeItem(U.LOCAL_STORAGE.SNIPPYLY_QUEUED_COMMENT)}e.pageInfo&&(e.pageInfo.commentUrl=this.generateCommentUrl(e));let We=e.comments,ke=JSON.parse(JSON.stringify(e));if(ke.position=null,i){ke.targetElement=null,ke.targetTextRange=null;let we={annotationId:e.multiThreadAnnotationId?e.multiThreadAnnotationId:e.annotationId,type:e.multiThreadAnnotationId?Re.MULTI_THREAD:Re.COMMENT},Ee=yield this.areaService.generateAreaAnnotationId();ke.areaAnnotationId=Ee;let Me=this.areaService.addArea(void 0,i,we,Ee,{locationId:ke.locationId,location:ke.location});Me&&(ke.metadata=I(I({},ke.metadata),Me?.metadata||{}))}!a&&!ke?.targetInlineCommentElementId&&!ke?.isPageAnnotation&&this.domService.toggleAnnotationSelection(ke,c),e.targetTextRange&&sessionStorage.setItem(U.SESSION_STORAGE.SNIPPYLY_AUTO_SELECT_ANNOTATION_ID,e?.multiThreadAnnotationId?e?.multiThreadAnnotationId:e.annotationId),this.analyticsService.trackEvent(Z.Events.Comments.COMMENT_DRAFT_ADDED,{annotationId:e.annotationId,commentType:this.getCommentType(ke),commentMode:this.getCommentMode()}),ke?.comments?.length?ke.comments=[]:ke.isDraft=!0,ke?.multiThreadAnnotationId&&this.saveMultiThreadCommentAnnotation(ke),We?.length?this.saveComment(ke,{type:jt.NEWLY_ADDED,updatedComment:We[0]}):this.draftCommentAnnotationsByAnnotationId$.next(T(I({},this.draftCommentAnnotationsByAnnotationId$.value),{[e.annotationId]:ke}))}})))))).subscribe(()=>{},E=>{this.loggingService.catch("Error in CommentService saveCommentToDb subscription: ",E)})}catch(E){this.loggingService.catch("Error in CommentService saveCommentToDb: ",E)}}saveMultiThreadCommentAnnotation(e){return ee(this,null,function*(){try{if(e?.multiThreadAnnotationId){let i=this.docService.getDocumentPaths();if(this.db&&i?.multiThread){let r={annotationId:e.multiThreadAnnotationId,targetElement:e.targetElement,targetElementId:e.targetElementId,targetInlineCommentElementId:e.targetInlineCommentElementId,inlineCommentSectionConfig:e.inlineCommentSectionConfig,areaAnnotationId:e.areaAnnotationId,targetTextRange:e.targetTextRange,from:e.from,locationId:e.locationId,location:e.location,sourceId:e.sourceId,type:"multiThread",metadata:e.metadata};delete e?.targetElement,delete e?.areaAnnotationId,delete e?.targetTextRange;let a=this.getMultiThreadCommentAnnotationsByOrganizationIdAndDocumentId({organizationId:i?.organizationId,documentId:i?.documentId})?.find(s=>s.annotationId===e.multiThreadAnnotationId);if(a||(a=yield this.commonDbService?.getData({feature:"multiThread",properties:{documentId:i?.documentId??"",organizationId:i?.organizationId??"",id:e.multiThreadAnnotationId}})),a&&(a=JSON.parse(JSON.stringify(a)),delete a.from,r=I(I({},a),r)),r?.commentAnnotations||(r.commentAnnotations={}),r.commentAnnotations[e.annotationId]=!0,e?.isDraft)this.draftMultiThreadCommentAnnotationsByAnnotationId$.next(T(I({},this.draftMultiThreadCommentAnnotationsByAnnotationId$.value),{[r.annotationId]:T(I({},r),{isDraft:!0})}));else{let c=this.draftMultiThreadCommentAnnotationsByAnnotationId$.value[r.annotationId];if(c&&(r=I(I({},r),c)),delete r.isDraft,r.commentAnnotationsMap={},!r?.metadata?.documentId){r?.metadata||(r.metadata={});let _=this.docService.getBaseMetadata();r.metadata=I(I({},r?.metadata),_)}let{documentId:p,organizationId:h}=r?.metadata||{};yield this.commonDbService.updateData({feature:"multiThread",properties:{id:r.annotationId,documentId:p,organizationId:h},data:JSON.parse(JSON.stringify(r)),callback:()=>{let _=this.draftMultiThreadCommentAnnotationsByAnnotationId$.value;_[e.annotationId]&&(delete _[e.annotationId],this.draftMultiThreadCommentAnnotationsByAnnotationId$.next(_))}})}return r}}return null}catch(i){return this.loggingService.catch("Error in CommentService saveMultiThreadCommentAnnotation: ",i),null}})}setCommentCategory(e){return ee(this,null,function*(){try{if(e?.comments?.length){let i=e.comments[0].commentText?.trim();if(i){let r=yield this.getCommentCategory(i).toPromise();if(r){let a=this.docService.getDocumentPaths();if(a?.comment&&e?.annotationId){let s=this.getCommentAnnotationsOnCurrentOrganizationAndDocument()?.find(c=>c.annotationId===e.annotationId);if(s||(s=yield this.commonDbService?.getData({feature:"comment",properties:{documentId:a?.documentId??"",organizationId:a?.organizationId??"",id:e.annotationId}})),s?.annotationId){let c=s;c.commentCategories=[r];let{documentId:p,organizationId:h}=this.getDocumentIdAndOrganizationIdFromCommentAnnotation(c);yield this.commonDbService.updateData({feature:"comment",properties:{id:e.annotationId,documentId:p,organizationId:h},data:JSON.parse(JSON.stringify(c))})}}}}}}catch(i){this.loggingService.catch("Error in CommentService setCommentCategory: ",i)}})}getCommentCategory(e){try{let i=Cr(this.functions,Zn.cloudFunction.chatgptCompletion,{timeout:12e5}),a=[{role:"system",content:`Identify category of this sentence from these categories, ${Object.keys(this.customCategoryMap)?.join(", ")}:`},{role:"user",content:e}];return bo(i({messages:a,apiKey:this.configService.getApiKey(),sdkVersion:Ta(),sdkType:this.configService.getSdkType(),numResponse:1})).pipe(ce(s=>{if(s?.data){let c=s.data,p=c?.length?c[0]?.content?.trim():void 0;return p&&Object.keys(this.customCategoryMap).includes(p)?this.customCategoryMap[p]:void 0}else return}))}catch(i){return this.loggingService.catch("Error in CommentService getCommentCategory: ",i),re(void 0)}}updateCommentAnnotationContext(e,i,r){return ee(this,null,function*(){try{this.analyticsService.trackEvent(Z.Events.Comments.COMMENT_UPDATE_CONTEXT_TRIGGERED,{annotationId:e,context:i,merge:r?.merge});let a=this.authService.getUser(),s=this.docService.getDocumentPaths();if(a&&s?.comment&&e){let c=this.getCommentAnnotationsOnCurrentOrganizationAndDocument()?.find(p=>p.annotationId===e);if(typeof c=="object"&&(c=JSON.parse(JSON.stringify(c))),c||(c=yield this.commonDbService?.getData({feature:"comment",properties:{documentId:s?.documentId??"",organizationId:s?.organizationId??"",id:e}})),c?.annotationId){let p=i,h=JSON.parse(JSON.stringify(c.context||{}));r?.merge&&(p=I(I({},h),i));let _={context:JSON.parse(JSON.stringify(p||{}))};if(_?.context?.commentType==="manual"&&(_.commentType="manual",_.targetElement=null),c.context=_.context,Co(h,p))return Promise.resolve("Comment annotation context is already updated.");{let{documentId:E,organizationId:A}=this.getDocumentIdAndOrganizationIdFromCommentAnnotation(c);return this.commonDbService.updateData({feature:"comment",properties:{id:e,documentId:E,organizationId:A},data:JSON.parse(JSON.stringify(c)),callback:()=>{this.analyticsService.trackEvent(Z.Events.Comments.COMMENT_UPDATE_CONTEXT_SUCCESS,{annotationId:e,context:_?.context,merge:r?.merge})}})}}else return this.analyticsService.trackEvent(Z.Events.Comments.COMMENT_UPDATE_CONTEXT_FAILED,{annotationId:e,context:i,merge:r?.merge,error:"Comment annotation not found in database."}),Promise.resolve("Comment annotation not found in database.")}}catch(a){return this.loggingService.catch("Error in CommentService updateCommentAnnotationContext: ",a),Promise.resolve("Error in CommentService updateCommentAnnotationContext.")}})}updateComment(e,i,r,a,s){this.loggingService.log("%c[WB] Calling FUNCTION: updateComment","color: green;");try{if(this.authService.getUser()&&this.authService.isFeatureAllowed(Re.COMMENT)){if(i&&this.setLocationToCommentAnnotation(e),e?.targetElement?.xpath){let c=this.domService.getXPath(e.targetElement.xpath);if(c){let p=c.iterateNext();p&&(xo(p)||(e.targetElement=null))}}if(e?.type==="multiThread"){let c=JSON.parse(JSON.stringify(e));if(c.position=null,c.ghostComment=null,!c?.metadata?.documentId){c?.metadata||(c.metadata={});let _=this.docService.getBaseMetadata();c.metadata=I(I({},c?.metadata),_)}let{documentId:p,organizationId:h}=c?.metadata||{};r?this.commonDbService.updateData({feature:"multiThread",properties:{id:c.annotationId,documentId:p,organizationId:h},data:JSON.parse(JSON.stringify(c))}):this.commonDbService.setData({feature:"multiThread",properties:{id:c.annotationId,documentId:p,organizationId:h},data:JSON.parse(JSON.stringify(c))})}else{this.setSubscribedUsersDataInCommentAnnotation(e);let c=JSON.parse(JSON.stringify(e));c.position=null,c.ghostComment=null,c.lastUpdated=this.timestamp,c.status||(c.status=this.customFilterService.defaultStatus),delete c.resolved,delete c.inProgress,this.setLocationFromDocumentParams(c);let p=window.localStorage.getItem(U.LOCAL_STORAGE.SNIPPYLY_QUEUED_COMMENT);if(p&&JSON.parse(p).annotationId===c.annotationId&&window.localStorage.removeItem(U.LOCAL_STORAGE.SNIPPYLY_QUEUED_COMMENT),c?.multiThreadAnnotationId&&!s&&this.saveMultiThreadCommentAnnotation(c).then(h=>{}),c?.comments?.length){if(delete c?.isDraft,c?.multiThreadAnnotationId&&this.draftMultiThreadCommentAnnotationsByAnnotationId$.value[c?.multiThreadAnnotationId]&&this.saveMultiThreadCommentAnnotation(c),!c?.metadata?.documentId){c?.metadata||(c.metadata={});let A=this.docService.getBaseMetadata();c.metadata=I(I({},c?.metadata),A)}let{documentId:h,organizationId:_}=c?.metadata||{},E=a?I({annotationData:a?.commentAnnotation,targetAnnotationData:a?.targetComment,actionType:a?.actionType,notificationSource:"comment"},a?.otherFields||{}):null;r?this.commonDbService.updateData({feature:"comment",properties:{id:c.annotationId,documentId:h,organizationId:_},extraData:E,data:JSON.parse(JSON.stringify(c)),callback:A=>{a&&!A?.firestoreAvailable&&this.updateNotificationsDatabase(a.commentAnnotation,a.targetComment,a.actionType,a.otherFields||{})}}):this.commonDbService.setData({feature:"comment",properties:{id:c.annotationId,documentId:h,organizationId:_},extraData:E,data:JSON.parse(JSON.stringify(c)),callback:A=>{a&&!A?.firestoreAvailable&&this.updateNotificationsDatabase(a.commentAnnotation,a.targetComment,a.actionType,a.otherFields||{})}}),this.viewsService.setCommentAnnotationAsRead(c)}else this.draftCommentAnnotationsByAnnotationId$.next(T(I({},this.draftCommentAnnotationsByAnnotationId$.value),{[e.annotationId]:c}))}}}catch(c){this.loggingService.catch("Error in CommentService updateComment: ",c)}}getDocumentIdAndOrganizationIdFromCommentAnnotation(e){try{return{documentId:e?.metadata?.documentId,organizationId:e?.metadata?.organizationId}}catch(i){return this.loggingService.catch("Error in CommentService getDocumentIdAndOrganizationIdFromCommentAnnotation: ",i),{}}}getDocumentIdAndOrganizationIdFromMultiThreadCommentAnnotation(e){try{return{documentId:e?.metadata?.documentId,organizationId:e?.metadata?.organizationId}}catch(i){return this.loggingService.catch("Error in CommentService getDocumentIdAndOrganizationIdFromMultiThreadCommentAnnotation: ",i),{}}}setLocationFromDocumentParams(e){e?.documentParams&&(e.location=e.documentParams,delete e.documentParams),e?.documentParamsId&&(e.locationId=e.documentParamsId,delete e.documentParamsId)}deleteCommentPinAnnotations(e){return new Promise((i,r)=>ee(this,null,function*(){try{let a=this.domService.getSelectedAnnotationsMap(),s=this.authService.getUser(),c=[];Object.keys(a).forEach(p=>{let h=a[p];["tag","recorder","rewriter","arrow","area","multiThread"].includes(h.type)||s&&h.from&&(s?.isAdmin||h.from.userId===s.userId)&&c.push(h)}),c?.length?(this.analyticsService.trackEvent(Z.Events.Comments.COMMENT_DELETE_TRIGGERED,{triggerType:e,annotationId:c.map(p=>p.annotationId).join(),commentMode:this.getCommentMode()}),this.dialog.open(da,{data:{title:"Delete thread?",message:"All replies to this thread will be lost.",yesButton:"Delete",noButton:"Cancel",darkMode:this.commentContainerDarkMode$.value,variant:"comment"}}).afterClosed().pipe(Je(1)).subscribe(p=>{try{p?(c.forEach(h=>ee(this,null,function*(){yield this.deleteCommentPinAnnotation(h)})),setTimeout(()=>{document.querySelectorAll(`[${U.SNIPPYLY_HIGHLIGHT}]`).forEach(_=>{this.domService.removeHighlightFromElement(_)}),i()},100)):i()}catch(h){r(h)}},p=>{r(p)})):i(),this.domService.resetSelectedAnnotationsMap(!0,"comment")}catch(a){this.loggingService.catch("Error in CommentService deleteCommentPinAnnotations: ",a),r(a)}}))}deleteCommentPinAnnotation(e,i){return ee(this,null,function*(){try{if(setTimeout(()=>{if(this.draftCommentAnnotationsByAnnotationId$?.value?.[e.annotationId]){let r=this.draftCommentAnnotationsByAnnotationId$.value;delete r[e.annotationId],this.draftCommentAnnotationsByAnnotationId$.next(r)}},50),this.authService.isFeatureAllowed(Re.COMMENT))if((i||e.comments?.length)&&this.updateNotificationsDatabase(e,null,jt.DELETED),e.comments?.forEach(r=>{r.reactionAnnotationIds&&r.reactionAnnotationIds.forEach(a=>{this.deleteReaction(a)})}),e?.annotationId){this.analyticsService.trackEvent(Z.Events.Comments.COMMENT_DELETED,{annotationId:e.annotationId,commentType:this.getCommentType(e),commentMode:this.getCommentMode()});let r=window.localStorage.getItem(U.LOCAL_STORAGE.SNIPPYLY_QUEUED_COMMENT);r&&JSON.parse(r).annotationId===e.annotationId&&window.localStorage.removeItem(U.LOCAL_STORAGE.SNIPPYLY_QUEUED_COMMENT),this.areaService.onDeleteTargetAnnotation(e?.annotationId,e?.areaAnnotationId);let a={type:"delete",annotation:null,targetAnnotationId:e.annotationId};this.commentUpdated$.next(a),e?.multiThreadAnnotationId&&(yield this.removeCommentAnnotationFromMultiThread(e)),this.commentAnnotationDeleted$.next(e);let{documentId:s,organizationId:c}=this.getDocumentIdAndOrganizationIdFromCommentAnnotation(e);return e?.isDraft?Promise.resolve():this.commonDbService.deleteData({feature:"comment",properties:{id:e.annotationId,documentId:s,organizationId:c}}).then(()=>{this.viewsService.deleteCommentAnnotationViews(e,{documentId:s,organizationId:c})})}else return Promise.resolve();return Promise.resolve()}catch(r){return this.loggingService.catch("Error in CommentService deleteCommentPinAnnotation: ",r),Promise.resolve()}})}removeCommentAnnotationFromMultiThread(e){return ee(this,null,function*(){try{let i=e?.multiThreadAnnotationId;if(i){let r=this.docService.getDocumentPaths(),a=this.getMultiThreadAnnotationById(i);if(!a){let h=e?.metadata?.documentId||r?.documentId,_=e?.metadata?.organizationId||r?.organizationId;a=yield this.commonDbService?.getData({feature:"multiThread",properties:{documentId:h,organizationId:_,id:i}})}let s=this.draftMultiThreadCommentAnnotationsByAnnotationId$.value?.[i];a&&delete a?.commentAnnotations?.[e.annotationId],s&&(delete s?.commentAnnotations?.[e.annotationId],Object.keys(s?.commentAnnotations||{}).length===0&&(delete this.draftMultiThreadCommentAnnotationsByAnnotationId$.value?.[i],this.draftMultiThreadCommentAnnotationsByAnnotationId$.next(this.draftMultiThreadCommentAnnotationsByAnnotationId$.value))),delete a.commentAnnotationsMap;let{documentId:c,organizationId:p}=this.getDocumentIdAndOrganizationIdFromMultiThreadCommentAnnotation(a);return Object.keys(a?.commentAnnotations||{}).length===0?(this.areaService.onDeleteTargetAnnotation(a?.annotationId,a?.areaAnnotationId),this.multiThreadCommentAnnotationDeleted$.next(a),this.commonDbService.deleteData({feature:"multiThread",properties:{id:a?.annotationId,documentId:c,organizationId:p}})):this.commonDbService.setData({feature:"multiThread",properties:{id:a?.annotationId,documentId:c,organizationId:p},data:JSON.parse(JSON.stringify(a))})}}catch(i){this.loggingService.catch("Error in CommentService removeCommentAnnotationFromMultiThread: ",i)}})}getAnnotationById(e,i){try{let r=this.commentAnnotationById$.value?.[e]||this.draftCommentAnnotationsByAnnotationId$?.value?.[e];if(r){let{documentId:a,organizationId:s}=i||{};if(a&&r.metadata?.documentId!==a||s&&r.metadata?.organizationId!==s)return}return r}catch(r){this.loggingService.catch("Error in CommentService getAnnotationById: ",r);return}}getBaseMetadataFromCommentAnnotationId(e){try{let i=this.commentAnnotationById$.value?.[e];if(i)return i.metadata}catch(i){this.loggingService.catch("Error in CommentService getBaseMetadataFromCommentAnnotationId: ",i)}}getMultiThreadAnnotationById(e,i){try{let r=this.multiThreadCommentAnnotationById$.value?.[e]||this.draftMultiThreadCommentAnnotationsByAnnotationId$?.value?.[e];if(r){let{documentId:a,organizationId:s}=i||{};if(a&&r.metadata?.documentId!==a||s&&r.metadata?.organizationId!==s)return}return r}catch(r){this.loggingService.catch("Error in CommentService getAnnotationById: ",r);return}}getBaseMetadataFromMultiThreadCommentAnnotationId(e){try{let i=this.multiThreadCommentAnnotationById$.value?.[e];if(i)return i.metadata}catch(i){this.loggingService.catch("Error in CommentService getBaseMetadataFromMultiThreadCommentAnnotationId: ",i)}}getElementRefByAnnotationId(e){try{let i=this.getAnnotationById(e);if(i){let r=i?.targetElement?.xpath;if(r)return{xpath:r}}return}catch(i){this.loggingService.catch("Error in CommentService getElementRefByAnnotationId: ",i);return}}scrollToCommentByAnnotationId(e){try{let i=this.getAnnotationById(e),r=document.getElementById(`comment-pin-container-${e}`);r||(r=document.querySelector(`[data-velt-id='${e}']`)),r||(r=document.querySelector(`${U.TAGS.VELT_COMMENT_TEXT}[${U.ATTRIBUTES.ANNOTATION_ID}="${e}"]`)),r&&(r.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"}),i&&(this.domService.getSelectedAnnotationsMap()[e]||this.domService.toggleAnnotationSelection(i)))}catch(i){this.loggingService.catch("Error in CommentService scrollToCommentByAnnotationId: ",i)}}selectCommentByAnnotationId(e,i){try{this.loggingService.log("%c[WB] Calling FUNCTION: selectCommentByAnnotationId","color: green;");let r=this.getAnnotationById(e);r&&this.domService.toggleAnnotationSelection(r,void 0,void 0,!0)}catch(r){this.loggingService.catch("Error in CommentService selectCommentByAnnotationId: ",r)}}enableAddCommentMode(){try{this.authService.isFeatureAllowed(Re.COMMENT)?!this.authService.isPlanExpired()&&this.iamService.hasRoleAny([mo.ADMIN,mo.COMMENTER])?(this.analyticsService.trackEvent(Z.Events.Comments.COMMENT_ADD_MODE_ENABLED,{commentMode:this.getCommentMode()}),this.addCommentMode$.next(!0)):this.loggingService.catch("Error in CommentService enableAddCommentMode: ","User is not allowed to add comment."):this.loggingService.catch("Error in CommentService enableAddCommentMode: ","Comment feature is not enabled.")}catch(e){this.loggingService.catch("Error in CommentService enableAddCommentMode: ",e)}}disableAddCommentMode(){this.analyticsService.trackEvent(Z.Events.Comments.COMMENT_ADD_MODE_DISABLED,{commentMode:this.getCommentMode()}),this.addCommentMode$.next(!1)}addCommentModeChange(){return this.addCommentMode$.asObservable()}enablePersistentCommentMode(){try{this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{persistentCommentMode:!0}}),this.persistentCommentMode$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enablePersistentCommentMode: ",e)}}enableDeleteReplyConfirmation(){try{this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{deleteReplyConfirmation:!0}}),this.deleteReplyConfirmation$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enableDeleteReplyConfirmation: ",e)}}enableSeenByUsers(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{seenByUsers:!0}}),this.seenByUsers$.value===!0)return;this.seenByUsers$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enableSeenByUsers: ",e)}}disableSeenByUsers(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{seenByUsers:!1}}),this.seenByUsers$.value===!1)return;this.seenByUsers$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disableSeenByUsers: ",e)}}getSeenByUsers$(){return this.seenByUsers$.asObservable()}disableDeleteReplyConfirmation(){try{this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{deleteReplyConfirmation:!1}}),this.deleteReplyConfirmation$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disableDeleteReplyConfirmation: ",e)}}disablePersistentCommentMode(){try{this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{persistentCommentMode:!1}}),this.persistentCommentMode$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disablePersistentCommentMode: ",e)}}persistentCommentModeChange(){return this.persistentCommentMode$.asObservable()}enablePersistentModeBanner(){this.persistentModeBanner$.next(!0)}disablePersistentModeBanner(){this.persistentModeBanner$.next(!1)}persistentModeBannerChange(){return this.persistentModeBanner$.asObservable()}showCommentIndex(e){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{commentIndex:e}}),this.showCommentIndex$.value===e)return;this.showCommentIndex$.next(e)}catch(i){this.loggingService.catch("Error in CommentService showCommentIndex: ",i)}}getShowCommentIndex(){return this.showCommentIndex$.asObservable()}enablePopoverMode(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{popoverMode:!0}}),this.popoverMode$.value===!0)return;this.popoverMode$.next(!0),this.analyticsService.trackEvent(Z.Events.Comments.COMMENT_POPOVER_MODE_ENABLED,{commentMode:this.getCommentMode()})}catch(e){this.loggingService.catch("Error in CommentService enablePopoverMode: ",e)}}disablePopoverMode(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{popoverMode:!1}}),this.popoverMode$.value===!1)return;this.popoverMode$.next(!1),this.analyticsService.trackEvent(Z.Events.Comments.COMMENT_POPOVER_MODE_DISABLED,{commentMode:this.getCommentMode()})}catch(e){this.loggingService.catch("Error in CommentService disablePopoverMode: ",e)}}getPopoverMode(){try{return this.popoverMode$.value}catch(e){return this.loggingService.catch("Error in CommentService getPopoverMode: ",e),!1}}getPopoverMode$(){return this.popoverMode$.asObservable()}enablePopoverTriangleComponent(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{popoverTriangleComponent:!0}}),this.popoverTriangleComponent$.value===!0)return;this.popoverTriangleComponent$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enablePopoverTriangleComponent: ",e)}}disablePopoverTriangleComponent(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{popoverTriangleComponent:!1}}),this.popoverTriangleComponent$.value===!1)return;this.popoverTriangleComponent$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disablePopoverTriangleComponent: ",e)}}getPopoverTriangleComponent(){try{return this.popoverTriangleComponent$.value}catch(e){return this.loggingService.catch("Error in CommentService getPopoverTriangleComponent: ",e),!1}}getPopoverTriangleComponent$(){return this.popoverTriangleComponent$.asObservable()}enableDraftMode(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{draftMode:!0}}),this.draftMode$.value===!0)return;this.draftMode$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enableDraftMode: ",e)}}disableDraftMode(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{draftMode:!1}}),this.draftMode$.value===!1)return;this.draftMode$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disableDraftMode: ",e)}}getDraftMode$(){return this.draftMode$.asObservable()}getDraftMode(){return this.draftMode$.value}enableTextComments(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{textMode:!0}}),this.analyticsService.trackEvent(Z.Events.Comments.COMMENT_TEXT_MODE_ENABLED,{commentMode:this.getCommentMode()}),this.textCommentMode$.value===!0)return;this.textCommentMode$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enableTextComments: ",e)}}disableTextComments(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{textMode:!1}}),this.analyticsService.trackEvent(Z.Events.Comments.COMMENT_TEXT_MODE_DISABLED,{commentMode:this.getCommentMode()}),this.textCommentMode$.value===!1)return;this.textCommentMode$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disableTextComments: ",e)}}getTextCommentMode$(){return this.textCommentMode$.asObservable()}isUserGlobalContact$(){return this.contactService.isUserGlobalContact$()}isSidebarOpenedByCustomTrigger(){try{return this.sidebarOpenedByCustomTrigger$.value}catch(e){return this.loggingService.catch("Error in CommentService isSidebarOpenedByCustomTrigger: ",e),!1}}setSidebarVisibility(e,i=!1,r=!1){try{this.domService.resetSelectedAnnotationsMap(),e?(document.querySelector(U.TAGS.VELT_COMMENTS_SIDEBAR)||document.querySelector(U.TAGS.SNIPPYLY_COMMENTS_SIDEBAR)?this.sidebarVisible$.next(e):this.loggingService.catch("Error in CommentService setSidebarVisibility: ",`<${U.TAGS.VELT_COMMENTS_SIDEBAR}> tag is not added.`),i&&this.sidebarOpenedByCustomTrigger$.next(!0)):(!this.sidebarOpenedByCustomTrigger$.value||i||r)&&(this.sidebarVisible$.next(e),this.sidebarOpenedByCustomTrigger$.next(!1)),e?this.analyticsService.trackEvent(Z.Events.Comments.COMMENT_SIDEBAR_OPENED,{commentMode:this.getCommentMode()}):this.analyticsService.trackEvent(Z.Events.Comments.COMMENT_SIDEBAR_CLOSED,{commentMode:this.getCommentMode()})}catch{this.loggingService.catch("Error in CommentService setSidebarVisibility: ",`<${U.TAGS.VELT_COMMENTS_SIDEBAR}> tag is not added.`)}}toggleSidebarVisibility(e=!1,i=!1){try{this.domService.resetSelectedAnnotationsMap(),this.sidebarVisible$.value?(!this.sidebarOpenedByCustomTrigger$.value||e||i)&&(this.sidebarVisible$.next(!this.sidebarVisible$.value),this.sidebarOpenedByCustomTrigger$.next(!1)):(document.querySelector(U.TAGS.VELT_COMMENTS_SIDEBAR)||document.querySelector(U.TAGS.SNIPPYLY_COMMENTS_SIDEBAR)?(this.sidebarVisible$.next(!this.sidebarVisible$.value),this.sidebarVisible$.value?this.analyticsService.trackEvent(Z.Events.Comments.COMMENT_SIDEBAR_TOGGLED,{commentMode:this.getCommentMode(),action:"closed"}):this.analyticsService.trackEvent(Z.Events.Comments.COMMENT_SIDEBAR_TOGGLED,{commentMode:this.getCommentMode(),action:"opened"})):this.loggingService.catch("Error in CommentService toggleSidebarVisibility: ",`<${U.TAGS.VELT_COMMENTS_SIDEBAR}> tag is not added.`),e&&this.sidebarOpenedByCustomTrigger$.next(!0))}catch{this.loggingService.catch("Error in CommentService toggleSidebarVisibility: ",`<${U.TAGS.VELT_COMMENTS_SIDEBAR}> tag is not added.`)}}getSidebarVisibility$(){return this.sidebarVisible$.asObservable()}disableFloatingComments(e){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{floatingCommentDialog:!e}}),this.floatingCommentsEnabled$.value===!e)return;this.floatingCommentsEnabled$.next(!e)}catch(i){this.loggingService.catch("Error in CommentService disableFloatingComments: ",i)}}showFloatingComments$(){return this.floatingCommentsEnabled$.asObservable()}showFloatingComments(){return this.floatingCommentsEnabled$.value}setModeratorMode(e){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{moderatorMode:e}}),this.moderatorMode$.value===e)return;this.moderatorMode$.next(e)}catch(i){this.loggingService.catch("Error in CommentService setModeratorMode: ",i)}}getModeratorMode(){return this.moderatorMode$.value}getModeratorMode$(){return this.moderatorMode$.asObservable()}setStreamMode(e){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{streamMode:e}}),this.streamMode$.value===e)return;this.streamMode$.next(e),e?this.analyticsService.trackEvent(Z.Events.Comments.COMMENT_STREAM_MODE_ENABLED,{commentMode:this.getCommentMode()}):this.analyticsService.trackEvent(Z.Events.Comments.COMMENT_STREAM_MODE_DISABLED,{commentMode:this.getCommentMode()})}catch(i){this.loggingService.catch("Error in CommentService setStreamMode: ",i)}}getStreamMode(){return this.streamMode$.value}getStreamMode$(){return this.streamMode$.asObservable()}getEnableDialogOnHover(){return this.enableDialogOnHover$.value}getEnableDialogOnHover$(){return this.enableDialogOnHover$.asObservable()}setEnableDialogOnHover(e){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{dialogOnHover:e}}),this.enableDialogOnHover$.value===e)return;this.enableDialogOnHover$.next(e)}catch(i){this.loggingService.catch("Error in CommentService setEnableDialogOnHover: ",i)}}getEnableDialogOnTargetElementClick(){return this.enableDialogOnTargetElementClick$.value}getEnableDialogOnTargetElementClick$(){return this.enableDialogOnTargetElementClick$.asObservable()}setEnableDialogOnTargetElementClick(e){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{dialogOnTargetElementClick:e}}),this.enableDialogOnTargetElementClick$.value===e)return;this.enableDialogOnTargetElementClick$.next(e)}catch(i){this.loggingService.catch("Error in CommentService setEnableDialogOnTargetElementClick: ",i)}}getEnablePriority(){return this.enablePriority$.value}getEnablePriority$(){return this.enablePriority$.asObservable()}setEnablePriority(e){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{priority:e}}),this.enablePriority$.value===e)return;this.enablePriority$.next(e)}catch(i){this.loggingService.catch("Error in CommentService setEnablePriority: ",i)}}getEnableStatus(){return this.enableStatus$.value}getEnableStatus$(){return this.enableStatus$.asObservable()}setEnableStatus(e){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{status:e}}),this.getEnableStatus()===e)return;this.enableStatus$.next(e)}catch(i){this.loggingService.catch("Error in CommentService setEnableStatus: ",i)}}getEnableResolve(){return this.enableResolve$.value}getEnableResolve$(){return this.enableResolve$.asObservable()}setEnableResolve(e){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{resolveButton:e}}),this.getEnableResolve()===e)return;this.enableResolve$.next(e)}catch(i){this.loggingService.catch("Error in CommentService setEnableResolve: ",i)}}getEnableGhostComments(){return this.enableGhostComments$.value}getEnableGhostComments$(){return this.enableGhostComments$.asObservable()}enableGhostComments(){try{this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{ghostComments:!0}}),this.enableGhostComments$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enableGhostComments: ",e)}}disableGhostComments(){try{this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{ghostComments:!1}}),this.enableGhostComments$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disableGhostComments: ",e)}}getEnableGhostCommentsMessage(){return this.enableGhostCommentsMessage$.value}getEnableGhostCommentsMessage$(){return this.enableGhostCommentsMessage$.asObservable()}enableGhostCommentsMessage(){try{this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{ghostCommentsIndicator:!0}}),this.enableGhostCommentsMessage$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enableShowGhostCommentsMessage: ",e)}}disableGhostCommentsMessage(){try{this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{ghostCommentsIndicator:!1}}),this.enableGhostCommentsMessage$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disableShowGhostCommentsMessage: ",e)}}enableInboxMode(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{inboxMode:!0}}),this.inboxMode$.value===!0)return;this.inboxMode$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enableInboxMode: ",e)}}disableInboxMode(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{inboxMode:!1}}),this.inboxMode$.value===!1)return;this.inboxMode$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disableInboxMode: ",e)}}getInboxMode(){return this.inboxMode$.value}getInboxMode$(){return this.inboxMode$.asObservable()}setEnableAutoCategorize(e){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{autoCategorize:e}}),this.enableAutoCategorize$.value===e)return;this.enableAutoCategorize$.next(e)}catch(i){this.loggingService.catch("Error in CommentService setEnableAutoCategorize: ",i)}}getEnableAutoCategorize(){return this.enableAutoCategorize$.value}getEnableAutoCategorize$(){return this.enableAutoCategorize$.asObservable()}setCommentContainerDarkMode(e){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{darkMode:e}}),this.commentContainerDarkMode$.value===e)return;this.commentContainerDarkMode$.next(e)}catch(i){this.loggingService.catch("Error in CommentService setCommentContainerDarkMode: ",i)}}getCommentContainerDarkMode(){return this.commentContainerDarkMode$.asObservable()}getSuggestionMode(){return this.suggestionMode$.value}getSuggestionMode$(){return this.suggestionMode$.asObservable()}setSuggestionMode(e){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{suggestionMode:e}}),this.getSuggestionMode()===e)return;this.suggestionMode$.next(e)}catch(i){this.loggingService.catch("Error in CommentService setSuggestionMode: ",i)}}getMobileMode(){return this.mobileMode$.value}getMobileMode$(){return this.mobileMode$.asObservable()}setMobileMode(e){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{mobileMode:e}}),this.getMobileMode()===e)return;this.mobileMode$.next(e)}catch(i){this.loggingService.catch("Error in CommentService setMobileMode: ",i)}}enableInlineCommentMode(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{inlineCommentMode:!0}}),this.inlineCommentMode$.value===!0)return;this.inlineCommentMode$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enableInlineCommentMode: ",e)}}disableInlineCommentMode(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{inlineCommentMode:!1}}),this.inlineCommentMode$.value===!1)return;this.inlineCommentMode$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disableInlineCommentMode: ",e)}}getInlineCommentMode(){return this.inlineCommentMode$.value}getInlineCommentMode$(){return this.inlineCommentMode$.asObservable()}enableMinimap(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{minimap:!0}}),this.minimap$.value===!0)return;this.minimap$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enableMinimap: ",e)}}disableMinimap(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{minimap:!1}}),this.minimap$.value===!1)return;this.minimap$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disableMinimap: ",e)}}getMinimap(){return this.minimap$.value}getMinimap$(){return this.minimap$.asObservable()}showCommentsOnDom(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{commentsOnDom:!0}}),this.commentsOnDom$.value===!0)return;this.commentsOnDom$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService showCommentsOnDom: ",e)}}hideCommentsOnDom(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{commentsOnDom:!1}}),this.commentsOnDom$.value===!1)return;this.commentsOnDom$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService hideCommentsOnDom: ",e)}}getCommentsOnDom(){return this.commentsOnDom$.value}getCommentsOnDom$(){return this.commentsOnDom$.asObservable()}enableCommentTool(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{commentTool:!0}}),this.commentToolEnabled$.value===!0)return;this.commentToolEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enableCommentTool: ",e)}}disableCommentTool(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{commentTool:!1}}),this.commentToolEnabled$.value===!1)return;this.commentToolEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disableCommentTool: ",e)}}getCommentTool(){return this.commentToolEnabled$.value}getCommentTool$(){return this.commentToolEnabled$.asObservable()}setTotalMediaLength(e){try{if(this.totalMediaLength$.value===e)return;this.totalMediaLength$.next(e)}catch(i){this.loggingService.catch("Error in CommentService setTotalMediaLength: ",i)}}getTotalMediaLength(){return this.totalMediaLength$.value}getTotalMediaLength$(){return this.totalMediaLength$.asObservable()}enableSidebarUrlNavigation(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{sidebarUrlNavigation:!0}}),this.sidebarUrlNavigationEnabled$.value===!0)return;this.sidebarUrlNavigationEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enableSidebarUrlNavigation: ",e)}}disableSidebarUrlNavigation(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{sidebarUrlNavigation:!1}}),this.sidebarUrlNavigationEnabled$.value===!1)return;this.sidebarUrlNavigationEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disableSidebarUrlNavigation: ",e)}}getSidebarUrlNavigation(){return this.sidebarUrlNavigationEnabled$.value}getSidebarUrlNavigation$(){return this.sidebarUrlNavigationEnabled$.asObservable()}setDetectionStrategy(e){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{detectionStrategy:e}}),this.detectionStrategy$.value===e)return;this.detectionStrategy$.next(e)}catch(i){this.loggingService.catch("Error in CommentService setDetectionStrategy: ",i)}}getDetectionStrategy(){return this.detectionStrategy$.value}getDetectionStrategy$(){return this.detectionStrategy$.asObservable()}enableSidebarButtonOnCommentDialog(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{sidebarButtonOnCommentDialog:!0}}),this.sidebarButtonOnCommentDialogVisible$.value===!0)return;this.sidebarButtonOnCommentDialogVisible$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enableSidebarButtonOnCommentDialog: ",e)}}disableSidebarButtonOnCommentDialog(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{sidebarButtonOnCommentDialog:!1}}),this.sidebarButtonOnCommentDialogVisible$.value===!1)return;this.sidebarButtonOnCommentDialogVisible$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disableSidebarButtonOnCommentDialog: ",e)}}getSidebarButtonOnCommentDialogVisibility(){return this.sidebarButtonOnCommentDialogVisible$.value}getSidebarButtonOnCommentDialogVisibility$(){return this.sidebarButtonOnCommentDialogVisible$.asObservable()}onSidebarButtonOnCommentDialogClick(){this.sidebarButtonOnCommentDialogClick$.next()}getSidebarButtonOnCommentDialogClick$(){return this.sidebarButtonOnCommentDialogClick$.asObservable()}enableDeviceIndicatorOnCommentPins(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{deviceIndicatorOnCommentPins:!0}}),this.deviceIndicatorOnCommentPins$.value===!0)return;this.deviceIndicatorOnCommentPins$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enableDeviceIndicatorOnCommentPins: ",e)}}disableDeviceIndicatorOnCommentPins(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{deviceIndicatorOnCommentPins:!1}}),this.deviceIndicatorOnCommentPins$.value===!1)return;this.deviceIndicatorOnCommentPins$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disableDeviceIndicatorOnCommentPins: ",e)}}getDeviceIndicatorOnCommentPins(){return this.deviceIndicatorOnCommentPins$.value}getDeviceIndicatorOnCommentPins$(){return this.deviceIndicatorOnCommentPins$.asObservable()}onSidebarCommentClick(e){this.sidebarCommentClick$.next(e)}getSidebarCommentClick$(){return this.sidebarCommentClick$.asObservable()}onCommentNavigationButtonClick(e){this.commentNavigationButtonClick$.next(e)}getCommentNavigationButtonClick$(){return this.commentNavigationButtonClick$.asObservable()}addBubbleCommentAnnotationIds(e){try{let r=[...this.bubbleCommentAnnotationIds$.value||[],...e],a=[...new Set(r)];this.bubbleCommentAnnotationIds$.next(a)}catch(i){this.loggingService.catch("Error in CommentService addBubbleCommentAnnotationIds: ",i)}}getBubbleCommentAnnotationIds(){return this.bubbleCommentAnnotationIds$.value}getBubbleCommentAnnotationIds$(){return this.bubbleCommentAnnotationIds$.asObservable()}removeBubbleCommentAnnotationIds(e){try{let r=(this.bubbleCommentAnnotationIds$.value||[]).filter(a=>!e.includes(a));this.bubbleCommentAnnotationIds$.next(r)}catch(i){this.loggingService.catch("Error in CommentService removeBubbleCommentAnnotationIds: ",i)}}enableSignInButton(e){try{this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{signInButton:e}}),this.enableSignInButton$.next(e)}catch(i){this.loggingService.catch("Error in CommentService enableSignInButton: ",i)}}getSignInButton(){return this.enableSignInButton$.value}getSignInButton$(){return this.enableSignInButton$.asObservable()}onSignInClick(){this.onSignInClick$.next()}getSignInButtonClick$(){return this.onSignInClick$.asObservable()}enableUpgradeButton(e){try{this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{upgradeButton:e}}),this.enableUpgradeButton$.next(e)}catch(i){this.loggingService.catch("Error in CommentService enableUpgradeButton: ",i)}}getUpgradeButton(){return this.enableUpgradeButton$.value}getUpgradeButton$(){return this.enableUpgradeButton$.asObservable()}onUpgradeClick(){this.onUpgradeClick$.next()}getUpgradeButtonClick$(){return this.onUpgradeClick$.asObservable()}openSidebar(){this.openSidebar$.next()}getOpenSidebar$(){return this.openSidebar$.asObservable()}enableAttachment(e){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{attachments:e}}),this.enableAttachment$.value===e)return;this.enableAttachment$.next(e)}catch(i){this.loggingService.catch("Error in CommentService enableAttachment: ",i)}}getEnableAttachment$(){return this.enableAttachment$.asObservable()}setAllowedRecordings(e){try{this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{recordings:e}}),e?.includes("all")?this.allowedRecordings$.next(["audio","video","screen"]):e?.includes("none")?this.allowedRecordings$.next([]):this.allowedRecordings$.next(e)}catch(i){this.loggingService.catch("Error in CommentService setAllowedRecordings: ",i)}}getAllowedRecordings(){return this.allowedRecordings$.value}getAllowedRecordings$(){return this.allowedRecordings$.asObservable()}enableReactions(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{reactions:!0}}),this.enableReactions$.value===!0)return;this.enableReactions$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enableReactions: ",e)}}disableReactions(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{reactions:!1}}),this.enableReactions$.value===!1)return;this.enableReactions$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disableReactions: ",e)}}getEnableReactions(){return this.enableReactions$.value}getEnableReactions$(){return this.enableReactions$.asObservable()}addCommentOnElement(e){this.addComment(void 0,void 0,void 0,e)}enablePrivateCommentMode(){return ee(this,null,function*(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{privateCommentMode:!0}}),this.privateCommentMode$.value===!0)return;this.iamService.isUserAdmin$().pipe(Je(1)).subscribe(e=>{e?(this.privateCommentMode$.next(!0),this.analyticsService.trackEvent(Z.Events.Comments.COMMENT_PRIVATE_COMMENT_MODE_ENABLED)):this.loggingService.logsEnabled&&console.warn("You are not allowed to enable private comment mode.")})}catch(e){this.loggingService.catch("Error in CommentService enablePrivateCommentMode: ",e)}})}disablePrivateCommentMode(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{privateCommentMode:!1}}),this.privateCommentMode$.value===!1)return;this.privateCommentMode$.next(!1),this.analyticsService.trackEvent(Z.Events.Comments.COMMENT_PRIVATE_COMMENT_MODE_DISABLED)}catch(e){this.loggingService.catch("Error in CommentService disablePrivateCommentMode: ",e)}}getPrivateCommentMode(){return this.privateCommentMode$.value}getPrivateCommentMode$(){return this.privateCommentMode$.asObservable()}enableScrollToComment(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{scrollToComment:!0}}),this.scrollToComment$.value===!0)return;this.scrollToComment$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enableScrollToComment: ",e)}}disableScrollToComment(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{scrollToComment:!1}}),this.scrollToComment$.value===!1)return;this.scrollToComment$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disableScrollToComment: ",e)}}getScrollToComment(){return this.scrollToComment$.value}getScrollToComment$(){return this.scrollToComment$.asObservable()}showScreenSizeInfo(e){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{deviceInfo:e}}),this.showScreenSizeInfo$.value===e)return;this.showScreenSizeInfo$.next(e)}catch(i){this.loggingService.catch("Error in CommentService showScreenSizeInfo: ",i)}}getShowScreenSizeInfo$(){return this.showScreenSizeInfo$.asObservable()}enableUserMentions(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: enableUserMentions","color: green;"),this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{userMentions:!0}}),this.userMentions$.value===!0)return;this.userMentions$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enableUserMentions: ",e)}}disableUserMentions(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: disableUserMentions","color: green;"),this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{userMentions:!1}}),this.userMentions$.value===!1)return;this.userMentions$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disableUserMentions: ",e)}}getUserMentions(){return this.userMentions$.value}getUserMentions$(){return this.userMentions$.asObservable()}enableDeleteOnBackspace(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: enableDeleteOnBackspace","color: green;"),this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{deleteOnBackspace:!0}}),this.deleteOnBackspace$.value===!0)return;this.deleteOnBackspace$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enableDeleteOnBackspace: ",e)}}disableDeleteOnBackspace(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: disableDeleteOnBackspace","color: green;"),this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{deleteOnBackspace:!1}}),this.deleteOnBackspace$.value===!1)return;this.deleteOnBackspace$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disableDeleteOnBackspace: ",e)}}getDeleteOnBackspace(){return this.deleteOnBackspace$.value}getDeleteOnBackspace$(){return this.deleteOnBackspace$.asObservable()}enableHotkey(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: enableHotkey","color: green;"),this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{hotkey:!0}}),this.hotkeyEnabled$.value===!0)return;this.hotkeyEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enableHotkey: ",e)}}disableHotkey(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: disableHotkey","color: green;"),this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{hotkey:!1}}),this.hotkeyEnabled$.value===!1)return;this.hotkeyEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disableHotkey: ",e)}}enableRecordingSummary(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: enableRecordingSummary","color: green;"),this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{recordingSummary:!0}}),this.recordingSummaryEnabled$.value===!0)return;this.recordingSummaryEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enableRecordingSummary: ",e)}}disableRecordingSummary(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: disableRecordingSummary","color: green;"),this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{recordingSummary:!1}}),this.recordingSummaryEnabled$.value===!1)return;this.recordingSummaryEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disableRecordingSummary: ",e)}}getRecordingSummaryEnabled(){return this.recordingSummaryEnabled$.value}getRecordingSummaryEnabled$(){return this.recordingSummaryEnabled$.asObservable()}setUnreadIndicatorMode(e){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: setUnreadIndicatorMode","color: green;"),this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{unreadIndicatorMode:e}}),this.unreadIndicatorMode$.value===e)return;this.unreadIndicatorMode$.next(e)}catch(i){this.loggingService.catch("Error in CommentService setUnreadIndicatorMode: ",i)}}getUnreadIndicatorMode(){return this.unreadIndicatorMode$.value}getUnreadIndicatorMode$(){return this.unreadIndicatorMode$.asObservable()}setComposerMode(e){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: setComposerMode","color: green;"),this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{composerMode:e}}),this.composerMode$.value===e)return;this.composerMode$.next(e)}catch(i){this.loggingService.catch("Error in CommentService setComposerMode: ",i)}}getComposerMode(){return this.composerMode$.value}getComposerMode$(){return this.composerMode$.asObservable()}enableEnterKeyToSubmit(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: enableEnterKeyToSubmit","color: green;"),this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{enterKeyToSubmit:!0}}),this.enterKeyToSubmit$.value===!0)return;this.enterKeyToSubmit$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enableEnterKeyToSubmit: ",e)}}disableEnterKeyToSubmit(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: disableEnterKeyToSubmit","color: green;"),this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{enterKeyToSubmit:!1}}),this.enterKeyToSubmit$.value===!1)return;this.enterKeyToSubmit$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disableEnterKeyToSubmit: ",e)}}getEnterKeyToSubmit(){return this.enterKeyToSubmit$.value}getEnterKeyToSubmit$(){return this.enterKeyToSubmit$.asObservable()}enablePinShadowDOM(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: enablePinShadowDOM","color: green;"),this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{pinShadowDom:!0}}),this.pinShadowDOM$.value===!0)return;this.pinShadowDOM$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enablePinShadowDOM: ",e)}}disablePinShadowDOM(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: disablePinShadowDOM","color: green;"),this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{pinShadowDom:!1}}),this.pinShadowDOM$.value===!1)return;this.pinShadowDOM$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disablePinShadowDOM: ",e)}}getPinShadowDOM(){return this.pinShadowDOM$.value}getPinDarkMode(){return this.pinDarkMode$.value}getPinDarkMode$(){return this.pinDarkMode$.asObservable()}getTextCommentToolDarkMode(){return this.textCommentToolDarkMode$.value}getTextCommentToolDarkMode$(){return this.textCommentToolDarkMode$.asObservable()}getTextCommentToolbarDarkMode(){return this.textCommentToolbarDarkMode$.value}getTextCommentToolbarDarkMode$(){return this.textCommentToolbarDarkMode$.asObservable()}getPinShadowDOM$(){return this.pinShadowDOM$.asObservable()}getTextCommentToolShadowDOM$(){return this.textCommentToolShadowDOM$.asObservable()}getTextCommentToolbarShadowDOM$(){return this.textCommentToolbarShadowDOM$.asObservable()}enableDialogShadowDOM(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: enableDialogShadowDOM","color: green;"),this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{dialogShadowDom:!0}}),this.dialogShadowDOM$.value===!0)return;this.dialogShadowDOM$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enableDialogShadowDOM: ",e)}}enableTextCommentToolbarShadowDOM(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: enableTextCommentToolbarShadowDOM","color: green;"),this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{textCommentToolbarShadowDom:!0}}),this.textCommentToolbarShadowDOM$.value===!0)return;this.textCommentToolbarShadowDOM$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enableTextCommentToolbarShadowDOM: ",e)}}disableTextCommentToolbarShadowDOM(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: disableTextCommentToolbarShadowDOM","color: green;"),this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{textCommentToolbarShadowDom:!1}}),this.textCommentToolbarShadowDOM$.value===!1)return;this.textCommentToolbarShadowDOM$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disableTextCommentToolbarShadowDOM: ",e)}}enableTextCommentToolShadowDOM(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: enableTextCommentToolShadowDOM","color: green;"),this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{textCommentToolShadowDom:!0}}),this.textCommentToolShadowDOM$.value===!0)return;this.textCommentToolShadowDOM$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enableTextCommentToolShadowDOM: ",e)}}disableTextCommentToolShadowDOM(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: disableTextCommentToolShadowDOM","color: green;"),this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{textCommentToolShadowDom:!1}}),this.textCommentToolShadowDOM$.value===!1)return;this.textCommentToolShadowDOM$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disableTextCommentToolShadowDOM: ",e)}}enableTextCommentToolDarkMode(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: enableTextCommentToolDarkMode","color: green;"),this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{textCommentToolDarkMode:!0}}),this.textCommentToolDarkMode$.value===!0)return;this.textCommentToolDarkMode$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enableTextCommentToolDarkMode: ",e)}}disableTextCommentToolDarkMode(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: disableTextCommentToolDarkMode","color: green;"),this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{textCommentToolDarkMode:!1}}),this.textCommentToolDarkMode$.value===!1)return;this.textCommentToolDarkMode$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disableTextCommentToolDarkMode: ",e)}}enableTextCommentToolbarDarkMode(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: enableTextCommentToolbarDarkMode","color: green;"),this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{textCommentToolbarDarkMode:!0}}),this.textCommentToolbarDarkMode$.value===!0)return;this.textCommentToolbarDarkMode$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enableTextCommentToolbarDarkMode: ",e)}}disableTextCommentToolbarDarkMode(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: disableTextCommentToolbarDarkMode","color: green;"),this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{textCommentToolbarDarkMode:!1}}),this.textCommentToolbarDarkMode$.value===!1)return;this.textCommentToolbarDarkMode$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disableTextCommentToolbarDarkMode: ",e)}}enablePinDarkMode(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: enablePinDarkMode","color: green;"),this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{pinDarkMode:!0}}),this.pinDarkMode$.value===!0)return;this.pinDarkMode$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enablePinDarkMode: ",e)}}disablePinDarkMode(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: disablePinDarkMode","color: green;"),this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{pinDarkMode:!1}}),this.pinDarkMode$.value===!1)return;this.pinDarkMode$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disablePinDarkMode: ",e)}}disableDialogShadowDOM(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: disableDialogShadowDOM","color: green;"),this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{dialogShadowDom:!1}}),this.dialogShadowDOM$.value===!1)return;this.dialogShadowDOM$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disableDialogShadowDOM: ",e)}}getDialogShadowDOM(){return this.dialogShadowDOM$.value}getDialogShadowDOM$(){return this.dialogShadowDOM$.asObservable()}enableSidebarShadowDOM(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: enableSidebarShadowDOM","color: green;"),this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{sidebarShadowDOM:!0}}),this.sidebarShadowDOM$.value===!0)return;this.sidebarShadowDOM$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enableSidebarShadowDOM: ",e)}}disableSidebarShadowDOM(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: disableSidebarShadowDOM","color: green;"),this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{sidebarShadowDOM:!1}}),this.sidebarShadowDOM$.value===!1)return;this.sidebarShadowDOM$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disableSidebarShadowDOM: ",e)}}getSidebarShadowDOM(){return this.sidebarShadowDOM$.value}getSidebarShadowDOM$(){return this.sidebarShadowDOM$.asObservable()}enableChangeDetectionInCommentMode(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: enableChangeDetectionInCommentMode","color: green;"),this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{changeDetectionInCommentMode:!0}}),this.changeDetectionInCommentMode$.value===!0)return;this.changeDetectionInCommentMode$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enableChangeDetectionInCommentMode: ",e)}}disableChangeDetectionInCommentMode(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: disableChangeDetectionInCommentMode","color: green;"),this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{changeDetectionInCommentMode:!1}}),this.changeDetectionInCommentMode$.value===!1)return;this.changeDetectionInCommentMode$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disableChangeDetectionInCommentMode: ",e)}}getChangeDetectionInCommentMode(){return this.changeDetectionInCommentMode$.value}getChangeDetectionInCommentMode$(){return this.changeDetectionInCommentMode$.asObservable()}showResolvedCommentsOnDom(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{resolvedCommentsOnDom:!0}}),this.resolvedCommentsOnDom$.value===!0)return;this.resolvedCommentsOnDom$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService showResolvedCommentsOnDom: ",e)}}hideResolvedCommentsOnDom(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{resolvedCommentsOnDom:!1}}),this.resolvedCommentsOnDom$.value===!1)return;this.resolvedCommentsOnDom$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService hideResolvedCommentsOnDom: ",e)}}getResolvedCommentsOnDom(){return this.resolvedCommentsOnDom$.value}getResolvedCommentsOnDom$(){return this.resolvedCommentsOnDom$.asObservable()}enableBubbleOnPin(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{bubbleOnPin:!0}}),this.bubbleOnPinEnabled$.value===!0)return;this.bubbleOnPinEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enableBubbleOnPin: ",e)}}disableBubbleOnPin(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{bubbleOnPin:!1}}),this.bubbleOnPinEnabled$.value===!1)return;this.bubbleOnPinEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disableBubbleOnPin: ",e)}}getBubbleOnPin(){return this.bubbleOnPinEnabled$.value}getBubbleOnPin$(){return this.bubbleOnPinEnabled$.asObservable()}enableBubbleOnPinHover(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{bubbleOnPinHover:!0}}),this.bubbleOnPinHoverEnabled$.value===!0)return;this.bubbleOnPinHoverEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enableBubbleOnPinHover: ",e)}}disableBubbleOnPinHover(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{bubbleOnPinHover:!1}}),this.bubbleOnPinHoverEnabled$.value===!1)return;this.bubbleOnPinHoverEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disableBubbleOnPinHover: ",e)}}getBubbleOnPinHover(){return this.bubbleOnPinHoverEnabled$.value}getBubbleOnPinHover$(){return this.bubbleOnPinHoverEnabled$.asObservable()}setExcludeLocationIdsFromSidebar(e){try{this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{excludeLocationIdsFromSidebar:e}}),this.excludeLocationIdsFromSidebar$.next(e)}catch(i){this.loggingService.catch("Error in CommentService setExcludeLocationIdsFromSidebar: ",i)}}getExcludeLocationIdsFromSidebar(){return this.excludeLocationIdsFromSidebar$.value}getExcludeLocationIdsFromSidebar$(){return this.excludeLocationIdsFromSidebar$.asObservable()}enableMultiThread(){try{this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{multiThread:!0}}),this.multiThread$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enableMultiThread: ",e)}}disableMultiThread(){try{this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{multiThread:!1}}),this.multiThread$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disableMultiThread: ",e)}}getMultiThread(){return this.multiThread$.value}getMultiThread$(){return this.multiThread$.asObservable()}enableShortUserName(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: enableShortUserName","color: green;"),this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{shortUserName:!0}}),this.shortUserName$.value===!0)return;this.shortUserName$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enableShortUserName: ",e)}}disableShortUserName(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: disableShortUserName","color: green;"),this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{shortUserName:!1}}),this.shortUserName$.value===!1)return;this.shortUserName$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disableShortUserName: ",e)}}getShortUserName(){return this.shortUserName$.value}getShortUserName$(){return this.shortUserName$.asObservable()}enableRecordingCountdown(){try{this.loggingService.log("%c[WB] Calling FUNCTION: enableRecordingCountdown","color: green;"),this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{recordingCountdown:!0}}),this.recorderService.enableRecordingCountdown()}catch(e){this.loggingService.catch("Error in CommentService enableRecordingCountdown: ",e)}}disableRecordingCountdown(){try{this.loggingService.log("%c[WB] Calling FUNCTION: disableRecordingCountdown","color: green;"),this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{recordingCountdown:!1}}),this.recorderService.disableRecordingCountdown()}catch(e){this.loggingService.catch("Error in CommentService disableRecordingCountdown: ",e)}}setCommentSidebarFilters(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setCommentSidebarFilters","color: green;"),this.commentSidebarFilters$.next(e)}catch(i){this.loggingService.catch("Error in CommentService setCommentSidebarFilters: ",i)}}getCommentSidebarFilters(){return this.commentSidebarFilters$.value}getCommentSidebarFilters$(){return this.commentSidebarFilters$.asObservable()}enableCommentPinHighlighter(){try{this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{commentPinHighlighter:!0}}),this.domService.enableCommentPinHighlighter()}catch(e){this.loggingService.catch("Error in CommentService enableCommentPinHighlighter: ",e)}}disableCommentPinHighlighter(){try{this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{commentPinHighlighter:!1}}),this.domService.disableCommentPinHighlighter()}catch(e){this.loggingService.catch("Error in CommentService disableCommentPinHighlighter: ",e)}}setCustomReactions(e){try{this.reactionService.setCustomReactions(e)}catch(i){this.loggingService.catch("Error in CommentService setCustomReactions: ",i)}}onCommentSelectionChange$(){return this.commentSelectionChange$.asObservable()}onCommentAdd$(){return this.commentAdded$.asObservable()}onCommentUpdate$(){return this.commentUpdated$.asObservable()}onCommentAnnotationDelete$(){return this.commentAnnotationDeleted$.asObservable()}onMultiThreadCommentAnnotationDelete$(){return this.multiThreadCommentAnnotationDeleted$.asObservable()}getCommentMode(){try{let e="freestyle";return this.getStreamMode()?e="stream":this.getPopoverMode()&&(e="popover"),e}catch(e){return this.loggingService.catch("Error in CommentService getCommentMode: ",e),"freestyle"}}getCommentType(e){try{return e.targetElement?"element":e.targetTextRange?"text":e.areaAnnotationId?"area":""}catch(i){return this.loggingService.catch("Error in CommentService getCommentType: ",i),""}}getCommentAnnotationAvailableOnXPath(e,i,r){try{return this.commentAnnotationById$.pipe(ge(()=>this.draftCommentAnnotationsByAnnotationId$),ge(a=>(!r&&i&&(r=cr(i,["id","data-id"])),re(T(I({},a),{element:r})))),ge(a=>this.getLocations$().pipe(ce(s=>T(I({},a),{locationIds:s})))),ce(({locationIds:a,element:s})=>{let c=[],p=this.docService.getDocumentPaths();if(p?.documentId){let h=this.docService.getAdditionalDocumentIdFromElement(s),_=h?this.docService.generateDocumentId(h):p?.documentId,E=this.getCommentAnnotationsByOrganizationIdAndDocumentId({organizationId:p?.organizationId,documentId:_||""});if(E)for(let A of E)(i&&A?.targetElementId===i||A?.targetElement?.xpath===e)&&a?.includes(A?.locationId)&&c.push(A)}return c.length?c:null}))}catch(a){return this.loggingService.catch("Error in CommentService isCommentAnnotationAvailableOnXPath: ",a),re(null)}}getCommentAnnotationByAnnotationId(e){try{return this.commentAnnotationById$.pipe(ce(()=>this.getAnnotationById(e)),ge(i=>i?i?.iam?.accessMode===Yi.PRIVATE?this.iamService.isUserAdmin$().pipe(ce(r=>{if(r)return i})):re(i):re(i)))}catch(i){return this.loggingService.catch("Error in CommentService getCommentAnnotationByAnnotationId: ",i),re(void 0)}}getMultiThreadCommentAnnotationByAnnotationId(e){return this.multiThreadCommentAnnotationById$.pipe(ce(()=>this.getMultiThreadAnnotationById(e)))}getCommentBubbleElement(e){try{let i=document.querySelector(`${U.TAGS.VELT_COMMENT_BUBBLE}[${U.ATTRIBUTES.VELT_ANNOTATION_IDS}*="${e?.annotationId}"]`);return i||(i=document.querySelector(`${U.TAGS.SNIPPYLY_COMMENT_BUBBLE}[${U.ATTRIBUTES.VELT_ANNOTATION_IDS}*="${e?.annotationId}"]`)),i}catch(i){return this.loggingService.catch("Error in CommentService getCommentBubbleElement: ",i),null}}getCommentAnnotationsBySectionId(e){try{return this.commentAnnotationById$.pipe(ge(()=>this.docService.getDocumentPaths$().pipe(ce(i=>({documentPaths:i,sectionId:e})))),ge(i=>{let r=cr(e,["id","data-id"]);if(r){let a=this.docService.getAdditionLocationFromElement(r);if(a){let s=this.docService.genarateLocationId(a);return this.docService.getLocations$().pipe(ce(c=>{let h=Object.values(c||{}).find(_=>_.locationId===s||a?.id&&_.location.id===a.id);return T(I({},i),{additionalLocation:h,locationOnElement:!!a})}))}}return re(T(I({},i),{additionalLocation:null,element:r}))}),ge(i=>i?.locationOnElement?re(i):this.docService.getLocation$().pipe(ce(r=>T(I({},i),{location:r})))),ce(({documentPaths:i,location:r,additionalLocation:a,locationOnElement:s,element:c})=>{let p=null;if(this.authService.getUser()&&i?.documentId){let _=this.docService.getAdditionalDocumentIdFromElement(c),E=_?this.docService.generateDocumentId(_):i?.documentId,A=this.getCommentAnnotationsByOrganizationIdAndDocumentId({organizationId:i?.organizationId,documentId:E||""});if(A){p=[];let V=om(e);s?a?.location?.id?V=om([a?.location?.id,e]):a?.locationId&&(V=om([a?.locationId+"",e])):r&&(r?.location?.id?V=om([r?.location?.id,e]):r?.locationId&&(V=om([r?.locationId+"",e])));for(let G of A)G?.multiThreadAnnotationId===V?p.push(G):(G?.targetInlineCommentElementId===e||G?.targetElementId===e)&&(s?a&&Ou({location:a?.location,locationId:a?.locationId},{location:G.location,locationId:G.locationId})&&p.push(G):r?Ou({location:r?.location,locationId:r?.locationId},{location:G.location,locationId:G.locationId})&&p.push(G):G?.locationId||p.push(G))}}return p}))}catch(i){return this.loggingService.catch("Error in CommentService getCommentAnnotationsBySectionId: ",i),re(null)}}getCommentAnnotationsByMultiThreadAnnotationId(e){try{return this.commentAnnotationById$.pipe(ge(()=>this.multiThreadCommentAnnotationById$),ge(()=>this.docService.getDocumentPaths$().pipe(ce(i=>({documentPaths:i,multiThreadAnnotationId:e})))),ce(({documentPaths:i,location:r,additionalLocation:a,locationOnElement:s})=>{let c=null;if(i?.documentId){let p=this.getMultiThreadAnnotationById(e),{documentId:h,organizationId:_}=p?.metadata||{documentId:i?.documentId,organizationId:i?.organizationId},E=this.getCommentAnnotationsByOrganizationIdAndDocumentId({organizationId:_,documentId:h||""});if(E){c=[];for(let A of E)A?.multiThreadAnnotationId===e&&p?.commentAnnotations?.[A?.annotationId]&&c.push(A)}}return c}))}catch(i){return this.loggingService.catch("Error in CommentService getCommentAnnotationsBySectionId: ",i),re(null)}}get timestamp(){return this.commonDbService.getServerTimestamp()}isElementInsideAllowedElements(e){try{return this.allowedElementIds$.value?.length||this.allowedElementClassNames$.value?.length||this.allowedElementQuerySelectors$.value?.length?!!(this.allowedElementIds$.value?.length&&this.domService.isElementInsideListedElementIds(e,this.allowedElementIds$.value)||this.allowedElementClassNames$.value?.length&&this.domService.isElementInsideListedElementClassNames(e,this.allowedElementClassNames$.value)||this.allowedElementQuerySelectors$.value?.length&&this.domService.isElementInsideListedElementQuerySelectors(e,this.allowedElementQuerySelectors$.value)):!0}catch(i){return this.loggingService.catch("Error in CommentService isElementInsideAllowedElements: ",i),!1}}getNearestAllowedElement(e){try{let i=this.domService.getListedElements({elementIds:this.allowedElementIds$.value,elementClassNames:this.allowedElementClassNames$.value,elementQuerySelectors:this.allowedElementQuerySelectors$.value});if(i?.length){for(let r=0;r<i.length;r++){let a=i[r];if(e.contains(a))return a}return null}return null}catch(i){return this.loggingService.catch("Error in CommentService getNearestAllowedElement: ",i),null}}isElementInsideManualCommentContainer(e){try{return this.domService.isElementInsideParentWithAttribute(e,U.ATTRIBUTES.VELT_MANUAL_COMMENT_CONTAINER,"true")}catch(i){return this.loggingService.catch("Error in CommentService isElementInsideManualCommentContainer: ",i),!1}}saveComment(e,i){return ee(this,null,function*(){try{i?.annotation&&(e=i.annotation),e&&(e=JSON.parse(JSON.stringify(e)));let r=this.originalCommentAnnotationsByDocumentId$.value[e.annotationId];if(r?.comments?.length){let _=JSON.parse(JSON.stringify(e.comments||[]));e.comments=[],r.comments?.forEach(E=>{let A=_.find(V=>V.commentId===E.commentId);A?e.comments.push(A):e.comments.push(E)})}e.comments||(e.comments=[]);let a=!1,s=!1,c;switch(i.type){case jt.NEWLY_ADDED:case jt.ADDED:if(!i.updatedComment)break;e?.comments?.length||(s=!0),e.comments.push(i.updatedComment);let _=i?.assigned||void 0;c={commentAnnotation:e,targetComment:i.updatedComment,actionType:i.type,otherFields:{assigned:_}};break;case jt.APPROVED:e.approved=!0,c={commentAnnotation:e,targetComment:null,actionType:jt.APPROVED};break;case jt.ASSIGNED:e.assignedTo=i.assignedTo,c={commentAnnotation:e,targetComment:null,actionType:jt.ASSIGNED};break;case jt.UPDATED:if(!i.updatedComment)break;let E=e.comments.findIndex(Ie=>Ie.commentId===i.updatedComment.commentId);if(E>=0){e.comments[E]=i.updatedComment,e.comments[E].status=jt.UPDATED;let Ie=i?.assigned||void 0;c={commentAnnotation:e,targetComment:i.updatedComment,actionType:jt.UPDATED,otherFields:{assigned:Ie}}}break;case jt.REACTION_ADDED:if(!i.updatedComment)break;let A=e.comments.findIndex(Ie=>Ie.commentId===i.updatedComment.commentId);A>=0&&(e.comments[A]=i.updatedComment,e.comments[A].status=jt.UPDATED,c={commentAnnotation:e,targetComment:i.updatedComment,actionType:jt.REACTION_ADDED});break;case jt.REACTION_DELETED:if(!i.updatedComment)break;let V=e.comments.findIndex(Ie=>Ie.commentId===i.updatedComment.commentId);V>=0&&(e.comments[V]=i.updatedComment,e.comments[V].status=jt.UPDATED,c={commentAnnotation:e,targetComment:i.updatedComment,actionType:jt.REACTION_DELETED});break;case jt.STATUS_CHANGED:e.status.type==="terminal"&&(this.domService.resetSelectedAnnotationsMap(!1,"comment"),e.resolvedByUserId=this.authService.getUser()?.userId),c={commentAnnotation:e,targetComment:null,actionType:jt.STATUS_CHANGED,otherFields:{oldStatus:i.oldStatus,newStatus:i.newStatus}};break;case jt.PRIORITY_CHANGED:c={commentAnnotation:e,targetComment:null,actionType:jt.PRIORITY_CHANGED,otherFields:{oldPriority:i.oldPriority,newPriority:i.newPriority}};break;case jt.ACCESS_MODE_CHANGED:c={commentAnnotation:e,targetComment:null,actionType:jt.ACCESS_MODE_CHANGED,otherFields:{oldAccessMode:i.oldAccessMode,newAccessMode:i.newAccessMode}};break;case jt.CUSTOM_LIST_CHANGED:c={commentAnnotation:e,targetComment:null,actionType:jt.CUSTOM_LIST_CHANGED,otherFields:{oldCustomList:i.oldCustomList,newCustomList:i.newCustomList}};break;case jt.SUBSCRIBED:c={commentAnnotation:e,targetComment:null,actionType:jt.SUBSCRIBED};break;case jt.UNSUBSCRIBED:c={commentAnnotation:e,targetComment:null,actionType:jt.UNSUBSCRIBED};break;case jt.DELETED:if(!i.updatedComment)break;let G=e.comments.findIndex(Ie=>Ie.commentId===i.updatedComment.commentId);if(G>=0){if((G===0&&this.deleteThreadWithFirstComment$.value!==!1||this.deleteReplyConfirmation$.value)&&!i.skipDeleteThreadConfirmation){let Be={};if(this.deleteReplyConfirmation$.value&&(G!==0||this.deleteThreadWithFirstComment$.value===!1)?Be={title:"Delete comment?",message:"This selected comment will be deleted.",yesButton:"Delete",noButton:"Cancel",darkMode:this.commentContainerDarkMode$.value,variant:"reply"}:Be={title:"Delete thread?",message:"All replies to this thread will be lost.",yesButton:"Delete",noButton:"Cancel",darkMode:this.commentContainerDarkMode$.value,variant:"comment"},!(yield this.dialog.open(da,{data:Be}).afterClosed().toPromise()))return}let Ie=e.comments.splice(G,1),Pe=e.metadata;Ie?.length&&Ie.forEach(Be=>{Be?.attachments&&Be.attachments.forEach(We=>{let ke={attachmentId:We.attachmentId,organizationId:Pe?.organizationId??null,documentId:Pe?.documentId??null,folderId:Pe?.folderId??null,commentAnnotationId:e.annotationId,apiKey:Pe?.apiKey??null};this.deleteAttachment({attachment:We,metadata:ke})}),Be?.reactionAnnotationIds&&Be.reactionAnnotationIds.forEach(We=>{this.deleteReaction(We)})})}e.status=this.customFilterService.defaultStatus,G===0&&this.deleteThreadWithFirstComment$.value!==!1||e.comments?.length===0?a=!0:(this.analyticsService.trackEvent(Z.Events.Comments.COMMENT_THREAD_DELETED,{annotationId:e.annotationId,commentThreadId:i.updatedComment.commentId,commentMode:this.getCommentMode()}),c={commentAnnotation:e,targetComment:i.updatedComment,actionType:jt.DELETED});break;case jt.ACCEPTED:let X={annotationId:e.annotationId,actionUser:this.authService.getUser(),actionType:jt.ACCEPTED,replaceContentHtml:e?.comments?.length?e?.comments[0]?.replaceContentHtml:void 0,replaceContentText:e?.comments?.length?e?.comments[0]?.replaceContentText:void 0,annotation:$n(e)};this.commentAccepted$.next(X),c={commentAnnotation:e,targetComment:null,actionType:jt.ACCEPTED};break;case jt.REJECTED:let he={annotationId:e.annotationId,actionUser:this.authService.getUser(),actionType:jt.REJECTED,replaceContentHtml:e?.comments?.length?e?.comments[0]?.replaceContentHtml:void 0,replaceContentText:e?.comments?.length?e?.comments[0]?.replaceContentText:void 0,annotation:$n(e)};this.commentRejected$.next(he),this.domService.resetSelectedAnnotationsMap(),c={commentAnnotation:e,targetComment:null,actionType:jt.REJECTED};break;default:break}e.resolvedByUserId&&e.status.type!=="terminal"&&(e.resolvedByUserId=null),i?.updatedComment?.isDraft&&(c=void 0),a?(this.deleteCommentPinAnnotation(e,!0),this.domService.resetSelectedAnnotationsMap(!1,"comment")):(s&&e.comments?.length&&this.enableAutoCategorize$?.value&&this.setCommentCategory(e),this.updateComment(e,!1,!1,c,!0),e?.multiThreadAnnotationId&&(i.type===jt.ADDED||i.type===jt.NEWLY_ADDED)&&e.comments?.length===1?setTimeout(()=>{this.domService.resetSelectedAnnotationsMap(!1,"comment")},100):this.domService.updateSelectedAnnotationInMap([e]));let p=this.getCustomPinById(e.annotationId),h={type:i.type,annotation:$n(e),targetAnnotationId:e.annotationId,targetCommentId:i.updatedComment?.commentId,updateContext:(_,E)=>{this.updateCommentAnnotationContext(e.annotationId,_,E)}};p!==void 0&&(h.element=p),delete h?.annotation?.pageInfo,delete h?.annotation?.targetElement,delete h?.annotation?.targetTextRange,h?.type===jt.DELETED&&(e.comments?.length||(h.annotation=null)),a||this.commentUpdated$.next(h)}catch(r){this.loggingService.catch("Error in CommentService saveComment: ",r)}})}attachComment(e,i=[],r){try{this.loggingService.log("%c[WB] Calling FUNCTION: attachComment","color: green;");let a=cr(e,i);if(a){let c={targetElement:{xpath:this.domService.getXPath(a),topPercentage:50,leftPercentage:90},targetElementId:e};this.addComment(void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,c,void 0,void 0,void 0,r)}}catch(a){this.loggingService.catch("Error in CommentService attachComment: ",a)}}updateNotificationsDatabase(e,i,r,a={}){try{let s=I({annotationData:e,targetAnnotationData:i,actionType:r,notificationSource:"comment"},a);this.notificationService.updateNotificationDatabase(s)}catch(s){this.loggingService.catch("Error in CommentService updateNotificationsDatabase: ",s)}}getUserContacts$(){return this.contactService.getUserContacts$()}addUserContact(e){this.contactService.addUserContact(e)}getElementFromComment(e){try{let i=null;if(e?.ghostComment)!i&&e.ghostComment?.targetElement?.fXpath&&(i=this.domService.getElementFromXPath(e.ghostComment?.targetElement?.fXpath),i&&!this.domService.isElementVisible(i)&&(i=null)),!i&&e.ghostComment?.targetElement?.cfXpath&&(i=this.domService.getElementFromXPath(e.ghostComment?.targetElement?.cfXpath),i&&!this.domService.isElementVisible(i)&&(i=null)),!i&&e.ghostComment?.targetElement?.xpath&&(i=this.domService.getElementFromXPath(e.ghostComment?.targetElement?.xpath),i&&!this.domService.isElementVisible(i)&&(i=null));else{let r=!1;!i&&e?.targetElement?.xpath&&(r=this.domService.isXpathWithId(e?.targetElement?.xpath),i=this.domService.getElementFromXPath(e?.targetElement?.xpath),i&&!this.domService.isElementVisible(i)&&(i=null)),r||(!i&&e?.targetElement?.cfXpath&&(i=this.domService.getElementFromXPath(e?.targetElement?.cfXpath),i&&!this.domService.isElementVisible(i)&&(i=null)),!i&&e?.targetElement?.fXpath&&(i=this.domService.getElementFromXPath(e?.targetElement?.fXpath),i&&!this.domService.isElementVisible(i)&&(i=null)))}return i&&!xo(i)&&(i=null),i}catch(i){return this.loggingService.catch("Error in CommentService getElementFromComment: ",i),null}}getElementFromComments(e){try{let i=[],r=null;if(e?.ghostComment)!r&&e.ghostComment?.targetElement?.fXpath&&(r=this.domService.getElementFromXPath(e.ghostComment?.targetElement?.fXpath),r&&!this.domService.isElementVisible(r)&&(r=null)),!r&&e.ghostComment?.targetElement?.cfXpath&&(r=this.domService.getElementFromXPath(e.ghostComment?.targetElement?.cfXpath),r&&!this.domService.isElementVisible(r)&&(r=null)),!r&&e.ghostComment?.targetElement?.xpath&&(r=this.domService.getElementFromXPath(e.ghostComment?.targetElement?.xpath),r&&!this.domService.isElementVisible(r)&&(r=null));else{let a=!1;!r&&e?.targetElement?.xpath&&(a=this.domService.isXpathWithId(e?.targetElement?.xpath),r=this.domService.getElementFromXPath(e?.targetElement?.xpath),r&&!this.domService.isElementVisible(r)&&(r=null)),a||(!r&&e?.targetElement?.cfXpath&&(r=this.domService.getElementFromXPath(e?.targetElement?.cfXpath),r&&!this.domService.isElementVisible(r)&&(r=null)),!r&&e?.targetElement?.fXpath&&(r=this.domService.getElementFromXPath(e?.targetElement?.fXpath),r&&!this.domService.isElementVisible(r)&&(r=null)))}return r&&!xo(r)&&(r=null),e?.targetElementId&&(i=Array.from(Uie(e.targetElementId,["id","data-id"]))),r&&!i.includes(r)&&i.push(r),i}catch(i){return this.loggingService.catch("Error in CommentService getElementFromComment: ",i),[]}}getGhostCommentTargetElement(e){try{let i=e.targetElement?.fXpath||e.targetElement?.xpath,r=null;if(i)for(;!r&&i;)r=this.domService.getElementFromXPath(i),r&&(!this.domService.isElementVisible(r)||!xo(r))&&(r=null),r||(i=i.substring(0,i.lastIndexOf("/")));return i==="/"&&(i=""),i?{xpath:i,topPercentage:e?.targetElement?.topPercentage||0,leftPercentage:e?.targetElement?.leftPercentage||0}:null}catch(i){return this.loggingService.catch("Error in CommentService getGhostCommentTargetElement: ",i),null}}setGhostCommentMessage(e){try{if(e?.ghostComment){e.ghostComment.message="Original content not found.",e.ghostComment.type=Vs.ELEMENT_DELETED;let i=e?.pageInfo?.deviceInfo?.deviceType,r=new Jn().getDeviceType();i&&i!==r&&(e.ghostComment.type=Vs.DIFFERENT_DEVICE,e.ghostComment.message=`Original comment was added on ${i}.`,[Zo.MOBILE,Zo.TABLET].includes(i)&&[Zo.MOBILE,Zo.TABLET].includes(r)||[Zo.DESKTOP,Zo.MONITOR].includes(i)&&[Zo.DESKTOP,Zo.MONITOR].includes(r)?e.ghostComment.isSameGroup=!0:e.ghostComment.isSameGroup=!1)}}catch(i){this.loggingService.catch("Error in CommentService setGhostCommentMessage: ",i)}}addAnnotationToGhostCommentAnnotationMap(e){try{let i=this.ghostCommentAnnotationMap$.value||{},r=i[e?.annotationId]||{};Co(e.ghostComment,r)||(i[e?.annotationId]=e.ghostComment,this.ghostCommentAnnotationMap$.next(i))}catch(i){this.loggingService.catch("Error in CommentService addAnnotationToGhostCommentAnnotationMap: ",i)}}removeAnnotationFromGhostCommentAnnotationMap(e){try{let i=this.ghostCommentAnnotationMap$.value||{};i[e?.annotationId]&&(delete i[e?.annotationId],this.ghostCommentAnnotationMap$.next(i))}catch(i){this.loggingService.catch("Error in CommentService removeAnnotationFromGhostCommentAnnotationMap: ",i)}}getGhostCommentAnnotationMap$(){return this.ghostCommentAnnotationMap$.asObservable()}getGhostCommentAnnotationMap(){return this.ghostCommentAnnotationMap$.value||{}}getUnreadCommentsMap$(){return this.unreadCommentsMap$.asObservable().pipe(Kt(_o))}getUnreadCommentsMap(){return this.unreadCommentsMap$.value}getUnreadCommentCountByAnnotationId$(e){return this.getUnreadCommentsMap$().pipe(ce(i=>i?{count:i[e]||0}:null))}getUnreadCommentAnnotationCountOnCurrentDocument$(){return this.getUnreadCommentsMap$().pipe(ce(e=>e?{count:Object.keys(e??{}).length||0}:null))}getUnreadCommentCountOnCurrentDocument$(){return this.getUnreadCommentsMap$().pipe(ce(e=>e?{count:Object.values(e).reduce((r,a)=>r+a,0)}:null))}getUnreadCommentCountByLocationId$(e){return this.getUnreadCommentsMap$().pipe(ce(i=>{if(i){let r=this.docService.getDocumentPaths(),a=[],s=0;return r?.documentId&&(a=this.getCommentAnnotationsByOrganizationIdAndDocumentId({organizationId:r?.organizationId,documentId:r?.documentId}),a&&Object.keys(i).forEach(c=>{a?.find(h=>h.annotationId===c)?.location?.id===e&&(s+=i[c])})),{count:s}}else return null}))}getUnreadCommentAnnotationCountByLocationId$(e){return this.getUnreadCommentsMap$().pipe(ce(i=>{if(i){let r=this.docService.getDocumentPaths(),a=[],s=0;return r?.documentId&&(a=this.getCommentAnnotationsByOrganizationIdAndDocumentId({organizationId:r?.organizationId,documentId:r?.documentId}),Object.keys(i).forEach(c=>{i[c]&&a?.find(h=>h.annotationId===c)?.location?.id===e&&(s+=1)})),{count:s}}else return null}))}setCommentAnnotationsAsRead(e){try{for(let i of e)this.viewsService.setCommentAnnotationAsRead(i)}catch(i){this.loggingService.catch("Error in CommentService setCommentAnnotationsAsRead: ",i)}}setCommentAnnotationsAsResolved(e){try{let i=this.customFilterService.resolvedStatus;if(i){for(let r of e)if(i?.id!==r?.status?.id){let a=JSON.parse(JSON.stringify(r||{}));r.status=this.customFilterService.resolvedStatus;let s={annotation:r,type:jt.STATUS_CHANGED,oldStatus:a.status,newStatus:this.customFilterService.resolvedStatus};this.saveComment(r,s)}}}catch(i){this.loggingService.catch("Error in CommentService setCommentAnnotationsAsResolved: ",i)}}updateCommentDialogPosition(){try{this.updateCommentDialogPositionTriggerSubject$.next()}catch(e){this.loggingService.catch("Error in CommentService updateCommentDialogPosition: ",e)}}updateCommentDialogPositionTrigger$(){return this.updateCommentDialogPositionTriggerSubject$.asObservable()}enableAreaComment(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{areaComment:!0}}),this.areaCommentEnabled$.value===!0)return;this.areaCommentEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enableAreaComment: ",e)}}disableAreaComment(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{areaComment:!1}}),this.areaCommentEnabled$.value===!1)return;this.areaCommentEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disableAreaComment: ",e)}}getAreaCommentEnabled$(){return this.areaCommentEnabled$.asObservable()}getAreaCommentEnabled(){return this.areaCommentEnabled$.value}setPinCursorImage(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setPinCursorImage","color: green;"),e&&(e=`url(${e}) 0 31, auto`),this.commentPinCursorImage$.next(e)}catch(i){this.loggingService.catch("Error in CommentService setPinCursorImage: ",i)}}getPinCursorImage$(){return this.commentPinCursorImage$.asObservable()}getPinCursorImage(){return this.commentPinCursorImage$.value}setCommentAnnotationsFromCommentsContainer(e){try{this.commentAnnotationsFromCommentsContainer$.next(e)}catch(i){this.loggingService.catch("Error in CommentService setCommentAnnotationsFromCommentsContainer: ",i)}}getCommentAnnotationsFromCommentsContainer$(){return this.commentAnnotationsFromCommentsContainer$.asObservable()}getCommentAnnotationsFromCommentsContainer(){return this.commentAnnotationsFromCommentsContainer$.value}addManualComment(e){return ee(this,null,function*(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: addManualComment","color: green;"),new Promise((i,r)=>{let a=this.domService.getLastDocumentClick()?.target,s=e?.location||this.docService.getAdditionLocationFromElement(a);if(s?.id){let c=this.docService.getLocationByClientLocationId(s.id);c&&(s=c)}this.addComment(void 0,void 0,void 0,void 0,void 0,void 0,void 0,s,void 0,e,void 0,void 0,void 0,c=>{i(c)}),this.addCommentMode$?.value&&!this.persistentCommentMode$?.value&&this.disableAddCommentMode()})}catch(i){return this.loggingService.catch("Error in CommentService addManualComment: ",i),null}})}getCommentUrl(e){try{return e?.pageInfo?.commentUrl?e.pageInfo.commentUrl:(e?.pageInfo||(e.pageInfo=_i(),e.pageInfo&&(e.pageInfo.screenWidth=this.domService.getCurrentWindowSizeValue()?.screenWidth)),e.pageInfo.commentUrl=this.generateCommentUrl(e),this.updateComment(e),e.pageInfo?.commentUrl)}catch(i){this.loggingService.catch("Error in CommentService getCommentUrl: ",i);return}}uploadFile(e,i){let r=`${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentPaths?.documentId}/${U.FIREBASE_PARTIAL_PATH_COMMENT}/${i.annotationId}`;this.documentPaths?.organizationId&&(r=`${U.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.documentPaths.organizationId}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentPaths?.documentId}/${U.FIREBASE_PARTIAL_PATH_COMMENT}/${i.annotationId}`);let a={organizationId:i.metadata?.clientOrganizationId??null,documentId:i.metadata?.clientDocumentId??null,commentAnnotationId:i.annotationId,apiKey:i.metadata?.apiKey??null,folderId:i.metadata?.folderId??null,attachmentId:null};return this.storageService.uploadFile({path:r,file:e,metadata:a,useAttachmentResolver:this.attachmentResolverService.attachmentDataProviderAvailable()})}downloadAttachment(e){this.storageService.downloadAttachment(e)}deleteAttachment({attachment:e,metadata:i}){return this.storageService.deleteAttachment({attachment:e,metadata:i,useAttachmentResolver:this.attachmentResolverService.attachmentDataProviderAvailable()})}deleteReaction(e){try{this.reactionService.deleteReactionPinAnnotation(e)}catch(i){this.loggingService.catch("Error in CommentService deleteReaction: ",i)}}generateCommentUrl(e){let i=new URL(window.location.href);return i.searchParams.delete(U.URL_PARAMS.COMMENT_ID),i.searchParams.append(U.URL_PARAMS.COMMENT_ID,e.annotationId),i.href}getCustomPinById(e){if(this.customPinsById.has(e))return this.customPinsById.get(e)}setCustomStatuses(e){try{if(e===void 0)return;this.customStatusesShown$.next(!0),this.customFilterService.setCustomStatusFilters(e)}catch(i){this.loggingService.catch("Error in CommentService setCustomStatuses: ",i)}}getCustomStatusesShown$(){return this.customStatusesShown$.asObservable()}getCustomStatusesShown(){return this.customStatusesShown$.value}setCustomPriorities(e){try{if(e===void 0)return;this.customFilterService.setCustomPriorityFilters(e)}catch(i){this.loggingService.catch("Error in CommentService setCustomPriorities: ",i)}}setCustomCategories(e){try{if(e===void 0)return;this.customFilterService.setCustomCategories(e)}catch(i){this.loggingService.catch("Error in CommentService setCustomCategories: ",i)}}addCommentOnSelectedText(){try{let e=this.authService.getUser();if(this.textCommentMode$.value&&e&&!(e?.isReadOnly||e?.isAnonymous)&&this.authService.isFeatureAllowed(Re.COMMENT)){let i=this.domService.getRange();if(window.getSelection()?.toString()&&!ZO()&&i?.commonAncestorContainer&&this.isElementInsideAllowedElements(i.commonAncestorContainer)&&!fd(i.commonAncestorContainer)){let r=i?this.domService.getTargetTextRangeFromSelectionRange(i):void 0;this.domService.clearTextSelection(),setTimeout(()=>{this.addComment(void 0,r)},100)}}}catch(e){this.loggingService.catch("Error in CommentService addCommentOnSelectedText: ",e)}}getInlineCommentSectionConfig(e){try{let i;if(e){let r=e?.closest(`[${U.ATTRIBUTES.VELT_TARGET_INLINE_COMMENT_ELEMENT_ID}]`);if(r){let a=r.getAttribute(U.ATTRIBUTES.VELT_TARGET_INLINE_COMMENT_ELEMENT_ID);a&&(i={},i.targetInlineCommentElementId=a,r.getAttribute(U.ATTRIBUTES.VELT_INLINE_COMMENT_SECTION_CONFIG)&&(i.config=JSON.parse(r.getAttribute(U.ATTRIBUTES.VELT_INLINE_COMMENT_SECTION_CONFIG)||"{}")))}}return i}catch(i){this.loggingService.catch("Error in CommentService getInlineCommentSectionConfig: ",i)}}createCustomListDataOnAnnotation(e){try{if(e===void 0)return;this.customChipDropdownData$.next(e)}catch(i){this.loggingService.catch("Error in CommentService createCustomListDataOnAnnotation: ",i)}}getCustomChipDropdownData$(){return this.customChipDropdownData$.asObservable()}getCustomChipDropdownData(){return this.customChipDropdownData$.value}setSubscribedUsersDataInCommentAnnotation(e){try{let i={},r=e?.unsubscribedUsers||{},a={};if(e?.subscribedUsers&&Object.keys(e.subscribedUsers||{}).forEach(s=>{let c=e.subscribedUsers?.[s];c?.type==="manual"&&(i[s]=c)}),e?.assignedTo?.userId){let s=Rt(e?.assignedTo?.userId);r[s]||i[s]?.type!=="manual"&&(i[s]={user:e?.assignedTo,type:"auto"})}e?.comments?.filter(s=>!s?.isDraft)?.forEach(s=>{if(s?.from?.userId){let c=Rt(s?.from?.userId);r[c]||i[c]?.type!=="manual"&&(i[c]={user:s?.from,type:"auto"})}s?.to?.forEach(c=>{if(c?.userId){let p=Rt(c.userId);r[p]||i[p]?.type!=="manual"&&(i[p]={user:c,type:"auto"})}}),s?.toOrganizationUserGroup?.forEach(c=>{if(c?.groupId)a[c?.groupId]={type:"auto"};else if(c?.clientGroupId){let p=Rt(c.clientGroupId);a[p]={type:"auto"}}})}),e.subscribedUsers=i,e.unsubscribedUsers=r,e.subscribedGroups=a}catch(i){this.loggingService.catch("Error in CommentService setSubscribeUsersDataInCommentAnnotation: ",i)}}getCopyLink$(){return this.copyLink$.asObservable()}setCopyLink(e){try{this.copyLink$.next(e)}catch(i){this.loggingService.catch("Error in CommentService setCopyLink: ",i)}}getCommentAnnotationById(e){return this.commentAnnotationById$.pipe(ge(()=>{let{annotationId:i,documentId:r}=e;if(r){let a=fn(r).toString();return this.getDataCommentAnnotationsFromDocumentId(a).pipe(ce(s=>s.find(p=>p.annotationId===i)||null))}else{let a=this.docService.getDocumentPaths();if(a?.documentId){let s=this.getCommentAnnotationsByOrganizationIdAndDocumentId({organizationId:a?.organizationId,documentId:a?.documentId});if(s){let c=s.find(p=>p.annotationId===i);return re(c||null)}}}return re(null)}),Ln(i=>(this.loggingService.catch("Error in CommentService getCommentAnnotationById: ",i),re(null))))}getDataCommentAnnotationsFromDocumentId(e){return this.configService?.getApiKey()?this.commonDbService.dbListener({feature:"allComments",properties:{documentId:e||this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,isCollection:!0}}).pipe(ce(i=>i?.data),ce(i=>{let r=[];return i&&(r=Object.values(i??{}).filter(a=>typeof a=="object")),r})):re([])}enableCollapsedComments(){try{this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{collapsedComments:!0}}),this.collapsedComments$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enableCollapsedComments: ",e)}}disableCollapsedComments(){try{this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{collapsedComments:!1}}),this.collapsedComments$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disableCollapsedComments: ",e)}}getCollapsedComments$(){return this.collapsedComments$.asObservable()}enableFullExpanded(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{fullExpanded:!0}}),this.fullExpanded$.value===!0)return;this.fullExpanded$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enableFullExpanded: ",e)}}disableFullExpanded(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{fullExpanded:!1}}),this.fullExpanded$.value===!1)return;this.fullExpanded$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disableFullExpanded: ",e)}}getFullExpanded$(){return this.fullExpanded$.asObservable()}getFullExpanded(){return this.fullExpanded$.value}setSidebarCustomActionEventData(e,i,r,a){try{this.sidebarCustomActionEventData$.next({actions:e,data:i,unreadDataMap:r,systemFilteredData:a})}catch(s){this.loggingService.catch("Error in CommentService emitOnSidebarCustomAction: ",s)}}getSidebarCustomActionEventData(){return this.sidebarCustomActionEventData$.asObservable()}setCommentSidebarData(e,i){try{this.sidebarData$.next({data:e,options:i})}catch(r){this.loggingService.catch("Error in CommentService setCommentSidebarData: ",r)}}getSidebarCustomData(){return this.sidebarData$.asObservable()}setSidebarCustomActionEventDataAllChanges(e,i,r,a){return ee(this,null,function*(){try{this.sidebarCustomActionEventDataAllChanges$.next({actions:e,data:i,unreadDataMap:r,systemFilteredData:a});let s=yield this.metadataService.getGlobalMetadata(),c={buttonContext:{selections:this.buttonService.buttonToggleMapValue()},unreadCommentAnnotationsMap:r,commentAnnotations:i,systemFilteredAnnotations:a,metadata:s};this.commentActionsService?.triggerAction(qi.COMMENT_SIDEBAR_DATA_UPDATE,c)}catch(s){this.loggingService.catch("Error in CommentService setSidebarCustomActionEventDataAllChanges: ",s)}})}setSidebarCustomActionEventDataOnInit(e,i,r,a){return ee(this,null,function*(){try{this.sidebarCustomActionEventDataOnInit$.next({actions:e,data:i,unreadDataMap:r,systemFilteredData:a});let c={metadata:yield this.metadataService.getGlobalMetadata(),unreadCommentAnnotationsMap:r,commentAnnotations:i,systemFilteredAnnotations:a,buttonContext:{selections:this.buttonService.buttonToggleMapValue()}};this.commentActionsService?.triggerAction(qi.COMMENT_SIDEBAR_DATA_INIT,c)}catch(s){this.loggingService.catch("Error in CommentService setSidebarCustomActionEventDataOnInit: ",s)}})}getSidebarCustomActionEventDataAllChanges(){return this.sidebarCustomActionEventDataAllChanges$.asObservable()}getSidebarCustomActionEventDataOnInit(){return this.sidebarCustomActionEventDataOnInit$.asObservable()}getSidebarCustomActionEventDataOnInitValue(){return this.sidebarCustomActionEventDataOnInit$.getValue()}setTransformContext(e){try{e?Co(this.transformContext$.value,e)||this.transformContext$.next(e):this.transformContext$.next(null)}catch(i){this.loggingService.catch("Error in CommentService setTransformContext: ",i)}}getTransformContext$(){return this.transformContext$.asObservable()}getTransformContext(){return this.transformContext$.value}enableSidebarCustomActions(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{customActions:!0}}),this.customActions$.value===!0)return;this.customActions$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enableSidebarCustomActions: ",e)}}disableSidebarCustomActions(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{customActions:!1}}),this.customActions$.value===!1)return;this.customActions$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disableSidebarCustomActions: ",e)}}getSidebarCustomActionsValue(){return this.customActions$.getValue()}enableQueryParamsComments(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{queryParamsComments:!0}}),this.queryParamsComments$.value===!0)return;this.queryParamsComments$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enableQueryParamsComments: ",e)}}disableQueryParamsComments(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{queryParamsComments:!1}}),this.queryParamsComments$.value===!1)return;this.queryParamsComments$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disableQueryParamsComments: ",e)}}getQueryParamsComments$(){return this.queryParamsComments$.asObservable()}getQueryParamsComments(){return this.queryParamsComments$.value}enableResolveStatusAccessAdminOnly(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{resolveStatusAccessAdminOnly:!0}}),this.resolveStatusAccessAdminOnly$.value===!0)return;this.resolveStatusAccessAdminOnly$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enableResolveStatusAccessAdminOnly: ",e)}}disableResolveStatusAccessAdminOnly(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{resolveStatusAccessAdminOnly:!1}}),this.resolveStatusAccessAdminOnly$.value===!1)return;this.resolveStatusAccessAdminOnly$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disableResolveStatusAccessAdminOnly: ",e)}}getResolveStatusAccessAdminOnly$(){return this.resolveStatusAccessAdminOnly$.asObservable()}getResolveStatusAccessAdminOnly(){return this.resolveStatusAccessAdminOnly$.value}enableSvgAsImg(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{svgAsImg:!0}}),this.svgAsImg$.value===!0)return;this.svgAsImg$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enableSvgAsImg: ",e)}}disableSvgAsImg(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{svgAsImg:!1}}),this.svgAsImg$.value===!1)return;this.svgAsImg$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disableSvgAsImg: ",e)}}getSvgAsImg$(){return this.svgAsImg$.asObservable()}getSvgAsImg(){return this.svgAsImg$.value}enableCommentToNearestAllowedElement(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{commentToNearestAllowedElement:!0}}),this.commentToNearestAllowedElement$.value===!0)return;this.commentToNearestAllowedElement$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enableCommentToNearestAllowedElement: ",e)}}disableCommentToNearestAllowedElement(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{commentToNearestAllowedElement:!1}}),this.commentToNearestAllowedElement$.value===!1)return;this.commentToNearestAllowedElement$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disableCommentToNearestAllowedElement: ",e)}}getCommentToNearestAllowedElement$(){return this.commentToNearestAllowedElement$.asObservable()}getCommentToNearestAllowedElement(){return this.commentToNearestAllowedElement$.value}enableFocusedThreadMode(){try{if(this.focusedThreadMode$.value===!0)return;this.focusedThreadMode$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enableFocusedThreadMode: ",e)}}disableFocusedThreadMode(){try{if(this.focusedThreadMode$.value===!1)return;this.focusedThreadMode$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disableFocusedThreadMode: ",e)}}getFocusedThreadMode$(){return this.focusedThreadMode$.asObservable()}enableReadOnly(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{readOnly:!0}}),this.readOnly$.value===!0)return;this.readOnly$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enableReadOnly: ",e)}}disableReadOnly(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{readOnly:!1}}),this.readOnly$.value===!1)return;this.readOnly$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disableReadOnly: ",e)}}getReadOnly$(){return this.readOnly$.asObservable()}getReadOnly(){return this.readOnly$.value}sanitizeCommentAnnotation(e){try{return e?.comments?.length&&e.comments.forEach(i=>{i?.commentHtml&&(i.commentHtml=this.domService.sanitizeHtml(i.commentHtml))}),e}catch(i){return this.loggingService.catch("Error in CommentService sanitizeCommentAnnotation: ",i),e}}enableCustomAutocompleteSearch(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{customAutocompleteSearch:!0}}),this.customAutocompleteSearch$.value===!0)return;this.customAutocompleteSearch$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enableCustomAutocompleteSearch: ",e)}}disableCustomAutocompleteSearch(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{customAutocompleteSearch:!1}}),this.customAutocompleteSearch$.value===!1)return;this.customAutocompleteSearch$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disableCustomAutocompleteSearch: ",e)}}getCustomAutocompleteSearch$(){return this.customAutocompleteSearch$.asObservable()}getCustomAutocompleteSearch(){return this.customAutocompleteSearch$.value}enableDeleteThreadWithFirstComment(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{deleteThreadWithFirstComment:!0}}),this.deleteThreadWithFirstComment$.value===!0)return;this.deleteThreadWithFirstComment$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enableDeleteThreadWithFirstComment: ",e)}}disableDeleteThreadWithFirstComment(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{deleteThreadWithFirstComment:!1}}),this.deleteThreadWithFirstComment$.value===!1)return;this.deleteThreadWithFirstComment$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disableDeleteThreadWithFirstComment: ",e)}}getDeleteThreadWithFirstComment$(){return this.deleteThreadWithFirstComment$.asObservable()}enableExpandMentionGroups(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{expandMentionGroups:!0}}),this.expandMentionGroups$.value===!0)return;this.expandMentionGroups$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enableExpandMentionGroups: ",e)}}disableExpandMentionGroups(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{expandMentionGroups:!1}}),this.expandMentionGroups$.value===!1)return;this.expandMentionGroups$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disableExpandMentionGroups: ",e)}}getExpandMentionGroups$(){return this.expandMentionGroups$.asObservable()}getExpandMentionGroups(){return this.expandMentionGroups$.value}enableShowMentionGroupsFirst(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{showMentionGroupsFirst:!0}}),this.showMentionGroupsFirst$.value===!0)return;this.showMentionGroupsFirst$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enableShowMentionGroupsFirst: ",e)}}disableShowMentionGroupsFirst(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{showMentionGroupsFirst:!1}}),this.showMentionGroupsFirst$.value===!1)return;this.showMentionGroupsFirst$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disableShowMentionGroupsFirst: ",e)}}getShowMentionGroupsFirst$(){return this.showMentionGroupsFirst$.asObservable()}getShowMentionGroupsFirst(){return this.showMentionGroupsFirst$.value}enableShowMentionGroupsOnly(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{showMentionGroupsOnly:!0}}),this.showMentionGroupsOnly$.value===!0)return;this.showMentionGroupsOnly$.next(!0)}catch(e){this.loggingService.catch("Error in CommentService enableShowMentionGroupsOnly: ",e)}}disableShowMentionGroupsOnly(){try{if(this.analyticsService.setFeatureConfig({feature:Re.COMMENT,config:{showMentionGroupsOnly:!1}}),this.showMentionGroupsOnly$.value===!1)return;this.showMentionGroupsOnly$.next(!1)}catch(e){this.loggingService.catch("Error in CommentService disableShowMentionGroupsOnly: ",e)}}getShowMentionGroupsOnly$(){return this.showMentionGroupsOnly$.asObservable()}getShowMentionGroupsOnly(){return this.showMentionGroupsOnly$.value}setAnalyticsFeatureConfig({config:e,feature:i}){try{this.analyticsService.setFeatureConfig({feature:i||Re.COMMENT,config:e})}catch(r){this.loggingService.catch("Error in CommentService setAnalyticsFeatureConfig: ",r)}}};o.\u0275fac=function(i){return new(i||o)(J(Qe),J(fc),J(bn),J($t),J(lt),J(pn),J(je),J(Fe),J(vi),J(gm),J(gi),J(Bp),J(Vo),J(Wi),J(gn),J(y),J(Vn),J($o),J(er),J(Ise),J(yi),J(Xa),J(Gv),J(fm),J($v),J(Lp))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var b=(()=>{let _DynamicDataService=class _DynamicDataService{constructor(n,o,t,e,i){this.authService=n,this.commentService=o,this.loggingService=t,this.injector=e,this.docService=i,this.subscriptions=[],this.commonData$=new fe({}),this.evaluateConditionTriggered=new De,this.conditionRegex=/\{(.*?)\}/g,this.extractedProps={},this.condition="",this.dataComponentConfigSignal=be({});try{this.subscriptions.push(this.authService.getUser$().subscribe(r=>{this.commonData$.next(T(I({},this.commonData$.value),{user:r}))})),this.subscriptions.push(this.commentService.getUnreadCommentAnnotationCountOnCurrentDocument$().subscribe(r=>{this.commonData$.next(T(I({},this.commonData$.value),{unreadCommentAnnotationCount:r?.count||0}))})),this.subscriptions.push(this.commentService.getUnreadCommentCountOnCurrentDocument$().subscribe(r=>{this.commonData$.next(T(I({},this.commonData$.value),{unreadCommentCount:r?.count||0}))})),this.subscriptions.push(this.docService.getUIState$().subscribe(r=>{this.commonData$.next(I(I({},this.commonData$.value),r))})),this.subscriptions.push(this.getCommonData().subscribe(r=>{this.dataComponentConfigSignal.update(a=>(a=I(I({},a),r),a)),this.executeConditionalClasses()})),this.subscriptions.push(this.evaluateConditionTriggered.subscribe(r=>{this.extractedProps=r.extractedProps,this.evaluateCondition(r.className,r.elementRef,r.condition)}))}catch(r){this.loggingService.catch("Error in DynamicDataService constructor: ",r)}}ngOnDestroy(){try{this.subscriptions.forEach(n=>n.unsubscribe())}catch(n){this.loggingService.catch("Error in DynamicDataService ngOnDestroy: ",n)}}getCommonData(){return this.commonData$.asObservable()}getModifiedPathBasedOnCondition(n,o){try{return Object.keys(o).forEach(t=>{o[t].path=this.modifyPathBasedOnCondition(t,n)}),o}catch(t){this.loggingService.catch("Error in DynamicDataService getModifiedPathBasedOnCondition: ",t)}}getComputedValues(n,o,t,e,i,r){try{Object.keys(t).forEach(a=>{let s;if(Pi(n)?s=Hi(()=>la(n(),t[a].path)):s=Hi(()=>la(n,t[a].path)),Pi(s()))pr(()=>{try{let c=s()();t[a].value=c,this.evaluateConditionTriggered.emit({extractedProps:t,className:e,elementRef:i,condition:r})}catch{}},{injector:this.injector,allowSignalWrites:!0});else{let c=s();t[a].value=c,this.evaluateConditionTriggered.emit({extractedProps:t,className:e,elementRef:i,condition:r})}})}catch(a){this.loggingService.catch("Error in DynamicDataService getComputedValues: ",a)}}modifyPathBasedOnCondition(n,o){try{let t=n;if(n.startsWith("userContact."))t=n.replace("userContact","selectorItem.contact");else if(n.startsWith("comment."))t=n.replace("comment","commentObj");else if(n.startsWith("commentAnnotation."))t=n.replace("commentAnnotation","componentConfigSignal.annotation");else if(n.startsWith("commentAnnotations."))t=n.replace("commentAnnotations","componentConfigSignal.annotations");else{let e=n.match(/^([^.\[]+)/),i=e?e[1]:"";if(i&&o&&typeof o=="function"&&o()&&i in o()){let r=n.match(/\[(.*?)\]/);if(r&&r[1]){let a=r[1];if(a.includes(".")){let s=a.split(".")[0];s&&o()&&s in o()?t=n:t=n.replace(`[${a}]`,`[componentConfigSignal.${a}]`)}else t=n}else t=n}else t="componentConfigSignal."+n}return t}catch(t){return this.loggingService.catch("Error in DynamicDataService modifyPathBasedOnCondition: ",t),n}}applyConditionalClasses(n,o){try{this.elementRef=n,this.data=o}catch(t){this.loggingService.catch("Error in DynamicDataService applyConditionalClasses: ",t)}}executeConditionalClasses(){try{let n=this.getHostElementAttributes(this.elementRef),t=[...Object.keys(n).filter(e=>e.startsWith("velt-class-")).map(e=>({name:e,value:n[e]}))];if(n["velt-class"]){let e=n["velt-class"],i=/'([^']+)':\s*([^,]+)(?:,|$)/g,r=[],a=0,s=100,c;for(;(c=i.exec(e))!==null;){if(a++>s){this.loggingService.catch("Too many class definitions detected.");break}if(c.length<3)continue;let[,p,h]=c;!p||!h||p.split(" ").forEach(_=>{_.trim()&&r.push({name:`velt-class-${_.trim()}`,value:h.trim()})})}t=[...t,...r]}this.data&&typeof this.data=="object"&&Object.keys(this.data).forEach(e=>{this.updateDataComponentConfigSignal(e,this.data[e])}),t.forEach(e=>{let i=e.name.replace("velt-class-","");this.condition=e.value,this.condition&&(this.extractProps(),this.extractedProps=this.getModifiedPathBasedOnCondition(this.dataComponentConfigSignal,this.extractedProps),this.getComputedValues(this.dataComponentConfigSignal,this.evaluateCondition,this.extractedProps,i,this.elementRef,e.value))})}catch(n){this.loggingService.catch("Error in DynamicDataService applyConditionalClasses: ",n)}}updateDataComponentConfigSignal(n,o){try{n==="dataComponentConfigSignal"?this.dataComponentConfigSignal.set(o):this.dataComponentConfigSignal.update(t=>T(I({},t),{[n]:o}))}catch(t){this.loggingService.catch("Error in DataComponent updateDataComponentConfigSignal: ",t)}}extractProps(){try{this.extractedProps={},this.conditionRegex.lastIndex=0;let n;for(;(n=this.conditionRegex.exec(this.condition))!==null;){let o=n[1];this.extractedProps[o]={value:null,path:null,isDynamicPath:this.hasDynamicParts(o)}}}catch(n){this.loggingService.catch("Error in DynamicDataService extractProps: ",n)}}hasDynamicParts(n){try{let o=/\[[^\]'"]*[^\]'"]\]/.test(n),t=/\[[^[\]]*[\.\[][^[\]]*\]/.test(n);return o||t}catch(o){return this.loggingService.catch("Error checking for dynamic path: ",o),!1}}evaluateCondition(n,o,t){try{if(t){let e=this.extractedProps,i=t.replace(this.conditionRegex,(s,c)=>{let p=e[c];return p&&p.value!==void 0?typeof p.value=="string"?`'${p.value}'`:p.value:"false"}),r=this.sanitizeCondition(i),a=this.safeEval(r);return n&&o&&(a?this.setHostElementClasses(o,n):this.removeHostElementClasses(o,n)),a}return!1}catch(e){return this.loggingService.catch("Error in IfComponent evaluateCondition: ",e),!1}}sanitizeCondition(n){try{return n.replace(/[^a-zA-Z0-9\s\+\-\*\/\%\(\)\!\=\<\>\|\&\.\[\]\{\},'"]/g,"")}catch(o){return this.loggingService.catch("Error in IfComponent sanitizeCondition: ",o),""}}safeEval(expression){try{return eval(expression)}catch(n){return!1}}getHostElementAttributes(n){try{let o=n,t={};for(let e of o.attributes)t[e.name]=e.value;return t}catch{return{}}}setHostElementClasses(n,o){try{n.classList.add(o)}catch{}}removeHostElementClasses(n,o){try{n.classList.remove(o)}catch{}}};_DynamicDataService.\u0275fac=function(o){return new(o||_DynamicDataService)(J(je),J(Te),J(y),J(Et),J(lt))},_DynamicDataService.\u0275prov=Ae({token:_DynamicDataService,factory:_DynamicDataService.\u0275fac,providedIn:"root"});let DynamicDataService=_DynamicDataService;return DynamicDataService})();var H=(()=>{let o=class o{set veltIf(e){try{e&&this.setIfCondition(e)}catch(i){this._loggingService.catch("Error in BaseComponent set veltIf:",i)}}constructor(e,i,r){this._elementRef=e,this._dynamicDataService=i,this._loggingService=r,this.componentConfigSignal=be({}),this.veltElement=!0,this.conditionSignal=be(null)}initializeComponentConfigSignal(e){try{this.componentConfigSignal.set(e)}catch(i){this._loggingService.catch("Error in BaseComponent initializeComponentConfigSignal:",i)}}ngOnInit(){try{this._dynamicDataService.applyConditionalClasses(this._elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal})}catch(e){this._loggingService.catch("Error in BaseComponent ngOnInit:",e)}}ngOnDestroy(){}setIfCondition(e){try{this.conditionSignal.set(e)}catch(i){this._loggingService.catch("Error in BaseComponent setIfCondition:",i)}}};o.\u0275fac=function(i){return new(i||o)(u(N),u(b),u(y))},o.\u0275cmp=M({type:o,selectors:[["app-base"]],hostVars:1,hostBindings:function(i,r){i&2&&x("data-velt-element",r.veltElement)},inputs:{componentConfigSignal:"componentConfigSignal",template:"template",wireframe:"wireframe",veltIf:"veltIf"},standalone:!1,decls:0,vars:0,template:function(i,r){},encapsulation:2});let n=o;return n})();var nt=(()=>{let o=class o extends H{onDarkModeChange(){return this.darkModeSubject$.asObservable()}constructor(e,i,r,a,s,c,p){super(e,c,p),this._elementRef=e,this._themeService=i,this._changeDetector=r,this._featureService=a,this._componentDarkModeObservable=s,this._componentDarkMode=null,this._globalDarkMode=!1,this._featureDarkMode=!1,this._themeSubscriptions=[],this._darkMode=!1,this.darkMode=!1,this.darkModeSubject$=new fe(!1);try{this._themeSubscriptions.push(this._themeService.getDarkMode$().subscribe(h=>{this._globalDarkMode=h,this.setDarkMode()})),this._featureService&&(this._featureService instanceof Te?this._themeSubscriptions.push(this._featureService.getCommentContainerDarkMode().subscribe(h=>{this._featureDarkMode=h,this.setDarkMode()})):this._featureService instanceof er&&this._themeSubscriptions.push(this._featureService.getDarkMode$().subscribe(h=>{h!==null&&(this._featureDarkMode=h),this.setDarkMode()}))),this._componentDarkModeObservable&&this._componentDarkModeObservable instanceof Ft&&this._themeSubscriptions.push(this._componentDarkModeObservable.subscribe(h=>{this._componentDarkMode=h,this.setDarkMode()}))}catch{}}ngOnInit(){super.ngOnInit()}ngOnChanges(e){try{if(e._darkMode){let i=e._darkMode.currentValue;typeof i=="string"&&(i=i==="true"),this._componentDarkMode=i,this.setDarkMode()}}catch{}}setComponentDarkMode(e){try{this._componentDarkMode=e,this.setDarkMode()}catch{}}setDarkMode(){try{this._componentDarkMode===null?this._featureDarkMode?this.darkMode=!0:this.darkMode=!!this._globalDarkMode:this.darkMode=!!this._componentDarkMode,this.darkMode?this._elementRef.nativeElement.hasAttribute("dark")||this._elementRef.nativeElement.setAttribute("dark",""):this._elementRef.nativeElement.hasAttribute("dark")&&this._elementRef.nativeElement.removeAttribute("dark"),this.darkModeSubject$.next(this.darkMode),this._changeDetector&&this._changeDetector.markForCheck()}catch{}}ngOnDestroy(){try{super.ngOnDestroy(),this._themeSubscriptions.forEach(e=>{e.unsubscribe()})}catch{}}};o.\u0275fac=function(i){return new(i||o)(u(N),u(Ye),u(Xt),u("FeatureService",8),u(Ft),u(b),u(y))},o.\u0275cmp=M({type:o,selectors:[["app-themed"]],inputs:{_darkMode:[0,"darkMode","_darkMode"]},standalone:!1,features:[B,qe],decls:0,vars:0,template:function(i,r){},encapsulation:2,changeDetection:0});let n=o;return n})();var Ge=(()=>{let o=class o{constructor(e){this.loggingService=e,this.wireframeMap=new fe(new Map);try{this.loggingService.log("%c[WB] Creating CLASS: WireframeService","color: blue;")}catch(i){this.loggingService.catch("Error in WireframeService constructor: ",i)}}setWireframe(e,i){try{let r=this.wireframeMap.value;r.set(e,i),this.wireframeMap.next(r)}catch(r){this.loggingService.catch("Error in WireframeService setWireframe: ",r)}}setWireframeMap(e){try{let i=this.wireframeMap.value;e.forEach((r,a)=>{i.set(a,r)}),this.wireframeMap.next(i)}catch(i){this.loggingService.catch("Error in WireframeService setWireframeMap: ",i)}}getWireframe(e,i=!0){try{let r=this.wireframeMap.value,a=r.get(e);if(!a&&i){let s=e?.split("---")[0];s&&(a=r.get(s))}return a&&(a?.children?.length>0||a?.innerHTML?.trim()?.length>0)?a:void 0}catch(r){this.loggingService.catch("Error in WireframeService getWireframe: ",r);return}}getConditionElement(e,i=!0){try{let r=this.wireframeMap.value,a=r.get(e);if(!a&&i){let s=e?.split("---")[0];s&&(a=r.get(s))}return a}catch(r){this.loggingService.catch("Error in WireframeService getConditionElement: ",r);return}}getWireframe$(e,i=!0){return this.wireframeMap.asObservable().pipe(ce(r=>this.getWireframe(e,i)))}setChildren(e){try{this.wireframeMap.next(e)}catch(i){this.loggingService.catch("Error in WireframeService setChildren: ",i)}}getWireframeMap(){return this.wireframeMap.value}};o.\u0275fac=function(i){return new(i||o)(J(y))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var xse=n=>({componentConfigSignal:n}),o9e=(n,o)=>({condition:n,data:o}),r9e=(n,o,t,e,i)=>({template:n,context:o,componentName:"velt-confirm-dialog-wireframe",variant:t,setIfCondition:e,componentElementRef:i});function a9e(n,o){if(n&1&&(f(0),w(1,"app-confirm-dialog-title",5)(2,"app-confirm-dialog-message",5),C(3,"div",6),w(4,"app-confirm-dialog-reject",5)(5,"app-confirm-dialog-approve",5),S(),v()),n&2){let t=l(3);d(),m("componentConfigSignal",t.componentConfigSignal),d(),m("componentConfigSignal",t.componentConfigSignal),d(2),m("componentConfigSignal",t.componentConfigSignal),d(),m("componentConfigSignal",t.componentConfigSignal)}}function s9e(n,o){if(n&1&&(f(0),g(1,a9e,6,4,"ng-container",4),v()),n&2){let t=l().ngIf,e=l();d(),m("veltDynamicTemplate",$(3,r9e,e.template,P(1,xse,e.componentConfigSignal),t.variant,e.setIfCondition.bind(e),e.elementRef))}}function l9e(n,o){if(n&1&&(f(0),g(1,s9e,2,9,"ng-container",3),v()),n&2){let t=l();d(),m("veltIf",F(3,o9e,t.conditionSignal(),P(1,xse,t.componentConfigSignal)))}}var da=(()=>{let o=class o extends nt{constructor(e,i,r,a,s,c,p){super(s,a,void 0,void 0,void 0,p,e),this.loggingService=e,this.dialogRef=i,this.wireframeService=r,this.themeService=a,this.elementRef=s,this.dynamicDataService=p,this.subscriptions=[],this.componentConfigSignal=be({title:"",message:"",yesButton:"",noButton:"",variant:"",closeDialog:this.closeDialog.bind(this)}),this.veltElement=!0;try{c&&(this.componentConfigSignal.update(h=>(h=I(I({},h),c),h)),c?.darkMode&&[!0,!1].includes(c?.darkMode)&&super.setComponentDarkMode(c?.darkMode)),this.setZIndex()}catch(h){this.loggingService.catch("Error in ConfirmDialogComponent constructor: ",h)}}ngOnInit(){try{this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;");let e="velt-confirm-dialog-wireframe";super.ngOnInit(),this.componentConfigSignal().variant&&(e+=`---${this.componentConfigSignal().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}}))}catch(e){this.loggingService.catch("Error in ConfirmDialogComponent OnInit: ",e)}}ngOnDestroy(){super.ngOnDestroy();try{this.subscriptions.forEach(e=>e.unsubscribe())}catch(e){this.loggingService.catch("Error in ConfirmDialogComponent OnDestroy: ",e)}}setZIndex(){try{if(this.dialogRef){let e=this.dialogRef._overlayRef;e&&(e.backdropElement&&(e.backdropElement.style.zIndex="2147483647"),e.hostElement&&(e.hostElement.style.zIndex="2147483647"))}}catch(e){this.loggingService.catch("Error in ConfirmDialogComponent setZIndex: ",e)}}closeDialog(e){try{this.dialogRef.close(e)}catch(i){this.loggingService.catch("Error in ConfirmDialogComponent closeDialog: ",i)}}};o.\u0275fac=function(i){return new(i||o)(u(y),u(Ko),u(Ge),u(Ye),u(N),u(cl,8),u(b))},o.\u0275cmp=M({type:o,selectors:[["snippyly-confirm-dialog"]],hostVars:1,hostBindings:function(i,r){i&2&&x("data-velt-element",r.veltElement)},standalone:!1,features:[j([b]),B],decls:3,vars:4,consts:[["floatingConfirmationRef",""],[1,"velt-confirm-dialog",3,"snippylyOverlay","snippylyOverlayZIndex","snippylyOverlayBackdropZIndex"],[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[3,"componentConfigSignal"],["mat-dialog-actions",""]],template:function(i,r){if(i&1&&(C(0,"div",1,0),g(2,l9e,2,6,"ng-container",2),S()),i&2){let a=de(1);m("snippylyOverlay",a)("snippylyOverlayZIndex",1200)("snippylyOverlayBackdropZIndex",1100),d(2),m("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}*[_ngcontent-%COMP%]{outline:0}[_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-confirm-dialog[_ngcontent-%COMP%]{width:455px;padding:40px;display:block;box-sizing:border-box;background-color:var(--velt-background-0)}.mat-mdc-dialog-actions[_ngcontent-%COMP%]{justify-content:space-between;gap:var(--velt-spacing-md);min-height:auto} mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface:has(snippyly-confirm-dialog){border-radius:var(--velt-border-radius-xl);padding:0}@media (max-width: 768px){.velt-confirm-dialog[_ngcontent-%COMP%]{width:auto;max-width:455px;padding:24px}}"],changeDetection:0});let n=o;return n})();var fc=(()=>{let o=class o{constructor(e,i,r,a,s,c,p,h,_,E,A,V){this.analyticsService=e,this.configService=i,this.docService=r,this.databaseService=a,this.commonDbService=s,this.authService=c,this.domService=p,this.afAuth=h,this.iamService=_,this.dialog=E,this.loggingService=A,this.notificationService=V,this.areaAnnotationById$=new fe({}),this.documentPaths=null,this.db=Ci(),this.areaEnabled$=new fe(!0),this.allowedElementIds$=new fe([]),this.addAreaMode$=new fe(!1),this.loggingService.log("%c[WB] Creating CLASS: AreaService","color: blue;"),this.analyticsService.setAreaService(this),this.authService.setAreaService(this),this.databaseService.getDb().pipe(Ne(G=>!!G),Je(1)).subscribe(G=>{G&&(this.db=G,this.getDocumentPaths())},G=>{this.loggingService.catch("Error in AreaService getDb subscription: ",G)}),this.domService.onWindowPointerMove$().subscribe(G=>{if(this.addAreaMode$.value){this.highlightElement&&this.domService.removeHighlightFromElement(this.highlightElement);let X=this.domService.getBackgroundElement(G.clientX,G.clientY);X&&(this.isElementInsideAllowedElements(X)?GO(G.target)?this.domService.removeClassFromElement(document.body,"show-pin-cursor"):(this.domService.addClassToElement(document.body,"show-pin-cursor"),this.highlightElement=X,this.domService.highlightElement(this.highlightElement,U.CURSOR.AREA_PIN)):this.domService.removeClassFromElement(document.body,"show-pin-cursor"))}},G=>{this.loggingService.catch("Error in AreaService onWindowPointerMove$ subscription: ",G)}),this.domService.onWindowKeyupEsc$().subscribe(G=>{this.addAreaMode$.value&&this.disableAddAreaMode()},G=>{this.loggingService.catch("Error in AreaService onWindowKeyupEsc$ subscription: ",G)}),this.domService.onDocumentClick$().subscribe(G=>{if(G&&this.addAreaMode$.value){if(G.preventDefault(),G.stopPropagation(),!GO(G.target)){let X=this.domService.getBackgroundElement(G.clientX,G.clientY);X&&this.isElementInsideAllowedElements(X)&&this.addArea(G)}this.disableAddAreaMode()}},G=>{this.loggingService.catch("Error in AreaService onDocumentClick$ subscription: ",G)}),this.addAreaMode$.subscribe(G=>{this.highlightElement&&this.domService.removeHighlightFromElement(this.highlightElement),G?this.domService.addClassToElement(document.body,"snippyly-add-area-mode"):(this.domService.removeClassFromElement(document.body,"snippyly-add-area-mode"),this.domService.removeClassFromElement(document.body,"show-pin-cursor"))},G=>{this.loggingService.catch("Error in AreaService addAreaMode$ subscription: ",G)}),this.domService.onWindowKeyupBackspace$().subscribe(G=>{this.deleteAreaPinAnnotations("keyupBackspace")},G=>{this.loggingService.catch("Error in AreaService onWindowKeyupBackspace$ subscription: ",G)}),this.domService.onWindowKeyupDelete$().subscribe(G=>{this.deleteAreaPinAnnotations("keyupDelete")},G=>{this.loggingService.catch("Error in AreaService onWindowKeyupDelete$ subscription: ",G)})}clearCache(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCache in AreaService","color: green;");try{this.areaAnnotationById$.next({}),this.areaEnabled$.next(!0),this.allowedElementIds$.next([]),this.addAreaMode$.next(!1),this.highlightElement=null}catch(e){this.loggingService.catch("Error in AreaService clearCache: ",e)}}getDocumentPaths(){this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentPaths","color: green;"),this.docService.getDocumentPaths$()}setAllowedElementIds(e){this.allowedElementIds$.next(e||[])}getAllowedElementIds(){return this.allowedElementIds$.asObservable()}getAllAreaAnnotations(e,i,r){this.loggingService.log("%c[WB] Calling FUNCTION: getAllAreaAnnotations","color: green;");let a,s;try{if(e&&(s=fn(e)),i&&typeof i=="object"){let c=Xo(i);a=fn(JSON.stringify(c))}}catch(c){this.loggingService.catch("Error in AreaService getAllAreaAnnotations: ",c)}return Wn(this.afAuth).pipe(Ne(c=>!!c),ge(c=>this.isFeatureAllowed({firebaseUser:c,annotations:[],filteredAnnotations:[]})),ge(c=>c.featureAllowed?this.iamService.isUserAllowed$().pipe(ce(p=>(c.featureAllowed=p,c))):re(c)),ge(c=>c.featureAllowed?this.authService.isPlanExpired$().pipe(ce(p=>(c.featureAllowed=!p,c))):re(c)),ge(c=>c.featureAllowed?re(c).pipe(ge(p=>this.docService.getDocumentPaths$().pipe(ce(h=>(this.documentPaths=h,p.documentPaths=h,p)))),ge(p=>s?this.getDataFromDocumentIds([s]).pipe(ce(h=>(p.annotations=h||[],I({},p)))):this.docService.getDocumentIds$().pipe(ge(h=>{let _=h?.length>0?h.map(E=>E.documentId):[this.documentPaths?.documentId??""];return this.getDataFromDocumentIds(_).pipe(ce(E=>(p.annotations=E||[],I({},p))))}))),ge(p=>this.docService.getLocation$().pipe(ce(h=>(p.location=h,p)))),ge(p=>this.docService.getLocations$().pipe(ce(h=>(p.customLocations=h,p)))),ce(p=>{if(p.filteredAnnotations=[],s&&!a)return p.filteredAnnotations=p.annotations?.slice(),p;{let h=[],_=[];return a?h.push(a):(h.push(p?.location?.locationId),h.push(...Object.values(p?.customLocations||[]).map(E=>E.locationId)),p?.location?.location?.id&&_.push(p?.location?.location?.id)),p.filteredAnnotations=this.filterAnnotationsByLocationIds(p?.annotations,h,_),p}}),ge(p=>r?re(p):p?.annotations?.length?this.domService.onWindowResize$().pipe(ce(()=>p)):re(p)),ge(p=>r?re(p):p?.annotations?.length?this.domService.onDomChange$("AreaService getAllAreaAnnotations").pipe(ce(()=>p)):re(p)),ce(p=>(p.filteredAnnotations=p.filteredAnnotations?.map(h=>{let _=Object.assign({},h);return _.areaProperties=this.calculateAreaAnnotationPosition(_),_}),p)),ge(p=>p?.filteredAnnotations?re(p?.filteredAnnotations||[]):re([])),ge(p=>{if(this.authService.isFeatureAllowed(Re.COMMENT))return re(p);{let h=p?.filter(_=>!_?.targetAnnotations?.filter(E=>E?.type===Re.COMMENT)?.length);return re(h)}})):re([])),Kt(_o))}isFeatureAllowed(e){return this.configService.getConfig$().pipe(Ne(i=>!!i),ce(i=>T(I({},e),{config:i})),ge(i=>this.authService.getUser$().pipe(ce(r=>T(I({},i),{user:r})))),ge(i=>Zi(i.config,i.user,Re.AREA)?re(T(I({},i),{featureAllowed:!0})):(this.loggingService.warn("Area feature is not allowed."),re(T(I({},i),{featureAllowed:!1})))))}getDataFromDocumentIds(e,i){return this.getDataFromDocuments({documentIds:e,filters:i})}getDataFromDocuments(e){if(this.configService.getApiKey()){let{documentIds:i,filters:r}=e;if(i?.some(p=>!p)||!this.documentPaths)return re([]);let a=this.docService.getFolderConfig(),s=re([]),c={useCollectionGroup:!0,isCollection:!0,useQuery:!0};if(this.commonDbService.shouldUseFirestore()||(c.documentId=i?.length?i[0]:void 0,c.organizationId=this.documentPaths?.organizationId),a?.veltFolderId&&a?.allDocuments)s=this.commonDbService.dbListener({feature:"allAreas",properties:T(I({},c),{firestoreQuery:[Fi(mt("metadata.apiKey","==",this.configService?.getApiKey()),mt("metadata.veltFolderId","==",a?.veltFolderId),mt("metadata.organizationId","==",this.documentPaths?.organizationId))]})});else{let p=[];for(let h=0;h<(i?.length??0);h+=U.LISTENER_BATCH_SIZE)p.push(i?.slice(h,h+U.LISTENER_BATCH_SIZE)??[]);s=Dn(p.map(h=>this.commonDbService.dbListener({feature:"allAreas",properties:T(I({},c),{firestoreQuery:[Fi(mt("metadata.apiKey","==",this.configService?.getApiKey()),mt("metadata.documentId","in",h),mt("metadata.organizationId","==",this.documentPaths?.organizationId),...a?.veltFolderId?[mt("metadata.veltFolderId","==",a?.veltFolderId)]:[])]})}).pipe($r()))).pipe(ce(h=>ca(h)))}return s.pipe(ce(({data:p,operation:h})=>{let _=[];return p&&(_=Object.values(p??{}).filter(E=>typeof E=="object")),{data:_,operation:h}}),ce(({data:p,operation:h})=>{if(!i)return{data:p,documentMap:{},operation:h};let _=p.reduce((E,A)=>{let V=A.metadata?.documentId;return V&&(E[V]||(E[V]=[]),E[V].push(A)),E},{});return{data:p,documentMap:_,operation:h}}),ce(({data:p,documentMap:h,operation:_})=>{if(!r)if(_?.type==="removed"){if(_?.ids?.length){let E=this.areaAnnotationById$.value;_?.ids?.forEach(A=>{delete E?.[A]}),this.areaAnnotationById$.next(E)}}else Object.entries(h??{}).forEach(([E,A])=>{this.setAreaAnnotationsByOrganizationIdAndDocumentId({organizationId:this.documentPaths?.organizationId,documentId:E,annotations:A})});return p}))}else return re([])}setAreaAnnotationsByOrganizationIdAndDocumentId({organizationId:e,documentId:i,annotations:r,queryHash:a}){try{if(i){e||(e=U.NO_ORGANIZATION_ID),a||(a=U.DEFAULT_QUERY_HASH);let s={};r?.forEach(p=>{p?.annotationId&&(s[p?.annotationId]=p)});let c=I(I({},this.areaAnnotationById$.value),s);this.areaAnnotationById$.next(c)}}catch(s){this.loggingService.catch("Error in AreaService setAreaAnnotationsByOrganizationIdAndDocumentId:",s)}}getAnnotationById(e){try{return this.areaAnnotationById$.value?.[e]?this.areaAnnotationById$.value?.[e]:void 0}catch(i){this.loggingService.catch("Error in AreaService getAnnotationById: ",i);return}}filterAnnotationsByLocationIds(e,i,r){try{return e.filter(a=>i.includes(a.locationId)||r?.includes(a?.location?.id)||i?.find(s=>s==a?.location?.id)||r?.find(s=>s==a?.locationId+""))}catch(a){return this.loggingService.catch("Error in AreaService filterAnnotationsByLocations:",a),[]}}calculateAreaAnnotationPosition(e){try{if(e.targetElements?.length){let i=e.targetElements[0],r=e.targetElements[1];if(i?.xpath&&r?.xpath){let a=this.domService.getElementFromXPath(i.xpath);a&&Ui(a)&&(a=null),!a&&i.cfXpath&&(a=this.domService.getElementFromXPath(i.cfXpath),a&&Ui(a)&&(a=null)),!a&&i.fXpath&&(a=this.domService.getElementFromXPath(i.fXpath),a&&Ui(a)&&(a=null));let s=this.domService.getElementFromXPath(r.xpath);if(s&&Ui(s)&&(s=null),!s&&r.cfXpath&&(s=this.domService.getElementFromXPath(r.cfXpath),s&&Ui(s)&&(s=null)),!s&&r.fXpath&&(s=this.domService.getElementFromXPath(r.fXpath),s&&Ui(s)&&(s=null)),a&&s){let c=IV(a,s);if(c){let p=a.getBoundingClientRect(),h={};p&&p.width&&p.height&&(h={top:p.height*i.topPercentage/100,left:p.width*i.leftPercentage/100});let _=s.getBoundingClientRect(),E={};_&&_.width&&_.height&&(E={top:_.height*r.topPercentage/100,left:_.width*r.leftPercentage/100});let A=EV(h.left,h.top,a,c),V=EV(E.left,E.top,s,c),G,X,he,Ie,Pe={};A.x>V.x?A.y>V.y?(Ie={x:A.x,y:A.y},G={x:V.x,y:V.y},Pe.handle1=Ie,Pe.handle2=G):(X={x:A.x,y:A.y},he={x:V.x,y:V.y},Pe.handle1=X,Pe.handle2=he):A.y>V.y?(he={x:A.x,y:A.y},X={x:V.x,y:V.y},Pe.handle1=he,Pe.handle2=X):(G={x:A.x,y:A.y},Ie={x:V.x,y:V.y},Pe.handle1=G,Pe.handle2=Ie);let Be={topLeft:G||{x:he?.x,y:X?.y},bottomRight:Ie||{x:X?.x,y:he?.y},topRight:X||{x:Ie?.x,y:G?.y},bottomLeft:he||{x:G?.x,y:Ie?.y}};return Pe.coordinates=Be,Pe.targetElement=this.domService.getXPath(c),Pe}}}}return}catch(i){this.loggingService.catch("Error in AreaService calculateAreaAnnotationPosition:",i);return}}addArea(e,i=[],r,a,s){this.loggingService.log("%c[WB] Calling FUNCTION: addArea","color: green;");try{let c=this.authService.getUser();if(c)if(c.isReadOnly||c.isAnonymous)this.loggingService.catch("Anonymous/Readonly users cannot add areas.");else{let p=new tM;a&&(p.annotationId=a),p.from=c,p.color=U.DEFAULT_ANNOTATION_COLOR,p.lastUpdated=this.timestamp,r&&(p.targetAnnotations=[r]),p.props=new vl;let h=this.domService.getCurrentWindowSizeValue();if(p.props.screenWidth=h.screenWidth,p.props.screenHeight=h.screenHeight,p.props.screenScrollHeight=h.screenScrollHeight,p.props.viewportWidth=window.innerWidth,p.props.viewportHeight=window.innerHeight,e||i?.length>0){let A=e?this.getPointsForAreaPinAnnotation(e):i;p.targetElements=[],A.forEach(V=>{p.targetElements.push(this.getTargetElementForAreaPinAnnotation(e,{clientX:V.x,clientY:V.y}))})}this.setLocationToAreaAnnotation(p),s&&(p.locationId=s.locationId,p.location=s.location),p.pageInfo=_i(),p.pageInfo&&(p.pageInfo.screenWidth=this.domService.getCurrentWindowSizeValue()?.screenWidth);let _=this.getElementForAreaAnnotation(p),E=this.docService.getBaseMetadata("area",{element:_});return p?.metadata||(p.metadata={}),p.metadata=I(I({},p.metadata),E),this.saveAreaToDb(p),p}return}catch(c){this.loggingService.catch("Error in AreaService addArea: ",c);return}}setLocationToAreaAnnotation(e){try{let i=this.docService.getLocation();i?(e.locationId=i.locationId,e.location=i.location):(delete e.locationId,delete e.location)}catch(i){this.loggingService.catch("Error in AreaService setLocationToAreaAnnotation:",i)}}getElementForAreaAnnotation(e){try{let i,r,a;return e.targetElements?.length&&(e.targetElements[0]?.xpath&&(r=this.domService.getElementFromXPath(e.targetElements[0].xpath)),e.targetElements[1]?.xpath&&(a=this.domService.getElementFromXPath(e.targetElements[1].xpath))),i=IV(r,a),i}catch(i){return this.loggingService.catch("Error in AreaService getElementForAreaAnnotation: ",i),null}}saveAreaToDb(e){this.loggingService.log("%c[WB] Calling FUNCTION: saveAreaToDb","color: green;");try{this.authService.getUser()&&this.authService.isFeatureAllowed(Re.AREA)&&Dn([this.docService.getDocumentPaths$(),this.databaseService.getDb()]).pipe(Ne(([i,r])=>!!i&&!!r),Je(1),ge(([i,r])=>{if(this.documentPaths=i,this.db=r,this.documentPaths?.area){let a=on(this.db,`${this.documentPaths?.area}`),s;e.annotationId?s=on(this.db,`${this.documentPaths?.area}/${e.annotationId}`):e.annotationId=this.commonDbService.generateDocumentId(),e.pageInfo&&(e.pageInfo.areaUrl=this.generateAreaUrl(e));let c=JSON.parse(JSON.stringify(e));if(c.position=null,!c?.metadata?.documentId){c?.metadata||(c.metadata={});let _=this.docService.getBaseMetadata();c.metadata=I(I({},c?.metadata),_)}this.domService.toggleAnnotationSelection(c),this.analyticsService.trackEvent(Z.Events.Area.AREA_ADDED,{annotationId:e.annotationId});let{documentId:p,organizationId:h}=this.getDocumentIdAndOrganizationIdFromAreaAnnotation(e);return this.commonDbService.setData({feature:"area",properties:{id:e.annotationId,documentId:p,organizationId:h},data:JSON.parse(JSON.stringify(c))})}else return re(null)})).subscribe(()=>{},i=>{this.loggingService.catch("Error in AreaService saveAreaToDb subscription: ",i)})}catch(i){this.loggingService.catch("Error in AreaService saveAreaToDb: ",i)}}getDocumentIdAndOrganizationIdFromAreaAnnotation(e){try{return{documentId:e?.metadata?.documentId,organizationId:e?.metadata?.organizationId}}catch(i){return this.loggingService.catch("Error in AreaService getDocumentIdAndOrganizationIdFromAreaAnnotation: ",i),{}}}updateArea(e,i=!1,r){try{r&&this.setLocationToAreaAnnotation(e),i&&this.updateNotificationsDatabase(e,UO.UPDATED),this.updateAreaToDb(e)}catch(a){this.loggingService.catch("Error in AreaService updateArea: ",a)}}updateAreaToDb(e){this.loggingService.log("%c[WB] Calling FUNCTION: updateAreaToDb","color: green;");try{if(this.domService.updateSelectedAnnotationInMap([e]),this.authService.getUser()&&this.authService.isFeatureAllowed(Re.AREA)){let i=JSON.parse(JSON.stringify(e));if(i.position=null,!i?.metadata?.documentId){i?.metadata||(i.metadata={});let s=this.docService.getBaseMetadata();i.metadata=I(I({},i?.metadata),s)}let{documentId:r,organizationId:a}=this.getDocumentIdAndOrganizationIdFromAreaAnnotation(e);this.commonDbService.setData({feature:"area",properties:{id:e.annotationId,documentId:r,organizationId:a},data:JSON.parse(JSON.stringify(i))})}}catch(i){this.loggingService.catch("Error in AreaService updateAreaToDb: ",i)}}deleteAreaPinAnnotations(e){try{let i=this.domService.getSelectedAnnotationsMap(),r=this.authService.getUser(),a=[];Object.keys(i??{}).forEach(s=>ee(this,null,function*(){let c=i[s];c.type==="area"&&r&&c.from&&(r?.isAdmin||c.from.userId===r.userId)&&a.push(c)})),a?.length&&(this.analyticsService.trackEvent(Z.Events.Area.AREA_DELETE_TRIGGERED,{triggerType:e,annotationId:a.map(s=>s.annotationId).join()}),this.dialog.open(da,{data:{title:"Delete area?",message:"This selected area will be deleted.",yesButton:"Delete",noButton:"Cancel",variant:"area"}}).afterClosed().pipe(Je(1)).subscribe(s=>{s&&(a.forEach(c=>ee(this,null,function*(){yield this.deleteAreaPinAnnotation(c)})),setTimeout(()=>{document.querySelectorAll(`[${U.SNIPPYLY_HIGHLIGHT}]`).forEach(p=>{this.domService.removeHighlightFromElement(p)})},100))})),this.domService.resetSelectedAnnotationsMap(!0,"area")}catch(i){this.loggingService.catch("Error in AreaService deleteAreaPinAnnotations: ",i)}}getAreaAnnotationsByOrganizationIdAndDocumentId({organizationId:e,documentId:i}){try{let r={};return Object.values(this.areaAnnotationById$.value??{}).forEach(a=>{a?.metadata?.documentId==i&&a?.metadata?.organizationId==e&&(r[a?.annotationId]=a)}),Object.values(r??{})}catch(r){return this.loggingService.catch("Error in AreaService getAreaAnnotationsByOrganizationIdAndDocumentId:",r),[]}}onDeleteTargetAnnotation(e,i){try{if(this.docService.getDocumentId()&&this.areaAnnotationById$.value){let a=Object.values(this.areaAnnotationById$.value||{}),s;i?s=a.find(c=>c?.annotationId===i):s=a.find(c=>c?.targetAnnotations?.find(p=>p?.annotationId===e)),s&&(s.targetAnnotations=s.targetAnnotations?.filter(c=>c?.annotationId!==e),s.targetAnnotations?.length?this.updateAreaToDb(s):this.deleteAreaPinAnnotation(s))}}catch(r){this.loggingService.catch("Error in AreaService onDeleteTargetAnnotation: ",r)}}deleteAreaPinAnnotation(e){if(this.authService.isFeatureAllowed(Re.AREA)&&this.documentPaths?.area&&e?.annotationId){this.updateNotificationsDatabase(e,UO.DELETED),this.analyticsService.trackEvent(Z.Events.Area.AREA_DELETED,{annotationId:e.annotationId});let{documentId:i,organizationId:r}=this.getDocumentIdAndOrganizationIdFromAreaAnnotation(e);return this.commonDbService.deleteData({feature:"area",properties:{id:e.annotationId,documentId:i,organizationId:r}})}else return Promise.resolve()}enableArea(){try{this.areaEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in AreaService enableArea: ",e)}}disableArea(){try{this.areaEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in AreaService disableArea: ",e)}}getAreaEnabled$(){try{return this.areaEnabled$.asObservable()}catch(e){return this.loggingService.catch("Error in AreaService getAreaEnabled$: ",e),re(!1)}}getAreaEnabled(){try{return this.areaEnabled$.value}catch(e){return this.loggingService.catch("Error in AreaService getAreaEnabled: ",e),!1}}enableAddAreaMode(){this.authService.isFeatureAllowed(Re.AREA)?(this.analyticsService.trackEvent(Z.Events.Area.AREA_ADD_MODE_ENABLED),this.addAreaMode$.next(!0)):this.loggingService.catch("Error in AreaService enableAddAreaMode: ","Area feature is not enabled.")}disableAddAreaMode(){this.analyticsService.trackEvent(Z.Events.Area.AREA_ADD_MODE_DISABLED),this.addAreaMode$.next(!1)}addAreaModeChange(){return this.addAreaMode$.asObservable()}getTargetElementForAreaPinAnnotation(e,i){try{let r=e,a=r?.touches?.length?r.touches[0]?.clientX:r?.clientX,s=r?.touches?.length?r.touches[0]?.clientY:r?.clientY;i&&(a=i.clientX,s=i.clientY);let c=this.domService.getBackgroundElement(a,s);if(c){let p=this.domService.getXPath(c),h=this.domService.getXPath(c,!0),_=this.domService.getXPath(c,!0,!0),E=c.getBoundingClientRect(),A=a-E.x,V=s-E.y,G=A*100/(E.width||1),X=V*100/(E.height||1);return{xpath:p,fXpath:h,cfXpath:_,leftPercentage:G,topPercentage:X}}else return null}catch(r){return this.loggingService.catch("Error in AreaService getTargetElementForAreaPinAnnotation: ",r),null}}getPointsForAreaPinAnnotation(e){let i=[],r=e,a=r?.touches?.length?r.touches[0]?.clientX:r.clientX,s=r?.touches?.length?r.touches[0]?.clientY:r.clientY;return i.push({x:a,y:s}),i.push({x:a+100,y:s+100}),i}get timestamp(){return this.commonDbService.getServerTimestamp()}isElementInsideAllowedElements(e){try{return this.domService.isElementInsideListedElementIds(e,this.allowedElementIds$.value)}catch(i){return this.loggingService.catch("Error in AreaService isElementInsideAllowedElements: ",i),!1}}updateNotificationsDatabase(e,i){try{let r={annotationData:e,actionType:i,notificationSource:"area"};this.notificationService.updateNotificationDatabase(r)}catch(r){this.loggingService.catch("Error in AreaService updateNotificationsDatabase: ",r)}}getAreaUrl(e){try{return e?.pageInfo?.areaUrl?e.pageInfo.areaUrl:(e?.pageInfo||(e.pageInfo=_i(),e.pageInfo&&(e.pageInfo.screenWidth=this.domService.getCurrentWindowSizeValue()?.screenWidth)),e.pageInfo.areaUrl=this.generateAreaUrl(e),this.updateArea(e),e.pageInfo?.areaUrl)}catch(i){this.loggingService.catch("Error in AreaService getAreaUrl: ",i);return}}generateAreaUrl(e){let i=new URL(window.location.href);return i.searchParams.delete(U.URL_PARAMS.TAG_ID),i.searchParams.append(U.URL_PARAMS.TAG_ID,e.annotationId),i.href}generateAreaAnnotationId(){return ee(this,null,function*(){try{if(this.docService.getDocumentPaths()?.area){let i=this.commonDbService.generateDocumentId();return yield Ip(10),i||""}else return""}catch(e){return this.loggingService.catch("Error in AreaService generateAreaAnnotationId: ",e),""}})}};o.\u0275fac=function(i){return new(i||o)(J(Qe),J($t),J(lt),J(pn),J(bn),J(je),J(Fe),J(vi),J(gn),J(Wi),J(y),J(Vn))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var li=class{constructor(o){this.injector=o,this.hideAnalytics=!1}ha(o){try{this.hideAnalytics=o}catch{}}getService(o){return this.injector.get(o)}trackEvent(o,t={},e=!0){try{this.hideAnalytics||(t||(t={}),t=T(I({},t),{source:"external"}),this.getService(Qe).trackAuthenticatedEvent(o,t,e))}catch(i){this.getService(y).catch("Error in _trackEvent: ",i);return}}};var PM=class extends li{constructor(o){super(o),this.getService(y).log("%c[WB] Creating CLASS: AreaElement","color: blue;"),this.enableArea=this._enableAreaComment,this.disableArea=this._disableAreaComment,this.enableAreaComment=this._enableAreaComment,this.disableAreaComment=this._disableAreaComment}_enableAreaComment(){this.getService(y).log("%c[WB] Calling FUNCTION: enableAreaComment","color: green;");try{this.trackEvent(Z.Events.Area.ENABLE_AREA_COMMENT_TRIGGERED),this.getService(fc).enableArea()}catch(o){this.getService(y).catch("Error in _enableAreaComment: ",o)}}_disableAreaComment(){this.getService(y).log("%c[WB] Calling FUNCTION: disableAreaComment","color: green;");try{this.trackEvent(Z.Events.Area.DISABLE_AREA_COMMENT_TRIGGERED),this.getService(fc).disableArea()}catch(o){this.getService(y).catch("Error in _disableAreaComment: ",o)}}};var vm=(()=>{let o=class o{constructor(e,i,r,a,s,c,p,h,_,E,A,V){this.analyticsService=e,this.configService=i,this.docService=r,this.databaseService=a,this.authService=s,this.domService=c,this.afAuth=p,this.iamService=h,this.dialog=_,this.loggingService=E,this.notificationService=A,this.commonDbService=V,this.arrowAnnotations$=new fe({}),this.arrowAnnotationsByDocumentId$=new fe({}),this.documentPaths=null,this.db=Ci(),this.allowedElementIds$=new fe([]),this.addArrowMode$=new fe(!1),this.loggingService.log("%c[WB] Creating CLASS: ArrowService","color: blue;"),this.databaseService.getDb().pipe(Ne(G=>!!G),Je(1)).subscribe(G=>{G&&(this.db=G,this.getDocumentPaths())},G=>{this.loggingService.catch("Error in ArrowService getDb subscription: ",G)}),this.domService.onWindowPointerMove$().subscribe(G=>{if(this.addArrowMode$.value){let X=!0,he=this.domService.getBackgroundElement(G.clientX,G.clientY);he&&(this.isElementInsideAllowedElements(he)?zO(G.target)?this.domService.removeClassFromElement(document.body,"show-pin-cursor"):(this.domService.addClassToElement(document.body,"show-pin-cursor"),this.highlightElement&&this.highlightElement!==he&&this.domService.removeHighlightFromElement(this.highlightElement),this.highlightElement=he,this.domService.highlightElement(this.highlightElement,U.CURSOR.ARROW_PIN),X=!1):this.domService.removeClassFromElement(document.body,"show-pin-cursor")),this.highlightElement&&X&&(this.domService.removeHighlightFromElement(this.highlightElement),this.highlightElement=null)}},G=>{this.loggingService.catch("Error in ArrowService onWindowPointerMove$ subscription: ",G)}),this.domService.onWindowKeyupEsc$().subscribe(G=>{this.addArrowMode$.value&&this.disableAddArrowMode()},G=>{this.loggingService.catch("Error in ArrowService onWindowKeyupEsc$ subscription: ",G)}),this.domService.onDocumentClick$().subscribe(G=>{if(G&&this.addArrowMode$.value){if(!zO(G.target)){let X=this.domService.getBackgroundElement(G.clientX,G.clientY);X&&this.isElementInsideAllowedElements(X)&&(G.preventDefault(),G.stopPropagation(),this.addArrow(G))}this.disableAddArrowMode()}},G=>{this.loggingService.catch("Error in ArrowService onDocumentClick$ subscription: ",G)}),this.addArrowMode$.subscribe(G=>{this.highlightElement&&this.domService.removeHighlightFromElement(this.highlightElement),G?this.domService.addClassToElement(document.body,"snippyly-add-arrow-mode"):(this.domService.removeClassFromElement(document.body,"snippyly-add-arrow-mode"),this.domService.removeClassFromElement(document.body,"show-pin-cursor"))},G=>{this.loggingService.catch("Error in ArrowService addArrowMode$ subscription: ",G)}),this.domService.onWindowKeyupBackspace$().subscribe(G=>{this.deleteArrowPinAnnotations("keyupBackspace")},G=>{this.loggingService.catch("Error in ArrowService onWindowKeyupBackspace$ subscription: ",G)}),this.domService.onWindowKeyupDelete$().subscribe(G=>{this.deleteArrowPinAnnotations("keyupDelete")},G=>{this.loggingService.catch("Error in ArrowService onWindowKeyupDelete$ subscription: ",G)})}getDocumentPaths(){this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentPaths","color: green;"),this.docService.getDocumentPaths$()}setAllowedElementIds(e){this.allowedElementIds$.next(e||[])}getAllowedElementIds(){return this.allowedElementIds$.asObservable()}getAllArrowAnnotations(e,i,r){this.loggingService.log("%c[WB] Calling FUNCTION: getAllArrowAnnotations","color: green;");let a,s;try{if(e&&(s=fn(e)),i&&typeof i=="object"){let c=Xo(i);a=fn(JSON.stringify(c))}}catch(c){this.loggingService.catch("Error in ArrowService getAllArrowAnnotations: ",c)}return Wn(this.afAuth).pipe(Ne(c=>!!c),ge(c=>this.isFeatureAllowed({firebaseUser:c,annotations:[],filteredAnnotations:[]})),ge(c=>c.featureAllowed?this.iamService.isUserAllowed$().pipe(ce(p=>(c.featureAllowed=p,c))):re(c)),ge(c=>c.featureAllowed?this.authService.isPlanExpired$().pipe(ce(p=>(c.featureAllowed=!p,c))):re(c)),ge(c=>c.featureAllowed?re(c).pipe(ge(p=>this.docService.getDocumentPaths$().pipe(ce(h=>(this.documentPaths=h,p.documentPaths=h,p)))),ge(p=>this.getDataFromDocumentId(s).pipe(ce(h=>(p.annotations=h||[],I({},p))))),ge(p=>this.docService.getLocation$().pipe(ce(h=>(p.location=h,p)))),ge(p=>this.docService.getLocations$().pipe(ce(h=>(p.customLocations=h,p)))),ce(p=>{if(p.filteredAnnotations=[],s&&!a)return p.filteredAnnotations=p.annotations?.slice(),p;{let h=[];return a?h.push(a):(h.push(p?.location?.locationId),h.push(...Object.values(p?.customLocations||[]).map(_=>_.locationId))),p.filteredAnnotations=this.filterAnnotationsByLocationIds(p?.annotations,h),p}}),ge(p=>r?re(p):p?.annotations?.length?this.domService.onWindowResize$().pipe(ce(()=>p)):re(p)),ge(p=>r?re(p):p?.annotations?.length?this.domService.onDomChange$("ArrowService getAllArrowAnnotations").pipe(ce(()=>p)):re(p)),ce(p=>(p?.filteredAnnotations?.forEach(h=>{this.calculateArrowAnnotationPosition(h)}),p)),ge(p=>p?.filteredAnnotations?re(p?.filteredAnnotations||[]):re([]))):re([])),Kt(_o))}isFeatureAllowed(e){return this.configService.getConfig$().pipe(Ne(i=>!!i),ce(i=>T(I({},e),{config:i})),ge(i=>this.authService.getUser$().pipe(ce(r=>T(I({},i),{user:r})))),ge(i=>Zi(i.config,i.user,Re.ARROW)?re(T(I({},i),{featureAllowed:!0})):(this.loggingService.warn("Arrow feature is not allowed."),re(T(I({},i),{featureAllowed:!1})))))}getDataFromDocumentId(e){return this.databaseService.getDb().pipe(Ne(i=>!!i),ge(i=>(this.db=i,this.loggingService.log(this.db),this.configService.getApiKey()&&this.documentPaths?.arrow&&this.documentPaths?this.commonDbService.dbListener({feature:"allArrows",properties:{documentId:e??this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(ce(r=>({data:r?.data,operation:r?.operation})),ce(({data:r,operation:a})=>{let s=[];return r&&(s=Object.values(r).filter(c=>typeof c=="object")),{data:s,operation:a}}),Ln(r=>(this.loggingService.catch("Error in ArrowService getDataFromDocumentId: ",r),re({data:[],operation:null}))),ce(({data:r,operation:a})=>{if(a?.type==="removed"){if(a?.ids?.length){let s=this.arrowAnnotationsByDocumentId$.value;a?.ids?.forEach(c=>{delete s?.[c]}),this.arrowAnnotationsByDocumentId$.next(s)}}else this.setArrowAnnotationsByDocumentId(e||this.documentPaths?.documentId,r);return r})):re([]))))}setArrowAnnotationsByDocumentId(e,i){try{if(e){let r=T(I({},this.arrowAnnotationsByDocumentId$.value),{[e]:i});this.arrowAnnotationsByDocumentId$.next(r)}}catch(r){this.loggingService.catch("Error in ArrowService setArrowAnnotationsByDocumentId:",r)}}filterAnnotationsByLocationIds(e,i){try{return e.filter(r=>i.includes(r.locationId))}catch(r){return this.loggingService.catch("Error in ArrowService filterAnnotationsByLocations:",r),[]}}calculateArrowAnnotationPosition(e){try{if(e.targetElement){let i=this.domService.getXPath(e.targetElement?.xpath);if(i){let r=i.iterateNext();if(r&&xo(r)){let a=r.getBoundingClientRect();if(a&&a.width&&a.height){let{height:s,width:c}=Ep(r);e.position={top:s*e.targetElement.topPercentage/100,left:c*e.targetElement.leftPercentage/100}}else e.position=null}else e.position=null}else e.position=null}}catch(i){this.loggingService.catch("Error in ArrowService calculateArrowAnnotationPosition:",i)}}addArrow(e){this.loggingService.log("%c[WB] Calling FUNCTION: addArrow","color: green;");try{let i=this.authService.getUser();if(i)if(i.isReadOnly||i.isAnonymous)this.loggingService.catch("Anonymous/Readonly users cannot add arrows.");else{let r=new nM;r.from=i,r.color=i?.color||U.DEFAULT_ANNOTATION_COLOR,r.lastUpdated=this.timestamp,r.props=new vl;let a=this.domService.getCurrentWindowSizeValue();if(r.props.screenWidth=a.screenWidth,r.props.screenHeight=a.screenHeight,r.props.screenScrollHeight=a.screenScrollHeight,r.props.viewportWidth=window.innerWidth,r.props.viewportHeight=window.innerHeight,r.props.arrowLength=U.VELT_MIN_ARROW_LENGTH,(e?.clientX||0)>U.VELT_MIN_ARROW_LENGTH?r.props.arrowAngle=135:r.props.arrowAngle=45,e&&(r.targetElement=this.domService.getTargetElementForCursorPosition(e)),r?.targetElement?.xpath){let s=this.domService.getXPath(r.targetElement.xpath);if(s){let c=s.iterateNext();c&&(xo(c)||(r.targetElement=null))}}this.setLocationToArrowAnnotation(r),r.pageInfo=_i(),r.pageInfo&&(r.pageInfo.screenWidth=this.domService.getCurrentWindowSizeValue()?.screenWidth),this.saveArrowToDb(r)}}catch(i){this.loggingService.catch("Error in ArrowService addArrow: ",i)}}setLocationToArrowAnnotation(e){try{let i=this.docService.getLocation();i?(e.locationId=i.locationId,e.location=i.location):(delete e.locationId,delete e.location);try{if(e.targetElement?.xpath){let r=this.domService.getElementFromXPath(e.targetElement.xpath),a=this.docService.getAdditionLocationFromElement(r);if(a){let s=this.docService.addLocation(a);s&&(e.locationId=s.locationId,e.location=s.location)}}}catch{}}catch(i){this.loggingService.catch("Error in ArrowService setLocationToArrowAnnotation:",i)}}saveArrowToDb(e){this.loggingService.log("%c[WB] Calling FUNCTION: saveArrowToDb","color: green;");try{this.authService.getUser()&&this.authService.isFeatureAllowed(Re.ARROW)&&this.docService.getDocumentPaths$().pipe(Ne(i=>!!i),Je(1),ge(i=>(this.documentPaths=i,this.loggingService.log(this.documentPaths),this.databaseService.getDb().pipe(Ne(r=>!!r),Je(1),ge(r=>{if(this.db=r,this.loggingService.log(this.db),this.documentPaths?.arrow){let a=on(this.db,`${this.documentPaths?.arrow}`);e.annotationId=this.commonDbService.generateDocumentId(),e.pageInfo&&(e.pageInfo.arrowUrl=this.generateArrowUrl(e));let s=JSON.parse(JSON.stringify(e));return s.position=null,this.domService.toggleAnnotationSelection(s),this.analyticsService.trackEvent(Z.Events.Arrow.ARROW_DRAFT_ADDED,{annotationId:e.annotationId}),this.commonDbService.setData({feature:"arrow",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:e.annotationId,skipFirestore:!0},data:JSON.parse(JSON.stringify(s))})}else return re(null)}))))).subscribe(()=>{},i=>{this.loggingService.catch("Error in ArrowService saveArrowToDb subscription: ",i)})}catch(i){this.loggingService.catch("Error in ArrowService saveArrowToDb: ",i)}}updateArrow(e,i=!1,r){try{r&&this.setLocationToArrowAnnotation(e),i&&this.updateNotificationsDatabase(e,VO.UPDATED),this.updateArrowToDb(e)}catch(a){this.loggingService.catch("Error in ArrowService updateArrow: ",a)}}updateArrowToDb(e){this.loggingService.log("%c[WB] Calling FUNCTION: updateArrowToDb","color: green;");try{if(e?.targetElement?.xpath){let i=this.domService.getXPath(e.targetElement.xpath);if(i){let r=i.iterateNext();r&&(xo(r)||(e.targetElement=null))}}this.domService.updateSelectedAnnotationInMap([e]),this.authService.getUser()&&this.authService.isFeatureAllowed(Re.ARROW)&&this.docService.getDocumentPaths$().pipe(Ne(i=>!!i),Je(1),ge(i=>(this.documentPaths=i,this.loggingService.log(this.documentPaths),this.databaseService.getDb().pipe(Ne(r=>!!r),Je(1),ge(r=>{if(this.db=r,this.loggingService.log(this.db),this.documentPaths?.arrow&&e?.annotationId){let a=JSON.parse(JSON.stringify(e));return a.position=null,this.commonDbService.setData({feature:"arrow",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:e.annotationId,skipFirestore:!0},data:JSON.parse(JSON.stringify(a))})}else return re(null)}))))).subscribe(()=>{},i=>{this.loggingService.catch("Error in ArrowService updateArrowToDb subscription: ",i)})}catch(i){this.loggingService.catch("Error in ArrowService updateArrowToDb: ",i)}}deleteArrowPinAnnotations(e){try{let i=this.domService.getSelectedAnnotationsMap(),r=this.authService.getUser(),a=[];Object.keys(i).forEach(s=>ee(this,null,function*(){let c=i[s];if(c.type==="arrow"){let p=r&&!r?.isAnonymous&&!r?.isGuest;r&&c.from&&(p||c.from.userId===r.userId)&&a.push(c)}})),a?.length&&(this.analyticsService.trackEvent(Z.Events.Arrow.ARROW_DELETE_TRIGGERED,{triggerType:e,annotationId:a.map(s=>s.annotationId).join()}),this.dialog.open(da,{data:{title:"Delete arrow?",message:"This selected arrow will be deleted.",yesButton:"Delete",noButton:"Cancel",variant:"arrow"}}).afterClosed().pipe(Je(1)).subscribe(s=>{s&&(a.forEach(c=>ee(this,null,function*(){yield this.deleteArrowPinAnnotation(c)})),setTimeout(()=>{document.querySelectorAll(`[${U.SNIPPYLY_HIGHLIGHT}]`).forEach(p=>{this.domService.removeHighlightFromElement(p)})},100))})),this.domService.resetSelectedAnnotationsMap(!0,"arrow")}catch(i){this.loggingService.catch("Error in ArrowService deleteArrowPinAnnotations: ",i)}}deleteArrowPinAnnotation(e){return this.authService.isFeatureAllowed(Re.ARROW)&&this.documentPaths?.arrow&&e?.annotationId?(this.updateNotificationsDatabase(e,VO.DELETED),this.analyticsService.trackEvent(Z.Events.Arrow.ARROW_DELETED,{annotationId:e.annotationId}),this.commonDbService.deleteData({feature:"arrow",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:e.annotationId,skipFirestore:!0}})):Promise.resolve()}enableAddArrowMode(){this.authService.isFeatureAllowed(Re.ARROW)?(this.analyticsService.trackEvent(Z.Events.Arrow.ARROW_ADD_MODE_ENABLED),this.addArrowMode$.next(!0)):this.loggingService.catch("Error in ArrowService enableAddArrowMode: ","Arrow feature is not enabled.")}disableAddArrowMode(){this.analyticsService.trackEvent(Z.Events.Arrow.ARROW_ADD_MODE_DISABLED),this.addArrowMode$.next(!1)}addArrowModeChange(){return this.addArrowMode$.asObservable()}get timestamp(){return this.commonDbService.getServerTimestamp()}isElementInsideAllowedElements(e){try{return this.domService.isElementInsideListedElementIds(e,this.allowedElementIds$.value)}catch(i){return this.loggingService.catch("Error in ArrowService isElementInsideAllowedElements: ",i),!1}}updateNotificationsDatabase(e,i){try{let r={annotationData:e,actionType:i,notificationSource:"arrow"};this.notificationService.updateNotificationDatabase(r)}catch(r){this.loggingService.catch("Error in ArrowService updateNotificationsDatabase: ",r)}}getArrowUrl(e){try{return e?.pageInfo?.arrowUrl?e.pageInfo.arrowUrl:(e?.pageInfo||(e.pageInfo=_i(),e.pageInfo&&(e.pageInfo.screenWidth=this.domService.getCurrentWindowSizeValue()?.screenWidth)),e.pageInfo.arrowUrl=this.generateArrowUrl(e),this.updateArrow(e),e.pageInfo?.arrowUrl)}catch(i){this.loggingService.catch("Error in ArrowService getArrowUrl: ",i);return}}generateArrowUrl(e){let i=new URL(window.location.href);return i.searchParams.delete(U.URL_PARAMS.TAG_ID),i.searchParams.append(U.URL_PARAMS.TAG_ID,e.annotationId),i.href}};o.\u0275fac=function(i){return new(i||o)(J(Qe),J($t),J(lt),J(pn),J(je),J(Fe),J(vi),J(gn),J(Wi),J(y),J(Vn),J(bn))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var RM=class extends li{constructor(o){super(o),this.getService(y).log("%c[WB] Creating CLASS: ArrowElement","color: blue;"),this.allowedElementIds=this._allowedElementIds}_allowedElementIds(o){this.getService(y).log("%c[WB] Calling FUNCTION: allowedElementIds","color: green;");try{this.trackEvent(Z.Events.Arrow.ALLOWED_ELEMENT_IDS_TRIGGERED,{payload:{elementIds:o}}),this.getService(vm).setAllowedElementIds(o)}catch(t){this.getService(y).catch("Error in allowedElementIds: ",t)}}};var Hs=(()=>{let o=class o{constructor(e){this.loggingService=e,this.autocompleteDataMap$=new fe({}),this.onAutocompleteChipClick$=new et;try{this.loggingService.log("%c[WB] Creating CLASS: AutocompleteService","color: blue;"),this.create({hotkey:"@",type:"contact",data:[]})}catch(i){this.loggingService.catch("Error in AutocompleteService constructor: ",i)}}create(e){try{if(this.loggingService.log("%c[WB] Calling AutocompleteService FUNCTION: create","color: green;"),e?.hotkey){let i=this.autocompleteDataMap$.value;i[e.hotkey]=e,this.autocompleteDataMap$.next(i)}}catch(i){this.loggingService.catch("Error in AutocompleteService create: ",i)}}remove(e){try{this.loggingService.log("%c[WB] Calling AutocompleteService FUNCTION: remove","color: green;");let i=this.autocompleteDataMap$.value;delete i[e],this.autocompleteDataMap$.next(i)}catch(i){this.loggingService.catch("Error in AutocompleteService remove: ",i)}}getAutocompleteDataMap$(){return this.autocompleteDataMap$.asObservable()}getAutocompleteDataMap(){return this.autocompleteDataMap$.value}setOnAutocompleteChipClick(e){this.onAutocompleteChipClick$.next(e)}getOnAutocompleteChipClick$(){return this.onAutocompleteChipClick$.asObservable()}};o.\u0275fac=function(i){return new(i||o)(J(y))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var FM=class extends li{constructor(o){super(o),this.getService(y).log("%c[WB] Creating CLASS: AutocompleteElement","color: blue;"),this.create=this._create,this.onAutocompleteChipClick=this._onAutocompleteChipClick}_create(o){this.getService(y).log("%c[WB] Calling FUNCTION: create","color: green;");try{return this.trackEvent(Z.Events.Autocomplete.CREATE_TRIGGERED,{payload:{data:o}}),this.getService(Hs).create(o)}catch(t){this.getService(y).catch("Error in _create: ",t)}}_onAutocompleteChipClick(){this.getService(y).log("%c[WB] Calling FUNCTION: onAutocompleteChipClick","color: green;");try{return this.trackEvent(Z.Events.Autocomplete.ON_AUTOCOMPLETE_CHIP_CLICK_TRIGGERED),this.getService(Hs).getOnAutocompleteChipClick$()}catch(o){return this.getService(y).catch("Error in _onAutocompleteChipClick: ",o),re(null)}}};var ni=(()=>{let o=class o{constructor(e,i,r,a,s,c,p,h,_,E,A){this.analyticsService=e,this.authService=i,this.commentService=r,this.contactService=a,this.customFilterService=s,this.docService=c,this.iamService=p,this.loggingService=h,this.metadataService=_,this.reactionService=E,this.commonDbService=A,this.actionSubjects=new Map,this.defaultSource="internal",this.isUserAdmin=!1,this.subscriptions=[],this.loggingService.log("%c[WB] Creating CLASS: CommentActionsService","color: blue;");try{this.commentService.setCommentActionsService(this),this.iamService.isUserAdmin$().subscribe(V=>{this.isUserAdmin=V})}catch(V){this.loggingService.catch("Error in CommentActionsService constructor: ",V)}}addCommentAnnotation(a,s){return ee(this,arguments,function*({annotation:e,options:i},r){try{return this.loggingService.log("%c[WB] Calling CommentActionsService FUNCTION: addCommentAnnotation","color: green;"),new Promise(c=>{this.commentService.addComment(void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,p=>ee(this,null,function*(){let h=yield this.getAddCommentAnnotationEventFromCommentAddEventData(p);c(h)}),void 0,void 0,e)})}catch(c){return this.loggingService.catch("Error in CommentActionsService addCommentAnnotation: ",c),null}})}getAddCommentAnnotationEventFromCommentAddEventData(e){return ee(this,null,function*(){try{let i=yield this.metadataService.getGlobalMetadata();return{commentAnnotation:$n(e?.annotation),annotationId:e?.annotation?.annotationId,metadata:i,addContext:e?.addContext,elementRef:e?.elementRef}}catch(i){return this.loggingService.catch("Error in CommentActionsService getAddCommentAnnotationEventFromData: ",i),null}})}triggerAddCommentAnnotationEvent(e){try{this.triggerAction(qi.ADD_COMMENT_ANNOTATION,e)}catch(i){this.loggingService.catch("Error in CommentActionsService triggerAddCommentAnnotationEvent: ",i)}}triggerAnnotationNotFoundError(e){try{this.loggingService.catch("Annotation not found:","The annotation with the given id was not found.")}catch(i){this.loggingService.catch("Error in CommentActionsService triggerAnnotationNotFoundError: ",i)}}deleteCommentAnnotation(a,s){return ee(this,arguments,function*({annotationId:e,options:i},r){try{if(this.loggingService.log("%c[WB] Calling CommentActionsService FUNCTION: deleteCommentAnnotation","color: green;"),!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),null;let p=this.commentService.getAnnotationById(e,i);if(p){let h=this.authService.getUser();if(this.isUserAdmin||h?.userId===p?.from?.userId){this.commentService.deleteCommentPinAnnotation(p);let _=yield this.metadataService.getGlobalMetadata(),E={annotationId:p.annotationId,commentAnnotation:$n(p),metadata:_};return this.triggerAction(qi.DELETE_COMMENT_ANNOTATION,E),E}else this.loggingService.catch("Access Denied","You must be the author of the comment or an admin to delete it.")}else this.triggerAnnotationNotFoundError(e);return null}catch(c){return this.loggingService.catch("Error in CommentActionsService deleteCommentAnnotation: ",c),null}})}updatePriority(s,c){return ee(this,arguments,function*({annotationId:e,priority:i,options:r},a){try{if(this.loggingService.log("%c[WB] Calling CommentActionsService FUNCTION: updatePriority","color: green;"),!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),null;let h=this.commentService.getAnnotationById(e,r);if(h){h=JSON.parse(JSON.stringify(h));let _=h.priority?JSON.parse(JSON.stringify(h.priority)):null;_&&i&&_?.id===i?.id?h.priority=void 0:h.priority=i,this.commentService.saveComment(h,{type:jt.PRIORITY_CHANGED,newPriority:i,oldPriority:_});let E=yield this.metadataService.getGlobalMetadata(),A={newPriority:i,oldPriority:_,annotationId:e,commentAnnotation:$n(h),metadata:E};return this.triggerAction(qi.UPDATE_PRIORITY,A),this.analyticsService.trackEvent(Z.Events.Comments.COMMENT_PRIORITY_CHANGED,{annotationId:e,commentType:this.commentService.getCommentType(h),oldPriority:h.priority,newPriority:i,commentMode:this.commentService.getCommentMode(),source:a??this.defaultSource}),A}else this.triggerAnnotationNotFoundError(e);return null}catch(p){return this.loggingService.catch("Error in CommentActionsService updatePriority: ",p),null}})}updateStatus(s,c){return ee(this,arguments,function*({annotationId:e,status:i,options:r},a){try{if(this.loggingService.log("%c[WB] Calling CommentActionsService FUNCTION: updateStatus","color: green;"),!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),null;let h=this.commentService.getAnnotationById(e,r);if(h){h=JSON.parse(JSON.stringify(h));let _=h.status?JSON.parse(JSON.stringify(h.status)):null;h.status=i,this.commentService.saveComment(h,{type:jt.STATUS_CHANGED,newStatus:i,oldStatus:_});let E=yield this.metadataService.getGlobalMetadata(),A={newStatus:i,oldStatus:_,annotationId:e,commentAnnotation:$n(h),metadata:E};return this.triggerAction(qi.UPDATE_STATUS,A),this.analyticsService.trackEvent(Z.Events.Comments.COMMENT_STATUS_CHANGED,{annotationId:e,commentType:this.commentService.getCommentType(h),oldStatus:_,newStatus:i,commentMode:this.commentService.getCommentMode(),source:a??this.defaultSource}),A}else this.triggerAnnotationNotFoundError(e);return null}catch(p){return this.loggingService.catch("Error in CommentActionsService updateStatus: ",p),null}})}updateAccess(s,c){return ee(this,arguments,function*({annotationId:e,accessMode:i,options:r},a){try{if(this.loggingService.log("%c[WB] Calling CommentActionsService FUNCTION: updateAccess","color: green;"),!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),null;let h=this.commentService.getAnnotationById(e,r);if(h)if(this.isUserAdmin){h=JSON.parse(JSON.stringify(h));let _=h.iam?.accessMode;h.iam.accessMode=i,this.commentService.saveComment(h,{type:jt.ACCESS_MODE_CHANGED,newAccessMode:i,oldAccessMode:_});let E=yield this.metadataService.getGlobalMetadata(),A={newAccessMode:i,oldAccessMode:_,annotationId:e,commentAnnotation:$n(h),metadata:E};switch(this.triggerAction(qi.UPDATE_ACCESS,A),i){case Yi.PRIVATE:this.analyticsService.trackEvent(Z.Events.Comments.COMMENT_ACCESS_MODE_CHANGED,{type:Yi.PRIVATE,source:a??this.defaultSource});break;case Yi.PUBLIC:this.analyticsService.trackEvent(Z.Events.Comments.COMMENT_ACCESS_MODE_CHANGED,{type:Yi.PUBLIC,source:a??this.defaultSource});break;default:break}return A}else this.loggingService.catch("Access Denied","You must be an admin to update the access mode of the comment.");else this.triggerAnnotationNotFoundError(e);return null}catch(p){return this.loggingService.catch("Error in CommentActionsService updateAccess: ",p),null}})}resolveCommentAnnotation(r){return ee(this,arguments,function*({annotationId:e,options:i}){try{if(this.loggingService.log("%c[WB] Calling CommentActionsService FUNCTION: resolveCommentAnnotation","color: green;"),!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),null;let s=this.commentService.getAnnotationById(e,i);if(s){s=JSON.parse(JSON.stringify(s));let c=this.customFilterService.resolvedStatus,p=s.status?JSON.parse(JSON.stringify(s.status)):null;c&&(s.status=c,this.commentService.saveComment(s,{type:jt.STATUS_CHANGED,newStatus:c,oldStatus:p}));let h=yield this.metadataService.getGlobalMetadata(),_={annotationId:e,commentAnnotation:$n(s),metadata:h};return this.triggerAction(qi.RESOLVE_COMMENT,_),_}else this.triggerAnnotationNotFoundError(e);return null}catch(a){return this.loggingService.catch("Error in CommentActionsService resolveCommentAnnotation: ",a),null}})}getLink(a,s){return ee(this,arguments,function*({annotationId:e,options:i},r){try{this.loggingService.log("%c[WB] Calling CommentActionsService FUNCTION: getLink","color: green;");let c=this.commentService.getAnnotationById(e,i);if(c){let p=this.commentService.getCommentUrl(c)??null,h=yield this.metadataService.getGlobalMetadata();return{link:p,annotationId:e,commentAnnotation:$n(c),metadata:h}}else this.triggerAnnotationNotFoundError(e);return null}catch(c){return this.loggingService.catch("Error in CommentActionsService getLink: ",c),null}})}copyLink(a,s){return ee(this,arguments,function*({annotationId:e,options:i},r){try{this.loggingService.log("%c[WB] Calling CommentActionsService FUNCTION: copyLink","color: green;");let c=yield this.getLink({annotationId:e,options:i},r);if(c?.link){vs(c.link),this.commentService.setCopyLink(c.link),this.analyticsService.trackEvent(Z.Events.Comments.COMMENT_LINK_COPIED,{annotationId:e,commentType:this.commentService.getCommentType(c.commentAnnotation),commentMode:this.commentService.getCommentMode(),source:r??this.defaultSource,link:c.link});let p=yield this.metadataService.getGlobalMetadata(),h={link:c.link,annotationId:e,commentAnnotation:$n(c.commentAnnotation),metadata:p};return this.triggerAction(qi.COPY_LINK,h),h}return null}catch(c){return this.loggingService.catch("Error in CommentActionsService copyLink: ",c),null}})}addComment(p,h){return ee(this,arguments,function*({annotationId:e,comment:i,assignedTo:r,assigned:a,options:s},c){try{this.loggingService.log("%c[WB] Calling CommentActionsService FUNCTION: addComment","color: green;");let _=this.authService.getUser();if(!_)return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),null;if(_){let E=this.commentService.getAnnotationById(e,s),A=E?.comments?.length?jt.ADDED:jt.NEWLY_ADDED;if(E){let V=new pc;V=I(I({},V),i),V.lastUpdated=new Date,V.attachments||(V.attachments=[]),V.attachments=V.attachments.filter(he=>he?.attachmentId),V.createdAt=this.timestamp,V.from=_,r&&(E.assignedTo=r),this.commentService.saveComment(E,{type:A,updatedComment:V,assigned:a});let G=yield this.metadataService.getGlobalMetadata(),X={annotationId:e,commentId:V?.commentId,comment:V,commentAnnotation:$n(E),metadata:G};return this.triggerAction(qi.ADD_COMMENT,X),this.analyticsService.trackEvent(Z.Events.Comments.COMMENT_ADDED,{annotationId:e,commentThreadId:i?.commentId,commentType:this.commentService.getCommentType(E),commentMode:this.commentService.getCommentMode(),source:c??this.defaultSource}),X}else this.triggerAnnotationNotFoundError(e)}return null}catch(_){return this.loggingService.catch("Error in CommentActionsService addComment: ",_),null}})}approveCommentAnnotation(a,s){return ee(this,arguments,function*({annotationId:e,options:i},r){try{this.loggingService.log("%c[WB] Calling CommentActionsService FUNCTION: approveCommentAnnotation","color: green;");let c=this.commentService.getAnnotationById(e,i);if(c){c.approved=!0,this.commentService.saveComment(c,{type:jt.APPROVED}),this.analyticsService.trackEvent(Z.Events.Comments.COMMENT_APPROVED,{annotationId:e,commentType:this.commentService.getCommentType(c),commentMode:this.commentService.getCommentMode(),source:r??this.defaultSource});let p=yield this.metadataService.getGlobalMetadata(),h={annotationId:e,commentAnnotation:$n(c),metadata:p};return this.triggerAction(qi.APPROVE_COMMENT_ANNOTATION,h),h}else this.triggerAnnotationNotFoundError(e);return null}catch(c){return this.loggingService.catch("Error in CommentActionsService approveComment: ",c),null}})}acceptCommentAnnotation(a,s){return ee(this,arguments,function*({annotationId:e,options:i},r){try{this.loggingService.log("%c[WB] Calling CommentActionsService FUNCTION: acceptCommentAnnotation","color: green;");let c=this.commentService.getAnnotationById(e,i),p=this.authService.getUser();if(c&&p){let h=c.status?JSON.parse(JSON.stringify(c.status)):null;c.status=U.CommentAcceptStatus,this.commentService.saveComment(c,{type:jt.ACCEPTED,oldStatus:h,newStatus:U.CommentAcceptStatus});let _=yield this.metadataService.getGlobalMetadata(),E={annotationId:e,commentAnnotation:$n(c),metadata:_,actionUser:p,replaceContentHtml:c?.comments?.length?c?.comments[0]?.replaceContentHtml:void 0,replaceContentText:c?.comments?.length?c?.comments[0]?.replaceContentText:void 0};return this.triggerAction(qi.ACCEPT_COMMENT_ANNOTATION,E),this.analyticsService.trackEvent(Z.Events.Comments.COMMENT_ACCEPTED,{annotationId:e,commentType:this.commentService.getCommentType(c),commentMode:this.commentService.getCommentMode(),source:r??this.defaultSource}),E}else this.triggerAnnotationNotFoundError(e);return null}catch(c){return this.loggingService.catch("Error in CommentActionsService acceptCommentAnnotation: ",c),null}})}rejectCommentAnnotation(a,s){return ee(this,arguments,function*({annotationId:e,options:i},r){try{this.loggingService.log("%c[WB] Calling CommentActionsService FUNCTION: rejectCommentAnnotation","color: green;");let c=this.commentService.getAnnotationById(e,i),p=this.authService.getUser();if(c&&p){let h=c.status?JSON.parse(JSON.stringify(c.status)):null;c.status=U.CommentRejectStatus,this.commentService.saveComment(c,{type:jt.REJECTED,oldStatus:h,newStatus:U.CommentRejectStatus});let _=yield this.metadataService.getGlobalMetadata(),E={annotationId:e,commentAnnotation:$n(c),metadata:_,actionUser:p,replaceContentHtml:c?.comments?.length?c?.comments[0]?.replaceContentHtml:void 0,replaceContentText:c?.comments?.length?c?.comments[0]?.replaceContentText:void 0};return this.triggerAction(qi.REJECT_COMMENT_ANNOTATION,E),this.analyticsService.trackEvent(Z.Events.Comments.COMMENT_REJECTED,{annotationId:e,commentType:this.commentService.getCommentType(c),commentMode:this.commentService.getCommentMode(),source:r??this.defaultSource}),E}else this.triggerAnnotationNotFoundError(e);return null}catch(c){return this.loggingService.catch("Error in CommentActionsService rejectCommentAnnotation: ",c),null}})}toggleNotificationSubscription(a,s){return ee(this,arguments,function*({annotationId:e,options:i},r){try{this.loggingService.log("%c[WB] Calling CommentActionsService FUNCTION: toggleNotificationSubscription","color: green;");let c=this.commentService.getAnnotationById(e,i),p=this.authService.getUser();if(c&&p){let h=Rt(p.userId);if(h){c.subscribedUsers||(c.subscribedUsers={}),c.unsubscribedUsers||(c.unsubscribedUsers={});let _,E=!1;if(c?.unsubscribedUsers?.[h])E=!1;else if(c?.subscribedUsers?.[h])E=!0;else{let G=this.contactService.getCurrentOrganizationUserIAM();if(G){let X=G.groups||{};Object.keys(X).forEach(he=>{c?.subscribedGroups?.[he]&&(E=!0)})}}if(r==="subscribe"||!r&&!E)delete c.unsubscribedUsers[h],c.subscribedUsers[h]={user:p,type:"manual"},_=jt.SUBSCRIBED;else if(r==="unsubscribe"||!r&&E)delete c.subscribedUsers[h],c.unsubscribedUsers[h]={user:p,type:"manual"},_=jt.UNSUBSCRIBED;else return null;this.commentService.saveComment(c,{type:_});let A=yield this.metadataService.getGlobalMetadata(),V={annotationId:e,commentAnnotation:$n(c),metadata:A};return _===jt.SUBSCRIBED?this.triggerAction(qi.SUBSCRIBE_COMMENT_ANNOTATION,V):this.triggerAction(qi.UNSUBSCRIBE_COMMENT_ANNOTATION,V),V}}else this.triggerAnnotationNotFoundError(e);return null}catch(c){return this.loggingService.catch("Error in CommentActionsService toggleNotificationSubscription: ",c),null}})}assignUser(s,c){return ee(this,arguments,function*({annotationId:e,assignedTo:i,options:r},a){try{if(this.loggingService.log("%c[WB] Calling CommentActionsService FUNCTION: assignUser","color: green;"),!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),null;let h=this.commentService.getAnnotationById(e,r);if(h){h.assignedTo=i,this.commentService.saveComment(h,{type:jt.ASSIGNED,assignedTo:i});let _=yield this.metadataService.getGlobalMetadata(),E={annotationId:e,assignedTo:i,commentAnnotation:$n(h),metadata:_};return this.triggerAction(qi.ASSIGN_USER,E),this.analyticsService.trackEvent(Z.Events.Comments.COMMENT_ASSIGNED,{annotationId:e,commentType:this.commentService.getCommentType(h),commentMode:this.commentService.getCommentMode(),source:a??this.defaultSource,assignedToUserId:i?.userId}),E}else this.triggerAnnotationNotFoundError(e);return null}catch(p){return this.loggingService.catch("Error in CommentActionsService assignUser: ",p),null}})}getComment(r){return ee(this,arguments,function*({annotationId:e,options:i}){try{this.loggingService.log("%c[WB] Calling CommentActionsService FUNCTION: getComment","color: green;");let a=this.commentService.getAnnotationById(e,i);return a?a.comments||[]:(this.triggerAnnotationNotFoundError(e),[])}catch(a){return this.loggingService.catch("Error in CommentActionsService getComment: ",a),[]}})}updateOrDeleteComment(e,i,r,a,s){return ee(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling CommentActionsService FUNCTION: updateOrDeleteComment","color: green;"),i?.commentText?.trim()||i?.attachments?.length||i?.recorders?.length){let c=this.authService.getUser();if(this.isUserAdmin||c?.userId===i?.from?.userId){i.lastUpdated=new Date,i.status=jt.UPDATED,i.isEdited||(i.isEdited=!0,i.editedAt=new Date),this.commentService.saveComment(e,{type:jt.UPDATED,updatedComment:i});let p=yield this.metadataService.getGlobalMetadata(),h={annotationId:e?.annotationId,commentId:i?.commentId,comment:i,commentAnnotation:$n(e),metadata:p};return this.triggerAction(qi.UPDATE_COMMENT,h),this.analyticsService.trackEvent(Z.Events.Comments.COMMENT_EDITED,{annotationId:e?.annotationId,commentThreadId:i?.commentId,commentType:this.commentService.getCommentType(e),commentMode:this.commentService.getCommentMode(),source:s??this.defaultSource}),h}else this.loggingService.catch("Access Denied","You must be the author of the comment or an admin to update it.")}else yield this.deleteComment({annotationId:e?.annotationId,commentId:i.commentId,skipDeleteThreadConfirmation:r,options:a});return null}catch(c){return this.loggingService.catch("Error in CommentActionsService updateOrDeleteComment: ",c),null}})}updateComment(p,h){return ee(this,arguments,function*({annotationId:e,comment:i,skipDeleteThreadConfirmation:r,merge:a,options:s},c){try{this.loggingService.log("%c[WB] Calling CommentActionsService FUNCTION: updateComment","color: green;");let _=this.commentService.getAnnotationById(e,s),E=this.authService.getUser();if(!E)return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),null;if(_&&E){let A=i,V=_.comments?.find(G=>G.commentId===i.commentId);if(V){if(this.isUserAdmin||E?.userId===V?.from?.userId)return a&&(A=I(I({},V),i)),A.from=V.from,A.createdAt=V.createdAt,A.lastUpdated=new Date,yield this.updateOrDeleteComment(_,A,r,s,c);this.loggingService.catch("Access Denied","You must be the author of the comment or an admin to update it.")}}else this.triggerAnnotationNotFoundError(e);return null}catch(_){return this.loggingService.catch("Error in CommentActionsService updateComment: ",_),null}})}deleteComment(c,p){return ee(this,arguments,function*({annotationId:e,commentId:i,skipDeleteThreadConfirmation:r,options:a},s){try{this.loggingService.log("%c[WB] Calling CommentActionsService FUNCTION: deleteComment","color: green;");let h=this.commentService.getAnnotationById(e,a),_=this.authService.getUser();if(h){let E=h.comments?.find(A=>A?.commentId===i);if(E)if(this.isUserAdmin||_?.userId===E?.from?.userId){this.commentService.saveComment(h,{type:jt.DELETED,updatedComment:E,skipDeleteThreadConfirmation:r});let A=yield this.metadataService.getGlobalMetadata(),V={annotationId:e,commentId:i,commentAnnotation:$n(h),comment:E,metadata:A};return this.triggerAction(qi.DELETE_COMMENT,V),V}else this.loggingService.catch("Access Denied","You must be the author of the comment or an admin to delete it.")}else this.triggerAnnotationNotFoundError(e);return null}catch(h){return this.loggingService.catch("Error in CommentActionsService deleteComment: ",h),null}})}addAttachment(s,c){return ee(this,arguments,function*({annotationId:e,files:i,options:r},a){try{this.loggingService.log("%c[WB] Calling CommentActionsService FUNCTION: addAttachment","color: green;");let p=[],h=this.commentService.getAnnotationById(e,r);if(h||a==="internal"){let A=[];i.forEach(V=>{let{valid:G,file:X,maxAllowedSize:he,error:Ie}=this.validateFile(V);G&&X?A.push(this.uploadFile(X,h||{}).then(Pe=>({valid:G,file:X,maxAllowedSize:he,error:Ie,attachment:Pe||void 0}))):A.push(Promise.resolve({valid:G,file:X,maxAllowedSize:he,error:Ie,attachment:void 0}))}),p=yield Promise.all(A)}else this.triggerAnnotationNotFoundError(e);let _=yield this.metadataService.getGlobalMetadata(),E={annotationId:e,commentAnnotation:h?$n(h):void 0,attachments:p,metadata:_};return this.triggerAction(qi.ADD_ATTACHMENT,E),p}catch(p){return this.loggingService.catch("Error in CommentActionsService addAttachment: ",p),[]}})}validateFile(e){try{this.loggingService.log("%c[WB] Calling CommentActionsService FUNCTION: validateFile","color: green;");let i=100*1024*1024;(e?.type?.includes("image")||e?.type?.includes("pdf"))&&(i=15*1024*1024);let r=e.size<=i;return{valid:r,file:e,maxAllowedSize:i,maxAllowedSizeInMB:i/1024/1024,error:r?void 0:`File size should be less than ${i/1024/1024} MB`}}catch(i){return this.loggingService.catch("Error in CommentActionsService validateFile: ",i),{valid:!1,maxAllowedSize:0,maxAllowedSizeInMB:0,error:"Error in validating file"}}}deleteAttachment(s){return ee(this,arguments,function*({annotationId:e,commentId:i,attachmentId:r,options:a}){try{this.loggingService.log("%c[WB] Calling CommentActionsService FUNCTION: deleteAttachment","color: green;");let c=this.commentService.getAnnotationById(e,a);if(c){let p=c.comments?.find(_=>_?.commentId===i),h=c.metadata;if(p){let _=this.authService.getUser();if(this.isUserAdmin||_?.userId===p?.from?.userId){let E=p.attachments?.find(A=>A?.attachmentId===r);if(E){p.attachments=p.attachments?.filter(X=>X?.attachmentId!==r);let A={attachmentId:E.attachmentId,organizationId:h?.organizationId??null,documentId:h?.documentId??null,folderId:h?.folderId??null,commentAnnotationId:c.annotationId,apiKey:h?.apiKey??null};yield this.commentService.deleteAttachment({attachment:E,metadata:A});let V=yield this.metadataService.getGlobalMetadata(),G={attachment:E,annotationId:e,commentId:i,commentAnnotation:$n(c),metadata:V};return this.triggerAction(qi.DELETE_ATTACHMENT,G),this.updateComment({annotationId:e,comment:p,options:a}),G}}else this.loggingService.catch("Access Denied","You must be the author of the comment or an admin to delete the attachment.")}}else this.triggerAnnotationNotFoundError(e);return null}catch(c){return this.loggingService.catch("Error in CommentActionsService deleteAttachment: ",c),null}})}getAttachment(a){return ee(this,arguments,function*({annotationId:e,commentId:i,options:r}){try{this.loggingService.log("%c[WB] Calling CommentActionsService FUNCTION: getAttachment","color: green;");let s=this.commentService.getAnnotationById(e,r);return s?s.comments?.find(p=>p?.commentId===i)?.attachments||[]:(this.triggerAnnotationNotFoundError(e),[])}catch(s){return this.loggingService.catch("Error in CommentActionsService getAttachment: ",s),[]}})}uploadFile(e,i){return ee(this,null,function*(){try{return this.loggingService.log("%c[WB] Calling CommentActionsService FUNCTION: uploadFile","color: green;"),this.commentService.uploadFile(e,i)}catch(r){return this.loggingService.catch("Error in CommentActionsService uploadFile: ",r),null}})}getRecording(a){return ee(this,arguments,function*({annotationId:e,commentId:i,options:r}){try{this.loggingService.log("%c[WB] Calling CommentActionsService FUNCTION: getRecording","color: green;");let s=this.commentService.getAnnotationById(e,r);return s?s.comments?.find(p=>p?.commentId===i)?.recorders||[]:(this.triggerAnnotationNotFoundError(e),[])}catch(s){return this.loggingService.catch("Error in CommentActionsService getRecording: ",s),[]}})}deleteRecording(s){return ee(this,arguments,function*({annotationId:e,commentId:i,recorderId:r,options:a}){try{this.loggingService.log("%c[WB] Calling CommentActionsService FUNCTION: deleteRecording","color: green;");let c=this.commentService.getAnnotationById(e,a);if(c){let p=c.comments?.find(h=>h?.commentId===i);if(p){let h=this.authService.getUser();if(this.isUserAdmin||h?.userId===p?.from?.userId){let _=p.recorders?.find(E=>E?.id===r);if(_){p.recorders=p.recorders?.filter(V=>V?.id!==r);let E=yield this.metadataService.getGlobalMetadata(),A={annotationId:e,commentId:i,recording:_,commentAnnotation:$n(c),metadata:E};return this.triggerAction(qi.DELETE_RECORDING,A),this.updateComment({annotationId:e,comment:p,skipDeleteThreadConfirmation:!0,options:a}),A}}else this.loggingService.catch("Access Denied","You must be the author of the comment or an admin to delete the recording.")}}else this.triggerAnnotationNotFoundError(e);return null}catch(c){return this.loggingService.catch("Error in CommentActionsService deleteRecording: ",c),null}})}fetchCommentAnnotations(e){return ee(this,null,function*(){try{let i=yield this.commentService.fetchCommentAnnotations(e),r;if(i?.hasMore){let s=i?.data[i?.data?.length-1];r=yield hV(s?.lastUpdated?.toString()??"","veltencrypttoken","veltencrypttoken")}let a=i?.data?.reduce((s,c)=>(s[c.metadata.clientDocumentId??c.metadata.documentId]=s[c.metadata.clientDocumentId??c.metadata.documentId]||[],s[c.metadata.clientDocumentId??c.metadata.documentId].push($n(c)),s),{});return I({data:a},i?.hasMore?{nextPageToken:r}:{})}catch(i){return this.loggingService.catch("Error in CommentActionsService fetchCommentAnnotations: ",i),{data:null}}})}toggleReaction(c,p){return ee(this,arguments,function*({annotationId:e,commentId:i,reaction:r,options:a},s){try{this.loggingService.log("%c[WB] Calling CommentActionsService FUNCTION: toggleReaction","color: green;");let h=this.commentService.getAnnotationById(e,a),_=this.authService.getUser();if(h&&_){let E=h.comments?.find(A=>A?.commentId===i);if(E){let A=yield this.reactionService.addOrUpdateReaction(r.reactionId,E?.reactionAnnotationIds||[],void 0,void 0,h?.annotationId,r.customReaction,s),V=jt.REACTION_ADDED;if(A){A?.reactions?.find(he=>he.from?.userId===_?.userId)||(V=jt.REACTION_DELETED),E.reactionAnnotationIds||(E.reactionAnnotationIds=[]),E.reactionAnnotationIds.includes(A.annotationId)||E.reactionAnnotationIds.push(A.annotationId),A?.reactions?.length||(E.reactionAnnotationIds=E.reactionAnnotationIds.filter(he=>he!==A.annotationId)),this.commentService.saveComment(h,{type:V,updatedComment:E});let G=yield this.metadataService.getGlobalMetadata(),X={annotationId:e,commentId:i,reaction:A,commentAnnotation:$n(h),metadata:G};return s==="add"?this.triggerAction(qi.ADD_REACTION,X):s==="delete"?this.triggerAction(qi.DELETE_REACTION,X):this.triggerAction(qi.TOGGLE_REACTION,X),X}}}else this.triggerAnnotationNotFoundError(e);return null}catch(h){return this.loggingService.catch("Error in CommentActionsService toggleReaction: ",h),null}})}onComposerClick(i){return ee(this,arguments,function*({commentAnnotation:e}){try{this.loggingService.log("%c[WB] Calling CommentActionsService FUNCTION: onComposerClick","color: green;");let r=yield this.metadataService.getGlobalMetadata(),a={commentAnnotation:e?.annotationId?$n(e):void 0,metadata:r};this.triggerAction(qi.COMPOSER_CLICKED,a)}catch(r){this.loggingService.catch("Error in CommentActionsService onComposerClick: ",r)}})}autocompleteSearch(e){return ee(this,null,function*(){try{this.loggingService.log("%c[WB] Calling CommentActionsService FUNCTION: autocompleteSearch","color: green;");let i=yield this.metadataService.getGlobalMetadata();e.metadata=i,this.triggerAction(qi.AUTOCOMPLETE_SEARCH,e)}catch(i){this.loggingService.catch("Error in CommentActionsService autocompleteSearch: ",i)}})}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 CommentActionsService convert: ",i),this}}triggerAction(e,i){try{this.actionSubjects.has(e)||this.actionSubjects.set(e,new et),this.actionSubjects.get(e)?.next(i)}catch(r){this.loggingService.catch("Error in CommentActionsService triggerAction: ",r)}}onAction(e){try{return this.actionSubjects.has(e)||this.actionSubjects.set(e,new et),this.actionSubjects.get(e)?.asObservable()}catch(i){return this.loggingService.catch("Error in CommentActionsService onAction: ",i),re(null)}}get timestamp(){return this.commonDbService.getServerTimestamp()}getCommentAnnotations(e){try{if(e){if(e?.allDocuments&&!e?.folderId)return this.loggingService.catch("folderId is required when allDocuments is true."),re({data:null});if(!e?.allDocuments&&!e?.documentIds?.length)return this.loggingService.catch("documentIds is required."),re({data:null})}return this.commentService.getAllCommentAnnotations({excludeDomChanges:!0,skipPositionCalculation:!0,query:e}).pipe(ce(i=>i?i.reduce((r,a)=>{let s=a.metadata?.clientDocumentId;return!s||e?.documentIds&&!e?.documentIds?.includes(s)||(r[s]||(r[s]=[]),r[s].push(a)),r},{}):null),ce(i=>({data:i})))}catch(i){return this.loggingService.catch("Error in CommentActionsService getCommentAnnotation: ",i),re({data:null})}}getCommentAnnotationsCount$(e){try{return this.commentService.getAnnotationsCount(e).pipe(ce(i=>i||{data:null}))}catch(i){return this.loggingService.catch("Error in CommentActionsService getCommentAnnotation: ",i),re({data:null})}}};o.\u0275fac=function(i){return new(i||o)(J(Qe),J(je),J(Te),J(gi),J($o),J(lt),J(gn),J(y),J(fm),J(er),J(bn))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Wv=(()=>{let o=class o{constructor(e,i){this.httpClient=e,this.loggingService=i,this.fileContentMap$=new fe({})}getFileContent(e){try{let i=fn(e);return this.fileContentMap$.value[i]?re(this.fileContentMap$.value[i]):this.httpClient.get(e,{responseType:"text"}).pipe(ce(r=>(this.fileContentMap$.next(T(I({},this.fileContentMap$.value),{[i]:r})),r)))}catch(i){return this.loggingService.catch("Error in TranscriptionService saveRecorderToDb: ",i),re(null)}}getVttFileTextToArray(e){try{let c=[],p=e.split(`
|
|
382
382
|
`);for(var i=0;i<p.length;i++)if(p[i].indexOf("-->")!==-1){var r=p[i].split(" --> ")[0],a=p[i].split(" --> ")[1],s=p[i+1];c.push({startTime:r,endTime:a,startTimeInSeconds:this.getTimeInSecondsFromVttTime(r),endTimeInSeconds:this.getTimeInSecondsFromVttTime(a),text:s})}return c}catch(c){return this.loggingService.catch("Error in TranscriptionService getVttFileTextToArray: ",c),[]}}getTimeInSecondsFromVttTime(e){try{let i=e.split(":"),r=0;i.length===3&&(r=parseInt(i[0]),i.shift());let a=parseInt(i[0]),s=parseInt(i[1].split(".")[0]),c=parseInt(i[1].split(".")[1]);return((r*60*60+a*60+s)*1e3+c)/1e3}catch(i){return this.loggingService.catch("Error in TranscriptionService getTimeInSecondsFromVttTime: ",i),0}}};o.\u0275fac=function(i){return new(i||o)(J(Q4),J(y))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Xi=(()=>{let o=class o{constructor(e,i,r,a,s,c,p,h,_,E,A,V,G,X,he,Ie,Pe,Be,We){this.analyticsService=e,this.configService=i,this.docService=r,this.databaseService=a,this.commonDbService=s,this.authService=c,this.domService=p,this.afAuth=h,this.iamService=_,this.functions=E,this.avatarService=A,this.contactService=V,this.storageService=G,this.dialog=X,this.loggingService=he,this.notificationService=Ie,this.transcriptionService=Pe,this.recorderService=Be,this.recorderUtilsService=We,this.recorderAnnotationById$=new fe({}),this.documentPaths=null,this.db=Ci(),this.allowedElementIds$=new fe([]),this.addRecorderMode$=new fe(!1),this.recorderContainerDarkMode$=new fe(!1),this.recordingTranscriptionEnabled$=new fe(!0),this.draftRecordings$=new fe([]),this.recorderNotesFound$=new fe(!1),this.recordedData=null,this.videoEditorAutoOpen$=new fe({}),this.getAllRecorderAnnotations().subscribe(ke=>{}),this.loggingService.log("%c[WB] Creating CLASS: RecorderAnnotationService","color: blue;"),this.analyticsService.setRecorderAnnotationService(this),this.authService.setRecorderAnnotationService(this),this.databaseService.getDb().pipe(Ne(ke=>!!ke),Je(1)).subscribe(ke=>{ke&&(this.db=ke,this.getDocumentPaths())},ke=>{this.loggingService.catch("Error in RecorderAnnotationService getDb subscription: ",ke)}),this.domService.onWindowPointerMove$().subscribe(ke=>{if(this.addRecorderMode$.value){this.highlightElement&&this.domService.removeHighlightFromElement(this.highlightElement);let we=this.domService.getBackgroundElement(ke.clientX,ke.clientY);we&&(this.isElementInsideAllowedElements(we)?WO(ke.target)?this.domService.removeClassFromElement(document.body,"show-pin-cursor"):(this.domService.addClassToElement(document.body,"show-pin-cursor"),this.highlightElement=we):this.domService.removeClassFromElement(document.body,"show-pin-cursor"))}},ke=>{this.loggingService.catch("Error in RecorderAnnotationService onWindowPointerMove$ subscription: ",ke)}),this.domService.onWindowKeyupEsc$().subscribe(ke=>{this.addRecorderMode$.value&&this.disableAddRecorderMode()},ke=>{this.loggingService.catch("Error in RecorderAnnotationService onWindowKeyupEsc$ subscription: ",ke)}),this.domService.onDocumentClick$().subscribe(ke=>{if(ke&&this.addRecorderMode$.value){if(ke.preventDefault(),ke.stopPropagation(),!WO(ke.target)){let we=this.domService.getBackgroundElement(ke.clientX,ke.clientY);we&&this.isElementInsideAllowedElements(we)}this.disableAddRecorderMode()}},ke=>{this.loggingService.catch("Error in RecorderAnnotationService onDocumentClick$ subscription: ",ke)}),this.addRecorderMode$.subscribe(ke=>{this.highlightElement&&this.domService.removeHighlightFromElement(this.highlightElement),ke?this.domService.addClassToElement(document.body,"snippyly-add-recorder-mode"):(this.domService.removeClassFromElement(document.body,"snippyly-add-recorder-mode"),this.domService.removeClassFromElement(document.body,"show-pin-cursor"))},ke=>{this.loggingService.catch("Error in RecorderAnnotationService addRecorderMode$ subscription: ",ke)}),this.domService.onWindowKeyupBackspace$().subscribe(ke=>{this.deleteRecorderPinAnnotations()},ke=>{this.loggingService.catch("Error in RecorderAnnotationService onWindowKeyupBackspace$ subscription: ",ke)}),this.domService.onWindowKeyupDelete$().subscribe(ke=>{this.deleteRecorderPinAnnotations()},ke=>{this.loggingService.catch("Error in RecorderAnnotationService onWindowKeyupDelete$ subscription: ",ke)}),this.recorderService.onRecordedData().subscribe(ke=>{this.recordedData=ke},ke=>{this.loggingService.catch("Error in RecorderAnnotationService onRecordedData subscription: ",ke)}),this.domService.getDeleteCommmentAnnotations$().subscribe(ke=>{ke?.length&&ke.forEach(we=>ee(this,null,function*(){}))},ke=>{this.loggingService.catch("Error in RecorderAnnotationService onWindowKeyupDelete$ subscription: ",ke)})}clearCache(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCache in RecorderAnnotationService","color: green;");try{this.recorderAnnotationById$.next({}),this.documentPaths=null,this.allowedElementIds$.next([]),this.addRecorderMode$.next(!1),this.highlightElement=null}catch(e){this.loggingService.catch("Error in RecorderAnnotationService clearCache: ",e)}}getDocumentPaths(){this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentPaths","color: green;");try{this.docService.getDocumentPaths$().pipe(In(e=>{this.documentPaths=e})).subscribe(()=>{},e=>{this.loggingService.catch("Error in getDocumentPaths subscription: ",e)})}catch(e){this.loggingService.catch("Error in CursorService getDocumentPaths: ",e)}}getAnonymousAvatarImage(){return this.loggingService.log("%c[WB] Calling FUNCTION: getAnonymousAvatarImage","color: green;"),this.avatarService.generateUserImage()}setAllowedElementIds(e){this.allowedElementIds$.next(e||[])}getAllowedElementIds(){return this.allowedElementIds$.asObservable()}getDraftRecordings$(){return this.draftRecordings$.asObservable()}getRecorderDataByRecorderId(e){try{return this.recorderAnnotationById$.pipe(ce(()=>this.getAnnotationById(e)),ge(i=>ee(this,null,function*(){return i?yield this.createRecorderData(i,!0):void 0})))}catch(i){return this.loggingService.catch("Error in RecorderAnnotationService getRecorderDataByRecorderId: ",i),re(void 0)}}getRecorderDataByRecorderIds(e){return ee(this,null,function*(){try{let i={};return yield Promise.all(e.recorderIds.map(r=>ee(this,null,function*(){let a=this.getAnnotationById(r);if(!a)return;let s=yield this.createRecorderData(a,!0);s&&(i[r]=s)}))),{data:Object.keys(i).length>0?i:null}}catch(i){return this.loggingService.catch("Error in RecorderAnnotationService getRecorderDataByRecorderIds: ",i),{data:null}}})}fetchRecorderDataByRecorderIds(e){return ee(this,null,function*(){try{let i=this.recorderAnnotationById$.value,r=[],a=Object.values(i);return e?.recorderIds?.length&&(a=a.filter(s=>e.recorderIds.includes(s.annotationId))),a.length===0?[]:(yield Promise.all(a.map(s=>ee(this,null,function*(){if(!s)return;let c=yield this.createRecorderData(s,!0);c&&r.push(c)}))),r)}catch(i){return this.loggingService.catch("Error in RecorderAnnotationService fetchRecorderDataByRecorderIds: ",i),[]}})}getRecordings(e){try{return this.recorderAnnotationById$.pipe(ge(i=>ee(this,null,function*(){let r=[],a=Object.values(i);return e?.recorderIds?.length&&(a=a.filter(s=>e.recorderIds.includes(s.annotationId))),a.length===0?[]:(yield Promise.all(a.map(s=>ee(this,null,function*(){if(!s)return;let c=yield this.createRecorderData(s,!0);c&&r.push(c)}))),r)})),Ln(i=>(this.loggingService.catch("Error in RecorderAnnotationService getRecordings: ",i),re([]))))}catch(i){return this.loggingService.catch("Error in RecorderAnnotationService getRecordings: ",i),re([])}}setRecorderActionsService(e){try{this.recorderActionsService=e}catch(i){this.loggingService.catch("Error in RecorderAnnotationService setRecorderActionsService: ",i)}}getVttFileTextToArray(e){try{return this.transcriptionService.getVttFileTextToArray(e)}catch(i){this.loggingService.catch("Error in RecorderAnnotationService getVttFileTextToArray: ",i)}}getAllRecorderAnnotations(e,i,r){this.loggingService.log("%c[WB] Calling FUNCTION: getAllRecorderAnnotations","color: green;");let a,s;try{if(e&&(s=fn(e)),i&&typeof i=="object"){let c=Xo(i);a=fn(JSON.stringify(c))}}catch(c){this.loggingService.catch("Error in RecorderAnnotationService getAllRecorderAnnotations: ",c)}return Wn(this.afAuth).pipe(Ne(c=>!!c),ge(c=>this.isFeatureAllowed({firebaseUser:c,annotations:[],filteredAnnotations:[]})),ge(c=>c.featureAllowed?this.iamService.isUserAllowed$().pipe(ce(p=>(c.featureAllowed=p,c))):re(c)),ge(c=>c.featureAllowed?this.authService.isPlanExpired$().pipe(ce(p=>(c.featureAllowed=!p,c))):re(c)),ge(c=>c.featureAllowed?re(c).pipe(ge(p=>this.docService.getDocumentPaths$().pipe(ce(h=>(this.documentPaths=h,p.documentPaths=h,p)))),ge(p=>s?this.getDataFromDocumentIds([s]).pipe(ce(h=>(p.annotations=h||[],I({},p)))):this.docService.getDocumentIds$().pipe(ge(h=>{let _=h?.length>0?h.map(E=>E.documentId):[this.documentPaths?.documentId??""];return this.getDataFromDocumentIds(_).pipe(ce(E=>(p.annotations=E||[],I({},p))))}))),ge(p=>this.docService.getLocation$().pipe(ce(h=>(p.location=h,p)))),ge(p=>this.docService.getLocations$().pipe(ce(h=>(p.customLocations=h,p)))),ce(p=>{if(p.filteredAnnotations=[],s&&!a)return p.filteredAnnotations=p.annotations?.slice(),p;{let h=[];return a?h.push(a):(h.push(p?.location?.locationId),h.push(...Object.values(p?.customLocations||[]).map(_=>_.locationId))),p.filteredAnnotations=this.filterAnnotationsByLocationIds(p?.annotations,h),p}}),ge(p=>r?re(p):p?.annotations?.length?this.domService.onWindowResize$().pipe(ce(()=>p)):re(p)),ge(p=>r?re(p):p?.annotations?.length?this.domService.onDomChange$("RecorderAnnotationService getAllRecorderAnnotations").pipe(ce(()=>p)):re(p)),ce(p=>{let h=[];return p?.filteredAnnotations?.forEach(_=>{this.calculateRecorderAnnotationPosition(_),_?.targetElement||h.push(_)}),this.draftRecordings$.next(h),p}),ge(p=>p?.filteredAnnotations?re(p?.filteredAnnotations||[]):re([]))):re([])),Kt(_o))}isFeatureAllowed(e){return this.configService.getConfig$().pipe(Ne(i=>!!i),ce(i=>T(I({},e),{config:i})),ge(i=>this.authService.getUser$().pipe(ce(r=>T(I({},i),{user:r})))),ge(i=>Zi(i.config,i.user,Re.RECORDER)?re(T(I({},i),{featureAllowed:!0})):(this.loggingService.warn("Recorder feature is not allowed."),re(T(I({},i),{featureAllowed:!1})))))}getDataFromDocumentIds(e,i){return this.getDataFromDocuments({documentIds:e,filters:i})}getDataFromDocuments(e){if(this.configService?.getApiKey()){let{documentIds:i,filters:r}=e;if(i?.some(p=>!p)||!this.documentPaths)return re([]);let a=this.docService.getFolderConfig(),s=re([]),c={useCollectionGroup:!0,isCollection:!0,useQuery:!0};if(this.commonDbService.shouldUseFirestore()||(c.documentId=i?.length?i[0]:void 0,c.organizationId=this.documentPaths?.organizationId),a?.veltFolderId&&a?.allDocuments)s=this.commonDbService.dbListener({feature:"allRecorders",properties:T(I({},c),{firestoreQuery:[Fi(mt("metadata.apiKey","==",this.configService?.getApiKey()),mt("metadata.veltFolderId","==",a?.veltFolderId),mt("metadata.organizationId","==",this.documentPaths?.organizationId))]})});else{let p=[];for(let h=0;h<(i?.length??0);h+=U.LISTENER_BATCH_SIZE)p.push(i?.slice(h,h+U.LISTENER_BATCH_SIZE)??[]);s=Dn(p.map(h=>this.commonDbService.dbListener({feature:"allRecorders",properties:T(I({},c),{firestoreQuery:[Fi(mt("metadata.apiKey","==",this.configService?.getApiKey()),mt("metadata.documentId","in",h),mt("metadata.organizationId","==",this.documentPaths?.organizationId),...a?.veltFolderId?[mt("metadata.veltFolderId","==",a?.veltFolderId)]:[])]})}).pipe($r()))).pipe(ce(h=>ca(h)))}return s.pipe(ce(p=>({data:p?.data,operation:p?.operation})),ce(({data:p,operation:h})=>{let _=[];return p&&(_=Object.values(p).filter(E=>typeof E=="object")),{data:_,operation:h}}),ce(({data:p,operation:h})=>{if(!i)return{data:p,documentMap:{},operation:h};let _=p.reduce((E,A)=>{let V=A.metadata?.documentId;return V&&(E[V]||(E[V]=[]),E[V].push(A)),E},{});return{data:p,documentMap:_,operation:h}}),ce(({data:p,documentMap:h,operation:_})=>{if(!r)if(_?.type==="removed"){if(_?.ids?.length){let E=this.recorderAnnotationById$.value;_?.ids?.forEach(A=>{delete E?.[A]}),this.recorderAnnotationById$.next(E)}}else Object.entries(h).forEach(([E,A])=>{this.setRecorderAnnotationsByOrganizationIdAndDocumentId({organizationId:this.documentPaths?.organizationId,documentId:E,annotations:A})});return p}),Ln(p=>(this.loggingService.catch("Error in RecorderAnnotationService getDataFromDocumentId: ",p),re([]))))}else return re([])}setRecorderAnnotationsByOrganizationIdAndDocumentId({organizationId:e,documentId:i,annotations:r,queryHash:a}){try{if(i){e||(e=U.NO_ORGANIZATION_ID),a||(a=U.DEFAULT_QUERY_HASH);let s={};r?.forEach(p=>{p?.annotationId&&(s[p?.annotationId]=p)});let c=I(I({},this.recorderAnnotationById$.value),s);this.recorderAnnotationById$.next(c)}}catch(s){this.loggingService.catch("Error in RecorderAnnotationService setRecorderAnnotationsByOrganizationIdAndDocumentId:",s)}}filterAnnotationsByLocationIds(e,i){try{return e.filter(r=>i.includes(r.locationId))}catch(r){return this.loggingService.catch("Error in RecorderAnnotationService filterAnnotationsByLocations:",r),[]}}calculateRecorderAnnotationPosition(e){try{if(e.targetElement){let i=this.domService.getXPath(e.targetElement?.xpath);if(i){let r=i.iterateNext();if(r&&xo(r)){let a=r.getBoundingClientRect();if(a&&a.width&&a.height){let{height:s,width:c}=Ep(r);e.position={top:s*e.targetElement.topPercentage/100,left:c*e.targetElement.leftPercentage/100}}else e.position=null}else e.position=null}else e.position=null}}catch(i){this.loggingService.catch("Error in RecorderAnnotationService calculateRecorderAnnotationPosition:",i)}}getAnnotationById(e,i){try{let r=this.recorderAnnotationById$.value?.[e];if(r){let{documentId:a,organizationId:s}=i||{};if(a&&r.metadata?.documentId!==a||s&&r.metadata?.organizationId!==s)return}return r}catch(r){this.loggingService.catch("Error in RecorderAnnotationService getAnnotationById: ",r);return}}getBaseMetadataFromRecorderAnnotationId(e){try{let i=this.recorderAnnotationById$.value?.[e];if(i)return i.metadata}catch(i){this.loggingService.catch("Error in RecorderAnnotationService getBaseMetadataFromRecorderAnnotationId: ",i)}}getRecorderAnnotationById(e,i){return this.recorderAnnotationById$.pipe(ge(()=>{let r=this.getAnnotationById(e,i);return r?re(r):re(null)}),Ln(r=>(this.loggingService.catch("Error in RecorderAnnotationService getCommentAnnotationById: ",r),re(null))))}getRecorderAnnotationsByOrganizationIdAndDocumentId({organizationId:e,documentId:i}){try{let r={};return Object.values(this.recorderAnnotationById$.value).forEach(a=>{a?.metadata?.documentId==i&&a?.metadata?.organizationId==e&&(r[a?.annotationId]=a)}),Object.values(r)}catch(r){return this.loggingService.catch("Error in RecorderAnnotationService getRecorderAnnotationsByOrganizationIdAndDocumentId:",r),[]}}setLocationToRecorderAnnotation(e){try{let i=this.docService.getLocation();i?(e.locationId=i.locationId,e.location=i.location):(delete e.locationId,delete e.location);try{if(e.targetElement?.xpath){let r=this.domService.getElementFromXPath(e.targetElement.xpath),a=this.docService.getAdditionLocationFromElement(r);if(a){let s=this.docService.addLocation(a);s&&(e.locationId=s.locationId,e.location=s.location)}}}catch{}}catch(i){this.loggingService.catch("Error in RecorderAnnotationService setLocationToRecorderAnnotation:",i)}}addRecorder(e,i,r){this.loggingService.log("%c[WB] Calling FUNCTION: addRecorder","color: green;");try{let a=this.authService.getUser();if(a){if(a.isReadOnly||a.isAnonymous)return this.loggingService.catch("Anonymous/Readonly users cannot add recorders."),re(null);{i.from=a,i.color=U.DEFAULT_ANNOTATION_COLOR,i.lastUpdated=this.timestamp;let{topPositionX:s,topPositionY:c}=this.domService.getTopLeftPosition();i.positionX=s,i.positionY=c;let p=this.domService.getCurrentWindowSizeValue();if(i.screenWidth=p.screenWidth,i.screenHeight=p.screenHeight,i.screenScrollHeight=p.screenScrollHeight,i.recorderedElementPath="",e&&(i.targetElement=this.domService.getTargetElementForCursorPosition(e)),i?.targetElement?.xpath){let h=this.domService.getXPath(i.targetElement.xpath);if(h){let _=h.iterateNext();_&&(xo(_)||(i.targetElement=null))}}return this.setLocationToRecorderAnnotation(i),i.pageInfo=_i(),i.pageInfo&&(i.pageInfo.screenWidth=this.domService.getCurrentWindowSizeValue()?.screenWidth),this.saveRecorderToDb(i,r)}}else return re(null)}catch(a){return this.loggingService.catch("Error in RecorderAnnotationService addRecorder: ",a),re(null)}}saveRecorderToDb(e,i){this.loggingService.log("%c[WB] Calling FUNCTION: saveRecorderToDb","color: green;");try{return this.authService.getUser()&&this.authService.isFeatureAllowed(Re.RECORDER)?this.docService.getDocumentPaths$().pipe(Ne(r=>!!r),Je(1),ge(r=>(this.documentPaths=r,this.loggingService.log(this.documentPaths),this.databaseService.getDb().pipe(Ne(a=>!!a),Je(1),ge(a=>ee(this,null,function*(){if(this.db=a,this.loggingService.log(this.db),this.documentPaths?.recorder){let s=on(this.db,`${this.documentPaths?.recorder}`);e.annotationId=this.commonDbService.generateDocumentId(),e.pageInfo&&(e.pageInfo.recorderUrl=this.generateRecorderUrl(e));let c=JSON.parse(JSON.stringify(e));if(c.position=null,!c?.metadata?.documentId){c?.metadata||(c.metadata={});let _=this.docService.getBaseMetadata("recorder",{commentAnnotationId:e.commentAnnotationId});c.metadata=I(I({},c?.metadata),_)}let{documentId:p,organizationId:h}=c?.metadata||{};return yield this.commonDbService.setData({feature:"recorder",properties:{id:e.annotationId,documentId:p,organizationId:h},data:JSON.parse(JSON.stringify(c))}),this.analyticsService.trackEvent(Z.Events.Recording.RECORDING_ADDED,{annotationId:e.annotationId,recorderType:e.recordingType,recorderMode:e.mode,recorderSize:e?.attachments?.length?e?.attachments[0]?.size:e?.attachment?.size,sourceFeature:i||"recording"}),this.setVideoEditorAutoOpen({[e.annotationId]:!0}),this.processRecording(e,"recording","merge"),this.updateNotificationsDatabase(e,ev.ADDED),e}else return null})))))):re(null)}catch(r){return this.loggingService.catch("Error in RecorderAnnotationService saveRecorderToDb: ",r),re(null)}}processRecording(e,i,r){return ee(this,null,function*(){try{let a=Cr(this.functions,Zn?.cloudFunction?.processRecording,{timeout:36e5}),s=this.docService.getDocumentPaths();e?.metadata?.documentId&&(s=new xd({apiKey:this.configService.getApiKey(),clientDocumentId:e.metadata.clientDocumentId,clientOrganizationId:e.metadata.clientOrganizationId,documentId:e.metadata.documentId,organizationId:e.metadata.organizationId}));let c={databaseUrl:this.authService.getFirebaseConfig()?.firebaseOptions?.databaseURL,entirePath:s?.recorder+e?.annotationId,fromUser:this.authService.getUser(),clientOrganizationId:s?.clientOrganizationId,clientDocumentId:s?.clientDocumentId,apiKey:this.configService.getApiKey(),sdkVersion:Ta(),sdkType:this.configService.getSdkType(),useFirestore:this.commonDbService.shouldUseFirestore(),storageBucket:this.authService.getFirebaseConfig()?.firebaseOptions?.storageBucket,documentPath:s?.recorder,annotationId:e?.annotationId,sourceFeature:i||"recording",annotationData:e,skipMerge:!0,transcriptionEnabled:this.getRecordingTranscriptionEnabled(),type:r,returnType:"transcription"};if(c?.useFirestore){let A=yield this.recorderUtilsService.encryptRecorderAnnotation(e);c.annotationData=A}let p=this.documentPaths?.organizationId,h=this.documentPaths?.documentId;e?.metadata?.documentId&&(h=e.metadata.documentId,p=e.metadata.organizationId);let _=`${this.configService.getApiKey()}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${h}/${U.FIREBASE_PARTIAL_PATH_RECORDER}`;p&&(_=`${this.configService.getApiKey()}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${p}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${h}/${U.FIREBASE_PARTIAL_PATH_RECORDER}`),c.bucketPath=_;let E=yield a(c);if(E.data&&this.recordedData){let A=this.getAnnotationById(this.recordedData.id);if(!A)return;let V=yield this.createRecorderData(A,!1);if(V){if(E?.data?.transcriptedText&&(V.transcription.contentSummary=E.data.transcriptedText),E.data.vttUrl)try{let G=yield this.transcriptionService.getFileContent(E.data.vttUrl).toPromise();G&&(V.transcription.transcriptSegments=this.getVttFileTextToArray(G),V.transcription.vttFileUrl=E.data.vttUrl)}catch(G){this.loggingService.catch("Error fetching VTT content: ",G)}A?.attachments?.length&&this.recordedData&&(this.recordedData.videoUrl=A.attachments[0].url),this.recorderActionsService?.onTranscriptionDone(V),this.recorderActionsService?.onRecordingDone(V)}this.recorderService.setRecordedData(this.recordedData)}}catch(a){this.loggingService.catch("Error in RecorderAnnotationService processRecording: ",a)}})}getDocumentIdAndOrganizationIdFromRecorderAnnotation(e){try{return{documentId:e?.metadata?.documentId,organizationId:e?.metadata?.organizationId}}catch(i){return this.loggingService.catch("Error in RecorderAnnotationService getDocumentIdAndOrganizationIdFromRecorderAnnotation: ",i),{}}}createRecorderData(e,i=!1){return ee(this,null,function*(){try{let r=lv(e?.metadata||{}),a=aS(e?.from),s={recorderId:e?.annotationId||"",from:a,assets:[],metadata:r,transcription:{transcriptSegments:[],vttFileUrl:"",contentSummary:""}};if(e?.transcription?.transcriptedText&&(s.transcription.contentSummary=e.transcription.transcriptedText),e?.attachments?.forEach(c=>{c?.url&&s.assets.push({url:c.url,mimeType:c.mimeType,fileName:c.name,fileSizeInBytes:c.size,fileFormat:c.type,thumbnailUrl:c.thumbnail})}),i&&e?.transcription?.vttUrl)try{let c=yield this.transcriptionService.getFileContent(e.transcription.vttUrl).toPromise();c&&(s.transcription.transcriptSegments=this.getVttFileTextToArray(c),s.transcription.vttFileUrl=e.transcription.vttUrl)}catch(c){this.loggingService.catch("Error fetching VTT content: ",c)}return s}catch(r){return this.loggingService.catch("Error in RecorderAnnotationService createRecorderData: ",r),null}})}updateRecorder(e,i=!1,r){try{r&&this.setLocationToRecorderAnnotation(e),i&&this.updateNotificationsDatabase(e,ev.UPDATED),this.updateRecorderToDb(e)}catch(a){this.loggingService.catch("Error in RecorderAnnotationService updateRecorder: ",a)}}resolveRecorder(e){try{this.domService.resetSelectedAnnotationsMap(!1),this.updateNotificationsDatabase(e,ev.RESOLVED),this.updateRecorderToDb(e),this.domService.updateSelectedAnnotationInMap([e])}catch(i){this.loggingService.catch("Error in RecorderAnnotationService resolveRecorder: ",i)}}updateRecorderToDb(e){this.loggingService.log("%c[WB] Calling FUNCTION: updateRecorderToDb","color: green;");try{if(e?.targetElement?.xpath){let i=this.domService.getXPath(e.targetElement.xpath);if(i){let r=i.iterateNext();r&&(xo(r)||(e.targetElement=null))}}if(this.domService.updateSelectedAnnotationInMap([e]),this.authService.getUser()&&this.authService.isFeatureAllowed(Re.RECORDER)){let i=JSON.parse(JSON.stringify(e));if(i.position=null,!i?.metadata?.documentId){i?.metadata||(i.metadata={});let s=this.docService.getBaseMetadata();i.metadata=I(I({},i?.metadata),s)}let{documentId:r,organizationId:a}=this.getDocumentIdAndOrganizationIdFromRecorderAnnotation(e);this.commonDbService.setData({feature:"recorder",properties:{id:e.annotationId,documentId:r,organizationId:a},data:JSON.parse(JSON.stringify(i))})}}catch(i){this.loggingService.catch("Error in RecorderAnnotationService updateRecorderToDb: ",i)}}deleteRecorderPinAnnotations(){try{let e=this.domService.getSelectedAnnotationsMap(),i=this.authService.getUser(),r=[];Object.keys(e).forEach(a=>ee(this,null,function*(){let s=e[a];s.type==="recorder"&&i&&s.from&&(i?.isAdmin||s.from.userId===i.userId)&&r.push(s)})),r?.length&&(this.analyticsService.trackEvent(Z.Events.Recording.RECORDING_DELETE_TRIGGERED,{annotationId:r.map(a=>a.annotationId).join()}),this.dialog.open(da,{data:{title:"Delete recording?",message:"This selected recording will be deleted.",yesButton:"Delete",noButton:"Cancel",darkMode:this.recorderContainerDarkMode$.value,variant:"recorder"}}).afterClosed().pipe(Je(1)).subscribe(a=>{a&&(r.forEach(s=>ee(this,null,function*(){yield this.deleteRecorderPinAnnotation(s)})),setTimeout(()=>{document.querySelectorAll(`[${U.SNIPPYLY_HIGHLIGHT}]`).forEach(c=>{this.domService.removeHighlightFromElement(c)})},100))}),this.domService.resetSelectedAnnotationsMap(!0,"recorder"))}catch(e){this.loggingService.catch("Error in RecorderAnnotationService deleteRecorderPinAnnotations: ",e)}}deleteRecorderPinAnnotation(e,i){if(this.authService.isFeatureAllowed(Re.RECORDER)&&this.documentPaths?.recorder&&e?.annotationId){this.updateNotificationsDatabase(e,ev.DELETED),e?.attachment&&this.storageService.deleteAttachment({attachment:e.attachment}),e?.attachments&&e.attachments.forEach(s=>{this.storageService.deleteAttachment({attachment:s}).catch(c=>{this.loggingService.catch("Error in RecorderAnnotationService deleteRecorderPinAnnotation delete attachment: ",c)})}),e?.transcription&&(e?.transcription?.srtBucketPath&&this.storageService.deleteFileFromPath(e.transcription.srtBucketPath).catch(s=>{this.loggingService.catch("Error in RecorderAnnotationService deleteRecorderPinAnnotation delete srt file: ",s)}),e?.transcription?.vttBucketPath&&this.storageService.deleteFileFromPath(e.transcription.vttBucketPath).catch(s=>{this.loggingService.catch("Error in RecorderAnnotationService deleteRecorderPinAnnotation delete vtt file: ",s)})),this.analyticsService.trackEvent(Z.Events.Recording.RECORDING_DELETED,{annotationId:e.annotationId,recorderType:e.recordingType,recorderMode:e.mode,recorderSize:e?.attachments?.length?e?.attachments[0]?.size:e.attachment?.size,sourceFeature:i||"recording"});let{documentId:r,organizationId:a}=this.getDocumentIdAndOrganizationIdFromRecorderAnnotation(e);return this.commonDbService.deleteData({feature:"recorder",properties:{id:e.annotationId,documentId:r,organizationId:a}}).then(s=>ee(this,null,function*(){let c=yield this.createRecorderData(e,!0);c&&this.recorderActionsService?.onDeleteRecording(c)}))}else return Promise.resolve()}enableAddRecorderMode(){this.authService.isFeatureAllowed(Re.RECORDER)?this.addRecorderMode$.next(!0):this.loggingService.catch("Error in RecorderAnnotationService enableAddRecorderMode: ","Recorder feature is not enabled.")}disableAddRecorderMode(){this.addRecorderMode$.next(!1)}addRecorderModeChange(){return this.addRecorderMode$.asObservable()}setRecorderContainerDarkMode(e){try{if(this.recorderContainerDarkMode$.value===e)return;this.recorderContainerDarkMode$.next(e)}catch(i){this.loggingService.catch("Error in RecorderAnnotationService setRecorderContainerDarkMode: ",i)}}getRecorderContainerDarkMode(){return this.recorderContainerDarkMode$.asObservable()}enableRecordingTranscription(){try{if(this.analyticsService.setFeatureConfig({feature:Re.RECORDER,config:{recordingTranscription:!0}}),this.recordingTranscriptionEnabled$.value===!0)return;this.recordingTranscriptionEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in RecorderAnnotationService enableRecordingTranscription: ",e)}}disableRecordingTranscription(){try{if(this.analyticsService.setFeatureConfig({feature:Re.RECORDER,config:{recordingTranscription:!1}}),this.recordingTranscriptionEnabled$.value===!1)return;this.recordingTranscriptionEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in RecorderAnnotationService disableRecordingTranscription: ",e)}}getRecordingTranscriptionEnabled(){return this.recordingTranscriptionEnabled$.value}getRecordingTranscriptionEnabled$(){return this.recordingTranscriptionEnabled$.asObservable()}get timestamp(){return this.commonDbService.getServerTimestamp()}isElementInsideAllowedElements(e){try{return this.domService.isElementInsideListedElementIds(e,this.allowedElementIds$.value)}catch(i){return this.loggingService.catch("Error in RecorderAnnotationService isElementInsideAllowedElements: ",i),!1}}attachRecorder(e){let i=document.getElementById(e);if(i){let r=this.domService.getXPath(i),a=this.getRecorderPinAnnotationObject();a&&(a.targetElement={xpath:r,topPercentage:50,leftPercentage:90},this.saveRecorderToDb(a))}}getRecorderPinAnnotationObject(){let e=this.authService.getUser();if(e)if(e.isReadOnly||e.isAnonymous)this.loggingService.catch("Anonymous/Readonly users cannot add recorders.");else{let i=new Pp;i.from=e,i.color=U.DEFAULT_ANNOTATION_COLOR,i.lastUpdated=this.timestamp;let{topPositionX:r,topPositionY:a}=this.domService.getTopLeftPosition();i.positionX=r,i.positionY=a;let s=this.domService.getCurrentWindowSizeValue();i.screenWidth=s.screenWidth,i.screenHeight=s.screenHeight,i.screenScrollHeight=s.screenScrollHeight,i.recorderedElementPath="";let c=this.docService.getLocation();return c&&(i.locationId=c.locationId,i.location=c.location),i}return null}updateNotificationsDatabase(e,i,r={}){try{let a=I({annotationData:e,actionType:i,notificationSource:"recorder",recordingType:e?.recordingType},r);this.notificationService.updateNotificationDatabase(a)}catch(a){this.loggingService.catch("Error in RecorderAnnotationService updateNotificationsDatabase: ",a)}}getUserContacts$(){return this.contactService.getUserContacts$()}addUserContact(e){this.contactService.addUserContact(e)}getRecorderUrl(e){try{return e?.pageInfo?.recorderUrl?e.pageInfo.recorderUrl:e?.annotationId?(e?.pageInfo||(e.pageInfo=_i(),e.pageInfo&&(e.pageInfo.screenWidth=this.domService.getCurrentWindowSizeValue()?.screenWidth)),e.pageInfo.recorderUrl=this.generateRecorderUrl(e),this.updateRecorder(e),e.pageInfo?.recorderUrl):""}catch(i){this.loggingService.catch("Error in RecorderAnnotationService getRecorderUrl: ",i);return}}uploadFile(e,i){let r=this.documentPaths?.organizationId,a=this.documentPaths?.documentId;i?.metadata?.documentId&&(a=i.metadata.documentId,r=i.metadata.organizationId);let s=`${U.FIREBASE_PARTIAL_PATH_DOCS}/${a}/${U.FIREBASE_PARTIAL_PATH_RECORDER}`;return r&&(s=`${U.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${r}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${a}/${U.FIREBASE_PARTIAL_PATH_RECORDER}`),this.storageService.uploadFile({path:s,file:e})}downloadAttachment(e){this.storageService.downloadAttachment(e)}deleteAttachment(e){return this.storageService.deleteAttachment({attachment:e})}generateRecorderUrl(e){let i=new URL(window.location.href);return i.searchParams.delete(U.URL_PARAMS.RECORDER_ID),i.searchParams.append(U.URL_PARAMS.RECORDER_ID,e.annotationId),i.href}setRecorderNotesFound(e){try{this.recorderNotesFound$.next(e)}catch(i){this.loggingService.catch("Error in RecorderAnnotationService setRecorderNotesFound: ",i)}}getRecorderNotesFound$(){try{return this.recorderNotesFound$.asObservable()}catch(e){return this.loggingService.catch("Error in RecorderAnnotationService getRecorderNotesFound: ",e),re(!1)}}getRecorderNotesFound(){try{return this.recorderNotesFound$.value}catch(e){return this.loggingService.catch("Error in RecorderAnnotationService getRecorderNotesFound: ",e),!1}}trimVideoRecording(e,i){return ee(this,null,function*(){try{let s=(yield Cr(this.functions,Zn?.cloudFunction?.trimVideoRecording,{timeout:36e5})({videoUrl:e,segments:i})).data;if(s&&s.videoData){let c=atob(s.videoData),p=new ArrayBuffer(c.length),h=new Uint8Array(p);for(let _=0;_<c.length;_++)h[_]=c.charCodeAt(_);return new Blob([h],{type:s.mimeType||"video/mp4"})}return null}catch(r){return this.loggingService.catch("Error in RecorderAnnotationService trimVideoRecording: ",r),null}})}setVideoEditorAutoOpen(e){try{this.videoEditorAutoOpen$.next(I(I({},this.videoEditorAutoOpen$.value),e))}catch(i){this.loggingService.catch("Error in RecorderAnnotationService setVideoEditorAutoOpen: ",i)}}getVideoEditorAutoOpen$(){try{return this.videoEditorAutoOpen$.asObservable()}catch(e){return this.loggingService.catch("Error in RecorderAnnotationService getVideoEditorAutoOpen: ",e),re({})}}getVideoEditorAutoOpen(){try{return this.videoEditorAutoOpen$.value}catch(e){return this.loggingService.catch("Error in RecorderAnnotationService getVideoEditorAutoOpen: ",e),{}}}};o.\u0275fac=function(i){return new(i||o)(J(Qe),J($t),J(lt),J(pn),J(bn),J(je),J(Fe),J(vi),J(gn),J(Vo),J(gm),J(gi),J(Bp),J(Wi),J(y),J(Vn),J(Wv),J(yi),J(jv))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var LM=class extends li{constructor(o){super(o),this.getService(y).log("%c[WB] Creating CLASS: CommentElement","color: blue;"),this.getAllCommentAnnotations=this._getAllCommentAnnotations,this.deleteSelectedComment=this._deleteSelectedComment,this.enableTextComments=this._enableTextComments,this.disableTextComments=this._disableTextComments,this.allowedElementIds=this._allowedElementIds,this.allowedElementClassNames=this._allowedElementClassNames,this.allowedElementQuerySelectors=this._allowedElementQuerySelectors,this.disableFloatingCommentDialog=this._disableFloatingComments,this.enableFloatingCommentDialog=this._enableFloatingComments,this.attachComment=this._attachComment,this.openCommentSidebar=this._openCommentSidebar,this.closeCommentSidebar=this._closeCommentSidebar,this.toggleCommentSidebar=this._toggleCommentSidebar,this.enableModeratorMode=this._enableModeratorMode,this.disableModeratorMode=this._disableModeratorMode,this.enableStreamMode=this._enableStreamMode,this.disableStreamMode=this._disableStreamMode,this.enableSignInButton=this._enableSignInButton,this.disableSignInButton=this._disableSignInButton,this.enableUpgradeButton=this._enableUpgradeButton,this.disableUpgradeButton=this._disableUpgradeButton,this.onCommentModeChange=this._onCommentModeChange,this.enableAttachments=this._enableAttachment,this.disableAttachments=this._disableAttachment,this.isUserGlobalContact=this._isUserGlobalContact,this.enableDeviceInfo=this._enableDeviceInfo,this.disableDeviceInfo=this._disableDeviceInfo,this.enableCommentMode=this._enableCommentMode,this.disableCommentMode=this._disableCommentMode,this.enablePersistentCommentMode=this._enablePersistentCommentMode,this.disablePersistentCommentMode=this._disablePersistentCommentMode,this.enableCommentIndex=this._enableCommentIndex,this.disableCommentIndex=this._disableCommentIndex,this.enablePopoverMode=this._enablePopoverMode,this.disablePopoverMode=this._disablePopoverMode,this.enableDialogOnHover=this._enableDialogOnHover,this.enablePopoverTriangleComponent=this._enablePopoverTriangleComponent,this.disablePopoverTriangleComponent=this._disablePopoverTriangleComponent,this.disableDialogOnHover=this._disableDialogOnHover,this.enableDialogOnTargetElementClick=this._enableDialogOnTargetElementClick,this.disableDialogOnTargetElementClick=this._disableDialogOnTargetElementClick,this.enablePriority=this._enablePriority,this.disablePriority=this._disablePriority,this.enableStatus=this._enableStatus,this.disableStatus=this._disableStatus,this.enableResolveButton=this._enableResolveButton,this.disableResolveButton=this._disableResolveButton,this.enableGhostComments=this._enableGhostComments,this.disableGhostComments=this._disableGhostComments,this.enableGhostCommentsIndicator=this._enableGhostCommentsIndicator,this.disableGhostCommentsIndicator=this._disableGhostCommentsIndicator,this.setCustomStatus=this._setCustomStatus,this.setCustomPriority=this._setCustomPriority,this.setCustomCategory=this._setCustomCategory,this.enableInboxMode=this._enableInboxMode,this.disableInboxMode=this._disableInboxMode,this.enableAutoCategorize=this._enableAutoCategorize,this.disableAutoCategorize=this._disableAutoCategorize,this.enableDarkMode=this._enableDarkMode,this.disableDarkMode=this._disableDarkMode,this.setContextProvider=this._setContextProvider,this.enableSuggestionMode=this._enableSuggestionMode,this.disableSuggestionMode=this._disableSuggestionMode,this.enableMobileMode=this._enableMobileMode,this.disableMobileMode=this._disableMobileMode,this.enableInlineCommentMode=this._enableInlineCommentMode,this.disableInlineCommentMode=this._disableInlineCommentMode,this.enableMinimap=this._enableMinimap,this.disableMinimap=this._disableMinimap,this.showCommentsOnDom=this._showCommentsOnDom,this.hideCommentsOnDom=this._hideCommentsOnDom,this.enableCommentTool=this._enableCommentTool,this.disableCommentTool=this._disableCommentTool,this.setTotalMediaLength=this._setTotalMediaLength,this.onCommentAdd=this._onCommentAdd,this.onCommentUpdate=this._onCommentUpdate,this.addCommentOnSelectedText=this._addCommentOnSelectedText,this.enableSidebarUrlNavigation=this._enableSidebarUrlNavigation,this.disableSidebarUrlNavigation=this._disableSidebarUrlNavigation,this.setDStrategy=this._setDStrategy,this.enableSidebarButtonOnCommentDialog=this._enableSidebarButtonOnCommentDialog,this.disableSidebarButtonOnCommentDialog=this._disableSidebarButtonOnCommentDialog,this.onSidebarButtonOnCommentDialogClick=this._onSidebarButtonOnCommentDialogClick,this.enableReactions=this._enableReactions,this.disableReactions=this._disableReactions,this.setRecordings=this._setRecordings,this.addCommentOnElement=this._addCommentOnElement,this.enablePrivateCommentMode=this._enablePrivateCommentMode,this.disablePrivateCommentMode=this._disablePrivateCommentMode,this.enableScrollToComment=this._enableScrollToComment,this.disableScrollToComment=this._disableScrollToComment,this.enableUserMentions=this._enableUserMentions,this.disableUserMentions=this._disableUserMentions,this.setCommentSidebarFilters=this._setCommentSidebarFilters,this.enableCommentPinHighlighter=this._enableCommentPinHighlighter,this.disableCommentPinHighlighter=this._disableCommentPinHighlighter,this.enableDeleteOnBackspace=this._enableDeleteOnBackspace,this.disableDeleteOnBackspace=this._disableDeleteOnBackspace,this.enableHotkey=this._enableHotkey,this.disableHotkey=this._disableHotkey,this.enableDeviceIndicatorOnCommentPins=this._enableDeviceIndicatorOnCommentPins,this.disableDeviceIndicatorOnCommentPins=this._disableDeviceIndicatorOnCommentPins,this.getElementRefByAnnotationId=this._getElementRefByAnnotationId,this.scrollToCommentByAnnotationId=this._scrollToCommentByAnnotationId,this.selectCommentByAnnotationId=this._selectCommentByAnnotationId,this.enableRecordingSummary=this._enableRecordingSummary,this.disableRecordingSummary=this._disableRecordingSummary,this.enableRecordingTranscription=this._enableRecordingTranscription,this.disableRecordingTranscription=this._disableRecordingTranscription,this.enableRecordingCountdown=this._enableRecordingCountdown,this.disableRecordingCountdown=this._disableRecordingCountdown,this.setUnreadIndicatorMode=this._setUnreadIndicatorMode,this.enableEnterKeyToSubmit=this._enableEnterKeyToSubmit,this.disableEnterKeyToSubmit=this._disableEnterKeyToSubmit,this.enablePinShadowDOM=this._enablePinShadowDOM,this.disablePinShadowDOM=this._disablePinShadowDOM,this.enableDialogShadowDOM=this._enableDialogShadowDOM,this.disableDialogShadowDOM=this._disableDialogShadowDOM,this.enableSidebarShadowDOM=this._enableSidebarShadowDOM,this.disableSidebarShadowDOM=this._disableSidebarShadowDOM,this.enableChangeDetectionInCommentMode=this._enableChangeDetectionInCommentMode,this.disableChangeDetectionInCommentMode=this._disableChangeDetectionInCommentMode,this.showResolvedCommentsOnDom=this._showResolvedCommentsOnDom,this.hideResolvedCommentsOnDom=this._hideResolvedCommentsOnDom,this.setCustomReactions=this._setCustomReactions,this.onCommentSelectionChange=this._onCommentSelectionChange,this.getUnreadCommentCountByAnnotationId=this._getUnreadCommentCountByAnnotationId,this.getUnreadCommentAnnotationCountOnCurrentDocument=this._getUnreadCommentAnnotationCountOnCurrentDocument,this.getUnreadCommentCountOnCurrentDocument=this._getUnreadCommentCountOnCurrentDocument,this.getUnreadCommentAnnotationCountByLocationId=this._getUnreadCommentAnnotationCountByLocationId,this.getUnreadCommentCountByLocationId=this._getUnreadCommentCountByLocationId,this.updateCommentDialogPosition=this._updateCommentDialogPosition,this.enableAreaComment=this._enableAreaComment,this.disableAreaComment=this._disableAreaComment,this.setPinCursorImage=this._setPinCursorImage,this.addManualComment=this._addManualComment,this.createCustomListDataOnAnnotation=this._createCustomListDataOnAnnotation,this.createCustomListDataOnComment=this._createCustomListDataOnComment,this.excludeLocationIdsFromSidebar=this._excludeLocationIdsFromSidebar,this.enableBubbleOnPin=this._enableBubbleOnPin,this.disableBubbleOnPin=this._disableBubbleOnPin,this.enableBubbleOnPinHover=this._enableBubbleOnPinHover,this.disableBubbleOnPinHover=this._disableBubbleOnPinHover,this.enableMultiThreadMode=this._enableMultiThread,this.disableMultiThreadMode=this._disableMultiThread,this.enableMultiThread=this._enableMultiThread,this.disableMultiThread=this._disableMultiThread,this.updateContext=this._updateContext,this.getSelectedComments=this._getSelectedComments,this.enableDeleteReplyConfirmation=this._enableDeleteReplyConfirmation,this.disableDeleteReplyConfirmation=this._disableDeleteReplyConfirmation,this.onCopyLink=this._onCopyLink,this.getCommentAnnotationById=this._getCommentAnnotationById,this.enableCollapsedComments=this._enableCollapsedComments,this.disableCollapsedComments=this._disableCollapsedComments,this.onCommentSidebarActionButtonClick=this._onCommentSidebarActionButtonClick,this.setCommentSidebarData=this._setCommentSidebarData,this.onCommentSidebarInit=this._onCommentSidebarInit,this.onCommentSidebarData=this._onCommentSidebarData,this.setCommentSidebarDefaultCustomActions=this._setCommentSidebarDefaultCustomActions,this.enableSidebarCustomActions=this._enableSidebarCustomActions,this.disableSidebarCustomActions=this._disableSidebarCustomActions,this.enableQueryParamsComments=this._enableQueryParamsComments,this.disableQueryParamsComments=this._disableQueryParamsComments,this.enableResolveStatusAccessAdminOnly=this._enableResolveStatusAccessAdminOnly,this.disableResolveStatusAccessAdminOnly=this._disableResolveStatusAccessAdminOnly,this.enableSeenByUsers=this._enableSeenByUsers,this.disableSeenByUsers=this._disableSeenByUsers,this.enableShortUserName=this._enableShortUserName,this.disableShortUserName=this._disableShortUserName,this.addCommentAnnotation=this._addCommentAnnotation,this.approveCommentAnnotation=this._approveCommentAnnotation,this.acceptCommentAnnotation=this._acceptCommentAnnotation,this.rejectCommentAnnotation=this._rejectCommentAnnotation,this.subscribeCommentAnnotation=this._subscribeCommentAnnotation,this.unsubscribeCommentAnnotation=this._unsubscribeCommentAnnotation,this.deleteCommentAnnotation=this._deleteCommentAnnotation,this.getCommentAnnotations=this._getCommentAnnotations,this.getCommentAnnotationsCount=this._getCommentAnnotationsCount,this.assignUser=this._assignUser,this.updatePriority=this._updatePriority,this.updateStatus=this._updateStatus,this.updateAccess=this._updateAccess,this.resolveCommentAnnotation=this._resolveCommentAnnotation,this.getLink=this._getLink,this.copyLink=this._copyLink,this.addComment=this._addComment,this.updateComment=this._updateComment,this.deleteComment=this._deleteComment,this.getComment=this._getComment,this.addAttachment=this._addAttachment,this.deleteAttachment=this._deleteAttachment,this.getAttachment=this._getAttachment,this.deleteRecording=this._deleteRecording,this.getRecording=this._getRecording,this.addReaction=this._addReaction,this.deleteReaction=this._deleteReaction,this.toggleReaction=this._toggleReaction,this.enableReadOnly=this._enableReadOnly,this.disableReadOnly=this._disableReadOnly,this.enableCustomAutocompleteSearch=this._enableCustomAutocompleteSearch,this.disableCustomAutocompleteSearch=this._disableCustomAutocompleteSearch,this.fetchCommentAnnotations=this._fetchCommentAnnotations,this.setTransformContext=this._setTransformContext,this.enableSvgAsImg=this._enableSvgAsImg,this.disableSvgAsImg=this._disableSvgAsImg,this.enableFullExpanded=this._enableFullExpanded,this.disableFullExpanded=this._disableFullExpanded,this.enableCommentToNearestAllowedElement=this._enableCommentToNearestAllowedElement,this.disableCommentToNearestAllowedElement=this._disableCommentToNearestAllowedElement,this.enableDraftMode=this._enableDraftMode,this.disableDraftMode=this._disableDraftMode,this.on=this._on}_getAllCommentAnnotations(o,t){this.getService(y).log("%c[WB] Calling FUNCTION: getOnlineUsers","color: green;");try{return this.trackEvent(Z.Events.Comments.GET_ALL_COMMENT_ANNOTATIONS_TRIGGERED,{payload:{documentId:o,location:t}}),this.getService(Te).getAllCommentAnnotations({customClientDocumentId:o,params:t,excludeDomChanges:!0,skipPositionCalculation:!0}).pipe(ce(e=>e?.length?e?.map(i=>$n(i)):e))}catch(e){return this.getService(y).catch("Error in _getLiveCommentsOnCurrentDocument: ",e),re(null)}}_deleteSelectedComment(){this.getService(y).log("%c[WB] Calling FUNCTION: deleteSelectedComment","color: green;");try{return this.trackEvent(Z.Events.Comments.DELETE_SELECTED_COMMENT_TRIGGERED),this.getService(Te).deleteCommentPinAnnotations("commentElement")}catch(o){return this.getService(y).catch("Error in _deleteSelectedComment: ",o),Promise.resolve(null)}}_enableTextComments(){this.getService(y).log("%c[WB] Calling FUNCTION: enableTextComments","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_TEXT_COMMENTS_TRIGGERED),this.getService(Te).enableTextComments()}catch(o){this.getService(y).catch("Error in _enableTextComments: ",o)}}_disableTextComments(){this.getService(y).log("%c[WB] Calling FUNCTION: disableTextComments","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_TEXT_COMMENTS_TRIGGERED),this.getService(Te).disableTextComments()}catch(o){this.getService(y).catch("Error in _disableTextComments: ",o)}}_allowedElementIds(o){this.getService(y).log("%c[WB] Calling FUNCTION: allowedElementIds","color: green;");try{this.trackEvent(Z.Events.Comments.ALLOWED_ELEMENT_IDS_TRIGGERED,{payload:{elementIds:o}}),this.getService(Te).setAllowedElementIds(o)}catch(t){this.getService(y).catch("Error in allowedElementIds: ",t)}}_allowedElementClassNames(o){this.getService(y).log("%c[WB] Calling FUNCTION: allowedElementClassNames","color: green;");try{this.trackEvent(Z.Events.Comments.ALLOWED_ELEMENT_CLASS_NAMES_TRIGGERED,{payload:{classNames:o}}),this.getService(Te).setAllowedElementClassNames(o)}catch(t){this.getService(y).catch("Error in allowedElementClassNames: ",t)}}_allowedElementQuerySelectors(o){this.getService(y).log("%c[WB] Calling FUNCTION: allowedElementQuerySelectors","color: green;");try{this.trackEvent(Z.Events.Comments.ALLOWED_ELEMENT_QUERY_SELECTORS_TRIGGERED,{payload:{querySelectors:o}}),this.getService(Te).setAllowedElementQuerySelectors(o)}catch(t){this.getService(y).catch("Error in allowedElementQuerySelectors: ",t)}}_disableFloatingComments(){this.getService(y).log("%c[WB] Calling FUNCTION: disableFloatingComments","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_FLOATING_COMMENT_DIALOG_TRIGGERED),this.getService(Te).disableFloatingComments(!0)}catch(o){this.getService(y).catch("Error in _disableFloatingComments: ",o)}}_enableFloatingComments(){this.getService(y).log("%c[WB] Calling FUNCTION: enableFloatingComments","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_FLOATING_COMMENT_DIALOG_TRIGGERED),this.getService(Te).disableFloatingComments(!1)}catch(o){this.getService(y).catch("Error in _enableFloatingComments: ",o)}}_attachComment(o){this.getService(y).log("%c[WB] Calling FUNCTION: attachComment","color: green;");try{this.trackEvent(Z.Events.Comments.ATTACH_COMMENT_TRIGGERED,{payload:{elementId:o}}),this.getService(Te).attachComment(o,["id","data-id"])}catch(t){this.getService(y).catch("Error in _attachComment: ",t)}}_openCommentSidebar(){this.getService(y).log("%c[WB] Calling FUNCTION: openCommentSidebar","color: green;");try{this.trackEvent(Z.Events.Comments.OPEN_COMMENT_SIDEBAR_TRIGGERED),this.getService(Te).setSidebarVisibility(!0,!0)}catch(o){this.getService(y).catch("Error in _openCommentSidebar: ",o)}}_closeCommentSidebar(){this.getService(y).log("%c[WB] Calling FUNCTION: closeCommentSidebar","color: green;");try{this.trackEvent(Z.Events.Comments.CLOSE_COMMENT_SIDEBAR_TRIGGERED),this.getService(Te).setSidebarVisibility(!1,!0)}catch(o){this.getService(y).catch("Error in _closeCommentSidebar: ",o)}}_toggleCommentSidebar(){this.getService(y).log("%c[WB] Calling FUNCTION: toggleCommentSidebar","color: green;");try{this.trackEvent(Z.Events.Comments.TOGGLE_COMMENT_SIDEBAR_TRIGGERED),this.getService(Te).toggleSidebarVisibility(!0)}catch(o){this.getService(y).catch("Error in _toggleCommentSidebar: ",o)}}_enableModeratorMode(){this.getService(y).log("%c[WB] Calling FUNCTION: enableModeratorMode","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_MODERATOR_MODE_TRIGGERED),this.getService(Te).setModeratorMode(!0)}catch(o){this.getService(y).catch("Error in _enableModeratorMode: ",o)}}_disableModeratorMode(){this.getService(y).log("%c[WB] Calling FUNCTION: disableModeratorMode","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_MODERATOR_MODE_TRIGGERED),this.getService(Te).setModeratorMode(!1)}catch(o){this.getService(y).catch("Error in _disableModeratorMode: ",o)}}_enableStreamMode(){this.getService(y).log("%c[WB] Calling FUNCTION: enableStreamMode","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_STREAM_MODE_TRIGGERED),this.getService(Te).setStreamMode(!0)}catch(o){this.getService(y).catch("Error in _enableStreamMode: ",o)}}_disableStreamMode(){this.getService(y).log("%c[WB] Calling FUNCTION: disableStreamMode","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_STREAM_MODE_TRIGGERED),this.getService(Te).setStreamMode(!1)}catch(o){this.getService(y).catch("Error in _disableStreamMode: ",o)}}_enableSignInButton(){this.getService(y).log("%c[WB] Calling FUNCTION: enableSignInButton","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_SIGN_IN_BUTTON_TRIGGERED),this.getService(Te).enableSignInButton(!0)}catch(o){this.getService(y).catch("Error in _enableSignInButton: ",o)}}_disableSignInButton(){this.getService(y).log("%c[WB] Calling FUNCTION: disableSignInButton","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_SIGN_IN_BUTTON_TRIGGERED),this.getService(Te).enableSignInButton(!1)}catch(o){this.getService(y).catch("Error in _disableSignInButton: ",o)}}_enableUpgradeButton(){this.getService(y).log("%c[WB] Calling FUNCTION: enableUpgradeButton","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_UPGRADE_BUTTON_TRIGGERED),this.getService(Te).enableUpgradeButton(!0)}catch(o){this.getService(y).catch("Error in _enableUpgradeButton: ",o)}}_disableUpgradeButton(){this.getService(y).log("%c[WB] Calling FUNCTION: disableUpgradeButton","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_UPGRADE_BUTTON_TRIGGERED),this.getService(Te).enableUpgradeButton(!1)}catch(o){this.getService(y).catch("Error in _disableUpgradeButton: ",o)}}_onCommentModeChange(){this.getService(y).log("%c[WB] Calling FUNCTION: onCommentModeChange","color: green;");try{return this.trackEvent(Z.Events.Comments.ON_COMMENT_MODE_CHANGE_TRIGGERED),this.getService(Te).addCommentModeChange()}catch(o){return this.getService(y).catch("Error in _onCommentModeChange: ",o),re(!1)}}_enableAttachment(){this.getService(y).log("%c[WB] Calling FUNCTION: enableAttachment","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_ATTACHMENTS_TRIGGERED),this.getService(Te).enableAttachment(!0)}catch(o){this.getService(y).catch("Error in _enableAttachment: ",o)}}_disableAttachment(){this.getService(y).log("%c[WB] Calling FUNCTION: disableAttachment","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_ATTACHMENTS_TRIGGERED),this.getService(Te).enableAttachment(!1)}catch(o){this.getService(y).catch("Error in _disableAttachment: ",o)}}_isUserGlobalContact(){this.getService(y).log("%c[WB] Calling FUNCTION: isUserGlobalContact","color: green;");try{return this.trackEvent(Z.Events.Comments.IS_USER_GLOBAL_CONTACT_TRIGGERED),this.getService(Te).isUserGlobalContact$()}catch(o){return this.getService(y).catch("Error in _isUserGlobalContact: ",o),re(!1)}}_enableDeviceInfo(){this.getService(y).log("%c[WB] Calling FUNCTION: enableDeviceInfo","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_DEVICE_INFO_TRIGGERED),this.getService(Te).showScreenSizeInfo(!0)}catch(o){this.getService(y).catch("Error in _enableDeviceInfo: ",o)}}_disableDeviceInfo(){this.getService(y).log("%c[WB] Calling FUNCTION: disableDeviceInfo","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_DEVICE_INFO_TRIGGERED),this.getService(Te).showScreenSizeInfo(!1)}catch(o){this.getService(y).catch("Error in _disableDeviceInfo: ",o)}}_enableCommentMode(){this.getService(y).log("%c[WB] Calling FUNCTION: enableCommentMode","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_COMMENT_MODE_TRIGGERED),this.getService(Te).enableAddCommentMode()}catch(o){this.getService(y).catch("Error in _enableCommentMode: ",o)}}_disableCommentMode(){this.getService(y).log("%c[WB] Calling FUNCTION: disableCommentMode","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_COMMENT_MODE_TRIGGERED),this.getService(Te).disableAddCommentMode()}catch(o){this.getService(y).catch("Error in _disableCommentMode: ",o)}}_enablePersistentCommentMode(){this.getService(y).log("%c[WB] Calling FUNCTION: enablePersistentCommentMode","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_PERSISTENT_COMMENT_MODE_TRIGGERED),this.getService(Te).enablePersistentCommentMode()}catch(o){this.getService(y).catch("Error in _enablePersistentCommentMode: ",o)}}_disablePersistentCommentMode(){this.getService(y).log("%c[WB] Calling FUNCTION: disablePersistentCommentMode","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_PERSISTENT_COMMENT_MODE_TRIGGERED),this.getService(Te).disablePersistentCommentMode()}catch(o){this.getService(y).catch("Error in _disablePersistentCommentMode: ",o)}}_showCommentIndex(o){this.getService(y).log("%c[WB] Calling FUNCTION: showCommentIndex","color: green;");try{this.getService(Te).showCommentIndex(o)}catch(t){this.getService(y).catch("Error in _showCommentIndex: ",t)}}_enableCommentIndex(){this.getService(y).log("%c[WB] Calling FUNCTION: enableCommentIndex","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_COMMENT_INDEX_TRIGGERED),this.getService(Te).showCommentIndex(!0)}catch(o){this.getService(y).catch("Error in _enableCommentIndex: ",o)}}_disableCommentIndex(){this.getService(y).log("%c[WB] Calling FUNCTION: disableCommentIndex","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_COMMENT_INDEX_TRIGGERED),this.getService(Te).showCommentIndex(!1)}catch(o){this.getService(y).catch("Error in _disableCommentIndex: ",o)}}_enablePopoverMode(){this.getService(y).log("%c[WB] Calling FUNCTION: enablePopoverMode","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_POPOVER_MODE_TRIGGERED),this.getService(Te).enablePopoverMode()}catch(o){this.getService(y).catch("Error in _enablePopoverMode: ",o)}}_disablePopoverMode(){this.getService(y).log("%c[WB] Calling FUNCTION: disablePopoverMode","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_POPOVER_MODE_TRIGGERED),this.getService(Te).disablePopoverMode()}catch(o){this.getService(y).catch("Error in _disablePopoverMode: ",o)}}_enableDialogOnHover(){this.getService(y).log("%c[WB] Calling FUNCTION: enableDialogOnHover","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_DIALOG_ON_HOVER_TRIGGERED),this.getService(Te).setEnableDialogOnHover(!0)}catch(o){this.getService(y).catch("Error in _enableDialogOnHover: ",o)}}_disableDialogOnHover(){this.getService(y).log("%c[WB] Calling FUNCTION: disableDialogOnHover","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_DIALOG_ON_HOVER_TRIGGERED),this.getService(Te).setEnableDialogOnHover(!1)}catch(o){this.getService(y).catch("Error in _disableDialogOnHover: ",o)}}_enablePopoverTriangleComponent(){this.getService(y).log("%c[WB] Calling FUNCTION: enablePopoverTriangleComponent","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_POPOVER_TRIANGLE_COMPONENT_TRIGGERED),this.getService(Te).enablePopoverTriangleComponent()}catch(o){this.getService(y).catch("Error in _enablePopoverTriangleComponent: ",o)}}_disablePopoverTriangleComponent(){this.getService(y).log("%c[WB] Calling FUNCTION: disablePopoverTriangleComponent","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_POPOVER_TRIANGLE_COMPONENT_TRIGGERED),this.getService(Te).disablePopoverTriangleComponent()}catch(o){this.getService(y).catch("Error in _disablePopoverTriangleComponent: ",o)}}_enableDialogOnTargetElementClick(){this.getService(y).log("%c[WB] Calling FUNCTION: enableDialogOnTargetElementClick","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_DIALOG_ON_TARGET_ELEMENT_CLICK_TRIGGERED),this.getService(Te).setEnableDialogOnTargetElementClick(!0)}catch(o){this.getService(y).catch("Error in _enableDialogOnTargetElementClick: ",o)}}_disableDialogOnTargetElementClick(){this.getService(y).log("%c[WB] Calling FUNCTION: disableDialogOnTargetElementClick","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_DIALOG_ON_TARGET_ELEMENT_CLICK_TRIGGERED),this.getService(Te).setEnableDialogOnTargetElementClick(!1)}catch(o){this.getService(y).catch("Error in _disableDialogOnTargetElementClick: ",o)}}_enablePriority(){this.getService(y).log("%c[WB] Calling FUNCTION: enablePriority","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_PRIORITY_TRIGGERED),this.getService(Te).setEnablePriority(!0)}catch(o){this.getService(y).catch("Error in _enablePriority: ",o)}}_disablePriority(){this.getService(y).log("%c[WB] Calling FUNCTION: disablePriority","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_PRIORITY_TRIGGERED),this.getService(Te).setEnablePriority(!1)}catch(o){this.getService(y).catch("Error in _disablePriority: ",o)}}_enableStatus(){this.getService(y).log("%c[WB] Calling FUNCTION: enableStatus","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_STATUS_TRIGGERED),this.getService(Te).setEnableStatus(!0)}catch(o){this.getService(y).catch("Error in _enableStatus: ",o)}}_disableStatus(){this.getService(y).log("%c[WB] Calling FUNCTION: disableStatus","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_STATUS_TRIGGERED),this.getService(Te).setEnableStatus(!1)}catch(o){this.getService(y).catch("Error in _disableStatus: ",o)}}_enableResolveButton(){this.getService(y).log("%c[WB] Calling FUNCTION: enableResolveButton","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_RESOLVE_BUTTON_TRIGGERED),this.getService(Te).setEnableResolve(!0)}catch(o){this.getService(y).catch("Error in _enableResolveButton: ",o)}}_disableResolveButton(){this.getService(y).log("%c[WB] Calling FUNCTION: disableResolveButton","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_RESOLVE_BUTTON_TRIGGERED),this.getService(Te).setEnableResolve(!1)}catch(o){this.getService(y).catch("Error in _disableResolveButton: ",o)}}_enableGhostComments(){this.getService(y).log("%c[WB] Calling FUNCTION: enableGhostComments","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_GHOST_COMMENTS_TRIGGERED),this.getService(Te).enableGhostComments()}catch(o){this.getService(y).catch("Error in _enableGhostCommentsInDOM: ",o)}}_disableGhostComments(){this.getService(y).log("%c[WB] Calling FUNCTION: disableGhostComments","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_GHOST_COMMENTS_TRIGGERED),this.getService(Te).disableGhostComments()}catch(o){this.getService(y).catch("Error in _disableGhostComments: ",o)}}_enableGhostCommentsIndicator(){this.getService(y).log("%c[WB] Calling FUNCTION: enableGhostCommentsIndicator","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_GHOST_COMMENTS_INDICATOR_TRIGGERED),this.getService(Te).enableGhostCommentsMessage()}catch(o){this.getService(y).catch("Error in _enableGhostCommentsIndicator: ",o)}}_disableGhostCommentsIndicator(){this.getService(y).log("%c[WB] Calling FUNCTION: disableGhostCommentsIndicator","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_GHOST_COMMENTS_INDICATOR_TRIGGERED),this.getService(Te).disableGhostCommentsMessage()}catch(o){this.getService(y).catch("Error in _disableGhostCommentsIndicator: ",o)}}_setCustomStatus(o){this.getService(y).log("%c[WB] Calling FUNCTION: setCustomStatus","color: green;");try{this.trackEvent(Z.Events.Comments.SET_CUSTOM_STATUS_TRIGGERED,{payload:{customStatuses:o}}),this.getService(Te).setCustomStatuses(o)}catch(t){this.getService(y).catch("Error in _setCustomStatus: ",t)}}_enableInboxMode(){this.getService(y).log("%c[WB] Calling FUNCTION: enableInboxMode","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_INBOX_MODE_TRIGGERED),this.getService(Te).enableInboxMode()}catch(o){this.getService(y).catch("Error in _enableInboxMode: ",o)}}_setCustomPriority(o){this.getService(y).log("%c[WB] Calling FUNCTION: setCustomPriority","color: green;");try{this.trackEvent(Z.Events.Comments.SET_CUSTOM_PRIORITY_TRIGGERED,{payload:{customPriorities:o}}),this.getService(Te).setCustomPriorities(o)}catch(t){this.getService(y).catch("Error in _setCustomPriority: ",t)}}_setCustomCategory(o){this.getService(y).log("%c[WB] Calling FUNCTION: setCustomCategory","color: green;");try{this.trackEvent(Z.Events.Comments.SET_CUSTOM_CATEGORY_TRIGGERED,{payload:{customCategories:o}}),this.getService(Te).setCustomCategories(o)}catch(t){this.getService(y).catch("Error in _setCustomCategory: ",t)}}_disableInboxMode(){this.getService(y).log("%c[WB] Calling FUNCTION: disableInboxMode","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_INBOX_MODE_TRIGGERED),this.getService(Te).disableInboxMode()}catch(o){this.getService(y).catch("Error in _disableInboxMode: ",o)}}_enableAutoCategorize(){this.getService(y).log("%c[WB] Calling FUNCTION: enableAutoCategorize","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_AUTO_CATEGORIZE_TRIGGERED),this.getService(Te).setEnableAutoCategorize(!0)}catch(o){this.getService(y).catch("Error in _enableAutoCategorize: ",o)}}_disableAutoCategorize(){this.getService(y).log("%c[WB] Calling FUNCTION: disableAutoCategorize","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_AUTO_CATEGORIZE_TRIGGERED),this.getService(Te).setEnableAutoCategorize(!1)}catch(o){this.getService(y).catch("Error in _disableAutoCategorize: ",o)}}_enableDarkMode(){this.getService(y).log("%c[WB] Calling FUNCTION: enableDarkMode","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_DARK_MODE_TRIGGERED),this.getService(Te).setCommentContainerDarkMode(!0)}catch(o){this.getService(y).catch("Error in _enableDarkMode: ",o)}}_disableDarkMode(){this.getService(y).log("%c[WB] Calling FUNCTION: disableDarkMode","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_DARK_MODE_TRIGGERED),this.getService(Te).setCommentContainerDarkMode(!1)}catch(o){this.getService(y).catch("Error in _disableDarkMode: ",o)}}_setContextProvider(o){try{this.trackEvent(Z.Events.Comments.SET_CONTEXT_PROVIDER_TRIGGERED,{payload:{documentId:Bae,location}}),this.getService(Te).setContextProvider(o)}catch(t){this.getService(y).catch("Error in _setContextProvider: ",t)}}_enableSuggestionMode(){this.getService(y).log("%c[WB] Calling FUNCTION: enableSuggestionMode","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_SUGGESTION_MODE_TRIGGERED),this.getService(Te).setSuggestionMode(!0)}catch(o){this.getService(y).catch("Error in _enableSuggestionMode: ",o)}}_disableSuggestionMode(){this.getService(y).log("%c[WB] Calling FUNCTION: disableSuggestionMode","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_SUGGESTION_MODE_TRIGGERED),this.getService(Te).setSuggestionMode(!1)}catch(o){this.getService(y).catch("Error in _disableSuggestionMode: ",o)}}_enableMobileMode(){this.getService(y).log("%c[WB] Calling FUNCTION: enableMobileMode","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_MOBILE_MODE_TRIGGERED),this.getService(Te).setMobileMode(!0)}catch(o){this.getService(y).catch("Error in _enableMobileMode: ",o)}}_disableMobileMode(){this.getService(y).log("%c[WB] Calling FUNCTION: disableMobileMode","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_MOBILE_MODE_TRIGGERED),this.getService(Te).setMobileMode(!1)}catch(o){this.getService(y).catch("Error in _disableMobileMode: ",o)}}_enableInlineCommentMode(){this.getService(y).log("%c[WB] Calling FUNCTION: enableInlineCommentMode","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_INLINE_COMMENT_MODE_TRIGGERED),this.getService(Te).enableInlineCommentMode()}catch(o){this.getService(y).catch("Error in _enableInlineCommentMode: ",o)}}_disableInlineCommentMode(){this.getService(y).log("%c[WB] Calling FUNCTION: disableInlineCommentMode","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_INLINE_COMMENT_MODE_TRIGGERED),this.getService(Te).disableInlineCommentMode()}catch(o){this.getService(y).catch("Error in _disableInlineCommentMode: ",o)}}_enableMinimap(){this.getService(y).log("%c[WB] Calling FUNCTION: enableMinimap","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_MINIMAP_TRIGGERED),this.getService(Te).enableMinimap()}catch(o){this.getService(y).catch("Error in _enableMinimap: ",o)}}_disableMinimap(){this.getService(y).log("%c[WB] Calling FUNCTION: disableMinimap","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_MINIMAP_TRIGGERED),this.getService(Te).disableMinimap()}catch(o){this.getService(y).catch("Error in _disableMinimap: ",o)}}_showCommentsOnDom(){this.getService(y).log("%c[WB] Calling FUNCTION: showCommentsOnDom","color: green;");try{this.trackEvent(Z.Events.Comments.SHOW_COMMENTS_ON_DOM_TRIGGERED),this.getService(Te).showCommentsOnDom()}catch(o){this.getService(y).catch("Error in _showCommentsOnDom: ",o)}}_hideCommentsOnDom(){this.getService(y).log("%c[WB] Calling FUNCTION: hideCommentsOnDom","color: green;");try{this.trackEvent(Z.Events.Comments.HIDE_COMMENTS_ON_DOM_TRIGGERED),this.getService(Te).hideCommentsOnDom()}catch(o){this.getService(y).catch("Error in _hideCommentsOnDom: ",o)}}_enableCommentTool(){this.getService(y).log("%c[WB] Calling FUNCTION: enableCommentTool","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_COMMENT_TOOL_TRIGGERED),this.getService(Te).enableCommentTool()}catch(o){this.getService(y).catch("Error in _enableCommentTool: ",o)}}_disableCommentTool(){this.getService(y).log("%c[WB] Calling FUNCTION: disableCommentTool","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_COMMENT_TOOL_TRIGGERED),this.getService(Te).disableCommentTool()}catch(o){this.getService(y).catch("Error in _disableCommentTool: ",o)}}_setTotalMediaLength(o){this.getService(y).log("%c[WB] Calling FUNCTION: setTotalMediaLength","color: green;");try{this.trackEvent(Z.Events.Comments.SET_TOTAL_MEDIA_LENGTH_TRIGGERED,{payload:{length:o}}),this.getService(Te).setTotalMediaLength(o)}catch(t){this.getService(y).catch("Error in _setTotalMediaLength: ",t)}}_onCommentAdd(){this.getService(y).log("%c[WB] Calling FUNCTION: onCommentAdd","color: green;");try{return this.trackEvent(Z.Events.Comments.ON_COMMENT_ADD_TRIGGERED),this.getService(Te).onCommentAdd$()}catch(o){return this.getService(y).catch("Error in _onCommentAdd: ",o),re()}}_onCommentUpdate(){this.getService(y).log("%c[WB] Calling FUNCTION: onCommentUpdate","color: green;");try{return this.trackEvent(Z.Events.Comments.ON_COMMENT_UPDATE_TRIGGERED),this.getService(Te).onCommentUpdate$()}catch(o){return this.getService(y).catch("Error in _onCommentUpdate: ",o),re()}}_addCommentOnSelectedText(){this.getService(y).log("%c[WB] Calling FUNCTION: addCommentOnSelectedText","color: green;");try{this.trackEvent(Z.Events.Comments.ADD_COMMENT_ON_SELECTED_TEXT_TRIGGERED),this.getService(Te).addCommentOnSelectedText()}catch(o){this.getService(y).catch("Error in _addCommentOnSelectedText: ",o)}}_enableSidebarUrlNavigation(){this.getService(y).log("%c[WB] Calling FUNCTION: enableSidebarUrlNavigation","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_SIDEBAR_URL_NAVIGATION_TRIGGERED),this.getService(Te).enableSidebarUrlNavigation()}catch(o){this.getService(y).catch("Error in _enableSidebarUrlNavigation: ",o)}}_disableSidebarUrlNavigation(){this.getService(y).log("%c[WB] Calling FUNCTION: disableSidebarUrlNavigation","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_SIDEBAR_URL_NAVIGATION_TRIGGERED),this.getService(Te).disableSidebarUrlNavigation()}catch(o){this.getService(y).catch("Error in _disableSidebarUrlNavigation: ",o)}}_setDStrategy(o){this.getService(y).log("%c[WB] Calling FUNCTION: setDStrategy","color: green;");try{this.trackEvent(Z.Events.Comments.SET_D_STRATEGY_TRIGGERED,{payload:{strategy:o}}),this.getService(Te).setDetectionStrategy(o)}catch(t){this.getService(y).catch("Error in _setDStrategy: ",t)}}_enableSidebarButtonOnCommentDialog(){this.getService(y).log("%c[WB] Calling FUNCTION: enableSidebarButtonOnCommentDialog","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_SIDEBAR_BUTTON_ON_COMMENT_DIALOG_TRIGGERED),this.getService(Te).enableSidebarButtonOnCommentDialog()}catch(o){this.getService(y).catch("Error in _enableSidebarButtonOnCommentDialog: ",o)}}_disableSidebarButtonOnCommentDialog(){this.getService(y).log("%c[WB] Calling FUNCTION: disableSidebarButtonOnCommentDialog","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_SIDEBAR_BUTTON_ON_COMMENT_DIALOG_TRIGGERED),this.getService(Te).disableSidebarButtonOnCommentDialog()}catch(o){this.getService(y).catch("Error in _disableSidebarButtonOnCommentDialog: ",o)}}_onSidebarButtonOnCommentDialogClick(){this.getService(y).log("%c[WB] Calling FUNCTION: onSidebarButtonOnCommentDialogClick","color: green;");try{return this.trackEvent(Z.Events.Comments.ON_SIDEBAR_BUTTON_ON_COMMENT_DIALOG_CLICK_TRIGGERED),this.getService(Te).getSidebarButtonOnCommentDialogClick$()}catch(o){return this.getService(y).catch("Error in _onSidebarButtonOnCommentDialogClick: ",o),re(null)}}_enableReactions(){this.getService(y).log("%c[WB] Calling FUNCTION: enableReactions","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_REACTIONS_TRIGGERED),this.getService(Te).enableReactions()}catch(o){this.getService(y).catch("Error in _enableReactions: ",o)}}_disableReactions(){this.getService(y).log("%c[WB] Calling FUNCTION: disableReactions","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_REACTIONS_TRIGGERED),this.getService(Te).disableReactions()}catch(o){this.getService(y).catch("Error in _disableReactions: ",o)}}_setRecordings(o){this.getService(y).log("%c[WB] Calling FUNCTION: setRecordings","color: green;");try{this.trackEvent(Z.Events.Comments.SET_RECORDINGS_TRIGGERED,{payload:{allowedRecordings:o}}),typeof o=="string"&&(o=o?.split(",")?.map(t=>t.trim())),this.getService(Te).setAllowedRecordings(o)}catch(t){this.getService(y).catch("Error in _setRecordings: ",t)}}_addCommentOnElement(o){this.getService(y).log("%c[WB] Calling FUNCTION: addCommentOnElement","color: green;");try{this.trackEvent(Z.Events.Comments.ADD_COMMENT_ON_ELEMENT_TRIGGERED,{payload:{data:o}}),this.getService(Te).addCommentOnElement(o)}catch(t){this.getService(y).catch("Error in _addCommentOnElement: ",t)}}_enablePrivateCommentMode(){this.getService(y).log("%c[WB] Calling FUNCTION: enablePrivateCommentMode","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_PRIVATE_COMMENT_MODE_TRIGGERED),this.getService(Te).enablePrivateCommentMode()}catch(o){this.getService(y).catch("Error in _enablePrivateCommentMode: ",o)}}_disablePrivateCommentMode(){this.getService(y).log("%c[WB] Calling FUNCTION: disablePrivateCommentMode","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_PRIVATE_COMMENT_MODE_TRIGGERED),this.getService(Te).disablePrivateCommentMode()}catch(o){this.getService(y).catch("Error in _disablePrivateCommentMode: ",o)}}_enableScrollToComment(){this.getService(y).log("%c[WB] Calling FUNCTION: enableScrollToComment","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_SCROLL_TO_COMMENT_TRIGGERED),this.getService(Te).enableScrollToComment()}catch(o){this.getService(y).catch("Error in _enableScrollToComment: ",o)}}_disableScrollToComment(){this.getService(y).log("%c[WB] Calling FUNCTION: disableScrollToComment","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_SCROLL_TO_COMMENT_TRIGGERED),this.getService(Te).disableScrollToComment()}catch(o){this.getService(y).catch("Error in _disableScrollToComment: ",o)}}_enableUserMentions(){this.getService(y).log("%c[WB] Calling FUNCTION: enableUserMentions","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_USER_MENTIONS_TRIGGERED),this.getService(Te).enableUserMentions()}catch(o){this.getService(y).catch("Error in _enableUserMentions: ",o)}}_disableUserMentions(){this.getService(y).log("%c[WB] Calling FUNCTION: disableUserMentions","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_USER_MENTIONS_TRIGGERED),this.getService(Te).disableUserMentions()}catch(o){this.getService(y).catch("Error in _disableUserMentions: ",o)}}_setCommentSidebarFilters(o){this.getService(y).log("%c[WB] Calling FUNCTION: setCommentSidebarFilters","color: green;");try{this.trackEvent(Z.Events.Comments.SET_COMMENT_SIDEBAR_FILTERS_TRIGGERED,{payload:{filters:o}}),this.getService(Te).setCommentSidebarFilters(o)}catch(t){this.getService(y).catch("Error in _setCommentSidebarFilters: ",t)}}_enableCommentPinHighlighter(){this.getService(y).log("%c[WB] Calling FUNCTION: enableCommentPinHighlighter","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_COMMENT_PIN_HIGHLIGHTER_TRIGGERED),this.getService(Te).enableCommentPinHighlighter()}catch(o){this.getService(y).catch("Error in _enableCommentPinHighlighter: ",o)}}_disableCommentPinHighlighter(){this.getService(y).log("%c[WB] Calling FUNCTION: disableCommentPinHighlighter","color: green;");try{this.getService(Te).disableCommentPinHighlighter()}catch(o){this.getService(y).catch("Error in _disableCommentPinHighlighter: ",o)}}_enableDeleteOnBackspace(){this.getService(y).log("%c[WB] Calling FUNCTION: enableDeleteOnBackspace","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_DELETE_ON_BACKSPACE_TRIGGERED),this.getService(Te).enableDeleteOnBackspace()}catch(o){this.getService(y).catch("Error in _enableDeleteOnBackspace: ",o)}}_disableDeleteOnBackspace(){this.getService(y).log("%c[WB] Calling FUNCTION: disableDeleteOnBackspace","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_DELETE_ON_BACKSPACE_TRIGGERED),this.getService(Te).disableDeleteOnBackspace()}catch(o){this.getService(y).catch("Error in _disableDeleteOnBackspace: ",o)}}_enableHotkey(){this.getService(y).log("%c[WB] Calling FUNCTION: enableHotkey","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_HOTKEY_TRIGGERED),this.getService(Te).enableHotkey()}catch(o){this.getService(y).catch("Error in _enableHotkey: ",o)}}_disableHotkey(){this.getService(y).log("%c[WB] Calling FUNCTION: disableHotkey","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_HOTKEY_TRIGGERED),this.getService(Te).disableHotkey()}catch(o){this.getService(y).catch("Error in _disableHotkey: ",o)}}_enableDeviceIndicatorOnCommentPins(){this.getService(y).log("%c[WB] Calling FUNCTION: enableDeviceIndicatorOnCommentPins","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_DEVICE_INDICATOR_ON_COMMENT_PINS_TRIGGERED),this.getService(Te).enableDeviceIndicatorOnCommentPins()}catch(o){this.getService(y).catch("Error in _enableDeviceIndicatorOnCommentPins: ",o)}}_disableDeviceIndicatorOnCommentPins(){this.getService(y).log("%c[WB] Calling FUNCTION: disableDeviceIndicatorOnCommentPins","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_DEVICE_INDICATOR_ON_COMMENT_PINS_TRIGGERED),this.getService(Te).disableDeviceIndicatorOnCommentPins()}catch(o){this.getService(y).catch("Error in _disableDeviceIndicatorOnCommentPins: ",o)}}_getElementRefByAnnotationId(o){this.getService(y).log("%c[WB] Calling FUNCTION: getElementRefByAnnotationId","color: green;");try{return this.trackEvent(Z.Events.Comments.GET_ELEMENT_REF_BY_ANNOTATION_ID_TRIGGERED,{payload:{annotationId:o}}),this.getService(Te).getElementRefByAnnotationId(o)}catch(t){this.getService(y).catch("Error in _getElementRefByAnnotationId: ",t);return}}_scrollToCommentByAnnotationId(o){this.getService(y).log("%c[WB] Calling FUNCTION: scrollToCommentByAnnotationId","color: green;");try{this.trackEvent(Z.Events.Comments.SCROLL_TO_COMMENT_BY_ANNOTATION_ID_TRIGGERED,{payload:{annotationId:o}}),this.getService(Te).scrollToCommentByAnnotationId(o)}catch(t){this.getService(y).catch("Error in _scrollToCommentByAnnotationId: ",t)}}_selectCommentByAnnotationId(o){this.getService(y).log("%c[WB] Calling FUNCTION: selectCommentByAnnotationId","color: green;");try{this.trackEvent(Z.Events.Comments.SELECT_COMMENT_BY_ANNOTATION_ID_TRIGGERED,{payload:{annotationId:o}}),this.getService(Te).selectCommentByAnnotationId(o)}catch(t){this.getService(y).catch("Error in _selectCommentByAnnotationId: ",t)}}_enableRecordingSummary(){this.getService(y).log("%c[WB] Calling FUNCTION: enableRecordingSummary","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_RECORDING_SUMMARY_TRIGGERED),this.getService(Te).enableRecordingSummary()}catch(o){this.getService(y).catch("Error in _enableRecordingSummary: ",o)}}_disableRecordingSummary(){this.getService(y).log("%c[WB] Calling FUNCTION: disableRecordingSummary","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_RECORDING_SUMMARY_TRIGGERED),this.getService(Te).disableRecordingSummary()}catch(o){this.getService(y).catch("Error in _disableRecordingSummary: ",o)}}_enableRecordingTranscription(){this.getService(y).log("%c[WB] Calling FUNCTION: enableRecordingTranscription","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_RECORDING_TRANSCRIPTION_TRIGGERED),this.getService(Xi).enableRecordingTranscription()}catch(o){this.getService(y).catch("Error in _enableRecordingTranscription: ",o)}}_disableRecordingTranscription(){this.getService(y).log("%c[WB] Calling FUNCTION: disableRecordingTranscription","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_RECORDING_TRANSCRIPTION_TRIGGERED),this.getService(Xi).disableRecordingTranscription()}catch(o){this.getService(y).catch("Error in _disableRecordingTranscription: ",o)}}_enableRecordingCountdown(){this.getService(y).log("%c[WB] Calling FUNCTION: enableRecordingCountdown","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_RECORDING_COUNTDOWN_TRIGGERED),this.getService(Te).enableRecordingCountdown()}catch(o){this.getService(y).catch("Error in _enableRecordingCountdown: ",o)}}_disableRecordingCountdown(){this.getService(y).log("%c[WB] Calling FUNCTION: disableRecordingCountdown","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_RECORDING_COUNTDOWN_TRIGGERED),this.getService(Te).disableRecordingCountdown()}catch(o){this.getService(y).catch("Error in _disableRecordingCountdown: ",o)}}_setUnreadIndicatorMode(o){this.getService(y).log("%c[WB] Calling FUNCTION: setUnreadIndicatorMode","color: green;");try{this.trackEvent(Z.Events.Comments.SET_UNREAD_INDICATOR_MODE_TRIGGERED,{payload:{mode:o}}),this.getService(Te).setUnreadIndicatorMode(o)}catch(t){this.getService(y).catch("Error in _setUnreadIndicatorMode: ",t)}}_enableEnterKeyToSubmit(){this.getService(y).log("%c[WB] Calling FUNCTION: enableEnterKeyToSubmit","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_ENTER_KEY_TO_SUBMIT_TRIGGERED),this.getService(Te).enableEnterKeyToSubmit()}catch(o){this.getService(y).catch("Error in _enableEnterKeyToSubmit: ",o)}}_disableEnterKeyToSubmit(){this.getService(y).log("%c[WB] Calling FUNCTION: disableEnterKeyToSubmit","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_ENTER_KEY_TO_SUBMIT_TRIGGERED),this.getService(Te).disableEnterKeyToSubmit()}catch(o){this.getService(y).catch("Error in _disableEnterKeyToSubmit: ",o)}}_enablePinShadowDOM(){this.getService(y).log("%c[WB] Calling FUNCTION: enablePinShadowDOM","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_PIN_SHADOW_DOM_TRIGGERED),this.getService(Te).enablePinShadowDOM()}catch(o){this.getService(y).catch("Error in _enablePinShadowDOM: ",o)}}_disablePinShadowDOM(){this.getService(y).log("%c[WB] Calling FUNCTION: disablePinShadowDOM","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_PIN_SHADOW_DOM_TRIGGERED),this.getService(Te).disablePinShadowDOM()}catch(o){this.getService(y).catch("Error in _disablePinShadowDOM: ",o)}}_enableDialogShadowDOM(){this.getService(y).log("%c[WB] Calling FUNCTION: enableDialogShadowDOM","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_DIALOG_SHADOW_DOM_TRIGGERED),this.getService(Te).enableDialogShadowDOM()}catch(o){this.getService(y).catch("Error in _enableDialogShadowDOM: ",o)}}_disableDialogShadowDOM(){this.getService(y).log("%c[WB] Calling FUNCTION: disableDialogShadowDOM","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_DIALOG_SHADOW_DOM_TRIGGERED),this.getService(Te).disableDialogShadowDOM()}catch(o){this.getService(y).catch("Error in _disableDialogShadowDOM: ",o)}}_enableSidebarShadowDOM(){this.getService(y).log("%c[WB] Calling FUNCTION: enableSidebarShadowDOM","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_SIDEBAR_SHADOW_DOM_TRIGGERED),this.getService(Te).enableSidebarShadowDOM()}catch(o){this.getService(y).catch("Error in _enableSidebarShadowDOM: ",o)}}_disableSidebarShadowDOM(){this.getService(y).log("%c[WB] Calling FUNCTION: disableSidebarShadowDOM","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_SIDEBAR_SHADOW_DOM_TRIGGERED),this.getService(Te).disableSidebarShadowDOM()}catch(o){this.getService(y).catch("Error in _disableSidebarShadowDOM: ",o)}}_enableChangeDetectionInCommentMode(){this.getService(y).log("%c[WB] Calling FUNCTION: enableChangeDetectionInCommentMode","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_CHANGE_DETECTION_IN_COMMENT_MODE_TRIGGERED),this.getService(Te).enableChangeDetectionInCommentMode()}catch(o){this.getService(y).catch("Error in _enableChangeDetectionInCommentMode: ",o)}}_disableChangeDetectionInCommentMode(){this.getService(y).log("%c[WB] Calling FUNCTION: disableChangeDetectionInCommentMode","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_CHANGE_DETECTION_IN_COMMENT_MODE_TRIGGERED),this.getService(Te).disableChangeDetectionInCommentMode()}catch(o){this.getService(y).catch("Error in _disableChangeDetectionInCommentMode: ",o)}}_showResolvedCommentsOnDom(){this.getService(y).log("%c[WB] Calling FUNCTION: showResolvedCommentsOnDom","color: green;");try{this.trackEvent(Z.Events.Comments.SHOW_RESOLVED_COMMENTS_ON_DOM_TRIGGERED),this.getService(Te).showResolvedCommentsOnDom()}catch(o){this.getService(y).catch("Error in _showResolvedCommentsOnDom: ",o)}}_hideResolvedCommentsOnDom(){this.getService(y).log("%c[WB] Calling FUNCTION: hideResolvedCommentsOnDom","color: green;");try{this.trackEvent(Z.Events.Comments.HIDE_RESOLVED_COMMENTS_ON_DOM_TRIGGERED),this.getService(Te).hideResolvedCommentsOnDom()}catch(o){this.getService(y).catch("Error in _hideResolvedCommentsOnDom: ",o)}}_setCustomReactions(o){this.getService(y).log("%c[WB] Calling FUNCTION: setCustomReactions","color: green;");try{this.trackEvent(Z.Events.Comments.SET_CUSTOM_REACTIONS_TRIGGERED,{payload:{reactions:o}}),this.getService(Te).setCustomReactions(o)}catch(t){this.getService(y).catch("Error in _setCustomReactions: ",t)}}_onCommentSelectionChange(){this.getService(y).log("%c[WB] Calling FUNCTION: onCommentSelectionChange","color: green;");try{return this.trackEvent(Z.Events.Comments.ON_COMMENT_SELECTION_CHANGE_TRIGGERED),this.getService(Te).onCommentSelectionChange$()}catch(o){return this.getService(y).catch("Error in _onCommentSelectionChange: ",o),re(null)}}_getUnreadCommentCountByAnnotationId(o){this.getService(y).log("%c[WB] Calling FUNCTION: getUnreadCommentCountByAnnotationId","color: green;");try{return this.trackEvent(Z.Events.Comments.GET_UNREAD_COMMENT_COUNT_BY_ANNOTATION_ID_TRIGGERED,{payload:{commentAnnotationId:o}}),this.getService(Te).getUnreadCommentCountByAnnotationId$(o)}catch(t){return this.getService(y).catch("Error in _getUnreadCommentCountByAnnotationId: ",t),re(null)}}_getUnreadCommentAnnotationCountOnCurrentDocument(){this.getService(y).log("%c[WB] Calling FUNCTION: getUnreadCommentAnnotationCountOnCurrentDocument","color: green;");try{return this.trackEvent(Z.Events.Comments.GET_UNREAD_COMMENT_ANNOTATION_COUNT_ON_CURRENT_DOCUMENT_TRIGGERED),this.getService(Te).getUnreadCommentAnnotationCountOnCurrentDocument$()}catch(o){return this.getService(y).catch("Error in _getUnreadCommentAnnotationCountOnCurrentDocument: ",o),re(null)}}_getUnreadCommentCountOnCurrentDocument(){this.getService(y).log("%c[WB] Calling FUNCTION: getUnreadCommentCountOnCurrentDocument","color: green;");try{return this.trackEvent(Z.Events.Comments.GET_UNREAD_COMMENT_COUNT_ON_CURRENT_DOCUMENT_TRIGGERED),this.getService(Te).getUnreadCommentCountOnCurrentDocument$()}catch(o){return this.getService(y).catch("Error in _getUnreadCommentCountOnCurrentDocument: ",o),re(null)}}_getUnreadCommentAnnotationCountByLocationId(o){this.getService(y).log("%c[WB] Calling FUNCTION: getUnreadCommentAnnotationCountByLocationId","color: green;");try{return this.trackEvent(Z.Events.Comments.GET_UNREAD_COMMENT_ANNOTATION_COUNT_BY_LOCATION_ID_TRIGGERED,{payload:{locationId:o}}),this.getService(Te).getUnreadCommentAnnotationCountByLocationId$(o)}catch(t){return this.getService(y).catch("Error in _getUnreadCommentAnnotationCountByLocationId: ",t),re(null)}}_getUnreadCommentCountByLocationId(o){this.getService(y).log("%c[WB] Calling FUNCTION: getUnreadCommentCountByLocationId","color: green;");try{return this.trackEvent(Z.Events.Comments.GET_UNREAD_COMMENT_COUNT_BY_LOCATION_ID_TRIGGERED,{payload:{locationId:o}}),this.getService(Te).getUnreadCommentCountByLocationId$(o)}catch(t){return this.getService(y).catch("Error in _getUnreadCommentCountByLocationId: ",t),re(null)}}_updateCommentDialogPosition(){this.getService(y).log("%c[WB] Calling FUNCTION: updateCommentDialogPosition","color: green;");try{this.trackEvent(Z.Events.Comments.UPDATE_COMMENT_DIALOG_POSITION_TRIGGERED),this.getService(Te).updateCommentDialogPosition()}catch(o){this.getService(y).catch("Error in _updateCommentDialogPosition: ",o)}}_enableAreaComment(){this.getService(y).log("%c[WB] Calling FUNCTION: enableAreaComment","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_AREA_COMMENT_TRIGGERED),this.getService(Te).enableAreaComment()}catch(o){this.getService(y).catch("Error in _enableAreaComment: ",o)}}_disableAreaComment(){this.getService(y).log("%c[WB] Calling FUNCTION: disableAreaComment","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_AREA_COMMENT_TRIGGERED),this.getService(Te).disableAreaComment()}catch(o){this.getService(y).catch("Error in _disableAreaComment: ",o)}}_setPinCursorImage(o){this.getService(y).log("%c[WB] Calling FUNCTION: setPinCursorImage","color: green;");try{this.trackEvent(Z.Events.Comments.SET_PIN_CURSOR_IMAGE_TRIGGERED,{payload:{image:o}}),this.getService(Te).setPinCursorImage(o)}catch(t){this.getService(y).catch("Error in _setPinCursorImage: ",t)}}_addManualComment(o){this.getService(y).log("%c[WB] Calling FUNCTION: addManualComment","color: green;");try{return this.trackEvent(Z.Events.Comments.ADD_MANUAL_COMMENT_TRIGGERED,{payload:{config:o}}),this.getService(Te).addManualComment(o)}catch(t){return this.getService(y).catch("Error in _addManualComment: ",t),Promise.resolve()}}_createCustomListDataOnAnnotation(o){this.getService(y).log("%c[WB] Calling FUNCTION: createCustomListDataOnAnnotation","color: green;");try{this.trackEvent(Z.Events.Comments.CREATE_CUSTOM_LIST_DATA_ON_ANNOTATION_TRIGGERED,{payload:{data:o}}),this.getService(Te).createCustomListDataOnAnnotation(o)}catch(t){this.getService(y).catch("Error in _createCustomListDataOnAnnotation: ",t)}}_createCustomListDataOnComment(o){this.getService(y).log("%c[WB] Calling FUNCTION: createCustomListDataOnComment","color: green;");try{return this.trackEvent(Z.Events.Comments.CREATE_CUSTOM_LIST_DATA_ON_COMMENT_TRIGGERED,{payload:{data:o}}),this.getService(Hs).create(o)}catch(t){this.getService(y).catch("Error in _createCustomListDataOnComment: ",t)}}_excludeLocationIdsFromSidebar(o){this.getService(y).log("%c[WB] Calling FUNCTION: excludeLocationIdsFromSidebar","color: green;");try{this.trackEvent(Z.Events.Comments.EXCLUDE_LOCATION_IDS_FROM_SIDEBAR_TRIGGERED,{payload:{locationIds:o}}),this.getService(Te).setExcludeLocationIdsFromSidebar(o)}catch(t){this.getService(y).catch("Error in _excludeLocationIdsFromSidebar: ",t)}}_enableBubbleOnPin(){this.getService(y).log("%c[WB] Calling FUNCTION: enableBubbleOnPin","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_BUBBLE_ON_PIN_TRIGGERED),this.getService(Te).enableBubbleOnPin()}catch(o){this.getService(y).catch("Error in _enableBubbleOnPin: ",o)}}_disableBubbleOnPin(){this.getService(y).log("%c[WB] Calling FUNCTION: disableBubbleOnPin","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_BUBBLE_ON_PIN_TRIGGERED),this.getService(Te).disableBubbleOnPin()}catch(o){this.getService(y).catch("Error in _disableBubbleOnPin: ",o)}}_enableBubbleOnPinHover(){this.getService(y).log("%c[WB] Calling FUNCTION: enableBubbleOnPinHover","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_BUBBLE_ON_PIN_HOVER_TRIGGERED),this.getService(Te).enableBubbleOnPinHover()}catch(o){this.getService(y).catch("Error in _enableBubbleOnPinHover: ",o)}}_disableBubbleOnPinHover(){this.getService(y).log("%c[WB] Calling FUNCTION: disableBubbleOnPinHover","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_BUBBLE_ON_PIN_HOVER_TRIGGERED),this.getService(Te).disableBubbleOnPinHover()}catch(o){this.getService(y).catch("Error in _disableBubbleOnPinHover: ",o)}}_enableMultiThread(){this.getService(y).log("%c[WB] Calling FUNCTION: enableMultiThread","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_MULTI_THREAD_TRIGGERED),this.getService(Te).enableMultiThread()}catch(o){this.getService(y).catch("Error in _enableMultiThread: ",o)}}_disableMultiThread(){this.getService(y).log("%c[WB] Calling FUNCTION: disableMultiThread","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_MULTI_THREAD_TRIGGERED),this.getService(Te).disableMultiThread()}catch(o){this.getService(y).catch("Error in _disableMultiThread: ",o)}}_updateContext(o,t,e){this.getService(y).log("%c[WB] Calling FUNCTION: updateContext","color: green;");try{return this.trackEvent(Z.Events.Comments.UPDATE_CONTEXT_TRIGGERED,{payload:{annotationId:o,context:t,config:e}}),this.getService(Te).updateCommentAnnotationContext(o,t,e)}catch(i){return this.getService(y).catch("Error in _updateContext: ",i),Promise.resolve()}}_getSelectedComments(){this.getService(y).log("%c[WB] Calling FUNCTION: getSelectedComments","color: green;");try{return this.trackEvent(Z.Events.Comments.GET_SELECTED_COMMENTS_TRIGGERED),this.getService(Fe).getSelectedComments$()}catch(o){return this.getService(y).catch("Error in _getSelectedComments: ",o),re([])}}_enableDeleteReplyConfirmation(){this.getService(y).log("%c[WB] Calling FUNCTION: enableDeleteReplyConfirmation","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_DELETE_REPLY_CONFIRMATION_TRIGGERED),this.getService(Te).enableDeleteReplyConfirmation()}catch(o){this.getService(y).catch("Error in _enableDeleteReplyConfirmation: ",o)}}_disableDeleteReplyConfirmation(){this.getService(y).log("%c[WB] Calling FUNCTION: disableDeleteReplyConfirmation","color: green;");try{this.getService(Te).disableDeleteReplyConfirmation()}catch(o){this.getService(y).catch("Error in _disableDeleteReplyConfirmation: ",o)}}_onCopyLink(){this.getService(y).log("%c[WB] Calling FUNCTION: onCopyLink","color: green;");try{return this.trackEvent(Z.Events.Comments.ON_COPY_LINK_TRIGGERED),this.getService(Te).getCopyLink$()}catch(o){return this.getService(y).catch("Error in _onCopyLink: ",o),re("")}}_getCommentAnnotationById(o){this.getService(y).log("%c[WB] Calling FUNCTION: getCommentAnnotationById","color: green;");try{return this.trackEvent(Z.Events.Comments.GET_COMMENT_ANNOTATION_BY_ID_TRIGGERED,{payload:{config:o}}),this.getService(Te).getCommentAnnotationById(o)}catch(t){return this.getService(y).catch("Error in _getCommentAnnotationById: ",t),re(null)}}_enableCollapsedComments(){this.getService(y).log("%c[WB] Calling FUNCTION: enableCollapsedComments","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_COLLAPSED_COMMENTS_TRIGGERED),this.getService(Te).enableCollapsedComments()}catch(o){this.getService(y).catch("Error in _enableCollapsedComments: ",o)}}_disableCollapsedComments(){this.getService(y).log("%c[WB] Calling FUNCTION: disableCollapsedComments","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_COLLAPSED_COMMENTS_TRIGGERED),this.getService(Te).disableCollapsedComments()}catch(o){this.getService(y).catch("Error in _disableCollapsedComments: ",o)}}_onCommentSidebarActionButtonClick(){this.getService(y).log("%c[WB] Calling FUNCTION: onCommentSidebarActionButtonClick","color: green;");try{return this.trackEvent(Z.Events.Comments.ON_COMMENT_SIDEBAR_ACTION_BUTTON_CLICK_TRIGGERED),this.getService(Te).getSidebarCustomActionEventData()}catch(o){return this.getService(y).catch("Error in _onCommentSidebarActionButtonClick: ",o),re(null)}}_setCommentSidebarData(o,t){this.getService(y).log("%c[WB] Calling FUNCTION: setCommentSidebarData","color: green;");try{this.trackEvent(Z.Events.Comments.SET_COMMENT_SIDEBAR_DATA_TRIGGERED,{payload:{data:o,options:t}}),this.getService(Te).setCommentSidebarData(o,t)}catch(e){this.getService(y).catch("Error in _setCommentSidebarData: ",e)}}_onCommentSidebarInit(){this.getService(y).log("%c[WB] Calling FUNCTION: onCommentSidebarInit","color: green;");try{return this.trackEvent(Z.Events.Comments.ON_COMMENT_SIDEBAR_INIT_TRIGGERED),this.getService(Te).getSidebarCustomActionEventDataOnInit()}catch(o){return this.getService(y).catch("Error in _onCommentSidebarInit: ",o),re(null)}}_onCommentSidebarData(){this.getService(y).log("%c[WB] Calling FUNCTION: onCommentSidebarData","color: green;");try{return this.trackEvent(Z.Events.Comments.ON_COMMENT_SIDEBAR_DATA_TRIGGERED),this.getService(Te).getSidebarCustomActionEventDataAllChanges()}catch(o){return this.getService(y).catch("Error in _onCommentSidebarData: ",o),re(null)}}_setCommentSidebarDefaultCustomActions(o){this.getService(y).log("%c[WB] Calling FUNCTION: setCommentSidebarDefaultCustomActions","color: green;");try{this.trackEvent(Z.Events.Comments.SET_COMMENT_SIDEBAR_DEFAULT_CUSTOM_ACTIONS_TRIGGERED,{payload:{actions:o}}),this.getService(Te).setSidebarCustomActionEventData(o,[],{},[])}catch(t){this.getService(y).catch("Error in _setCommentSidebarDefaultCustomActions: ",t)}}_enableSidebarCustomActions(){this.getService(y).log("%c[WB] Calling FUNCTION: enableSidebarCustomActions","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_SIDEBAR_CUSTOM_ACTIONS_TRIGGERED),this.getService(Te).enableSidebarCustomActions()}catch(o){this.getService(y).catch("Error in _enableSidebarCustomActions: ",o)}}_disableSidebarCustomActions(){this.getService(y).log("%c[WB] Calling FUNCTION: disableSidebarCustomActions","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_SIDEBAR_CUSTOM_ACTIONS_TRIGGERED),this.getService(Te).disableSidebarCustomActions()}catch(o){this.getService(y).catch("Error in _disableSidebarCustomActions: ",o)}}_enableQueryParamsComments(){this.getService(y).log("%c[WB] Calling FUNCTION: enableQueryParamsComments","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_QUERY_PARAMS_COMMENTS_TRIGGERED),this.getService(Te).enableQueryParamsComments()}catch(o){this.getService(y).catch("Error in _enableQueryParamsComments: ",o)}}_disableQueryParamsComments(){this.getService(y).log("%c[WB] Calling FUNCTION: disableQueryParamsComments","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_QUERY_PARAMS_COMMENTS_TRIGGERED),this.getService(Te).disableQueryParamsComments()}catch(o){this.getService(y).catch("Error in _disableQueryParamsComments: ",o)}}_enableResolveStatusAccessAdminOnly(){this.getService(y).log("%c[WB] Calling FUNCTION: enableResolveStatusAccessAdminOnly","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_RESOLVE_STATUS_ACCESS_ADMIN_ONLY_TRIGGERED),this.getService(Te).enableResolveStatusAccessAdminOnly()}catch(o){this.getService(y).catch("Error in _enableResolveStatusAccessAdminOnly: ",o)}}_disableResolveStatusAccessAdminOnly(){this.getService(y).log("%c[WB] Calling FUNCTION: disableResolveStatusAccessAdminOnly","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_RESOLVE_STATUS_ACCESS_ADMIN_ONLY_TRIGGERED),this.getService(Te).disableResolveStatusAccessAdminOnly()}catch(o){this.getService(y).catch("Error in _disableResolveStatusAccessAdminOnly: ",o)}}_enableSeenByUsers(){this.getService(y).log("%c[WB] Calling FUNCTION: enableSeenByUsers","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_SEEN_BY_USERS_TRIGGERED),this.getService(Te).enableSeenByUsers()}catch(o){this.getService(y).catch("Error in _enableSeenByUsers: ",o)}}_disableSeenByUsers(){this.getService(y).log("%c[WB] Calling FUNCTION: disableSeenByUsers","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_SEEN_BY_USERS_TRIGGERED),this.getService(Te).disableSeenByUsers()}catch(o){this.getService(y).catch("Error in _disableSeenByUsers: ",o)}}_enableShortUserName(){this.getService(y).log("%c[WB] Calling FUNCTION: enableShortUserName","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_SHORT_USER_NAME_TRIGGERED),this.getService(Te).enableShortUserName()}catch(o){this.getService(y).catch("Error in _enableShortUserName: ",o)}}_disableShortUserName(){this.getService(y).log("%c[WB] Calling FUNCTION: disableShortUserName","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_SHORT_USER_NAME_TRIGGERED),this.getService(Te).disableShortUserName()}catch(o){this.getService(y).catch("Error in _disableShortUserName: ",o)}}_addCommentAnnotation(o){return ee(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: addCommentAnnotation","color: green;");try{return this.trackEvent(Z.Events.Comments.ADD_COMMENT_ANNOTATION_TRIGGERED,{payload:{addCommentAnnotationRequest:o}}),this.getService(ni).convert(o).addCommentAnnotation(o,"external")}catch(t){return this.getService(y).catch("Error in _addCommentAnnotation: ",t),null}})}_approveCommentAnnotation(o){return ee(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: approveCommentAnnotation","color: green;");try{return this.trackEvent(Z.Events.Comments.APPROVE_COMMENT_ANNOTATION_TRIGGERED,{payload:{approveCommentAnnotationRequest:o}}),this.getService(ni).convert(o).approveCommentAnnotation(o,"external")}catch(t){return this.getService(y).catch("Error in _approveCommentAnnotation: ",t),null}})}_acceptCommentAnnotation(o){return ee(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: acceptCommentAnnotation","color: green;");try{return this.trackEvent(Z.Events.Comments.ACCEPT_COMMENT_ANNOTATION_TRIGGERED,{payload:{acceptCommentAnnotationRequest:o}}),this.getService(ni).convert(o).acceptCommentAnnotation(o,"external")}catch(t){return this.getService(y).catch("Error in _acceptCommentAnnotation: ",t),null}})}_rejectCommentAnnotation(o){return ee(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: rejectCommentAnnotation","color: green;");try{return this.trackEvent(Z.Events.Comments.REJECT_COMMENT_ANNOTATION_TRIGGERED,{payload:{rejectCommentAnnotationRequest:o}}),this.getService(ni).convert(o).rejectCommentAnnotation(o,"external")}catch(t){return this.getService(y).catch("Error in _rejectCommentAnnotation: ",t),null}})}_subscribeCommentAnnotation(o){return ee(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: subscribeCommentAnnotation","color: green;");try{return this.trackEvent(Z.Events.Comments.SUBSCRIBE_COMMENT_ANNOTATION_TRIGGERED,{payload:{subscribeCommentAnnotationRequest:o}}),this.getService(ni).convert(o).toggleNotificationSubscription(o,"subscribe")}catch(t){return this.getService(y).catch("Error in _subscribeCommentAnnotation: ",t),null}})}_unsubscribeCommentAnnotation(o){return ee(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: unsubscribeCommentAnnotation","color: green;");try{return this.trackEvent(Z.Events.Comments.UNSUBSCRIBE_COMMENT_ANNOTATION_TRIGGERED,{payload:{unsubscribeCommentAnnotationRequest:o}}),this.getService(ni).convert(o).toggleNotificationSubscription(o,"unsubscribe")}catch(t){return this.getService(y).catch("Error in _unsubscribeCommentAnnotation: ",t),null}})}_deleteCommentAnnotation(o){return ee(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: deleteCommentAnnotation","color: green;");try{return this.trackEvent(Z.Events.Comments.DELETE_COMMENT_ANNOTATION_TRIGGERED,{payload:{deleteCommentAnnotationRequest:o}}),this.getService(ni).convert(o).deleteCommentAnnotation(o,"external")}catch(t){return this.getService(y).catch("Error in _deleteCommentAnnotation: ",t),null}})}_getCommentAnnotations(o){this.getService(y).log("%c[WB] Calling FUNCTION: getCommentAnnotations","color: green;");try{return this.trackEvent(Z.Events.Comments.GET_COMMENT_ANNOTATIONS_TRIGGERED,{payload:{query:o}}),this.getService(ni).getCommentAnnotations(o).pipe(ce(t=>(t.data&&Object.keys(t.data).forEach(e=>{if(t.data?.[e]?.length){let i=t.data[e];t.data[e]=i?.map(r=>$n(r))}}),t)))}catch(t){return this.getService(y).catch("Error in _getCommentAnnotations: ",t),re({data:null})}}_getCommentAnnotationsCount(o){this.getService(y).log("%c[WB] Calling FUNCTION: getCommentAnnotationsCount","color: green;");try{return this.trackEvent(Z.Events.Comments.GET_COMMENT_ANNOTATIONS_COUNT_TRIGGERED,{payload:{query:o}}),this.getService(ni).getCommentAnnotationsCount$(o)}catch(t){return this.getService(y).catch("Error in _getCommentAnnotationsCount: ",t),re({data:null})}}_assignUser(o){return ee(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: assignUser","color: green;");try{return this.trackEvent(Z.Events.Comments.ASSIGN_USER_TRIGGERED,{payload:{assignUserRequest:o}}),this.getService(ni).convert(o).assignUser(o,"external")}catch(t){return this.getService(y).catch("Error in _assignUser: ",t),null}})}_updatePriority(o){return ee(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: updatePriority","color: green;");try{return this.trackEvent(Z.Events.Comments.UPDATE_PRIORITY_TRIGGERED,{payload:{updatePriorityRequest:o}}),this.getService(ni).convert(o).updatePriority(o,"external")}catch(t){return this.getService(y).catch("Error in _updatePriority: ",t),null}})}_updateStatus(o){return ee(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: updateStatus","color: green;");try{return this.trackEvent(Z.Events.Comments.UPDATE_STATUS_TRIGGERED,{payload:{updateStatusRequest:o}}),this.getService(ni).convert(o).updateStatus(o,"external")}catch(t){return this.getService(y).catch("Error in _updateStatus: ",t),null}})}_updateAccess(o){return ee(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: updateAccess","color: green;");try{return this.trackEvent(Z.Events.Comments.UPDATE_ACCESS_TRIGGERED,{payload:{updateAccessRequest:o}}),this.getService(ni).convert(o).updateAccess(o,"external")}catch(t){return this.getService(y).catch("Error in _updateAccess: ",t),null}})}_resolveCommentAnnotation(o){return ee(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: resolveCommentAnnotation","color: green;");try{return this.trackEvent(Z.Events.Comments.RESOLVE_COMMENT_ANNOTATION_TRIGGERED,{payload:{resolveCommentAnnotationRequest:o}}),this.getService(ni).convert(o).resolveCommentAnnotation(o)}catch(t){return this.getService(y).catch("Error in _resolveCommentAnnotation: ",t),null}})}_getLink(o){return ee(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: getLink","color: green;");try{return this.trackEvent(Z.Events.Comments.GET_LINK_TRIGGERED,{payload:{getLinkRequest:o}}),this.getService(ni).convert(o).getLink(o,"external")}catch(t){return this.getService(y).catch("Error in _getLink: ",t),null}})}_copyLink(o){return ee(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: copyLink","color: green;");try{return this.trackEvent(Z.Events.Comments.COPY_LINK_TRIGGERED,{payload:{copyLinkRequest:o}}),this.getService(ni).convert(o).copyLink(o,"external")}catch(t){return this.getService(y).catch("Error in _copyLink: ",t),null}})}_addComment(o){return ee(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: addComment","color: green;");try{return this.trackEvent(Z.Events.Comments.ADD_COMMENT_TRIGGERED,{payload:{addCommentRequest:o}}),this.getService(ni).convert(o).addComment(o,"external")}catch(t){return this.getService(y).catch("Error in _addComment: ",t),null}})}_updateComment(o){return ee(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: updateComment","color: green;");try{return this.trackEvent(Z.Events.Comments.UPDATE_COMMENT_TRIGGERED,{payload:{updateCommentRequest:o}}),this.getService(ni).convert(o).updateComment(o,"external")}catch(t){return this.getService(y).catch("Error in _updateComment: ",t),null}})}_deleteComment(o){return ee(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: deleteComment","color: green;");try{return this.trackEvent(Z.Events.Comments.DELETE_COMMENT_TRIGGERED,{payload:{deleteCommentRequest:o}}),this.getService(ni).convert(o).deleteComment(o,"external")}catch(t){return this.getService(y).catch("Error in _deleteComment: ",t),null}})}_getComment(o){return ee(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: getComment","color: green;");try{return this.trackEvent(Z.Events.Comments.GET_COMMENT_TRIGGERED,{payload:{getCommentRequest:o}}),this.getService(ni).convert(o).getComment(o)}catch(t){return this.getService(y).catch("Error in _getComment: ",t),[]}})}_addAttachment(o){return ee(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: addAttachment","color: green;");try{return this.trackEvent(Z.Events.Comments.ADD_ATTACHMENT_TRIGGERED,{payload:{addAttachmentRequest:o}}),this.getService(ni).convert(o).addAttachment(o)}catch(t){return this.getService(y).catch("Error in _addAttachment: ",t),Promise.resolve([])}})}_deleteAttachment(o){return ee(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: deleteAttachment","color: green;");try{return this.trackEvent(Z.Events.Comments.DELETE_ATTACHMENT_TRIGGERED,{payload:{deleteAttachmentRequest:o}}),this.getService(ni).convert(o).deleteAttachment(o)}catch(t){return this.getService(y).catch("Error in _deleteAttachment: ",t),null}})}_getAttachment(o){return ee(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: getAttachment","color: green;");try{return this.trackEvent(Z.Events.Comments.GET_ATTACHMENT_TRIGGERED,{payload:{getAttachmentRequest:o}}),this.getService(ni).convert(o).getAttachment(o)}catch(t){return this.getService(y).catch("Error in _getAttachment: ",t),[]}})}_getRecording(o){return ee(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: getRecording","color: green;");try{return this.trackEvent(Z.Events.Comments.GET_RECORDING_TRIGGERED,{payload:{getRecordingRequest:o}}),this.getService(ni).convert(o).getRecording(o)}catch(t){return this.getService(y).catch("Error in _getRecording: ",t),[]}})}_deleteRecording(o){return ee(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: deleteRecording","color: green;");try{return this.trackEvent(Z.Events.Comments.DELETE_RECORDING_TRIGGERED,{payload:{deleteRecordingRequest:o}}),this.getService(ni).convert(o).deleteRecording(o)}catch(t){return this.getService(y).catch("Error in _deleteRecording: ",t),null}})}_fetchCommentAnnotations(o){return ee(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: fetchCommentAnnotations","color: green;");try{return this.trackEvent(Z.Events.Comments.FETCH_COMMENT_ANNOTATIONS_TRIGGERED,{payload:{fetchCommentAnnotationsRequest:o}}),this.getService(ni).fetchCommentAnnotations(o)}catch(t){return this.getService(y).catch("Error in _fetchCommentAnnotations: ",t),{data:null}}})}_addReaction(o){return ee(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: addReaction","color: green;");try{return this.trackEvent(Z.Events.Comments.ADD_REACTION_TRIGGERED,{payload:{addReactionRequest:o}}),this.getService(ni).convert(o).toggleReaction(o,"add")}catch(t){return this.getService(y).catch("Error in _addReaction: ",t),null}})}_deleteReaction(o){return ee(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: deleteReaction","color: green;");try{return this.trackEvent(Z.Events.Comments.DELETE_REACTION_TRIGGERED,{payload:{deleteReactionRequest:o}}),this.getService(ni).convert(o).toggleReaction(o,"delete")}catch(t){return this.getService(y).catch("Error in _deleteReaction: ",t),null}})}_toggleReaction(o){return ee(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: toggleReaction","color: green;");try{return this.trackEvent(Z.Events.Comments.TOGGLE_REACTION_TRIGGERED,{payload:{toggleReactionRequest:o}}),this.getService(ni).convert(o).toggleReaction(o)}catch(t){return this.getService(y).catch("Error in _toggleReaction: ",t),null}})}_on(o){this.getService(y).log("%c[WB] Calling FUNCTION: on","color: green;");try{return this.trackEvent(Z.Events.Comments.ON_ACTION_TRIGGERED,{payload:{action:o}}),this.getService(ni).onAction(o)}catch(t){return this.getService(y).catch("Error in _on: ",t),re(null)}}_enableReadOnly(){return ee(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: enableReadOnly","color: green;");try{return this.trackEvent(Z.Events.Comments.ENABLE_READ_ONLY_TRIGGERED),this.getService(Te).enableReadOnly()}catch(o){this.getService(y).catch("Error in _toggleReaction: ",o);return}})}_disableReadOnly(){return ee(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: disableReadOnly","color: green;");try{return this.trackEvent(Z.Events.Comments.DISABLE_READ_ONLY_TRIGGERED),this.getService(Te).disableReadOnly()}catch(o){this.getService(y).catch("Error in _disableReadOnly: ",o);return}})}_enableCustomAutocompleteSearch(){this.getService(y).log("%c[WB] Calling FUNCTION: enableCustomAutocompleteSearch","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_CUSTOM_AUTOCOMPLETE_SEARCH_TRIGGERED),this.getService(Te).enableCustomAutocompleteSearch()}catch(o){this.getService(y).catch("Error in _enableCustomAutocompleteSearch: ",o);return}}_disableCustomAutocompleteSearch(){this.getService(y).log("%c[WB] Calling FUNCTION: disableCustomAutocompleteSearch","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_CUSTOM_AUTOCOMPLETE_SEARCH_TRIGGERED),this.getService(Te).disableCustomAutocompleteSearch()}catch(o){this.getService(y).catch("Error in _disableCustomAutocompleteSearch: ",o);return}}_setTransformContext(o){this.getService(y).log("%c[WB] Calling FUNCTION: setTransformContext","color: green;");try{this.trackEvent(Z.Events.Comments.SET_TRANSFORM_CONTEXT_TRIGGERED,{payload:{transformContext:o}}),this.getService(Te).setTransformContext(o)}catch(t){this.getService(y).catch("Error in _setTransformContext: ",t);return}}_enableSvgAsImg(){this.getService(y).log("%c[WB] Calling FUNCTION: enableSvgAsImg","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_SVG_AS_IMG_TRIGGERED),this.getService(Te).enableSvgAsImg()}catch(o){this.getService(y).catch("Error in _enableSvgAsImg: ",o);return}}_disableSvgAsImg(){this.getService(y).log("%c[WB] Calling FUNCTION: disableSvgAsImg","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_SVG_AS_IMG_TRIGGERED),this.getService(Te).disableSvgAsImg()}catch(o){this.getService(y).catch("Error in _disableSvgAsImg: ",o);return}}_enableFullExpanded(){this.getService(y).log("%c[WB] Calling FUNCTION: enableFullExpanded","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_FULL_EXPANDED_TRIGGERED),this.getService(Te).enableFullExpanded()}catch(o){this.getService(y).catch("Error in _enableFullExpanded: ",o);return}}_disableFullExpanded(){this.getService(y).log("%c[WB] Calling FUNCTION: disableFullExpanded","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_FULL_EXPANDED_TRIGGERED),this.getService(Te).disableFullExpanded()}catch(o){this.getService(y).catch("Error in _disableFullExpanded: ",o);return}}_enableCommentToNearestAllowedElement(){this.getService(y).log("%c[WB] Calling FUNCTION: enableCommentToNearestAllowedElement","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_COMMENT_TO_NEAREST_ALLOWED_ELEMENT_TRIGGERED),this.getService(Te).enableCommentToNearestAllowedElement()}catch(o){this.getService(y).catch("Error in _enableCommentToNearestAllowedElement: ",o);return}}_disableCommentToNearestAllowedElement(){this.getService(y).log("%c[WB] Calling FUNCTION: disableCommentToNearestAllowedElement","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_COMMENT_TO_NEAREST_ALLOWED_ELEMENT_TRIGGERED),this.getService(Te).disableCommentToNearestAllowedElement()}catch(o){this.getService(y).catch("Error in _disableCommentToNearestAllowedElement: ",o);return}}_enableDraftMode(){this.getService(y).log("%c[WB] Calling FUNCTION: enableDraftMode","color: green;");try{this.trackEvent(Z.Events.Comments.ENABLE_DRAFT_MODE_TRIGGERED),this.getService(Te).enableDraftMode()}catch(o){this.getService(y).catch("Error in _enableDraftMode: ",o);return}}_disableDraftMode(){this.getService(y).log("%c[WB] Calling FUNCTION: disableDraftMode","color: green;");try{this.trackEvent(Z.Events.Comments.DISABLE_DRAFT_MODE_TRIGGERED),this.getService(Te).disableDraftMode()}catch(o){this.getService(y).catch("Error in _disableDraftMode: ",o);return}}};var BM=class extends li{constructor(o){super(o),this.getService(y).log("%c[WB] Creating CLASS: ContactElement","color: blue;"),this.isUserGlobalContact=this._isUserGlobalContact,this.onContactSelected=this._onContactSelected,this.enableAtHere=this._enableAtHere,this.setAtHereLabel=this._setAtHereLabel,this.setAtHereDescription=this._setAtHereDescription,this.disableAtHere=this._disableAtHere,this.updateContactListScopeForOrganizationUsers=this._updateContactListScopeForOrganizationUsers,this.updateContactList=this._updateContactList,this.getContactList=this._getContactList}_isUserGlobalContact(){this.getService(y).log("%c[WB] Calling FUNCTION: isUserGlobalContact","color: green;");try{return this.trackEvent(Z.Events.Contact.IS_USER_GLOBAL_CONTACT_TRIGGERED),this.getService(gi).isUserGlobalContact$()}catch(o){return this.getService(y).catch("Error in _isUserGlobalContact: ",o),re(!1)}}_onContactSelected(){this.getService(y).log("%c[WB] Calling FUNCTION: onContactSelected","color: green;");try{return this.trackEvent(Z.Events.Contact.ON_CONTACT_SELECTED_TRIGGERED),this.getService(gi).onContactSelected$()}catch(o){return this.getService(y).catch("Error in _onContactSelected: ",o),re(null)}}_enableAtHere(){this.getService(y).log("%c[WB] Calling FUNCTION: enableAtHere","color: green;");try{this.trackEvent(Z.Events.Contact.ENABLE_AT_HERE_TRIGGERED),this.getService(gi).enableAtHere()}catch(o){this.getService(y).catch("Error in _enableAtHere: ",o)}}_setAtHereLabel(o){this.getService(y).log("%c[WB] Calling FUNCTION: setAtHereLabel","color: green;");try{this.trackEvent(Z.Events.Contact.SET_AT_HERE_LABEL_TRIGGERED,{payload:{label:o}}),this.getService(gi).setAtHereLabel(o)}catch(t){this.getService(y).catch("Error in setAtHereLabel: ",t)}}_setAtHereDescription(o){this.getService(y).log("%c[WB] Calling FUNCTION: setAtHereDescription","color: green;");try{this.trackEvent(Z.Events.Contact.SET_AT_HERE_DESCRIPTION_TRIGGERED,{payload:{description:o}}),this.getService(gi).setAtHereDescription(o)}catch(t){this.getService(y).catch("Error in setAtHereDescription: ",t)}}_disableAtHere(){this.getService(y).log("%c[WB] Calling FUNCTION: disableAtHere","color: green;");try{this.trackEvent(Z.Events.Contact.DISABLE_AT_HERE_TRIGGERED),this.getService(gi).disableAtHere()}catch(o){this.getService(y).catch("Error in _disableAtHere: ",o)}}_updateContactListScopeForOrganizationUsers(o){this.getService(y).log("%c[WB] Calling FUNCTION: updateContactListScopeForOrganizationUsers","color: green;");try{this.trackEvent(Z.Events.Contact.UPDATE_CONTACT_LIST_SCOPE_FOR_ORGANIZATION_USERS_TRIGGERED,{payload:{scope:o}}),this.getService(gi).updateContactListScopeForOrganizationUsers(o)}catch(t){this.getService(y).catch("Error in _updateContactListScopeForOrganizationUsers: ",t)}}_updateContactList(o,t){this.getService(y).log("%c[WB] Calling FUNCTION: _updateContactList","color: green;");try{this.trackEvent(Z.Events.Contact.UPDATE_CONTACT_LIST_TRIGGERED,{payload:{userContacts:o,config:t}}),typeof o=="object"&&o instanceof Array&&(!t||t&&typeof t=="object")&&(o=JSON.parse(JSON.stringify(o)),this.getService(gi).convert(t).updateContactList(o,t))}catch(e){this.getService(y).catch("Error in _updateContactList: ",e)}}_getContactList(){this.getService(y).log("%c[WB] Calling FUNCTION: getContactList","color: green;");try{return this.trackEvent(Z.Events.Contact.GET_CONTACT_LIST_TRIGGERED),this.getService(gi).getContactList$()}catch(o){return this.getService(y).catch("Error in _getContactList: ",o),re(null)}}};var Qa=function(n){return n.CLICK="click",n.HOVER="hover",n.SCROLL="scroll",n.NAVIGATE="navigate",n}(Qa||{}),Td=class{constructor(){this.type=Qa.HOVER,this.data=null,this.pageInfo=_i(),this.timestamp=Date.now()}},VM=class{constructor(o,t){this.targetXpath=o,this.xpath=t}};var UM=class{constructor(){this.sessionId=null,this.isLeader=!1,this.lastProcessedActionTimestamp=null}};var qu=class{constructor(o){this.snippylyId=o,this.joinTimestamp=Date.now()}};var jM=class{constructor(o,t,e){this.followers=[],this.actionStack=[],this.id=xn(),this.leaderId=o,this.leaderName=t,this.followers.push(new qu(e))}};var Tse=(()=>{let o=class o{constructor(e,i,r,a,s){this.databaseService=e,this.docService=i,this.loggingService=r,this.authService=a,this.commonDbService=s,this.currentUser$=new fe(null),this.currentSession$=new fe(null);try{this.databaseService.getDb().pipe(Ne(c=>!!c),Je(1)).subscribe(c=>{c&&(this.db=c)},c=>{this.loggingService.catch("Error in FlockSessionService getDb subscription: ",c)}),this.authService.getUser$().subscribe(c=>{c&&c.userSnippylyId&&(this.user=c)})}catch(c){this.loggingService.catch("Error in FlockSessionService constructor: ",c)}}startCurrentFlockUserSubscription(e){try{this.currentUserSub?.unsubscribe(),e&&e.userSnippylyId&&(this.user=e,this.subscribeToCurrentFlockUser(e?.userSnippylyId))}catch(i){this.loggingService.catch("Error in FlockSessionService startCurrentFlockUserSubscription: ",i)}}stopCurrentFlockUserSubscription(){try{this.currentUserSub?.unsubscribe()}catch(e){this.loggingService.catch("Error in FlockSessionService stopCurrentFlockUserSubscription: ",e)}}provisionFlockSession(e,i,r){try{let a=this.docService.getDocumentPaths();a&&this.db&&this.commonDbService.dbListener({feature:"flockUser",properties:{documentId:a?.documentId,organizationId:a?.organizationId,id:e,skipFirestore:!0}}).pipe(Je(1)).subscribe(s=>{s?.data&&s?.data?.sessionId?this.subscribeToCurrentSession(s?.data?.sessionId,r):this.createFlockSession(e,i,r)})}catch(a){this.loggingService.catch("Error in FlockSessionService provisionFlockSession: ",a)}return null}swapLeader(e,i,r){try{if(this.updateRemoteFlockUser(e,{isLeader:!1}),this.updateRemoteFlockUser(i,{isLeader:!0}),this.currentSession){this.currentSession.leaderId=i,this.currentSession.leaderName=r,this.currentSession.followers.push(new qu(e));let a=this.currentSession.followers.findIndex(s=>s.snippylyId===i);a>-1&&this.currentSession.followers.splice(a,1),this.updateSession(this.currentSession.id,this.currentSession)}}catch(a){this.loggingService.catch("Error in FlockSessionService swapLeader: ",a)}}createFlockSession(e,i,r){try{let a=new jM(e,i,r);return this.updateRemoteFlockUser(e,{snippylyId:e,sessionId:a.id,isLeader:!0}),this.updateSession(a.id,a),this.subscribeToCurrentSession(a.id),a.id}catch(a){this.loggingService.catch("Error in FlockSessionService createFlockSession: ",a)}return null}removeFollowerFromCurrentSession(e){try{if(this.currentSession){this.updateRemoteFlockUser(e,{sessionId:null,lastProcessedActionTimestamp:null});let i=this.currentSession.followers.findIndex(r=>r.snippylyId===e);if(i>-1){if(this.currentSession.followers.splice(i,1),this.currentSession.followers.length===0){this.deleteSession(this.currentSession.id);return}this.updateSession(this.currentSession.id,this.currentSession),this.user&&this.user.userSnippylyId&&this.user.userSnippylyId===e&&(this.sessionSub?.unsubscribe(),this.currentSession=void 0,this.currentSession$?.next(null))}}}catch(i){this.loggingService.catch("Error in FlockSessionService removeFollowerFromSession: ",i)}}updateRemoteFlockUser(e,i={}){try{if(!e)return;let r=this.docService.getDocumentPaths();for(let a in i)i.hasOwnProperty(a)&&i[a]===void 0&&delete i[a];r&&this.db&&this.commonDbService.updateData({feature:"flockUser",properties:{documentId:r?.documentId??"",organizationId:r?.organizationId??"",id:e,skipFirestore:!0},data:JSON.parse(JSON.stringify(i))})}catch(r){this.loggingService.catch("Error in FlockSessionService updateRemoteFlockUser: ",r)}}subscribeToCurrentSession(e,i=void 0){try{let r=this.docService.getDocumentPaths();r&&this.db&&(this.sessionSub&&this.sessionSub.unsubscribe(),this.sessionSub=this.commonDbService.dbListener({feature:"flockSession",properties:{documentId:r?.documentId,organizationId:r?.organizationId,id:e,skipFirestore:!0}}).subscribe(a=>{a?.data&&typeof a?.data=="object"&&Object.keys(a?.data)?.length>0?(this.currentSession=a?.data,i!==void 0&&this.currentSession?.followers.findIndex(s=>s.snippylyId===i)===-1&&(this.currentSession.followers.push(new qu(i)),this.updateSession(this.currentSession.id,this.currentSession)),this.currentSession$.next(this.currentSession??null)):(this.currentSession=void 0,this.currentSession$.next(null))}))}catch(r){this.loggingService.catch("Error in FlockSessionService subscribeToCurrentSession: ",r)}}subscribeToCurrentFlockUser(e){try{let i=this.docService.getDocumentPaths();i&&this.db&&(this.currentUserSub&&this.currentUserSub.unsubscribe(),this.currentUserSub=this.commonDbService.dbListener({feature:"flockUser",properties:{documentId:i?.documentId,organizationId:i?.organizationId,id:e,skipFirestore:!0}}).pipe(Ln(r=>(this.loggingService.catch("Error in FlockSessionService subscribeToCurrentFlockUser: ",r),re(null)))).subscribe(r=>{r?.data&&typeof r?.data=="object"&&Object.keys(r?.data)?.length>0&&(this.currentUser$.next(r?.data),r?.data?.sessionId&&this.subscribeToCurrentSession(r?.data?.sessionId))},r=>{this.loggingService.catch("Error in FlockSessionService subscribeToCurrentFlockUser subscription: ",r)}))}catch(i){this.loggingService.catch("Error in FlockSessionService subscribeToCurrentFlockUser: ",i)}}updateSession(e,i={}){try{if(!e)return;let r=this.docService.getDocumentPaths();for(let a in i)i.hasOwnProperty(a)&&i[a]===void 0&&delete i[a];r&&this.db&&this.commonDbService.updateData({feature:"flockSession",properties:{documentId:r?.documentId??"",organizationId:r?.organizationId??"",id:e,skipFirestore:!0},data:JSON.parse(JSON.stringify(i))})}catch(r){this.loggingService.catch("Error in FlockSessionService updateSession: ",r)}}deleteSession(e){try{let i=this.docService.getDocumentPaths();i&&this.db&&(this.commonDbService.deleteData({feature:"flockSession",properties:{documentId:i?.documentId??"",organizationId:i?.organizationId??"",id:e,skipFirestore:!0}}),this.currentSession&&e===this.currentSession.id&&(this.updateRemoteFlockUser(this.currentSession.leaderId,{sessionId:null,isLeader:!1,lastProcessedActionTimestamp:null}),this.currentSession.followers.forEach(r=>{this.updateRemoteFlockUser(r.snippylyId,{sessionId:null,lastProcessedActionTimestamp:null})}),this.currentSession=void 0,this.currentSession$.next(null),this.sessionSub?.unsubscribe()))}catch(i){this.loggingService.catch("Error in FlockSessionService deleteSession: ",i)}}addActionToStack(e,i){try{i=i&&JSON.parse(JSON.stringify(i));let r=this.docService.getDocumentPaths();if(r&&this.db&&e){let a=on(this.db,`${r.flock}/sessions/${e}/actionStack`);UA(a,s=>s?(s.unshift(i),s.slice(0,5)):[i]),i.type===Qa.NAVIGATE&&this.updateSession(e,{pageInfo:i.pageInfo})}}catch(r){this.loggingService.catch("Error in FlockSessionService addActionToStack: ",r)}}};o.\u0275fac=function(i){return new(i||o)(J(pn),J(lt),J(y),J(je),J(bn))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var wse={en:{"Action button":"Action button",Yes:"Yes",Delete:"Delete",Cancel:"Cancel","Delete thread?":"Delete thread?","All replies to this thread will be lost.":"All replies to this thread will be lost.","Delete comment?":"Delete comment?","This selected comment will be deleted.":"This selected comment will be deleted.","Delete recording?":"Delete recording?","This selected recording will be deleted.":"This selected recording will be deleted.","Delete area?":"Delete area?","This selected area will be deleted.":"This selected area will be deleted.","Delete arrow?":"Delete arrow?","This selected arrow will be deleted.":"This selected arrow will be deleted.","Delete tag?":"Delete tag?","This selected tag will be deleted.":"This selected tag will be deleted.","Contact us":"Contact us","Let us know how can we help you!":"Let us know how can we help you!","Your email address":"Your email address","How can we help?":"How can we help?",Send:"Send","Allow mic permission to":"Allow mic permission to","enable your audio":"enable your audio","1. Click the":"1. Click the","page info icon in your browser\u2019s address bar":"page info icon in your browser\u2019s address bar","2. Turn on Microphone":"2. Turn on Microphone","2. Turn on Camera":"2. Turn on Camera","Allow camera permission":"Allow camera permission","to enable your video":"to enable your video",dropdown:"dropdown","assign dropdown":"assign dropdown","custom dropdown":"custom dropdown","options dropdown":"options dropdown","priority dropdown":"priority dropdown","status dropdown":"status dropdown","seen dropdown":"seen dropdown",menu:"menu","assign menu":"assign menu","custom menu":"custom menu","options menu":"options menu","priority menu":"priority menu","status menu":"status menu","seen menu":"seen menu","menu items":"menu items","assign menu items":"assign menu items","custom menu items":"custom menu items","options menu items":"options menu items","priority menu items":"priority menu items","status menu items":"status menu items","seen menu items":"seen menu items","Playback Speed":"Playback Speed","Subtitles not available":"Subtitles not available","Transcription not available":"Transcription not available",Feedback:"Feedback","Provide feedback on your Superflow experience.":"Provide feedback on your Superflow experience.","Tell us the details...":"Tell us the details...","You are following":"You are following","You are leading.":"You are leading.",Stop:"Stop",following:"following",leading:"leading","is editing.":"is editing.","requested edit access.":"requested edit access.","You are editing.":"You are editing.","You are editing on different tab.":"You are editing on different tab.","Access Requested":"Access Requested","Request access":"Request access","Edit here":"Edit here",Settings:"Settings",Audio:"Audio",Microphone:"Microphone",Video:"Video",Camera:"Camera","Save changes":"Save changes","Audio settings":"Audio settings","No device found":"No device found","Video settings":"Video settings","Media source settings":"Media source settings","Audio recording preview":"Audio recording preview","Cancel recording":"Cancel recording","Video recording icon":"Video recording icon","Screen recording icon":"Screen recording icon","Audio recording icon":"Audio recording icon","Recording preview bottom panel":"Recording preview bottom panel","Starting recording in":"Starting recording in","Recording control buttons":"Recording control buttons","Toggle camera":"Toggle camera",off:"off",on:"on","Camera is off":"Camera is off","Close recording preview":"Close recording preview","Toggle microphone":"Toggle microphone",Close:"Close",Open:"Open","recording settings":"recording settings","Start Recording":"Start Recording","Report bugs":"Report bugs","Let us know about any bugs so we can fix them ASAP!":"Let us know about any bugs so we can fix them ASAP!","Thank you! We will get back to you soon.":"Thank you! We will get back to you soon.","Thank you for your feedback!":"Thank you for your feedback!","Thanks for reporting the bug. We will get back to you soon.":"Thanks for reporting the bug. We will get back to you soon.","Invitation sent!":"Invitation sent!","User removed!":"User removed!",members:"members","Invalid contact":"Invalid contact","Invalid email":"Invalid email","Comment pin":"Comment pin","Add text comment":"Add text comment","Add comment annotation":"Add comment annotation","Use AI to rewrite selected text":"Use AI to rewrite selected text","Select a shorter text":"Select a shorter text","Select a longer text":"Select a longer text",Rewrite:"Rewrite","Ask ChatGPT":"Ask ChatGPT","Text comment tools":"Text comment tools","Avatar for comment author":"Avatar for comment author","comments in this thread":"comments in this thread","Assign To":"Assign To","Attach files":"Attach files","Attach files input":"Attach files input","All comments":"All comments","View all comments":"View all comments","Approve comment":"Approve comment",Approve:"Approve","Assign thread":"Assign thread",Search:"Search","Search users":"Search users","Avatar for assigned user":"Avatar for assigned user","Assigned to":"Assigned to","Comment assignment details":"Comment assignment details","Assigned to:":"Assigned to:","Comment dialog thread":"Comment dialog thread","Close comment dialog":"Close comment dialog","Comment Index":"Comment Index",Suggestion:"Suggestion","Comment tools and actions":"Comment tools and actions","Mention someone using @ symbol":"Mention someone using @ symbol","Mention someone using @ symbol while editing":"Mention someone using @ symbol while editing","Type @ to mention someone":"Type @ to mention someone","Type @ to mention someone while editing":"Type @ to mention someone while editing","Add file attachment to comment":"Add file attachment to comment","Record voice message":"Record voice message","Click to start voice recording":"Click to start voice recording","Record video message":"Record video message","Click to start screen recording":"Click to start screen recording","Record your screen":"Record your screen","Save new comment":"Save new comment","Save edited comment":"Save edited comment","Assign user":"Assign user","Remove File":"Remove File","Image attachment:":"Image attachment:","unnamed image":"unnamed image","Actions for image:":"Actions for image:","Uploading image:":"Uploading image:","Delete image:":"Delete image:","Preview of image:":"Preview of image:","Remove invalid file:":"Remove invalid file:","Error message:":"Error message:","Invalid file:":"Invalid file:","Actions for invalid file:":"Actions for invalid file:","File error:":"File error:","File cannot be uploaded":"File cannot be uploaded","Preview of invalid file:":"Preview of invalid file:","Invalid file":"Invalid file",unknown:"unknown","Delete file":"Delete file","File attachment:":"File attachment:","unnamed file":"unnamed file","File type icon for":"File type icon for","Details for file:":"Details for file:","Filename:":"Filename:","File size:":"File size:","Uploading file:":"Uploading file:","Actions for file:":"Actions for file:","Remove file:":"Remove file:","Attached files":"Attached files","total attachments":"total attachments","File attachments":"File attachments",valid:"valid","invalid files":"invalid files","User avatar for":"User avatar for","unknown user":"unknown user","New comment composer":"New comment composer","Comment or type @ to add others":"Comment or type @ to add others","Write a comment...":"Write a comment...","Edit comment composer":"Edit comment composer","Comment or add emails with @":"Comment or add emails with @","Private comment mode - only visible to your team":"Private comment mode - only visible to your team","Only for your team":"Only for your team","Screen recording":"Screen recording",unnamed:"unnamed","Screen recording controls":"Screen recording controls","Edit comment section":"Edit comment section","Add new comment section":"Add new comment section","Custom annotation options":"Custom annotation options","Toggle annotation options":"Toggle annotation options","Annotation:":"Annotation:",Select:"Select","Remaining count:":"Remaining count:","Delete comment controls":"Delete comment controls","Delete this comment":"Delete this comment","Ghost comment notification":"Ghost comment notification","Original content not found.":"Original content not found.","Comment dialog header":"Comment dialog header","Comment dialog header controls":"Comment dialog header controls","Comment metadata":"Comment metadata","1 more reply":"1 more reply","more replies":"more replies","Show 1 more reply":"Show 1 more reply","Navigate to comment location":"Navigate to comment location","Assign comment":"Assign comment","Delete thread":"Delete thread","Delete comment":"Delete comment","Edit comment":"Edit comment",Edit:"Edit","Make it private":"Make it private","Make it public":"Make it public",Subscribe:"Subscribe",Unsubscribe:"Unsubscribe","priority level":"priority level","Priority name":"Priority name",P0:"P0",P1:"P1",P2:"P2","Selected priority:":"Selected priority:","Selected priority indicator":"Selected priority indicator","Priority:":"Priority:","Priority item":"Priority item","Thread priority:":"Thread priority:","Private comment banner":"Private comment banner","Resolve thread":"Resolve thread","Sign In":"Sign In","Status dropdown for":"Status dropdown for",comment:"comment","Status name:":"Status name:","Status option:":"Status option:","Status:":"Status:","Accept suggestion":"Accept suggestion",Accept:"Accept","Reject suggestion":"Reject suggestion",Reject:"Reject","Suggestion actions":"Suggestion actions","Delete Attachment":"Delete Attachment","Download Attachment":"Download Attachment",Attachment:"Attachment",preview:"preview","Image attachment controls":"Image attachment controls","Image attachment actions":"Image attachment actions","Delete attachment":"Delete attachment","Download attachment":"Download attachment","File name:":"File name:","Attachment:":"Attachment:",Attachments:"Attachments","Avatar for":"Avatar for",user:"user","Draft comment status":"Draft comment status",Draft:"Draft",Comment:"Comment","Comment by":"Comment by",Me:"Me","Comment reactions":"Comment reactions","Comment recordings":"Comment recordings","Name for":"Name for","Time for":"Time for","Seen by":"Seen by","Users who viewed this comment":"Users who viewed this comment","List of users who have seen this comment":"List of users who have seen this comment","Seen By":"Seen By","Comment viewers list":"Comment viewers list","Show comment viewers":"Show comment viewers","Comment viewers dropdown":"Comment viewers dropdown",now:"now",Unread:"Unread","Comment thread":"Comment thread","Comment content":"Comment content","Author information":"Author information","Author details and status":"Author details and status","Comment device information":"Comment device information","Inline mode metadata":"Inline mode metadata","Comment actions":"Comment actions","Reaction options":"Reaction options","Comment message":"Comment message",of:"of","Show more replies":"Show more replies",replies:"replies",Reply:"Reply",reply:"reply",Show:"Show","Show reply":"Show reply","Unresolve comment":"Unresolve comment","Upgrade plan":"Upgrade plan",Upgrade:"Upgrade","Copy link to comment":"Copy link to comment","Link Copied!":"Link Copied!","Copy thread link":"Copy thread link","Emoji reactions menu":"Emoji reactions menu","Open emoji reactions menu":"Open emoji reactions menu",Priority:"Priority","Private Comment":"Private Comment",Resolve:"Resolve",Unresolve:"Unresolve","Comment bubble":"Comment bubble","Multi-thread comment dialog":"Multi-thread comment dialog","Comment dialog":"Comment dialog","Comment bottom sheet":"Comment bottom sheet","Comment inbox container":"Comment inbox container","Single comment dialog":"Single comment dialog","Ghost comment indicator":"Ghost comment indicator","Private comment":"Private comment","Comment icon":"Comment icon","Exit comment mode":"Exit comment mode","to exit":"to exit",exit:"exit","Private Comment Mode":"Private Comment Mode","Comment Mode":"Comment Mode","Comment mode icon":"Comment mode icon","Comments stream view":"Comments stream view","Comments inbox":"Comments inbox","Comments location overview":"Comments location overview","Comments minimap":"Comments minimap","Go to comments here.":"Go to comments here.","Close comments sidebar":"Close comments sidebar","Add your first comment":"Add your first comment","No comments to display":"No comments to display","filter section":"filter section",All:"All","Close filter panel":"Close filter panel","Apply filters and close panel":"Apply filters and close panel",Done:"Done","checkbox checked":"checkbox checked","checkbox unchecked":"checkbox unchecked",items:"items","Current viewing page":"Current viewing page","This page":"This page",selected:"selected","not selected":"not selected",pages:"pages",people:"people",priorities:"priorities",statuses:"statuses",Filters:"Filters",versions:"versions","View All":"View All","View all":"View all","Comment filters":"Comment filters","Available filters":"Available filters","Apply or cancel filters":"Apply or cancel filters","Filter comments":"Filter comments","filters applied":"filters applied","Return to all comments":"Return to all comments","Back to all comments":"Back to all comments","Search through comments":"Search through comments","Filter and status controls":"Filter and status controls","Unknown user":"Unknown user","Comment dialog for":"Comment dialog for",Collapse:"Collapse",Expand:"Expand","comment group":"comment group",arrow:"arrow","Comments list with":"Comments list with","Location filter options":"Location filter options",Pages:"Pages","Filter comments by location":"Filter comments by location","menu expanded":"menu expanded","menu collapsed":"menu collapsed","Location filter dropdown":"Location filter dropdown","Mark all comments as read":"Mark all comments as read","Mark all as read":"Mark all as read","Mark all comments as resolved":"Mark all comments as resolved","Mark all as resolved":"Mark all as resolved","Bulk actions for comments":"Bulk actions for comments","Actions menu":"Actions menu",expanded:"expanded",collapsed:"collapsed","Comment actions dropdown":"Comment actions dropdown","Show unread and read comments":"Show unread and read comments","Unread and read":"Unread and read","Show read comments only":"Show read comments only","Read only":"Read only","Show resolved comments only":"Show resolved comments only",Resolved:"Resolved","Show unread comments only":"Show unread comments only","Unread only":"Unread only","Selected indicator":"Selected indicator","Sort comments by date":"Sort comments by date","Sort by date":"Sort by date","Sort comments by unread status":"Sort comments by unread status","Sort by unread":"Sort by unread","Sort and filter comments":"Sort and filter comments","custom filter applied":"custom filter applied","Comment filters and sorting":"Comment filters and sorting",filtered:"filtered","Page comment composer":"Page comment composer","Add a comment to the page":"Add a comment to the page","Comments and feedback panel":"Comments and feedback panel","Reset all comment filters":"Reset all comment filters","Clear filters":"Clear filters","Loading comments":"Loading comments","Comment status filters":"Comment status filters",status:"status","status icon":"status icon","Status filter options":"Status filter options","Status filter dropdown":"Status filter dropdown","Comments sidebar":"Comments sidebar","Comments panel":"Comments panel","Comment composer":"Comment composer","Comments section panel":"Comments section panel",Comments:"Comments","Loading Comments":"Loading Comments","Comments section":"Comments section","No comments found for applied filters.":"No comments found for applied filters.","Comments list":"Comments list","Comment actions menu":"Comment actions menu","More actions":"More actions","Filter and sort options":"Filter and sort options","Collapse threads":"Collapse threads","Comments dialog":"Comments dialog","Clear all filters":"Clear all filters","Comments information":"Comments information","Toggle comments sidebar":"Toggle comments sidebar","Click to mute":"Click to mute","Click to unmute":"Click to unmute","Stop sharing":"Stop sharing","Share screen":"Share screen","Invite users to join this huddle":"Invite users to join this huddle","Please select a contact to invite":"Please select a contact to invite","Chat with everyone":"Chat with everyone","Enable audio or video to change the settings":"Enable audio or video to change the settings","Change audio/video settings":"Change audio/video settings",Leave:"Leave","In-call messages":"In-call messages","Type here...":"Type here...","Audio Huddle":"Audio Huddle","Video Huddle":"Video Huddle","Screen Huddle":"Screen Huddle","1 person is":"1 person is","people are":"people are","on a call now":"on a call now","You can join the call":"You can join the call","Stop Sharing":"Stop Sharing","is sharing now.":"is sharing now.",You:"You","Close notifications panel":"Close notifications panel","Notification item":"Notification item","All notifications list":"All notifications list","All notifications":"All notifications","All notifications read":"All notifications read","Document notification":"Document notification","Document name:":"Document name:",Untitled:"Untitled","Document ID:":"Document ID:",Document:"Document","unread notifications":"unread notifications","Document notifications panel":"Document notifications panel","For you notifications panel":"For you notifications panel","Notification message:":"Notification message:","Notification headline:":"Notification headline:","Notification time:":"Notification time:","Unread notification":"Unread notification",Notification:"Notification",unread:"unread",read:"read",Load:"Load","more notifications":"more notifications","Load More":"Load More","User notifications for":"User notifications for",notification:"notification",notifications:"notifications",available:"available",Notifications:"Notifications","User:":"User:","People notifications panel":"People notifications panel",Documents:"Documents","For You":"For You",People:"People","Notification categories":"Notification categories","Mark all notifications as read":"Mark all notifications as read","Notification actions":"Notification actions","View all notifications":"View all notifications","Notifications panel":"Notifications panel","Notifications bell icon - no unread notifications":"Notifications bell icon - no unread notifications","Notifications count":"Notifications count","Notification bell with":"Notification bell with","User online":"User online","mins ago.":"mins ago.","Reaction count":"Reaction count","Reaction with":"Reaction with","Reaction by":"Reaction by","Users who reacted":"Users who reacted","Reaction details":"Reaction details","React with":"React with",emoji:"emoji","Choose a reaction":"Choose a reaction","Available reactions":"Available reactions","Add reaction":"Add reaction","Reaction selector":"Reaction selector","Start audio recording":"Start audio recording","Audio Recording":"Audio Recording","Screen Recording":"Screen Recording","Start video recording":"Start video recording","Video Recording":"Video Recording","Recording options menu":"Recording options menu","Available recording types":"Available recording types",Record:"Record","Record audio":"Record audio","Record screen":"Record screen","Record video":"Record video","Recording controls for":"Recording controls for",recording:"recording","Stop recording":"Stop recording","Recording duration":"Recording duration","Resume recording":"Resume recording","Pause recording":"Pause recording","Currently recording:":"Currently recording:",none:"none","Audio waveform visualization":"Audio waveform visualization","Currently recording":"Currently recording","Recording paused":"Recording paused","Recording information":"Recording information","Recording controls":"Recording controls","Expand recording panel":"Expand recording panel","Collapse recording panel":"Collapse recording panel","Floating mode container for":"Floating mode container for","Screen recording preview":"Screen recording preview","Expanded view":"Expanded view","Mini preview":"Mini preview","Recording control panel":"Recording control panel","Draggable recording panel":"Draggable recording panel","Currently saving recording":"Currently saving recording","Saving Recording...":"Saving Recording...",Paused:"Paused","Video preview":"Video preview","Screen recording panel":"Screen recording panel","Draggable recording controls":"Draggable recording controls","Video recording preview":"Video recording preview","recording player":"recording player",Draggable:"Draggable",player:"player","recording pin":"recording pin","Created by":"Created by",Play:"Play","Draggable recording pin by":"Draggable recording pin by","Recording player":"Recording player","Audio recording":"Audio recording","Audio player":"Audio player","Audio player controls":"Audio player controls","Audio content and controls":"Audio content and controls","Playback controls":"Playback controls","Playback time":"Playback time","Audio waveform":"Audio waveform",Subtitles:"Subtitles","Additional controls and information":"Additional controls and information","Pause button":"Pause button","Pause audio":"Pause audio","Play audio":"Play audio","Audio progress":"Audio progress","Copy link to recording":"Copy link to recording","Delete recording":"Delete recording","Enter full screen mode":"Enter full screen mode","Recording name:":"Recording name:","Untitled recording":"Untitled recording","Recording player controls":"Recording player controls","Pause video":"Pause video","Play video":"Play video","Video subtitles":"Video subtitles","Toggle subtitles":"Toggle subtitles","Seek video playback":"Seek video playback","Video playback controls":"Video playback controls","Video transcription":"Video transcription","Video player":"Video player","Video player container":"Video player container","Video player with controls":"Video player with controls","Video information and controls":"Video information and controls","Video transcription summary":"Video transcription summary","Fullscreen video player":"Fullscreen video player","Expanded video player":"Expanded video player","Getting data ...":"Getting data ...","Get more options":"Get more options","Max 3 rewrites allowed":"Max 3 rewrites allowed",left:"left","Show original text":"Show original text","Select a rewritten text to create a task":"Select a rewritten text to create a task","Create Task":"Create Task","How would you like to change this copy?":"How would you like to change this copy?",Suggestions:"Suggestions","Selected users":"Selected users","additional users":"additional users",Reassign:"Reassign",Remove:"Remove","Please select a contact to assign":"Please select a contact to assign",Summary:"Summary","see more":"see more","see less":"see less","Invite users":"Invite users","No users are added.":"No users are added.",Invited:"Invited","General access":"General access","Copy Link":"Copy Link","Send invite":"Send invite","Go Back":"Go Back","Total Views":"Total Views","Views Today":"Views Today",View:"View",Views:"Views",Today:"Today","Search comments":"Search comments","In Progress":"In Progress",Status:"Status","Not set":"Not set","Comment Type":"Comment Type",Public:"Public",Private:"Private","Group By":"Group By","Assigned to Me":"Assigned to Me","Added by Me":"Added by Me",Other:"Other",Desktop:"Desktop",Mobile:"Mobile",Tablet:"Tablet",Others:"Others","Default - MacBook Pro Microphone (Built-in)":"Default - MacBook Pro Microphone (Built-in)","iPhone Microphone":"iPhone Microphone","MacBook Pro Microphone (Built-in)":"MacBook Pro Microphone (Built-in)","Sorting options":"Sorting options","Created First":"Created First","Created Last":"Created Last","Updated First":"Updated First","Updated Last":"Updated Last"}};var zs=(()=>{let o=class o{constructor(e){this.loggingService=e,this.currentLanguageSignal=be(navigator.language.split("-")[0]),this.autoTranslationSignal=be(!1),this.translationsMap=new Map,this.translationCache=new Map,this.translationsUpdateSignal=be(0),this.currentLanguage=this.currentLanguageSignal.asReadonly(),this.autoTranslation=this.autoTranslationSignal.asReadonly(),this.translationsVersion=this.translationsUpdateSignal.asReadonly(),this.currentTranslations=Hi(()=>{let i=this.currentLanguageSignal(),r=this.translationsUpdateSignal();return this.translationsMap.get(i)||{}}),this.loggingService.log("%c[WB] Calling FUNCTION: constructor","color: green;"),this.setTranslations(wse),pr(()=>{let i=this.currentLanguageSignal();this.translationCache.clear(),this.translationsUpdateSignal.update(r=>r+1)},{allowSignalWrites:!0})}translate(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: translate","color: green;");let i=this.currentLanguageSignal(),r=this.translationsUpdateSignal(),a=`${i}:${e}:${r}`,s=this.translationCache.get(i);if(s?.has(a))return s.get(a)||e;let c=this.currentTranslations()[e];return this.translationCache.has(i)||this.translationCache.set(i,new Map),this.translationCache.get(i)?.set(a,c||e),av(c)?e:c}catch{return e}}setTranslations(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setTranslations","color: green;");let i=!1;Object.entries(e).forEach(([r,a])=>{if(a&&typeof a=="object"){let s=this.translationsMap.get(r)||{};Object.keys(a).forEach(p=>{s.hasOwnProperty(p)||(i=!0)});let c=I(I({},s),a);this.translationsMap.set(r,c),this.translationCache.delete(r)}}),this.translationsUpdateSignal.update(r=>r+1),i&&setTimeout(()=>{this.translationsUpdateSignal.update(r=>r+1)},0)}catch(i){this.loggingService.catch("Error in setTranslations: ",i)}}setLanguage(e){return ee(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: setLanguage","color: green;"),this.currentLanguageSignal.set(e)}catch(i){this.loggingService.catch("Error in setLanguage: ",i)}})}enableAutoTranslation(){try{this.loggingService.log("%c[WB] Calling FUNCTION: enableAutoTranslation","color: green;"),this.autoTranslationSignal.set(!0)}catch(e){this.loggingService.catch("Error in enableAutoTranslation: ",e)}}disableAutoTranslation(){try{this.loggingService.log("%c[WB] Calling FUNCTION: disableAutoTranslation","color: green;"),this.autoTranslationSignal.set(!1),this.translationCache.clear()}catch(e){this.loggingService.catch("Error in disableAutoTranslation: ",e)}}};o.\u0275fac=function(i){return new(i||o)(J(y))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var me=(()=>{let o=class o{constructor(e,i){this.domService=e,this.translateService=i,this.sanitizedCache=new Map}transform(e){if(e==null)return"";let i=typeof e=="boolean"||typeof e=="number"?String(e):e;try{let r=this.translateService.currentLanguage(),a=this.translateService.translationsVersion(),s=`${r}:${i}:${a}`,c=this.sanitizedCache.get(s);if(c)return c;let p=this.translateService.translate(i),h=this.domService.sanitizeHtml(p);return this.sanitizedCache.set(s,h),this.sanitizedCache.size>1e3&&this.sanitizedCache.clear(),h}catch(r){return console.warn("Translation error:",r),i}}};o.\u0275fac=function(i){return new(i||o)(u(Fe,16),u(zs,16))},o.\u0275pipe=ao({name:"translate",type:o,pure:!0,standalone:!1});let n=o;return n})();function d9e(n,o){if(n&1&&(C(0,"span",6),te(1),D(2,"translate"),S()),n&2){let t=l(2).ngIf;d(),dr("",O(2,2,"You are following")," ",t.leaderName,"")}}function p9e(n,o){n&1&&(C(0,"span",6),te(1),D(2,"translate"),S()),n&2&&(d(),$e(O(2,1,"You are leading.")))}function g9e(n,o){if(n&1){let t=q();C(0,"div",2),z("click",function(){k(t);let i=l().ngIf,r=l();return R(i.type==="following"?r.closeOverlay():void 0)}),C(1,"div",3),g(2,d9e,3,4,"span",4)(3,p9e,3,3,"span",4),C(4,"button",5),z("click",function(){k(t);let i=l(2);return R(i.closeOverlay())}),te(5),D(6,"translate"),D(7,"translate"),S()()()}if(n&2){let t=l().ngIf;pe("no-pointer",t.type==="leading"),d(2),m("ngIf",t.type==="following"),d(),m("ngIf",t.type==="leading"),d(2),dr("",O(6,6,"Stop")," ",O(7,8,t.type),"")}}function u9e(n,o){if(n&1&&(f(0),g(1,g9e,8,10,"div",1),v()),n&2){let t=o.ngIf;d(),m("ngIf",t.leaderName!==""||t.type==="leading")}}var h$=(()=>{let o=class o extends nt{closeOverlay(){this.closeOverlayEvent.emit()}constructor(e,i,r){super(i,r),this.loggingService=e,this.elementRef=i,this.themeService=r,this.closeOverlayEvent=new De,this.componentConfigSignal=be({leaderName:"",type:"following"})}ngOnInit(){}setLeaderName(e){try{this.componentConfigSignal.update(i=>(i=T(I({},i),{leaderName:e}),i))}catch(i){this.loggingService.catch("Error in FollowOverlayComponent setLeaderName: ",i)}}getLeaderName(){return this.componentConfigSignal().leaderName}setType(e){try{this.componentConfigSignal.update(i=>(i=T(I({},i),{type:e}),i))}catch(i){this.loggingService.catch("Error in FollowOverlayComponent setType: ",i)}}ngOnDestroy(){try{super.ngOnDestroy()}catch{}}};o.\u0275fac=function(i){return new(i||o)(u(y),u(N),u(Ye))},o.\u0275cmp=M({type:o,selectors:[["snippyly-follow-overlay"]],outputs:{closeOverlayEvent:"closeOverlayEvent"},standalone:!1,features:[B],decls:1,vars:1,consts:[[4,"ngIf"],["data-velt-ignore","","class","follow-overlay-container",3,"no-pointer","click",4,"ngIf"],["data-velt-ignore","",1,"follow-overlay-container",3,"click"],["data-velt-ignore","",1,"follow-dialog"],["data-velt-ignore","","class","follow-text",4,"ngIf"],["data-velt-ignore","",1,"follow-btn",3,"click"],["data-velt-ignore","",1,"follow-text"]],template:function(i,r){i&1&&g(0,u9e,2,1,"ng-container",0),i&2&&m("ngIf",r.componentConfigSignal())},dependencies:[K,me],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}.follow-overlay-container{position:fixed;top:0;left:0;width:100%;height:100%;background-color:transparent;z-index:var(--velt-follow-mode-overlay-z-index);display:flex;justify-content:center;align-items:flex-end}.follow-overlay-container .follow-dialog{background-color:var(--legacy-velt-follow-overlay-bg-color);color:var(--legacy-velt-follow-overlay-text-color);font-size:12px;display:flex;justify-content:center;align-items:center;gap:calc((1.2rem + 0px) * var(--velt-base-rem-unit));padding:calc((.9rem + 0px) * var(--velt-base-rem-unit)) calc((1.1rem + 0px) * var(--velt-base-rem-unit));border-radius:90px;margin-bottom:calc((2rem + 0px) * var(--velt-base-rem-unit));box-shadow:0 8px 16px -8px #0f0f0f1a;border:1px solid var(--legacy-velt-follow-overlay-border-color)}.follow-overlay-container .follow-dialog .follow-btn{background-color:var(--legacy-velt-follow-overlay-btn-color);padding:8px 12px;border-radius:90px;display:inline-flex;justify-content:center;align-items:center;border:none;font-weight:600;font-size:14px;cursor:pointer;pointer-events:all}.follow-overlay-container .follow-dialog .follow-btn:hover{transition:background-color .5s;background-color:var(--legacy-velt-follow-overlay-btn-hover-color)}.follow-overlay-container.no-pointer{pointer-events:none}
|
|
383
|
-
`],encapsulation:3,changeDetection:0});let n=o;return n})();var Dse=(()=>{let o=class o{constructor(e,i,r,a){this.componentFactoryResolver=e,this.applicationRef=i,this.injector=r,this.loggingService=a,this.darkMode=!1}createFollowOverlay(e,i){try{let a=this.componentFactoryResolver.resolveComponentFactory(h$).create(this.injector);a.instance.setLeaderName(e),a.instance.closeOverlayEvent.pipe(Je(1)).subscribe(()=>{this.removeOverlay(),i()}),this.applicationRef.attachView(a.hostView),this.overlayRef=a,this.overlayRef.instance.darkMode=this.darkMode;let s=this.overlayRef.location.nativeElement;s.id="snippyly-follow-overlay",s.setAttribute(U.ATTRIBUTES.VELT_IGNORE,""),document.body.appendChild(s)}catch(r){this.loggingService.catch("Error in FlockOverlayService createFollowOverlay: ",r)}}createLeaderOverlay(e){let r=this.componentFactoryResolver.resolveComponentFactory(h$).create(this.injector);r.instance.setType("leading"),r.instance.closeOverlayEvent.pipe(Je(1)).subscribe(()=>{this.removeOverlay(),e()}),this.applicationRef.attachView(r.hostView),this.overlayRef=r,this.overlayRef.instance.darkMode=this.darkMode;let a=this.overlayRef.location.nativeElement;a.id="snippyly-follow-overlay",a.setAttribute(U.ATTRIBUTES.VELT_IGNORE,""),document.body.appendChild(a)}changeLeaderName(e){this.overlayRef&&this.overlayRef.instance.setLeaderName(e)}getLeaderName(){return this.overlayRef?this.overlayRef.instance.getLeaderName():null}removeOverlay(){if(this.overlayRef){let e=this.overlayRef.location.nativeElement;this.applicationRef.detachView(this.overlayRef.hostView),this.overlayRef.destroy(),e.shadowRoot&&e.shadowRoot.removeChild(e.shadowRoot.childNodes[0]),e.remove(),this.overlayRef=void 0}}setDarkMode(e){try{this.darkMode=e,this.overlayRef&&(this.overlayRef.instance.darkMode=e)}catch(i){this.loggingService.catch("Error in FlockOverlayService setDarkMode: ",i)}}};o.\u0275fac=function(i){return new(i||o)(J(Io),J(mi),J(Et),J(y))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var vc=(()=>{let o=class o{constructor(e,i,r,a,s){this.authService=e,this.domService=i,this.loggingService=r,this.flockSessionService=a,this.flockOverlayService=s,this.flockLeader$=new fe({userId:"",name:""}),this.flockMode$=new fe(!1),this.currentFlockUser=null,this.localScrollData=[],this.domSubscriptions=[],this.followOverlayCreated=!1,this.leaderOverlayCreated=!1,this.windowFocused=!0,this.tabFocused=!0,this.useHistoryAPI=!0,this.disableDefaultNavigation=!1;try{this.flockLeader$.subscribe(c=>{let{userId:p,name:h}=c,_=p;if(this.provisionFollowUser(),_&&this.currentFlockUser&&this.currentFlockUser.snippylyId)if(this.currentFlockUser.sessionId){if(this.currentFlockUser.snippylyId&&this.currentFlockUser.isLeader){this.flockSessionService.swapLeader(this.currentFlockUser.snippylyId,_,h);return}this.removeCurrentUserFromSession()}else this.flockSessionService.provisionFlockSession(_,h,this.currentFlockUser.snippylyId)},c=>{this.loggingService.catch("Error in FlockService flockLeader$ subscription: ",c)}),this.flockSessionService.currentSession$.subscribe(c=>{if(c!==null){if(this.currentFlockUser&&(this.currentFlockUser.sessionId===null||this.currentFlockUser.sessionId===void 0)&&this.currentFlockUser.snippylyId&&(this.currentFlockUser.sessionId=c.id,this.flockSessionService.updateRemoteFlockUser(this.currentFlockUser.snippylyId,this.currentFlockUser)),this.currentFlockUser&&!this.currentFlockUser.isLeader&&!this.followOverlayCreated&&(this.leaderOverlayCreated&&(this.flockOverlayService.removeOverlay(),this.leaderOverlayCreated=!1),this.followOverlayCreated=!0,this.flockOverlayService.createFollowOverlay(c.leaderName,()=>{this.removeCurrentUserFromSession(),this.followOverlayCreated=!1})),this.currentFlockUser&&this.currentFlockUser.isLeader&&!this.leaderOverlayCreated&&(this.followOverlayCreated&&(this.flockOverlayService.removeOverlay(),this.followOverlayCreated=!1),this.leaderOverlayCreated=!0,this.flockOverlayService.createLeaderOverlay(()=>{this.removeCurrentUserFromSession(),this.leaderOverlayCreated=!1})),this.currentFlockUser&&!this.currentFlockUser.isLeader&&c.actionStack){let p=c.actionStack[0];p&&this.currentFlockUser.lastProcessedActionTimestamp!==p.timestamp&&this.processAction(p)}if(this.currentFlockUser&&!this.currentFlockUser.isLeader&&this.followOverlayCreated&&this.flockOverlayService.getLeaderName()!==null&&c.leaderName!==this.flockOverlayService.getLeaderName()&&this.flockOverlayService.changeLeaderName(c.leaderName),this.currentFlockUser&&this.currentFlockUser.isLeader){let p=_i();if(c.pageInfo){if(p&&p.url!==c.pageInfo.url){let h=new Td;h.type=Qa.NAVIGATE,this.flockSessionService.addActionToStack(c.id,h)}}else{this.flockSessionService.updateSession(c.id,{pageInfo:p});let h=new Td;h.type=Qa.NAVIGATE,this.flockSessionService.addActionToStack(c.id,h)}}}else this.currentFlockUser&&this.leaderOverlayCreated&&(this.flockOverlayService.removeOverlay(),this.leaderOverlayCreated=!1),this.currentFlockUser&&this.followOverlayCreated&&(this.flockOverlayService.removeOverlay(),this.followOverlayCreated=!1)}),this.flockSessionService.currentUser$.subscribe(c=>{if(c!==null&&(this.currentFlockUser&&this.currentFlockUser.isLeader!==c.isLeader&&(this.domSubscriptions.forEach(p=>p.unsubscribe()),this.domSubscriptions=[]),this.currentFlockUser=c,c.sessionId&&this.domSubscriptions.length===0))if(c.isLeader){if(!this.tabFocused||!this.windowFocused)return;this.subscribeToLeaderDOMEvents()}else this.subscribeToFollowerDOMEvents()}),Dn([this.authService.getUser$(),this.getFlockMode$()]).subscribe(([c,p])=>{c&&c.userSnippylyId&&p?this.flockSessionService.startCurrentFlockUserSubscription(c):this.flockSessionService.stopCurrentFlockUserSubscription()})}catch(c){this.loggingService.catch("Error in FlockService constructor: ",c)}}provisionFollowUser(){try{if(this.currentFlockUser===null){let e=this.authService.getUser();e&&e.userSnippylyId&&(this.currentFlockUser=new UM,this.currentFlockUser.snippylyId=e.userSnippylyId)}}catch(e){this.loggingService.catch("Error in FlockService provisionFollowUser: ",e)}}startFollowingUser(e,i){try{if(this.provisionFollowUser(),e&&this.currentFlockUser&&this.currentFlockUser.snippylyId){if(this.currentFlockUser.sessionId){if(this.currentFlockUser.snippylyId&&this.currentFlockUser.isLeader){this.flockSessionService.swapLeader(this.currentFlockUser.snippylyId,e,i);return}this.removeCurrentUserFromSession()}this.flockSessionService.provisionFlockSession(e,i,this.currentFlockUser.snippylyId)}}catch(r){this.loggingService.catch("Error in FlockService startFollowingUser: ",r)}}stopFollowingUser(){try{this.removeCurrentUserFromSession()}catch(e){this.loggingService.catch("Error in FlockService stopFollowingUser: ",e)}}subscribeToUrlChanges(){try{if(this.useHistoryAPI){let e=window.history.pushState,i=window.history.replaceState;window.history.pushState=(...r)=>{e.apply(window.history,r),this.onUrlChange()},window.history.replaceState=(...r)=>{i.apply(window.history,r),this.onUrlChange()},this.domSubscriptions.push({unsubscribe:()=>{window.history.pushState=e,window.history.replaceState=i}}),this.domSubscriptions.push(oi(window,"popstate").subscribe(()=>{this.onUrlChange()}))}}catch(e){this.loggingService.catch("Error in FlockService subscribeToUrlChanges: ",e)}}onUrlChange(){try{if(this.currentFlockUser&&this.currentFlockUser.sessionId&&this.currentFlockUser.isLeader){let e=new Td;e.type=Qa.NAVIGATE,this.flockSessionService.addActionToStack(this.currentFlockUser.sessionId,e)}}catch(e){this.loggingService.catch("Error in FlockService onUrlChange: ",e)}}processAction(e){try{switch(e.type){case Qa.CLICK:this.clickUserElement(e.data);break;case Qa.HOVER:this.scrollToHoveredElement(e.data);break;case Qa.SCROLL:this.scrollToFollowedUser(e.data);break;case Qa.NAVIGATE:this.checkMatchingUrl(e.pageInfo);break}this.currentFlockUser&&this.currentFlockUser.snippylyId&&this.flockSessionService.updateRemoteFlockUser(this.currentFlockUser.snippylyId,{lastProcessedActionTimestamp:e.timestamp})}catch(i){this.loggingService.catch("Error in FlockService processAction: ",i)}}subscribeToLeaderDOMEvents(){try{this.domSubscriptions.length>0&&(this.domSubscriptions.forEach(e=>e.unsubscribe()),this.domSubscriptions=[]),this.domSubscriptions.push(oi(window,"mouseover").pipe(jr(500)).subscribe(e=>{let i=e?.target;if(i){let r=window.getComputedStyle(i);if(r.position==="fixed"||r.position==="sticky"||i.hasAttribute(U.ATTRIBUTES.VELT_IGNORE))return;i=SV(i,{x:e.clientX,y:e.clientY}),this.updateHoveredElement(i)}})),this.domSubscriptions.push(this.domService.onWindowClick$().subscribe(e=>{let i=e?.target;if(i){if(i.hasAttribute(U.ATTRIBUTES.VELT_IGNORE))return;this.updateClickedElement(i)}})),this.subscribeToUrlChanges(),this.subscribeToScrollables()}catch(e){this.loggingService.catch("Error in FlockService subscribeToLeaderDOMEvents: ",e)}}subscribeToFollowerDOMEvents(){}updateClickedElement(e){try{if(this.currentFlockUser&&this.currentFlockUser.sessionId){let i=this.domService.getXPath(e),r=ov(e),a=this.domService.getXPath(r),s={id:Math.random().toString(36).substring(2),xpath:i,parentXpath:a},c=new Td;c.type=Qa.CLICK,c.data=s,this.flockSessionService.addActionToStack(this.currentFlockUser.sessionId,c)}}catch(i){this.loggingService.catch("Error in FlockService updateClickedElement: ",i)}}updateHoveredElement(e){try{if(this.currentFlockUser&&this.currentFlockUser.sessionId){let i=this.domService.getXPath(e),r=ov(e),a=this.domService.getXPath(r),s={id:Math.random().toString(36).substring(2),xpath:i,parentXpath:a},c=new Td;c.type=Qa.HOVER,c.data=s,this.flockSessionService.addActionToStack(this.currentFlockUser.sessionId,c)}}catch(i){this.loggingService.catch("Error in FlockService updateHoveredElement: ",i)}}subscribeToScrollables(){try{let e=Wie();e.push(document),e?.forEach(i=>{this.domSubscriptions.push(oi(i,"scroll").pipe(jr(100)).subscribe(r=>{this.currentFlockUser&&this.currentFlockUser.sessionId&&this.currentFlockUser.isLeader&&this.updateScrollPositionOfElement(i)}))})}catch(e){this.loggingService.catch("Error in FlockService getScrollableElements: ",e)}}updateScrollPositionOfElement(e){try{if(this.currentFlockUser&&this.currentFlockUser.sessionId){let i=new VM("","");if(e===document){let s=Kie();if(s){let c=SV(s);c&&(i.targetXpath=this.domService.getXPath(c))}i.xpath=""}else{let s=Yie(e);i.targetXpath=this.domService.getXPath(s),i.xpath=this.domService.getXPath(e)}let r=!1,a=!1;if(this.localScrollData.forEach((s,c)=>{s.xpath===s.xpath&&(i.targetXpath!==s.targetXpath&&(r=!0),this.localScrollData[c]=Object.assign(s,i),a=!0)}),a||this.localScrollData.push(i),r||!a){let s=new Td;s.type=Qa.SCROLL,s.data=i,this.flockSessionService.addActionToStack(this.currentFlockUser.sessionId,s)}}}catch(i){this.loggingService.catch("Error in FlockService calculateScrollPositionOfAnElement: ",i)}}enableFlockMode(e){try{if(this.flockMode$.next(!0),e){let{useHistoryAPI:i,onNavigate:r,disableDefaultNavigation:a,darkMode:s}=e;i!==void 0&&(this.useHistoryAPI=i),r!==void 0&&typeof r=="function"&&(this.onNavigate=r),a!==void 0&&(this.disableDefaultNavigation=a),this.flockOverlayService.setDarkMode(s)}}catch(i){this.loggingService.catch("Error in FlockService enableFlockMode: ",i)}}disableFlockMode(){try{this.flockMode$.next(!1),this.onNavigateEmitter=void 0,this.useHistoryAPI=!0,this.onNavigate=void 0}catch(e){this.loggingService.catch("Error in FlockService disableFlockMode: ",e)}}setDisableFlockNavigation(e){try{this.disableDefaultNavigation=e}catch(i){this.loggingService.catch("Error in FlockService setDisableFlockNavigation: ",i)}}getFlockMode$(){return this.flockMode$.asObservable()}getFlockMode(){return this.flockMode$.value}setNavigateEmitter(e){try{this.onNavigateEmitter=e}catch(i){this.loggingService.catch("Error in FlockService setNavigateEmitter: ",i)}}setTabFocused(e){try{if(this.tabFocused=e,!this.currentFlockUser)return;this.currentFlockUser.isLeader&&this.currentFlockUser.sessionId&&(this.tabFocused&&this.domSubscriptions.length===0?this.subscribeToLeaderDOMEvents():!this.tabFocused&&this.domSubscriptions.length>0&&(this.domSubscriptions.forEach(r=>{r.unsubscribe()}),this.domSubscriptions=[]))}catch(i){this.loggingService.catch("Error in FlockService setTabFocused: ",i)}}setWindowFocused(e){try{if(this.windowFocused=e,!this.currentFlockUser)return;this.currentFlockUser.isLeader&&this.currentFlockUser.sessionId&&(this.windowFocused&&this.domSubscriptions.length===0?this.subscribeToLeaderDOMEvents():!this.windowFocused&&this.domSubscriptions.length>0&&(this.domSubscriptions.forEach(r=>{r.unsubscribe()}),this.domSubscriptions=[]))}catch(i){this.loggingService.catch("Error in FlockService setWindowFocused: ",i)}}setFlockLeader(e,i){try{this.flockLeader$.next({userId:e,name:i})}catch(r){this.loggingService.catch("Error in FlockService setFlockLeader: ",r)}}isInSession(){try{return!!(this.currentFlockUser&&this.currentFlockUser.sessionId)}catch(e){this.loggingService.catch("Error in FlockService isFollowing: ",e)}return!1}removeCurrentUserFromSession(){try{this.domSubscriptions.forEach(e=>e.unsubscribe()),this.domSubscriptions=[],this.currentFlockUser&&(this.currentFlockUser.isLeader?this.currentFlockUser.sessionId&&this.flockSessionService.deleteSession(this.currentFlockUser.sessionId):this.currentFlockUser.snippylyId&&this.flockSessionService.removeFollowerFromCurrentSession(this.currentFlockUser.snippylyId))}catch(e){this.loggingService.catch("Error in FlockService removeCurrentUserFromSession: ",e)}}checkMatchingUrl(e){try{let r=_i()?.url,a=e.url;if(r!==a&&a!==void 0){let{url:s,path:c,baseUrl:p}=e;if(this.onNavigate!==void 0&&typeof this.onNavigate=="function"){this.onNavigate({url:s,path:c,baseUrl:p});return}if(this.onNavigateEmitter&&this.onNavigateEmitter.emit({url:s,path:c,baseUrl:p}),this.disableDefaultNavigation)return;window.location.href=a}}catch(i){this.loggingService.catch("Error in FlockService checkMatchingUrl: ",i)}}scrollToFollowedUser(e){try{if(e.xpath===""){let i=this.domService.getElementFromXPath(e.targetXpath);i&&XO(i)}else{let i=this.domService.getElementFromXPath(e.xpath),r=this.domService.getElementFromXPath(e.targetXpath);i&&r&&(XO(i),bV(i,r))}}catch(i){this.loggingService.catch("Error in FlockService scrollToFollowedUser: ",i)}}clickUserElement(e){try{let i=this.domService.getElementFromXPath(e.xpath);i&&this.lastClickedElement?.id!==e.id&&(i?.click(),this.lastClickedElement=e)}catch(i){this.loggingService.catch("Error in FlockService clickUserElement: ",i)}}scrollToHoveredElement(e){try{let i=this.domService.getElementFromXPath(e.xpath);if(i&&e.parentXpath)if(e.parentXpath==="/html")XO(i);else{let r=this.domService.getElementFromXPath(e.parentXpath);r&&bV(r,i,!0)}}catch(i){this.loggingService.catch("Error in FlockService clickUserElement: ",i)}}};o.\u0275fac=function(i){return new(i||o)(J(je),J(Fe),J(y),J(Tse),J(Dse))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Di=(()=>{let o=class o{constructor(e,i,r,a,s,c,p,h,_,E){this.afAuth=e,this.analyticsService=i,this.authService=r,this.configService=a,this.databaseService=s,this.docService=c,this.domService=p,this.iamService=h,this.loggingService=_,this.commonDbService=E,this.db=Ci(),this.liveStateDataMap$=new fe({}),this.liveStateDataMapDraft={},this.singleEditorMode$=new fe(!1),this.singleEditorModeConfig$=new fe(null),this.singleEditorLiveStateData$=new fe(null),this.singleEditorLiveStateData={},this.editorAccessTimeout$=new fe(U.LIVE_STATE_REQUEST_EDITOR_ACCESS_WAIT_TIME),this.editorAccessTransferOnTimeOut$=new fe(!0),this.defaultSingleEditorUIEnabled$=new fe(!0),this.editorAccessTimer$=new fe(new Bv),this.autoSyncState$=new fe(!1),this.serverConnectionState$=new fe(gl.PENDING_INIT),this.user=null,this.keydownSubscription=null,this.isEditor$=new fe(null),this.preventEventsOnElementMap={},this.PREVENT_EVENTS=["click","mouseup","mousedown"],this.autoSyncStateHistory=null,this.singleEditorModeContainerIds$=new fe([]),this.inputChangeSubscriptionMap={},this.childListMutationSubscription=null,this.tabId=this.domService.getTabId();try{this.loggingService.log("%c[WB] Creating CLASS: LiveStateService","color: blue;"),this.databaseService.getDb().pipe(Ne(A=>!!A),Je(1)).subscribe(A=>{A&&(this.db=A,this.getUser(),this.getDocumentPaths(),this.subscribeLiveStateData().subscribe(),this.singleEditorMode$.subscribe(V=>{V&&this.detectKeydownOnInput()}),this.autoSyncState$.subscribe(V=>{V?(this.detectLiveSyncInputs(),this.observeElementAddedOnDom()):(this.unsubscribeInputChanges(),this.childListMutationSubscription?.unsubscribe(),this.childListMutationSubscription=null)}),this.updateOnDatabaseDisconnect().subscribe(()=>{},V=>{this.loggingService.catch("Error in LiveStateService constructor updateOnDatabaseDisconnect: ",V)}),this.updateServerStateOnDatabaseDisconnect().subscribe(()=>{},V=>{this.loggingService.catch("Error in LiveStateService constructor updateServerStateOnDatabaseDisconnect: ",V)}))},A=>{this.loggingService.catch("Error in LiveStateService getDb subscription: ",A)}),this.liveStateDataMap$.pipe(Ne(A=>!!A?.default?.autoSyncState),ce(A=>A.default?.autoSyncState),Kt((A,V)=>JSON.stringify(A||{})===JSON.stringify(V||{}))).subscribe(A=>{A&&(this.getAutoSyncState()&&(!this.autoSyncStateHistory&&A?.history&&this.updateLiveStateSyncInputDataLocally(A.history),A?.current&&this.updateLiveStateSyncInputDataLocally({[A.current.liveStateDataId]:A.current})),!this.autoSyncStateHistory&&A?.history&&(this.autoSyncStateHistory=A.history))}),this.docService.addPreDocumentIdChangeFunction("live-state-service",A=>this.isUserEditor()?.isEditor&&(!this.getSingleEditorModeConfig()?.singleTabEditor||this.isUserEditor()?.isEditorOnCurrentTab)?this.removeEditorAccess():Promise.resolve())}catch(A){this.loggingService.catch("Error in LiveStateService constructor: ",A)}}observeElementAddedOnDom(){try{this.loggingService.log("%c[WB] Calling FUNCTION: observeElementAddedOnDom","color: green;"),this.childListMutationSubscription&&(this.childListMutationSubscription.unsubscribe(),this.childListMutationSubscription=null),this.childListMutationSubscription=this.domService.getChildListMutation$().subscribe(e=>{e?.length&&e.forEach(i=>{let r=Array.from(i.addedNodes||[]).filter(a=>a instanceof HTMLElement);r?.forEach(a=>{xV(a,!0)?.forEach(p=>{typeof p?.getAttribute=="function"&&p?.getAttribute(U.ATTRIBUTES.VELT_SYNC_STATE)&&this.subscribeInputChanges(p)})}),r?.length&&this.isEditor$?.value?.isEditor===!1&&(this.disableInputElements(),this.disableElementEvents())})},e=>{this.loggingService.catch("Error in LiveStateService domService getChildListMutation$ subscription: ",e)})}catch(e){this.loggingService.catch("Error in LiveStateService observeElementAddedOnDom: ",e)}}detectKeydownOnInput(){try{this.loggingService.log("%c[WB] Calling FUNCTION: detectKeydownOnInput","color: green;"),this.unsubscribeKeydownSubscription(),this.keydownSubscription=this.domService.onWindowKeydown$().pipe(Ne(e=>e?.target instanceof HTMLInputElement||e?.target instanceof HTMLTextAreaElement||e?.target instanceof HTMLSelectElement),Ne(e=>!!this.isElementInsideSingleEditorModeContainerElements(e?.target)),Je(1)).subscribe(e=>{this.unsubscribeKeydownSubscription(),this.getSingleEditorModeConfig()?.customMode||this.setUserAsEditor()},e=>{this.loggingService.catch("Error in LiveStateService detectKeydownOnInput subscription: ",e)})}catch(e){this.loggingService.catch("Error in LiveStateService detectKeydownOnInput: ",e)}}unsubscribeKeydownSubscription(){try{this.loggingService.log("%c[WB] Calling FUNCTION: unsubscribeKeydownSubscription","color: green;"),this.keydownSubscription&&(this.keydownSubscription.unsubscribe(),this.keydownSubscription=null)}catch(e){this.loggingService.catch("Error in LiveStateService unsubscribeKeydownSubscription: ",e)}}getDocumentPaths(){try{this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentPaths","color: green;"),this.docService.getDocumentPaths$().subscribe(e=>{this.documentPaths=e,this.updateLiveStateDataFromDraft()})}catch(e){this.loggingService.catch("Error in LiveStateService getDocumentPaths: ",e)}}getUser(){try{this.loggingService.log("%c[WB] Calling FUNCTION: getUser","color: green;"),this.authService.getUser$().subscribe(e=>{this.user=e,this.updateLiveStateDataFromDraft()})}catch(e){this.loggingService.catch("Error in LiveStateService getUser: ",e)}}updateLiveStateDataFromDraft(){try{this.loggingService.log("%c[WB] Calling FUNCTION: updateLiveStateDataFromDraft","color: green;"),this.liveStateDataMapDraft?.custom&&this.user&&this.documentPaths&&(Object.keys(this.liveStateDataMapDraft.custom).forEach(e=>{this.setLiveStateData(e,this.liveStateDataMapDraft.custom[e])}),this.liveStateDataMapDraft={})}catch(e){this.loggingService.catch("Error in LiveStateService updateLiveStateDataFromDraft: ",e)}}subscribeLiveStateData(){return this.loggingService.log("%c[WB] Calling FUNCTION: getOnlineUsersOnCurrentDocument","color: green;"),Wn(this.afAuth).pipe(Ne(e=>!!e),ge(e=>this.isFeatureAllowed({firebaseUser:e,liveStateData:{}})),ge(e=>e.featureAllowed?this.iamService.isUserAllowed$().pipe(ce(i=>(e.featureAllowed=i,e))):re(e)),ge(e=>e.featureAllowed?this.authService.isPlanExpired$().pipe(ce(i=>(e.featureAllowed=!i,e))):re(e)),ge(e=>e.featureAllowed?re(e).pipe(ge(i=>this.docService.getDocumentPaths$().pipe(ce(r=>(this.documentPaths=r,i.documentPaths=r,i)))),In(i=>{this.serverConnectionState$?.value===gl.PENDING_INIT&&i?.documentPaths?.liveState&&this.serverConnectionState$.next(gl.PENDING_DATA)}),ge(i=>this.getDataFromDocumentId().pipe(ce(r=>(i.liveStateData=r,I({},i))))),ge(i=>this.getSingleEditorMode$().pipe(ce(()=>i))),ce(i=>{if(this.serverConnectionState$?.value!==gl.ONLINE&&this.serverConnectionState$.next(gl.ONLINE),i.liveStateData)this.liveStateDataMap$.next(i.liveStateData);else{let r=this.liveStateDataMap$.value;r&&Object.keys(r).length>0&&this.liveStateDataMap$.next({})}this.getSingleEditorMode()&&this.updateSingleEditorLiveSyncData(i?.liveStateData?.default?.singleEditorMode||{})})):re({})))}updateSingleEditorLiveSyncData(e){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: updateSingleEditorLiveSyncData","color: green;"),Co(e,{})&&!this.keydownSubscription&&this.detectKeydownOnInput(),e&&!e?.editor&&this.isEditor$?.value!==void 0&&this.isEditor$.next(void 0),Co(this.singleEditorLiveStateData,e))return;if(this.singleEditorLiveStateData=e,this.singleEditorLiveStateData$.next(e),this.singleEditorLiveStateData?.editor){let i=this.authService.getUser();this.singleEditorLiveStateData?.editor?.userId!==i?.userId?this.makeReader():this.makeEditor()}else this.isEditor$?.value!==void 0&&this.isEditor$.next(void 0),this.enableInputElements(),this.enableElementEvents();this.editorAccessTimerInterval&&this.singleEditorLiveStateData?.requestEditorAccess?.status!=="pending"&&this.clearEditorAccessTimerInterval(),this.requestAccessTimer&&this.singleEditorLiveStateData?.requestEditorAccess?.status!=="pending"?this.clearRequestAccessTimer():this.singleEditorLiveStateData?.requestEditorAccess?.status==="pending"&&this.isUserEditor()?.isEditor&&this.isUserEditor()?.isEditorOnCurrentTab&&this.setRequestAccessTimer(this.singleEditorLiveStateData?.requestEditorAccess?.editorAccessTimeout||U.LIVE_STATE_REQUEST_EDITOR_ACCESS_WAIT_TIME)}catch{}}isFeatureAllowed(e){return this.configService.getConfig$().pipe(Ne(i=>!!i),ce(i=>T(I({},e),{config:i})),ge(i=>this.authService.getUser$().pipe(ce(r=>T(I({},i),{user:r})))),ge(i=>Zi(i.config,i.user,Re.LIVE_STATE_SYNC)?re(T(I({},i),{featureAllowed:!0})):(this.loggingService.warn("Live state sync feature is not allowed."),re(T(I({},i),{featureAllowed:!1})))))}getDataFromDocumentId(e){return this.databaseService.getDb().pipe(Ne(i=>!!i),ge(i=>(this.db=i,this.configService?.getApiKey()&&this.documentPaths?.liveState?this.commonDbService.dbListener({feature:"allLiveStates",properties:{documentId:e??this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(ce(r=>r?.data),Ln(r=>(this.loggingService.catch("Error in LiveStateService getDataFromDocumentId: ",r),re({})))):re({}))))}getLiveStateData$(e,i){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getLiveStateData$","color: green;"),Wn(this.afAuth).pipe(Ne(r=>!!r),ge(r=>this.isFeatureAllowed({firebaseUser:r,liveStateData:{}})),ge(r=>r.featureAllowed?this.iamService.isUserAllowed$().pipe(ce(a=>(r.featureAllowed=a,r))):re(r)),ge(r=>r.featureAllowed?this.authService.isPlanExpired$().pipe(ce(a=>(r.featureAllowed=!a,r))):re(r)),ge(r=>r.featureAllowed?re(r).pipe(ge(a=>this.docService.getDocumentPaths$().pipe(ce(s=>(this.documentPaths=s,a.documentPaths=s,a)))),ge(a=>{let s=i?.listenToNewChangesOnly?1:0;return this.getLiveStateDataFromDatabase$(e).pipe(xs(s))}),ce(a=>{if(a)if(e){let s=Rt(e+""),c=a?.[s];if(c){let p=c?.data;if(c?.tabId&&this.tabId&&c?.tabId===this.tabId)return;if(c?.isDataStringified&&typeof p=="string")try{p=JSON.parse(p)}catch{}return p}else return}else{let s={};return Object.keys(a||{}).forEach(c=>{if(a[c]?.liveStateDataId){let p=a[c],h=p?.data;if(p?.isDataStringified&&typeof h=="string")try{h=JSON.parse(h)}catch{}s[p.liveStateDataId]=h}}),s}return a})):re(void 0).pipe(Ne(Boolean))),Kt((r,a)=>JSON.stringify(r||{})===JSON.stringify(a||{})),Ne(r=>r!==void 0),ce(r=>r))}catch(r){return this.loggingService.catch("Error in LiveStateService getLiveStateData$: ",r),re(null)}}getLiveStateDataFromDatabase$(e){try{return this.databaseService.getDb().pipe(Ne(i=>!!i),ge(i=>{this.db=i;let r=e?Rt(e+""):void 0;return this.configService?.getApiKey()&&this.documentPaths?.liveState?this.commonDbService.dbListener({feature:r?"liveStateCustom":"allLiveStateCustoms",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,id:r,skipFirestore:!0}}).pipe(ce(a=>a?.data),ce(a=>{if(a)return r?{[r]:a}:a}),Ln(a=>(this.loggingService.catch("Error in LiveStateService getLiveStateDataFromDatabase$: ",a),re(null)))):re(void 0)}))}catch(i){return this.loggingService.catch("Error in LiveStateService getLiveStateDataFromDatabase$: ",i),re(void 0)}}setLiveStateData(e,i,r){return ee(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: setLiveStateData","color: green;");try{let a=this.authService.getUser();if(e&&this.documentPaths?.liveState&&a){let s=Rt(e+""),c=!1;try{if(r?.merge&&typeof i=="object"){let h=yield this.commonDbService.getData({feature:"liveStateCustom",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:s,skipFirestore:!0}});if(h?.isDataStringified){let _=JSON.parse(h?.data);typeof i=="object"&&(i=I(I({},_),i))}}}catch{}try{typeof i=="object"&&(i=JSON.stringify(i),c=!0)}catch{}let p={id:s,lastUpdated:this.timestamp,liveStateDataId:e,data:i,updatedBy:a,tabId:this.tabId,isDataStringified:c};yield this.commonDbService.setData({feature:"liveStateCustom",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:s,skipFirestore:!0},data:JSON.parse(JSON.stringify(p))})}else this.loggingService.warn("liveStateDataId or documentPaths or user is null"),this.liveStateDataMapDraft?.custom||(this.liveStateDataMapDraft.custom={}),e&&(this.liveStateDataMapDraft.custom[e]=i)}catch(a){this.loggingService.catch("Error in LiveStateService _setLiveStateData: ",a)}})}getFormElements(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getInputElements","color: green;"),document.querySelectorAll("input, textarea, select, button, [contenteditable]")}catch(e){return this.loggingService.catch("Error in LiveStateService getInputElements: ",e),null}}disableInputElements(){try{this.loggingService.log("%c[WB] Calling FUNCTION: disableInputElements","color: green;"),this.getFormElements()?.forEach(i=>{if(this.isElementInsideSingleEditorModeContainerElements(i)&&!this.isSingleEditorModeDisabledForElement(i)&&!Ui(i)){let r=i?.hasAttribute("disabled");i?.hasAttribute("contenteditable")&&(r=i?.getAttribute("contenteditable")==="false"),r||(i.setAttribute("disabled","true"),i.setAttribute(U.ATTRIBUTES.VELT_SYNC_ACCESS_AUTO,"true"),i?.hasAttribute("contenteditable")&&i.setAttribute("contenteditable","false"))}})}catch(e){this.loggingService.catch("Error in LiveStateService disableInputElements: ",e)}}enableInputElements(){try{this.loggingService.log("%c[WB] Calling FUNCTION: enableInputElements","color: green;"),this.getFormElements()?.forEach(i=>{i?.hasAttribute(U.ATTRIBUTES.VELT_SYNC_ACCESS_AUTO)&&(i.removeAttribute("disabled"),i.removeAttribute(U.ATTRIBUTES.VELT_SYNC_ACCESS_AUTO),i?.getAttribute("contenteditable")&&i.setAttribute("contenteditable","true"))})}catch(e){this.loggingService.catch("Error in LiveStateService enableInputElements: ",e)}}disableElementEvents(){try{this.loggingService.log("%c[WB] Calling FUNCTION: disableElementEvents","color: green;"),document.querySelectorAll(`[${U.ATTRIBUTES.VELT_SYNC_ACCESS}]`)?.forEach(i=>{let r=this.domService.getXPath(i);r&&!this.preventEventsOnElementMap[r]&&(this.preventEventsOnElementMap[r]={element:i,events:{}},this.PREVENT_EVENTS.forEach(a=>{let s=oi(i,a,{capture:!0}).subscribe(c=>{try{c.preventDefault(),c.stopPropagation()}catch(p){this.loggingService.catch("Error in LiveStateService disableElementEvents subscription: ",p)}});this.preventEventsOnElementMap[r]?.events[a]?.unsubscribe(),this.preventEventsOnElementMap[r].events[a]=s}))})}catch(e){this.loggingService.catch("Error in LiveStateService disableElementClicks: ",e)}}enableElementEvents(){try{this.loggingService.log("%c[WB] Calling FUNCTION: enableElementEvents","color: green;"),Object.keys(this.preventEventsOnElementMap).forEach(e=>{let i=this.preventEventsOnElementMap[e];Object.keys(i.events||{}).forEach(r=>{i?.events[r]?.unsubscribe()})}),this.preventEventsOnElementMap={}}catch(e){this.loggingService.catch("Error in LiveStateService enableElementClicks: ",e)}}setUserAsEditor(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: setUserAsEditor","color: green;"),this.user&&this.documentPaths?.liveStateSingleEditorMode){let e={editor:this.user,tabId:this.tabId,editorAt:this.timestamp};this.commonDbService.setData({feature:"liveStateSingleEditorMode",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",skipFirestore:!0},data:JSON.parse(JSON.stringify(e))}),this.analyticsService.trackEvent(Z.Events.LiveStateSync.SET_USER_AS_EDITOR_TRIGGERED,{editorUserId:this.user?.userSnippylyId,tabId:this.tabId})}}catch(e){this.loggingService.catch("Error in LiveStateService setUserAsEditor: ",e)}}setRequestAccessTimer(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setRequestAccessTimer","color: green;"),this.requestAccessTimer||(this.requestAccessTimer=setTimeout(()=>{this.getEditorAccessTransferOnTimeOut()&&this.acceptEditorAccessRequest(),this.clearRequestAccessTimer()},e*1e3),this.setEditorAccessTimerInterval(e))}catch(i){this.loggingService.catch("Error in LiveStateService setRequestAccessTimer: ",i)}}clearRequestAccessTimer(){try{this.loggingService.log("%c[WB] Calling FUNCTION: clearRequestAccessTimer","color: green;"),this.requestAccessTimer&&(clearTimeout(this.requestAccessTimer),this.requestAccessTimer=null)}catch(e){this.loggingService.catch("Error in LiveStateService clearRequestAccessTimer: ",e)}}requestEditorAccess(){this.loggingService.log("%c[WB] Calling FUNCTION: requestEditorAccess","color: green;");try{return this.analyticsService.trackEvent(Z.Events.LiveStateSync.REQUEST_EDITOR_ACCESS_TRIGGERED),new Ft(e=>{let i=null;try{if(this.user&&this.documentPaths?.liveStateSingleEditorMode){let r=this.getEditorAccessTimeout(),a=on(this.db,`${this.documentPaths?.liveStateSingleEditorMode}`),s={requestEditorAccess:{user:this.user,requestedAt:this.timestamp,status:"pending",editorAccessTimeout:r,tabId:this.tabId}};this.commonDbService.updateData({feature:"liveStateSingleEditorMode",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",skipFirestore:!0},errorCallback:c=>{this.loggingService.catch("Error in LiveStateService requestEditorAccess: ",c),e.next(null),e.complete()},callback:()=>{r&&(this.requestAccessTimer=setTimeout(()=>{this.getEditorAccessTransferOnTimeOut()&&this.setUserAsEditor()},(r+3)*1e3),this.setEditorAccessTimerInterval(r+3)),i=this.getSingleEditorLiveStateData$().subscribe(c=>{c&&(c?.requestEditorAccess?c?.requestEditorAccess?.status==="cancelled"&&(e.next(null),e.complete()):c?.editor?.userId===this.user?.userId?(e.next(!0),e.complete()):(e.next(!1),e.complete()))})},data:JSON.parse(JSON.stringify(s))})}else e.next(!1),e.complete()}catch(r){this.loggingService.catch("Error in LiveStateService requestEditorAccess: ",r),e.next(null),e.complete()}return()=>{i&&i?.unsubscribe()}})}catch(e){return this.loggingService.catch("Error in LiveStateService requestEditorAccess: ",e),re(null)}}makeEditor(){try{this.loggingService.log("%c[WB] Calling FUNCTION: makeEditor","color: green;");let e=this.singleEditorLiveStateData?.tabId===this.tabId;this.isEditor$.next({isEditor:!0,isEditorOnCurrentTab:e}),this.getSingleEditorModeConfig()?.customMode||(!this.getSingleEditorModeConfig()?.singleTabEditor||e?(this.enableInputElements(),this.enableElementEvents()):(this.disableInputElements(),this.disableElementEvents()))}catch(e){this.loggingService.catch("Error in LiveStateService makeEditor: ",e)}}makeReader(){try{this.loggingService.log("%c[WB] Calling FUNCTION: makeReader","color: green;"),this.isEditor$.next({isEditor:!1,isEditorOnCurrentTab:!1}),this.getSingleEditorModeConfig()?.customMode||(this.disableInputElements(),this.disableElementEvents())}catch(e){this.loggingService.catch("Error in makeReader: ",e)}}acceptEditorAccessRequest(){return ee(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: acceptEditorAccessRequest","color: green;"),this.user&&this.singleEditorLiveStateData?.requestEditorAccess&&this.isUserEditor()?.isEditor&&this.documentPaths?.liveStateSingleEditorMode){let e=this.singleEditorLiveStateData?.requestEditorAccess?.user,i=this.singleEditorLiveStateData?.requestEditorAccess?.tabId;if(e&&i){let r={editor:e,requestEditorAccess:null,tabId:i,editorAt:this.timestamp};this.commonDbService.updateData({feature:"liveStateSingleEditorMode",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",skipFirestore:!0},data:JSON.parse(JSON.stringify(r))}),this.analyticsService.trackEvent(Z.Events.LiveStateSync.ACCEPT_EDITOR_ACCESS_REQUEST_TRIGGERED,{editorUserId:e?.userSnippylyId,tabId:i})}}}catch(e){this.loggingService.catch("Error in acceptEditorAccessRequest: ",e)}})}rejectEditorAccessRequest(){return ee(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: rejectEditorAccessRequest","color: green;"),this.user&&this.singleEditorLiveStateData?.requestEditorAccess&&this.isUserEditor()?.isEditor&&this.documentPaths?.liveStateSingleEditorMode){let e={requestEditorAccess:null};this.commonDbService.updateData({feature:"liveStateSingleEditorMode",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",skipFirestore:!0},data:JSON.parse(JSON.stringify(e))}),this.analyticsService.trackEvent(Z.Events.LiveStateSync.REJECT_EDITOR_ACCESS_REQUEST_TRIGGERED)}}catch(e){this.loggingService.catch("Error in LiveStateService rejectEditorAccessRequest: ",e)}})}cancelEditorAccessRequest(){return ee(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: cancelEditorAccessRequest","color: green;"),this.user&&this.singleEditorLiveStateData?.requestEditorAccess&&this.documentPaths?.liveStateSingleEditorMode){let e={requestEditorAccess:T(I({},this.singleEditorLiveStateData?.requestEditorAccess),{status:"cancelled"})};this.commonDbService.updateData({feature:"liveStateSingleEditorMode",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",skipFirestore:!0},data:JSON.parse(JSON.stringify(e))}),e={requestEditorAccess:null},this.commonDbService.updateData({feature:"liveStateSingleEditorMode",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",skipFirestore:!0},data:JSON.parse(JSON.stringify(e))}),this.analyticsService.trackEvent(Z.Events.LiveStateSync.CANCEL_EDITOR_ACCESS_REQUEST_TRIGGERED)}}catch(e){this.loggingService.catch("Error in LiveStateService cancelEditorAccessRequest: ",e)}})}editCurrentTab(){return ee(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: editCurrentTab","color: green;"),this.user&&this.isUserEditor()?.isEditor&&!this.isUserEditor()?.isEditorOnCurrentTab&&this.documentPaths?.liveStateSingleEditorMode){let e={tabId:this.tabId};this.commonDbService.updateData({feature:"liveStateSingleEditorMode",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",skipFirestore:!0},data:JSON.parse(JSON.stringify(e))}),this.analyticsService.trackEvent(Z.Events.LiveStateSync.EDIT_CURRENT_TAB_TRIGGERED,{tabId:this.tabId})}}catch(e){this.loggingService.catch("Error in LiveStateService editCurrentTab: ",e)}})}isUserEditor$(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: isUserEditor$","color: green;"),this.isEditor$.asObservable()}catch(e){return this.loggingService.catch("Error in LiveStateService isUserEditor$: ",e),re(null)}}isUserEditor(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: isUserEditor","color: green;"),this.isEditor$.value}catch(e){return this.loggingService.catch("Error in LiveStateService isUserEditor: ",e),null}}getEditor$(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getEditor$","color: green;"),this.getSingleEditorLiveStateData$().pipe(ce(e=>e?.editor||null),Kt())}catch(e){return this.loggingService.catch("Error in LiveStateService getEditor$: ",e),re(null)}}isEditorAccessRequested$(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: isEditorAccessRequested$","color: green;"),this.isUserEditor$().pipe(ge(e=>e?.isEditor?this.singleEditorLiveStateData$.pipe(ce(i=>i?.requestEditorAccess?{requestStatus:"requested",requestedBy:i?.requestEditorAccess?.user}:null)):re(null)),Kt((e,i)=>JSON.stringify(e||{})===JSON.stringify(i||{})))}catch(e){return this.loggingService.catch("Error in LiveStateService isEditorAccessRequested$: ",e),re(null)}}removeEditorAccess(){return ee(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeEditorAccess","color: green;"),(this.user||this.authService.getAuthUser())&&this.documentPaths?.liveStateSingleEditorMode&&(yield this.commonDbService.deleteData({feature:"liveStateSingleEditorMode",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",skipFirestore:!0}}))}catch(e){this.loggingService.catch("Error in LiveStateService removeEditorAccess: ",e)}})}getSingleEditorLiveStateData$(){return this.singleEditorLiveStateData$.asObservable()}enableSingleEditorMode(e){try{if(this.singleEditorMode$.value===!0)return;this.singleEditorMode$.next(!0),e?this.singleEditorModeConfig$.next(e):this.singleEditorModeConfig$.next(new cM)}catch(i){this.loggingService.catch("Error in LiveStateService enableSingleEditorMode: ",i)}}disableSingleEditorMode(){try{if(this.singleEditorMode$.value===!1)return;this.singleEditorMode$.next(!1)}catch(e){this.loggingService.catch("Error in LiveStateService disableSingleEditorMode: ",e)}}getSingleEditorMode$(){return this.singleEditorMode$.asObservable()}getSingleEditorMode(){return this.singleEditorMode$.value}getSingleEditorModeConfig$(){return this.singleEditorModeConfig$.asObservable()}getSingleEditorModeConfig(){return this.singleEditorModeConfig$.value}enableAutoSyncState(){try{if(this.autoSyncState$.value===!0)return;this.autoSyncState$.next(!0)}catch(e){this.loggingService.catch("Error in LiveStateService enableAutoSyncState: ",e)}}disableAutoSyncState(){try{if(this.autoSyncState$.value===!1)return;this.autoSyncState$.next(!1)}catch(e){this.loggingService.catch("Error in LiveStateService disableAutoSyncState: ",e)}}getAutoSyncState$(){return this.autoSyncState$.asObservable()}getAutoSyncState(){return this.autoSyncState$.value}setEditorAccessTimeout(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setEditorAccessTimeout","color: green;"),e&&this.editorAccessTimeout$.next(e)}catch(i){this.loggingService.catch("Error in LiveStateService setEditorAccessTimeout: ",i)}}getEditorAccessTimeout$(){return this.editorAccessTimeout$.asObservable()}getEditorAccessTimeout(){return this.editorAccessTimeout$.value}enableEditorAccessTransferOnTimeOut(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: enableEditorAccessTransferOnTimeOut","color: green;"),this.editorAccessTransferOnTimeOut$.value===!0)return;this.editorAccessTransferOnTimeOut$.next(!0)}catch(e){this.loggingService.catch("Error in LiveStateService enableEditorAccessTransferOnTimeOut: ",e)}}disableEditorAccessTransferOnTimeOut(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: disableEditorAccessTransferOnTimeOut","color: green;"),this.editorAccessTransferOnTimeOut$.value===!1)return;this.editorAccessTransferOnTimeOut$.next(!1)}catch(e){this.loggingService.catch("Error in LiveStateService disableEditorAccessTransferOnTimeOut: ",e)}}getEditorAccessTransferOnTimeOut$(){return this.editorAccessTransferOnTimeOut$.asObservable()}getEditorAccessTransferOnTimeOut(){return this.editorAccessTransferOnTimeOut$.value}enableDefaultSingleEditorUI(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: enableDefaultSingleEditorUI","color: green;"),this.defaultSingleEditorUIEnabled$.value===!0)return;this.defaultSingleEditorUIEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in LiveStateService enableDefaultSingleEditorUI: ",e)}}disableDefaultSingleEditorUI(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: disableDefaultSingleEditorUI","color: green;"),this.defaultSingleEditorUIEnabled$.value===!1)return;this.defaultSingleEditorUIEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in LiveStateService disableDefaultSingleEditorUI: ",e)}}getDefaultSingleEditorUIEnabled$(){return this.defaultSingleEditorUIEnabled$.asObservable()}getDefaultSingleEditorUIEnabled(){return this.defaultSingleEditorUIEnabled$.value}setEditorAccessTimerInterval(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setEditorAccessTimerInterval","color: green;"),this.clearEditorAccessTimerInterval(),e>0&&(this.editorAccessTimer$.next({state:"inProgress",durationLeft:e}),this.editorAccessTimerInterval=setInterval(()=>{try{e-=1,e<0?this.clearEditorAccessTimerInterval():e?this.editorAccessTimer$.next({state:"inProgress",durationLeft:e}):this.editorAccessTimer$.next({state:"completed"})}catch(i){this.loggingService.catch("Error in LiveStateService setEditorAccessTimerCountdown interval: ",i),this.clearEditorAccessTimerInterval()}},1e3))}catch(i){this.loggingService.catch("Error in LiveStateService setEditorAccessTimerCountdown: ",i),this.clearEditorAccessTimerInterval()}}clearEditorAccessTimerInterval(){try{this.loggingService.log("%c[WB] Calling FUNCTION: clearEditorAccessTimerInterval","color: green;"),this.editorAccessTimerInterval&&(clearInterval(this.editorAccessTimerInterval),this.editorAccessTimerInterval=null,this.editorAccessTimer$.next({state:"idle"}))}catch(e){this.loggingService.catch("Error in LiveStateService clearEditorAccessTimerInterval: ",e)}}getEditorAccessTimer$(){return this.editorAccessTimer$.asObservable()}onServerConnectionStateChange$(){return this.serverConnectionState$.asObservable()}detectLiveSyncInputs(){try{document.querySelectorAll(`[${U.ATTRIBUTES.VELT_SYNC_STATE}]`)?.forEach(i=>{this.subscribeInputChanges(i)})}catch(e){this.loggingService.catch("Error in LiveStateService detectLiveSyncInputs: ",e)}}subscribeInputChanges(e){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: subscribeInputChanges","color: green;"),e){let i=e.tagName,r=this.domService.getXPath(e),a=Rt(r);if(this.inputChangeSubscriptionMap[a])this.loggingService.warn("subscription already exists",a,e);else{this.inputChangeSubscriptionMap[a]={id:a,element:e};let s;switch(i?.toLowerCase()){case"input":s=oi(e,"input").pipe(jr(300)).subscribe(p=>{let h={value:p?.target?.value,tagName:p?.target?.tagName,type:p?.target?.type};this.setLiveStateSyncInputData(p?.target,h)});break;case"textarea":s=oi(e,"input").pipe(jr(300)).subscribe(p=>{let h={value:p?.target?.value,tagName:p?.target?.tagName};this.setLiveStateSyncInputData(p?.target,h)});break;default:e.getAttribute("contenteditable")&&(s=oi(e,"input").pipe(jr(300)).subscribe(p=>{let h={innerText:p?.target?.innerText,innerHTML:this.domService.sanitizeHtml(p?.target?.innerHTML),tagName:p?.target?.tagName,isContentEditable:!0};this.setLiveStateSyncInputData(p?.target,h)}));break}s&&(this.inputChangeSubscriptionMap[a]?.subscriptions||(this.inputChangeSubscriptionMap[a]={subscriptions:[]}),this.inputChangeSubscriptionMap[a].subscriptions?.push(s))}}}catch(i){this.loggingService.catch("Error in LiveStateService subscribeInputChanges: ",i)}}unsubscribeInputChanges(){try{this.loggingService.log("%c[WB] Calling FUNCTION: unsubscribeInputChanges","color: green;"),Object.keys(this.inputChangeSubscriptionMap).forEach(e=>{this.inputChangeSubscriptionMap[e]?.subscriptions?.forEach(r=>{r.unsubscribe()})}),this.inputChangeSubscriptionMap={}}catch(e){this.loggingService.catch("Error in LiveStateService unsubscribeInputChanges: ",e)}}setLiveStateSyncInputData(e,i){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: setLiveStateSyncInputData","color: green;"),this.user&&this.documentPaths?.liveState){let r=this.domService.getXPath(e),a=Rt(r),s={id:a,lastUpdated:this.timestamp,liveStateDataId:r,data:i,updatedBy:this.user,tabId:this.tabId};this.commonDbService.updateData({feature:"liveStateAutoSyncStateCurrent",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",skipFirestore:!0},data:JSON.parse(JSON.stringify(s))}),this.commonDbService.updateData({feature:"liveStateAutoSyncStateHistoryId",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:a,skipFirestore:!0},data:JSON.parse(JSON.stringify(s))})}}catch(r){this.loggingService.catch("Error in LiveStateService setLiveStateSyncInputData: ",r)}}updateLiveStateSyncInputDataLocally(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: updateLiveStateSyncInputDataLocally","color: green;"),this.user&&Object.keys(e).forEach(i=>{let r=e[i],a=this.domService.getElementFromXPath(r?.liveStateDataId),s=!1;if(r?.updatedBy?.userSnippylyId!==this.user?.userSnippylyId)s=!0;else{let c=r?.tabId&&this.tabId&&r?.tabId!==this.tabId,p=a?.contains(document.activeElement);c&&!eoe()&&!p&&(s=!0)}if(s&&a)switch(a.value=r?.data?.value,a.tagName?.toLowerCase()){case"input":a.value=r?.data?.value;break;case"textarea":a.value=r?.data?.value;break;default:a.getAttribute("contenteditable")&&(a.innerHTML=this.domService.sanitizeHtml(r?.data?.innerHTML))}})}catch(i){this.loggingService.catch("Error in LiveStateService updateLiveStateSyncInputDataLocally: ",i)}}setSingleEditorModeContainerIds(e){this.singleEditorModeContainerIds$.next(e||[])}getSingleEditorModeContainerIds(){return this.singleEditorModeContainerIds$.asObservable()}isElementInsideSingleEditorModeContainerElements(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: isElementInsideSingleEditorModeContainerElements","color: green;");let i=this.singleEditorModeContainerIds$.value,r=document.querySelectorAll(`[${U.ATTRIBUTES.VELT_SINGLE_EDITOR_MODE_CONTAINER}]`);if(!i?.length&&!r?.length)return!0;if(i?.length)for(let a=0;a<i.length;a++){let s=document.getElementById(i[a]);if(s&&s.contains(e))return!0}if(r?.length)for(let a=0;a<r.length;a++){let s=r[a];if(s&&s.contains(e))return!0}return!1}catch(i){return this.loggingService.catch("Error in LiveStateService isElementInsideSingleEditorModeContainerElements: ",i),!1}}isSingleEditorModeDisabledForElement(e){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: isSingleEditorModeDisabledForElement","color: green;"),e){if(e.getAttribute(U.ATTRIBUTES.VELT_SYNC_ACCESS_DISABLED))return!0;{let r=e?.parentElement;if(r)return this.isSingleEditorModeDisabledForElement(r)}}return!1}catch(i){return this.loggingService.catch("Error in LiveStateService isSingleEditorModeDisabledForElement: ",i),!1}}updateOnDatabaseDisconnect(){return this.loggingService.log("%c[WB] Calling FUNCTION: updateOnDatabaseDisconnect","color: green;"),this.isUserEditor$().pipe(In(e=>{try{if(this.documentPaths?.liveStateSingleEditorMode){let i=on(this.db,`${this.documentPaths?.liveStateSingleEditorMode}`);e?.isEditor&&(!this.getSingleEditorModeConfig()?.singleTabEditor||e?.isEditorOnCurrentTab)?ll(i).remove():ll(i).cancel()}}catch(i){this.loggingService.catch("Error in LiveStateService updateOnDatabaseDisconnect tap: ",i)}}))}updateServerStateOnDatabaseDisconnect(){return this.loggingService.log("%c[WB] Calling FUNCTION: updateServerStateOnDatabaseDisconnect","color: green;"),Wn(this.afAuth).pipe(Ne(e=>!!e),ge(e=>this.docService.getDocumentPaths$().pipe(ce(i=>e))),In(e=>ee(this,null,function*(){try{if(this.docService.getDocumentPaths()?.liveState&&e){let r=on(this.db,".info/connected"),a=!0;gu(r,s=>{let c=s.val();if(a&&c===!1){a=!1;return}a=!1,c===!1?this.serverConnectionState$.next(gl.OFFLINE):this.serverConnectionState$.value===gl.OFFLINE&&this.serverConnectionState$.next(gl.ONLINE)})}}catch(i){this.loggingService.catch("Error in updateServerStateOnDatabaseDisconnect:",i)}})))}get timestamp(){return this.commonDbService.getServerTimestamp()}};o.\u0275fac=function(i){return new(i||o)(J(vi),J(Qe),J(je),J($t),J(pn),J(lt),J(Fe),J(gn),J(y),J(bn))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Cm=(()=>{let o=class o{constructor(e,i,r,a,s,c,p,h,_,E,A,V){this.analyticsService=e,this.docService=i,this.authService=r,this.afAuth=a,this.iamService=s,this.databaseService=c,this.configService=p,this.avatarService=h,this.loggingService=_,this.flockService=E,this.liveStateService=A,this.commonDbService=V,this.db=Ci(),this.presenceUser$=new fe(new dM),this.documentPaths=null,this.inactivityTime=5*60*1e3,this.presenceUsers$=new fe([]),this.presenceUsersSubscription=null,this.includeSelf$=new fe(!0),this.loggingService.log("%c[WB] Creating CLASS: PresenceService","color: blue;"),this.databaseService.getDb().pipe(Ne(G=>!!G),Je(1)).subscribe(G=>{G&&(this.db=G,this.getUser(),this.getDocumentPaths(),this.getLocation(),this.updateOnUserDbConnectionStateChange().subscribe(()=>{},X=>{this.loggingService.catch("Error in PresenceService constructor updateOnUserDbConnectionStateChange: ",X)}),this.updateOnDatabaseDisconnect().subscribe(()=>{},X=>{this.loggingService.catch("Error in PresenceService constructor updateOnDatabaseDisconnect: ",X)}),this.updateOnDocumentFocusChange(),this.updateOnAllowedFeatureListChange())},G=>{this.loggingService.catch("Error in PresenceService constructor: ",G)}),this.authService.addPreSignOutFuction("presence-signout",this.signOutUser.bind(this)),this.presenceUsers$.pipe(Vi()).subscribe(([G,X])=>{sessionStorage.getItem(U.SESSION_STORAGE.VELT_PRESENCE_MULTIPLE_USERS_DETECTED)||X?.length>1&&G.length!==X.length&&(this.analyticsService.trackEvent(Z.Events.Presence.PRESENCE_MULTIPLE_USERS_DETECTED,{totalUsers:X.length,presenceSnippylyUserIds:X.map(he=>he.userSnippylyId),presenceClientUserIds:X.map(he=>he.userId)}),sessionStorage.setItem(U.SESSION_STORAGE.VELT_PRESENCE_MULTIPLE_USERS_DETECTED,"true"))})}getUser(){this.loggingService.log("%c[WB] Calling FUNCTION: getUser","color: green;"),this.authService.getUser$().pipe(Ne(e=>!!e)).subscribe(e=>{e&&this.setPresenceUser(e)},e=>{this.loggingService.catch("Error in getUser: ",e)})}getDocumentPaths(){this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentPaths","color: green;"),this.docService.getDocumentPaths$().pipe(In(e=>{this.documentPaths=e}),Vi(),In(([e,i])=>{e&&this.updateUserStatusOnDocumentChange(U.PRESENCE_STATUS_OFFLINE,e),i&&this.updateUserStatusOnDocumentChange(U.PRESENCE_STATUS_ONLINE,i)})).subscribe(()=>{},e=>{this.loggingService.catch("Error in getDocumentPaths: ",e)})}getLocation(){this.docService.getLocation$().pipe(In(e=>{this.updateUserOnLocationChange(e)})).subscribe(()=>{},e=>{this.loggingService.catch("Error in getLocation: ",e)})}getPresenceUser(){return this.loggingService.log("%c[WB] Calling FUNCTION: getPresenceUser","color: green;"),this.presenceUser$.asObservable()}getOnlineUsersOnCurrentDocument(){return this.loggingService.log("%c[WB] Calling FUNCTION: getOnlineUsersOnCurrentDocument","color: green;"),Wn(this.afAuth).pipe(Ne(e=>!!e),ge(e=>this.isFeatureAllowed({firebaseUser:e,users:[],filteredUsers:[]})),ge(e=>e.featureAllowed?this.iamService.isUserAllowed$().pipe(ce(i=>(e.featureAllowed=i,e))):re(e)),ge(e=>e.featureAllowed?this.authService.isPlanExpired$().pipe(ce(i=>(e.featureAllowed=!i,e))):re(e)),ge(e=>e.featureAllowed?re(e).pipe(ge(i=>this.docService.getDocumentPaths$().pipe(ce(r=>(this.documentPaths=r,i.documentPaths=r,i)))),ge(i=>this.getDataFromDocumentId().pipe(ce(r=>(i.users=r||[],I({},i))))),ce(i=>(i.filteredUsers=this.filterOnlineUsers(i.users,i.firebaseUser),i)),ge(i=>this.getIncludeSelf$().pipe(ce(r=>(r||(i.filteredUsers=i?.filteredUsers?.filter(a=>a?.userSnippylyId!==i.user?.userSnippylyId)),i)))),ge(i=>i?.filteredUsers?re(i?.filteredUsers||[]):re([]))):re([])))}isFeatureAllowed(e){return this.configService.getConfig$().pipe(Ne(i=>!!i),ce(i=>T(I({},e),{config:i})),ge(i=>this.authService.getUser$().pipe(ce(r=>T(I({},i),{user:r})))),ge(i=>Zi(i.config,i.user,Re.PRESENCE)?re(T(I({},i),{featureAllowed:!0})):(this.loggingService.warn("Presence feature is not allowed."),re(T(I({},i),{featureAllowed:!1})))))}getDataFromDocumentId(e){return this.databaseService.getDb().pipe(Ne(i=>!!i),ge(i=>(this.db=i,this.loggingService.log(this.db),this.configService?.getApiKey()&&this.documentPaths?.presence?this.commonDbService.dbListener({feature:"allPresence",properties:{documentId:e??this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(Ln(r=>(this.loggingService.catch("Error in PresenceService getDataFromDocumentId: ",r),re(null))),ce(r=>r?.data),ce(r=>{let a=[];return r&&(a=Object.values(r).filter(s=>typeof s=="object")),a})):re([]))))}filterOnlineUsers(e,i){this.loggingService.log("%c[WB] Calling FUNCTION: filterOnlineUsers","color: green;");try{let a=e.slice().filter(s=>{let c=Sp(s.timestamp);return s.userSnippylyId&&(s.onlineStatus===U.PRESENCE_STATUS_ONLINE||s.onlineStatus===U.PRESENCE_STATUS_AWAY)&&c<this.inactivityTime});return this.presenceUsers$.next(a),a}catch(r){return this.loggingService.catch("Error in filterOnlineUsers:",r),[]}}enableIncludeSelf(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: enableIncludeSelf","color: green;"),this.includeSelf$.value===!0)return;this.includeSelf$.next(!0)}catch(e){this.loggingService.catch("Error in PresenceService enableIncludeSelf: ",e)}}disableIncludeSelf(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: disableIncludeSelf","color: green;"),this.includeSelf$.value===!1)return;this.includeSelf$.next(!1)}catch(e){this.loggingService.catch("Error in PresenceService disableIncludeSelf: ",e)}}getIncludeSelf$(){return this.includeSelf$.asObservable()}getIncludeSelf(){return this.includeSelf$.value}getPresenceUserFromExternalId(e){try{if(this.presenceUsers$.value&&this.presenceUsers$.value.length>0){let i=this.presenceUsers$.value.find(r=>r.userId===e);if(i)return i}return null}catch(i){return this.loggingService.catch("Error in getNameFromSnippylyId:",i),null}}getAnonymousAvatarImage(){return this.loggingService.log("%c[WB] Calling FUNCTION: getAnonymousAvatarImage","color: green;"),this.avatarService.generateUserImage()}updateCurrentPresenceUser(e){return ee(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: updateCurrentPresenceUser","color: green;");try{if(this.documentPaths?.presence&&e&&e.userId&&this.authService.isFeatureAllowed(Re.PRESENCE)){if(!e.isAnonymous){e.pageInfo=new Ki;let i=JSON.parse(JSON.stringify(e));this.authService.getUser()&&this.commonDbService.updateData({feature:"presence",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:e.userSnippylyId,skipFirestore:!0},data:JSON.parse(JSON.stringify(T(I({},i),{timestamp:this.timestamp})))})}this.presenceUser$.next(e)}}catch(i){this.loggingService.catch("Error in updateCurrentPresenceUser:",i)}})}setCurrentPresenceUserStatus(e){return ee(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: setCurrentPresenceUserStatus","color: green;");try{this.loggingService.log(e);let i=this.presenceUser$.value;if(i.onlineStatus!==e){this.presenceUsersSubscription&&this.presenceUsersSubscription?.unsubscribe();let r=i.onlineStatus,a=e;this.presenceUsersSubscription=this.getPresenceUsers$().pipe(Ne(s=>!!s?.length),Je(1)).subscribe(s=>{s?.length>1&&this.analyticsService.trackEvent(Z.Events.Presence.PRESENCE_USER_STATUS_CHANGED,{oldStatus:r,newStatus:a,totalUsers:s?.length,presenceSnippylyUserIds:s?.map(c=>c.userSnippylyId),presenceClientUserIds:s?.map(c=>c.userId)})})}i.onlineStatus=e,e===U.PRESENCE_STATUS_OFFLINE&&this.flockService.isInSession()&&this.flockService.removeCurrentUserFromSession(),e===U.PRESENCE_STATUS_OFFLINE&&this.liveStateService.isUserEditor()?.isEditor&&this.liveStateService.removeEditorAccess(),this.updateCurrentPresenceUser(i)}catch(i){this.loggingService.catch("Error in setCurrentPresenceUserStatus:",i)}})}updateUserStatusOnDocumentChange(e,i){return ee(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: updateUserStatusOnDocumentChange","color: green;");try{let r=this.presenceUser$.value;if(r.onlineStatus=e,i?.presence&&r&&r.userId&&!r.isAnonymous&&this.authService.isFeatureAllowed(Re.PRESENCE)){let a=JSON.parse(JSON.stringify(r));this.commonDbService.updateData({feature:"presence",properties:{documentId:i?.documentId,organizationId:i?.organizationId,userId:r.userSnippylyId,skipFirestore:!0},data:JSON.parse(JSON.stringify(a))})}}catch(r){this.loggingService.catch("Error in updateUserStatusOnDocumentChange:",r)}})}updateUserOnLocationChange(e){return ee(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: updateUserOnLocationChange","color: green;");try{let i=this.presenceUser$.value;if(i.location=e?e.location:null,i.locationId=e?e?.locationId:null,this.documentPaths?.presence&&i&&i.userId&&!i.isAnonymous&&this.authService.isFeatureAllowed(Re.PRESENCE)){let r=JSON.parse(JSON.stringify(i));this.commonDbService.updateData({feature:"presence",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:i.userSnippylyId,skipFirestore:!0},data:JSON.parse(JSON.stringify(r))})}}catch(i){this.loggingService.catch("Error in updateUserOnLocationChange:",i)}})}updateOnUserDbConnectionStateChange(){this.loggingService.log("%c[WB] Calling FUNCTION: updateOnUserDbConnectionStateChange","color: green;");let e=on(this.db,".info/connected"),i=Of(e).pipe(ce(r=>r?U.PRESENCE_STATUS_ONLINE:U.PRESENCE_STATUS_OFFLINE));return Wn(this.afAuth).pipe(xs(1),ge(r=>r?i:re(U.PRESENCE_STATUS_OFFLINE)),In(r=>this.setCurrentPresenceUserStatus(r)))}updateOnDocumentFocusChange(){this.loggingService.log("%c[WB] Calling FUNCTION: updateOnDocumentFocusChange","color: green;");try{document&&document.addEventListener("visibilitychange",e=>{this.authService.getUser()&&(document.visibilityState==="hidden"?(this.setCurrentPresenceUserStatus(U.PRESENCE_STATUS_AWAY),this.flockService.getFlockMode()&&this.flockService.setTabFocused(!1)):(this.setCurrentPresenceUserStatus(U.PRESENCE_STATUS_ONLINE),this.flockService.getFlockMode()&&this.flockService.setTabFocused(!0)))}),window&&(window.addEventListener("focus",()=>{this.authService.getUser()&&(this.setCurrentPresenceUserStatus(U.PRESENCE_STATUS_ONLINE),this.flockService.getFlockMode()&&this.flockService.setWindowFocused(!0))}),window.addEventListener("blur",()=>{this.authService.getUser()&&(document.visibilityState!=="hidden"&&this.setCurrentPresenceUserStatus(U.PRESENCE_STATUS_AWAY),this.flockService.getFlockMode()&&this.flockService.setWindowFocused(!1))}))}catch(e){this.loggingService.catch("Error in updateOnDocumentFocusChange:",e)}}updateOnAllowedFeatureListChange(){try{this.configService.getConfig$().subscribe(e=>{if(e&&e.featureAllowList?.length){let i=this.presenceUser$.value,r=!1;if(e.featureAllowList.includes(Re.PRESENCE)?i?.onlineStatus!==U.PRESENCE_STATUS_ONLINE&&(i.onlineStatus=U.PRESENCE_STATUS_ONLINE,r=!0):i?.onlineStatus!==U.PRESENCE_STATUS_OFFLINE&&(i.onlineStatus=U.PRESENCE_STATUS_OFFLINE,r=!0),r&&this.authService.getUser()&&this.documentPaths?.presence&&i&&i.userId&&!i.isAnonymous){let a=JSON.parse(JSON.stringify(i));this.commonDbService.updateData({feature:"presence",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:i.userSnippylyId,skipFirestore:!0},data:JSON.parse(JSON.stringify(a))})}}})}catch(e){this.loggingService.catch("Error in updateOnAllowedFeatureListChange:",e)}}updateOnDatabaseDisconnect(){return this.loggingService.log("%c[WB] Calling FUNCTION: updateOnDatabaseDisconnect","color: green;"),Wn(this.afAuth).pipe(Ne(e=>!!e),ge(e=>this.docService.getDocumentPaths$().pipe(ce(i=>e))),In(e=>ee(this,null,function*(){try{if(this.documentPaths?.presence&&e){let i=yield ad(e,!0).catch(a=>null);if(!i)return;let{user:r}=i.claims;if(!r?.isAnonymous){let a=on(this.db,`${this.documentPaths.presence}/${e.uid}`);this.flockService.isInSession()&&this.flockService.removeCurrentUserFromSession(),this.liveStateService.isUserEditor()?.isEditor&&this.liveStateService.removeEditorAccess(),ll(a).update({onlineStatus:U.PRESENCE_STATUS_OFFLINE,timestamp:this.timestamp}).catch(s=>{this.loggingService.catch("Error in updateOnDatabaseDisconnect:",s)})}}}catch(i){this.loggingService.catch("Error in updateOnDatabaseDisconnect:",i)}})))}setPresenceUser(e){this.loggingService.log("%c[WB] Calling FUNCTION: setPresenceUser","color: green;");try{let i=this.presenceUser$.value;i.userId=e?.userId,i.name=e?.name,i.email=e?.email,i.photoUrl=e?.photoUrl,i.userSnippylyId=e?.userSnippylyId,i.color=e?.color,i.textColor=e?.textColor,i.initial=e?.initial,i.timestamp=this.timestamp,i.type=e?.type,i.isReadOnly=e?.isReadOnly,i.isAnonymous=e?.isAnonymous;let r=e?.name?.split(" ");if(r&&r.length>0){let a=r[0],s=r.length>1?r[r.length-1]:null,c=s?s[0]:null;a&&(i.name=`${a} ${c?c+".":""}`)}this.updateCurrentPresenceUser(i)}catch(i){this.loggingService.catch("Error in setPresenceUser:",i)}}signOutUser(e){return new Promise((i,r)=>{try{this.documentPaths?.presence&&e?this.commonDbService.dbListener({feature:"presence",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:e.uid,skipFirestore:!0}}).pipe(Je(1)).subscribe(a=>{a?.data?(this.flockService.isInSession()&&this.flockService.removeCurrentUserFromSession(),this.liveStateService.isUserEditor()?.isEditor&&this.liveStateService.removeEditorAccess(),this.commonDbService.updateData({feature:"presence",errorCallback:s=>{r(s)},callback:()=>{i(null)},properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:e.uid,skipFirestore:!0},data:JSON.parse(JSON.stringify(T(I({},a?.data??{}),{timestamp:this.timestamp,onlineStatus:U.PRESENCE_STATUS_OFFLINE})))})):i(null)},a=>{this.loggingService.catch("Error in signOutUser subscription: ",a),r(a)}):i(null)}catch(a){this.loggingService.catch("Error in signOutUser:",a),r(a)}})}setInactivityTime(e){this.inactivityTime=e,this.analyticsService.trackEvent(Z.Events.Presence.PRESENCE_SET_CUSTOM_INACTIVITY_TIMER,{inactivityTime:this.inactivityTime})}getPresenceUsers$(){return this.presenceUsers$.asObservable()}getPresenceUsers(){return this.presenceUsers$.value}get timestamp(){return this.commonDbService.getServerTimestamp()}};o.\u0275fac=function(i){return new(i||o)(J(Qe),J(lt),J(je),J(vi),J(gn),J(pn),J($t),J(gm),J(y),J(vc),J(Di),J(bn))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var qv=(()=>{let o=class o{constructor(e,i,r,a,s,c,p,h,_,E,A){this.analyticsService=e,this.configService=i,this.presenceService=r,this.docService=a,this.afAuth=s,this.iamService=c,this.domService=p,this.databaseService=h,this.authService=_,this.loggingService=E,this.commonDbService=A,this.db=Af(),this.cursorUser$=new fe(new Lv),this.documentPaths=null,this.inactivityTime=2*60*1e3,this.allowedElementIds$=new fe([]),this.cursorTagAvailable$=new fe(!1),this.cursorTagAvailable=!1,this.cursorUsers$=new fe([]),this.loggingService.log("%c[WB] Creating CLASS: CursorService","color: blue;");try{this.checkCursorTagAvailable(),this.databaseService.getDb().pipe(Ne(V=>!!V),ge(V=>this.cursorTagAvailable$.pipe(Ne(G=>!!G),Je(1),ce(()=>V))),Je(1)).subscribe(V=>{V&&(this.db=V,this.cursorTagAvailable&&(this.getPresenceUser(),this.getDocumentPaths(),this.getLocation(),this.updateOnDatabaseDisconnect().subscribe(()=>{},G=>{this.loggingService.catch("Error in CursorService constructor updateOnDatabaseDisconnect: ",G)}),this.addMouseMoveListener(),this.addScreenSizeChangeListener(),this.updateOnAllowedFeatureListChange()))},V=>{this.loggingService.catch("Error in CursorService constructor getDb: ",V)}),this.cursorUsers$.pipe(Vi()).subscribe(([V,G])=>{sessionStorage.getItem(U.SESSION_STORAGE.VELT_CURSOR_MULTIPLE_USERS_DETECTED)||G?.length>1&&V.length!==G.length&&(this.analyticsService.trackEvent(Z.Events.Cursor.CURSOR_MULTIPLE_USERS_DETECTED,{totalUsers:G.length,cursorSnippylyUserIds:G.map(X=>X.userSnippylyId),cursorClientUserIds:G.map(X=>X.userId)}),sessionStorage.setItem(U.SESSION_STORAGE.VELT_CURSOR_MULTIPLE_USERS_DETECTED,"true"))}),this.authService.addPreSignOutFuction("cursor-signout",this.signOutUser.bind(this))}catch(V){this.loggingService.catch("Error in CursorService constructor: ",V)}}checkCursorTagAvailable(){this.loggingService.log("%c[WB] Calling FUNCTION: checkCursorTagAvailable","color: green;");try{this.cursorTagAvailable=!!document.querySelector(U.TAGS.VELT_CURSOR)||!!document.querySelector(U.TAGS.SNIPPYLY_CURSOR),this.cursorTagAvailable$.next(this.cursorTagAvailable)}catch(e){this.loggingService.catch("Error in CursorService checkCursorTagAvailable: ",e)}}addScreenSizeChangeListener(){this.loggingService.log("%c[WB] Calling FUNCTION: addScreenSizeChangeListener","color: green;");try{this.docService.getDocumentPaths$().pipe(Ne(e=>!!e),ge(e=>this.domService.getCurrentWindowSize$("CursorService addScreenSizeChangeListener").pipe(Ne(i=>!!i)))).subscribe(e=>{this.setCurrentCursorUserScreenSize(e)},e=>{this.loggingService.catch("Error in addScreenSizeChangeListener getCurrentWindowSize: ",e)})}catch(e){this.loggingService.catch("Error in CursorService addScreenSizeChangeListener: ",e)}}addMouseMoveListener(){this.loggingService.log("%c[WB] Calling FUNCTION: addMouseMoveListener","color: green;");try{this.domService.onWindowPointerMove$().pipe(t7(50)).subscribe(e=>{e&&this.setCurrentCursorUserPosition(e.pageX,e.pageY,this.domService.getTargetElementForCursorPosition(e,!0,!1,!1))},e=>{this.loggingService.catch("Error in addMouseMoveListener getCurrentMousePosition: ",e)})}catch(e){this.loggingService.catch("Error in CursorService addMouseMoveListener: ",e)}}getDocumentPaths(){this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentPaths","color: green;");try{this.docService.getDocumentPaths$().pipe(In(e=>{this.documentPaths=e}),Vi(),In(([e,i])=>{e&&this.updateUserStatusOnDocumentChange(U.PRESENCE_STATUS_OFFLINE,e),i&&this.updateUserStatusOnDocumentChange(U.PRESENCE_STATUS_ONLINE,i)})).subscribe(()=>{},e=>{this.loggingService.catch("Error in getDocumentPaths subscription: ",e)})}catch(e){this.loggingService.catch("Error in CursorService getDocumentPaths: ",e)}}getLocation(){try{this.docService.getLocation$().pipe(In(e=>{this.updateUserOnLocationChange(e)})).subscribe(()=>{},e=>{this.loggingService.catch("Error in getLocation subscription: ",e)})}catch(e){this.loggingService.catch("Error in CursorService getLocation: ",e)}}getCursorUser(){return this.loggingService.log("%c[WB] Calling FUNCTION: getCursorUser","color: green;"),this.cursorUser$.asObservable()}getPresenceUser(){this.loggingService.log("%c[WB] Calling FUNCTION: getPresenceUser","color: green;"),this.presenceService.getPresenceUser().pipe(Ne(e=>!!e),Ln(e=>re(e.code))).subscribe(e=>{this.setCursorUser(e)},e=>{this.loggingService.catch("Error in getPresenceUser: ",e)})}getLiveCursorsOnCurrentDocument(){return this.loggingService.log("%c[WB] Calling FUNCTION: getLiveCursorsOnCurrentDocument","color: green;"),Wn(this.afAuth).pipe(Ne(e=>!!e),ge(e=>this.isFeatureAllowed({firebaseUser:e,users:[],filteredUsers:[]})),ge(e=>e.featureAllowed?this.iamService.isUserAllowed$().pipe(ce(i=>(e.featureAllowed=i,e))):re(e)),ge(e=>e.featureAllowed?this.authService.isPlanExpired$().pipe(ce(i=>(e.featureAllowed=!i,e))):re(e)),ge(e=>!e.featureAllowed||e?.user?.isAnonymous?re([]):re(e).pipe(ge(i=>this.docService.getDocumentPaths$().pipe(ce(r=>(this.documentPaths=r,i.documentPaths=r,i)))),ge(i=>this.getDataFromDocumentId().pipe(ce(r=>(i.users=r||[],I({},i))))),ce(i=>(i.filteredUsers=this.filterOnlineUsers(i.users,i.firebaseUser),i)),ge(i=>i?.filteredUsers?.length?this.domService.getCurrentWindowSize$("CursorService getLiveCursorsOnCurrentDocument").pipe(ce(()=>i)):re(i)),ce(i=>(i?.filteredUsers?.forEach(r=>{this.calculateCursorUserPosition(r)}),i)),ge(i=>i?.filteredUsers?re(i?.filteredUsers||[]):re([])))))}isFeatureAllowed(e){return this.configService.getConfig$().pipe(Ne(i=>!!i),ce(i=>T(I({},e),{config:i})),ge(i=>this.authService.getUser$().pipe(ce(r=>T(I({},i),{user:r})))),ge(i=>Zi(i.config,i.user,Re.CURSOR)?re(T(I({},i),{featureAllowed:!0})):(this.loggingService.warn("Cursor feature is not allowed."),re(T(I({},i),{featureAllowed:!1})))))}getDataFromDocumentId(e){return this.databaseService.getDb().pipe(Ne(i=>!!i),ge(i=>(this.db=i,this.loggingService.log(this.db),this.configService?.getApiKey()&&this.documentPaths?.cursor?this.commonDbService.dbListener({feature:"allCursors",properties:{documentId:e??this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(Ln(r=>(this.loggingService.catch("Error in CursorService getDataFromDocumentId: ",r),re(null))),ce(r=>r?.data),ce(r=>{let a=[];return r&&(a=Object.values(r).filter(s=>typeof s=="object")),a})):re([]))))}calculateCursorUserPosition(e){try{if(e?.targetElement){let i=this.domService.getXPath(e.targetElement?.xpath);if(i){let r=i.iterateNext();if(r&&this.isElementInsideAllowedElements(r)){let a=r.getBoundingClientRect();a&&a.width&&a.height&&(e.position={top:a.top+a.height*e.targetElement.topPercentage/100,left:a.left+a.width*e.targetElement.leftPercentage/100})}}}}catch(i){this.loggingService.catch("Error in calculateCursorUserPosition:",i)}}filterOnlineUsers(e,i){try{let a=e.slice().filter(c=>{let p=Sp(c.timestamp);return c.userSnippylyId&&c.onlineStatus===U.PRESENCE_STATUS_ONLINE&&p<this.inactivityTime});this.cursorUsers$.next(a),a=a.filter(c=>c?.userSnippylyId!==i?.uid);let s=this.docService.getLocation();return s&&s.locationId?a=a.filter(c=>c.locationId===s.locationId):a=a.filter(c=>!c.locationId),a}catch(r){return this.loggingService.catch("Error in filterOnlineUsers:",r),[]}}setCursorUser(e){this.loggingService.log("%c[WB] Calling FUNCTION: setCursorUser","color: green;");try{let i=this.cursorUser$.value;i.userId=e?.userId,i.name=e?.name,i.email=e?.email,i.photoUrl=e?.photoUrl,i.comment="",this.authService.isFeatureAllowed(Re.PRESENCE)&&(i.onlineStatus=e?.onlineStatus),i.userSnippylyId=e?.userSnippylyId,i.color=e?.color,i.textColor=e?.textColor,i.initial=e?.initial,i.timestamp=this.timestamp,i.type=e?.type,i.isReadOnly=e?.isReadOnly,i.isAnonymous=e?.isAnonymous;let r=this.domService.getCurrentWindowSizeValue();i.screenWidth=r?.screenWidth,i.screenHeight=r?.screenHeight,i.screenScrollHeight=r?.screenScrollHeight,this.updateCurrentCursorUser(i)}catch(i){this.loggingService.catch("Error in setCursorUser:",i)}}setCurrentCursorUserPosition(e,i,r){try{let a=this.cursorUser$.value;a?.onlineStatus===U.PRESENCE_STATUS_ONLINE&&(a.positionX=e,a.positionY=i,r?a.targetElement=r:a.targetElement=null,this.updateCurrentCursorUser(a))}catch(a){this.loggingService.catch("Error in setCurrentCursorUserPosition:",a)}}setCurrentCursorUserScreenSize(e){try{if(e.screenWidth!==0&&e.screenHeight!==0){let i=this.cursorUser$.value;i?.onlineStatus===U.PRESENCE_STATUS_ONLINE&&(i.screenWidth=e.screenWidth,i.screenHeight=e.screenHeight,i.screenScrollHeight=e.screenScrollHeight,this.updateCurrentCursorUser(i))}}catch(i){this.loggingService.catch("Error in setCurrentCursorUserScreenSize:",i)}}updateCurrentCursorUser(e){return ee(this,null,function*(){try{if(this.documentPaths&&e&&e.userId&&this.authService.isFeatureAllowed(Re.CURSOR)){if(!e.isAnonymous){e.pageInfo=new Ki;let i=JSON.parse(JSON.stringify(e));this.commonDbService.updateData({feature:"cursor",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:e.userSnippylyId,skipFirestore:!0},data:JSON.parse(JSON.stringify(T(I({},i),{timestamp:this.timestamp})))})}this.cursorUser$.next(e)}}catch(i){this.loggingService.catch("Error in updateCurrentCursorUser:",i)}})}updateUserStatusOnDocumentChange(e,i){return ee(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: updateUserStatusOnDocumentChange","color: green;");try{let r=this.cursorUser$.value;if(r.onlineStatus=e,i&&r&&r.userId&&!r.isAnonymous&&this.authService.isFeatureAllowed(Re.CURSOR)){let a=JSON.parse(JSON.stringify(r));this.commonDbService.updateData({feature:"cursor",properties:{documentId:i?.documentId??"",organizationId:i?.organizationId??"",id:r.userSnippylyId,skipFirestore:!0},data:JSON.parse(JSON.stringify(T(I({},a),{timestamp:this.timestamp})))})}}catch(r){this.loggingService.catch("Error in updateUserStatusOnDocumentChange:",r)}})}updateUserOnLocationChange(e){return ee(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: updateUserOnLocationChange","color: green;");try{let i=this.cursorUser$.value;if(i.location=e?e.location:null,i.locationId=e?e?.locationId:null,this.documentPaths&&i&&i.userId&&!i.isAnonymous&&this.authService.isFeatureAllowed(Re.CURSOR)){let r=JSON.parse(JSON.stringify(i));this.commonDbService.updateData({feature:"cursor",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:i.userSnippylyId,skipFirestore:!0},data:JSON.parse(JSON.stringify(T(I({},r),{timestamp:this.timestamp})))})}}catch(i){this.loggingService.catch("Error in updateUserOnLocationChange:",i)}})}updateOnAllowedFeatureListChange(){try{this.configService.getConfig$().subscribe(e=>{if(e&&e.featureAllowList?.length){let i=this.cursorUser$.value,r=!1;if(e.featureAllowList.includes(Re.CURSOR)?i?.onlineStatus!==U.PRESENCE_STATUS_ONLINE&&(i.onlineStatus=U.PRESENCE_STATUS_ONLINE,r=!0):i?.onlineStatus!==U.PRESENCE_STATUS_OFFLINE&&(i.onlineStatus=U.PRESENCE_STATUS_OFFLINE,r=!0),r&&this.documentPaths&&i&&i.userId&&!i.isAnonymous){let a=JSON.parse(JSON.stringify(i));this.commonDbService.updateData({feature:"cursor",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:i.userSnippylyId,skipFirestore:!0},data:JSON.parse(JSON.stringify(T(I({},a),{timestamp:this.timestamp})))})}}})}catch(e){this.loggingService.catch("Error in updateOnAllowedFeatureListChange:",e)}}updateOnDatabaseDisconnect(){return this.loggingService.log("%c[WB] Calling FUNCTION: updateOnDatabaseDisconnect","color: green;"),Wn(this.afAuth).pipe(Ne(e=>!!e),ge(e=>this.docService.getDocumentPaths$().pipe(ce(i=>e))),In(e=>ee(this,null,function*(){try{if(this.documentPaths&&e){let i=yield ad(e,!0).catch(a=>null);if(!i)return;let{user:r}=i.claims;if(!r?.isAnonymous){let a=on(this.db,`${this.documentPaths.cursor}/${e.uid}`);ll(a).update({onlineStatus:U.PRESENCE_STATUS_OFFLINE,comment:"",timestamp:this.timestamp}).catch(s=>{this.loggingService.catch("Error in updateOnDatabaseDisconnect:",s)})}}}catch(i){this.loggingService.catch("Error in updateOnDatabaseDisconnect:",i)}})))}signOutUser(e){return new Promise((i,r)=>{try{this.documentPaths&&e?this.commonDbService.dbListener({feature:"cursor",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,id:e.uid,skipFirestore:!0}}).pipe(Je(1)).subscribe(a=>{a?.data?this.commonDbService.updateData({feature:"cursor",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:e.uid,skipFirestore:!0},callback:()=>{i(null)},data:JSON.parse(JSON.stringify(T(I({},a?.data??{}),{timestamp:this.timestamp,onlineStatus:U.PRESENCE_STATUS_OFFLINE})))}):i(null)},a=>{this.loggingService.catch("Error in signOutUser subscription: ",a),r(a)}):i(null)}catch(a){this.loggingService.catch("Error in signOutUser:",a),r(a)}})}setInactivityTime(e){this.inactivityTime=e,this.analyticsService.trackEvent(Z.Events.Cursor.CURSOR_SET_CUSTOM_INACTIVITY_TIMER,{inactivityTime:this.inactivityTime})}setAllowedElementIds(e){this.allowedElementIds$.next(e||[])}getAllowedElementIds(){return this.allowedElementIds$.asObservable()}isElementInsideAllowedElements(e){try{return this.domService.isElementInsideListedElementIds(e,this.allowedElementIds$.value)}catch(i){return this.loggingService.catch("Error in CursorService isElementInsideAllowedElements: ",i),!1}}get timestamp(){return this.commonDbService.getServerTimestamp()}};o.\u0275fac=function(i){return new(i||o)(J(Qe),J($t),J(Cm),J(lt),J(vi),J(gn),J(Fe),J(pn),J(je),J(y),J(bn))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var HM=class extends li{constructor(o){super(o),this.getService(y).log("%c[WB] Creating CLASS: CursorElement","color: blue;"),this.getLiveCursorsOnCurrentDocument=this._getOnlineUsersOnCurrentDocument,this.getOnlineUsersOnCurrentDocument=this._getOnlineUsersOnCurrentDocument,this.setInactivityTime=this._setInactivityTime,this.allowedElementIds=this._allowedElementIds}_getOnlineUsersOnCurrentDocument(){this.getService(y).log("%c[WB] Calling FUNCTION: getOnlineUsersOnCurrentDocument","color: green;");try{return this.trackEvent(Z.Events.Cursor.GET_LIVE_CURSORS_ON_CURRENT_DOCUMENT_TRIGGERED),this.getService(qv).getLiveCursorsOnCurrentDocument()}catch(o){return this.getService(y).catch("Error in _getOnlineUsersOnCurrentDocument: ",o),re(null)}}_setInactivityTime(o){this.getService(y).log("%c[WB] Calling FUNCTION: _setInactivityTime","color: green;");try{this.trackEvent(Z.Events.Cursor.SET_INACTIVITY_TIME_TRIGGERED,{payload:{time:o}}),isNaN(o)?this.getService(y).catch("Error in setInactivityTime: ","Provided value is not a number."):this.getService(qv).setInactivityTime(o)}catch(t){this.getService(y).catch("Error in setInactivityTime: ",t)}}_allowedElementIds(o){this.getService(y).log("%c[WB] Calling FUNCTION: allowedElementIds","color: green;");try{this.trackEvent(Z.Events.Cursor.ALLOWED_ELEMENT_IDS_TRIGGERED,{payload:{elementIds:o}}),this.getService(qv).setAllowedElementIds(o)}catch(t){this.getService(y).catch("Error in allowedElementIds: ",t)}}};var zM=class extends li{constructor(o){super(o),this.getService(y).log("%c[WB] Creating CLASS: DocElement","color: blue;"),this.getDocumentMetadata=this._getDocumentMetadata}_getDocumentMetadata(){this.getService(y).log("%c[WB] Calling FUNCTION: getDocumentMetadata","color: green;");try{return this.trackEvent(Z.Events.Doc.GET_DOCUMENT_METADATA_TRIGGERED),this.getService(lt).getDocumentMetadata$()}catch(o){return this.getService(y).catch("Error in getDocumentMetadata: ",o),re(null)}}};var mr=(()=>{let o=class o{constructor(e,i,r,a,s,c,p,h,_,E,A,V,G){this.afAuth=e,this.analyticsService=i,this.authService=r,this.databaseService=a,this.docService=s,this.configService=c,this.domService=p,this.huddleUtilsService=h,this.functions=_,this.loggingService=E,this.notificationService=A,this.commonDbService=V,this.usersService=G,this.documentPaths=null,this.localStream$=new fe(null),this.peerConnectionMap={},this.localStream=new MediaStream,this.screenSharingStream=new MediaStream,this.screenSharingStream$=new fe(null),this.remoteStreamMap={},this.remoteStreamMap$=new fe(null),this.localStreamState$=new fe({}),this.peerConnectionStateMap={},this.peerConnectionStateMap$=new fe({}),this.hudleToolComponentId$=new fe(null),this.attendees$=new fe([]),this.invitees$=new fe([]),this.huddleJoined$=new fe(!1),this.userHuddleStartTime$=new fe(null),this.messages$=new fe([]),this.messagesPanelVisible$=new fe(!1),this.huddleOnCursorMode$=new fe(!1),this.flockModeOnAvatarClickEnabled$=new fe(!1),this.chatEnabled$=new fe(!0),this.huddleOnCursorModeByAttendeeId$=new fe({}),this.huddleCursorAvailableByAttendeeId$=new fe({}),this.remoteStreamsByUserId$=new fe({}),this.messagesSubscription=null,this.huddleJoined=!1,this.onAnswerConnectionIdHistory={},this.onOfferUidHistory={},this.senders={},this.db=Ci(),this.dbRefsRemoveOnDropCall=[],this.servers={iceServers:[{urls:["stun:stun1.l.google.com:19302","stun:stun2.l.google.com:19302"]}]},this.databaseService.getDb().pipe(Ne(X=>!!X),Je(1)).subscribe(X=>{try{X&&(this.db=X,this.isHuddleTagInstalled()&&(sessionStorage.getItem("skipTwilioIceServers")||this.getTwilioIceServers()),this.getUser(),this.getDocumentPaths())}catch(he){this.loggingService.catch("Error in HuddleService getDb:",he)}},X=>{this.loggingService.catch("Error in HuddleService getDb subscription: ",X)}),this.docService.addPreDocumentIdChangeFunction("huddle-service",X=>ee(this,null,function*(){this.huddleJoined$.value&&(yield this.dropCall(),yield this.removeLocalStream(),yield this.removeAttendee(),this.attendees$.next([]))})),this.getAttendees().subscribe(),this.getInvitees().subscribe(),this.localStream$.subscribe(X=>{X&&(this.localStream=X)}),this.screenSharingStream$.subscribe(X=>{X&&(this.screenSharingStream=X)}),this.configService.getConfig$().subscribe(X=>{try{!X?.featureAllowList?.find(Ie=>Ie===Re.CURSOR)&&this.huddleOnCursorMode$.next(!1)}catch(he){this.loggingService.catch("Error in HuddleService configService.getConfig$:",he)}},X=>{this.loggingService.catch("Error in HuddleService configService.getConfig$ subscription: ",X)}),this.attendees$.subscribe(X=>{try{if(X?.length){if(this.huddleOnCursorMode$?.value){let he=this.huddleOnCursorModeByAttendeeId$.getValue()||{};X.forEach(Ie=>{he[Ie.userSnippylyId]=!0}),this.huddleOnCursorModeByAttendeeId$.next(he)}this.huddleJoined$?.value&&(X?.find(he=>he?.huddleOnCursorMode)?this.addCursorTag():this.removeCursorTag())}}catch(he){this.loggingService.catch("Error in HuddleService attendees$:",he)}},X=>{this.loggingService.catch("Error in HuddleService attendees$ subscription: ",X)}),Dn([this.huddleJoined$,this.huddleOnCursorMode$]).subscribe(([X,he])=>{try{if(X){if(he){let Ie=this.attendees$.getValue()||[],Pe=this.huddleOnCursorModeByAttendeeId$.getValue()||{};Ie.forEach(Be=>{Pe[Be.userSnippylyId]=!0}),document?.body?.setAttribute(U.ATTRIBUTES.VELT_HUDDLE_ON_CURSOR_MODE,"true")}else this.huddleOnCursorModeByAttendeeId$.next({}),document?.body?.removeAttribute(U.ATTRIBUTES.VELT_HUDDLE_ON_CURSOR_MODE);this.updateHuddleOnCursorMode()}else this.removeCursorTag(),document?.body?.removeAttribute(U.ATTRIBUTES.VELT_HUDDLE_ON_CURSOR_MODE)}catch(Ie){this.loggingService.catch("Error in HuddleService huddleJoined$:",Ie)}},X=>{this.loggingService.catch("Error in HuddleService huddleJoined$ subscription: ",X)}),this.huddleOnCursorModeByAttendeeId$.subscribe(X=>{try{this.huddleJoined&&(Object.keys(X).length?this.addCursorTag():this.removeCursorTag())}catch(he){this.loggingService.catch("Error in HuddleService huddleOnCursorModeByAttendeeId$:",he)}},X=>{this.loggingService.catch("Error in HuddleService huddleOnCursorModeByAttendeeId$ subscription: ",X)}),this.authService.addPreSignOutFuction("huddle-signout",this.signOutUser.bind(this))}isHuddleTagInstalled(){try{return!!document?.querySelector(`${U.TAGS.VELT_HUDDLE}`)||!!document?.querySelector(`${U.TAGS.SNIPPYLY_HUDDLE}`)}catch(e){return this.loggingService.catch("Error in HuddleService isHuddleTagInstalled:",e),!1}}getTwilioIceServers(){return ee(this,null,function*(){try{let i=(yield Cr(this.functions,Zn.cloudFunction.getIceServers,{timeout:12e5})())?.data;i&&i?.iceServers&&(this.servers.iceServers=i.iceServers)}catch(e){this.loggingService.catch("Error in HuddleService getTwilioIceServers:",e)}})}getRemoteStream(){return this.loggingService.log("%c[WB] Calling FUNCTION: getRemoteStream","color: green;"),this.remoteStreamMap$.asObservable()}getPeerConnectionStateMap(){return this.loggingService.log("%c[WB] Calling FUNCTION: getPeerConnectionStateMap","color: green;"),this.peerConnectionStateMap$.asObservable()}getLocalStreamState(){return this.loggingService.log("%c[WB] Calling FUNCTION: getLocalStreamState","color: green;"),this.localStreamState$.asObservable()}getScreenSharingStream(){return this.loggingService.log("%c[WB] Calling FUNCTION: getScreenSharingStream","color: green;"),this.screenSharingStream$.asObservable()}getAttendees(){return Wn(this.afAuth).pipe(Ne(e=>!!e),ce(e=>({firebaseUser:e})),ge(e=>this.configService.getConfig$().pipe(Ne(i=>!!i),ce(i=>T(I({},e),{config:i})))),ge(e=>this.authService.getUser$().pipe(ce(i=>T(I({},e),{user:i})))),ge(e=>Zi(e.config,e.user,Re.HUDDLE)?re(T(I({},e),{allowed:!0})):(this.loggingService.warn("Huddle feature is not allowed."),re(T(I({},e),{allowed:!1})))),ge(e=>this.docService.getDocumentPaths$().pipe(ce(i=>(this.documentPaths=i,e)))),ge(e=>e?.allowed?e?.user?.isAnonymous?re(null):this.documentPaths?.huddle?this.commonDbService.dbListener({feature:"allHuddleAttendees",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(ce(i=>i?.data),ce(i=>i?(this.attendees$.next(Object.values(i)),Object.values(i)):(this.attendees$.next([]),null))):re(null):re([])))}getInvitees(){try{return Wn(this.afAuth).pipe(Ne(e=>!!e),ce(e=>({firebaseUser:e})),ge(e=>this.configService.getConfig$().pipe(Ne(i=>!!i),ce(i=>T(I({},e),{config:i})))),ge(e=>this.authService.getUser$().pipe(ce(i=>T(I({},e),{user:i})))),ge(e=>Zi(e.config,e.user,Re.HUDDLE)?re(T(I({},e),{allowed:!0})):(this.loggingService.warn("Huddle feature is not allowed."),re(T(I({},e),{allowed:!1})))),ge(e=>this.docService.getDocumentPaths$().pipe(ce(i=>(this.documentPaths=i,e)))),ge(e=>e?.allowed?e?.user?.isAnonymous?re(null):this.documentPaths?.huddle?this.commonDbService.dbListener({feature:"allHuddleInvitees",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(ce(i=>i?.data),ce(i=>i?(this.invitees$.next(Object.values(i)),Object.values(i)):(this.invitees$.next([]),null))):re(null):re([])))}catch(e){return this.loggingService.catch("Error in HuddleService getInvitees:",e),re([])}}clearHuddleInvitees(){try{this.documentPaths?.huddle&&this.commonDbService.deleteData({feature:"allHuddleInvitees",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}})}catch(e){this.loggingService.catch("Error in HuddleService clearHuddleInvitees:",e)}}getUser(){this.loggingService.log("%c[WB] Calling FUNCTION: getUser","color: green;"),this.authService.getUser$().pipe(Ne(e=>!!e)).subscribe(e=>{e&&(this.user=e)},e=>{this.loggingService.catch("Error in getUser: ",e)})}getDocumentPaths(){this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentPaths","color: green;"),this.docService.getDocumentPaths$().pipe(In(e=>{this.documentPaths=e})).subscribe(()=>{},e=>{this.loggingService.catch("Error in getDocumentPaths: ",e)})}setHuddleToolComponentId(e){this.hudleToolComponentId$.next(e||null)}getHuddleToolComponentId(){return this.hudleToolComponentId$.asObservable()}joinHuddle(e){return ee(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: joinHuddle","color: green;"),this.documentPaths?.huddle?(this.initialHuddleType=e,this.huddleJoined=!0,this.huddleJoined$.next(!0),this.initLocalStreams(),this.huddle=on(this.db,this.documentPaths?.huddle),this.iceCandidates=on(this.db,`${this.documentPaths?.huddle}/iceCandidates`),this.connections=on(this.db,`${this.documentPaths?.huddle}/connections`),this.attendees=on(this.db,`${this.documentPaths?.huddle}/attendees`),this.messages=on(this.db,`${this.documentPaths?.huddle}/messages`),this.setHuddleListener(),this.addAttendee(),this.callExistingAttendees(),this.userHuddleStartTime$.next(new Date().getTime())):this.loggingService.catch("Error in joinHuddle: documentPaths not found")}catch(i){this.loggingService.catch("Error in HuddleService joinHuddle:",i)}})}initLocalStreams(){try{if(!this.localStream$?.value?.getTracks()?.length){let e=new MediaStream([this.silence(),this.black()]);this.localStream$.next(e)}if(!this.screenSharingStream$?.value?.getTracks()?.length){let e=new MediaStream([this.black()]);this.screenSharingStream$.next(e)}}catch(e){this.loggingService.catch("Error in HuddleService initLocalStreams:",e)}}setHuddleListener(){this.loggingService.log("%c[WB] Calling FUNCTION: setHuddleListener","color: green;"),gu(this.connections,e=>{try{if(e.exists()){let i=e.val();Object.values(i).forEach(a=>{let s=Object.values(a);if(s&&s.length>0){let p=s[0]?.connectionId;this.onHuddleSnapshot(p,a)}}),Object.keys(this.remoteStreamMap).forEach(a=>ee(this,null,function*(){i[a]||(this.remoteStreamMap[a]&&Object.values(this.remoteStreamMap[a]).forEach(s=>{s.getTracks().forEach(c=>{c.stop()})}),delete this.remoteStreamMap[a],yield this.removeIceCandidates(a))})),this.remoteStreamMap$.next(this.remoteStreamMap)}else Object.keys(this.remoteStreamMap).forEach(i=>ee(this,null,function*(){Object.values(this.remoteStreamMap[i]).forEach(r=>{r.getTracks().forEach(a=>{a.stop()})}),yield this.removeIceCandidates(i)})),this.remoteStreamMap={},this.remoteStreamMap$.next(this.remoteStreamMap)}catch(i){this.loggingService.catch("Error in HuddleService setHuddleLister onValue:",i)}}),SL(this.iceCandidates).subscribe(e=>{try{e.event==="child_added"&&this.onIceCandidateSnapshot(e.snapshot)}catch(i){this.loggingService.catch("Error in HuddleService iceCandidates stateChanges:",i)}}),SL(this.attendees).subscribe(e=>{try{if(e.event==="child_removed"){let i=e?.snapshot?.val();if(i){delete this.onOfferUidHistory[i?.userSnippylyId];let r=this.getCombinedId(this.user.userSnippylyId,i?.userSnippylyId);delete this.onAnswerConnectionIdHistory[r],this.closeConnection(r)}}}catch(i){this.loggingService.catch("Error in HuddleService iceCandidates stateChanges:",i)}}),this.messagesSubscription&&this.messagesSubscription.unsubscribe(),this.messagesSubscription=new Ft(e=>{let i=gu(this.messages,r=>e.next(r),r=>e.error(r));return()=>i()}).pipe(ge(e=>this.usersService.getUserById$().pipe(ce(()=>e))),ge(e=>{if(e.exists()){let i=e.val();return bo(this.huddleUtilsService.resolveUsersFromHuddleMessages(Object.values(i||{})))}return re([])}),Ln(e=>(this.loggingService.catch("Error in HuddleService messages onValue:",e),re([])))).subscribe(e=>{this.messages$.next(e)})}onHuddleSnapshot(e,i){try{this.loggingService.log("%c[WB] Calling FUNCTION: onHuddleSnapshot","color: green;"),i.offerData&&!i.answerData&&i.offerData.from!==this.user.userSnippylyId&&i.offerData.to===this.user.userSnippylyId&&!(e in this.peerConnectionMap)&&!this.onOfferUidHistory[i.offerData.from]?(this.loggingService.log("offer received"),this.loggingService.log(i),this.onOfferUidHistory[i.offerData.from]=!0,this.onOffer(e,i.offerData)):i.answerData&&i.answerData.from!==this.user.userSnippylyId&&i.answerData.to===this.user.userSnippylyId&&this.peerConnectionMap[e]&&this.peerConnectionMap[e]?.connectionState!=="connected"&&!this.onAnswerConnectionIdHistory[e]&&(this.loggingService.log("answer received"),this.loggingService.log(i),this.onAnswerConnectionIdHistory[e]=!0,this.onAnswer(e,i.answerData))}catch(r){this.loggingService.catch("Error in HuddleService onHuddleSnapshot:",r)}}onIceCandidateSnapshot(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: onIceCandidateSnapshot","color: green;"),this.loggingService.log("ice candidate received");let i=e.val(),r=i.connectionId;i?.from!==this.user.userSnippylyId&&r in this.peerConnectionMap&&this.onIceCandidateChange(r,i)}catch(i){this.loggingService.catch("Error in HuddleService onIceCandidateSnapshot:",i)}}onOffer(e,i){return ee(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: onOffer","color: green;"),this.createPeerConnection(e,i.from)){this.addLocalStreamToPeerConnection(e,!0);let a=i.offer;yield this.setRemoteDescription(e,a),yield this.sendAnswer(e,i.from)}}catch(r){this.loggingService.catch("Error in HuddleService onOffer:",r)}})}sendAnswer(e,i){return ee(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: sendAnswer","color: green;"),this.loggingService.log(e),this.documentPaths?.huddle&&e){let r=yield this.peerConnectionMap[e].createAnswer();yield this.setLocalDescription(e,r);let s={answer:{type:r.type,sdp:r.sdp},from:this.user.userSnippylyId,connectionId:e,to:i},c=on(this.db,`${this.documentPaths?.huddle}/connections/${e}`);this.dbRefsRemoveOnDropCall.push({type:"connection",dbRef:c}),yield jA(c,{answerData:s}),ll(c).remove()}else this.loggingService.catch("Error in sendAnswer: documentPaths not found")}catch(r){this.loggingService.catch("Error in HuddleService onHuddleSnapshot:",r)}})}onAnswer(e,i){return ee(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: onAnswer","color: green;");let r=i.answer;yield this.setRemoteDescription(e,r)}catch(r){this.loggingService.catch("Error in HuddleService onAnswer:",r)}})}onIceCandidateChange(e,i){return ee(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: onIceCandidateChange","color: green;");let r=i.candidate;this.loggingService.log("onIceCandidateChange",r),yield this.peerConnectionMap[e].addIceCandidate(new RTCIceCandidate(r))}catch(r){this.loggingService.catch("Error in HuddleService onIceCandidateChange:",r)}})}setRemoteDescription(e,i){return ee(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: setRemoteDescription","color: green;"),yield this.peerConnectionMap[e].setRemoteDescription(new RTCSessionDescription(i))}catch(r){this.loggingService.catch("Error in HuddleService setRemoteDescription:",r)}})}addAttendee(){return ee(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: addAttendee","color: green;"),this.documentPaths?.huddle&&this.user?.userSnippylyId){let e=T(I({},this.user),{timestamp:this.timestamp,streamMetadata:{webcam:this.localStream?.id,screen:this.screenSharingStream?.id},initialHuddleType:this.initialHuddleType,huddleOnCursorMode:this.huddleOnCursorMode$?.value});e=this.huddleUtilsService.formatHuddleAttendeeData(e);let i=on(this.db,`${this.documentPaths?.huddle}/attendees/${this.user.userSnippylyId}`);yield Mf(i,JSON.parse(JSON.stringify(e))),this.dbRefsRemoveOnDropCall.push({type:"attendee",dbRef:i}),ll(i).remove(),yield this.updateUserHuddleState()}else this.loggingService.catch("Error in addAttendee: documentPaths not found")}catch(e){this.loggingService.catch("Error in HuddleService addAttendee:",e)}})}callExistingAttendees(){try{this.loggingService.log("%c[WB] Calling FUNCTION: callExistingAttendees","color: green;"),hee(this.attendees).pipe(Je(1)).subscribe(e=>{e&&e.length>1?(e.forEach(i=>{i.userSnippylyId!==this.user.userSnippylyId&&!this.onOfferUidHistory[i.userSnippylyId]&&(this.loggingService.log("calling"),this.loggingService.log(i),this.initOffer(i.userSnippylyId))}),this.addLocalStreamToAllPeerConnections()):this.deleteMessages()})}catch(e){this.loggingService.catch("Error in HuddleService callExistingAttendees:",e)}}addLocalStreamToAllPeerConnections(){return ee(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: addLocalStreamToAllPeerConnections","color: green;"),Object.keys(this.senders).forEach(e=>{this.loggingService.log(this.senders[e]),this.localStream.getTracks().forEach(i=>{this.loggingService.log(i),this.senders[e].replaceTrack(i)})})}catch(e){this.loggingService.catch("Error in HuddleService addLocalStreamToAllPeerConnections:",e)}})}initOffer(e){return ee(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: initOffer","color: green;");let i=this.createPeerConnection(null,e);i&&(this.addLocalStreamToPeerConnection(i,!1),yield this.sendOffer(i,e))}catch(i){this.loggingService.catch("Error in HuddleService initOffer:",i)}})}createPeerConnection(e,i){try{return this.loggingService.log("%c[WB] Calling FUNCTION: createPeerConnection","color: green;"),e||(e=this.getCombinedId(this.user?.userSnippylyId,i)),e in this.peerConnectionMap?null:(this.loggingService.log("creating pc"),this.peerConnectionMap[e]=new RTCPeerConnection(this.servers),this.peerConnectionMap[e].onicecandidateerror=r=>{this.loggingService.log("Huddle: onicecandidateerror",r)},this.peerConnectionMap[e].onicecandidate=r=>{if(this.loggingService.log("pc onicecandidate"),r.candidate){let a={candidate:r.candidate.toJSON(),from:this.user.userSnippylyId,connectionId:e},s=fee(this.iceCandidates,a);this.dbRefsRemoveOnDropCall.push({type:"iceCandidate",dbRef:s}),ll(s).remove()}},this.peerConnectionMap[e].ontrack=r=>{this.loggingService.log("pc ontrack"),this.onTrack(e,r)},this.peerConnectionMap[e].onconnectionstatechange=r=>ee(this,null,function*(){this.logStatuses("onconnectionstatechange",e,r),this.peerConnectionMap[e].connectionState==="failed"&&(this.removeConnection(e),this.closeConnection(e),this.checkForRemovingAttendee())}),this.peerConnectionMap[e].onicegatheringstatechange=r=>ee(this,null,function*(){this.logStatuses("onicegatheringstatechange",e,r)}),this.peerConnectionMap[e].onsignalingstatechange=r=>ee(this,null,function*(){this.logStatuses("onsignalingstatechange",e,r)}),this.peerConnectionMap[e].oniceconnectionstatechange=r=>ee(this,null,function*(){this.loggingService.log("pc oniceconnectionstatechange"),this.logStatuses("oniceconnectionstatechange",e,r);try{this.peerConnectionStateMap[e]=this.peerConnectionMap[e].iceConnectionState,this.peerConnectionStateMap$.next(this.peerConnectionStateMap),this.peerConnectionMap[e]?.iceConnectionState==="connected"?(this.loggingService.log("connected"),this.updateTransceiverDirection(e)):this.peerConnectionMap[e]?.iceConnectionState==="disconnected"?this.loggingService.log("Disconnected"):this.peerConnectionMap[e].iceConnectionState==="closed"&&(this.loggingService.log("Closed"),this.closeConnection(e))}catch(a){this.loggingService.catch("Error in HuddleService oniceconnectionstatechange:",a)}}),this.peerConnectionMap[e].onnegotiationneeded=()=>{this.loggingService.log("pc onnegotiationneeded"),this.logStatuses("onnegotiationneeded",e)},e)}catch(r){return this.loggingService.catch("Error in HuddleService createPeerConnection:",r),""}}logStatuses(e,i,r){let a={};["connectionState","iceConnectionState","iceGatheringState","signalingState"].forEach(c=>{a[c]=this.peerConnectionMap[i][c]}),this.loggingService.log("Huddle: logStatues: ",i,e,a,r,this.peerConnectionMap[i])}checkForRemovingAttendee(){return ee(this,null,function*(){try{this.documentPaths?.huddle&&this.user?.userSnippylyId&&(Object.keys(this.peerConnectionMap)?.length||(this.commonDbService.deleteData({feature:"huddleAttendee",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,id:this.user?.userSnippylyId,skipFirestore:!0}}),this.joinHuddle(this.initialHuddleType)))}catch(e){this.loggingService.catch("Error in HuddleService checkForRemovingAttendee:",e)}})}closeConnection(e){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: closeConnection","color: green;"),this.peerConnectionMap[e]){let i=this.peerConnectionMap[e];i.getTransceivers()?.forEach(a=>{a.stop()}),i.getReceivers()?.forEach(a=>{a.track?.stop()}),i.close(),delete this.peerConnectionMap[e],delete this.onAnswerConnectionIdHistory[e],delete this.senders[e];let r=e.split("__").find(a=>a!==this.user?.userSnippylyId);r&&delete this.onOfferUidHistory[r]}}catch(i){this.loggingService.catch("Error in HuddleService closeConnection:",i)}}removeConnection(e){return ee(this,null,function*(){try{this.documentPaths?.huddle&&e&&this.commonDbService.deleteData({feature:"huddleConnection",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,id:e,skipFirestore:!0}})}catch(i){this.loggingService.catch("Error in HuddleService removeConnection:",i)}})}addLocalStreamToPeerConnection(e,i){try{this.loggingService.log("%c[WB] Calling FUNCTION: addLocalStreamToPeerConnection","color: green;"),i?(this.localStream.getTracks().forEach(r=>{this.peerConnectionMap[e].addTrack(r,this.localStream)}),this.screenSharingStream?.getVideoTracks()?.forEach(r=>{this.peerConnectionMap[e].addTrack(r,this.screenSharingStream)})):(this.localStream.getTracks().forEach(r=>{this.peerConnectionMap[e].addTrack(r,this.localStream)}),this.screenSharingStream?.getVideoTracks()?.forEach(r=>{this.peerConnectionMap[e].addTrack(r,this.screenSharingStream)}))}catch(r){this.loggingService.catch("Error in HuddleService addLocalStreamToPeerConnection:",r)}}updateTransceiverDirection(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: updateTransceiverDirection","color: green;");let i=this.peerConnectionMap[e].getTransceivers();this.loggingService.log(i),i.map(r=>{this.loggingService.log(r.currentDirection),r.currentDirection!=="sendrecv"&&(r.direction="sendrecv"),this.senders[e]=r.sender})}catch(i){this.loggingService.catch("Error in HuddleService updateTransceiverDirection:",i)}}generateKey(){this.loggingService.log("%c[WB] Calling FUNCTION: generateKey","color: green;");let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i="";for(let r=0;r<20;r++)i+=e.charAt(Math.floor(Math.random()*e.length));return i}getCombinedId(e,i){try{return e.localeCompare(i)===-1?`${e}__${i}`:`${i}__${e}`}catch(r){return this.loggingService.catch("Error in HuddleService getCombinedId:",r),""}}sendOffer(e,i){return ee(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: sendOffer","color: green;"),this.documentPaths?.huddle&&e){this.onOfferUidHistory[i]=!0;let r=yield this.peerConnectionMap[e].createOffer();yield this.setLocalDescription(e,r);let a={sdp:r.sdp,type:r.type};i||(i="all");let s={offer:a,from:this.user.userSnippylyId,connectionId:e,to:i},c=on(this.db,`${this.documentPaths?.huddle}/connections/${e}`);yield Mf(c,{offerData:s}),this.dbRefsRemoveOnDropCall.push({type:"connection",dbRef:c}),ll(c).remove()}}catch(r){this.loggingService.catch("Error in HuddleService sendOffer:",r)}})}setLocalDescription(e,i){return ee(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: setLocalDescription","color: green;"),yield this.peerConnectionMap[e].setLocalDescription(i)}catch(r){this.loggingService.catch("Error in HuddleService setLocalDescription:",r)}})}onTrack(e,i){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: onTrack","color: green;"),this.remoteStreamMap[e]||(this.remoteStreamMap[e]={}),this.loggingService.log(i.receiver.track),i?.streams?.length){this.remoteStreamMap[e][i.streams[0].id]=i.streams[0];let r=e.split("__").find(s=>s!==this.user?.userSnippylyId),a=this.attendees$.value?.find(s=>s?.userSnippylyId===r);a&&(a?.streamMetadata?.webcam===i.streams[0].id&&(this.remoteStreamMap[e].webcam=i.streams[0]),a?.streamMetadata?.screen===i.streams[0].id&&(this.remoteStreamMap[e].screen=i.streams[0])),this.remoteStreamMap$.next(this.remoteStreamMap)}}catch(r){this.loggingService.catch("Error in HuddleService onTrack:",r)}}toggleScreenSharing(e){return ee(this,null,function*(){try{if(e)this.screenSharingStream=yield navigator.mediaDevices?.getDisplayMedia({video:!0}),Object.keys(this.peerConnectionMap).forEach(i=>{this.peerConnectionMap[i].getSenders().find(s=>s?.track?.kind==this.screenSharingStream?.getVideoTracks()[0].kind)?.replaceTrack(this.screenSharingStream?.getVideoTracks()[0])});else{let i=this.localStream;Object.keys(this.peerConnectionMap).forEach(r=>{this.peerConnectionMap[r].getSenders().find(c=>c?.track?.kind==i.getVideoTracks()[0].kind)?.replaceTrack(i.getVideoTracks()[0])}),this.screenSharingStream?.getTracks().forEach(r=>r.stop())}}catch(i){this.loggingService.catch("Error in HuddleService toggleScreenSharing:",i)}})}setLocalStream(e){return ee(this,null,function*(){try{if(this.localStream=new MediaStream([this.silence(),this.black()]),e?.audio||e?.video){let i=e,r=ac();e?.audio&&(e?.audio instanceof Object?i.audio=T(I({},e?.audio),{deviceId:r?.selectedAudioDevice?.deviceId}):i.audio={deviceId:r?.selectedAudioDevice?.deviceId}),e?.video&&(e?.video instanceof Object?i.video=T(I({},e?.video),{deviceId:r?.selectedVideoDevice?.deviceId}):i.video={deviceId:r?.selectedVideoDevice?.deviceId});let a=yield navigator.mediaDevices.getUserMedia(i);a?.getAudioTracks()?.length&&(this.localStream.getAudioTracks().forEach(s=>this.localStream.removeTrack(s)),a.getAudioTracks().forEach(s=>this.localStream.addTrack(s))),a?.getVideoTracks()?.length&&(this.localStream.getVideoTracks().forEach(s=>this.localStream.removeTrack(s)),a.getVideoTracks().forEach(s=>this.localStream.addTrack(s)))}this.localStream$.next(this.localStream)}catch(i){this.loggingService.catch("Error in HuddleService setLocalStream:",i)}})}setScreenSharingStream(){return ee(this,null,function*(){try{let e=yield navigator.mediaDevices?.getDisplayMedia({video:!0});e&&this.screenSharingStream$.next(e)}catch(e){this.loggingService.catch("Error in HuddleService setScreenSharingStream:",e)}})}removeLocalStream(){return ee(this,null,function*(){try{this.localStream$?.value&&(this.localStream$.value.getTracks().forEach(i=>{i.stop()}),this.localStream$.next(null))}catch(e){this.loggingService.catch("Error in HuddleService removeLocalStream:",e)}})}toggleLocalStreamAudio(e){return ee(this,null,function*(){try{let i=this.localStream$.value;if(i){let r=i.getAudioTracks()[0];if(r.enabled&&!e)r.stop(),i.getAudioTracks()?.forEach(a=>{i.removeTrack(a)}),i.addTrack(this.silence()),this.analyticsService.trackEvent(Z.Events.Huddle.HUDDLE_AUDIO_MUTED,{huddleType:this.initialHuddleType,totalUsers:this.getHuddleAttendees()?.length||0,totalUserHuddleDuration:this.getTotalUserHuddleDuration(),huddleSnippylyUserIds:this.getHuddleAttendees()?.map(a=>a?.userSnippylyId),huddleClientUserIds:this.getHuddleAttendees()?.map(a=>a?.userId)});else{let a=ac(),s=yield navigator.mediaDevices.getUserMedia({audio:{deviceId:a?.selectAudioDevice?.deviceId}});s&&(i.getAudioTracks()?.forEach(c=>{i.removeTrack(c)}),s.getAudioTracks()?.forEach(c=>{i.addTrack(c)}),this.analyticsService.trackEvent(Z.Events.Huddle.HUDDLE_AUDIO_UNMUTED,{huddleType:this.initialHuddleType,totalUsers:this.getHuddleAttendees()?.length||0,totalUserHuddleDuration:this.getTotalUserHuddleDuration(),huddleSnippylyUserIds:this.getHuddleAttendees()?.map(c=>c?.userSnippylyId),huddleClientUserIds:this.getHuddleAttendees()?.map(c=>c?.userId)}))}Object.keys(this.peerConnectionMap).forEach(a=>{this.peerConnectionMap[a].getSenders().find(p=>p?.track?.kind==i?.getAudioTracks()[0].kind)?.replaceTrack(i?.getAudioTracks()[0])}),this.updateUserHuddleState()}}catch(i){this.loggingService.catch("Error in HuddleService toggleLocalStreamAudio:",i)}})}toggleLocalStreamVideo(e){return ee(this,null,function*(){try{let i=this.localStream$.value;if(i){let r=i.getVideoTracks()[0];if(r.enabled&&!e)r.stop(),i.getVideoTracks()?.forEach(a=>{i.removeTrack(a)}),i.addTrack(this.black()),this.analyticsService.trackEvent(Z.Events.Huddle.HUDDLE_VIDEO_TURNED_OFF,{huddleType:this.initialHuddleType,totalUsers:this.getHuddleAttendees()?.length||0,totalUserHuddleDuration:this.getTotalUserHuddleDuration(),huddleSnippylyUserIds:this.getHuddleAttendees()?.map(a=>a?.userSnippylyId),huddleClientUserIds:this.getHuddleAttendees()?.map(a=>a?.userId)});else{let a=ac(),s=yield navigator.mediaDevices.getUserMedia({video:{deviceId:a?.selectedVideoDevice?.deviceId}});s&&(i.getVideoTracks()?.forEach(c=>{i.removeTrack(c)}),s.getVideoTracks()?.forEach(c=>{i.addTrack(c)}),this.analyticsService.trackEvent(Z.Events.Huddle.HUDDLE_VIDEO_TURNED_ON,{huddleType:this.initialHuddleType,totalUsers:this.getHuddleAttendees()?.length||0,totalUserHuddleDuration:this.getTotalUserHuddleDuration(),huddleSnippylyUserIds:this.getHuddleAttendees()?.map(c=>c?.userSnippylyId),huddleClientUserIds:this.getHuddleAttendees()?.map(c=>c?.userId)}))}Object.keys(this.peerConnectionMap).forEach(a=>{this.peerConnectionMap[a].getSenders().find(p=>p?.track?.kind==i?.getVideoTracks()[0].kind)?.replaceTrack(i?.getVideoTracks()[0])}),this.updateUserHuddleState()}}catch(i){this.loggingService.catch("Error in HuddleService toggleLocalStreamVideo:",i)}})}toggleLocalScreenSharing(){return ee(this,null,function*(){try{let e=this.screenSharingStream;if(e){if(e.getVideoTracks()[0].enabled)this.stopScreenSharingStream();else{let r=yield navigator.mediaDevices?.getDisplayMedia({video:!0});r&&(e.getVideoTracks()?.forEach(a=>{e.removeTrack(a)}),r.getVideoTracks()?.forEach(a=>{e.addTrack(a),a.onended=()=>{this.stopScreenSharingStream(),this.updateScreenSharingTracksToPeers(),this.updateUserHuddleState()}})),this.screenSharingStream$.next(e),this.analyticsService.trackEvent(Z.Events.Huddle.HUDDLE_SCREENSHARING_STARTED,{huddleType:this.initialHuddleType,totalUsers:this.getHuddleAttendees()?.length||0,totalUserHuddleDuration:this.getTotalUserHuddleDuration(),huddleSnippylyUserIds:this.getHuddleAttendees()?.map(a=>a?.userSnippylyId),huddleClientUserIds:this.getHuddleAttendees()?.map(a=>a?.userId)})}this.updateScreenSharingTracksToPeers(),this.updateUserHuddleState()}}catch(e){this.loggingService.catch("Error in HuddleService toggleLocalScreenSharing:",e)}})}stopScreenSharingStream(){return ee(this,null,function*(){let e=this.screenSharingStream;if(e){let i=e.getVideoTracks()[0];i.enabled&&(i.stop(),e.getVideoTracks()?.forEach(r=>{e.removeTrack(r)}),e.addTrack(this.black()),this.analyticsService.trackEvent(Z.Events.Huddle.HUDDLE_SCREENSHARING_STOPPED,{huddleType:this.initialHuddleType,totalUsers:this.getHuddleAttendees()?.length||0,totalUserHuddleDuration:this.getTotalUserHuddleDuration(),huddleSnippylyUserIds:this.getHuddleAttendees()?.map(r=>r?.userSnippylyId),huddleClientUserIds:this.getHuddleAttendees()?.map(r=>r?.userId)}))}})}updateScreenSharingTracksToPeers(){return ee(this,null,function*(){Object.keys(this.peerConnectionMap).forEach(e=>{let r=this.peerConnectionMap[e].getSenders().filter(a=>a?.track?.kind==this.screenSharingStream?.getVideoTracks()[0].kind);r?.length>1&&r[1]?.replaceTrack(this.screenSharingStream?.getVideoTracks()[0])})})}dropCall(){return ee(this,null,function*(){try{this.messagesSubscription&&this.messagesSubscription.unsubscribe(),this.removeHuddleSessionData(),this.huddleJoined=!1,this.huddleJoined$.next(!1),this.peerConnectionMap&&Object.keys(this.peerConnectionMap).forEach(e=>{let i=this.peerConnectionMap[e];i.getTransceivers()?.forEach(r=>{r.stop()}),i.getSenders()?.forEach(r=>{r.track?.stop()}),i.getReceivers()?.forEach(r=>{r.track?.stop()}),i.close()}),this.peerConnectionMap={},this.dbRefsRemoveOnDropCall.forEach(e=>ee(this,null,function*(){yield VA(e.dbRef)})),this.onOfferUidHistory={},this.onAnswerConnectionIdHistory={},this.senders={},this.peerConnectionStateMap={},this.peerConnectionStateMap$.next(this.peerConnectionStateMap),this.localStream.getTracks().forEach(e=>{e.stop()}),this.screenSharingStream.getTracks().forEach(e=>{e.stop()}),this.localStream=new MediaStream([this.silence(),this.black()]),this.screenSharingStream=new MediaStream([this.black()]),this.localStream$.next(this.localStream),this.screenSharingStream$.next(this.screenSharingStream),this.localStreamState$.next({audioState:!1,videoState:!1,screenSharingState:!1}),this.analyticsService.trackEvent(Z.Events.Huddle.HUDDLE_LEFT,{huddleType:this.initialHuddleType,totalUsers:this.getHuddleAttendees()?.length||0,totalUserHuddleDuration:this.getTotalUserHuddleDuration(),huddleSnippylyUserIds:this.getHuddleAttendees()?.map(e=>e?.userSnippylyId),huddleClientUserIds:this.getHuddleAttendees()?.map(e=>e?.userId)})}catch(e){this.loggingService.catch("Error in HuddleService dropCall:",e)}})}updateHuddleSessionData(e,i,r){try{let a=JSON.parse(sessionStorage.getItem(U.SESSION_STORAGE.SNIPPYLY_HUDDLE_DATA)||"{}");r?sessionStorage.setItem(U.SESSION_STORAGE.SNIPPYLY_HUDDLE_DATA,JSON.stringify(r)):(a[e]=i,sessionStorage.setItem(U.SESSION_STORAGE.SNIPPYLY_HUDDLE_DATA,JSON.stringify(a)))}catch(a){this.loggingService.catch("Error in HuddleService updateHuddleSessionData:",a)}}getHuddleSessionData(){try{return sessionStorage.getItem(U.SESSION_STORAGE.SNIPPYLY_HUDDLE_DATA)?JSON.parse(sessionStorage.getItem(U.SESSION_STORAGE.SNIPPYLY_HUDDLE_DATA)):null}catch(e){return this.loggingService.catch("Error in HuddleService getHuddleSessionData:",e),null}}removeHuddleSessionData(){try{sessionStorage.removeItem(U.SESSION_STORAGE.SNIPPYLY_HUDDLE_DATA)}catch(e){this.loggingService.catch("Error in HuddleService removeHuddleSessionData:",e)}}removeAttendee(){return ee(this,null,function*(){try{if(this.documentPaths?.huddle&&this.user.userSnippylyId){yield this.commonDbService.deleteData({feature:"huddleAttendee",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,id:this.user?.userSnippylyId,skipFirestore:!0}});return}else return}catch(e){return this.loggingService.catch("Error in HuddleService removeAttendee:",e),Promise.resolve(null)}})}updateUserHuddleState(){return ee(this,null,function*(){try{if(this.attendees&&this.user&&this.documentPaths?.huddle){let e=this.getAudioState(),i=this.getVideoState(),r=this.getScreenSharingState();this.localStreamState$.next({audioState:e,videoState:i,screenSharingState:r});let a={audioState:e,videoState:i,screenSharingState:r};yield this.commonDbService.setData({feature:"huddleAttendeeState",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,id:this.user?.userSnippylyId,skipFirestore:!0},data:a})}}catch(e){this.loggingService.catch("Error in HuddleService updateUserHuddleState:",e)}})}updateHuddleOnCursorMode(){return ee(this,null,function*(){try{if(this.attendees&&this.user&&this.documentPaths?.huddle){let e=on(this.db,`${this.documentPaths?.huddle}/attendees/${this.user.userSnippylyId}/huddleOnCursorMode`);yield Mf(e,!!this.huddleOnCursorMode$.value)}}catch(e){this.loggingService.catch("Error in HuddleService updateHuddleOnCursorMode:",e)}})}getAudioState(){try{let e=this.localStream$.value;if(e){let i=e?.getAudioTracks();return!!(i?.length?i[0]:null)?.enabled}return!1}catch(e){return this.loggingService.catch("Error in HuddleService getAudioState:",e),!1}}getVideoState(){try{let e=this.localStream$.value;if(e){let i=e?.getVideoTracks();return!!(i?.length?i[0]:null)?.enabled}return!1}catch(e){return this.loggingService.catch("Error in HuddleService getVideoState:",e),!1}}getScreenSharingState(){try{let e=this.screenSharingStream;if(e){let i=e?.getVideoTracks();return!!(i?.length?i[0]:null)?.enabled}return!1}catch(e){return this.loggingService.catch("Error in HuddleService getVideoState:",e),!1}}removeIceCandidates(e){return ee(this,null,function*(){try{if(this.documentPaths?.huddle&&e){let i=yield this.commonDbService?.getData({feature:"allHuddleIceCandidates",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",skipFirestore:!0}});Object.keys(i).length>0&&Object.keys(i).forEach(r=>ee(this,null,function*(){i[r].connectionId===e&&this.commonDbService.deleteData({feature:"huddleIceCandidate",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,id:r,skipFirestore:!0}})}))}}catch(i){this.loggingService.catch("Error in HuddleService dropCall:",i)}})}get timestamp(){return this.commonDbService.getServerTimestamp()}silence(){try{let e=new AudioContext,i=e.createOscillator(),r=i.connect(e.createMediaStreamDestination());return i.start(),Object.assign(r.stream.getAudioTracks()[0],{enabled:!1})}catch(e){this.loggingService.catch("Error in HuddleService silence:",e)}}black({width:e=640,height:i=480}={}){try{let r=Object.assign(document.createElement("canvas"),{width:e,height:i});r.getContext("2d")?.fillRect(0,0,e,i);let a=r.captureStream();return Object.assign(a.getVideoTracks()[0],{enabled:!1})}catch(r){this.loggingService.catch("Error in HuddleService black:",r)}}getInitialHuddleType(){try{return this.initialHuddleType}catch(e){return this.loggingService.catch("Error in HuddleService getInitialHuddleType:",e),null}}getHuddleAttendees$(){try{return this.attendees$.asObservable()}catch(e){return this.loggingService.catch("Error in HuddleService getHuddleAttendees$:",e),re([])}}getHuddleAttendees(){try{return this.attendees$.value}catch(e){return this.loggingService.catch("Error in HuddleService getHuddleAttendees:",e),null}}getHuddleInvitees$(){try{return this.invitees$.asObservable()}catch(e){return this.loggingService.catch("Error in HuddleService getHuddleInvitees$:",e),re([])}}getHuddleInvitees(){try{return this.invitees$.value}catch(e){return this.loggingService.catch("Error in HuddleService getHuddleInvitees:",e),null}}getHuddleStartTime(){try{return this.userHuddleStartTime$.value}catch(e){return this.loggingService.catch("Error in HuddleService getHuddleStartTime:",e),null}}getTotalUserHuddleDuration(){try{return this.userHuddleStartTime$.value?new Date().getTime()-this.userHuddleStartTime$.value:null}catch(e){return this.loggingService.catch("Error in HuddleService gettotalUserHuddleDuration:",e),null}}inviteUsers(e){try{this.updateInvitees(e);let i={};i.notificationSource="huddleInvite",i.huddleInvitees=e,i.huddleType=this.getInitialHuddleType(),this.updateNotificationsDatabase(i)}catch(i){this.loggingService.catch("Error in HuddleService inviteUsers:",i)}}updateInvitees(e){try{if(this.documentPaths?.huddle){let i={};e.forEach(r=>{if(r?.email){let a=Rt(r.email);i[a]=r}}),this.commonDbService.setData({feature:"allHuddleInvitees",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0},data:i})}}catch(i){this.loggingService.catch("Error in HuddleService updateInvitees:",i)}}updateNotificationsDatabase(e={}){try{let i=I({notificationSource:"huddle"},e);this.notificationService.updateNotificationDatabase(i)}catch(i){this.loggingService.catch("Error in HuddleService updateNotificationsDatabase: ",i)}}getHuddleJoined$(){try{return this.huddleJoined$.asObservable()}catch(e){return this.loggingService.catch("Error in HuddleService getHuddleJoined$:",e),re(!1)}}getHuddleCursorAvailableByAttendeeId(){try{return this.huddleCursorAvailableByAttendeeId$.value}catch(e){return this.loggingService.catch("Error in HuddleService getHuddleCursorAvailableByAttendeeId:",e),null}}getHuddleCursorAvailableByAttendeeId$(){try{return this.huddleCursorAvailableByAttendeeId$.asObservable()}catch(e){return this.loggingService.catch("Error in HuddleService getHuddleCursorAvailableByAttendeeId$:",e),re({})}}updateHuddleCursorAvailableByAttendeeId(e,i){try{let r=this.huddleCursorAvailableByAttendeeId$.value;r[e]=i,this.huddleCursorAvailableByAttendeeId$.next(r)}catch(r){this.loggingService.catch("Error in HuddleService updateCursorUserAvailableByUserId:",r)}}setRemoteStreamsByUserId(e){try{this.remoteStreamsByUserId$.next(e)}catch(i){this.loggingService.catch("Error in HuddleService setRemoteStreamsByUserId:",i)}}getRemoteStreamsByUserId$(){try{return this.remoteStreamsByUserId$.asObservable()}catch(e){return this.loggingService.catch("Error in HuddleService getRemoteStreamsByUserId$:",e),re({})}}enableHuddleOnCursorMode(){try{this.huddleOnCursorMode$.next(!0)}catch(e){this.loggingService.catch("Error in HuddleService enableHuddleOnCursorMode:",e)}}disableHuddleOnCursorMode(){try{this.huddleOnCursorMode$.next(!1)}catch(e){this.loggingService.catch("Error in HuddleService disableHuddleOnCursorMode:",e)}}getHuddleOnCursorMode$(){try{return this.huddleOnCursorMode$.asObservable()}catch(e){return this.loggingService.catch("Error in HuddleService getHuddleOnCursorMode$:",e),re(!1)}}enableFlockModeOnAvatarClick(){try{this.flockModeOnAvatarClickEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in HuddleService enableFlockModeOnAvatarClick:",e)}}disableFlockModeOnAvatarClick(){try{this.flockModeOnAvatarClickEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in HuddleService disableFlockModeOnAvatarClick:",e)}}getFlockModeOnAvatarClick$(){try{return this.flockModeOnAvatarClickEnabled$.asObservable()}catch(e){return this.loggingService.catch("Error in HuddleService getFlockModeOnAvatarClick$:",e),re(!1)}}getFlockModeOnAvatarClick(){try{return this.flockModeOnAvatarClickEnabled$.value}catch(e){return this.loggingService.catch("Error in HuddleService getFlockModeOnAvatarClick:",e),!1}}enableChat(){try{this.chatEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in HuddleService enableChat:",e)}}disableChat(){try{this.chatEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in HuddleService disableChat:",e)}}getChatEnabled$(){try{return this.chatEnabled$.asObservable()}catch(e){return this.loggingService.catch("Error in HuddleService getChatEnabled$:",e),re(!1)}}getChatEnabled(){try{return this.chatEnabled$.value}catch(e){return this.loggingService.catch("Error in HuddleService getChatEnabled:",e),!1}}getHuddleOnCursorModeByAttendeeId$(){try{return this.huddleOnCursorModeByAttendeeId$.asObservable()}catch(e){return this.loggingService.catch("Error in HuddleService getHuddleOnCursorModeByAttendeeId$:",e),re({})}}toggleHuddleOnCursorModeByAttendeeId(e){try{let i=this.huddleOnCursorModeByAttendeeId$.value;i[e]?delete i[e]:i[e]=!0,this.huddleOnCursorModeByAttendeeId$.next(i)}catch(i){this.loggingService.catch("Error in HuddleService toggleHuddleOnCursorModeByAttendeeId:",i)}}addCursorTag(){try{if(!document.querySelector(`${U.TAGS.SNIPPYLY_CURSOR}`)){let e=document.createElement(U.TAGS.SNIPPYLY_CURSOR);e.setAttribute("snippyly-temporary","true"),document.body.appendChild(e)}}catch(e){this.loggingService.catch("Error in HuddleService addCursorTag:",e)}}removeCursorTag(){try{let e=document.querySelector(`${U.TAGS.SNIPPYLY_CURSOR}`);e?.hasAttribute("snippyly-temporary")&&e.remove()}catch(e){this.loggingService.catch("Error in HuddleService removeCursorTag:",e)}}sendMessage(e){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: sendMessage","color: green;"),this.documentPaths?.huddle&&this.user){let i=new lM;i.message=e,i.from=this.user,i.timestamp=this.timestamp,this.commonDbService.setData({feature:"huddleMessage",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,id:i.id,skipFirestore:!0},data:i})}}catch(i){this.loggingService.catch("Error in HuddleService sendMessage:",i)}}getMessages$(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getMessages$","color: green;"),this.messages$.asObservable()}catch(e){return this.loggingService.catch("Error in HuddleService getMessages$:",e),re([])}}deleteMessages(){try{this.loggingService.log("%c[WB] Calling FUNCTION: deleteMessages","color: green;"),this.documentPaths?.huddle&&this.commonDbService.deleteData({feature:"allHuddleMessages",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}})}catch(e){this.loggingService.catch("Error in HuddleService deleteMessages:",e)}}showMessagesPanel(){try{this.loggingService.log("%c[WB] Calling FUNCTION: showMessagesPanel","color: green;"),this.messagesPanelVisible$.next(!0)}catch(e){this.loggingService.catch("Error in HuddleService showMessagesPanel:",e)}}hideMessagesPanel(){try{this.loggingService.log("%c[WB] Calling FUNCTION: hideMessagesPanel","color: green;"),this.messagesPanelVisible$.next(!1)}catch(e){this.loggingService.catch("Error in HuddleService hideMessagesPanel:",e)}}toggleMessagesPanel(){try{this.loggingService.log("%c[WB] Calling FUNCTION: toggleMessagesPanel","color: green;"),this.messagesPanelVisible$.next(!this.messagesPanelVisible$.value)}catch(e){this.loggingService.catch("Error in HuddleService toggleMessagesPanel:",e)}}getMessagesPanelVisible$(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getMessagesPanelVisible$","color: green;"),this.messagesPanelVisible$.asObservable()}catch(e){return this.loggingService.catch("Error in HuddleService getMessagesPanelVisible$:",e),re(!1)}}getMessagesPanelVisible(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getMessagesPanelVisible","color: green;"),this.messagesPanelVisible$.value}catch(e){return this.loggingService.catch("Error in HuddleService getMessagesPanelVisible:",e),!1}}signOutUser(e){return ee(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: signOutUser","color: green;"),this.huddleJoined$.value&&(yield this.dropCall(),yield this.removeLocalStream(),yield this.removeAttendee())}catch(i){this.loggingService.catch("Error in HuddleService signOutUser:",i)}})}};o.\u0275fac=function(i){return new(i||o)(J(vi),J(Qe),J(je),J(pn),J(lt),J($t),J(Fe),J(xM),J(Vo),J(y),J(Vn),J(bn),J(Hn))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var GM=class extends li{constructor(o){super(o),this.getService(y).log("%c[WB] Creating CLASS: HuddleElement","color: blue;"),this.enableCursorMode=this._enableCursorMode,this.disableCursorMode=this._disableCursorMode,this.enableChat=this._enableChat,this.disableChat=this._disableChat,this.enableFlockModeOnAvatarClick=this._enableFlockModeOnAvatarClick,this.disableFlockModeOnAvatarClick=this._disableFlockModeOnAvatarClick}_enableCursorMode(){this.getService(y).log("%c[WB] Calling FUNCTION: _enableCursorMode","color: green;");try{this.trackEvent(Z.Events.Huddle.ENABLE_HUDDLE_ON_CURSOR_MODE_TRIGGERED),this.getService(mr).enableHuddleOnCursorMode()}catch(o){this.getService(y).catch("Error in enableCursorMode: ",o)}}_disableCursorMode(){this.getService(y).log("%c[WB] Calling FUNCTION: _disableCursorMode","color: green;");try{this.trackEvent(Z.Events.Huddle.DISABLE_HUDDLE_ON_CURSOR_MODE_TRIGGERED),this.getService(mr).disableHuddleOnCursorMode()}catch(o){this.getService(y).catch("Error in disableCursorMode: ",o)}}_enableChat(){this.getService(y).log("%c[WB] Calling FUNCTION: _enableChat","color: green;");try{this.trackEvent(Z.Events.Huddle.ENABLE_CHAT_TRIGGERED),this.getService(mr).enableChat()}catch(o){this.getService(y).catch("Error in enableChat: ",o)}}_disableChat(){this.getService(y).log("%c[WB] Calling FUNCTION: _disableChat","color: green;");try{this.trackEvent(Z.Events.Huddle.DISABLE_CHAT_TRIGGERED),this.getService(mr).disableChat()}catch(o){this.getService(y).catch("Error in disableChat: ",o)}}_enableFlockModeOnAvatarClick(){this.getService(y).log("%c[WB] Calling FUNCTION: _enableFlockModeOnAvatarClick","color: green;");try{this.trackEvent(Z.Events.Huddle.ENABLE_FLOCK_MODE_ON_AVATAR_CLICK_TRIGGERED),this.getService(mr).enableFlockModeOnAvatarClick()}catch(o){this.getService(y).catch("Error in enableFlockModeOnAvatarClick: ",o)}}_disableFlockModeOnAvatarClick(){this.getService(y).log("%c[WB] Calling FUNCTION: _disableFlockModeOnAvatarClick","color: green;");try{this.trackEvent(Z.Events.Huddle.DISABLE_FLOCK_MODE_ON_AVATAR_CLICK_TRIGGERED),this.getService(mr).disableFlockModeOnAvatarClick()}catch(o){this.getService(y).catch("Error in disableFlockModeOnAvatarClick: ",o)}}};var WM=class extends li{constructor(o){super(o),this.getService(y).log("%c[WB] Creating CLASS: LiveStateElement","color: blue;"),this.getLiveStateData$=this._getLiveStateData,this.getLiveStateData=this._getLiveStateData,this.setLiveStateData=this._setLiveStateData,this.enableSingleEditorMode=this._enableSingleEditorMode,this.disableSingleEditorMode=this._disableSingleEditorMode,this.isUserEditor$=this._isUserEditor,this.isUserEditor=this._isUserEditor,this.getEditor=this._getEditor,this.setUserAsEditor=this._setUserAsEditor,this.resetUserAccess=this._resetUserAccess,this.singleEditorModeContainerIds=this._singleEditorModeContainerIds,this.enableAutoSyncState=this._enableAutoSyncState,this.disableAutoSyncState=this._disableAutoSyncState,this.requestEditorAccess=this._requestEditorAccess,this.isEditorAccessRequested=this._isEditorAccessRequested,this.acceptEditorAccessRequest=this._acceptEditorAccessRequest,this.rejectEditorAccessRequest=this._rejectEditorAccessRequest,this.cancelEditorAccessRequest=this._cancelEditorAccessRequest,this.editCurrentTab=this._editCurrentTab,this.setEditorAccessTimeout=this._setEditorAccessTimeout,this.enableEditorAccessTransferOnTimeOut=this._enableEditorAccessTransferOnTimeOut,this.disableEditorAccessTransferOnTimeOut=this._disableEditorAccessTransferOnTimeOut,this.enableDefaultSingleEditorUI=this._enableDefaultSingleEditorUI,this.disableDefaultSingleEditorUI=this._disableDefaultSingleEditorUI,this.getEditorAccessTimer=this._getEditorAccessTimer,this.onServerConnectionStateChange=this._onServerConnectionStateChange}_getLiveStateData(o,t){this.getService(y).log("%c[WB] Calling FUNCTION: getLiveStateData","color: green;");try{return this.trackEvent(Z.Events.LiveStateSync.GET_LIVE_STATE_DATA_TRIGGERED),this.getService(Di).getLiveStateData$(o,t)}catch(e){return this.getService(y).catch("Error in _getLiveStateData: ",e),re(null)}}_setLiveStateData(o,t,e){this.getService(y).log("%c[WB] Calling FUNCTION: setLiveStateData","color: green;");try{return this.trackEvent(Z.Events.LiveStateSync.SET_LIVE_STATE_DATA_TRIGGERED),this.getService(Di).setLiveStateData(o,t,e)}catch(i){return this.getService(y).catch("Error in _setLiveStateData: ",i),re(null)}}_enableSingleEditorMode(o){this.getService(y).log("%c[WB] Calling FUNCTION: enableSingleEditorMode","color: green;");try{this.trackEvent(Z.Events.LiveStateSync.ENABLE_SINGLE_EDITOR_MODE_TRIGGERED),this.getService(Di).enableSingleEditorMode(o)}catch(t){this.getService(y).catch("Error in _enableSingleEditorMode: ",t)}}_disableSingleEditorMode(){this.getService(y).log("%c[WB] Calling FUNCTION: disableSingleEditorMode","color: green;");try{this.trackEvent(Z.Events.LiveStateSync.DISABLE_SINGLE_EDITOR_MODE_TRIGGERED),this.getService(Di).disableSingleEditorMode()}catch(o){this.getService(y).catch("Error in _disableSingleEditorMode: ",o)}}_isUserEditor(){this.getService(y).log("%c[WB] Calling FUNCTION: isUserEditor$","color: green;");try{return this.trackEvent(Z.Events.LiveStateSync.IS_USER_EDITOR_TRIGGERED),this.getService(Di).isUserEditor$()}catch(o){return this.getService(y).catch("Error in _isUserEditor$: ",o),re(null)}}_getEditor(){this.getService(y).log("%c[WB] Calling FUNCTION: getEditor","color: green;");try{return this.trackEvent(Z.Events.LiveStateSync.GET_EDITOR_TRIGGERED),this.getService(Di).getEditor$()}catch(o){return this.getService(y).catch("Error in _getEditor: ",o),re(null)}}_setUserAsEditor(){this.getService(y).log("%c[WB] Calling FUNCTION: setUserAsEditor","color: green;");try{this.trackEvent(Z.Events.LiveStateSync.SET_USER_AS_EDITOR_TRIGGERED),this.getService(Di).setUserAsEditor()}catch(o){this.getService(y).catch("Error in _setUserAsEditor: ",o)}}_resetUserAccess(){this.getService(y).log("%c[WB] Calling FUNCTION: resetUserAccess","color: green;");try{this.trackEvent(Z.Events.LiveStateSync.RESET_USER_ACCESS_TRIGGERED),this.getService(Di).removeEditorAccess()}catch(o){this.getService(y).catch("Error in _resetUserAccess: ",o)}}_singleEditorModeContainerIds(o){this.getService(y).log("%c[WB] Calling FUNCTION: singleEditorModeContainerIds","color: green;");try{this.trackEvent(Z.Events.LiveStateSync.SINGLE_EDITOR_MODE_CONTAINER_IDS_TRIGGERED),this.getService(Di).setSingleEditorModeContainerIds(o)}catch(t){this.getService(y).catch("Error in _singleEditorModeContainerIds: ",t)}}_enableAutoSyncState(){this.getService(y).log("%c[WB] Calling FUNCTION: enableAutoSyncState","color: green;");try{this.trackEvent(Z.Events.LiveStateSync.ENABLE_AUTO_SYNC_STATE_TRIGGERED),this.getService(Di).enableAutoSyncState()}catch(o){this.getService(y).catch("Error in _enableAutoSyncState: ",o)}}_disableAutoSyncState(){this.getService(y).log("%c[WB] Calling FUNCTION: disableAutoSyncState","color: green;");try{this.trackEvent(Z.Events.LiveStateSync.DISABLE_AUTO_SYNC_STATE_TRIGGERED),this.getService(Di).disableAutoSyncState()}catch(o){this.getService(y).catch("Error in _disableAutoSyncState: ",o)}}_requestEditorAccess(){this.getService(y).log("%c[WB] Calling FUNCTION: requestEditorAccess","color: green;");try{return this.trackEvent(Z.Events.LiveStateSync.REQUEST_EDITOR_ACCESS_TRIGGERED),this.getService(Di).requestEditorAccess()}catch(o){return this.getService(y).catch("Error in _requestEditorAccess: ",o),re(null)}}_isEditorAccessRequested(){this.getService(y).log("%c[WB] Calling FUNCTION: isEditorAccessRequested","color: green;");try{return this.trackEvent(Z.Events.LiveStateSync.IS_EDITOR_ACCESS_REQUESTED_TRIGGERED),this.getService(Di).isEditorAccessRequested$()}catch(o){return this.getService(y).catch("Error in _isEditorAccessRequested: ",o),re(null)}}_acceptEditorAccessRequest(){this.getService(y).log("%c[WB] Calling FUNCTION: acceptEditorAccessRequest","color: green;");try{this.trackEvent(Z.Events.LiveStateSync.ACCEPT_EDITOR_ACCESS_REQUEST_TRIGGERED),this.getService(Di).acceptEditorAccessRequest()}catch(o){this.getService(y).catch("Error in _acceptEditorAccessRequest: ",o)}}_rejectEditorAccessRequest(){this.getService(y).log("%c[WB] Calling FUNCTION: rejectEditorAccessRequest","color: green;");try{this.trackEvent(Z.Events.LiveStateSync.REJECT_EDITOR_ACCESS_REQUEST_TRIGGERED),this.getService(Di).rejectEditorAccessRequest()}catch(o){this.getService(y).catch("Error in _rejectEditorAccessRequest: ",o)}}_cancelEditorAccessRequest(){this.getService(y).log("%c[WB] Calling FUNCTION: cancelEditorAccessRequest","color: green;");try{this.trackEvent(Z.Events.LiveStateSync.CANCEL_EDITOR_ACCESS_REQUEST_TRIGGERED),this.getService(Di).cancelEditorAccessRequest()}catch(o){this.getService(y).catch("Error in _cancelEditorAccessRequest: ",o)}}_editCurrentTab(){this.getService(y).log("%c[WB] Calling FUNCTION: editCurrentTab","color: green;");try{this.trackEvent(Z.Events.LiveStateSync.EDIT_CURRENT_TAB_TRIGGERED),this.getService(Di).editCurrentTab()}catch(o){this.getService(y).catch("Error in _editCurrentTab: ",o)}}_setEditorAccessTimeout(o){this.getService(y).log("%c[WB] Calling FUNCTION: setEditorAccessTimeout","color: green;");try{this.trackEvent(Z.Events.LiveStateSync.SET_EDITOR_ACCESS_TIMEOUT_TRIGGERED),this.getService(Di).setEditorAccessTimeout(o)}catch(t){this.getService(y).catch("Error in _setEditorAccessTimeout: ",t)}}_enableEditorAccessTransferOnTimeOut(){this.getService(y).log("%c[WB] Calling FUNCTION: enableEditorAccessTransferOnTimeOut","color: green;");try{this.trackEvent(Z.Events.LiveStateSync.ENABLE_EDITOR_ACCESS_TRANSFER_ON_TIMEOUT_TRIGGERED),this.getService(Di).enableEditorAccessTransferOnTimeOut()}catch(o){this.getService(y).catch("Error in _enableEditorAccessTransferOnTimeOut: ",o)}}_disableEditorAccessTransferOnTimeOut(){this.getService(y).log("%c[WB] Calling FUNCTION: disableEditorAccessTransferOnTimeOut","color: green;");try{this.trackEvent(Z.Events.LiveStateSync.DISABLE_EDITOR_ACCESS_TRANSFER_ON_TIMEOUT_TRIGGERED),this.getService(Di).disableEditorAccessTransferOnTimeOut()}catch(o){this.getService(y).catch("Error in _disableEditorAccessTransferOnTimeOut: ",o)}}_enableDefaultSingleEditorUI(){this.getService(y).log("%c[WB] Calling FUNCTION: enableDefaultSingleEditorUI","color: green;");try{this.trackEvent(Z.Events.LiveStateSync.ENABLE_DEFAULT_SINGLE_EDITOR_UI_TRIGGERED),this.getService(Di).enableDefaultSingleEditorUI()}catch(o){this.getService(y).catch("Error in _enableDefaultSingleEditorUI: ",o)}}_disableDefaultSingleEditorUI(){this.getService(y).log("%c[WB] Calling FUNCTION: disableDefaultSingleEditorUI","color: green;");try{this.trackEvent(Z.Events.LiveStateSync.DISABLE_DEFAULT_SINGLE_EDITOR_UI_TRIGGERED),this.getService(Di).disableDefaultSingleEditorUI()}catch(o){this.getService(y).catch("Error in _disableDefaultSingleEditorUI: ",o)}}_getEditorAccessTimer(){this.getService(y).log("%c[WB] Calling FUNCTION: getEditorAccessTimer","color: green;");try{return this.trackEvent(Z.Events.LiveStateSync.GET_EDITOR_ACCESS_TIMER_TRIGGERED),this.getService(Di).getEditorAccessTimer$()}catch(o){return this.getService(y).catch("Error in _getEditorAccessTimer: ",o),re(new Bv)}}_onServerConnectionStateChange(){this.getService(y).log("%c[WB] Calling FUNCTION: onServerConnectionStateChange","color: green;");try{return this.trackEvent(Z.Events.LiveStateSync.ON_SERVER_CONNECTION_STATE_CHANGE_TRIGGERED),this.getService(Di).onServerConnectionStateChange$()}catch(o){return this.getService(y).catch("Error in _onServerConnectionStateChange: ",o),re(gl.PENDING_INIT)}}};var qM=class extends li{constructor(o){super(o),this.getService(y).log("%c[WB] Creating CLASS: ViewsElement","color: blue;"),this.openHistoryPanel=this._openHistoryPanel,this.closeHistoryPanel=this._closeHistoryPanel,this.toggleHistoryPanel=this._toggleHistoryPanel,this.getNotificationsData=this._getNotificationsData,this.setMaxDays=this._setMaxDays,this.setTabConfig=this._setTabConfig,this.enableReadNotificationsOnForYouTab=this._enableReadNotificationsOnForYouTab,this.disableReadNotificationsOnForYouTab=this._disableReadNotificationsOnForYouTab,this.setAllNotificationsAsRead=this._setAllNotificationsAsRead,this.getUnreadNotificationsCount=this._getUnreadNotificationsCount,this.markNotificationAsReadById=this._markNotificationAsReadById}_openHistoryPanel(){this.getService(y).log("%c[WB] Calling FUNCTION: _openHistoryPanel","color: green;");try{this.trackEvent(Z.Events.Notifications.OPEN_HISTORY_PANEL_TRIGGERED),this.getService(Vn).setHistoryPanelVisibility(!0,!0)}catch(o){this.getService(y).catch("Error in openHistoryPanel: ",o)}}_closeHistoryPanel(){this.getService(y).log("%c[WB] Calling FUNCTION: _closeHistoryPanel","color: green;");try{this.trackEvent(Z.Events.Notifications.CLOSE_HISTORY_PANEL_TRIGGERED),this.getService(Vn).setHistoryPanelVisibility(!1,!0)}catch(o){this.getService(y).catch("Error in closeHistoryPanel: ",o)}}_toggleHistoryPanel(){this.getService(y).log("%c[WB] Calling FUNCTION: _toggleHistoryPanel","color: green;");try{this.trackEvent(Z.Events.Notifications.TOGGLE_HISTORY_PANEL_TRIGGERED),this.getService(Vn).toggleHistoryPanelVisibility(!0)}catch(o){this.getService(y).catch("Error in toggleHistoryPanel: ",o)}}_getNotificationsData(){this.getService(y).log("%c[WB] Calling FUNCTION: _getNotificationsData","color: green;");try{return this.trackEvent(Z.Events.Notifications.GET_NOTIFICATIONS_DATA_TRIGGERED),this.getService(Vn).getNotifications$()}catch(o){return this.getService(y).catch("Error in getNotificationsData: ",o),re([])}}_setMaxDays(o){this.getService(y).log("%c[WB] Calling FUNCTION: _setMaxDays","color: green;");try{this.trackEvent(Z.Events.Notifications.SET_MAX_DAYS_TRIGGERED),this.getService(Vn).setMaxDays(o)}catch(t){this.getService(y).catch("Error in setMaxDays: ",t)}}_setTabConfig(o){this.getService(y).log("%c[WB] Calling FUNCTION: _setTabConfig","color: green;");try{this.trackEvent(Z.Events.Notifications.SET_TAB_CONFIG_TRIGGERED),this.getService(Vn).setTabConfig(o)}catch(t){this.getService(y).catch("Error in setTabConfig: ",t)}}_enableReadNotificationsOnForYouTab(){this.getService(y).log("%c[WB] Calling FUNCTION: _enableReadNotificationsOnForYouTab","color: green;");try{this.trackEvent(Z.Events.Notifications.ENABLE_READ_NOTIFICATIONS_ON_FOR_YOU_TAB_TRIGGERED),this.getService(Vn).enableReadNotificationsOnForYouTab()}catch(o){this.getService(y).catch("Error in enableReadNotificationsOnForYouTab: ",o)}}_disableReadNotificationsOnForYouTab(){this.getService(y).log("%c[WB] Calling FUNCTION: _disableReadNotificationsOnForYouTab","color: green;");try{this.trackEvent(Z.Events.Notifications.DISABLE_READ_NOTIFICATIONS_ON_FOR_YOU_TAB_TRIGGERED),this.getService(Vn).disableReadNotificationsOnForYouTab()}catch(o){this.getService(y).catch("Error in disableReadNotificationsOnForYouTab: ",o)}}_setAllNotificationsAsRead(o){this.getService(y).log("%c[WB] Calling FUNCTION: _setAllNotificationsAsRead","color: green;");try{this.trackEvent(Z.Events.Notifications.SET_ALL_NOTIFICATIONS_AS_READ_TRIGGERED),this.getService(Vn).setAllNotificationsAsRead(o)}catch(t){this.getService(y).catch("Error in setAllNotificationsAsRead: ",t)}}_getUnreadNotificationsCount(){this.getService(y).log("%c[WB] Calling FUNCTION: _getUnreadNotificationsCount","color: green;");try{return this.trackEvent(Z.Events.Notifications.GET_UNREAD_NOTIFICATIONS_COUNT_TRIGGERED),this.getService(Vn).getUnreadNotificationsCount$()}catch(o){return this.getService(y).catch("Error in getUnreadNotificationsCount: ",o),re({forYou:null,all:null})}}_markNotificationAsReadById(o){this.getService(y).log("%c[WB] Calling FUNCTION: _markNotificationAsReadById","color: green;");try{this.trackEvent(Z.Events.Notifications.MARK_NOTIFICATION_AS_READ_BY_ID_TRIGGERED,{payload:{notificationId:o}}),this.getService(Vn).markNotificationAsReadById(o)}catch(t){this.getService(y).catch("Error in markNotificationAsReadById: ",t)}}};var YM=class extends li{constructor(o){super(o),this.getService(y).log("%c[WB] Creating CLASS: PresenceElement","color: blue;"),this.getOnlineUsersOnCurrentDocument=this._getOnlineUsersOnCurrentDocument,this.setInactivityTime=this._setInactivityTime,this.enableFlockMode=this._enableFlockMode,this.disableFlockMode=this._disableFlockMode,this.startFollowingUser=this._startFollowingUser,this.stopFollowingUser=this._stopFollowingUser,this.enableSelf=this._enableSelf,this.disableSelf=this._disableSelf}_getOnlineUsersOnCurrentDocument(){this.getService(y).log("%c[WB] Calling FUNCTION: getOnlineUsers","color: green;");try{return this.trackEvent(Z.Events.Presence.GET_ONLINE_USERS_ON_CURRENT_DOCUMENT_TRIGGERED),this.getService(Cm).getOnlineUsersOnCurrentDocument()}catch(o){return this.getService(y).catch("Error in _getOnlineUsersOnCurrentDocument: ",o),re(null)}}_setInactivityTime(o){this.getService(y).log("%c[WB] Calling FUNCTION: _setInactivityTime","color: green;");try{this.trackEvent(Z.Events.Presence.SET_INACTIVITY_TIME_TRIGGERED,{payload:{time:o}}),isNaN(o)?this.getService(y).catch("Error in setInactivityTime: ","Provided value is not a number."):this.getService(Cm).setInactivityTime(o)}catch(t){this.getService(y).catch("Error in setInactivityTime: ",t)}}_disableFlockMode(){try{this.trackEvent(Z.Events.Presence.DISABLE_FLOCK_MODE_TRIGGERED),this.getService(vc).disableFlockMode()}catch(o){this.getService(y).catch("Error in _disableFlockMode: ",o)}}_enableFlockMode(o){try{this.trackEvent(Z.Events.Presence.ENABLE_FLOCK_MODE_TRIGGERED,{payload:{options:o}}),this.getService(vc).enableFlockMode(o)}catch(t){this.getService(y).catch("Error in _enableFlockMode: ",t)}}_stopFollowingUser(){try{this.trackEvent(Z.Events.Presence.STOP_FOLLOWING_USER_TRIGGERED),this.getService(vc).stopFollowingUser()}catch(o){this.getService(y).catch("Error in _stopFollowingUser: ",o)}}_startFollowingUser(o){try{this.trackEvent(Z.Events.Presence.START_FOLLOWING_USER_TRIGGERED,{payload:{externalId:o}});let t=this.getService(Cm).getPresenceUserFromExternalId(o);return t&&t.userSnippylyId&&t.name!==void 0?(this.getService(vc).startFollowingUser(t.userSnippylyId,t.name),{success:!0,msg:"Joined flock session."}):{success:!1,msg:"User could not be found."}}catch(t){return this.getService(y).catch("Error in _startFollowingUser: ",t),{success:!1,msg:"Unknown error.",raw:t}}}_enableSelf(){try{this.trackEvent(Z.Events.Presence.ENABLE_SELF_TRIGGERED),this.getService(Cm).enableIncludeSelf()}catch(o){this.getService(y).catch("Error in _enableSelf: ",o)}}_disableSelf(){try{this.trackEvent(Z.Events.Presence.DISABLE_SELF_TRIGGERED),this.getService(Cm).disableIncludeSelf()}catch(o){this.getService(y).catch("Error in _disableSelf: ",o)}}};var KM=class extends li{constructor(o){super(o),this.getService(y).log("%c[WB] Creating CLASS: ReactionElement","color: blue;"),this.enableDarkMode=this._enableDarkMode,this.disableDarkMode=this._disableDarkMode,this.setCustomReactions=this._setCustomReactions}_enableDarkMode(){this.getService(y).log("%c[WB] Calling FUNCTION: enableDarkMode","color: green;");try{this.trackEvent(Z.Events.Reactions.ENABLE_DARK_MODE_TRIGGERED),this.getService(er).enableDarkMode()}catch(o){this.getService(y).catch("Error in _enableDarkMode: ",o)}}_disableDarkMode(){this.getService(y).log("%c[WB] Calling FUNCTION: disableDarkMode","color: green;");try{this.trackEvent(Z.Events.Reactions.DISABLE_DARK_MODE_TRIGGERED),this.getService(er).disableDarkMode()}catch(o){this.getService(y).catch("Error in _disableDarkMode: ",o)}}_setCustomReactions(o){this.getService(y).log("%c[WB] Calling FUNCTION: setCustomReactions","color: green;");try{this.trackEvent(Z.Events.Reactions.SET_CUSTOM_REACTIONS_TRIGGERED,{payload:{reactions:o}}),this.getService(er).setCustomReactions(o)}catch(t){this.getService(y).catch("Error in _setCustomReactions: ",t)}}};var Ose=(()=>{let o=class o{constructor(e,i,r){this.loggingService=e,this.recorderAnnotationService=i,this.recorderService=r,this.actionSubjects=new Map,this.subscriptions=[];try{this.recorderAnnotationService.setRecorderActionsService(this),this.recorderService.setRecorderActionsService(this)}catch(a){this.loggingService.catch("Error in RecorderActionsService constructor: ",a)}}onTranscriptionDone(e){try{this.triggerAction(LO.TRANSCRIPTION_DONE,e)}catch(i){this.loggingService.catch("Error in RecorderActionsService onTranscriptionDone: ",i)}}onRecordingDone(e){try{this.triggerAction(LO.RECORDING_DONE,e)}catch(i){this.loggingService.catch("Error in RecorderActionsService onRecordingDone: ",i)}}onDeleteRecording(e){try{this.triggerAction(LO.DELETE_RECORDING,e)}catch(i){this.loggingService.catch("Error in RecorderActionsService onDeleteRecording: ",i)}}triggerAction(e,i){try{this.actionSubjects.has(e)||this.actionSubjects.set(e,new et),this.actionSubjects.get(e)?.next(i)}catch(r){this.loggingService.catch("Error in RecorderActionsService triggerAction: ",r)}}onAction(e){try{return this.actionSubjects.has(e)||this.actionSubjects.set(e,new et),this.actionSubjects.get(e)?.asObservable()}catch(i){return this.loggingService.catch("Error in RecorderActionsService onAction: ",i),re(null)}}};o.\u0275fac=function(i){return new(i||o)(J(y),J(Xi),J(yi))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var ZM=class extends li{constructor(o){super(o),this.getService(y).log("%c[WB] Creating CLASS: RecorderElement","color: blue;"),this.initRecording=this._initRecording,this.onRecordedData=this._onRecordedData,this.enableDarkMode=this._enableDarkMode,this.disableDarkMode=this._disableDarkMode,this.enableRecordingCountdown=this._enableRecordingCountdown,this.disableRecordingCountdown=this._disableRecordingCountdown,this.getRecordingDataByRecorderId=this._getRecordingDataByRecorderId,this.enableRecordingTranscription=this._enableRecordingTranscription,this.disableRecordingTranscription=this._disableRecordingTranscription,this.getRecordingData=this._getRecordingData,this.enableVideoEditor=this._enableVideoEditor,this.disableVideoEditor=this._disableVideoEditor,this.getRecordings=this._getRecordings,this.fetchRecordings=this._fetchRecordings,this.on=this._on}_initRecording(o,t){this.getService(y).log("%c[WB] Calling FUNCTION: initRecording","color: green;");try{return this.trackEvent(Z.Events.Recording.INIT_RECORDING_TRIGGERED,{payload:{type:o,panelId:t}}),this.getService(yi).initRecording(o,t)}catch(e){return this.getService(y).catch("Error in _initRecording: ",e),re(null)}}_onRecordedData(){this.getService(y).log("%c[WB] Calling FUNCTION: onRecordedData","color: green;");try{return this.trackEvent(Z.Events.Recording.ON_RECORDED_DATA_TRIGGERED),this.getService(yi).onRecordedData()}catch(o){return this.getService(y).catch("Error in _onRecordedData: ",o),re(null)}}_enableDarkMode(){this.getService(y).log("%c[WB] Calling FUNCTION: enableDarkMode","color: green;");try{this.trackEvent(Z.Events.Recording.ENABLE_DARK_MODE_TRIGGERED),this.getService(Xi).setRecorderContainerDarkMode(!0)}catch(o){this.getService(y).catch("Error in _enableDarkMode: ",o)}}_disableDarkMode(){this.getService(y).log("%c[WB] Calling FUNCTION: disableDarkMode","color: green;");try{this.trackEvent(Z.Events.Recording.DISABLE_DARK_MODE_TRIGGERED),this.getService(Xi).setRecorderContainerDarkMode(!1)}catch(o){this.getService(y).catch("Error in _disableDarkMode: ",o)}}_enableRecordingCountdown(){this.getService(y).log("%c[WB] Calling FUNCTION: enableRecordingCountdown","color: green;");try{this.trackEvent(Z.Events.Recording.ENABLE_RECORDING_COUNTDOWN_TRIGGERED),this.getService(yi).enableRecordingCountdown()}catch(o){this.getService(y).catch("Error in _enableRecordingCountdown: ",o)}}_disableRecordingCountdown(){this.getService(y).log("%c[WB] Calling FUNCTION: disableRecordingCountdown","color: green;");try{this.trackEvent(Z.Events.Recording.DISABLE_RECORDING_COUNTDOWN_TRIGGERED),this.getService(yi).disableRecordingCountdown()}catch(o){this.getService(y).catch("Error in _disableRecordingCountdown: ",o)}}_getRecordingDataByRecorderId(o){this.getService(y).log("%c[WB] Calling FUNCTION: getRecordingDataByRecorderId","color: green;");try{return this.trackEvent(Z.Events.Recording.GET_RECORDING_DATA_BY_RECORDER_ID_TRIGGERED,{payload:{recorderId:o}}),this.getService(Xi).getRecorderDataByRecorderId(o)}catch(t){return this.getService(y).catch("Error in _getRecordingDataByRecorderId: ",t),re(null)}}_getRecordings(o){this.getService(y).log("%c[WB] Calling FUNCTION: getRecordings","color: green;");try{return this.trackEvent(Z.Events.Recording.GET_RECORDINGS_TRIGGERED,{payload:{query:o}}),this.getService(Xi).getRecordings(o)}catch(t){return this.getService(y).catch("Error in _getRecordings: ",t),re([])}}_getRecordingData(o){this.getService(y).log("%c[WB] Calling FUNCTION: getRecordingData","color: green;");try{return this.trackEvent(Z.Events.Recording.GET_RECORDING_DATA_TRIGGERED,{payload:{query:o}}),this.getService(Xi).getRecorderDataByRecorderIds(o)}catch(t){return this.getService(y).catch("Error in _getRecordingData: ",t),Promise.resolve({data:null})}}_fetchRecordings(o){this.getService(y).log("%c[WB] Calling FUNCTION: fetchRecordings","color: green;");try{return this.trackEvent(Z.Events.Recording.FETCH_RECORDINGS_TRIGGERED,{payload:{query:o}}),this.getService(Xi).fetchRecorderDataByRecorderIds(o)}catch(t){return this.getService(y).catch("Error in _fetchRecordings: ",t),Promise.resolve([])}}_enableRecordingTranscription(){this.getService(y).log("%c[WB] Calling FUNCTION: enableRecordingTranscription","color: green;");try{this.trackEvent(Z.Events.Recording.ENABLE_RECORDING_TRANSCRIPTION_TRIGGERED),this.getService(Xi).enableRecordingTranscription()}catch(o){this.getService(y).catch("Error in _enableRecordingTranscription: ",o)}}_disableRecordingTranscription(){this.getService(y).log("%c[WB] Calling FUNCTION: disableRecordingTranscription","color: green;");try{this.trackEvent(Z.Events.Recording.DISABLE_RECORDING_TRANSCRIPTION_TRIGGERED),this.getService(Xi).disableRecordingTranscription()}catch(o){this.getService(y).catch("Error in _disableRecordingTranscription: ",o)}}_on(o){this.getService(y).log("%c[WB] Calling FUNCTION: on","color: green;");try{return this.trackEvent(Z.Events.Recording.ON_ACTION_TRIGGERED,{payload:{action:o}}),this.getService(Ose).onAction(o)}catch(t){return this.getService(y).catch("Error in _on: ",t),re(null)}}_enableVideoEditor(){this.getService(y).log("%c[WB] Calling FUNCTION: enableVideoEditor","color: green;");try{this.trackEvent(Z.Events.Recording.ENABLE_VIDEO_EDITOR_TRIGGERED),this.getService(yi).enableVideoEditor()}catch(o){this.getService(y).catch("Error in _enableVideoEditor: ",o)}}_disableVideoEditor(){this.getService(y).log("%c[WB] Calling FUNCTION: disableVideoEditor","color: green;");try{this.trackEvent(Z.Events.Recording.DISABLE_VIDEO_EDITOR_TRIGGERED),this.getService(yi).disableVideoEditor()}catch(o){this.getService(y).catch("Error in _disableVideoEditor: ",o)}}};var Cc=(()=>{let o=class o{constructor(e,i,r,a,s,c){this.analyticsService=e,this.authService=i,this.configService=r,this.domService=a,this.loggingService=s,this.functions=c,this.rewriterAnnotations$=new fe([]),this.rewriterOptions$=new fe({}),this.rewriterEnabled$=new fe(!1),this.lastOpenAIPromptCalledAt=0,this.getRewriterEnabled$().subscribe(p=>{try{if(p){let h=document.querySelectorAll(U.TAGS.SNIPPYLY_REWRITER);if(!document.querySelectorAll(U.TAGS.VELT_REWRITER)?.length&&!h?.length){let E=document.createElement(U.TAGS.VELT_REWRITER);document.body.appendChild(E),this.authService.getUser$().pipe(Ne(A=>!!A),Je(1)).subscribe(A=>{this.analyticsService.trackEvent(Z.Events.Rewriter.REWRITER_ENABLED,{isMobileDevice:this.domService.isMobileDevice()})})}}else{let h=document.querySelectorAll(U.TAGS.SNIPPYLY_REWRITER);h?.length&&h.forEach(E=>{E.remove()});let _=document.querySelectorAll(U.TAGS.VELT_REWRITER);_?.length&&_.forEach(E=>{E.remove()})}}catch(h){this.loggingService.catch("Error in rewriterEnabled$: ",h)}},p=>{this.loggingService.catch("Error in rewriterEnabled$ subscription: ",p)})}getRewriterAnnotations$(){try{return this.rewriterAnnotations$.asObservable()}catch(e){return this.loggingService.catch("Error in getRewriterAnnotations$(): ",e),re([])}}addRewriter(e,i,r){this.loggingService.log("%c[WB] Calling FUNCTION: addRewriter","color: green;");try{let a=this.authService.getUser();if(a)if(a.isReadOnly||a.isAnonymous)this.loggingService.catch("Anonymous/Readonly users cannot add rewriters.");else{let s=new hM;s.from=a,s.color=U.DEFAULT_ANNOTATION_COLOR,i&&(s.targetTextRange=i),r&&(s.rewriterType=r),this.saveRewriterToDb(s)}}catch(a){this.loggingService.catch("Error in RewriterService addRewriter: ",a)}}saveRewriterToDb(e){this.loggingService.log("%c[WB] Calling FUNCTION: saveRewriterToDb","color: green;");try{e?.annotationId||(e.annotationId=Math.random().toString(36).substring(2)+Date.now().toString(36));let i=this.rewriterAnnotations$.getValue();i.push(e),this.rewriterAnnotations$.next(i),this.domService.toggleAnnotationSelection(e)}catch(i){this.loggingService.catch("Error in RewriterService saveRewriterToDb: ",i)}}removeRewriter(e){try{let i=this.rewriterAnnotations$.getValue(),r=i.findIndex(a=>a.annotationId===e.annotationId);r>-1&&(i.splice(r,1),this.rewriterAnnotations$.next(i))}catch(i){this.loggingService.catch("Error in RewriterService removeRewriter: ",i)}}getRewriterOptions(e,i,r){try{if(this.lastOpenAIPromptCalledAt&&Date.now()-this.lastOpenAIPromptCalledAt<1e3)return this.lastOpenAIPromptCalledAt=Date.now(),re([]);this.lastOpenAIPromptCalledAt=Date.now();let a=Cr(this.functions,Zn.cloudFunction.chatgptCompletion,{timeout:20*60*1e3}),s=i?.[0]?.role==="system"?i?.[0]?.content:null;return this.analyticsService.trackEvent(Z.Events.Rewriter.REWRITE_PROMPT_SUBMITTED,{isMobileDevice:this.domService.isMobileDevice(),prompt:s,type:e}),bo(a({messages:i,type:e,apiKey:this.configService.getApiKey(),sdkVersion:Ta(),sdkType:this.configService.getSdkType()})).pipe(ce(c=>c?.data?c.data:[]))}catch(a){return this.loggingService.catch("Error in RewriterService getRewriterOptions: ",a),re([])}}enableRewriter(){try{this.rewriterEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in RewriterService enableRewriter: ",e)}}disableRewriter(){try{this.rewriterEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in RewriterService disableRewriter: ",e)}}getRewriterEnabled$(){try{return this.rewriterEnabled$.asObservable()}catch(e){return this.loggingService.catch("Error in RewriterService getRewriterEnabled$: ",e),re(!1)}}resetRewriter(){try{this.domService.resetSelectedAnnotationsMap(!1,"rewriter"),this.rewriterAnnotations$.next([])}catch(e){this.loggingService.catch("Error in RewriterService resetRewriter: ",e)}}getChatGPTInput(e,i,r=[]){try{let a="";return e&&(a=`
|
|
383
|
+
`],encapsulation:3,changeDetection:0});let n=o;return n})();var Dse=(()=>{let o=class o{constructor(e,i,r,a){this.componentFactoryResolver=e,this.applicationRef=i,this.injector=r,this.loggingService=a,this.darkMode=!1}createFollowOverlay(e,i){try{let a=this.componentFactoryResolver.resolveComponentFactory(h$).create(this.injector);a.instance.setLeaderName(e),a.instance.closeOverlayEvent.pipe(Je(1)).subscribe(()=>{this.removeOverlay(),i()}),this.applicationRef.attachView(a.hostView),this.overlayRef=a,this.overlayRef.instance.darkMode=this.darkMode;let s=this.overlayRef.location.nativeElement;s.id="snippyly-follow-overlay",s.setAttribute(U.ATTRIBUTES.VELT_IGNORE,""),document.body.appendChild(s)}catch(r){this.loggingService.catch("Error in FlockOverlayService createFollowOverlay: ",r)}}createLeaderOverlay(e){let r=this.componentFactoryResolver.resolveComponentFactory(h$).create(this.injector);r.instance.setType("leading"),r.instance.closeOverlayEvent.pipe(Je(1)).subscribe(()=>{this.removeOverlay(),e()}),this.applicationRef.attachView(r.hostView),this.overlayRef=r,this.overlayRef.instance.darkMode=this.darkMode;let a=this.overlayRef.location.nativeElement;a.id="snippyly-follow-overlay",a.setAttribute(U.ATTRIBUTES.VELT_IGNORE,""),document.body.appendChild(a)}changeLeaderName(e){this.overlayRef&&this.overlayRef.instance.setLeaderName(e)}getLeaderName(){return this.overlayRef?this.overlayRef.instance.getLeaderName():null}removeOverlay(){if(this.overlayRef){let e=this.overlayRef.location.nativeElement;this.applicationRef.detachView(this.overlayRef.hostView),this.overlayRef.destroy(),e.shadowRoot&&e.shadowRoot.removeChild(e.shadowRoot.childNodes[0]),e.remove(),this.overlayRef=void 0}}setDarkMode(e){try{this.darkMode=e,this.overlayRef&&(this.overlayRef.instance.darkMode=e)}catch(i){this.loggingService.catch("Error in FlockOverlayService setDarkMode: ",i)}}};o.\u0275fac=function(i){return new(i||o)(J(Io),J(mi),J(Et),J(y))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var vc=(()=>{let o=class o{constructor(e,i,r,a,s){this.authService=e,this.domService=i,this.loggingService=r,this.flockSessionService=a,this.flockOverlayService=s,this.flockLeader$=new fe({userId:"",name:""}),this.flockMode$=new fe(!1),this.currentFlockUser=null,this.localScrollData=[],this.domSubscriptions=[],this.followOverlayCreated=!1,this.leaderOverlayCreated=!1,this.windowFocused=!0,this.tabFocused=!0,this.useHistoryAPI=!0,this.disableDefaultNavigation=!1;try{this.flockLeader$.subscribe(c=>{let{userId:p,name:h}=c,_=p;if(this.provisionFollowUser(),_&&this.currentFlockUser&&this.currentFlockUser.snippylyId)if(this.currentFlockUser.sessionId){if(this.currentFlockUser.snippylyId&&this.currentFlockUser.isLeader){this.flockSessionService.swapLeader(this.currentFlockUser.snippylyId,_,h);return}this.removeCurrentUserFromSession()}else this.flockSessionService.provisionFlockSession(_,h,this.currentFlockUser.snippylyId)},c=>{this.loggingService.catch("Error in FlockService flockLeader$ subscription: ",c)}),this.flockSessionService.currentSession$.subscribe(c=>{if(c!==null){if(this.currentFlockUser&&(this.currentFlockUser.sessionId===null||this.currentFlockUser.sessionId===void 0)&&this.currentFlockUser.snippylyId&&(this.currentFlockUser.sessionId=c.id,this.flockSessionService.updateRemoteFlockUser(this.currentFlockUser.snippylyId,this.currentFlockUser)),this.currentFlockUser&&!this.currentFlockUser.isLeader&&!this.followOverlayCreated&&(this.leaderOverlayCreated&&(this.flockOverlayService.removeOverlay(),this.leaderOverlayCreated=!1),this.followOverlayCreated=!0,this.flockOverlayService.createFollowOverlay(c.leaderName,()=>{this.removeCurrentUserFromSession(),this.followOverlayCreated=!1})),this.currentFlockUser&&this.currentFlockUser.isLeader&&!this.leaderOverlayCreated&&(this.followOverlayCreated&&(this.flockOverlayService.removeOverlay(),this.followOverlayCreated=!1),this.leaderOverlayCreated=!0,this.flockOverlayService.createLeaderOverlay(()=>{this.removeCurrentUserFromSession(),this.leaderOverlayCreated=!1})),this.currentFlockUser&&!this.currentFlockUser.isLeader&&c.actionStack){let p=c.actionStack[0];p&&this.currentFlockUser.lastProcessedActionTimestamp!==p.timestamp&&this.processAction(p)}if(this.currentFlockUser&&!this.currentFlockUser.isLeader&&this.followOverlayCreated&&this.flockOverlayService.getLeaderName()!==null&&c.leaderName!==this.flockOverlayService.getLeaderName()&&this.flockOverlayService.changeLeaderName(c.leaderName),this.currentFlockUser&&this.currentFlockUser.isLeader){let p=_i();if(c.pageInfo){if(p&&p.url!==c.pageInfo.url){let h=new Td;h.type=Qa.NAVIGATE,this.flockSessionService.addActionToStack(c.id,h)}}else{this.flockSessionService.updateSession(c.id,{pageInfo:p});let h=new Td;h.type=Qa.NAVIGATE,this.flockSessionService.addActionToStack(c.id,h)}}}else this.currentFlockUser&&this.leaderOverlayCreated&&(this.flockOverlayService.removeOverlay(),this.leaderOverlayCreated=!1),this.currentFlockUser&&this.followOverlayCreated&&(this.flockOverlayService.removeOverlay(),this.followOverlayCreated=!1)}),this.flockSessionService.currentUser$.subscribe(c=>{if(c!==null&&(this.currentFlockUser&&this.currentFlockUser.isLeader!==c.isLeader&&(this.domSubscriptions.forEach(p=>p.unsubscribe()),this.domSubscriptions=[]),this.currentFlockUser=c,c.sessionId&&this.domSubscriptions.length===0))if(c.isLeader){if(!this.tabFocused||!this.windowFocused)return;this.subscribeToLeaderDOMEvents()}else this.subscribeToFollowerDOMEvents()}),Dn([this.authService.getUser$(),this.getFlockMode$()]).subscribe(([c,p])=>{c&&c.userSnippylyId&&p?this.flockSessionService.startCurrentFlockUserSubscription(c):this.flockSessionService.stopCurrentFlockUserSubscription()})}catch(c){this.loggingService.catch("Error in FlockService constructor: ",c)}}provisionFollowUser(){try{if(this.currentFlockUser===null){let e=this.authService.getUser();e&&e.userSnippylyId&&(this.currentFlockUser=new UM,this.currentFlockUser.snippylyId=e.userSnippylyId)}}catch(e){this.loggingService.catch("Error in FlockService provisionFollowUser: ",e)}}startFollowingUser(e,i){try{if(this.provisionFollowUser(),e&&this.currentFlockUser&&this.currentFlockUser.snippylyId){if(this.currentFlockUser.sessionId){if(this.currentFlockUser.snippylyId&&this.currentFlockUser.isLeader){this.flockSessionService.swapLeader(this.currentFlockUser.snippylyId,e,i);return}this.removeCurrentUserFromSession()}this.flockSessionService.provisionFlockSession(e,i,this.currentFlockUser.snippylyId)}}catch(r){this.loggingService.catch("Error in FlockService startFollowingUser: ",r)}}stopFollowingUser(){try{this.removeCurrentUserFromSession()}catch(e){this.loggingService.catch("Error in FlockService stopFollowingUser: ",e)}}subscribeToUrlChanges(){try{if(this.useHistoryAPI){let e=window.history.pushState,i=window.history.replaceState;window.history.pushState=(...r)=>{e.apply(window.history,r),this.onUrlChange()},window.history.replaceState=(...r)=>{i.apply(window.history,r),this.onUrlChange()},this.domSubscriptions.push({unsubscribe:()=>{window.history.pushState=e,window.history.replaceState=i}}),this.domSubscriptions.push(oi(window,"popstate").subscribe(()=>{this.onUrlChange()}))}}catch(e){this.loggingService.catch("Error in FlockService subscribeToUrlChanges: ",e)}}onUrlChange(){try{if(this.currentFlockUser&&this.currentFlockUser.sessionId&&this.currentFlockUser.isLeader){let e=new Td;e.type=Qa.NAVIGATE,this.flockSessionService.addActionToStack(this.currentFlockUser.sessionId,e)}}catch(e){this.loggingService.catch("Error in FlockService onUrlChange: ",e)}}processAction(e){try{switch(e.type){case Qa.CLICK:this.clickUserElement(e.data);break;case Qa.HOVER:this.scrollToHoveredElement(e.data);break;case Qa.SCROLL:this.scrollToFollowedUser(e.data);break;case Qa.NAVIGATE:this.checkMatchingUrl(e.pageInfo);break}this.currentFlockUser&&this.currentFlockUser.snippylyId&&this.flockSessionService.updateRemoteFlockUser(this.currentFlockUser.snippylyId,{lastProcessedActionTimestamp:e.timestamp})}catch(i){this.loggingService.catch("Error in FlockService processAction: ",i)}}subscribeToLeaderDOMEvents(){try{this.domSubscriptions.length>0&&(this.domSubscriptions.forEach(e=>e.unsubscribe()),this.domSubscriptions=[]),this.domSubscriptions.push(oi(window,"mouseover").pipe(jr(500)).subscribe(e=>{let i=e?.target;if(i){let r=window.getComputedStyle(i);if(r.position==="fixed"||r.position==="sticky"||i.hasAttribute(U.ATTRIBUTES.VELT_IGNORE))return;i=SV(i,{x:e.clientX,y:e.clientY}),this.updateHoveredElement(i)}})),this.domSubscriptions.push(this.domService.onWindowClick$().subscribe(e=>{let i=e?.target;if(i){if(i.hasAttribute(U.ATTRIBUTES.VELT_IGNORE))return;this.updateClickedElement(i)}})),this.subscribeToUrlChanges(),this.subscribeToScrollables()}catch(e){this.loggingService.catch("Error in FlockService subscribeToLeaderDOMEvents: ",e)}}subscribeToFollowerDOMEvents(){}updateClickedElement(e){try{if(this.currentFlockUser&&this.currentFlockUser.sessionId){let i=this.domService.getXPath(e),r=ov(e),a=this.domService.getXPath(r),s={id:Math.random().toString(36).substring(2),xpath:i,parentXpath:a},c=new Td;c.type=Qa.CLICK,c.data=s,this.flockSessionService.addActionToStack(this.currentFlockUser.sessionId,c)}}catch(i){this.loggingService.catch("Error in FlockService updateClickedElement: ",i)}}updateHoveredElement(e){try{if(this.currentFlockUser&&this.currentFlockUser.sessionId){let i=this.domService.getXPath(e),r=ov(e),a=this.domService.getXPath(r),s={id:Math.random().toString(36).substring(2),xpath:i,parentXpath:a},c=new Td;c.type=Qa.HOVER,c.data=s,this.flockSessionService.addActionToStack(this.currentFlockUser.sessionId,c)}}catch(i){this.loggingService.catch("Error in FlockService updateHoveredElement: ",i)}}subscribeToScrollables(){try{let e=Wie();e.push(document),e?.forEach(i=>{this.domSubscriptions.push(oi(i,"scroll").pipe(jr(100)).subscribe(r=>{this.currentFlockUser&&this.currentFlockUser.sessionId&&this.currentFlockUser.isLeader&&this.updateScrollPositionOfElement(i)}))})}catch(e){this.loggingService.catch("Error in FlockService getScrollableElements: ",e)}}updateScrollPositionOfElement(e){try{if(this.currentFlockUser&&this.currentFlockUser.sessionId){let i=new VM("","");if(e===document){let s=Kie();if(s){let c=SV(s);c&&(i.targetXpath=this.domService.getXPath(c))}i.xpath=""}else{let s=Yie(e);i.targetXpath=this.domService.getXPath(s),i.xpath=this.domService.getXPath(e)}let r=!1,a=!1;if(this.localScrollData.forEach((s,c)=>{s.xpath===s.xpath&&(i.targetXpath!==s.targetXpath&&(r=!0),this.localScrollData[c]=Object.assign(s,i),a=!0)}),a||this.localScrollData.push(i),r||!a){let s=new Td;s.type=Qa.SCROLL,s.data=i,this.flockSessionService.addActionToStack(this.currentFlockUser.sessionId,s)}}}catch(i){this.loggingService.catch("Error in FlockService calculateScrollPositionOfAnElement: ",i)}}enableFlockMode(e){try{if(this.flockMode$.next(!0),e){let{useHistoryAPI:i,onNavigate:r,disableDefaultNavigation:a,darkMode:s}=e;i!==void 0&&(this.useHistoryAPI=i),r!==void 0&&typeof r=="function"&&(this.onNavigate=r),a!==void 0&&(this.disableDefaultNavigation=a),this.flockOverlayService.setDarkMode(s)}}catch(i){this.loggingService.catch("Error in FlockService enableFlockMode: ",i)}}disableFlockMode(){try{this.flockMode$.next(!1),this.onNavigateEmitter=void 0,this.useHistoryAPI=!0,this.onNavigate=void 0}catch(e){this.loggingService.catch("Error in FlockService disableFlockMode: ",e)}}setDisableFlockNavigation(e){try{this.disableDefaultNavigation=e}catch(i){this.loggingService.catch("Error in FlockService setDisableFlockNavigation: ",i)}}getFlockMode$(){return this.flockMode$.asObservable()}getFlockMode(){return this.flockMode$.value}setNavigateEmitter(e){try{this.onNavigateEmitter=e}catch(i){this.loggingService.catch("Error in FlockService setNavigateEmitter: ",i)}}setTabFocused(e){try{if(this.tabFocused=e,!this.currentFlockUser)return;this.currentFlockUser.isLeader&&this.currentFlockUser.sessionId&&(this.tabFocused&&this.domSubscriptions.length===0?this.subscribeToLeaderDOMEvents():!this.tabFocused&&this.domSubscriptions.length>0&&(this.domSubscriptions.forEach(r=>{r.unsubscribe()}),this.domSubscriptions=[]))}catch(i){this.loggingService.catch("Error in FlockService setTabFocused: ",i)}}setWindowFocused(e){try{if(this.windowFocused=e,!this.currentFlockUser)return;this.currentFlockUser.isLeader&&this.currentFlockUser.sessionId&&(this.windowFocused&&this.domSubscriptions.length===0?this.subscribeToLeaderDOMEvents():!this.windowFocused&&this.domSubscriptions.length>0&&(this.domSubscriptions.forEach(r=>{r.unsubscribe()}),this.domSubscriptions=[]))}catch(i){this.loggingService.catch("Error in FlockService setWindowFocused: ",i)}}setFlockLeader(e,i){try{this.flockLeader$.next({userId:e,name:i})}catch(r){this.loggingService.catch("Error in FlockService setFlockLeader: ",r)}}isInSession(){try{return!!(this.currentFlockUser&&this.currentFlockUser.sessionId)}catch(e){this.loggingService.catch("Error in FlockService isFollowing: ",e)}return!1}removeCurrentUserFromSession(){try{this.domSubscriptions.forEach(e=>e.unsubscribe()),this.domSubscriptions=[],this.currentFlockUser&&(this.currentFlockUser.isLeader?this.currentFlockUser.sessionId&&this.flockSessionService.deleteSession(this.currentFlockUser.sessionId):this.currentFlockUser.snippylyId&&this.flockSessionService.removeFollowerFromCurrentSession(this.currentFlockUser.snippylyId))}catch(e){this.loggingService.catch("Error in FlockService removeCurrentUserFromSession: ",e)}}checkMatchingUrl(e){try{let r=_i()?.url,a=e.url;if(r!==a&&a!==void 0){let{url:s,path:c,baseUrl:p}=e;if(this.onNavigate!==void 0&&typeof this.onNavigate=="function"){this.onNavigate({url:s,path:c,baseUrl:p});return}if(this.onNavigateEmitter&&this.onNavigateEmitter.emit({url:s,path:c,baseUrl:p}),this.disableDefaultNavigation)return;window.location.href=a}}catch(i){this.loggingService.catch("Error in FlockService checkMatchingUrl: ",i)}}scrollToFollowedUser(e){try{if(e.xpath===""){let i=this.domService.getElementFromXPath(e.targetXpath);i&&XO(i)}else{let i=this.domService.getElementFromXPath(e.xpath),r=this.domService.getElementFromXPath(e.targetXpath);i&&r&&(XO(i),bV(i,r))}}catch(i){this.loggingService.catch("Error in FlockService scrollToFollowedUser: ",i)}}clickUserElement(e){try{let i=this.domService.getElementFromXPath(e.xpath);i&&this.lastClickedElement?.id!==e.id&&(i?.click(),this.lastClickedElement=e)}catch(i){this.loggingService.catch("Error in FlockService clickUserElement: ",i)}}scrollToHoveredElement(e){try{let i=this.domService.getElementFromXPath(e.xpath);if(i&&e.parentXpath)if(e.parentXpath==="/html")XO(i);else{let r=this.domService.getElementFromXPath(e.parentXpath);r&&bV(r,i,!0)}}catch(i){this.loggingService.catch("Error in FlockService clickUserElement: ",i)}}};o.\u0275fac=function(i){return new(i||o)(J(je),J(Fe),J(y),J(Tse),J(Dse))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Di=(()=>{let o=class o{constructor(e,i,r,a,s,c,p,h,_,E){this.afAuth=e,this.analyticsService=i,this.authService=r,this.configService=a,this.databaseService=s,this.docService=c,this.domService=p,this.iamService=h,this.loggingService=_,this.commonDbService=E,this.db=Ci(),this.liveStateDataMap$=new fe({}),this.liveStateDataMapDraft={},this.singleEditorMode$=new fe(!1),this.singleEditorModeConfig$=new fe(null),this.singleEditorLiveStateData$=new fe(null),this.singleEditorLiveStateData={},this.editorAccessTimeout$=new fe(U.LIVE_STATE_REQUEST_EDITOR_ACCESS_WAIT_TIME),this.editorAccessTransferOnTimeOut$=new fe(!0),this.defaultSingleEditorUIEnabled$=new fe(!0),this.editorAccessTimer$=new fe(new Bv),this.autoSyncState$=new fe(!1),this.serverConnectionState$=new fe(gl.PENDING_INIT),this.user=null,this.keydownSubscription=null,this.isEditor$=new fe(null),this.preventEventsOnElementMap={},this.PREVENT_EVENTS=["click","mouseup","mousedown"],this.autoSyncStateHistory=null,this.singleEditorModeContainerIds$=new fe([]),this.inputChangeSubscriptionMap={},this.childListMutationSubscription=null,this.tabId=this.domService.getTabId();try{this.loggingService.log("%c[WB] Creating CLASS: LiveStateService","color: blue;"),this.databaseService.getDb().pipe(Ne(A=>!!A),Je(1)).subscribe(A=>{A&&(this.db=A,this.getUser(),this.getDocumentPaths(),this.subscribeLiveStateData().subscribe(),this.singleEditorMode$.subscribe(V=>{V&&this.detectKeydownOnInput()}),this.autoSyncState$.subscribe(V=>{V?(this.detectLiveSyncInputs(),this.observeElementAddedOnDom()):(this.unsubscribeInputChanges(),this.childListMutationSubscription?.unsubscribe(),this.childListMutationSubscription=null)}),this.updateOnDatabaseDisconnect().subscribe(()=>{},V=>{this.loggingService.catch("Error in LiveStateService constructor updateOnDatabaseDisconnect: ",V)}),this.updateServerStateOnDatabaseDisconnect().subscribe(()=>{},V=>{this.loggingService.catch("Error in LiveStateService constructor updateServerStateOnDatabaseDisconnect: ",V)}))},A=>{this.loggingService.catch("Error in LiveStateService getDb subscription: ",A)}),this.liveStateDataMap$.pipe(Ne(A=>!!A?.default?.autoSyncState),ce(A=>A.default?.autoSyncState),Kt((A,V)=>JSON.stringify(A||{})===JSON.stringify(V||{}))).subscribe(A=>{A&&(this.getAutoSyncState()&&(!this.autoSyncStateHistory&&A?.history&&this.updateLiveStateSyncInputDataLocally(A.history),A?.current&&this.updateLiveStateSyncInputDataLocally({[A.current.liveStateDataId]:A.current})),!this.autoSyncStateHistory&&A?.history&&(this.autoSyncStateHistory=A.history))}),this.docService.addPreDocumentIdChangeFunction("live-state-service",A=>this.isUserEditor()?.isEditor&&(!this.getSingleEditorModeConfig()?.singleTabEditor||this.isUserEditor()?.isEditorOnCurrentTab)?this.removeEditorAccess():Promise.resolve())}catch(A){this.loggingService.catch("Error in LiveStateService constructor: ",A)}}observeElementAddedOnDom(){try{this.loggingService.log("%c[WB] Calling FUNCTION: observeElementAddedOnDom","color: green;"),this.childListMutationSubscription&&(this.childListMutationSubscription.unsubscribe(),this.childListMutationSubscription=null),this.childListMutationSubscription=this.domService.getChildListMutation$().subscribe(e=>{e?.length&&e.forEach(i=>{let r=Array.from(i.addedNodes||[]).filter(a=>a instanceof HTMLElement);r?.forEach(a=>{xV(a,!0)?.forEach(p=>{typeof p?.getAttribute=="function"&&p?.getAttribute(U.ATTRIBUTES.VELT_SYNC_STATE)&&this.subscribeInputChanges(p)})}),r?.length&&this.isEditor$?.value?.isEditor===!1&&(this.disableInputElements(),this.disableElementEvents())})},e=>{this.loggingService.catch("Error in LiveStateService domService getChildListMutation$ subscription: ",e)})}catch(e){this.loggingService.catch("Error in LiveStateService observeElementAddedOnDom: ",e)}}detectKeydownOnInput(){try{this.loggingService.log("%c[WB] Calling FUNCTION: detectKeydownOnInput","color: green;"),this.unsubscribeKeydownSubscription(),this.keydownSubscription=this.domService.onWindowKeydown$().pipe(Ne(e=>e?.target instanceof HTMLInputElement||e?.target instanceof HTMLTextAreaElement||e?.target instanceof HTMLSelectElement),Ne(e=>!!this.isElementInsideSingleEditorModeContainerElements(e?.target)),Je(1)).subscribe(e=>{this.unsubscribeKeydownSubscription(),this.getSingleEditorModeConfig()?.customMode||this.setUserAsEditor()},e=>{this.loggingService.catch("Error in LiveStateService detectKeydownOnInput subscription: ",e)})}catch(e){this.loggingService.catch("Error in LiveStateService detectKeydownOnInput: ",e)}}unsubscribeKeydownSubscription(){try{this.loggingService.log("%c[WB] Calling FUNCTION: unsubscribeKeydownSubscription","color: green;"),this.keydownSubscription&&(this.keydownSubscription.unsubscribe(),this.keydownSubscription=null)}catch(e){this.loggingService.catch("Error in LiveStateService unsubscribeKeydownSubscription: ",e)}}getDocumentPaths(){try{this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentPaths","color: green;"),this.docService.getDocumentPaths$().subscribe(e=>{this.documentPaths=e,this.updateLiveStateDataFromDraft()})}catch(e){this.loggingService.catch("Error in LiveStateService getDocumentPaths: ",e)}}getUser(){try{this.loggingService.log("%c[WB] Calling FUNCTION: getUser","color: green;"),this.authService.getUser$().subscribe(e=>{this.user=e,this.updateLiveStateDataFromDraft()})}catch(e){this.loggingService.catch("Error in LiveStateService getUser: ",e)}}updateLiveStateDataFromDraft(){try{this.loggingService.log("%c[WB] Calling FUNCTION: updateLiveStateDataFromDraft","color: green;"),this.liveStateDataMapDraft?.custom&&this.user&&this.documentPaths&&(Object.keys(this.liveStateDataMapDraft.custom).forEach(e=>{this.setLiveStateData(e,this.liveStateDataMapDraft.custom[e])}),this.liveStateDataMapDraft={})}catch(e){this.loggingService.catch("Error in LiveStateService updateLiveStateDataFromDraft: ",e)}}subscribeLiveStateData(){return this.loggingService.log("%c[WB] Calling FUNCTION: getOnlineUsersOnCurrentDocument","color: green;"),Wn(this.afAuth).pipe(Ne(e=>!!e),ge(e=>this.isFeatureAllowed({firebaseUser:e,liveStateData:{}})),ge(e=>e.featureAllowed?this.iamService.isUserAllowed$().pipe(ce(i=>(e.featureAllowed=i,e))):re(e)),ge(e=>e.featureAllowed?this.authService.isPlanExpired$().pipe(ce(i=>(e.featureAllowed=!i,e))):re(e)),ge(e=>e.featureAllowed?re(e).pipe(ge(i=>this.docService.getDocumentPaths$().pipe(ce(r=>(this.documentPaths=r,i.documentPaths=r,i)))),In(i=>{this.serverConnectionState$?.value===gl.PENDING_INIT&&i?.documentPaths?.liveState&&this.serverConnectionState$.next(gl.PENDING_DATA)}),ge(i=>this.getDataFromDocumentId().pipe(ce(r=>(i.liveStateData=r,I({},i))))),ge(i=>this.getSingleEditorMode$().pipe(ce(()=>i))),ce(i=>{if(this.serverConnectionState$?.value!==gl.ONLINE&&this.serverConnectionState$.next(gl.ONLINE),i.liveStateData)this.liveStateDataMap$.next(i.liveStateData);else{let r=this.liveStateDataMap$.value;r&&Object.keys(r).length>0&&this.liveStateDataMap$.next({})}this.getSingleEditorMode()&&this.updateSingleEditorLiveSyncData(i?.liveStateData?.default?.singleEditorMode||{})})):re({})))}updateSingleEditorLiveSyncData(e){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: updateSingleEditorLiveSyncData","color: green;"),Co(e,{})&&!this.keydownSubscription&&this.detectKeydownOnInput(),e&&!e?.editor&&this.isEditor$?.value!==void 0&&this.isEditor$.next(void 0),Co(this.singleEditorLiveStateData,e))return;if(this.singleEditorLiveStateData=e,this.singleEditorLiveStateData$.next(e),this.singleEditorLiveStateData?.editor){let i=this.authService.getUser();this.singleEditorLiveStateData?.editor?.userId!==i?.userId?this.makeReader():this.makeEditor()}else this.isEditor$?.value!==void 0&&this.isEditor$.next(void 0),this.enableInputElements(),this.enableElementEvents();this.editorAccessTimerInterval&&this.singleEditorLiveStateData?.requestEditorAccess?.status!=="pending"&&this.clearEditorAccessTimerInterval(),this.requestAccessTimer&&this.singleEditorLiveStateData?.requestEditorAccess?.status!=="pending"?this.clearRequestAccessTimer():this.singleEditorLiveStateData?.requestEditorAccess?.status==="pending"&&this.isUserEditor()?.isEditor&&this.isUserEditor()?.isEditorOnCurrentTab&&this.setRequestAccessTimer(this.singleEditorLiveStateData?.requestEditorAccess?.editorAccessTimeout||U.LIVE_STATE_REQUEST_EDITOR_ACCESS_WAIT_TIME)}catch{}}isFeatureAllowed(e){return this.configService.getConfig$().pipe(Ne(i=>!!i),ce(i=>T(I({},e),{config:i})),ge(i=>this.authService.getUser$().pipe(ce(r=>T(I({},i),{user:r})))),ge(i=>Zi(i.config,i.user,Re.LIVE_STATE_SYNC)?re(T(I({},i),{featureAllowed:!0})):(this.loggingService.warn("Live state sync feature is not allowed."),re(T(I({},i),{featureAllowed:!1})))))}getDataFromDocumentId(e){return this.databaseService.getDb().pipe(Ne(i=>!!i),ge(i=>(this.db=i,this.configService?.getApiKey()&&this.documentPaths?.liveState?this.commonDbService.dbListener({feature:"allLiveStates",properties:{documentId:e??this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(ce(r=>r?.data),Ln(r=>(this.loggingService.catch("Error in LiveStateService getDataFromDocumentId: ",r),re({})))):re({}))))}getLiveStateData$(e,i){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getLiveStateData$","color: green;"),Wn(this.afAuth).pipe(Ne(r=>!!r),ge(r=>this.isFeatureAllowed({firebaseUser:r,liveStateData:{}})),ge(r=>r.featureAllowed?this.iamService.isUserAllowed$().pipe(ce(a=>(r.featureAllowed=a,r))):re(r)),ge(r=>r.featureAllowed?this.authService.isPlanExpired$().pipe(ce(a=>(r.featureAllowed=!a,r))):re(r)),ge(r=>r.featureAllowed?re(r).pipe(ge(a=>this.docService.getDocumentPaths$().pipe(ce(s=>(this.documentPaths=s,a.documentPaths=s,a)))),ge(a=>{let s=i?.listenToNewChangesOnly?1:0;return this.getLiveStateDataFromDatabase$(e).pipe(xs(s))}),ce(a=>{if(a)if(e){let s=Rt(e+""),c=a?.[s];if(c){let p=c?.data;if(c?.tabId&&this.tabId&&c?.tabId===this.tabId)return;if(c?.isDataStringified&&typeof p=="string")try{p=JSON.parse(p)}catch{}return p}else return}else{let s={};return Object.keys(a||{}).forEach(c=>{if(a[c]?.liveStateDataId){let p=a[c],h=p?.data;if(p?.isDataStringified&&typeof h=="string")try{h=JSON.parse(h)}catch{}s[p.liveStateDataId]=h}}),s}return a})):re(void 0).pipe(Ne(Boolean))),Kt((r,a)=>JSON.stringify(r||{})===JSON.stringify(a||{})),Ne(r=>r!==void 0),ce(r=>r))}catch(r){return this.loggingService.catch("Error in LiveStateService getLiveStateData$: ",r),re(null)}}getLiveStateDataFromDatabase$(e){try{return this.databaseService.getDb().pipe(Ne(i=>!!i),ge(i=>{this.db=i;let r=e?Rt(e+""):void 0;return this.configService?.getApiKey()&&this.documentPaths?.liveState?this.commonDbService.dbListener({feature:r?"liveStateCustom":"allLiveStateCustoms",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,id:r,skipFirestore:!0}}).pipe(ce(a=>a?.data),ce(a=>{if(a)return r?{[r]:a}:a}),Ln(a=>(this.loggingService.catch("Error in LiveStateService getLiveStateDataFromDatabase$: ",a),re(null)))):re(void 0)}))}catch(i){return this.loggingService.catch("Error in LiveStateService getLiveStateDataFromDatabase$: ",i),re(void 0)}}setLiveStateData(e,i,r){return ee(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: setLiveStateData","color: green;");try{let a=this.authService.getUser();if(e&&this.documentPaths?.liveState&&a){let s=Rt(e+""),c=!1;try{if(r?.merge&&typeof i=="object"){let h=yield this.commonDbService.getData({feature:"liveStateCustom",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:s,skipFirestore:!0}});if(h?.isDataStringified){let _=JSON.parse(h?.data);typeof i=="object"&&(i=I(I({},_),i))}}}catch{}try{typeof i=="object"&&(i=JSON.stringify(i),c=!0)}catch{}let p={id:s,lastUpdated:this.timestamp,liveStateDataId:e,data:i,updatedBy:a,tabId:this.tabId,isDataStringified:c};yield this.commonDbService.setData({feature:"liveStateCustom",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:s,skipFirestore:!0},data:JSON.parse(JSON.stringify(p))})}else this.loggingService.warn("liveStateDataId or documentPaths or user is null"),this.liveStateDataMapDraft?.custom||(this.liveStateDataMapDraft.custom={}),e&&(this.liveStateDataMapDraft.custom[e]=i)}catch(a){this.loggingService.catch("Error in LiveStateService _setLiveStateData: ",a)}})}getFormElements(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getInputElements","color: green;"),document.querySelectorAll("input, textarea, select, button, [contenteditable]")}catch(e){return this.loggingService.catch("Error in LiveStateService getInputElements: ",e),null}}disableInputElements(){try{this.loggingService.log("%c[WB] Calling FUNCTION: disableInputElements","color: green;"),this.getFormElements()?.forEach(i=>{if(this.isElementInsideSingleEditorModeContainerElements(i)&&!this.isSingleEditorModeDisabledForElement(i)&&!Ui(i)){let r=i?.hasAttribute("disabled");i?.hasAttribute("contenteditable")&&(r=i?.getAttribute("contenteditable")==="false"),r||(i.setAttribute("disabled","true"),i.setAttribute(U.ATTRIBUTES.VELT_SYNC_ACCESS_AUTO,"true"),i?.hasAttribute("contenteditable")&&i.setAttribute("contenteditable","false"))}})}catch(e){this.loggingService.catch("Error in LiveStateService disableInputElements: ",e)}}enableInputElements(){try{this.loggingService.log("%c[WB] Calling FUNCTION: enableInputElements","color: green;"),this.getFormElements()?.forEach(i=>{i?.hasAttribute(U.ATTRIBUTES.VELT_SYNC_ACCESS_AUTO)&&(i.removeAttribute("disabled"),i.removeAttribute(U.ATTRIBUTES.VELT_SYNC_ACCESS_AUTO),i?.getAttribute("contenteditable")&&i.setAttribute("contenteditable","true"))})}catch(e){this.loggingService.catch("Error in LiveStateService enableInputElements: ",e)}}disableElementEvents(){try{this.loggingService.log("%c[WB] Calling FUNCTION: disableElementEvents","color: green;"),document.querySelectorAll(`[${U.ATTRIBUTES.VELT_SYNC_ACCESS}]`)?.forEach(i=>{let r=this.domService.getXPath(i);r&&!this.preventEventsOnElementMap[r]&&(this.preventEventsOnElementMap[r]={element:i,events:{}},this.PREVENT_EVENTS.forEach(a=>{let s=oi(i,a,{capture:!0}).subscribe(c=>{try{c.preventDefault(),c.stopPropagation()}catch(p){this.loggingService.catch("Error in LiveStateService disableElementEvents subscription: ",p)}});this.preventEventsOnElementMap[r]?.events[a]?.unsubscribe(),this.preventEventsOnElementMap[r].events[a]=s}))})}catch(e){this.loggingService.catch("Error in LiveStateService disableElementClicks: ",e)}}enableElementEvents(){try{this.loggingService.log("%c[WB] Calling FUNCTION: enableElementEvents","color: green;"),Object.keys(this.preventEventsOnElementMap).forEach(e=>{let i=this.preventEventsOnElementMap[e];Object.keys(i.events||{}).forEach(r=>{i?.events[r]?.unsubscribe()})}),this.preventEventsOnElementMap={}}catch(e){this.loggingService.catch("Error in LiveStateService enableElementClicks: ",e)}}setUserAsEditor(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: setUserAsEditor","color: green;"),this.user&&this.documentPaths?.liveStateSingleEditorMode){let e={editor:this.user,tabId:this.tabId,editorAt:this.timestamp};this.commonDbService.setData({feature:"liveStateSingleEditorMode",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",skipFirestore:!0},data:JSON.parse(JSON.stringify(e))}),this.analyticsService.trackEvent(Z.Events.LiveStateSync.SET_USER_AS_EDITOR_TRIGGERED,{editorUserId:this.user?.userSnippylyId,tabId:this.tabId})}}catch(e){this.loggingService.catch("Error in LiveStateService setUserAsEditor: ",e)}}setRequestAccessTimer(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setRequestAccessTimer","color: green;"),this.requestAccessTimer||(this.requestAccessTimer=setTimeout(()=>{this.getEditorAccessTransferOnTimeOut()&&this.acceptEditorAccessRequest(),this.clearRequestAccessTimer()},e*1e3),this.setEditorAccessTimerInterval(e))}catch(i){this.loggingService.catch("Error in LiveStateService setRequestAccessTimer: ",i)}}clearRequestAccessTimer(){try{this.loggingService.log("%c[WB] Calling FUNCTION: clearRequestAccessTimer","color: green;"),this.requestAccessTimer&&(clearTimeout(this.requestAccessTimer),this.requestAccessTimer=null)}catch(e){this.loggingService.catch("Error in LiveStateService clearRequestAccessTimer: ",e)}}requestEditorAccess(){this.loggingService.log("%c[WB] Calling FUNCTION: requestEditorAccess","color: green;");try{return this.analyticsService.trackEvent(Z.Events.LiveStateSync.REQUEST_EDITOR_ACCESS_TRIGGERED),new Ft(e=>{let i=null;try{if(this.user&&this.documentPaths?.liveStateSingleEditorMode){let r=this.getEditorAccessTimeout(),a=on(this.db,`${this.documentPaths?.liveStateSingleEditorMode}`),s={requestEditorAccess:{user:this.user,requestedAt:this.timestamp,status:"pending",editorAccessTimeout:r,tabId:this.tabId}};this.commonDbService.updateData({feature:"liveStateSingleEditorMode",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",skipFirestore:!0},errorCallback:c=>{this.loggingService.catch("Error in LiveStateService requestEditorAccess: ",c),e.next(null),e.complete()},callback:()=>{r&&(this.requestAccessTimer=setTimeout(()=>{this.getEditorAccessTransferOnTimeOut()&&this.setUserAsEditor()},(r+3)*1e3),this.setEditorAccessTimerInterval(r+3)),i=this.getSingleEditorLiveStateData$().subscribe(c=>{c&&(c?.requestEditorAccess?c?.requestEditorAccess?.status==="cancelled"&&(e.next(null),e.complete()):c?.editor?.userId===this.user?.userId?(e.next(!0),e.complete()):(e.next(!1),e.complete()))})},data:JSON.parse(JSON.stringify(s))})}else e.next(!1),e.complete()}catch(r){this.loggingService.catch("Error in LiveStateService requestEditorAccess: ",r),e.next(null),e.complete()}return()=>{i&&i?.unsubscribe()}})}catch(e){return this.loggingService.catch("Error in LiveStateService requestEditorAccess: ",e),re(null)}}makeEditor(){try{this.loggingService.log("%c[WB] Calling FUNCTION: makeEditor","color: green;");let e=this.singleEditorLiveStateData?.tabId===this.tabId;this.isEditor$.next({isEditor:!0,isEditorOnCurrentTab:e}),this.getSingleEditorModeConfig()?.customMode||(!this.getSingleEditorModeConfig()?.singleTabEditor||e?(this.enableInputElements(),this.enableElementEvents()):(this.disableInputElements(),this.disableElementEvents()))}catch(e){this.loggingService.catch("Error in LiveStateService makeEditor: ",e)}}makeReader(){try{this.loggingService.log("%c[WB] Calling FUNCTION: makeReader","color: green;"),this.isEditor$.next({isEditor:!1,isEditorOnCurrentTab:!1}),this.getSingleEditorModeConfig()?.customMode||(this.disableInputElements(),this.disableElementEvents())}catch(e){this.loggingService.catch("Error in makeReader: ",e)}}acceptEditorAccessRequest(){return ee(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: acceptEditorAccessRequest","color: green;"),this.user&&this.singleEditorLiveStateData?.requestEditorAccess&&this.isUserEditor()?.isEditor&&this.documentPaths?.liveStateSingleEditorMode){let e=this.singleEditorLiveStateData?.requestEditorAccess?.user,i=this.singleEditorLiveStateData?.requestEditorAccess?.tabId;if(e&&i){let r={editor:e,requestEditorAccess:null,tabId:i,editorAt:this.timestamp};this.commonDbService.updateData({feature:"liveStateSingleEditorMode",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",skipFirestore:!0},data:JSON.parse(JSON.stringify(r))}),this.analyticsService.trackEvent(Z.Events.LiveStateSync.ACCEPT_EDITOR_ACCESS_REQUEST_TRIGGERED,{editorUserId:e?.userSnippylyId,tabId:i})}}}catch(e){this.loggingService.catch("Error in acceptEditorAccessRequest: ",e)}})}rejectEditorAccessRequest(){return ee(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: rejectEditorAccessRequest","color: green;"),this.user&&this.singleEditorLiveStateData?.requestEditorAccess&&this.isUserEditor()?.isEditor&&this.documentPaths?.liveStateSingleEditorMode){let e={requestEditorAccess:null};this.commonDbService.updateData({feature:"liveStateSingleEditorMode",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",skipFirestore:!0},data:JSON.parse(JSON.stringify(e))}),this.analyticsService.trackEvent(Z.Events.LiveStateSync.REJECT_EDITOR_ACCESS_REQUEST_TRIGGERED)}}catch(e){this.loggingService.catch("Error in LiveStateService rejectEditorAccessRequest: ",e)}})}cancelEditorAccessRequest(){return ee(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: cancelEditorAccessRequest","color: green;"),this.user&&this.singleEditorLiveStateData?.requestEditorAccess&&this.documentPaths?.liveStateSingleEditorMode){let e={requestEditorAccess:T(I({},this.singleEditorLiveStateData?.requestEditorAccess),{status:"cancelled"})};this.commonDbService.updateData({feature:"liveStateSingleEditorMode",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",skipFirestore:!0},data:JSON.parse(JSON.stringify(e))}),e={requestEditorAccess:null},this.commonDbService.updateData({feature:"liveStateSingleEditorMode",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",skipFirestore:!0},data:JSON.parse(JSON.stringify(e))}),this.analyticsService.trackEvent(Z.Events.LiveStateSync.CANCEL_EDITOR_ACCESS_REQUEST_TRIGGERED)}}catch(e){this.loggingService.catch("Error in LiveStateService cancelEditorAccessRequest: ",e)}})}editCurrentTab(){return ee(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: editCurrentTab","color: green;"),this.user&&this.isUserEditor()?.isEditor&&!this.isUserEditor()?.isEditorOnCurrentTab&&this.documentPaths?.liveStateSingleEditorMode){let e={tabId:this.tabId};this.commonDbService.updateData({feature:"liveStateSingleEditorMode",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",skipFirestore:!0},data:JSON.parse(JSON.stringify(e))}),this.analyticsService.trackEvent(Z.Events.LiveStateSync.EDIT_CURRENT_TAB_TRIGGERED,{tabId:this.tabId})}}catch(e){this.loggingService.catch("Error in LiveStateService editCurrentTab: ",e)}})}isUserEditor$(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: isUserEditor$","color: green;"),this.isEditor$.asObservable()}catch(e){return this.loggingService.catch("Error in LiveStateService isUserEditor$: ",e),re(null)}}isUserEditor(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: isUserEditor","color: green;"),this.isEditor$.value}catch(e){return this.loggingService.catch("Error in LiveStateService isUserEditor: ",e),null}}getEditor$(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getEditor$","color: green;"),this.getSingleEditorLiveStateData$().pipe(ce(e=>e?.editor||null),Kt())}catch(e){return this.loggingService.catch("Error in LiveStateService getEditor$: ",e),re(null)}}isEditorAccessRequested$(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: isEditorAccessRequested$","color: green;"),this.isUserEditor$().pipe(ge(e=>e?.isEditor?this.singleEditorLiveStateData$.pipe(ce(i=>i?.requestEditorAccess?{requestStatus:"requested",requestedBy:i?.requestEditorAccess?.user}:null)):re(null)),Kt((e,i)=>JSON.stringify(e||{})===JSON.stringify(i||{})))}catch(e){return this.loggingService.catch("Error in LiveStateService isEditorAccessRequested$: ",e),re(null)}}removeEditorAccess(){return ee(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeEditorAccess","color: green;"),(this.user||this.authService.getAuthUser())&&this.documentPaths?.liveStateSingleEditorMode&&(yield this.commonDbService.deleteData({feature:"liveStateSingleEditorMode",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",skipFirestore:!0}}))}catch(e){this.loggingService.catch("Error in LiveStateService removeEditorAccess: ",e)}})}getSingleEditorLiveStateData$(){return this.singleEditorLiveStateData$.asObservable()}enableSingleEditorMode(e){try{if(this.singleEditorMode$.value===!0)return;this.singleEditorMode$.next(!0),e?this.singleEditorModeConfig$.next(e):this.singleEditorModeConfig$.next(new cM)}catch(i){this.loggingService.catch("Error in LiveStateService enableSingleEditorMode: ",i)}}disableSingleEditorMode(){try{if(this.singleEditorMode$.value===!1)return;this.singleEditorMode$.next(!1)}catch(e){this.loggingService.catch("Error in LiveStateService disableSingleEditorMode: ",e)}}getSingleEditorMode$(){return this.singleEditorMode$.asObservable()}getSingleEditorMode(){return this.singleEditorMode$.value}getSingleEditorModeConfig$(){return this.singleEditorModeConfig$.asObservable()}getSingleEditorModeConfig(){return this.singleEditorModeConfig$.value}enableAutoSyncState(){try{if(this.autoSyncState$.value===!0)return;this.autoSyncState$.next(!0)}catch(e){this.loggingService.catch("Error in LiveStateService enableAutoSyncState: ",e)}}disableAutoSyncState(){try{if(this.autoSyncState$.value===!1)return;this.autoSyncState$.next(!1)}catch(e){this.loggingService.catch("Error in LiveStateService disableAutoSyncState: ",e)}}getAutoSyncState$(){return this.autoSyncState$.asObservable()}getAutoSyncState(){return this.autoSyncState$.value}setEditorAccessTimeout(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setEditorAccessTimeout","color: green;"),e&&this.editorAccessTimeout$.next(e)}catch(i){this.loggingService.catch("Error in LiveStateService setEditorAccessTimeout: ",i)}}getEditorAccessTimeout$(){return this.editorAccessTimeout$.asObservable()}getEditorAccessTimeout(){return this.editorAccessTimeout$.value}enableEditorAccessTransferOnTimeOut(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: enableEditorAccessTransferOnTimeOut","color: green;"),this.editorAccessTransferOnTimeOut$.value===!0)return;this.editorAccessTransferOnTimeOut$.next(!0)}catch(e){this.loggingService.catch("Error in LiveStateService enableEditorAccessTransferOnTimeOut: ",e)}}disableEditorAccessTransferOnTimeOut(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: disableEditorAccessTransferOnTimeOut","color: green;"),this.editorAccessTransferOnTimeOut$.value===!1)return;this.editorAccessTransferOnTimeOut$.next(!1)}catch(e){this.loggingService.catch("Error in LiveStateService disableEditorAccessTransferOnTimeOut: ",e)}}getEditorAccessTransferOnTimeOut$(){return this.editorAccessTransferOnTimeOut$.asObservable()}getEditorAccessTransferOnTimeOut(){return this.editorAccessTransferOnTimeOut$.value}enableDefaultSingleEditorUI(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: enableDefaultSingleEditorUI","color: green;"),this.defaultSingleEditorUIEnabled$.value===!0)return;this.defaultSingleEditorUIEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in LiveStateService enableDefaultSingleEditorUI: ",e)}}disableDefaultSingleEditorUI(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: disableDefaultSingleEditorUI","color: green;"),this.defaultSingleEditorUIEnabled$.value===!1)return;this.defaultSingleEditorUIEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in LiveStateService disableDefaultSingleEditorUI: ",e)}}getDefaultSingleEditorUIEnabled$(){return this.defaultSingleEditorUIEnabled$.asObservable()}getDefaultSingleEditorUIEnabled(){return this.defaultSingleEditorUIEnabled$.value}setEditorAccessTimerInterval(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setEditorAccessTimerInterval","color: green;"),this.clearEditorAccessTimerInterval(),e>0&&(this.editorAccessTimer$.next({state:"inProgress",durationLeft:e}),this.editorAccessTimerInterval=setInterval(()=>{try{e-=1,e<0?this.clearEditorAccessTimerInterval():e?this.editorAccessTimer$.next({state:"inProgress",durationLeft:e}):this.editorAccessTimer$.next({state:"completed"})}catch(i){this.loggingService.catch("Error in LiveStateService setEditorAccessTimerCountdown interval: ",i),this.clearEditorAccessTimerInterval()}},1e3))}catch(i){this.loggingService.catch("Error in LiveStateService setEditorAccessTimerCountdown: ",i),this.clearEditorAccessTimerInterval()}}clearEditorAccessTimerInterval(){try{this.loggingService.log("%c[WB] Calling FUNCTION: clearEditorAccessTimerInterval","color: green;"),this.editorAccessTimerInterval&&(clearInterval(this.editorAccessTimerInterval),this.editorAccessTimerInterval=null,this.editorAccessTimer$.next({state:"idle"}))}catch(e){this.loggingService.catch("Error in LiveStateService clearEditorAccessTimerInterval: ",e)}}getEditorAccessTimer$(){return this.editorAccessTimer$.asObservable()}onServerConnectionStateChange$(){return this.serverConnectionState$.asObservable()}detectLiveSyncInputs(){try{document.querySelectorAll(`[${U.ATTRIBUTES.VELT_SYNC_STATE}]`)?.forEach(i=>{this.subscribeInputChanges(i)})}catch(e){this.loggingService.catch("Error in LiveStateService detectLiveSyncInputs: ",e)}}subscribeInputChanges(e){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: subscribeInputChanges","color: green;"),e){let i=e.tagName,r=this.domService.getXPath(e),a=Rt(r);if(this.inputChangeSubscriptionMap[a])this.loggingService.warn("subscription already exists",a,e);else{this.inputChangeSubscriptionMap[a]={id:a,element:e};let s;switch(i?.toLowerCase()){case"input":s=oi(e,"input").pipe(jr(300)).subscribe(p=>{let h={value:p?.target?.value,tagName:p?.target?.tagName,type:p?.target?.type};this.setLiveStateSyncInputData(p?.target,h)});break;case"textarea":s=oi(e,"input").pipe(jr(300)).subscribe(p=>{let h={value:p?.target?.value,tagName:p?.target?.tagName};this.setLiveStateSyncInputData(p?.target,h)});break;default:e.getAttribute("contenteditable")&&(s=oi(e,"input").pipe(jr(300)).subscribe(p=>{let h={innerText:p?.target?.innerText,innerHTML:this.domService.sanitizeHtml(p?.target?.innerHTML),tagName:p?.target?.tagName,isContentEditable:!0};this.setLiveStateSyncInputData(p?.target,h)}));break}s&&(this.inputChangeSubscriptionMap[a]?.subscriptions||(this.inputChangeSubscriptionMap[a]={subscriptions:[]}),this.inputChangeSubscriptionMap[a].subscriptions?.push(s))}}}catch(i){this.loggingService.catch("Error in LiveStateService subscribeInputChanges: ",i)}}unsubscribeInputChanges(){try{this.loggingService.log("%c[WB] Calling FUNCTION: unsubscribeInputChanges","color: green;"),Object.keys(this.inputChangeSubscriptionMap).forEach(e=>{this.inputChangeSubscriptionMap[e]?.subscriptions?.forEach(r=>{r.unsubscribe()})}),this.inputChangeSubscriptionMap={}}catch(e){this.loggingService.catch("Error in LiveStateService unsubscribeInputChanges: ",e)}}setLiveStateSyncInputData(e,i){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: setLiveStateSyncInputData","color: green;"),this.user&&this.documentPaths?.liveState){let r=this.domService.getXPath(e),a=Rt(r),s={id:a,lastUpdated:this.timestamp,liveStateDataId:r,data:i,updatedBy:this.user,tabId:this.tabId};this.commonDbService.updateData({feature:"liveStateAutoSyncStateCurrent",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",skipFirestore:!0},data:JSON.parse(JSON.stringify(s))}),this.commonDbService.updateData({feature:"liveStateAutoSyncStateHistoryId",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:a,skipFirestore:!0},data:JSON.parse(JSON.stringify(s))})}}catch(r){this.loggingService.catch("Error in LiveStateService setLiveStateSyncInputData: ",r)}}updateLiveStateSyncInputDataLocally(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: updateLiveStateSyncInputDataLocally","color: green;"),this.user&&Object.keys(e).forEach(i=>{let r=e[i],a=this.domService.getElementFromXPath(r?.liveStateDataId),s=!1;if(r?.updatedBy?.userSnippylyId!==this.user?.userSnippylyId)s=!0;else{let c=r?.tabId&&this.tabId&&r?.tabId!==this.tabId,p=a?.contains(document.activeElement);c&&!eoe()&&!p&&(s=!0)}if(s&&a)switch(a.value=r?.data?.value,a.tagName?.toLowerCase()){case"input":a.value=r?.data?.value;break;case"textarea":a.value=r?.data?.value;break;default:a.getAttribute("contenteditable")&&(a.innerHTML=this.domService.sanitizeHtml(r?.data?.innerHTML))}})}catch(i){this.loggingService.catch("Error in LiveStateService updateLiveStateSyncInputDataLocally: ",i)}}setSingleEditorModeContainerIds(e){this.singleEditorModeContainerIds$.next(e||[])}getSingleEditorModeContainerIds(){return this.singleEditorModeContainerIds$.asObservable()}isElementInsideSingleEditorModeContainerElements(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: isElementInsideSingleEditorModeContainerElements","color: green;");let i=this.singleEditorModeContainerIds$.value,r=document.querySelectorAll(`[${U.ATTRIBUTES.VELT_SINGLE_EDITOR_MODE_CONTAINER}]`);if(!i?.length&&!r?.length)return!0;if(i?.length)for(let a=0;a<i.length;a++){let s=document.getElementById(i[a]);if(s&&s.contains(e))return!0}if(r?.length)for(let a=0;a<r.length;a++){let s=r[a];if(s&&s.contains(e))return!0}return!1}catch(i){return this.loggingService.catch("Error in LiveStateService isElementInsideSingleEditorModeContainerElements: ",i),!1}}isSingleEditorModeDisabledForElement(e){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: isSingleEditorModeDisabledForElement","color: green;"),e){if(e.getAttribute(U.ATTRIBUTES.VELT_SYNC_ACCESS_DISABLED))return!0;{let r=e?.parentElement;if(r)return this.isSingleEditorModeDisabledForElement(r)}}return!1}catch(i){return this.loggingService.catch("Error in LiveStateService isSingleEditorModeDisabledForElement: ",i),!1}}updateOnDatabaseDisconnect(){return this.loggingService.log("%c[WB] Calling FUNCTION: updateOnDatabaseDisconnect","color: green;"),this.isUserEditor$().pipe(In(e=>{try{if(this.documentPaths?.liveStateSingleEditorMode){let i=on(this.db,`${this.documentPaths?.liveStateSingleEditorMode}`);e?.isEditor&&(!this.getSingleEditorModeConfig()?.singleTabEditor||e?.isEditorOnCurrentTab)?ll(i).remove():ll(i).cancel()}}catch(i){this.loggingService.catch("Error in LiveStateService updateOnDatabaseDisconnect tap: ",i)}}))}updateServerStateOnDatabaseDisconnect(){return this.loggingService.log("%c[WB] Calling FUNCTION: updateServerStateOnDatabaseDisconnect","color: green;"),Wn(this.afAuth).pipe(Ne(e=>!!e),ge(e=>this.docService.getDocumentPaths$().pipe(ce(i=>e))),In(e=>ee(this,null,function*(){try{if(this.docService.getDocumentPaths()?.liveState&&e){let r=on(this.db,".info/connected"),a=!0;gu(r,s=>{let c=s.val();if(a&&c===!1){a=!1;return}a=!1,c===!1?this.serverConnectionState$.next(gl.OFFLINE):this.serverConnectionState$.value===gl.OFFLINE&&this.serverConnectionState$.next(gl.ONLINE)})}}catch(i){this.loggingService.catch("Error in updateServerStateOnDatabaseDisconnect:",i)}})))}get timestamp(){return this.commonDbService.getServerTimestamp()}};o.\u0275fac=function(i){return new(i||o)(J(vi),J(Qe),J(je),J($t),J(pn),J(lt),J(Fe),J(gn),J(y),J(bn))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var Cm=(()=>{let o=class o{constructor(e,i,r,a,s,c,p,h,_,E,A,V){this.analyticsService=e,this.docService=i,this.authService=r,this.afAuth=a,this.iamService=s,this.databaseService=c,this.configService=p,this.avatarService=h,this.loggingService=_,this.flockService=E,this.liveStateService=A,this.commonDbService=V,this.db=Ci(),this.presenceUser$=new fe(new dM),this.documentPaths=null,this.inactivityTime=5*60*1e3,this.presenceUsers$=new fe([]),this.presenceUsersSubscription=null,this.includeSelf$=new fe(!0),this.loggingService.log("%c[WB] Creating CLASS: PresenceService","color: blue;"),this.databaseService.getDb().pipe(Ne(G=>!!G),Je(1)).subscribe(G=>{G&&(this.db=G,this.getUser(),this.getDocumentPaths(),this.getLocation(),this.updateOnUserDbConnectionStateChange().subscribe(()=>{},X=>{this.loggingService.catch("Error in PresenceService constructor updateOnUserDbConnectionStateChange: ",X)}),this.updateOnDatabaseDisconnect().subscribe(()=>{},X=>{this.loggingService.catch("Error in PresenceService constructor updateOnDatabaseDisconnect: ",X)}),this.updateOnDocumentFocusChange(),this.updateOnAllowedFeatureListChange())},G=>{this.loggingService.catch("Error in PresenceService constructor: ",G)}),this.authService.addPreSignOutFuction("presence-signout",this.signOutUser.bind(this)),this.presenceUsers$.pipe(Vi()).subscribe(([G,X])=>{sessionStorage.getItem(U.SESSION_STORAGE.VELT_PRESENCE_MULTIPLE_USERS_DETECTED)||X?.length>1&&G.length!==X.length&&(this.analyticsService.trackEvent(Z.Events.Presence.PRESENCE_MULTIPLE_USERS_DETECTED,{totalUsers:X.length,presenceSnippylyUserIds:X.map(he=>he.userSnippylyId),presenceClientUserIds:X.map(he=>he.userId)}),sessionStorage.setItem(U.SESSION_STORAGE.VELT_PRESENCE_MULTIPLE_USERS_DETECTED,"true"))})}getUser(){this.loggingService.log("%c[WB] Calling FUNCTION: getUser","color: green;"),this.authService.getUser$().pipe(Ne(e=>!!e)).subscribe(e=>{e&&this.setPresenceUser(e)},e=>{this.loggingService.catch("Error in getUser: ",e)})}getDocumentPaths(){this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentPaths","color: green;"),this.docService.getDocumentPaths$().pipe(In(e=>{this.documentPaths=e}),Vi(),In(([e,i])=>{e&&this.updateUserStatusOnDocumentChange(U.PRESENCE_STATUS_OFFLINE,e),i&&this.updateUserStatusOnDocumentChange(U.PRESENCE_STATUS_ONLINE,i)})).subscribe(()=>{},e=>{this.loggingService.catch("Error in getDocumentPaths: ",e)})}getLocation(){this.docService.getLocation$().pipe(In(e=>{this.updateUserOnLocationChange(e)})).subscribe(()=>{},e=>{this.loggingService.catch("Error in getLocation: ",e)})}getPresenceUser(){return this.loggingService.log("%c[WB] Calling FUNCTION: getPresenceUser","color: green;"),this.presenceUser$.asObservable()}getOnlineUsersOnCurrentDocument(){return this.loggingService.log("%c[WB] Calling FUNCTION: getOnlineUsersOnCurrentDocument","color: green;"),Wn(this.afAuth).pipe(Ne(e=>!!e),ge(e=>this.isFeatureAllowed({firebaseUser:e,users:[],filteredUsers:[]})),ge(e=>e.featureAllowed?this.iamService.isUserAllowed$().pipe(ce(i=>(e.featureAllowed=i,e))):re(e)),ge(e=>e.featureAllowed?this.authService.isPlanExpired$().pipe(ce(i=>(e.featureAllowed=!i,e))):re(e)),ge(e=>e.featureAllowed?re(e).pipe(ge(i=>this.docService.getDocumentPaths$().pipe(ce(r=>(this.documentPaths=r,i.documentPaths=r,i)))),ge(i=>this.getDataFromDocumentId().pipe(ce(r=>(i.users=r||[],I({},i))))),ce(i=>(i.filteredUsers=this.filterOnlineUsers(i.users,i.firebaseUser),i)),ge(i=>this.getIncludeSelf$().pipe(ce(r=>(r||(i.filteredUsers=i?.filteredUsers?.filter(a=>a?.userSnippylyId!==i.user?.userSnippylyId)),i)))),ge(i=>i?.filteredUsers?re(i?.filteredUsers||[]):re([]))):re([])))}isFeatureAllowed(e){return this.configService.getConfig$().pipe(Ne(i=>!!i),ce(i=>T(I({},e),{config:i})),ge(i=>this.authService.getUser$().pipe(ce(r=>T(I({},i),{user:r})))),ge(i=>Zi(i.config,i.user,Re.PRESENCE)?re(T(I({},i),{featureAllowed:!0})):(this.loggingService.warn("Presence feature is not allowed."),re(T(I({},i),{featureAllowed:!1})))))}getDataFromDocumentId(e){return this.databaseService.getDb().pipe(Ne(i=>!!i),ge(i=>(this.db=i,this.loggingService.log(this.db),this.configService?.getApiKey()&&this.documentPaths?.presence?this.commonDbService.dbListener({feature:"allPresence",properties:{documentId:e??this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(Ln(r=>(this.loggingService.catch("Error in PresenceService getDataFromDocumentId: ",r),re(null))),ce(r=>r?.data),ce(r=>{let a=[];return r&&(a=Object.values(r).filter(s=>typeof s=="object")),a})):re([]))))}filterOnlineUsers(e,i){this.loggingService.log("%c[WB] Calling FUNCTION: filterOnlineUsers","color: green;");try{let a=e.slice().filter(s=>{let c=Sp(s.timestamp);return s.userSnippylyId&&(s.onlineStatus===U.PRESENCE_STATUS_ONLINE||s.onlineStatus===U.PRESENCE_STATUS_AWAY)&&c<this.inactivityTime});return this.presenceUsers$.next(a),a}catch(r){return this.loggingService.catch("Error in filterOnlineUsers:",r),[]}}enableIncludeSelf(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: enableIncludeSelf","color: green;"),this.includeSelf$.value===!0)return;this.includeSelf$.next(!0)}catch(e){this.loggingService.catch("Error in PresenceService enableIncludeSelf: ",e)}}disableIncludeSelf(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: disableIncludeSelf","color: green;"),this.includeSelf$.value===!1)return;this.includeSelf$.next(!1)}catch(e){this.loggingService.catch("Error in PresenceService disableIncludeSelf: ",e)}}getIncludeSelf$(){return this.includeSelf$.asObservable()}getIncludeSelf(){return this.includeSelf$.value}getPresenceUserFromExternalId(e){try{if(this.presenceUsers$.value&&this.presenceUsers$.value.length>0){let i=this.presenceUsers$.value.find(r=>r.userId===e);if(i)return i}return null}catch(i){return this.loggingService.catch("Error in getNameFromSnippylyId:",i),null}}getAnonymousAvatarImage(){return this.loggingService.log("%c[WB] Calling FUNCTION: getAnonymousAvatarImage","color: green;"),this.avatarService.generateUserImage()}updateCurrentPresenceUser(e){return ee(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: updateCurrentPresenceUser","color: green;");try{if(this.documentPaths?.presence&&e&&e.userId&&this.authService.isFeatureAllowed(Re.PRESENCE)){if(!e.isAnonymous){e.pageInfo=new Ki;let i=JSON.parse(JSON.stringify(e));this.authService.getUser()&&this.commonDbService.updateData({feature:"presence",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:e.userSnippylyId,skipFirestore:!0},data:JSON.parse(JSON.stringify(T(I({},i),{timestamp:this.timestamp})))})}this.presenceUser$.next(e)}}catch(i){this.loggingService.catch("Error in updateCurrentPresenceUser:",i)}})}setCurrentPresenceUserStatus(e){return ee(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: setCurrentPresenceUserStatus","color: green;");try{this.loggingService.log(e);let i=this.presenceUser$.value;if(i.onlineStatus!==e){this.presenceUsersSubscription&&this.presenceUsersSubscription?.unsubscribe();let r=i.onlineStatus,a=e;this.presenceUsersSubscription=this.getPresenceUsers$().pipe(Ne(s=>!!s?.length),Je(1)).subscribe(s=>{s?.length>1&&this.analyticsService.trackEvent(Z.Events.Presence.PRESENCE_USER_STATUS_CHANGED,{oldStatus:r,newStatus:a,totalUsers:s?.length,presenceSnippylyUserIds:s?.map(c=>c.userSnippylyId),presenceClientUserIds:s?.map(c=>c.userId)})})}i.onlineStatus=e,e===U.PRESENCE_STATUS_OFFLINE&&this.flockService.isInSession()&&this.flockService.removeCurrentUserFromSession(),e===U.PRESENCE_STATUS_OFFLINE&&this.liveStateService.isUserEditor()?.isEditor&&this.liveStateService.removeEditorAccess(),this.updateCurrentPresenceUser(i)}catch(i){this.loggingService.catch("Error in setCurrentPresenceUserStatus:",i)}})}updateUserStatusOnDocumentChange(e,i){return ee(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: updateUserStatusOnDocumentChange","color: green;");try{let r=this.presenceUser$.value;if(r.onlineStatus=e,i?.presence&&r&&r.userId&&!r.isAnonymous&&this.authService.isFeatureAllowed(Re.PRESENCE)){let a=JSON.parse(JSON.stringify(r));this.commonDbService.updateData({feature:"presence",properties:{documentId:i?.documentId,organizationId:i?.organizationId,userId:r.userSnippylyId,skipFirestore:!0},data:JSON.parse(JSON.stringify(a))})}}catch(r){this.loggingService.catch("Error in updateUserStatusOnDocumentChange:",r)}})}updateUserOnLocationChange(e){return ee(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: updateUserOnLocationChange","color: green;");try{let i=this.presenceUser$.value;if(i.location=e?e.location:null,i.locationId=e?e?.locationId:null,this.documentPaths?.presence&&i&&i.userId&&!i.isAnonymous&&this.authService.isFeatureAllowed(Re.PRESENCE)){let r=JSON.parse(JSON.stringify(i));this.commonDbService.updateData({feature:"presence",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:i.userSnippylyId,skipFirestore:!0},data:JSON.parse(JSON.stringify(r))})}}catch(i){this.loggingService.catch("Error in updateUserOnLocationChange:",i)}})}updateOnUserDbConnectionStateChange(){this.loggingService.log("%c[WB] Calling FUNCTION: updateOnUserDbConnectionStateChange","color: green;");let e=on(this.db,".info/connected"),i=Of(e).pipe(ce(r=>r?U.PRESENCE_STATUS_ONLINE:U.PRESENCE_STATUS_OFFLINE));return Wn(this.afAuth).pipe(xs(1),ge(r=>r?i:re(U.PRESENCE_STATUS_OFFLINE)),In(r=>this.setCurrentPresenceUserStatus(r)))}updateOnDocumentFocusChange(){this.loggingService.log("%c[WB] Calling FUNCTION: updateOnDocumentFocusChange","color: green;");try{document&&document.addEventListener("visibilitychange",e=>{this.authService.getUser()&&(document.visibilityState==="hidden"?(this.setCurrentPresenceUserStatus(U.PRESENCE_STATUS_AWAY),this.flockService.getFlockMode()&&this.flockService.setTabFocused(!1)):(this.setCurrentPresenceUserStatus(U.PRESENCE_STATUS_ONLINE),this.flockService.getFlockMode()&&this.flockService.setTabFocused(!0)))}),window&&(window.addEventListener("focus",()=>{this.authService.getUser()&&(this.setCurrentPresenceUserStatus(U.PRESENCE_STATUS_ONLINE),this.flockService.getFlockMode()&&this.flockService.setWindowFocused(!0))}),window.addEventListener("blur",()=>{this.authService.getUser()&&(document.visibilityState!=="hidden"&&this.setCurrentPresenceUserStatus(U.PRESENCE_STATUS_AWAY),this.flockService.getFlockMode()&&this.flockService.setWindowFocused(!1))}))}catch(e){this.loggingService.catch("Error in updateOnDocumentFocusChange:",e)}}updateOnAllowedFeatureListChange(){try{this.configService.getConfig$().subscribe(e=>{if(e&&e.featureAllowList?.length){let i=this.presenceUser$.value,r=!1;if(e.featureAllowList.includes(Re.PRESENCE)?i?.onlineStatus!==U.PRESENCE_STATUS_ONLINE&&(i.onlineStatus=U.PRESENCE_STATUS_ONLINE,r=!0):i?.onlineStatus!==U.PRESENCE_STATUS_OFFLINE&&(i.onlineStatus=U.PRESENCE_STATUS_OFFLINE,r=!0),r&&this.authService.getUser()&&this.documentPaths?.presence&&i&&i.userId&&!i.isAnonymous){let a=JSON.parse(JSON.stringify(i));this.commonDbService.updateData({feature:"presence",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:i.userSnippylyId,skipFirestore:!0},data:JSON.parse(JSON.stringify(a))})}}})}catch(e){this.loggingService.catch("Error in updateOnAllowedFeatureListChange:",e)}}updateOnDatabaseDisconnect(){return this.loggingService.log("%c[WB] Calling FUNCTION: updateOnDatabaseDisconnect","color: green;"),Wn(this.afAuth).pipe(Ne(e=>!!e),ge(e=>this.docService.getDocumentPaths$().pipe(ce(i=>e))),In(e=>ee(this,null,function*(){try{if(this.documentPaths?.presence&&e){let i=yield ad(e,!0).catch(a=>null);if(!i)return;let{user:r}=i.claims;if(!r?.isAnonymous){let a=on(this.db,`${this.documentPaths.presence}/${e.uid}`);this.flockService.isInSession()&&this.flockService.removeCurrentUserFromSession(),this.liveStateService.isUserEditor()?.isEditor&&this.liveStateService.removeEditorAccess(),ll(a).update({onlineStatus:U.PRESENCE_STATUS_OFFLINE,timestamp:this.timestamp}).catch(s=>{this.loggingService.catch("Error in updateOnDatabaseDisconnect:",s)})}}}catch(i){this.loggingService.catch("Error in updateOnDatabaseDisconnect:",i)}})))}setPresenceUser(e){this.loggingService.log("%c[WB] Calling FUNCTION: setPresenceUser","color: green;");try{let i=this.presenceUser$.value;i.userId=e?.userId,i.name=e?.name,i.email=e?.email,i.photoUrl=e?.photoUrl,i.userSnippylyId=e?.userSnippylyId,i.color=e?.color,i.textColor=e?.textColor,i.initial=e?.initial,i.timestamp=this.timestamp,i.type=e?.type,i.isReadOnly=e?.isReadOnly,i.isAnonymous=e?.isAnonymous;let r=e?.name?.split(" ");if(r&&r.length>0){let a=r[0],s=r.length>1?r[r.length-1]:null,c=s?s[0]:null;a&&(i.name=`${a} ${c?c+".":""}`)}this.updateCurrentPresenceUser(i)}catch(i){this.loggingService.catch("Error in setPresenceUser:",i)}}signOutUser(e){return new Promise((i,r)=>{try{this.documentPaths?.presence&&e?this.commonDbService.dbListener({feature:"presence",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:e.uid,skipFirestore:!0}}).pipe(Je(1)).subscribe(a=>{a?.data?(this.flockService.isInSession()&&this.flockService.removeCurrentUserFromSession(),this.liveStateService.isUserEditor()?.isEditor&&this.liveStateService.removeEditorAccess(),this.commonDbService.updateData({feature:"presence",errorCallback:s=>{r(s)},callback:()=>{i(null)},properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:e.uid,skipFirestore:!0},data:JSON.parse(JSON.stringify(T(I({},a?.data??{}),{timestamp:this.timestamp,onlineStatus:U.PRESENCE_STATUS_OFFLINE})))})):i(null)},a=>{this.loggingService.catch("Error in signOutUser subscription: ",a),r(a)}):i(null)}catch(a){this.loggingService.catch("Error in signOutUser:",a),r(a)}})}setInactivityTime(e){this.inactivityTime=e,this.analyticsService.trackEvent(Z.Events.Presence.PRESENCE_SET_CUSTOM_INACTIVITY_TIMER,{inactivityTime:this.inactivityTime})}getPresenceUsers$(){return this.presenceUsers$.asObservable()}getPresenceUsers(){return this.presenceUsers$.value}get timestamp(){return this.commonDbService.getServerTimestamp()}};o.\u0275fac=function(i){return new(i||o)(J(Qe),J(lt),J(je),J(vi),J(gn),J(pn),J($t),J(gm),J(y),J(vc),J(Di),J(bn))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var qv=(()=>{let o=class o{constructor(e,i,r,a,s,c,p,h,_,E,A){this.analyticsService=e,this.configService=i,this.presenceService=r,this.docService=a,this.afAuth=s,this.iamService=c,this.domService=p,this.databaseService=h,this.authService=_,this.loggingService=E,this.commonDbService=A,this.db=Af(),this.cursorUser$=new fe(new Lv),this.documentPaths=null,this.inactivityTime=2*60*1e3,this.allowedElementIds$=new fe([]),this.cursorTagAvailable$=new fe(!1),this.cursorTagAvailable=!1,this.cursorUsers$=new fe([]),this.loggingService.log("%c[WB] Creating CLASS: CursorService","color: blue;");try{this.checkCursorTagAvailable(),this.databaseService.getDb().pipe(Ne(V=>!!V),ge(V=>this.cursorTagAvailable$.pipe(Ne(G=>!!G),Je(1),ce(()=>V))),Je(1)).subscribe(V=>{V&&(this.db=V,this.cursorTagAvailable&&(this.getPresenceUser(),this.getDocumentPaths(),this.getLocation(),this.updateOnDatabaseDisconnect().subscribe(()=>{},G=>{this.loggingService.catch("Error in CursorService constructor updateOnDatabaseDisconnect: ",G)}),this.addMouseMoveListener(),this.addScreenSizeChangeListener(),this.updateOnAllowedFeatureListChange()))},V=>{this.loggingService.catch("Error in CursorService constructor getDb: ",V)}),this.cursorUsers$.pipe(Vi()).subscribe(([V,G])=>{sessionStorage.getItem(U.SESSION_STORAGE.VELT_CURSOR_MULTIPLE_USERS_DETECTED)||G?.length>1&&V.length!==G.length&&(this.analyticsService.trackEvent(Z.Events.Cursor.CURSOR_MULTIPLE_USERS_DETECTED,{totalUsers:G.length,cursorSnippylyUserIds:G.map(X=>X.userSnippylyId),cursorClientUserIds:G.map(X=>X.userId)}),sessionStorage.setItem(U.SESSION_STORAGE.VELT_CURSOR_MULTIPLE_USERS_DETECTED,"true"))}),this.authService.addPreSignOutFuction("cursor-signout",this.signOutUser.bind(this))}catch(V){this.loggingService.catch("Error in CursorService constructor: ",V)}}checkCursorTagAvailable(){this.loggingService.log("%c[WB] Calling FUNCTION: checkCursorTagAvailable","color: green;");try{this.cursorTagAvailable=!!document.querySelector(U.TAGS.VELT_CURSOR)||!!document.querySelector(U.TAGS.SNIPPYLY_CURSOR),this.cursorTagAvailable$.next(this.cursorTagAvailable)}catch(e){this.loggingService.catch("Error in CursorService checkCursorTagAvailable: ",e)}}addScreenSizeChangeListener(){this.loggingService.log("%c[WB] Calling FUNCTION: addScreenSizeChangeListener","color: green;");try{this.docService.getDocumentPaths$().pipe(Ne(e=>!!e),ge(e=>this.domService.getCurrentWindowSize$("CursorService addScreenSizeChangeListener").pipe(Ne(i=>!!i)))).subscribe(e=>{this.setCurrentCursorUserScreenSize(e)},e=>{this.loggingService.catch("Error in addScreenSizeChangeListener getCurrentWindowSize: ",e)})}catch(e){this.loggingService.catch("Error in CursorService addScreenSizeChangeListener: ",e)}}addMouseMoveListener(){this.loggingService.log("%c[WB] Calling FUNCTION: addMouseMoveListener","color: green;");try{this.domService.onWindowPointerMove$().pipe(t7(50)).subscribe(e=>{e&&this.setCurrentCursorUserPosition(e.pageX,e.pageY,this.domService.getTargetElementForCursorPosition(e,!0,!1,!1))},e=>{this.loggingService.catch("Error in addMouseMoveListener getCurrentMousePosition: ",e)})}catch(e){this.loggingService.catch("Error in CursorService addMouseMoveListener: ",e)}}getDocumentPaths(){this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentPaths","color: green;");try{this.docService.getDocumentPaths$().pipe(In(e=>{this.documentPaths=e}),Vi(),In(([e,i])=>{e&&this.updateUserStatusOnDocumentChange(U.PRESENCE_STATUS_OFFLINE,e),i&&this.updateUserStatusOnDocumentChange(U.PRESENCE_STATUS_ONLINE,i)})).subscribe(()=>{},e=>{this.loggingService.catch("Error in getDocumentPaths subscription: ",e)})}catch(e){this.loggingService.catch("Error in CursorService getDocumentPaths: ",e)}}getLocation(){try{this.docService.getLocation$().pipe(In(e=>{this.updateUserOnLocationChange(e)})).subscribe(()=>{},e=>{this.loggingService.catch("Error in getLocation subscription: ",e)})}catch(e){this.loggingService.catch("Error in CursorService getLocation: ",e)}}getCursorUser(){return this.loggingService.log("%c[WB] Calling FUNCTION: getCursorUser","color: green;"),this.cursorUser$.asObservable()}getPresenceUser(){this.loggingService.log("%c[WB] Calling FUNCTION: getPresenceUser","color: green;"),this.presenceService.getPresenceUser().pipe(Ne(e=>!!e),Ln(e=>re(e.code))).subscribe(e=>{this.setCursorUser(e)},e=>{this.loggingService.catch("Error in getPresenceUser: ",e)})}getLiveCursorsOnCurrentDocument(){return this.loggingService.log("%c[WB] Calling FUNCTION: getLiveCursorsOnCurrentDocument","color: green;"),Wn(this.afAuth).pipe(Ne(e=>!!e),ge(e=>this.isFeatureAllowed({firebaseUser:e,users:[],filteredUsers:[]})),ge(e=>e.featureAllowed?this.iamService.isUserAllowed$().pipe(ce(i=>(e.featureAllowed=i,e))):re(e)),ge(e=>e.featureAllowed?this.authService.isPlanExpired$().pipe(ce(i=>(e.featureAllowed=!i,e))):re(e)),ge(e=>!e.featureAllowed||e?.user?.isAnonymous?re([]):re(e).pipe(ge(i=>this.docService.getDocumentPaths$().pipe(ce(r=>(this.documentPaths=r,i.documentPaths=r,i)))),ge(i=>this.getDataFromDocumentId().pipe(ce(r=>(i.users=r||[],I({},i))))),ce(i=>(i.filteredUsers=this.filterOnlineUsers(i.users,i.firebaseUser),i)),ge(i=>i?.filteredUsers?.length?this.domService.getCurrentWindowSize$("CursorService getLiveCursorsOnCurrentDocument").pipe(ce(()=>i)):re(i)),ce(i=>(i?.filteredUsers?.forEach(r=>{this.calculateCursorUserPosition(r)}),i)),ge(i=>i?.filteredUsers?re(i?.filteredUsers||[]):re([])))))}isFeatureAllowed(e){return this.configService.getConfig$().pipe(Ne(i=>!!i),ce(i=>T(I({},e),{config:i})),ge(i=>this.authService.getUser$().pipe(ce(r=>T(I({},i),{user:r})))),ge(i=>Zi(i.config,i.user,Re.CURSOR)?re(T(I({},i),{featureAllowed:!0})):(this.loggingService.warn("Cursor feature is not allowed."),re(T(I({},i),{featureAllowed:!1})))))}getDataFromDocumentId(e){return this.databaseService.getDb().pipe(Ne(i=>!!i),ge(i=>(this.db=i,this.loggingService.log(this.db),this.configService?.getApiKey()&&this.documentPaths?.cursor?this.commonDbService.dbListener({feature:"allCursors",properties:{documentId:e??this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(Ln(r=>(this.loggingService.catch("Error in CursorService getDataFromDocumentId: ",r),re(null))),ce(r=>r?.data),ce(r=>{let a=[];return r&&(a=Object.values(r).filter(s=>typeof s=="object")),a})):re([]))))}calculateCursorUserPosition(e){try{if(e?.targetElement){let i=this.domService.getXPath(e.targetElement?.xpath);if(i){let r=i.iterateNext();if(r&&this.isElementInsideAllowedElements(r)){let a=r.getBoundingClientRect();a&&a.width&&a.height&&(e.position={top:a.top+a.height*e.targetElement.topPercentage/100,left:a.left+a.width*e.targetElement.leftPercentage/100})}}}}catch(i){this.loggingService.catch("Error in calculateCursorUserPosition:",i)}}filterOnlineUsers(e,i){try{let a=e.slice().filter(c=>{let p=Sp(c.timestamp);return c.userSnippylyId&&c.onlineStatus===U.PRESENCE_STATUS_ONLINE&&p<this.inactivityTime});this.cursorUsers$.next(a),a=a.filter(c=>c?.userSnippylyId!==i?.uid);let s=this.docService.getLocation();return s&&s.locationId?a=a.filter(c=>c.locationId===s.locationId):a=a.filter(c=>!c.locationId),a}catch(r){return this.loggingService.catch("Error in filterOnlineUsers:",r),[]}}setCursorUser(e){this.loggingService.log("%c[WB] Calling FUNCTION: setCursorUser","color: green;");try{let i=this.cursorUser$.value;i.userId=e?.userId,i.name=e?.name,i.email=e?.email,i.photoUrl=e?.photoUrl,i.comment="",this.authService.isFeatureAllowed(Re.PRESENCE)&&(i.onlineStatus=e?.onlineStatus),i.userSnippylyId=e?.userSnippylyId,i.color=e?.color,i.textColor=e?.textColor,i.initial=e?.initial,i.timestamp=this.timestamp,i.type=e?.type,i.isReadOnly=e?.isReadOnly,i.isAnonymous=e?.isAnonymous;let r=this.domService.getCurrentWindowSizeValue();i.screenWidth=r?.screenWidth,i.screenHeight=r?.screenHeight,i.screenScrollHeight=r?.screenScrollHeight,this.updateCurrentCursorUser(i)}catch(i){this.loggingService.catch("Error in setCursorUser:",i)}}setCurrentCursorUserPosition(e,i,r){try{let a=this.cursorUser$.value;a?.onlineStatus===U.PRESENCE_STATUS_ONLINE&&(a.positionX=e,a.positionY=i,r?a.targetElement=r:a.targetElement=null,this.updateCurrentCursorUser(a))}catch(a){this.loggingService.catch("Error in setCurrentCursorUserPosition:",a)}}setCurrentCursorUserScreenSize(e){try{if(e.screenWidth!==0&&e.screenHeight!==0){let i=this.cursorUser$.value;i?.onlineStatus===U.PRESENCE_STATUS_ONLINE&&(i.screenWidth=e.screenWidth,i.screenHeight=e.screenHeight,i.screenScrollHeight=e.screenScrollHeight,this.updateCurrentCursorUser(i))}}catch(i){this.loggingService.catch("Error in setCurrentCursorUserScreenSize:",i)}}updateCurrentCursorUser(e){return ee(this,null,function*(){try{if(this.documentPaths&&e&&e.userId&&this.authService.isFeatureAllowed(Re.CURSOR)){if(!e.isAnonymous){e.pageInfo=new Ki;let i=JSON.parse(JSON.stringify(e));this.commonDbService.updateData({feature:"cursor",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:e.userSnippylyId,skipFirestore:!0},data:JSON.parse(JSON.stringify(T(I({},i),{timestamp:this.timestamp})))})}this.cursorUser$.next(e)}}catch(i){this.loggingService.catch("Error in updateCurrentCursorUser:",i)}})}updateUserStatusOnDocumentChange(e,i){return ee(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: updateUserStatusOnDocumentChange","color: green;");try{let r=this.cursorUser$.value;if(r.onlineStatus=e,i&&r&&r.userId&&!r.isAnonymous&&this.authService.isFeatureAllowed(Re.CURSOR)){let a=JSON.parse(JSON.stringify(r));this.commonDbService.updateData({feature:"cursor",properties:{documentId:i?.documentId??"",organizationId:i?.organizationId??"",id:r.userSnippylyId,skipFirestore:!0},data:JSON.parse(JSON.stringify(T(I({},a),{timestamp:this.timestamp})))})}}catch(r){this.loggingService.catch("Error in updateUserStatusOnDocumentChange:",r)}})}updateUserOnLocationChange(e){return ee(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: updateUserOnLocationChange","color: green;");try{let i=this.cursorUser$.value;if(i.location=e?e.location:null,i.locationId=e?e?.locationId:null,this.documentPaths&&i&&i.userId&&!i.isAnonymous&&this.authService.isFeatureAllowed(Re.CURSOR)){let r=JSON.parse(JSON.stringify(i));this.commonDbService.updateData({feature:"cursor",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:i.userSnippylyId,skipFirestore:!0},data:JSON.parse(JSON.stringify(T(I({},r),{timestamp:this.timestamp})))})}}catch(i){this.loggingService.catch("Error in updateUserOnLocationChange:",i)}})}updateOnAllowedFeatureListChange(){try{this.configService.getConfig$().subscribe(e=>{if(e&&e.featureAllowList?.length){let i=this.cursorUser$.value,r=!1;if(e.featureAllowList.includes(Re.CURSOR)?i?.onlineStatus!==U.PRESENCE_STATUS_ONLINE&&(i.onlineStatus=U.PRESENCE_STATUS_ONLINE,r=!0):i?.onlineStatus!==U.PRESENCE_STATUS_OFFLINE&&(i.onlineStatus=U.PRESENCE_STATUS_OFFLINE,r=!0),r&&this.documentPaths&&i&&i.userId&&!i.isAnonymous){let a=JSON.parse(JSON.stringify(i));this.commonDbService.updateData({feature:"cursor",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:i.userSnippylyId,skipFirestore:!0},data:JSON.parse(JSON.stringify(T(I({},a),{timestamp:this.timestamp})))})}}})}catch(e){this.loggingService.catch("Error in updateOnAllowedFeatureListChange:",e)}}updateOnDatabaseDisconnect(){return this.loggingService.log("%c[WB] Calling FUNCTION: updateOnDatabaseDisconnect","color: green;"),Wn(this.afAuth).pipe(Ne(e=>!!e),ge(e=>this.docService.getDocumentPaths$().pipe(ce(i=>e))),In(e=>ee(this,null,function*(){try{if(this.documentPaths&&e){let i=yield ad(e,!0).catch(a=>null);if(!i)return;let{user:r}=i.claims;if(!r?.isAnonymous){let a=on(this.db,`${this.documentPaths.cursor}/${e.uid}`);ll(a).update({onlineStatus:U.PRESENCE_STATUS_OFFLINE,comment:"",timestamp:this.timestamp}).catch(s=>{this.loggingService.catch("Error in updateOnDatabaseDisconnect:",s)})}}}catch(i){this.loggingService.catch("Error in updateOnDatabaseDisconnect:",i)}})))}signOutUser(e){return new Promise((i,r)=>{try{this.documentPaths&&e?this.commonDbService.dbListener({feature:"cursor",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,id:e.uid,skipFirestore:!0}}).pipe(Je(1)).subscribe(a=>{a?.data?this.commonDbService.updateData({feature:"cursor",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:e.uid,skipFirestore:!0},callback:()=>{i(null)},data:JSON.parse(JSON.stringify(T(I({},a?.data??{}),{timestamp:this.timestamp,onlineStatus:U.PRESENCE_STATUS_OFFLINE})))}):i(null)},a=>{this.loggingService.catch("Error in signOutUser subscription: ",a),r(a)}):i(null)}catch(a){this.loggingService.catch("Error in signOutUser:",a),r(a)}})}setInactivityTime(e){this.inactivityTime=e,this.analyticsService.trackEvent(Z.Events.Cursor.CURSOR_SET_CUSTOM_INACTIVITY_TIMER,{inactivityTime:this.inactivityTime})}setAllowedElementIds(e){this.allowedElementIds$.next(e||[])}getAllowedElementIds(){return this.allowedElementIds$.asObservable()}isElementInsideAllowedElements(e){try{return this.domService.isElementInsideListedElementIds(e,this.allowedElementIds$.value)}catch(i){return this.loggingService.catch("Error in CursorService isElementInsideAllowedElements: ",i),!1}}get timestamp(){return this.commonDbService.getServerTimestamp()}};o.\u0275fac=function(i){return new(i||o)(J(Qe),J($t),J(Cm),J(lt),J(vi),J(gn),J(Fe),J(pn),J(je),J(y),J(bn))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var HM=class extends li{constructor(o){super(o),this.getService(y).log("%c[WB] Creating CLASS: CursorElement","color: blue;"),this.getLiveCursorsOnCurrentDocument=this._getOnlineUsersOnCurrentDocument,this.getOnlineUsersOnCurrentDocument=this._getOnlineUsersOnCurrentDocument,this.setInactivityTime=this._setInactivityTime,this.allowedElementIds=this._allowedElementIds}_getOnlineUsersOnCurrentDocument(){this.getService(y).log("%c[WB] Calling FUNCTION: getOnlineUsersOnCurrentDocument","color: green;");try{return this.trackEvent(Z.Events.Cursor.GET_LIVE_CURSORS_ON_CURRENT_DOCUMENT_TRIGGERED),this.getService(qv).getLiveCursorsOnCurrentDocument()}catch(o){return this.getService(y).catch("Error in _getOnlineUsersOnCurrentDocument: ",o),re(null)}}_setInactivityTime(o){this.getService(y).log("%c[WB] Calling FUNCTION: _setInactivityTime","color: green;");try{this.trackEvent(Z.Events.Cursor.SET_INACTIVITY_TIME_TRIGGERED,{payload:{time:o}}),isNaN(o)?this.getService(y).catch("Error in setInactivityTime: ","Provided value is not a number."):this.getService(qv).setInactivityTime(o)}catch(t){this.getService(y).catch("Error in setInactivityTime: ",t)}}_allowedElementIds(o){this.getService(y).log("%c[WB] Calling FUNCTION: allowedElementIds","color: green;");try{this.trackEvent(Z.Events.Cursor.ALLOWED_ELEMENT_IDS_TRIGGERED,{payload:{elementIds:o}}),this.getService(qv).setAllowedElementIds(o)}catch(t){this.getService(y).catch("Error in allowedElementIds: ",t)}}};var zM=class extends li{constructor(o){super(o),this.getService(y).log("%c[WB] Creating CLASS: DocElement","color: blue;"),this.getDocumentMetadata=this._getDocumentMetadata}_getDocumentMetadata(){this.getService(y).log("%c[WB] Calling FUNCTION: getDocumentMetadata","color: green;");try{return this.trackEvent(Z.Events.Doc.GET_DOCUMENT_METADATA_TRIGGERED),this.getService(lt).getDocumentMetadata$()}catch(o){return this.getService(y).catch("Error in getDocumentMetadata: ",o),re(null)}}};var mr=(()=>{let o=class o{constructor(e,i,r,a,s,c,p,h,_,E,A,V,G){this.afAuth=e,this.analyticsService=i,this.authService=r,this.databaseService=a,this.docService=s,this.configService=c,this.domService=p,this.huddleUtilsService=h,this.functions=_,this.loggingService=E,this.notificationService=A,this.commonDbService=V,this.usersService=G,this.documentPaths=null,this.localStream$=new fe(null),this.peerConnectionMap={},this.localStream=new MediaStream,this.screenSharingStream=new MediaStream,this.screenSharingStream$=new fe(null),this.remoteStreamMap={},this.remoteStreamMap$=new fe(null),this.localStreamState$=new fe({}),this.peerConnectionStateMap={},this.peerConnectionStateMap$=new fe({}),this.hudleToolComponentId$=new fe(null),this.attendees$=new fe([]),this.invitees$=new fe([]),this.huddleJoined$=new fe(!1),this.userHuddleStartTime$=new fe(null),this.messages$=new fe([]),this.messagesPanelVisible$=new fe(!1),this.huddleOnCursorMode$=new fe(!1),this.flockModeOnAvatarClickEnabled$=new fe(!1),this.chatEnabled$=new fe(!0),this.huddleOnCursorModeByAttendeeId$=new fe({}),this.huddleCursorAvailableByAttendeeId$=new fe({}),this.remoteStreamsByUserId$=new fe({}),this.messagesSubscription=null,this.huddleJoined=!1,this.onAnswerConnectionIdHistory={},this.onOfferUidHistory={},this.senders={},this.db=Ci(),this.dbRefsRemoveOnDropCall=[],this.servers={iceServers:[{urls:["stun:stun1.l.google.com:19302","stun:stun2.l.google.com:19302"]}]},this.databaseService.getDb().pipe(Ne(X=>!!X),Je(1)).subscribe(X=>{try{X&&(this.db=X,this.isHuddleTagInstalled()&&(sessionStorage.getItem("skipTwilioIceServers")||this.getTwilioIceServers()),this.getUser(),this.getDocumentPaths())}catch(he){this.loggingService.catch("Error in HuddleService getDb:",he)}},X=>{this.loggingService.catch("Error in HuddleService getDb subscription: ",X)}),this.docService.addPreDocumentIdChangeFunction("huddle-service",X=>ee(this,null,function*(){this.huddleJoined$.value&&(yield this.dropCall(),yield this.removeLocalStream(),yield this.removeAttendee(),this.attendees$.next([]))})),this.getAttendees().subscribe(),this.getInvitees().subscribe(),this.localStream$.subscribe(X=>{X&&(this.localStream=X)}),this.screenSharingStream$.subscribe(X=>{X&&(this.screenSharingStream=X)}),this.configService.getConfig$().subscribe(X=>{try{!X?.featureAllowList?.find(Ie=>Ie===Re.CURSOR)&&this.huddleOnCursorMode$.next(!1)}catch(he){this.loggingService.catch("Error in HuddleService configService.getConfig$:",he)}},X=>{this.loggingService.catch("Error in HuddleService configService.getConfig$ subscription: ",X)}),this.attendees$.subscribe(X=>{try{if(X?.length){if(this.huddleOnCursorMode$?.value){let he=this.huddleOnCursorModeByAttendeeId$.getValue()||{};X.forEach(Ie=>{he[Ie.userSnippylyId]=!0}),this.huddleOnCursorModeByAttendeeId$.next(he)}this.huddleJoined$?.value&&(X?.find(he=>he?.huddleOnCursorMode)?this.addCursorTag():this.removeCursorTag())}}catch(he){this.loggingService.catch("Error in HuddleService attendees$:",he)}},X=>{this.loggingService.catch("Error in HuddleService attendees$ subscription: ",X)}),Dn([this.huddleJoined$,this.huddleOnCursorMode$]).subscribe(([X,he])=>{try{if(X){if(he){let Ie=this.attendees$.getValue()||[],Pe=this.huddleOnCursorModeByAttendeeId$.getValue()||{};Ie.forEach(Be=>{Pe[Be.userSnippylyId]=!0}),document?.body?.setAttribute(U.ATTRIBUTES.VELT_HUDDLE_ON_CURSOR_MODE,"true")}else this.huddleOnCursorModeByAttendeeId$.next({}),document?.body?.removeAttribute(U.ATTRIBUTES.VELT_HUDDLE_ON_CURSOR_MODE);this.updateHuddleOnCursorMode()}else this.removeCursorTag(),document?.body?.removeAttribute(U.ATTRIBUTES.VELT_HUDDLE_ON_CURSOR_MODE)}catch(Ie){this.loggingService.catch("Error in HuddleService huddleJoined$:",Ie)}},X=>{this.loggingService.catch("Error in HuddleService huddleJoined$ subscription: ",X)}),this.huddleOnCursorModeByAttendeeId$.subscribe(X=>{try{this.huddleJoined&&(Object.keys(X).length?this.addCursorTag():this.removeCursorTag())}catch(he){this.loggingService.catch("Error in HuddleService huddleOnCursorModeByAttendeeId$:",he)}},X=>{this.loggingService.catch("Error in HuddleService huddleOnCursorModeByAttendeeId$ subscription: ",X)}),this.authService.addPreSignOutFuction("huddle-signout",this.signOutUser.bind(this))}isHuddleTagInstalled(){try{return!!document?.querySelector(`${U.TAGS.VELT_HUDDLE}`)||!!document?.querySelector(`${U.TAGS.SNIPPYLY_HUDDLE}`)}catch(e){return this.loggingService.catch("Error in HuddleService isHuddleTagInstalled:",e),!1}}getTwilioIceServers(){return ee(this,null,function*(){try{let i=(yield Cr(this.functions,Zn.cloudFunction.getIceServers,{timeout:12e5})())?.data;i&&i?.iceServers&&(this.servers.iceServers=i.iceServers)}catch(e){this.loggingService.catch("Error in HuddleService getTwilioIceServers:",e)}})}getRemoteStream(){return this.loggingService.log("%c[WB] Calling FUNCTION: getRemoteStream","color: green;"),this.remoteStreamMap$.asObservable()}getPeerConnectionStateMap(){return this.loggingService.log("%c[WB] Calling FUNCTION: getPeerConnectionStateMap","color: green;"),this.peerConnectionStateMap$.asObservable()}getLocalStreamState(){return this.loggingService.log("%c[WB] Calling FUNCTION: getLocalStreamState","color: green;"),this.localStreamState$.asObservable()}getScreenSharingStream(){return this.loggingService.log("%c[WB] Calling FUNCTION: getScreenSharingStream","color: green;"),this.screenSharingStream$.asObservable()}getAttendees(){return Wn(this.afAuth).pipe(Ne(e=>!!e),ce(e=>({firebaseUser:e})),ge(e=>this.configService.getConfig$().pipe(Ne(i=>!!i),ce(i=>T(I({},e),{config:i})))),ge(e=>this.authService.getUser$().pipe(ce(i=>T(I({},e),{user:i})))),ge(e=>Zi(e.config,e.user,Re.HUDDLE)?re(T(I({},e),{allowed:!0})):(this.loggingService.warn("Huddle feature is not allowed."),re(T(I({},e),{allowed:!1})))),ge(e=>this.docService.getDocumentPaths$().pipe(ce(i=>(this.documentPaths=i,e)))),ge(e=>e?.allowed?e?.user?.isAnonymous?re(null):this.documentPaths?.huddle?this.commonDbService.dbListener({feature:"allHuddleAttendees",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(ce(i=>i?.data),ce(i=>i?(this.attendees$.next(Object.values(i)),Object.values(i)):(this.attendees$.next([]),null))):re(null):re([])))}getInvitees(){try{return Wn(this.afAuth).pipe(Ne(e=>!!e),ce(e=>({firebaseUser:e})),ge(e=>this.configService.getConfig$().pipe(Ne(i=>!!i),ce(i=>T(I({},e),{config:i})))),ge(e=>this.authService.getUser$().pipe(ce(i=>T(I({},e),{user:i})))),ge(e=>Zi(e.config,e.user,Re.HUDDLE)?re(T(I({},e),{allowed:!0})):(this.loggingService.warn("Huddle feature is not allowed."),re(T(I({},e),{allowed:!1})))),ge(e=>this.docService.getDocumentPaths$().pipe(ce(i=>(this.documentPaths=i,e)))),ge(e=>e?.allowed?e?.user?.isAnonymous?re(null):this.documentPaths?.huddle?this.commonDbService.dbListener({feature:"allHuddleInvitees",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(ce(i=>i?.data),ce(i=>i?(this.invitees$.next(Object.values(i)),Object.values(i)):(this.invitees$.next([]),null))):re(null):re([])))}catch(e){return this.loggingService.catch("Error in HuddleService getInvitees:",e),re([])}}clearHuddleInvitees(){try{this.documentPaths?.huddle&&this.commonDbService.deleteData({feature:"allHuddleInvitees",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}})}catch(e){this.loggingService.catch("Error in HuddleService clearHuddleInvitees:",e)}}getUser(){this.loggingService.log("%c[WB] Calling FUNCTION: getUser","color: green;"),this.authService.getUser$().pipe(Ne(e=>!!e)).subscribe(e=>{e&&(this.user=e)},e=>{this.loggingService.catch("Error in getUser: ",e)})}getDocumentPaths(){this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentPaths","color: green;"),this.docService.getDocumentPaths$().pipe(In(e=>{this.documentPaths=e})).subscribe(()=>{},e=>{this.loggingService.catch("Error in getDocumentPaths: ",e)})}setHuddleToolComponentId(e){this.hudleToolComponentId$.next(e||null)}getHuddleToolComponentId(){return this.hudleToolComponentId$.asObservable()}joinHuddle(e){return ee(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: joinHuddle","color: green;"),this.documentPaths?.huddle?(this.initialHuddleType=e,this.huddleJoined=!0,this.huddleJoined$.next(!0),this.initLocalStreams(),this.huddle=on(this.db,this.documentPaths?.huddle),this.iceCandidates=on(this.db,`${this.documentPaths?.huddle}/iceCandidates`),this.connections=on(this.db,`${this.documentPaths?.huddle}/connections`),this.attendees=on(this.db,`${this.documentPaths?.huddle}/attendees`),this.messages=on(this.db,`${this.documentPaths?.huddle}/messages`),this.setHuddleListener(),this.addAttendee(),this.callExistingAttendees(),this.userHuddleStartTime$.next(new Date().getTime())):this.loggingService.catch("Error in joinHuddle: documentPaths not found")}catch(i){this.loggingService.catch("Error in HuddleService joinHuddle:",i)}})}initLocalStreams(){try{if(!this.localStream$?.value?.getTracks()?.length){let e=new MediaStream([this.silence(),this.black()]);this.localStream$.next(e)}if(!this.screenSharingStream$?.value?.getTracks()?.length){let e=new MediaStream([this.black()]);this.screenSharingStream$.next(e)}}catch(e){this.loggingService.catch("Error in HuddleService initLocalStreams:",e)}}setHuddleListener(){this.loggingService.log("%c[WB] Calling FUNCTION: setHuddleListener","color: green;"),gu(this.connections,e=>{try{if(e.exists()){let i=e.val();Object.values(i).forEach(a=>{let s=Object.values(a);if(s&&s.length>0){let p=s[0]?.connectionId;this.onHuddleSnapshot(p,a)}}),Object.keys(this.remoteStreamMap).forEach(a=>ee(this,null,function*(){i[a]||(this.remoteStreamMap[a]&&Object.values(this.remoteStreamMap[a]).forEach(s=>{s.getTracks().forEach(c=>{c.stop()})}),delete this.remoteStreamMap[a],yield this.removeIceCandidates(a))})),this.remoteStreamMap$.next(this.remoteStreamMap)}else Object.keys(this.remoteStreamMap).forEach(i=>ee(this,null,function*(){Object.values(this.remoteStreamMap[i]).forEach(r=>{r.getTracks().forEach(a=>{a.stop()})}),yield this.removeIceCandidates(i)})),this.remoteStreamMap={},this.remoteStreamMap$.next(this.remoteStreamMap)}catch(i){this.loggingService.catch("Error in HuddleService setHuddleLister onValue:",i)}}),SL(this.iceCandidates).subscribe(e=>{try{e.event==="child_added"&&this.onIceCandidateSnapshot(e.snapshot)}catch(i){this.loggingService.catch("Error in HuddleService iceCandidates stateChanges:",i)}}),SL(this.attendees).subscribe(e=>{try{if(e.event==="child_removed"){let i=e?.snapshot?.val();if(i){delete this.onOfferUidHistory[i?.userSnippylyId];let r=this.getCombinedId(this.user.userSnippylyId,i?.userSnippylyId);delete this.onAnswerConnectionIdHistory[r],this.closeConnection(r)}}}catch(i){this.loggingService.catch("Error in HuddleService iceCandidates stateChanges:",i)}}),this.messagesSubscription&&this.messagesSubscription.unsubscribe(),this.messagesSubscription=new Ft(e=>{let i=gu(this.messages,r=>e.next(r),r=>e.error(r));return()=>i()}).pipe(ge(e=>this.usersService.getUserById$().pipe(ce(()=>e))),ge(e=>{if(e.exists()){let i=e.val();return bo(this.huddleUtilsService.resolveUsersFromHuddleMessages(Object.values(i||{})))}return re([])}),Ln(e=>(this.loggingService.catch("Error in HuddleService messages onValue:",e),re([])))).subscribe(e=>{this.messages$.next(e)})}onHuddleSnapshot(e,i){try{this.loggingService.log("%c[WB] Calling FUNCTION: onHuddleSnapshot","color: green;"),i.offerData&&!i.answerData&&i.offerData.from!==this.user.userSnippylyId&&i.offerData.to===this.user.userSnippylyId&&!(e in this.peerConnectionMap)&&!this.onOfferUidHistory[i.offerData.from]?(this.loggingService.log("offer received"),this.loggingService.log(i),this.onOfferUidHistory[i.offerData.from]=!0,this.onOffer(e,i.offerData)):i.answerData&&i.answerData.from!==this.user.userSnippylyId&&i.answerData.to===this.user.userSnippylyId&&this.peerConnectionMap[e]&&this.peerConnectionMap[e]?.connectionState!=="connected"&&!this.onAnswerConnectionIdHistory[e]&&(this.loggingService.log("answer received"),this.loggingService.log(i),this.onAnswerConnectionIdHistory[e]=!0,this.onAnswer(e,i.answerData))}catch(r){this.loggingService.catch("Error in HuddleService onHuddleSnapshot:",r)}}onIceCandidateSnapshot(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: onIceCandidateSnapshot","color: green;"),this.loggingService.log("ice candidate received");let i=e.val(),r=i.connectionId;i?.from!==this.user.userSnippylyId&&r in this.peerConnectionMap&&this.onIceCandidateChange(r,i)}catch(i){this.loggingService.catch("Error in HuddleService onIceCandidateSnapshot:",i)}}onOffer(e,i){return ee(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: onOffer","color: green;"),this.createPeerConnection(e,i.from)){this.addLocalStreamToPeerConnection(e,!0);let a=i.offer;yield this.setRemoteDescription(e,a),yield this.sendAnswer(e,i.from)}}catch(r){this.loggingService.catch("Error in HuddleService onOffer:",r)}})}sendAnswer(e,i){return ee(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: sendAnswer","color: green;"),this.loggingService.log(e),this.documentPaths?.huddle&&e){let r=yield this.peerConnectionMap[e].createAnswer();yield this.setLocalDescription(e,r);let s={answer:{type:r.type,sdp:r.sdp},from:this.user.userSnippylyId,connectionId:e,to:i},c=on(this.db,`${this.documentPaths?.huddle}/connections/${e}`);this.dbRefsRemoveOnDropCall.push({type:"connection",dbRef:c}),yield jA(c,{answerData:s}),ll(c).remove()}else this.loggingService.catch("Error in sendAnswer: documentPaths not found")}catch(r){this.loggingService.catch("Error in HuddleService onHuddleSnapshot:",r)}})}onAnswer(e,i){return ee(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: onAnswer","color: green;");let r=i.answer;yield this.setRemoteDescription(e,r)}catch(r){this.loggingService.catch("Error in HuddleService onAnswer:",r)}})}onIceCandidateChange(e,i){return ee(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: onIceCandidateChange","color: green;");let r=i.candidate;this.loggingService.log("onIceCandidateChange",r),yield this.peerConnectionMap[e].addIceCandidate(new RTCIceCandidate(r))}catch(r){this.loggingService.catch("Error in HuddleService onIceCandidateChange:",r)}})}setRemoteDescription(e,i){return ee(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: setRemoteDescription","color: green;"),yield this.peerConnectionMap[e].setRemoteDescription(new RTCSessionDescription(i))}catch(r){this.loggingService.catch("Error in HuddleService setRemoteDescription:",r)}})}addAttendee(){return ee(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: addAttendee","color: green;"),this.documentPaths?.huddle&&this.user?.userSnippylyId){let e=T(I({},this.user),{timestamp:this.timestamp,streamMetadata:{webcam:this.localStream?.id,screen:this.screenSharingStream?.id},initialHuddleType:this.initialHuddleType,huddleOnCursorMode:this.huddleOnCursorMode$?.value});e=this.huddleUtilsService.formatHuddleAttendeeData(e);let i=on(this.db,`${this.documentPaths?.huddle}/attendees/${this.user.userSnippylyId}`);yield Mf(i,JSON.parse(JSON.stringify(e))),this.dbRefsRemoveOnDropCall.push({type:"attendee",dbRef:i}),ll(i).remove(),yield this.updateUserHuddleState()}else this.loggingService.catch("Error in addAttendee: documentPaths not found")}catch(e){this.loggingService.catch("Error in HuddleService addAttendee:",e)}})}callExistingAttendees(){try{this.loggingService.log("%c[WB] Calling FUNCTION: callExistingAttendees","color: green;"),hee(this.attendees).pipe(Je(1)).subscribe(e=>{e&&e.length>1?(e.forEach(i=>{i.userSnippylyId!==this.user.userSnippylyId&&!this.onOfferUidHistory[i.userSnippylyId]&&(this.loggingService.log("calling"),this.loggingService.log(i),this.initOffer(i.userSnippylyId))}),this.addLocalStreamToAllPeerConnections()):this.deleteMessages()})}catch(e){this.loggingService.catch("Error in HuddleService callExistingAttendees:",e)}}addLocalStreamToAllPeerConnections(){return ee(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: addLocalStreamToAllPeerConnections","color: green;"),Object.keys(this.senders).forEach(e=>{this.loggingService.log(this.senders[e]),this.localStream.getTracks().forEach(i=>{this.loggingService.log(i),this.senders[e].replaceTrack(i)})})}catch(e){this.loggingService.catch("Error in HuddleService addLocalStreamToAllPeerConnections:",e)}})}initOffer(e){return ee(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: initOffer","color: green;");let i=this.createPeerConnection(null,e);i&&(this.addLocalStreamToPeerConnection(i,!1),yield this.sendOffer(i,e))}catch(i){this.loggingService.catch("Error in HuddleService initOffer:",i)}})}createPeerConnection(e,i){try{return this.loggingService.log("%c[WB] Calling FUNCTION: createPeerConnection","color: green;"),e||(e=this.getCombinedId(this.user?.userSnippylyId,i)),e in this.peerConnectionMap?null:(this.loggingService.log("creating pc"),this.peerConnectionMap[e]=new RTCPeerConnection(this.servers),this.peerConnectionMap[e].onicecandidateerror=r=>{this.loggingService.log("Huddle: onicecandidateerror",r)},this.peerConnectionMap[e].onicecandidate=r=>{if(this.loggingService.log("pc onicecandidate"),r.candidate){let a={candidate:r.candidate.toJSON(),from:this.user.userSnippylyId,connectionId:e},s=fee(this.iceCandidates,a);this.dbRefsRemoveOnDropCall.push({type:"iceCandidate",dbRef:s}),ll(s).remove()}},this.peerConnectionMap[e].ontrack=r=>{this.loggingService.log("pc ontrack"),this.onTrack(e,r)},this.peerConnectionMap[e].onconnectionstatechange=r=>ee(this,null,function*(){this.logStatuses("onconnectionstatechange",e,r),this.peerConnectionMap[e].connectionState==="failed"&&(this.removeConnection(e),this.closeConnection(e),this.checkForRemovingAttendee())}),this.peerConnectionMap[e].onicegatheringstatechange=r=>ee(this,null,function*(){this.logStatuses("onicegatheringstatechange",e,r)}),this.peerConnectionMap[e].onsignalingstatechange=r=>ee(this,null,function*(){this.logStatuses("onsignalingstatechange",e,r)}),this.peerConnectionMap[e].oniceconnectionstatechange=r=>ee(this,null,function*(){this.loggingService.log("pc oniceconnectionstatechange"),this.logStatuses("oniceconnectionstatechange",e,r);try{this.peerConnectionStateMap[e]=this.peerConnectionMap[e].iceConnectionState,this.peerConnectionStateMap$.next(this.peerConnectionStateMap),this.peerConnectionMap[e]?.iceConnectionState==="connected"?(this.loggingService.log("connected"),this.updateTransceiverDirection(e)):this.peerConnectionMap[e]?.iceConnectionState==="disconnected"?this.loggingService.log("Disconnected"):this.peerConnectionMap[e].iceConnectionState==="closed"&&(this.loggingService.log("Closed"),this.closeConnection(e))}catch(a){this.loggingService.catch("Error in HuddleService oniceconnectionstatechange:",a)}}),this.peerConnectionMap[e].onnegotiationneeded=()=>{this.loggingService.log("pc onnegotiationneeded"),this.logStatuses("onnegotiationneeded",e)},e)}catch(r){return this.loggingService.catch("Error in HuddleService createPeerConnection:",r),""}}logStatuses(e,i,r){let a={};["connectionState","iceConnectionState","iceGatheringState","signalingState"].forEach(c=>{a[c]=this.peerConnectionMap[i][c]}),this.loggingService.log("Huddle: logStatues: ",i,e,a,r,this.peerConnectionMap[i])}checkForRemovingAttendee(){return ee(this,null,function*(){try{this.documentPaths?.huddle&&this.user?.userSnippylyId&&(Object.keys(this.peerConnectionMap)?.length||(this.commonDbService.deleteData({feature:"huddleAttendee",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,id:this.user?.userSnippylyId,skipFirestore:!0}}),this.joinHuddle(this.initialHuddleType)))}catch(e){this.loggingService.catch("Error in HuddleService checkForRemovingAttendee:",e)}})}closeConnection(e){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: closeConnection","color: green;"),this.peerConnectionMap[e]){let i=this.peerConnectionMap[e];i.getTransceivers()?.forEach(a=>{a.stop()}),i.getReceivers()?.forEach(a=>{a.track?.stop()}),i.close(),delete this.peerConnectionMap[e],delete this.onAnswerConnectionIdHistory[e],delete this.senders[e];let r=e.split("__").find(a=>a!==this.user?.userSnippylyId);r&&delete this.onOfferUidHistory[r]}}catch(i){this.loggingService.catch("Error in HuddleService closeConnection:",i)}}removeConnection(e){return ee(this,null,function*(){try{this.documentPaths?.huddle&&e&&this.commonDbService.deleteData({feature:"huddleConnection",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,id:e,skipFirestore:!0}})}catch(i){this.loggingService.catch("Error in HuddleService removeConnection:",i)}})}addLocalStreamToPeerConnection(e,i){try{this.loggingService.log("%c[WB] Calling FUNCTION: addLocalStreamToPeerConnection","color: green;"),i?(this.localStream.getTracks().forEach(r=>{this.peerConnectionMap[e].addTrack(r,this.localStream)}),this.screenSharingStream?.getVideoTracks()?.forEach(r=>{this.peerConnectionMap[e].addTrack(r,this.screenSharingStream)})):(this.localStream.getTracks().forEach(r=>{this.peerConnectionMap[e].addTrack(r,this.localStream)}),this.screenSharingStream?.getVideoTracks()?.forEach(r=>{this.peerConnectionMap[e].addTrack(r,this.screenSharingStream)}))}catch(r){this.loggingService.catch("Error in HuddleService addLocalStreamToPeerConnection:",r)}}updateTransceiverDirection(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: updateTransceiverDirection","color: green;");let i=this.peerConnectionMap[e].getTransceivers();this.loggingService.log(i),i.map(r=>{this.loggingService.log(r.currentDirection),r.currentDirection!=="sendrecv"&&(r.direction="sendrecv"),this.senders[e]=r.sender})}catch(i){this.loggingService.catch("Error in HuddleService updateTransceiverDirection:",i)}}generateKey(){this.loggingService.log("%c[WB] Calling FUNCTION: generateKey","color: green;");let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i="";for(let r=0;r<20;r++)i+=e.charAt(Math.floor(Math.random()*e.length));return i}getCombinedId(e,i){try{return e.localeCompare(i)===-1?`${e}__${i}`:`${i}__${e}`}catch(r){return this.loggingService.catch("Error in HuddleService getCombinedId:",r),""}}sendOffer(e,i){return ee(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: sendOffer","color: green;"),this.documentPaths?.huddle&&e){this.onOfferUidHistory[i]=!0;let r=yield this.peerConnectionMap[e].createOffer();yield this.setLocalDescription(e,r);let a={sdp:r.sdp,type:r.type};i||(i="all");let s={offer:a,from:this.user.userSnippylyId,connectionId:e,to:i},c=on(this.db,`${this.documentPaths?.huddle}/connections/${e}`);yield Mf(c,{offerData:s}),this.dbRefsRemoveOnDropCall.push({type:"connection",dbRef:c}),ll(c).remove()}}catch(r){this.loggingService.catch("Error in HuddleService sendOffer:",r)}})}setLocalDescription(e,i){return ee(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: setLocalDescription","color: green;"),yield this.peerConnectionMap[e].setLocalDescription(i)}catch(r){this.loggingService.catch("Error in HuddleService setLocalDescription:",r)}})}onTrack(e,i){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: onTrack","color: green;"),this.remoteStreamMap[e]||(this.remoteStreamMap[e]={}),this.loggingService.log(i.receiver.track),i?.streams?.length){this.remoteStreamMap[e][i.streams[0].id]=i.streams[0];let r=e.split("__").find(s=>s!==this.user?.userSnippylyId),a=this.attendees$.value?.find(s=>s?.userSnippylyId===r);a&&(a?.streamMetadata?.webcam===i.streams[0].id&&(this.remoteStreamMap[e].webcam=i.streams[0]),a?.streamMetadata?.screen===i.streams[0].id&&(this.remoteStreamMap[e].screen=i.streams[0])),this.remoteStreamMap$.next(this.remoteStreamMap)}}catch(r){this.loggingService.catch("Error in HuddleService onTrack:",r)}}toggleScreenSharing(e){return ee(this,null,function*(){try{if(e)this.screenSharingStream=yield navigator.mediaDevices?.getDisplayMedia({video:!0}),Object.keys(this.peerConnectionMap).forEach(i=>{this.peerConnectionMap[i].getSenders().find(s=>s?.track?.kind==this.screenSharingStream?.getVideoTracks()[0].kind)?.replaceTrack(this.screenSharingStream?.getVideoTracks()[0])});else{let i=this.localStream;Object.keys(this.peerConnectionMap).forEach(r=>{this.peerConnectionMap[r].getSenders().find(c=>c?.track?.kind==i.getVideoTracks()[0].kind)?.replaceTrack(i.getVideoTracks()[0])}),this.screenSharingStream?.getTracks().forEach(r=>r.stop())}}catch(i){this.loggingService.catch("Error in HuddleService toggleScreenSharing:",i)}})}setLocalStream(e){return ee(this,null,function*(){try{if(this.localStream=new MediaStream([this.silence(),this.black()]),e?.audio||e?.video){let i=e,r=ac();e?.audio&&(e?.audio instanceof Object?i.audio=T(I({},e?.audio),{deviceId:r?.selectedAudioDevice?.deviceId}):i.audio={deviceId:r?.selectedAudioDevice?.deviceId}),e?.video&&(e?.video instanceof Object?i.video=T(I({},e?.video),{deviceId:r?.selectedVideoDevice?.deviceId}):i.video={deviceId:r?.selectedVideoDevice?.deviceId});let a=yield navigator.mediaDevices.getUserMedia(i);a?.getAudioTracks()?.length&&(this.localStream.getAudioTracks().forEach(s=>this.localStream.removeTrack(s)),a.getAudioTracks().forEach(s=>this.localStream.addTrack(s))),a?.getVideoTracks()?.length&&(this.localStream.getVideoTracks().forEach(s=>this.localStream.removeTrack(s)),a.getVideoTracks().forEach(s=>this.localStream.addTrack(s)))}this.localStream$.next(this.localStream)}catch(i){this.loggingService.catch("Error in HuddleService setLocalStream:",i)}})}setScreenSharingStream(){return ee(this,null,function*(){try{let e=yield navigator.mediaDevices?.getDisplayMedia({video:!0});e&&this.screenSharingStream$.next(e)}catch(e){this.loggingService.catch("Error in HuddleService setScreenSharingStream:",e)}})}removeLocalStream(){return ee(this,null,function*(){try{this.localStream$?.value&&(this.localStream$.value.getTracks().forEach(i=>{i.stop()}),this.localStream$.next(null))}catch(e){this.loggingService.catch("Error in HuddleService removeLocalStream:",e)}})}toggleLocalStreamAudio(e){return ee(this,null,function*(){try{let i=this.localStream$.value;if(i){let r=i.getAudioTracks()[0];if(r.enabled&&!e)r.stop(),i.getAudioTracks()?.forEach(a=>{i.removeTrack(a)}),i.addTrack(this.silence()),this.analyticsService.trackEvent(Z.Events.Huddle.HUDDLE_AUDIO_MUTED,{huddleType:this.initialHuddleType,totalUsers:this.getHuddleAttendees()?.length||0,totalUserHuddleDuration:this.getTotalUserHuddleDuration(),huddleSnippylyUserIds:this.getHuddleAttendees()?.map(a=>a?.userSnippylyId),huddleClientUserIds:this.getHuddleAttendees()?.map(a=>a?.userId)});else{let a=ac(),s=yield navigator.mediaDevices.getUserMedia({audio:{deviceId:a?.selectAudioDevice?.deviceId}});s&&(i.getAudioTracks()?.forEach(c=>{i.removeTrack(c)}),s.getAudioTracks()?.forEach(c=>{i.addTrack(c)}),this.analyticsService.trackEvent(Z.Events.Huddle.HUDDLE_AUDIO_UNMUTED,{huddleType:this.initialHuddleType,totalUsers:this.getHuddleAttendees()?.length||0,totalUserHuddleDuration:this.getTotalUserHuddleDuration(),huddleSnippylyUserIds:this.getHuddleAttendees()?.map(c=>c?.userSnippylyId),huddleClientUserIds:this.getHuddleAttendees()?.map(c=>c?.userId)}))}Object.keys(this.peerConnectionMap).forEach(a=>{this.peerConnectionMap[a].getSenders().find(p=>p?.track?.kind==i?.getAudioTracks()[0].kind)?.replaceTrack(i?.getAudioTracks()[0])}),this.updateUserHuddleState()}}catch(i){this.loggingService.catch("Error in HuddleService toggleLocalStreamAudio:",i)}})}toggleLocalStreamVideo(e){return ee(this,null,function*(){try{let i=this.localStream$.value;if(i){let r=i.getVideoTracks()[0];if(r.enabled&&!e)r.stop(),i.getVideoTracks()?.forEach(a=>{i.removeTrack(a)}),i.addTrack(this.black()),this.analyticsService.trackEvent(Z.Events.Huddle.HUDDLE_VIDEO_TURNED_OFF,{huddleType:this.initialHuddleType,totalUsers:this.getHuddleAttendees()?.length||0,totalUserHuddleDuration:this.getTotalUserHuddleDuration(),huddleSnippylyUserIds:this.getHuddleAttendees()?.map(a=>a?.userSnippylyId),huddleClientUserIds:this.getHuddleAttendees()?.map(a=>a?.userId)});else{let a=ac(),s=yield navigator.mediaDevices.getUserMedia({video:{deviceId:a?.selectedVideoDevice?.deviceId}});s&&(i.getVideoTracks()?.forEach(c=>{i.removeTrack(c)}),s.getVideoTracks()?.forEach(c=>{i.addTrack(c)}),this.analyticsService.trackEvent(Z.Events.Huddle.HUDDLE_VIDEO_TURNED_ON,{huddleType:this.initialHuddleType,totalUsers:this.getHuddleAttendees()?.length||0,totalUserHuddleDuration:this.getTotalUserHuddleDuration(),huddleSnippylyUserIds:this.getHuddleAttendees()?.map(c=>c?.userSnippylyId),huddleClientUserIds:this.getHuddleAttendees()?.map(c=>c?.userId)}))}Object.keys(this.peerConnectionMap).forEach(a=>{this.peerConnectionMap[a].getSenders().find(p=>p?.track?.kind==i?.getVideoTracks()[0].kind)?.replaceTrack(i?.getVideoTracks()[0])}),this.updateUserHuddleState()}}catch(i){this.loggingService.catch("Error in HuddleService toggleLocalStreamVideo:",i)}})}toggleLocalScreenSharing(){return ee(this,null,function*(){try{let e=this.screenSharingStream;if(e){if(e.getVideoTracks()[0].enabled)this.stopScreenSharingStream();else{let r=yield navigator.mediaDevices?.getDisplayMedia({video:!0});r&&(e.getVideoTracks()?.forEach(a=>{e.removeTrack(a)}),r.getVideoTracks()?.forEach(a=>{e.addTrack(a),a.onended=()=>{this.stopScreenSharingStream(),this.updateScreenSharingTracksToPeers(),this.updateUserHuddleState()}})),this.screenSharingStream$.next(e),this.analyticsService.trackEvent(Z.Events.Huddle.HUDDLE_SCREENSHARING_STARTED,{huddleType:this.initialHuddleType,totalUsers:this.getHuddleAttendees()?.length||0,totalUserHuddleDuration:this.getTotalUserHuddleDuration(),huddleSnippylyUserIds:this.getHuddleAttendees()?.map(a=>a?.userSnippylyId),huddleClientUserIds:this.getHuddleAttendees()?.map(a=>a?.userId)})}this.updateScreenSharingTracksToPeers(),this.updateUserHuddleState()}}catch(e){this.loggingService.catch("Error in HuddleService toggleLocalScreenSharing:",e)}})}stopScreenSharingStream(){return ee(this,null,function*(){let e=this.screenSharingStream;if(e){let i=e.getVideoTracks()[0];i.enabled&&(i.stop(),e.getVideoTracks()?.forEach(r=>{e.removeTrack(r)}),e.addTrack(this.black()),this.analyticsService.trackEvent(Z.Events.Huddle.HUDDLE_SCREENSHARING_STOPPED,{huddleType:this.initialHuddleType,totalUsers:this.getHuddleAttendees()?.length||0,totalUserHuddleDuration:this.getTotalUserHuddleDuration(),huddleSnippylyUserIds:this.getHuddleAttendees()?.map(r=>r?.userSnippylyId),huddleClientUserIds:this.getHuddleAttendees()?.map(r=>r?.userId)}))}})}updateScreenSharingTracksToPeers(){return ee(this,null,function*(){Object.keys(this.peerConnectionMap).forEach(e=>{let r=this.peerConnectionMap[e].getSenders().filter(a=>a?.track?.kind==this.screenSharingStream?.getVideoTracks()[0].kind);r?.length>1&&r[1]?.replaceTrack(this.screenSharingStream?.getVideoTracks()[0])})})}dropCall(){return ee(this,null,function*(){try{this.messagesSubscription&&this.messagesSubscription.unsubscribe(),this.removeHuddleSessionData(),this.huddleJoined=!1,this.huddleJoined$.next(!1),this.peerConnectionMap&&Object.keys(this.peerConnectionMap).forEach(e=>{let i=this.peerConnectionMap[e];i.getTransceivers()?.forEach(r=>{r.stop()}),i.getSenders()?.forEach(r=>{r.track?.stop()}),i.getReceivers()?.forEach(r=>{r.track?.stop()}),i.close()}),this.peerConnectionMap={},this.dbRefsRemoveOnDropCall.forEach(e=>ee(this,null,function*(){yield VA(e.dbRef)})),this.onOfferUidHistory={},this.onAnswerConnectionIdHistory={},this.senders={},this.peerConnectionStateMap={},this.peerConnectionStateMap$.next(this.peerConnectionStateMap),this.localStream.getTracks().forEach(e=>{e.stop()}),this.screenSharingStream.getTracks().forEach(e=>{e.stop()}),this.localStream=new MediaStream([this.silence(),this.black()]),this.screenSharingStream=new MediaStream([this.black()]),this.localStream$.next(this.localStream),this.screenSharingStream$.next(this.screenSharingStream),this.localStreamState$.next({audioState:!1,videoState:!1,screenSharingState:!1}),this.analyticsService.trackEvent(Z.Events.Huddle.HUDDLE_LEFT,{huddleType:this.initialHuddleType,totalUsers:this.getHuddleAttendees()?.length||0,totalUserHuddleDuration:this.getTotalUserHuddleDuration(),huddleSnippylyUserIds:this.getHuddleAttendees()?.map(e=>e?.userSnippylyId),huddleClientUserIds:this.getHuddleAttendees()?.map(e=>e?.userId)})}catch(e){this.loggingService.catch("Error in HuddleService dropCall:",e)}})}updateHuddleSessionData(e,i,r){try{let a=JSON.parse(sessionStorage.getItem(U.SESSION_STORAGE.SNIPPYLY_HUDDLE_DATA)||"{}");r?sessionStorage.setItem(U.SESSION_STORAGE.SNIPPYLY_HUDDLE_DATA,JSON.stringify(r)):(a[e]=i,sessionStorage.setItem(U.SESSION_STORAGE.SNIPPYLY_HUDDLE_DATA,JSON.stringify(a)))}catch(a){this.loggingService.catch("Error in HuddleService updateHuddleSessionData:",a)}}getHuddleSessionData(){try{return sessionStorage.getItem(U.SESSION_STORAGE.SNIPPYLY_HUDDLE_DATA)?JSON.parse(sessionStorage.getItem(U.SESSION_STORAGE.SNIPPYLY_HUDDLE_DATA)):null}catch(e){return this.loggingService.catch("Error in HuddleService getHuddleSessionData:",e),null}}removeHuddleSessionData(){try{sessionStorage.removeItem(U.SESSION_STORAGE.SNIPPYLY_HUDDLE_DATA)}catch(e){this.loggingService.catch("Error in HuddleService removeHuddleSessionData:",e)}}removeAttendee(){return ee(this,null,function*(){try{if(this.documentPaths?.huddle&&this.user.userSnippylyId){yield this.commonDbService.deleteData({feature:"huddleAttendee",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,id:this.user?.userSnippylyId,skipFirestore:!0}});return}else return}catch(e){return this.loggingService.catch("Error in HuddleService removeAttendee:",e),Promise.resolve(null)}})}updateUserHuddleState(){return ee(this,null,function*(){try{if(this.attendees&&this.user&&this.documentPaths?.huddle){let e=this.getAudioState(),i=this.getVideoState(),r=this.getScreenSharingState();this.localStreamState$.next({audioState:e,videoState:i,screenSharingState:r});let a={audioState:e,videoState:i,screenSharingState:r};yield this.commonDbService.setData({feature:"huddleAttendeeState",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,id:this.user?.userSnippylyId,skipFirestore:!0},data:a})}}catch(e){this.loggingService.catch("Error in HuddleService updateUserHuddleState:",e)}})}updateHuddleOnCursorMode(){return ee(this,null,function*(){try{if(this.attendees&&this.user&&this.documentPaths?.huddle){let e=on(this.db,`${this.documentPaths?.huddle}/attendees/${this.user.userSnippylyId}/huddleOnCursorMode`);yield Mf(e,!!this.huddleOnCursorMode$.value)}}catch(e){this.loggingService.catch("Error in HuddleService updateHuddleOnCursorMode:",e)}})}getAudioState(){try{let e=this.localStream$.value;if(e){let i=e?.getAudioTracks();return!!(i?.length?i[0]:null)?.enabled}return!1}catch(e){return this.loggingService.catch("Error in HuddleService getAudioState:",e),!1}}getVideoState(){try{let e=this.localStream$.value;if(e){let i=e?.getVideoTracks();return!!(i?.length?i[0]:null)?.enabled}return!1}catch(e){return this.loggingService.catch("Error in HuddleService getVideoState:",e),!1}}getScreenSharingState(){try{let e=this.screenSharingStream;if(e){let i=e?.getVideoTracks();return!!(i?.length?i[0]:null)?.enabled}return!1}catch(e){return this.loggingService.catch("Error in HuddleService getVideoState:",e),!1}}removeIceCandidates(e){return ee(this,null,function*(){try{if(this.documentPaths?.huddle&&e){let i=yield this.commonDbService?.getData({feature:"allHuddleIceCandidates",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",skipFirestore:!0}});Object.keys(i).length>0&&Object.keys(i).forEach(r=>ee(this,null,function*(){i[r].connectionId===e&&this.commonDbService.deleteData({feature:"huddleIceCandidate",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,id:r,skipFirestore:!0}})}))}}catch(i){this.loggingService.catch("Error in HuddleService dropCall:",i)}})}get timestamp(){return this.commonDbService.getServerTimestamp()}silence(){try{let e=new AudioContext,i=e.createOscillator(),r=i.connect(e.createMediaStreamDestination());return i.start(),Object.assign(r.stream.getAudioTracks()[0],{enabled:!1})}catch(e){this.loggingService.catch("Error in HuddleService silence:",e)}}black({width:e=640,height:i=480}={}){try{let r=Object.assign(document.createElement("canvas"),{width:e,height:i});r.getContext("2d")?.fillRect(0,0,e,i);let a=r.captureStream();return Object.assign(a.getVideoTracks()[0],{enabled:!1})}catch(r){this.loggingService.catch("Error in HuddleService black:",r)}}getInitialHuddleType(){try{return this.initialHuddleType}catch(e){return this.loggingService.catch("Error in HuddleService getInitialHuddleType:",e),null}}getHuddleAttendees$(){try{return this.attendees$.asObservable()}catch(e){return this.loggingService.catch("Error in HuddleService getHuddleAttendees$:",e),re([])}}getHuddleAttendees(){try{return this.attendees$.value}catch(e){return this.loggingService.catch("Error in HuddleService getHuddleAttendees:",e),null}}getHuddleInvitees$(){try{return this.invitees$.asObservable()}catch(e){return this.loggingService.catch("Error in HuddleService getHuddleInvitees$:",e),re([])}}getHuddleInvitees(){try{return this.invitees$.value}catch(e){return this.loggingService.catch("Error in HuddleService getHuddleInvitees:",e),null}}getHuddleStartTime(){try{return this.userHuddleStartTime$.value}catch(e){return this.loggingService.catch("Error in HuddleService getHuddleStartTime:",e),null}}getTotalUserHuddleDuration(){try{return this.userHuddleStartTime$.value?new Date().getTime()-this.userHuddleStartTime$.value:null}catch(e){return this.loggingService.catch("Error in HuddleService gettotalUserHuddleDuration:",e),null}}inviteUsers(e){try{this.updateInvitees(e);let i={};i.notificationSource="huddleInvite",i.huddleInvitees=e,i.huddleType=this.getInitialHuddleType(),this.updateNotificationsDatabase(i)}catch(i){this.loggingService.catch("Error in HuddleService inviteUsers:",i)}}updateInvitees(e){try{if(this.documentPaths?.huddle){let i={};e.forEach(r=>{if(r?.email){let a=Rt(r.email);i[a]=r}}),this.commonDbService.setData({feature:"allHuddleInvitees",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0},data:i})}}catch(i){this.loggingService.catch("Error in HuddleService updateInvitees:",i)}}updateNotificationsDatabase(e={}){try{let i=I({notificationSource:"huddle"},e);this.notificationService.updateNotificationDatabase(i)}catch(i){this.loggingService.catch("Error in HuddleService updateNotificationsDatabase: ",i)}}getHuddleJoined$(){try{return this.huddleJoined$.asObservable()}catch(e){return this.loggingService.catch("Error in HuddleService getHuddleJoined$:",e),re(!1)}}getHuddleCursorAvailableByAttendeeId(){try{return this.huddleCursorAvailableByAttendeeId$.value}catch(e){return this.loggingService.catch("Error in HuddleService getHuddleCursorAvailableByAttendeeId:",e),null}}getHuddleCursorAvailableByAttendeeId$(){try{return this.huddleCursorAvailableByAttendeeId$.asObservable()}catch(e){return this.loggingService.catch("Error in HuddleService getHuddleCursorAvailableByAttendeeId$:",e),re({})}}updateHuddleCursorAvailableByAttendeeId(e,i){try{let r=this.huddleCursorAvailableByAttendeeId$.value;r[e]=i,this.huddleCursorAvailableByAttendeeId$.next(r)}catch(r){this.loggingService.catch("Error in HuddleService updateCursorUserAvailableByUserId:",r)}}setRemoteStreamsByUserId(e){try{this.remoteStreamsByUserId$.next(e)}catch(i){this.loggingService.catch("Error in HuddleService setRemoteStreamsByUserId:",i)}}getRemoteStreamsByUserId$(){try{return this.remoteStreamsByUserId$.asObservable()}catch(e){return this.loggingService.catch("Error in HuddleService getRemoteStreamsByUserId$:",e),re({})}}enableHuddleOnCursorMode(){try{this.huddleOnCursorMode$.next(!0)}catch(e){this.loggingService.catch("Error in HuddleService enableHuddleOnCursorMode:",e)}}disableHuddleOnCursorMode(){try{this.huddleOnCursorMode$.next(!1)}catch(e){this.loggingService.catch("Error in HuddleService disableHuddleOnCursorMode:",e)}}getHuddleOnCursorMode$(){try{return this.huddleOnCursorMode$.asObservable()}catch(e){return this.loggingService.catch("Error in HuddleService getHuddleOnCursorMode$:",e),re(!1)}}enableFlockModeOnAvatarClick(){try{this.flockModeOnAvatarClickEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in HuddleService enableFlockModeOnAvatarClick:",e)}}disableFlockModeOnAvatarClick(){try{this.flockModeOnAvatarClickEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in HuddleService disableFlockModeOnAvatarClick:",e)}}getFlockModeOnAvatarClick$(){try{return this.flockModeOnAvatarClickEnabled$.asObservable()}catch(e){return this.loggingService.catch("Error in HuddleService getFlockModeOnAvatarClick$:",e),re(!1)}}getFlockModeOnAvatarClick(){try{return this.flockModeOnAvatarClickEnabled$.value}catch(e){return this.loggingService.catch("Error in HuddleService getFlockModeOnAvatarClick:",e),!1}}enableChat(){try{this.chatEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in HuddleService enableChat:",e)}}disableChat(){try{this.chatEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in HuddleService disableChat:",e)}}getChatEnabled$(){try{return this.chatEnabled$.asObservable()}catch(e){return this.loggingService.catch("Error in HuddleService getChatEnabled$:",e),re(!1)}}getChatEnabled(){try{return this.chatEnabled$.value}catch(e){return this.loggingService.catch("Error in HuddleService getChatEnabled:",e),!1}}getHuddleOnCursorModeByAttendeeId$(){try{return this.huddleOnCursorModeByAttendeeId$.asObservable()}catch(e){return this.loggingService.catch("Error in HuddleService getHuddleOnCursorModeByAttendeeId$:",e),re({})}}toggleHuddleOnCursorModeByAttendeeId(e){try{let i=this.huddleOnCursorModeByAttendeeId$.value;i[e]?delete i[e]:i[e]=!0,this.huddleOnCursorModeByAttendeeId$.next(i)}catch(i){this.loggingService.catch("Error in HuddleService toggleHuddleOnCursorModeByAttendeeId:",i)}}addCursorTag(){try{if(!document.querySelector(`${U.TAGS.SNIPPYLY_CURSOR}`)){let e=document.createElement(U.TAGS.SNIPPYLY_CURSOR);e.setAttribute("snippyly-temporary","true"),document.body.appendChild(e)}}catch(e){this.loggingService.catch("Error in HuddleService addCursorTag:",e)}}removeCursorTag(){try{let e=document.querySelector(`${U.TAGS.SNIPPYLY_CURSOR}`);e?.hasAttribute("snippyly-temporary")&&e.remove()}catch(e){this.loggingService.catch("Error in HuddleService removeCursorTag:",e)}}sendMessage(e){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: sendMessage","color: green;"),this.documentPaths?.huddle&&this.user){let i=new lM;i.message=e,i.from=this.user,i.timestamp=this.timestamp,this.commonDbService.setData({feature:"huddleMessage",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,id:i.id,skipFirestore:!0},data:i})}}catch(i){this.loggingService.catch("Error in HuddleService sendMessage:",i)}}getMessages$(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getMessages$","color: green;"),this.messages$.asObservable()}catch(e){return this.loggingService.catch("Error in HuddleService getMessages$:",e),re([])}}deleteMessages(){try{this.loggingService.log("%c[WB] Calling FUNCTION: deleteMessages","color: green;"),this.documentPaths?.huddle&&this.commonDbService.deleteData({feature:"allHuddleMessages",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}})}catch(e){this.loggingService.catch("Error in HuddleService deleteMessages:",e)}}showMessagesPanel(){try{this.loggingService.log("%c[WB] Calling FUNCTION: showMessagesPanel","color: green;"),this.messagesPanelVisible$.next(!0)}catch(e){this.loggingService.catch("Error in HuddleService showMessagesPanel:",e)}}hideMessagesPanel(){try{this.loggingService.log("%c[WB] Calling FUNCTION: hideMessagesPanel","color: green;"),this.messagesPanelVisible$.next(!1)}catch(e){this.loggingService.catch("Error in HuddleService hideMessagesPanel:",e)}}toggleMessagesPanel(){try{this.loggingService.log("%c[WB] Calling FUNCTION: toggleMessagesPanel","color: green;"),this.messagesPanelVisible$.next(!this.messagesPanelVisible$.value)}catch(e){this.loggingService.catch("Error in HuddleService toggleMessagesPanel:",e)}}getMessagesPanelVisible$(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getMessagesPanelVisible$","color: green;"),this.messagesPanelVisible$.asObservable()}catch(e){return this.loggingService.catch("Error in HuddleService getMessagesPanelVisible$:",e),re(!1)}}getMessagesPanelVisible(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getMessagesPanelVisible","color: green;"),this.messagesPanelVisible$.value}catch(e){return this.loggingService.catch("Error in HuddleService getMessagesPanelVisible:",e),!1}}signOutUser(e){return ee(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: signOutUser","color: green;"),this.huddleJoined$.value&&(yield this.dropCall(),yield this.removeLocalStream(),yield this.removeAttendee())}catch(i){this.loggingService.catch("Error in HuddleService signOutUser:",i)}})}};o.\u0275fac=function(i){return new(i||o)(J(vi),J(Qe),J(je),J(pn),J(lt),J($t),J(Fe),J(xM),J(Vo),J(y),J(Vn),J(bn),J(Hn))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var GM=class extends li{constructor(o){super(o),this.getService(y).log("%c[WB] Creating CLASS: HuddleElement","color: blue;"),this.enableCursorMode=this._enableCursorMode,this.disableCursorMode=this._disableCursorMode,this.enableChat=this._enableChat,this.disableChat=this._disableChat,this.enableFlockModeOnAvatarClick=this._enableFlockModeOnAvatarClick,this.disableFlockModeOnAvatarClick=this._disableFlockModeOnAvatarClick}_enableCursorMode(){this.getService(y).log("%c[WB] Calling FUNCTION: _enableCursorMode","color: green;");try{this.trackEvent(Z.Events.Huddle.ENABLE_HUDDLE_ON_CURSOR_MODE_TRIGGERED),this.getService(mr).enableHuddleOnCursorMode()}catch(o){this.getService(y).catch("Error in enableCursorMode: ",o)}}_disableCursorMode(){this.getService(y).log("%c[WB] Calling FUNCTION: _disableCursorMode","color: green;");try{this.trackEvent(Z.Events.Huddle.DISABLE_HUDDLE_ON_CURSOR_MODE_TRIGGERED),this.getService(mr).disableHuddleOnCursorMode()}catch(o){this.getService(y).catch("Error in disableCursorMode: ",o)}}_enableChat(){this.getService(y).log("%c[WB] Calling FUNCTION: _enableChat","color: green;");try{this.trackEvent(Z.Events.Huddle.ENABLE_CHAT_TRIGGERED),this.getService(mr).enableChat()}catch(o){this.getService(y).catch("Error in enableChat: ",o)}}_disableChat(){this.getService(y).log("%c[WB] Calling FUNCTION: _disableChat","color: green;");try{this.trackEvent(Z.Events.Huddle.DISABLE_CHAT_TRIGGERED),this.getService(mr).disableChat()}catch(o){this.getService(y).catch("Error in disableChat: ",o)}}_enableFlockModeOnAvatarClick(){this.getService(y).log("%c[WB] Calling FUNCTION: _enableFlockModeOnAvatarClick","color: green;");try{this.trackEvent(Z.Events.Huddle.ENABLE_FLOCK_MODE_ON_AVATAR_CLICK_TRIGGERED),this.getService(mr).enableFlockModeOnAvatarClick()}catch(o){this.getService(y).catch("Error in enableFlockModeOnAvatarClick: ",o)}}_disableFlockModeOnAvatarClick(){this.getService(y).log("%c[WB] Calling FUNCTION: _disableFlockModeOnAvatarClick","color: green;");try{this.trackEvent(Z.Events.Huddle.DISABLE_FLOCK_MODE_ON_AVATAR_CLICK_TRIGGERED),this.getService(mr).disableFlockModeOnAvatarClick()}catch(o){this.getService(y).catch("Error in disableFlockModeOnAvatarClick: ",o)}}};var WM=class extends li{constructor(o){super(o),this.getService(y).log("%c[WB] Creating CLASS: LiveStateElement","color: blue;"),this.getLiveStateData$=this._getLiveStateData,this.getLiveStateData=this._getLiveStateData,this.setLiveStateData=this._setLiveStateData,this.enableSingleEditorMode=this._enableSingleEditorMode,this.disableSingleEditorMode=this._disableSingleEditorMode,this.isUserEditor$=this._isUserEditor,this.isUserEditor=this._isUserEditor,this.getEditor=this._getEditor,this.setUserAsEditor=this._setUserAsEditor,this.resetUserAccess=this._resetUserAccess,this.singleEditorModeContainerIds=this._singleEditorModeContainerIds,this.enableAutoSyncState=this._enableAutoSyncState,this.disableAutoSyncState=this._disableAutoSyncState,this.requestEditorAccess=this._requestEditorAccess,this.isEditorAccessRequested=this._isEditorAccessRequested,this.acceptEditorAccessRequest=this._acceptEditorAccessRequest,this.rejectEditorAccessRequest=this._rejectEditorAccessRequest,this.cancelEditorAccessRequest=this._cancelEditorAccessRequest,this.editCurrentTab=this._editCurrentTab,this.setEditorAccessTimeout=this._setEditorAccessTimeout,this.enableEditorAccessTransferOnTimeOut=this._enableEditorAccessTransferOnTimeOut,this.disableEditorAccessTransferOnTimeOut=this._disableEditorAccessTransferOnTimeOut,this.enableDefaultSingleEditorUI=this._enableDefaultSingleEditorUI,this.disableDefaultSingleEditorUI=this._disableDefaultSingleEditorUI,this.getEditorAccessTimer=this._getEditorAccessTimer,this.onServerConnectionStateChange=this._onServerConnectionStateChange}_getLiveStateData(o,t){this.getService(y).log("%c[WB] Calling FUNCTION: getLiveStateData","color: green;");try{return this.trackEvent(Z.Events.LiveStateSync.GET_LIVE_STATE_DATA_TRIGGERED),this.getService(Di).getLiveStateData$(o,t)}catch(e){return this.getService(y).catch("Error in _getLiveStateData: ",e),re(null)}}_setLiveStateData(o,t,e){this.getService(y).log("%c[WB] Calling FUNCTION: setLiveStateData","color: green;");try{return this.trackEvent(Z.Events.LiveStateSync.SET_LIVE_STATE_DATA_TRIGGERED),this.getService(Di).setLiveStateData(o,t,e)}catch(i){return this.getService(y).catch("Error in _setLiveStateData: ",i),Promise.resolve()}}_enableSingleEditorMode(o){this.getService(y).log("%c[WB] Calling FUNCTION: enableSingleEditorMode","color: green;");try{this.trackEvent(Z.Events.LiveStateSync.ENABLE_SINGLE_EDITOR_MODE_TRIGGERED),this.getService(Di).enableSingleEditorMode(o)}catch(t){this.getService(y).catch("Error in _enableSingleEditorMode: ",t)}}_disableSingleEditorMode(){this.getService(y).log("%c[WB] Calling FUNCTION: disableSingleEditorMode","color: green;");try{this.trackEvent(Z.Events.LiveStateSync.DISABLE_SINGLE_EDITOR_MODE_TRIGGERED),this.getService(Di).disableSingleEditorMode()}catch(o){this.getService(y).catch("Error in _disableSingleEditorMode: ",o)}}_isUserEditor(){this.getService(y).log("%c[WB] Calling FUNCTION: isUserEditor$","color: green;");try{return this.trackEvent(Z.Events.LiveStateSync.IS_USER_EDITOR_TRIGGERED),this.getService(Di).isUserEditor$()}catch(o){return this.getService(y).catch("Error in _isUserEditor$: ",o),re(null)}}_getEditor(){this.getService(y).log("%c[WB] Calling FUNCTION: getEditor","color: green;");try{return this.trackEvent(Z.Events.LiveStateSync.GET_EDITOR_TRIGGERED),this.getService(Di).getEditor$()}catch(o){return this.getService(y).catch("Error in _getEditor: ",o),re(null)}}_setUserAsEditor(){this.getService(y).log("%c[WB] Calling FUNCTION: setUserAsEditor","color: green;");try{this.trackEvent(Z.Events.LiveStateSync.SET_USER_AS_EDITOR_TRIGGERED),this.getService(Di).setUserAsEditor()}catch(o){this.getService(y).catch("Error in _setUserAsEditor: ",o)}}_resetUserAccess(){this.getService(y).log("%c[WB] Calling FUNCTION: resetUserAccess","color: green;");try{this.trackEvent(Z.Events.LiveStateSync.RESET_USER_ACCESS_TRIGGERED),this.getService(Di).removeEditorAccess()}catch(o){this.getService(y).catch("Error in _resetUserAccess: ",o)}}_singleEditorModeContainerIds(o){this.getService(y).log("%c[WB] Calling FUNCTION: singleEditorModeContainerIds","color: green;");try{this.trackEvent(Z.Events.LiveStateSync.SINGLE_EDITOR_MODE_CONTAINER_IDS_TRIGGERED),this.getService(Di).setSingleEditorModeContainerIds(o)}catch(t){this.getService(y).catch("Error in _singleEditorModeContainerIds: ",t)}}_enableAutoSyncState(){this.getService(y).log("%c[WB] Calling FUNCTION: enableAutoSyncState","color: green;");try{this.trackEvent(Z.Events.LiveStateSync.ENABLE_AUTO_SYNC_STATE_TRIGGERED),this.getService(Di).enableAutoSyncState()}catch(o){this.getService(y).catch("Error in _enableAutoSyncState: ",o)}}_disableAutoSyncState(){this.getService(y).log("%c[WB] Calling FUNCTION: disableAutoSyncState","color: green;");try{this.trackEvent(Z.Events.LiveStateSync.DISABLE_AUTO_SYNC_STATE_TRIGGERED),this.getService(Di).disableAutoSyncState()}catch(o){this.getService(y).catch("Error in _disableAutoSyncState: ",o)}}_requestEditorAccess(){this.getService(y).log("%c[WB] Calling FUNCTION: requestEditorAccess","color: green;");try{return this.trackEvent(Z.Events.LiveStateSync.REQUEST_EDITOR_ACCESS_TRIGGERED),this.getService(Di).requestEditorAccess()}catch(o){return this.getService(y).catch("Error in _requestEditorAccess: ",o),re(null)}}_isEditorAccessRequested(){this.getService(y).log("%c[WB] Calling FUNCTION: isEditorAccessRequested","color: green;");try{return this.trackEvent(Z.Events.LiveStateSync.IS_EDITOR_ACCESS_REQUESTED_TRIGGERED),this.getService(Di).isEditorAccessRequested$()}catch(o){return this.getService(y).catch("Error in _isEditorAccessRequested: ",o),re(null)}}_acceptEditorAccessRequest(){this.getService(y).log("%c[WB] Calling FUNCTION: acceptEditorAccessRequest","color: green;");try{this.trackEvent(Z.Events.LiveStateSync.ACCEPT_EDITOR_ACCESS_REQUEST_TRIGGERED),this.getService(Di).acceptEditorAccessRequest()}catch(o){this.getService(y).catch("Error in _acceptEditorAccessRequest: ",o)}}_rejectEditorAccessRequest(){this.getService(y).log("%c[WB] Calling FUNCTION: rejectEditorAccessRequest","color: green;");try{this.trackEvent(Z.Events.LiveStateSync.REJECT_EDITOR_ACCESS_REQUEST_TRIGGERED),this.getService(Di).rejectEditorAccessRequest()}catch(o){this.getService(y).catch("Error in _rejectEditorAccessRequest: ",o)}}_cancelEditorAccessRequest(){this.getService(y).log("%c[WB] Calling FUNCTION: cancelEditorAccessRequest","color: green;");try{this.trackEvent(Z.Events.LiveStateSync.CANCEL_EDITOR_ACCESS_REQUEST_TRIGGERED),this.getService(Di).cancelEditorAccessRequest()}catch(o){this.getService(y).catch("Error in _cancelEditorAccessRequest: ",o)}}_editCurrentTab(){this.getService(y).log("%c[WB] Calling FUNCTION: editCurrentTab","color: green;");try{this.trackEvent(Z.Events.LiveStateSync.EDIT_CURRENT_TAB_TRIGGERED),this.getService(Di).editCurrentTab()}catch(o){this.getService(y).catch("Error in _editCurrentTab: ",o)}}_setEditorAccessTimeout(o){this.getService(y).log("%c[WB] Calling FUNCTION: setEditorAccessTimeout","color: green;");try{this.trackEvent(Z.Events.LiveStateSync.SET_EDITOR_ACCESS_TIMEOUT_TRIGGERED),this.getService(Di).setEditorAccessTimeout(o)}catch(t){this.getService(y).catch("Error in _setEditorAccessTimeout: ",t)}}_enableEditorAccessTransferOnTimeOut(){this.getService(y).log("%c[WB] Calling FUNCTION: enableEditorAccessTransferOnTimeOut","color: green;");try{this.trackEvent(Z.Events.LiveStateSync.ENABLE_EDITOR_ACCESS_TRANSFER_ON_TIMEOUT_TRIGGERED),this.getService(Di).enableEditorAccessTransferOnTimeOut()}catch(o){this.getService(y).catch("Error in _enableEditorAccessTransferOnTimeOut: ",o)}}_disableEditorAccessTransferOnTimeOut(){this.getService(y).log("%c[WB] Calling FUNCTION: disableEditorAccessTransferOnTimeOut","color: green;");try{this.trackEvent(Z.Events.LiveStateSync.DISABLE_EDITOR_ACCESS_TRANSFER_ON_TIMEOUT_TRIGGERED),this.getService(Di).disableEditorAccessTransferOnTimeOut()}catch(o){this.getService(y).catch("Error in _disableEditorAccessTransferOnTimeOut: ",o)}}_enableDefaultSingleEditorUI(){this.getService(y).log("%c[WB] Calling FUNCTION: enableDefaultSingleEditorUI","color: green;");try{this.trackEvent(Z.Events.LiveStateSync.ENABLE_DEFAULT_SINGLE_EDITOR_UI_TRIGGERED),this.getService(Di).enableDefaultSingleEditorUI()}catch(o){this.getService(y).catch("Error in _enableDefaultSingleEditorUI: ",o)}}_disableDefaultSingleEditorUI(){this.getService(y).log("%c[WB] Calling FUNCTION: disableDefaultSingleEditorUI","color: green;");try{this.trackEvent(Z.Events.LiveStateSync.DISABLE_DEFAULT_SINGLE_EDITOR_UI_TRIGGERED),this.getService(Di).disableDefaultSingleEditorUI()}catch(o){this.getService(y).catch("Error in _disableDefaultSingleEditorUI: ",o)}}_getEditorAccessTimer(){this.getService(y).log("%c[WB] Calling FUNCTION: getEditorAccessTimer","color: green;");try{return this.trackEvent(Z.Events.LiveStateSync.GET_EDITOR_ACCESS_TIMER_TRIGGERED),this.getService(Di).getEditorAccessTimer$()}catch(o){return this.getService(y).catch("Error in _getEditorAccessTimer: ",o),re(new Bv)}}_onServerConnectionStateChange(){this.getService(y).log("%c[WB] Calling FUNCTION: onServerConnectionStateChange","color: green;");try{return this.trackEvent(Z.Events.LiveStateSync.ON_SERVER_CONNECTION_STATE_CHANGE_TRIGGERED),this.getService(Di).onServerConnectionStateChange$()}catch(o){return this.getService(y).catch("Error in _onServerConnectionStateChange: ",o),re(gl.PENDING_INIT)}}};var qM=class extends li{constructor(o){super(o),this.getService(y).log("%c[WB] Creating CLASS: ViewsElement","color: blue;"),this.openHistoryPanel=this._openHistoryPanel,this.closeHistoryPanel=this._closeHistoryPanel,this.toggleHistoryPanel=this._toggleHistoryPanel,this.getNotificationsData=this._getNotificationsData,this.setMaxDays=this._setMaxDays,this.setTabConfig=this._setTabConfig,this.enableReadNotificationsOnForYouTab=this._enableReadNotificationsOnForYouTab,this.disableReadNotificationsOnForYouTab=this._disableReadNotificationsOnForYouTab,this.setAllNotificationsAsRead=this._setAllNotificationsAsRead,this.getUnreadNotificationsCount=this._getUnreadNotificationsCount,this.markNotificationAsReadById=this._markNotificationAsReadById}_openHistoryPanel(){this.getService(y).log("%c[WB] Calling FUNCTION: _openHistoryPanel","color: green;");try{this.trackEvent(Z.Events.Notifications.OPEN_HISTORY_PANEL_TRIGGERED),this.getService(Vn).setHistoryPanelVisibility(!0,!0)}catch(o){this.getService(y).catch("Error in openHistoryPanel: ",o)}}_closeHistoryPanel(){this.getService(y).log("%c[WB] Calling FUNCTION: _closeHistoryPanel","color: green;");try{this.trackEvent(Z.Events.Notifications.CLOSE_HISTORY_PANEL_TRIGGERED),this.getService(Vn).setHistoryPanelVisibility(!1,!0)}catch(o){this.getService(y).catch("Error in closeHistoryPanel: ",o)}}_toggleHistoryPanel(){this.getService(y).log("%c[WB] Calling FUNCTION: _toggleHistoryPanel","color: green;");try{this.trackEvent(Z.Events.Notifications.TOGGLE_HISTORY_PANEL_TRIGGERED),this.getService(Vn).toggleHistoryPanelVisibility(!0)}catch(o){this.getService(y).catch("Error in toggleHistoryPanel: ",o)}}_getNotificationsData(){this.getService(y).log("%c[WB] Calling FUNCTION: _getNotificationsData","color: green;");try{return this.trackEvent(Z.Events.Notifications.GET_NOTIFICATIONS_DATA_TRIGGERED),this.getService(Vn).getNotifications$()}catch(o){return this.getService(y).catch("Error in getNotificationsData: ",o),re([])}}_setMaxDays(o){this.getService(y).log("%c[WB] Calling FUNCTION: _setMaxDays","color: green;");try{this.trackEvent(Z.Events.Notifications.SET_MAX_DAYS_TRIGGERED),this.getService(Vn).setMaxDays(o)}catch(t){this.getService(y).catch("Error in setMaxDays: ",t)}}_setTabConfig(o){this.getService(y).log("%c[WB] Calling FUNCTION: _setTabConfig","color: green;");try{this.trackEvent(Z.Events.Notifications.SET_TAB_CONFIG_TRIGGERED),this.getService(Vn).setTabConfig(o)}catch(t){this.getService(y).catch("Error in setTabConfig: ",t)}}_enableReadNotificationsOnForYouTab(){this.getService(y).log("%c[WB] Calling FUNCTION: _enableReadNotificationsOnForYouTab","color: green;");try{this.trackEvent(Z.Events.Notifications.ENABLE_READ_NOTIFICATIONS_ON_FOR_YOU_TAB_TRIGGERED),this.getService(Vn).enableReadNotificationsOnForYouTab()}catch(o){this.getService(y).catch("Error in enableReadNotificationsOnForYouTab: ",o)}}_disableReadNotificationsOnForYouTab(){this.getService(y).log("%c[WB] Calling FUNCTION: _disableReadNotificationsOnForYouTab","color: green;");try{this.trackEvent(Z.Events.Notifications.DISABLE_READ_NOTIFICATIONS_ON_FOR_YOU_TAB_TRIGGERED),this.getService(Vn).disableReadNotificationsOnForYouTab()}catch(o){this.getService(y).catch("Error in disableReadNotificationsOnForYouTab: ",o)}}_setAllNotificationsAsRead(o){this.getService(y).log("%c[WB] Calling FUNCTION: _setAllNotificationsAsRead","color: green;");try{this.trackEvent(Z.Events.Notifications.SET_ALL_NOTIFICATIONS_AS_READ_TRIGGERED),this.getService(Vn).setAllNotificationsAsRead(o)}catch(t){this.getService(y).catch("Error in setAllNotificationsAsRead: ",t)}}_getUnreadNotificationsCount(){this.getService(y).log("%c[WB] Calling FUNCTION: _getUnreadNotificationsCount","color: green;");try{return this.trackEvent(Z.Events.Notifications.GET_UNREAD_NOTIFICATIONS_COUNT_TRIGGERED),this.getService(Vn).getUnreadNotificationsCount$()}catch(o){return this.getService(y).catch("Error in getUnreadNotificationsCount: ",o),re({forYou:null,all:null})}}_markNotificationAsReadById(o){this.getService(y).log("%c[WB] Calling FUNCTION: _markNotificationAsReadById","color: green;");try{this.trackEvent(Z.Events.Notifications.MARK_NOTIFICATION_AS_READ_BY_ID_TRIGGERED,{payload:{notificationId:o}}),this.getService(Vn).markNotificationAsReadById(o)}catch(t){this.getService(y).catch("Error in markNotificationAsReadById: ",t)}}};var YM=class extends li{constructor(o){super(o),this.getService(y).log("%c[WB] Creating CLASS: PresenceElement","color: blue;"),this.getOnlineUsersOnCurrentDocument=this._getOnlineUsersOnCurrentDocument,this.setInactivityTime=this._setInactivityTime,this.enableFlockMode=this._enableFlockMode,this.disableFlockMode=this._disableFlockMode,this.startFollowingUser=this._startFollowingUser,this.stopFollowingUser=this._stopFollowingUser,this.enableSelf=this._enableSelf,this.disableSelf=this._disableSelf}_getOnlineUsersOnCurrentDocument(){this.getService(y).log("%c[WB] Calling FUNCTION: getOnlineUsers","color: green;");try{return this.trackEvent(Z.Events.Presence.GET_ONLINE_USERS_ON_CURRENT_DOCUMENT_TRIGGERED),this.getService(Cm).getOnlineUsersOnCurrentDocument()}catch(o){return this.getService(y).catch("Error in _getOnlineUsersOnCurrentDocument: ",o),re(null)}}_setInactivityTime(o){this.getService(y).log("%c[WB] Calling FUNCTION: _setInactivityTime","color: green;");try{this.trackEvent(Z.Events.Presence.SET_INACTIVITY_TIME_TRIGGERED,{payload:{time:o}}),isNaN(o)?this.getService(y).catch("Error in setInactivityTime: ","Provided value is not a number."):this.getService(Cm).setInactivityTime(o)}catch(t){this.getService(y).catch("Error in setInactivityTime: ",t)}}_disableFlockMode(){try{this.trackEvent(Z.Events.Presence.DISABLE_FLOCK_MODE_TRIGGERED),this.getService(vc).disableFlockMode()}catch(o){this.getService(y).catch("Error in _disableFlockMode: ",o)}}_enableFlockMode(o){try{this.trackEvent(Z.Events.Presence.ENABLE_FLOCK_MODE_TRIGGERED,{payload:{options:o}}),this.getService(vc).enableFlockMode(o)}catch(t){this.getService(y).catch("Error in _enableFlockMode: ",t)}}_stopFollowingUser(){try{this.trackEvent(Z.Events.Presence.STOP_FOLLOWING_USER_TRIGGERED),this.getService(vc).stopFollowingUser()}catch(o){this.getService(y).catch("Error in _stopFollowingUser: ",o)}}_startFollowingUser(o){try{this.trackEvent(Z.Events.Presence.START_FOLLOWING_USER_TRIGGERED,{payload:{externalId:o}});let t=this.getService(Cm).getPresenceUserFromExternalId(o);return t&&t.userSnippylyId&&t.name!==void 0?(this.getService(vc).startFollowingUser(t.userSnippylyId,t.name),{success:!0,msg:"Joined flock session."}):{success:!1,msg:"User could not be found."}}catch(t){return this.getService(y).catch("Error in _startFollowingUser: ",t),{success:!1,msg:"Unknown error.",raw:t}}}_enableSelf(){try{this.trackEvent(Z.Events.Presence.ENABLE_SELF_TRIGGERED),this.getService(Cm).enableIncludeSelf()}catch(o){this.getService(y).catch("Error in _enableSelf: ",o)}}_disableSelf(){try{this.trackEvent(Z.Events.Presence.DISABLE_SELF_TRIGGERED),this.getService(Cm).disableIncludeSelf()}catch(o){this.getService(y).catch("Error in _disableSelf: ",o)}}};var KM=class extends li{constructor(o){super(o),this.getService(y).log("%c[WB] Creating CLASS: ReactionElement","color: blue;"),this.enableDarkMode=this._enableDarkMode,this.disableDarkMode=this._disableDarkMode,this.setCustomReactions=this._setCustomReactions}_enableDarkMode(){this.getService(y).log("%c[WB] Calling FUNCTION: enableDarkMode","color: green;");try{this.trackEvent(Z.Events.Reactions.ENABLE_DARK_MODE_TRIGGERED),this.getService(er).enableDarkMode()}catch(o){this.getService(y).catch("Error in _enableDarkMode: ",o)}}_disableDarkMode(){this.getService(y).log("%c[WB] Calling FUNCTION: disableDarkMode","color: green;");try{this.trackEvent(Z.Events.Reactions.DISABLE_DARK_MODE_TRIGGERED),this.getService(er).disableDarkMode()}catch(o){this.getService(y).catch("Error in _disableDarkMode: ",o)}}_setCustomReactions(o){this.getService(y).log("%c[WB] Calling FUNCTION: setCustomReactions","color: green;");try{this.trackEvent(Z.Events.Reactions.SET_CUSTOM_REACTIONS_TRIGGERED,{payload:{reactions:o}}),this.getService(er).setCustomReactions(o)}catch(t){this.getService(y).catch("Error in _setCustomReactions: ",t)}}};var Ose=(()=>{let o=class o{constructor(e,i,r){this.loggingService=e,this.recorderAnnotationService=i,this.recorderService=r,this.actionSubjects=new Map,this.subscriptions=[];try{this.recorderAnnotationService.setRecorderActionsService(this),this.recorderService.setRecorderActionsService(this)}catch(a){this.loggingService.catch("Error in RecorderActionsService constructor: ",a)}}onTranscriptionDone(e){try{this.triggerAction(LO.TRANSCRIPTION_DONE,e)}catch(i){this.loggingService.catch("Error in RecorderActionsService onTranscriptionDone: ",i)}}onRecordingDone(e){try{this.triggerAction(LO.RECORDING_DONE,e)}catch(i){this.loggingService.catch("Error in RecorderActionsService onRecordingDone: ",i)}}onDeleteRecording(e){try{this.triggerAction(LO.DELETE_RECORDING,e)}catch(i){this.loggingService.catch("Error in RecorderActionsService onDeleteRecording: ",i)}}triggerAction(e,i){try{this.actionSubjects.has(e)||this.actionSubjects.set(e,new et),this.actionSubjects.get(e)?.next(i)}catch(r){this.loggingService.catch("Error in RecorderActionsService triggerAction: ",r)}}onAction(e){try{return this.actionSubjects.has(e)||this.actionSubjects.set(e,new et),this.actionSubjects.get(e)?.asObservable()}catch(i){return this.loggingService.catch("Error in RecorderActionsService onAction: ",i),re(null)}}};o.\u0275fac=function(i){return new(i||o)(J(y),J(Xi),J(yi))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var ZM=class extends li{constructor(o){super(o),this.getService(y).log("%c[WB] Creating CLASS: RecorderElement","color: blue;"),this.initRecording=this._initRecording,this.onRecordedData=this._onRecordedData,this.enableDarkMode=this._enableDarkMode,this.disableDarkMode=this._disableDarkMode,this.enableRecordingCountdown=this._enableRecordingCountdown,this.disableRecordingCountdown=this._disableRecordingCountdown,this.getRecordingDataByRecorderId=this._getRecordingDataByRecorderId,this.enableRecordingTranscription=this._enableRecordingTranscription,this.disableRecordingTranscription=this._disableRecordingTranscription,this.getRecordingData=this._getRecordingData,this.enableVideoEditor=this._enableVideoEditor,this.disableVideoEditor=this._disableVideoEditor,this.getRecordings=this._getRecordings,this.fetchRecordings=this._fetchRecordings,this.on=this._on}_initRecording(o,t){this.getService(y).log("%c[WB] Calling FUNCTION: initRecording","color: green;");try{return this.trackEvent(Z.Events.Recording.INIT_RECORDING_TRIGGERED,{payload:{type:o,panelId:t}}),this.getService(yi).initRecording(o,t)}catch(e){return this.getService(y).catch("Error in _initRecording: ",e),re(null)}}_onRecordedData(){this.getService(y).log("%c[WB] Calling FUNCTION: onRecordedData","color: green;");try{return this.trackEvent(Z.Events.Recording.ON_RECORDED_DATA_TRIGGERED),this.getService(yi).onRecordedData()}catch(o){return this.getService(y).catch("Error in _onRecordedData: ",o),re(null)}}_enableDarkMode(){this.getService(y).log("%c[WB] Calling FUNCTION: enableDarkMode","color: green;");try{this.trackEvent(Z.Events.Recording.ENABLE_DARK_MODE_TRIGGERED),this.getService(Xi).setRecorderContainerDarkMode(!0)}catch(o){this.getService(y).catch("Error in _enableDarkMode: ",o)}}_disableDarkMode(){this.getService(y).log("%c[WB] Calling FUNCTION: disableDarkMode","color: green;");try{this.trackEvent(Z.Events.Recording.DISABLE_DARK_MODE_TRIGGERED),this.getService(Xi).setRecorderContainerDarkMode(!1)}catch(o){this.getService(y).catch("Error in _disableDarkMode: ",o)}}_enableRecordingCountdown(){this.getService(y).log("%c[WB] Calling FUNCTION: enableRecordingCountdown","color: green;");try{this.trackEvent(Z.Events.Recording.ENABLE_RECORDING_COUNTDOWN_TRIGGERED),this.getService(yi).enableRecordingCountdown()}catch(o){this.getService(y).catch("Error in _enableRecordingCountdown: ",o)}}_disableRecordingCountdown(){this.getService(y).log("%c[WB] Calling FUNCTION: disableRecordingCountdown","color: green;");try{this.trackEvent(Z.Events.Recording.DISABLE_RECORDING_COUNTDOWN_TRIGGERED),this.getService(yi).disableRecordingCountdown()}catch(o){this.getService(y).catch("Error in _disableRecordingCountdown: ",o)}}_getRecordingDataByRecorderId(o){this.getService(y).log("%c[WB] Calling FUNCTION: getRecordingDataByRecorderId","color: green;");try{return this.trackEvent(Z.Events.Recording.GET_RECORDING_DATA_BY_RECORDER_ID_TRIGGERED,{payload:{recorderId:o}}),this.getService(Xi).getRecorderDataByRecorderId(o)}catch(t){return this.getService(y).catch("Error in _getRecordingDataByRecorderId: ",t),re(null)}}_getRecordings(o){this.getService(y).log("%c[WB] Calling FUNCTION: getRecordings","color: green;");try{return this.trackEvent(Z.Events.Recording.GET_RECORDINGS_TRIGGERED,{payload:{query:o}}),this.getService(Xi).getRecordings(o)}catch(t){return this.getService(y).catch("Error in _getRecordings: ",t),re([])}}_getRecordingData(o){this.getService(y).log("%c[WB] Calling FUNCTION: getRecordingData","color: green;");try{return this.trackEvent(Z.Events.Recording.GET_RECORDING_DATA_TRIGGERED,{payload:{query:o}}),this.getService(Xi).getRecorderDataByRecorderIds(o)}catch(t){return this.getService(y).catch("Error in _getRecordingData: ",t),Promise.resolve({data:null})}}_fetchRecordings(o){this.getService(y).log("%c[WB] Calling FUNCTION: fetchRecordings","color: green;");try{return this.trackEvent(Z.Events.Recording.FETCH_RECORDINGS_TRIGGERED,{payload:{query:o}}),this.getService(Xi).fetchRecorderDataByRecorderIds(o)}catch(t){return this.getService(y).catch("Error in _fetchRecordings: ",t),Promise.resolve([])}}_enableRecordingTranscription(){this.getService(y).log("%c[WB] Calling FUNCTION: enableRecordingTranscription","color: green;");try{this.trackEvent(Z.Events.Recording.ENABLE_RECORDING_TRANSCRIPTION_TRIGGERED),this.getService(Xi).enableRecordingTranscription()}catch(o){this.getService(y).catch("Error in _enableRecordingTranscription: ",o)}}_disableRecordingTranscription(){this.getService(y).log("%c[WB] Calling FUNCTION: disableRecordingTranscription","color: green;");try{this.trackEvent(Z.Events.Recording.DISABLE_RECORDING_TRANSCRIPTION_TRIGGERED),this.getService(Xi).disableRecordingTranscription()}catch(o){this.getService(y).catch("Error in _disableRecordingTranscription: ",o)}}_on(o){this.getService(y).log("%c[WB] Calling FUNCTION: on","color: green;");try{return this.trackEvent(Z.Events.Recording.ON_ACTION_TRIGGERED,{payload:{action:o}}),this.getService(Ose).onAction(o)}catch(t){return this.getService(y).catch("Error in _on: ",t),re(null)}}_enableVideoEditor(){this.getService(y).log("%c[WB] Calling FUNCTION: enableVideoEditor","color: green;");try{this.trackEvent(Z.Events.Recording.ENABLE_VIDEO_EDITOR_TRIGGERED),this.getService(yi).enableVideoEditor()}catch(o){this.getService(y).catch("Error in _enableVideoEditor: ",o)}}_disableVideoEditor(){this.getService(y).log("%c[WB] Calling FUNCTION: disableVideoEditor","color: green;");try{this.trackEvent(Z.Events.Recording.DISABLE_VIDEO_EDITOR_TRIGGERED),this.getService(yi).disableVideoEditor()}catch(o){this.getService(y).catch("Error in _disableVideoEditor: ",o)}}};var Cc=(()=>{let o=class o{constructor(e,i,r,a,s,c){this.analyticsService=e,this.authService=i,this.configService=r,this.domService=a,this.loggingService=s,this.functions=c,this.rewriterAnnotations$=new fe([]),this.rewriterOptions$=new fe({}),this.rewriterEnabled$=new fe(!1),this.lastOpenAIPromptCalledAt=0,this.getRewriterEnabled$().subscribe(p=>{try{if(p){let h=document.querySelectorAll(U.TAGS.SNIPPYLY_REWRITER);if(!document.querySelectorAll(U.TAGS.VELT_REWRITER)?.length&&!h?.length){let E=document.createElement(U.TAGS.VELT_REWRITER);document.body.appendChild(E),this.authService.getUser$().pipe(Ne(A=>!!A),Je(1)).subscribe(A=>{this.analyticsService.trackEvent(Z.Events.Rewriter.REWRITER_ENABLED,{isMobileDevice:this.domService.isMobileDevice()})})}}else{let h=document.querySelectorAll(U.TAGS.SNIPPYLY_REWRITER);h?.length&&h.forEach(E=>{E.remove()});let _=document.querySelectorAll(U.TAGS.VELT_REWRITER);_?.length&&_.forEach(E=>{E.remove()})}}catch(h){this.loggingService.catch("Error in rewriterEnabled$: ",h)}},p=>{this.loggingService.catch("Error in rewriterEnabled$ subscription: ",p)})}getRewriterAnnotations$(){try{return this.rewriterAnnotations$.asObservable()}catch(e){return this.loggingService.catch("Error in getRewriterAnnotations$(): ",e),re([])}}addRewriter(e,i,r){this.loggingService.log("%c[WB] Calling FUNCTION: addRewriter","color: green;");try{let a=this.authService.getUser();if(a)if(a.isReadOnly||a.isAnonymous)this.loggingService.catch("Anonymous/Readonly users cannot add rewriters.");else{let s=new hM;s.from=a,s.color=U.DEFAULT_ANNOTATION_COLOR,i&&(s.targetTextRange=i),r&&(s.rewriterType=r),this.saveRewriterToDb(s)}}catch(a){this.loggingService.catch("Error in RewriterService addRewriter: ",a)}}saveRewriterToDb(e){this.loggingService.log("%c[WB] Calling FUNCTION: saveRewriterToDb","color: green;");try{e?.annotationId||(e.annotationId=Math.random().toString(36).substring(2)+Date.now().toString(36));let i=this.rewriterAnnotations$.getValue();i.push(e),this.rewriterAnnotations$.next(i),this.domService.toggleAnnotationSelection(e)}catch(i){this.loggingService.catch("Error in RewriterService saveRewriterToDb: ",i)}}removeRewriter(e){try{let i=this.rewriterAnnotations$.getValue(),r=i.findIndex(a=>a.annotationId===e.annotationId);r>-1&&(i.splice(r,1),this.rewriterAnnotations$.next(i))}catch(i){this.loggingService.catch("Error in RewriterService removeRewriter: ",i)}}getRewriterOptions(e,i,r){try{if(this.lastOpenAIPromptCalledAt&&Date.now()-this.lastOpenAIPromptCalledAt<1e3)return this.lastOpenAIPromptCalledAt=Date.now(),re([]);this.lastOpenAIPromptCalledAt=Date.now();let a=Cr(this.functions,Zn.cloudFunction.chatgptCompletion,{timeout:20*60*1e3}),s=i?.[0]?.role==="system"?i?.[0]?.content:null;return this.analyticsService.trackEvent(Z.Events.Rewriter.REWRITE_PROMPT_SUBMITTED,{isMobileDevice:this.domService.isMobileDevice(),prompt:s,type:e}),bo(a({messages:i,type:e,apiKey:this.configService.getApiKey(),sdkVersion:Ta(),sdkType:this.configService.getSdkType()})).pipe(ce(c=>c?.data?c.data:[]))}catch(a){return this.loggingService.catch("Error in RewriterService getRewriterOptions: ",a),re([])}}enableRewriter(){try{this.rewriterEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in RewriterService enableRewriter: ",e)}}disableRewriter(){try{this.rewriterEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in RewriterService disableRewriter: ",e)}}getRewriterEnabled$(){try{return this.rewriterEnabled$.asObservable()}catch(e){return this.loggingService.catch("Error in RewriterService getRewriterEnabled$: ",e),re(!1)}}resetRewriter(){try{this.domService.resetSelectedAnnotationsMap(!1,"rewriter"),this.rewriterAnnotations$.next([])}catch(e){this.loggingService.catch("Error in RewriterService resetRewriter: ",e)}}getChatGPTInput(e,i,r=[]){try{let a="";return e&&(a=`
|
|
384
384
|
${a}
|
|
385
385
|
<|im_start|>system
|
|
386
386
|
${e}
|
|
@@ -412,7 +412,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
412
412
|
`).replace(/ /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 c=s.getRangeAt(0);a.contains(c.commonAncestorContainer)||(c.selectNodeContents(a),c.collapse(!1)),c.deleteContents();let p=r.split(`
|
|
413
413
|
`).map(h=>document.createTextNode(h));p.forEach((h,_)=>{c.insertNode(h),_<p.length-1&&c.insertNode(document.createElement("br")),c.collapse(!1)}),s.removeAllRanges(),s.addRange(c),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 c of i)if(c.type.indexOf("image")===0){let p=c.getAsFile(),h=xn(),_=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 c;if(this.componentConfigSignal().newCommentTextArea?c=this.componentConfigSignal().newCommentTextArea.nativeElement:this.componentConfigSignal().editCommentTextArea&&(c=this.componentConfigSignal().editCommentTextArea.nativeElement),c){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(c.innerHTML),newComment:c.innerText}),h))}else this.componentConfigSignal().newCommentTextArea?(this.componentConfigSignal.update(p=>(p=I({},p),p.newCommentTextArea.nativeElement.innerHTML=this.domService.sanitizeHtml(p.newCommentTextArea.nativeElement.innerHTML+" "+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+" "+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=xn(),c=new File([a],`${s}.png`,a);i.push(c)}}i?.length&&this.selectFiles(null,i)}}catch(i){this.catchError("Error in CommentDialogComponent onDrop: ",i)}}onEscapeKeyPressed(e){return ee(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 Ip(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 ee(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(Z.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(U.TAGS.VELT_COMMENTS_SIDEBAR)||document.querySelector(U.TAGS.SNIPPYLY_COMMENTS_SIDEBAR))?.hasAttribute(U.ATTRIBUTES.EMBED_MODE)?(this.commentService.setSidebarVisibility(!0),this.commentService.openSidebar()):this.commentService.setSidebarVisibility(!0)}approveCommentPinAnnotation(){try{this.analyticsService.trackEvent(Z.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(Z.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(Z.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(Z.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(Z.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(Z.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(Z.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 ee(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],c=yield Sse(s),p=this.domSanitizer.bypassSecurityTrustUrl(c),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:c,fileType:_}]}),E))}else this.componentConfigSignal.update(_=>(_=T(I({},_),{invalidSelectedFiles:[..._.invalidSelectedFiles,{file:s,url:c,errorMessage:h?.maxAllowedSizeInMB?`Size > ${h?.maxAllowedSizeInMB}MB`:"Size > 15MB"}]}),_)),this.analyticsService.trackEvent(Z.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 ee(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 ee(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"),c=s?.attachment;c&&(this.analyticsService.trackEvent(Z.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:c.attachmentId,attachmentSize:c.size,attachmentType:c.type}),e.push(c)),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(Z.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 ee(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 ee(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(Z.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:jt.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(Z.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(Z.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(Z.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 c={annotation:this.componentConfigSignal().annotation,type:jt.CUSTOM_LIST_CHANGED,oldCustomList:s.customList,newCustomList:a};this.updateSelectedCustomChipSet(),this.componentConfigSignal().annotation.annotationId&&this.saveComment.emit(c)}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(Z.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=toe();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(c=>{let p={};p.user=this.componentConfigSignal().userContactsBySnippylyId?.[c],p.viewedAt=i[r]?.views?.[c]?.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(Qe),u(je),u(Te),u(ni),u(rP),u(gi),u(Fe),u(yi),u(Os),u(BC),u(y),u($o),u(gn),u(er),u(Xa),u(Ye),u(N),u($i),u(Ge),u(lt),u(bn),u(Xt),u(tc,8))},o.\u0275cmp=M({type:o,selectors:[["snippyly-comment-dialog"]],viewQuery:function(i,r){if(i&1&&(it($Rt,5),it(HRt,5),it(zRt,5),it(Eue,7),it(Eue,5,fi)),i&2){let a;Ze(a=Xe())&&(r.commentsContainer=a.first),Ze(a=Xe())&&(r.newCommentTextArea=a.first),Ze(a=Xe())&&(r.editCommentTextArea=a.first),Ze(a=Xe())&&(r.hostElement=a.first),Ze(a=Xe())&&(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,qe],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),z("click",function(){return k(a),R(r.onClick())})("pointerout",function(c){return k(a),r.onPointerOutCommentDialog(c),R(c.stopPropagation())})("pointerdown",function(c){return k(a),R(c.stopPropagation())})("pointerup",function(c){return k(a),r.onPointerUp(),R(c.stopPropagation())}),S(),g(3,hNt,4,1,"ng-container",4)}if(i&2){let a,s,c,p,h,_,E,A,V,G,X,he,Ie,Pe,Be,We,ke,we,Ee,Me,Ce,ue,Le,Se,Ut,Gt,Dt,It,Nt,Fn,Ji,ii,Oi,dn,ui;pe("sidebar",(a=r.componentConfigSignal())==null?null:a.sidebarMode)("velt-comment-dialog--sidebar-mode",(s=r.componentConfigSignal())==null?null:s.sidebarMode)("dialog",(c=r.componentConfigSignal())==null?null:c.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",(A=r.componentConfigSignal())==null?null:A.bottomSheetMode)("inbox",(V=r.componentConfigSignal())==null?null:V.inboxMode)("velt-comment-dialog--inbox-mode",(G=r.componentConfigSignal())==null?null:G.inboxMode)("readonly",((X=r.componentConfigSignal())==null||X.user==null?null:X.user.isReadOnly)||((X=r.componentConfigSignal())==null||X.user==null?null:X.user.isAnonymous))("velt-comment-dialog--readonly",((he=r.componentConfigSignal())==null||he.user==null?null:he.user.isReadOnly)||((he=r.componentConfigSignal())==null||he.user==null?null:he.user.isAnonymous))("no-comments",!(!((Ie=r.componentConfigSignal())==null||Ie.annotation==null||Ie.annotation.comments==null)&&Ie.annotation.comments.length))("velt-comment-dialog--no-comments",!(!((Pe=r.componentConfigSignal())==null||Pe.annotation==null||Pe.annotation.comments==null)&&Pe.annotation.comments.length))("selected",(Be=r.componentConfigSignal())==null?null:Be.commentDialogSelected)("velt-comment-dialog--selected",(We=r.componentConfigSignal())==null?null:We.commentDialogSelected)("screen-recording",((ke=r.componentConfigSignal())==null||ke.recorderInitConfig==null?null:ke.recorderInitConfig.type)==="screen")("velt-comment-dialog--screen-recording",((we=r.componentConfigSignal())==null||we.recorderInitConfig==null?null:we.recorderInitConfig.type)==="screen")("s-ghost-comment-annotation",(Ee=r.componentConfigSignal())==null?null:Ee.showGhostCommentMessage)("velt-comment-dialog--ghost-comment-annotation",(Me=r.componentConfigSignal())==null?null:Me.showGhostCommentMessage)("velt-comment-dialog--focused-thread-mode",(Ce=r.componentConfigSignal())==null?null:Ce.focusedThreadMode)("inline-comment-mode",((ue=r.componentConfigSignal())==null?null:ue.inlineCommentMode)&&!((ue=r.componentConfigSignal())!=null&&ue.isInsidePdfViewer))("velt-comment-dialog--page-comment",(Le=r.componentConfigSignal())==null||Le.annotation==null?null:Le.annotation.isPageAnnotation)("velt-comment-dialog--inline-comment-mode",((Se=r.componentConfigSignal())==null?null:Se.inlineCommentMode)&&!((Se=r.componentConfigSignal())!=null&&Se.isInsidePdfViewer))("velt-comment-dialog--multi-thread-mode",(Ut=r.componentConfigSignal())==null?null:Ut.multiThread)("velt-comment-dialog--comment-composer-mode",(Gt=r.componentConfigSignal())==null?null:Gt.commentComposerMode)("velt-comment-dialog--page-mode-composer",(Dt=r.componentConfigSignal())==null?null:Dt.pageModeComposer)("private-comment",(It=r.componentConfigSignal())==null?null:It.isPrivateComment)("velt-comment-dialog--private-comment",(Nt=r.componentConfigSignal())==null?null:Nt.isPrivateComment),x("data-velt-annotation-draft",(Fn=r.componentConfigSignal())==null?null:Fn.getAnnotationDraftAttribute)("data-velt-annotation-edit-comment",(Ji=r.componentConfigSignal())!=null&&Ji.editComment?!0:void 0)("data-velt-comment-dialog-comments-count",((ii=r.componentConfigSignal())==null||ii.annotation==null||ii.annotation.comments==null?null:ii.annotation.comments.length)||"0")("data-velt-comment-dialog-comments-status",(Oi=r.componentConfigSignal())==null||Oi.annotation==null||Oi.annotation.status==null?null:Oi.annotation.status.id)("data-velt-comment-dialog-comments-status-type",(dn=r.componentConfigSignal())==null||dn.annotation==null||dn.annotation.status==null?null:dn.annotation.status.type)("data-velt-comment-dialog-comments-priority",(ui=r.componentConfigSignal())==null||ui.annotation==null||ui.annotation.priority==null?null:ui.annotation.priority.id)("data-testid",r.componentId+"-root"),d(3),m("ngIf",r.componentConfigSignal())}},dependencies:[K,ft,S0,v0,b0,f0,y0,Zu,u0,E0,h0,w0,x0,nn,OC],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 LP=(()=>{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 fe(null),this.saveComment=new De,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 ee(this,null,function*(){try{this.annotation.type==="multiThread"?(this.bottomSheetRef=this.bottomSheet.open(es,{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(Ho,{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(nc),u(Fe),u(y),u(N))},o.\u0275cmp=M({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:[qe],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 vNt(n,o){if(n&1){let t=q();C(0,"div",4),z("pointerup",function(i){return k(t),l(2).togglePinSelection(),R(i.stopPropagation())})("click",function(i){return k(t),R(i.stopPropagation())})("cdkDragStarted",function(){k(t);let i=l(2);return R(i.onPinDragStart())}),C(1,"snippyly-comment-pin",5),z("saveComment",function(i){k(t);let r=l(2);return R(r.saveComment(i))})("commentTargetElementClicked",function(){k(t);let i=l(2);return R(i.togglePinSelection())})("togglePinSelection",function(i){k(t);let r=l(2);return R(r.togglePinSelection(i))}),S()()}if(n&2){let t=l().ngIf,e=l();ot("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"),m("id","comment-pin-container-"+(t.commentPinAnnotation==null?null:t.commentPinAnnotation.annotationId)),x("data-testid",e.componentId+"-popover")("role","button")("aria-expanded",t.commentPinSelected),d(),m("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 CNt(n,o){if(n&1){let t=q();C(0,"div",7),z("pointerup",function(i){return k(t),l(3).togglePinSelection(),R(i.stopPropagation())})("touchend",function(i){return k(t),i.stopPropagation(),R(i.preventDefault())})("mousedown",function(i){return k(t),R(i.stopPropagation())})("touchstart",function(i){return k(t),R(i.stopPropagation())})("pointerdown",function(i){return k(t),R(i.stopPropagation())})("click",function(i){return k(t),R(i.stopPropagation())})("cdkDragStarted",function(){k(t);let i=l(3);return R(i.onPinDragStart())})("cdkDragMoved",function(i){k(t);let r=l(3);return R(r.onPinMove(i))})("cdkDragReleased",function(){k(t);let i=l(3);return R(i.onPinRelease())}),C(1,"snippyly-comment-pin",8,1),z("togglePinSelection",function(i){k(t);let r=l(3);return R(r.togglePinSelection(i))})("saveComment",function(i){k(t);let r=l(3);return R(r.saveComment(i))}),S()()}if(n&2){let t,e=de(2),i=l(2).ngIf,r=l();ot("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)+")":""),pe("pin-dragging",i.annotationDragging),m("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(),m("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 _Nt(n,o){if(n&1&&g(0,CNt,3,24,"div",6),n&2){let t=l().ngIf;m("ngIf",t.commentPinAnnotation==null?null:t.commentPinAnnotation.position)}}function yNt(n,o){if(n&1&&(f(0),g(1,vNt,2,14,"div",3)(2,_Nt,1,1,"ng-template",null,0,xe),v()),n&2){let t=o.ngIf,e=de(3);d(),m("ngIf",t.popoverMode)("ngIfElse",e)}}var BP=(()=>{let o=class o{constructor(e,i,r,a,s,c,p){this.analyticsService=e,this.authService=i,this.docService=r,this.domService=a,this.commentService=s,this.loggingService=c,this.elementRef=p,this.multipleCommentPinsSelected=!1,this.avatarErrorImage="",this.objectKeys=Object.keys,this.selectedAnnotationsLocationMap={},this.subscriptions=[],this.componentConfigSignal=be({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-${xn()}`}),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!==Vs.DIFFERENT_DEVICE&&document.querySelector(`[${U.ATTRIBUTES.VELT_ANNOTATION_DRAFT}="${i?.annotationId}"]`)&&this.domService.resetSelectedAnnotationsMap(!0,"comments");else{let a=document.querySelector(`[${U.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);if(a||(a=(this.domService.getDraftCommentAnnotationDialogs()||[])[0]),a){let s=a.getAttribute(U.ATTRIBUTES.VELT_ANNOTATION_DRAFT);if(s){let c=document.getElementById(`comment-pin-container-${s}`)||document.querySelector(`[data-velt-id='${s}']`);c&&(c.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!==Vs.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,c=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=`${c}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,c=this.domService.getBackgroundElement(r,a);c&&this.commentService.isElementInsideAllowedElements(c)&&(this.componentConfigSignal.update(p=>(p=T(I({},p),{targetElement:c}),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 he=this.domService.getTargetElementForCursorPosition(this.pointerMoveEvent,!0,!0,!0,Ie=>{if(this.commentService.getSvgAsImg()){let Pe=Ie?.closest(`[${U.ATTRIBUTES.VELT_COMMENT_CONTAINER}]`);Pe&&Pe instanceof HTMLElement&&(Ie=Pe)}return Ie});he&&(r=he)}let a=this.domService.getElementFromXPath(r?.xpath),s=this.componentConfigSignal().commentPinAnnotation.targetElement?.xpath,c=r?.xpath,p=s===c;if(!a)return;let h=this.componentConfigSignal().dragPosition,_=a.getBoundingClientRect(),E=50,A=50;if(h){let he=h.left-_.left,Ie=h.top-_.top;E=he/_.width*100,A=Ie/_.height*100,E=Math.max(0,Math.min(100,E)),A=Math.max(0,Math.min(100,A))}let V=I({},this.componentConfigSignal().commentPinAnnotation);V.targetElement=I({},r),V.targetElement.leftPercentage=E,V.targetElement.topPercentage=A,this.commentService.calculateCommentAnnotationPosition(V),this.componentConfigSignal.update(he=>(he=T(I({},he),{commentPinAnnotation:V,targetElement:a}),he));let G=this.domService.isElementInsideAdditionalLocationContainer(i)||this.domService.isElementInsideAdditionalLocationContainer(a),X=this.docService.getAdditionalDocumentIdFromElement(a)||this.docService.getDocumentPaths()?.clientDocumentId;if(!this.componentConfigSignal().commentPinAnnotation?.metadata?.clientDocumentId||this.componentConfigSignal().commentPinAnnotation?.metadata?.clientDocumentId==X?(this.componentConfigSignal.update(he=>(he=T(I({},he),{commentPinAnnotation:T(I({},he.commentPinAnnotation),{targetElement:r})}),he)),this.commentService.updateComment(this.componentConfigSignal().commentPinAnnotation,G)):this.componentConfigSignal.update(he=>(he=T(I({},he),{targetElement:i}),he)),p){let he=this.componentConfigSignal().transformContext,Ie=this.componentConfigSignal().elementInTransformedContainer,Pe=he&&this.isElementInsideTransformContainer(a,he.containerSelector);this.componentConfigSignal.update(We=>(We=T(I({},We),{elementInTransformedContainer:Pe}),We));let Be=e.getBoundingClientRect();if(!Ie&&Pe){e.style.transition="none";let We=Be.top,ke=Be.left;this.parentElement.appendChild(e),e.style.position="fixed",e.style.top=`${We}px`,e.style.left=`${ke}px`,e.offsetWidth,requestAnimationFrame(()=>{e.style.position="absolute",Pe&&V.position.transformContext?(e.style.top=`${V.position.top}px`,e.style.left=`${V.position.left}px`,V.position.transformContext.scale!==1&&(e.style.transform=`scale(${1/V.position.transformContext.scale})`)):(e.style.top=`${V.position.top}px`,e.style.left=`${V.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,Pe&&V.position.transformContext?(e.style.top=`${V.position.top}px`,e.style.left=`${V.position.left}px`):(e.style.top=`${V.position.top}px`,e.style.left=`${V.position.left}px`);e.offsetWidth,this.componentConfigSignal.update(We=>(We=T(I({},We),{annotationDragging:!1,dragPosition:null}),We))}this.analyticsService.trackEvent(Z.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(Qe),u(je),u(lt),u(Fe),u(Te),u(y),u(N))},o.\u0275cmp=M({type:o,selectors:[["snippyly-comment-pin-portal"]],hostVars:2,hostBindings:function(i,r){i&2&&(_a("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,yNt,4,2,"ng-container",2),i&2&&m("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 VP=(()=>{let o=class o{constructor(e,i,r,a,s,c){this.commentService=e,this.domService=i,this.componentFactoryResolver=r,this.injector=a,this.appRef=s,this.loggingService=c,this.commentsPinById={},this.commentPinTemplate$=new fe(null),this.customPinEvents$=new et}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,c=r.pinHostElement;if(document.body.contains(s)&&document.body.contains(c))a&&(a.instance.setCommentPinAnnotation(e),this.updateElementOffset(e));else{let p=r.pinHostDomPortalOutlet;p&&(this.removeCommentPinHostAttributes(e.annotationId,r.pinHostElement),this.removeCommentDisabledAttribute(c),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 No(BP),c=new Fo(a,this.componentFactoryResolver,this.appRef,this.injector),p=c.attach(s);p.instance.setCommentPinAnnotation(e),p.instance.setTargetElement(r);let h=r?.getAttribute(U.ATTRIBUTES.VELT_SOURCE_ID);h&&p.instance.setSourceId(h),this.commentsPinById[e.annotationId].push({pinHostDomPortalOutlet:c,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(U.ATTRIBUTES.VELT_COMMENT_PIN_HOST);if(r){let a=r.split(",");a.includes(e)||(a.push(e),i.setAttribute(U.ATTRIBUTES.VELT_COMMENT_PIN_HOST,a.join(",")))}else i.setAttribute(U.ATTRIBUTES.VELT_COMMENT_PIN_HOST,e);window.getComputedStyle(i).position==="static"&&(rm(i)||i.setAttribute(U.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(U.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(U.ATTRIBUTES.VELT_COMMENT_PIN_HOST,a.join(",")):i.removeAttribute(U.ATTRIBUTES.VELT_COMMENT_PIN_HOST))}i?.getAttribute(U.ATTRIBUTES.VELT_COMMENT_PIN_HOST)||i.removeAttribute(U.ATTRIBUTES.VELT_COMMENT_PIN_HOST_STATIC)}catch(r){this.loggingService.catch("Error in CommentPinPortalService removeCommentPinHostAttributes: ",r)}}setCommentDisabledAttribute(e){try{this.commentService.getPopoverMode()&&e.setAttribute(U.ATTRIBUTES.VELT_COMMENT_DISABLED,"auto")}catch(i){this.loggingService.catch("Error in CommentPinPortalService setCommentDisabledAttribute: ",i)}}removeCommentDisabledAttribute(e){try{e?.getAttribute(U.ATTRIBUTES.VELT_COMMENT_DISABLED)==="auto"&&e.removeAttribute(U.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,c=this.domService.getElementOffset(a,s);r.instance.setOffsetLeft(c.offsetLeft),r.instance.setOffsetTop(c.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(Te),J(Fe),J(Io),J(Et),J(mi),J(y))},o.\u0275prov=Ae({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:c,suffix:p,setIfCondition:h,componentElementRef:_,replaceTemplate:E=!0}){try{if(p&&(s+=`--${p}`),c&&(s+=`---${c}`),s){let A=this.wireframeService.getConditionElement(s);if(!A&&e&&(A=e),A){let V=A?.getAttribute("velt-if");V&&h&&h(V),Array.from(A.attributes).forEach(G=>{_?.nativeElement.setAttribute(G.name,G.value)}),i?.componentConfigSignal?this.dynamicDataService.applyConditionalClasses(_?.nativeElement,i):this.dynamicDataService.applyConditionalClasses(_?.nativeElement)}}if(s&&!e){let A=this.wireframeService.getWireframe(s);if(A){let V=document.createElement(A.tagName);V.innerHTML=A.innerHTML,this.template=V}}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(A){this.loggingService.warn("Error in DynamicTemplateDirective veltDynamicTemplate: ",A)}}constructor(e,i,r,a,s,c,p,h){this.elementRef=e,this.templateRef=i,this.viewContainer=r,this.dynamicComponentService=a,this.loggingService=s,this.domService=c,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,c){return c.split(".").reduce((p,h)=>p&&p[h],s)}r.forEach(s=>{let c=s.getAttribute("data-velt");if(c&&i){let p=a(i,c);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 c=r.children[s],p=this.dynamicComponentService.processAndReplaceVeltComponents(c,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(N),u(fo),u(fi),u(BC),u(y),u(Fe),u(Ge),u(b))},o.\u0275dir=Bt({type:o,selectors:[["","veltDynamicTemplate",""]],inputs:{veltDynamicTemplate:"veltDynamicTemplate"},standalone:!1});let n=o;return n})();function SNt(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 bNt(n,o){if(n&1&&(f(0),C(1,"div",1)(2,"div",2),oe(),C(3,"svg",3),D(4,"translate"),w(5,"path",4),S(),g(6,SNt,1,2,"div",5),S(),ct(),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",O(4,11,"Comment icon"))("focusable","false"),d(3),m("ngIf",t==null?null:t.unreadAnnotationCount),d(),x("data-testid",e.componentId+"-count")("aria-hidden","true"),d(),$e(t==null?null:t.count)}}var Tue=(()=>{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=be({unreadCommentsMap:null,count:0}),this.subscription=[],this.componentId="velt-comment-pin-bubble";try{this.subscription.push(this.commentService.getUnreadCommentsMap$().subscribe(c=>{this.componentConfigSignal.update(p=>(p=I({},p),p.unreadCommentsMap=c,p))}))}catch(c){this.catchError("Error in CommentPinBubbleComponent constructor: ",c)}}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(Te),u(y),u($o),u(Ye),u(N))},o.\u0275cmp=M({type:o,selectors:[["velt-comment-pin-bubble-internal"]],inputs:{annotation:"annotation"},standalone:!1,features:[B,qe],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,bNt,9,13,"ng-container",0),i&2&&m("ngIf",r.componentConfigSignal())},dependencies:[K,me],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 ENt=["commentDialogOverlay"],xNt=["commentPinBubbleOverlay"],TNt=["*"],wNt=()=>["snippyly-overlay-panel","velt-comment-pin-bubble-overlay-panel"],wue=n=>({trigger:n}),DNt=()=>["snippyly-overlay-panel","velt-comment-dialog-overlay-panel"];function ANt(n,o){n&1&&Ue(0)}function ONt(n,o){if(n&1&&(f(0),g(1,ANt,1,0,"ng-container",13),v()),n&2){l();let t=de(1);l(2);let e=de(9);d(),m("ngTemplateOutlet",e)("ngTemplateOutletContext",P(2,wue,t))}}function MNt(n,o){if(n&1){let t=q();C(0,"div",11,4),D(2,"translate"),z("click",function(i){return k(t),R(i.preventDefault())})("pointerenter",function(i){return k(t),l(3).onBubblePointerOver(i),R(i.stopPropagation())})("pointerleave",function(){k(t);let i=l(3);return R(i.onBubblePointerOut())})("pointerup",function(){k(t);let i=l(3);return R(i.onPointerUpOnBubble())}),C(3,"velt-comment-pin-bubble-internal",12),z("afterViewInit",function(){k(t);let i=l(3);return R(i.onBubbleAfterViewInit())})("onDestroy",function(){k(t);let i=l(3);return R(i.onBubbleOnDestroy())}),S()(),g(4,ONt,2,4,"ng-container",6)}if(n&2){let t=l(2).ngIf;x("role","button")("aria-expanded",t.commentBubbleHover)("aria-label",O(2,5,"Comment bubble")),d(3),m("annotation",t.annotation),d(),m("ngIf",t.isBubbleInitialized)}}function PNt(n,o){if(n&1){let t=q();f(0),g(1,MNt,5,7,"ng-template",10,3,xe),z("positionChange",function(i){k(t);let r=l(2);return R(r.onCommentPinBubblePositionChange(i))}),v()}if(n&2){let t=l().ngIf,e=de(2);d(),m("cdkConnectedOverlayOrigin",e)("cdkConnectedOverlayOpen",!t.annotationDragging&&!!(t!=null&&t.user)&&(t.bubbleOnPinHover&&t.commentPinHover||t.commentBubbleHover||t.commentPinSelected))("cdkConnectedOverlayPanelClass",kt(10,wNt))("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 kNt(n,o){n&1&&Ue(0)}function RNt(n,o){if(n&1&&g(0,kNt,1,0,"ng-container",13),n&2){l();let t=de(2),e=de(9);m("ngTemplateOutlet",e)("ngTemplateOutletContext",P(2,wue,t))}}function NNt(n,o){if(n&1){let t=q();f(0),C(1,"velt-multi-thread-comment-dialog-internal",14),D(2,"translate"),z("saveComment",function(i){k(t);let r=l(4);return R(r.saveComment.emit(i))})("updateOverlayPosition",function(){k(t);let i=l(4);return R(i.updateOverlayPosition())})("pointerOutFromCommentDialog",function(i){k(t);let r=l(4);return R(r.onPointerOutFromCommentDialog(i))})("pointerUp",function(i){k(t);let r=l(4);return R(r.onPointerUpOnDialog(i))}),S(),v()}if(n&2){let t=l(3).ngIf;d(),m("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",O(2,8,"Multi-thread comment dialog"))}}function FNt(n,o){if(n&1){let t=q();C(0,"snippyly-comment-dialog",15),D(1,"translate"),z("saveComment",function(i){k(t);let r=l(4);return R(r.saveComment.emit(i))})("updateOverlayPosition",function(){k(t);let i=l(4);return R(i.updateOverlayPosition())})("pointerOutFromCommentDialog",function(i){k(t);let r=l(4);return R(r.onPointerOutFromCommentDialog(i))})("pointerUp",function(){k(t);let i=l(4);return R(i.onPointerUpOnDialog())}),S()}if(n&2){let t=l(3).ngIf;m("annotation",t.annotation)("user",t.user)("commentPinSelected",t.commentPinSelected)("containerComponentId",t.containerComponentId)("commentPinType",t.commentPinType),x("role","dialog")("aria-label",O(1,7,"Comment dialog"))}}function LNt(n,o){if(n&1&&g(0,NNt,3,10,"ng-container",8)(1,FNt,2,9,"ng-template",null,2,xe),n&2){let t=de(2),e=l(2).ngIf;m("ngIf",(e==null||e.annotation==null?null:e.annotation.type)==="multiThread")("ngIfElse",t)}}function BNt(n,o){if(n&1){let t=q();g(0,LNt,3,2,"ng-template",10,5,xe),z("positionChange",function(i){k(t);let r=l(2);return R(r.onCommentDialogPositionChange(i))})}if(n&2){let t=o.trigger,e=l().ngIf;m("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",kt(10,DNt))("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 VNt(n,o){if(n&1){let t=q();C(0,"snippyly-comment-bottom-sheet",16),D(1,"translate"),z("saveComment",function(i){k(t);let r=l(2);return R(r.saveComment.emit(i))}),S()}if(n&2){let t=l().ngIf;m("annotation",t.annotation)("user",t.user),x("role","dialog")("aria-label",O(1,4,"Comment bottom sheet"))}}function UNt(n,o){if(n&1){let t=q();f(0),C(1,"div",7,0),D(3,"translate"),z("click",function(i){return k(t),R(i.preventDefault())})("pointerenter",function(i){return k(t),l().onPointerOver(i),R(i.stopPropagation())})("pointerleave",function(){k(t);let i=l();return R(i.onPointerOut())}),Pt(4),S(),g(5,PNt,3,11,"ng-container",8)(6,RNt,1,4,"ng-template",null,1,xe)(8,BNt,2,11,"ng-template",null,2,xe)(10,VNt,2,6,"snippyly-comment-bottom-sheet",9),v()}if(n&2){let t=o.ngIf,e=de(7),i=l();d(),x("data-testid",i.componentId+"-trigger")("role","button")("aria-expanded",t.commentPinSelected)("aria-haspopup","dialog")("aria-label",O(3,8,"Comment pin")),d(4),m("ngIf",t.bubbleOnPin&&!t.commentBubbleAvailable&&!t.dialogOpenedInSidebar)("ngIfElse",e),d(5),m("ngIf",(t==null?null:t.user)&&t.mobileMode&&t.isPhone&&!t.sidebarVisible&&!t.dialogOpenedInSidebar&&!t.inboxMode&&!t.streamMode&&t.floatingCommentsEnabled&&t.commentPinSelected)}}var VC=(()=>{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 De,this.togglePinSelection=new De,this.commentTargetElementClicked=new De,this.isDialogOnHoverEnabled=!1,this.isDialogOnTargetElementClickEnabled=!1,this.previouslySelectedAnnotations={},this.eventListenersSubscriptions=[],this.customScrollableParentEventsListenersSubscriptions=[],this.componentConfigSignal=be({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(Ei.XSmall).subscribe(c=>{c.matches?this.componentConfigSignal.update(p=>(p=T(I({},p),{isPhone:!0}),p)):this.componentConfigSignal.update(p=>(p=T(I({},p),{isPhone:!1}),p))},c=>{this.catchError("Error in CommentDialogPortalComponent breakpointObserver subscription: ",c)})),this.subscriptions.push(this.commentService.getSidebarVisibility$().subscribe(c=>{this.componentConfigSignal.update(p=>(p=T(I({},p),{sidebarVisible:c}),p))},c=>{this.catchError("Error in CommentDialogPortalComponent getSidebarVisibility$ subscription: ",c)})),this.subscriptions.push(this.commentService.getMobileMode$().subscribe(c=>{this.componentConfigSignal.update(p=>(p=T(I({},p),{mobileMode:c}),p))},c=>{this.catchError("Error in CommentDialogPortalComponent getMobileMode$ subscription: ",c)})),this.subscriptions.push(this.commentService.getShowCommentIndex().subscribe(c=>{this.componentConfigSignal.update(p=>(p=T(I({},p),{showCommentIndex:c}),p))},c=>{this.catchError("Error in CommentDialogPortalComponent getShowCommentIndex subscription: ",c)})),this.subscriptions.push(this.commentService.getStreamMode$().subscribe(c=>{this.componentConfigSignal.update(p=>(p=T(I({},p),{streamMode:c}),p))},c=>{this.catchError("Error in CommentDialogPortalComponent getStreamMode$ subscription: ",c)})),this.subscriptions.push(this.commentService.getInboxMode$().subscribe(c=>{this.componentConfigSignal.update(p=>(p=T(I({},p),{inboxMode:c}),p))},c=>{this.catchError("Error in CommentDialogPortalComponent getInboxMode subscription: ",c)})),this.subscriptions.push(this.domService.getDialogOpenedInSidebar().subscribe(c=>{this.componentConfigSignal.update(p=>(p=T(I({},p),{dialogOpenedInSidebar:c}),p))},c=>{this.catchError("Error in CommentDialogPortalComponent getDialogOpenedInSidebar subscription: ",c)})),this.subscriptions.push(this.commentService.getPopoverMode$().subscribe(c=>{this.componentConfigSignal.update(p=>(p=T(I({},p),{popoverMode:c}),p)),this.componentConfigSignal().popoverMode?this.componentConfigSignal.update(p=>(p=T(I({},p),{positions:U.OVERLAY_POSITIONS_FOR_POPOVER_MODE.map(h=>new Ri({originX:h.originX,originY:h.originY},{overlayX:h.overlayX,overlayY:h.overlayY}))}),p)):this.componentConfigSignal.update(p=>(p=T(I({},p),{positions:U.OVERLAY_POSITIONS.map(h=>new Ri({originX:h.originX,originY:h.originY},{overlayX:h.overlayX,overlayY:h.overlayY}))}),p)),this.addEventListeners()},c=>{this.catchError("Error in CommentDialogPortalComponent getPopoverMode subscription: ",c)})),this.subscriptions.push(this.commentService.showFloatingComments$().subscribe(c=>{this.componentConfigSignal.update(p=>(p=T(I({},p),{floatingCommentsEnabled:c}),p))},c=>{this.catchError("Error in CommentDialogPortalComponent showFloatingComments$ subscription: ",c)})),this.subscriptions.push(this.commentService.getEnableDialogOnHover$().subscribe(c=>{this.isDialogOnHoverEnabled=c,this.componentConfigSignal.update(p=>(p=T(I({},p),{dialogOnHover:c}),p)),this.addEventListeners()},c=>{this.catchError("Error in CommentDialogPortalComponent getEnableDialogOnHover subscription: ",c)})),this.subscriptions.push(this.commentService.getEnableDialogOnTargetElementClick$().subscribe(c=>{this.isDialogOnTargetElementClickEnabled=c,this.addEventListeners()},c=>{this.catchError("Error in CommentDialogPortalComponent getEnableDialogOnTargetElementClick subscription: ",c)})),this.subscriptions.push(this.commentService.getBubbleCommentAnnotationIds$().subscribe(c=>{if(c.includes(this.componentConfigSignal().annotation?.annotationId)){this.commentBubbleElement=this.commentService.getCommentBubbleElement(this.componentConfigSignal().annotation);let p=this.commentBubbleElement?.getAttribute(U.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)))},c=>{this.catchError("Error in CommentDialogPortalComponent getBubbleCommentAnnotationIds$ subscription: ",c)})),this.subscriptions.push(this.domService.getSelectedAnnotationsMap$().pipe(Vi()).subscribe(([c,p])=>{this.previouslySelectedAnnotations=c||{},p&&!p[this.componentConfigSignal().annotation?.annotationId]&&this.componentConfigSignal().commentPinHover&&this.setCommentPinHover(!1)},c=>{this.catchError("Error in CommentDialogPortalComponent getSelectedAnnotationsMap$ subscription: ",c)}))}catch(c){this.catchError("Error in CommentDialogPortalComponent constructor: ",c)}}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(yp(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(oi(this.targetElement,"pointerover").subscribe(e=>{this.onPointerOver(e),e.stopPropagation()},e=>{this.catchError("Error in CommentDialogPortalComponent addEventListeners pointerover subscription: ",e)})),this.eventListenersSubscriptions.push(oi(this.targetElement,"pointerout").subscribe(e=>{!this.targetElement?.contains(e?.relatedTarget)&&!e?.relatedTarget?.closest(U.TAGS.SNIPPYLY_COMMENT_DIALOG)&&this.onPointerOut()},e=>{this.catchError("Error in CommentDialogPortalComponent addEventListeners pointerout subscription: ",e)}))),this.eventListenersSubscriptions.push(oi(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(U.ATTRIBUTES.VELT_COMMENT_PIN_ACTIVE)||this.targetElement?.setAttribute(U.ATTRIBUTES.VELT_COMMENT_PIN_ACTIVE,"true")):this.targetElement&&this.targetElement?.hasAttribute(U.ATTRIBUTES.VELT_COMMENT_PIN_ACTIVE)&&this.targetElement?.removeAttribute(U.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(oi(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(co),u(Te),u(Fe),u(y),u(N))},o.\u0275cmp=M({type:o,selectors:[["velt-comment-dialog-portal-internal"]],viewQuery:function(i,r){if(i&1&&(it(ENt,5),it(xNt,5)),i&2){let a;Ze(a=Xe())&&(r.commentDialogOverlay=a.first),Ze(a=Xe())&&(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:[qe],ngContentSelectors:TNt,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,UNt,11,10,"ng-container",6)),i&2&&m("ngIf",r.componentConfigSignal())},dependencies:[K,ft,jn,kn,Ho,LP,Zp,Tue,es,me],encapsulation:2,changeDetection:0});let n=o;return n})();var jNt=["pinRef"],$Nt=["commentDialogPortalRef"],HNt=["*"],Oue=n=>({componentConfigSignal:n}),zNt=(n,o)=>({condition:n,data:o}),Aue=()=>["bubble","chart"],GNt=(n,o,t,e,i)=>({template:n,context:o,componentName:"velt-comment-pin-wireframe",variant:t,setIfCondition:e,componentElementRef:i}),WNt=(n,o,t)=>({"velt-comment-pin--status-default":n,"velt-comment-pin--status-ongoing":o,"velt-comment-pin--status-terminal":t});function qNt(n,o){n&1&&Ue(0)}function YNt(n,o){if(n&1&&(C(0,"velt-shadow-dom-internal"),g(1,qNt,1,0,"ng-container",11),S()),n&2){l();let t=de(3),e=l(2);x("data-testid",e.componentId+"-shadow-dom"),d(),m("ngTemplateOutlet",t)}}function KNt(n,o){if(n&1){let t=q();f(0),C(1,"div",14),z("click",function(i){return k(t),R(i.preventDefault())}),Pt(2),S(),v()}n&2&&(d(),x("role","presentation"))}function ZNt(n,o){if(n&1&&(f(0),w(1,"app-comment-pin-triangle",15),v()),n&2){let t=l(5);d(),m("componentConfigSignal",t.componentConfigSignal)("template",t.template)}}function XNt(n,o){n&1&&(oe(),C(0,"svg",20),w(1,"path",21)(2,"path",22),S())}function QNt(n,o){n&1&&(oe(),C(0,"svg",20),w(1,"path",23)(2,"path",24),S())}function JNt(n,o){n&1&&(oe(),C(0,"svg",20),w(1,"path",25)(2,"path",26),S())}function eFt(n,o){n&1&&(oe(),C(0,"svg",20),w(1,"path",27)(2,"path",28),S())}function tFt(n,o){if(n&1&&(f(0)(1,18),g(2,XNt,3,0,"svg",19)(3,QNt,3,0,"svg",19)(4,JNt,3,0,"svg",19)(5,eFt,3,0,"svg",19),v()()),n&2){let t=l(6).ngIf;d(),m("ngSwitch",t.annotation==null||t.annotation.pageInfo==null||t.annotation.pageInfo.deviceInfo==null?null:t.annotation.pageInfo.deviceInfo.deviceType),d(),m("ngSwitchCase","Mobile"),d(),m("ngSwitchCase","Tablet"),d(),m("ngSwitchCase","Desktop"),d(),m("ngSwitchCase","Monitor")}}function nFt(n,o){if(n&1&&w(0,"snippyly-user-avatar",29),n&2){let t=l(6).ngIf;m("user",t.annotation==null?null:t.annotation.from)}}function iFt(n,o){if(n&1&&(f(0),w(1,"app-comment-pin-unread-comment-indicator",30),v()),n&2){let t=l(7);d(),m("componentConfigSignal",t.componentConfigSignal)}}function oFt(n,o){if(n&1&&w(0,"app-comment-pin-index",30)(1,"app-comment-pin-ghost-comment-indicator",30)(2,"app-comment-pin-private-comment-indicator",30),n&2){let t=l(7);m("componentConfigSignal",t.componentConfigSignal),d(),m("componentConfigSignal",t.componentConfigSignal),d(),m("componentConfigSignal",t.componentConfigSignal)}}function rFt(n,o){if(n&1){let t=q();f(0),C(1,"div",17,5),z("click",function(i){return k(t),R(i.preventDefault())}),g(3,tFt,6,5,"ng-container",10)(4,nFt,1,1,"ng-template",null,6,xe)(6,iFt,2,1,"ng-container",10)(7,oFt,3,3,"ng-template",null,7,xe),S(),v()}if(n&2){let t=de(5),e=de(8),i=l(5).ngIf,r=l();d(),ot("--velt-internal-comment-pin-bg-color",(i.annotation==null||i.annotation.status==null?null:i.annotation.status.color)||null),pe("velt-comment-pin--marker-transparent",r.usingCustomCommentPin)("velt-comment-pin--marker-default",!r.usingCustomCommentPin),m("ngClass",He(12,WNt,!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),m("ngIf",i.isDeviceIndicatorOnCommentPinsEnabled&&i.isCommentAddedOnDifferentDeviceType)("ngIfElse",t),d(3),m("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 aFt(n,o){if(n&1){let t=q();C(0,"div",14),z("click",function(i){return k(t),R(i.preventDefault())}),g(1,rFt,9,16,"ng-container",16),S()}if(n&2){let t=l(4).ngIf,e=l();x("role","presentation"),d(),m("veltDynamicTemplate",$(4,GNt,e.template,P(2,Oue,e.componentConfigSignal),t==null?null:t.variant,e.setIfCondition.bind(e),e.elementRef))}}function sFt(n,o){if(n&1&&g(0,ZNt,2,2,"ng-container",10)(1,aFt,2,10,"ng-template",null,4,xe),n&2){let t=de(2),e=l(3).ngIf;m("ngIf",e.popoverMode)("ngIfElse",t)}}function lFt(n,o){if(n&1){let t=q();C(0,"velt-comment-dialog-portal-internal",12,1),z("saveComment",function(i){k(t);let r=l(3);return R(r.saveComment.emit(i))})("togglePinSelection",function(i){k(t);let r=l(3);return R(r.onPinBubblePointerUp(i))})("pointerUp",function(){k(t);let i=l(3);return R(i.onPointerUpOnDialog())}),C(2,"div",13,2),g(4,KNt,3,1,"ng-container",10)(5,sFt,3,2,"ng-template",null,3,xe),S()()}if(n&2){let t=de(6),e=l(2).ngIf,i=l();m("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),ot("--velt-internal-comment-pin-max-width",i.pinMaxWidth),pe("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-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),m("ngIf",e.commentPinType==="bubble"||e.commentPinType==="chart")("ngIfElse",t)}}function cFt(n,o){if(n&1&&(f(0),g(1,YNt,2,2,"velt-shadow-dom-internal",10)(2,lFt,7,26,"ng-template",null,0,xe),v()),n&2){let t=de(3),e=l().ngIf,i=l();d(),m("ngIf",!i.template&&i.pinShadowDOM&&!(kt(2,Aue)!=null&&kt(3,Aue).includes(e.commentPinType)))("ngIfElse",t)}}function mFt(n,o){if(n&1&&(f(0),g(1,cFt,4,4,"ng-container",9),v()),n&2){let t=l();d(),m("veltIf",F(3,zNt,t.conditionSignal(),P(1,Oue,t.componentConfigSignal)))}}var Qp=(()=>{let o=class o extends aP{constructor(e,i,r,a,s,c,p){super(c,p,r),this.commentService=e,this.domService=i,this.loggingService=r,this.commentPinPortalService=a,this.wireframeService=s,this.elementRef=c,this.dynamicDataService=p,this.commentPinSelected=!1,this.annotationDragging=!1,this.commentPinType="pin",this.usingCustomCommentPin=!1,this.multipleCommentPinsSelected=!1,this.avatarErrorImage="",this.saveComment=new De,this.pinShadowDOM=!1,this.subscriptions=[],this.commentTargetElementClicked=new De,this.togglePinSelection=new De,this.commentBubbleAvailable=!1,this.commentPinPosition={top:0,left:0},this.isOutsideViewport=!1,this.pinMaxWidth="",this.previouslySelectedAnnotations={},this.deviceInfo=new Jn,this.COMMENT_PIN_SIZE=40,this.componentConfigSignal=be({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{this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;"),super.ngOnInit(),this.setupA11yAttributes();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}}))}catch(e){this.catchError("Error in CommentsToolComponent OnInit: ",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=p0(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()===U.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(U.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=p0(this.componentConfigSignal().annotation);this.injectAttributeData(r,a)}}this.setUserInitial(),this.componentConfigSignal.update(r=>(r=T(I({},r),{isPrivateComment:this.componentConfigSignal().annotation?.iam?.accessMode===Yi.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(Te),u(Fe),u(y),u(VP),u(Ge),u(N),u(b))},o.\u0275cmp=M({type:o,selectors:[["snippyly-comment-pin"]],viewQuery:function(i,r){if(i&1&&(it(jNt,5),it($Nt,5)),i&2){let a;Ze(a=Xe())&&(r.pinRef=a.first),Ze(a=Xe())&&(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:[j([b]),B,qe],ngContentSelectors:HNt,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"],[3,"componentConfigSignal"]],template:function(i,r){i&1&&(Vt(),g(0,mFt,2,6,"ng-container",8)),i&2&&m("ngIf",r.componentConfigSignal())},dependencies:[Rr,K,ft,ki,Gi,kn,Un,ne,L0,N0,F0,V0,B0,nn,VC,se],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 dFt(n,o){if(n&1){let t=q();f(0),C(1,"velt-multi-thread-comment-dialog-internal",6),z("afterViewInit",function(){k(t);let i=l().last,r=l(2);return R(i?r.calculatePosition():null)})("saveComment",function(i){k(t);let r=l().$implicit,a=l(2);return R(a.saveComment(r==null?null:r.annotation,i))}),S(),v()}if(n&2){let t=l().$implicit,e=l().ngIf,i=l();d(),m("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 pFt(n,o){if(n&1){let t=q();C(0,"snippyly-comment-dialog",7),z("afterViewInit",function(){k(t);let i=l().last,r=l(2);return R(i?r.calculatePosition():null)})("saveComment",function(i){k(t);let r=l().$implicit,a=l(2);return R(a.saveComment(r==null?null:r.annotation,i))}),S()}if(n&2){let t=l().$implicit,e=l().ngIf,i=l();m("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 gFt(n,o){if(n&1){let t=q();f(0),C(1,"div",4),z("click",function(){let i=k(t).$implicit,r=l(2);return R(r.togglePinSelection(i==null?null:i.annotation))}),g(2,dFt,2,5,"ng-container",5)(3,pFt,1,6,"ng-template",null,0,xe),S(),v()}if(n&2){let t=o.$implicit,e=de(4),i=l().ngIf,r=l();d(),ot("top",t==null?null:t.top,"px"),pe("selected",i.selectedAnnotationsMap[t==null||t.annotation==null?null:t.annotation.annotationId]),m("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(),m("ngIf",(t==null||t.annotation==null?null:t.annotation.type)==="multiThread")("ngIfElse",e)}}function uFt(n,o){if(n&1&&(f(0),C(1,"div",2),D(2,"translate"),g(3,gFt,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",O(2,5,"Comments panel")),d(2),m("ngForOf",t.commentPinAnnotationsArray)("ngForTrackBy",e.trackById)}}var Mue=(()=>{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=be({commentPinAnnotationsArray:[],selectedAnnotationsMap:{},user:void 0,inlineCommentMode:!1}),this.veltElement=!0,this.componentId="velt-comments-stream-view",this.subscriptions.push(this.authService.getUser$().subscribe(c=>{this.componentConfigSignal.update(p=>(p=T(I({},p),{user:c}),p))},c=>{this.loggingService.catch("Error in CommentsStreamViewComponent getUser$ subscription: ",c)})),this.subscriptions.push(this.domService.getSelectedAnnotationsMap$().subscribe(c=>{this.componentConfigSignal.update(p=>(p=T(I({},p),{selectedAnnotationsMap:c}),p)),setTimeout(()=>{this.calculatePosition(),Object.keys(this.componentConfigSignal().selectedAnnotationsMap).length===1&&this.goToAnnotation(this.componentConfigSignal().selectedAnnotationsMap[Object.keys(this.componentConfigSignal().selectedAnnotationsMap)[0]])},100)},c=>{this.loggingService.catch("Error in CommentsStreamViewComponent getSelectedAnnotationsMap$ subscription: ",c)})),this.subscriptions.push(this.commentService.getInlineCommentMode$().subscribe(c=>{this.componentConfigSignal.update(p=>(p=T(I({},p),{inlineCommentMode:c}),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=ov(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=vV(a,this.scrollableParentElement)?.top||0,r.isInsidePdfViewer=sv(a,U.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 c=this.elementRef?.nativeElement?.querySelector(`[id="snippyly-comments-on-right-block-${r.annotation.annotationId}"]`);c&&(r.dialogElement=c,r.dialogOffsetTop=vV(c,this.scrollableParentElement)?.top||0)}if(!a)r.top=r.targetOffsetTop;else if(i){let c=s[a-1];if(r.dialogElement){let p=c.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 c=s[a-1];if(c.dialogElement){let p=c.top+c.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=bg(0,Um).pipe(ce(()=>{let r=e.getBoundingClientRect();return{top:r.top,left:r.left}}),Kt((r,a)=>r.top===a.top&&r.left===a.left),Vi());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(je),u(Te),u(Fe),u(N),u(y))},o.\u0275cmp=M({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:[qe],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,uFt,4,7,"ng-container",1),i&2&&m("ngIf",r.componentConfigSignal())},dependencies:[ht,K,Ho,es,me],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 fFt=()=>["snippyly-inbox-panel"];function vFt(n,o){n&1&&Ue(0)}function CFt(n,o){if(n&1&&g(0,vFt,1,0,"ng-container",7),n&2){l();let t=de(6);m("ngTemplateOutlet",t)}}function _Ft(n,o){if(n&1){let t=q();C(0,"velt-multi-thread-comment-dialog-internal",11),D(1,"translate"),z("saveComment",function(i){k(t);let r=l(4);return R(r.saveComment(i))}),S()}if(n&2){let t=l(3).ngIf,e=l();m("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",O(1,8,"Multi-thread comment dialog"))}}function yFt(n,o){if(n&1&&(f(0),g(1,_Ft,2,10,"velt-multi-thread-comment-dialog-internal",10),v()),n&2){let t=l(2).ngIf;d(),m("ngIf",t.commentAnnotation&&t.user)}}function SFt(n,o){if(n&1){let t=q();C(0,"snippyly-comment-dialog",13),D(1,"translate"),z("saveComment",function(i){k(t);let r=l(4);return R(r.saveComment(i))}),S()}if(n&2){let t=l(3).ngIf,e=l();m("annotation",t.commentAnnotation)("user",t.user)("commentPinSelected",!0)("inboxMode",!0),x("data-testid",e.componentId+"-single-dialog")("role","dialog")("aria-label",O(1,7,"Single comment dialog"))}}function bFt(n,o){if(n&1&&g(0,SFt,2,9,"snippyly-comment-dialog",12),n&2){let t=l(2).ngIf;m("ngIf",t.commentAnnotation&&t.user)}}function IFt(n,o){if(n&1&&(C(0,"div",8),D(1,"translate"),g(2,yFt,2,1,"ng-container",9)(3,bFt,1,1,"ng-template",null,3,xe),S()),n&2){let t=de(4),e=l().ngIf,i=l();pe("mobile",e.isPhone)("visible",!!e.commentAnnotation),x("data-testid",i.componentId)("role","region")("aria-label",O(1,10,"Comment inbox container"))("aria-expanded",!!e.commentAnnotation),d(2),m("ngIf",(e==null||e.commentAnnotation==null?null:e.commentAnnotation.type)==="multiThread")("ngIfElse",t)}}function EFt(n,o){if(n&1&&(f(0),w(1,"div",5,0),g(3,CFt,1,1,"ng-template",6,1,xe)(5,IFt,5,12,"ng-template",null,2,xe),v()),n&2){let t=de(2),e=l();d(),x("data-testid",e.componentId+"-trigger")("aria-hidden",!0),d(2),m("cdkConnectedOverlayOrigin",t)("cdkConnectedOverlayOpen",!0)("cdkConnectedOverlayDisableClose",!0)("cdkConnectedOverlayPanelClass",kt(6,fFt))}}var Pue=(()=>{let o=class o extends nt{constructor(e,i,r,a,s,c){super(s,c),this.authService=e,this.breakpointObserver=i,this.commentService=r,this.loggingService=a,this.elementRef=s,this.themeService=c,this.componentConfigSignal=be({isPhone:!1,sidebarVisible:!1}),this.subscriptions=[],this.componentId="velt-comment-inbox";try{this.subscriptions.push(this.breakpointObserver.observe(Ei.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(je),u(co),u(Te),u(y),u(N),u(Ye))},o.\u0275cmp=M({type:o,selectors:[["snippyly-comment-inbox"]],inputs:{commentAnnotation:"commentAnnotation"},standalone:!1,features:[B,qe],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,EFt,7,7,"ng-container",4),i&2&&m("ngIf",r.componentConfigSignal())},dependencies:[K,ft,jn,kn,Ho,es,me],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 TFt(n,o){if(n&1){let t=q();f(0),C(1,"div",3),z("click",function(){let i=k(t).$implicit,r=l(2);return R(r.scrollToAnnotation(i==null?null:i.key))}),C(2,"div",4),te(3),D(4,"translate"),S()(),v()}if(n&2){let t=o.$implicit,e=l().ngIf,i=l();d(),ot("top",t.value.top,"%")("transform","translate(0, -"+t.value.top+"%)"),pe("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(" ",O(4,12,"Go to comments here.")," ")}}function wFt(n,o){if(n&1&&(f(0),C(1,"div",1),D(2,"translate"),g(3,TFt,5,14,"ng-container",2),D(4,"keyvalue"),S(),v()),n&2){let t=o.ngIf,e=l();d(),pe("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",O(2,9,"Comments minimap")),d(2),m("ngForOf",O(4,11,t.commentAnnotationPositionMap))("ngForTrackBy",e.trackByAnnotationId)}}var UP=(()=>{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=be({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 c=i/s*100;return{pixelsFromTop:i,percentageOfTotalHeight:c}}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(Te),u(y),u(N))},o.\u0275cmp=M({type:o,selectors:[["app-comments-minimap"]],inputs:{commentAnnotations:"commentAnnotations",user:"user",targetScrollableElementId:"targetScrollableElementId",position:"position"},standalone:!1,features:[qe],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,wFt,5,13,"ng-container",0),i&2&&m("ngIf",r.componentConfigSignal())},dependencies:[ht,K,Qm,me],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 DFt(n,o){n&1&&Ue(0)}function AFt(n,o){if(n&1&&(C(0,"velt-shadow-dom-internal"),g(1,DFt,1,0,"ng-container",6),S()),n&2){l();let t=de(3);d(),m("ngTemplateOutlet",t)}}function OFt(n,o){if(n&1&&(w(0,"snippyly-comments-stream-view",10),D(1,"translate")),n&2){let t=l(3).ngIf,e=l();m("commentPinAnnotations",t.commentPinAnnotationsForStreamView)("streamViewContainerId",e.streamViewContainerId),x("data-testid",e.componentId+"-stream")("role","complementary")("aria-label",O(1,5,"Comments stream view"))}}function MFt(n,o){if(n&1&&(w(0,"snippyly-comment-inbox",11),D(1,"translate")),n&2){let t=l(3).ngIf,e=l();m("darkMode",t.darkMode)("commentAnnotation",t.selectedCommentAnnotation),x("data-testid",e.componentId+"-inbox")("role","complementary")("aria-label",O(1,5,"Comments inbox"))}}function PFt(n,o){if(n&1&&(w(0,"app-comments-minimap",12),D(1,"translate")),n&2){let t=l(3).ngIf,e=l();m("commentAnnotations",t.commentPinAnnotations)("user",t.user)("position",t.minimapPosition),x("data-testid",e.componentId+"-minimap")("role","complementary")("aria-label",O(1,6,"Comments location overview"))}}function kFt(n,o){if(n&1&&(w(0,"snippyly-comment-adder"),g(1,OFt,2,7,"snippyly-comments-stream-view",7)(2,MFt,2,7,"snippyly-comment-inbox",8)(3,PFt,2,8,"app-comments-minimap",9)),n&2){let t=l(2).ngIf,e=l();x("data-testid",e.componentId+"-adder"),d(),m("ngIf",t.streamMode&&t.commentsOnDom),d(),m("ngIf",t.inboxMode&&t.commentsOnDom),d(),m("ngIf",t.minimapEnabled&&t.commentsOnDom)}}function RFt(n,o){if(n&1&&(f(0),g(1,AFt,2,1,"velt-shadow-dom-internal",5)(2,kFt,4,4,"ng-template",null,0,xe),v()),n&2){let t=de(3),e=l().ngIf;d(),m("ngIf",e.shadowDOM)("ngIfElse",t)}}function NFt(n,o){if(n&1){let t=q();f(0),g(1,RFt,4,2,"ng-container",1),C(2,"div",2)(3,"slot",3),z("slotchange",function(i){k(t);let r=l();return R(r.handleCommentPinSlotChanged(i))}),S()(),w(4,"app-persistent-comment-mode",4),v()}if(n&2){let t=o.ngIf,e=l();d(),m("ngIf",t.isFirstComponent),d(),x("aria-hidden","true")("data-testid",e.componentId+"-slot-container"),d(2),m("componentConfigSignal",e.componentConfigSignal),x("data-testid",e.componentId+"-persistent-mode")}}var P$=(()=>{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 _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.customFilterService.setCustomStatusFilters(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,c,p,h,_,E,A,V){this.analyticsService=e,this.authService=i,this.domService=r,this.commentService=a,this.commentPinPortalService=s,this.commentTextPortalService=c,this.customFilterService=p,this.loggingService=h,this.elementRef=_,this.autocompleteService=E,this.contactService=A,this.recorderAnnotationService=V,this.onCommentAdd=new De,this.onSignIn=new De,this.onUpgrade=new De,this.onCustomPinInject=new De,this.onCommentUpdate=new De,this.onCommentAccept=new De,this.onCommentReject=new De,this.onSidebarButtonOnCommentDialogClick=new De,this.onCommentSelectionChange=new De,this.onCopyLink=new De,this.subscriptions=[],this.selectedAnnotationsMap={},this.commentAnnotationFocused=!1,this.enableGhostComments=!1,this.resolvedCommentsOnDom=!1,this.scrollToComment=!1,this.componentConfigSignal=be({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=xn(),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 G=new URL(window.location.href);this.focusCommentAnnotationId=G.searchParams.get(U.URL_PARAMS.COMMENT_ID),this.commentService.setCommentAddedEmitter(this.onCommentAdd)}catch(G){this.loggingService.catch("Error in CommentsContainerComponent constructor: ",G)}}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(U.TAGS.SNIPPYLY_COMMENTS),i=document.querySelector(U.TAGS.VELT_COMMENTS);document.querySelector(`${U.TAGS.VELT_COMMENTS}[${U.ATTRIBUTES.VELT_IS_FIRST_COMPONENT}]`)||(i?this.veltId===i?.getAttribute(U.ATTRIBUTES.VELT_ID)&&(this.componentConfigSignal.update(a=>(a=T(I({},a),{isFirstComponent:!0}),a)),i?.setAttribute(U.ATTRIBUTES.VELT_IS_FIRST_COMPONENT,"true"),this.initComponent()):this.veltId===e?.getAttribute(U.ATTRIBUTES.VELT_ID)&&(this.componentConfigSignal.update(a=>(a=T(I({},a),{isFirstComponent:!0}),a)),e?.setAttribute(U.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(Ne(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(ge(e=>(this.componentConfigSignal.update(i=>(i=T(I({},i),{commentsOnDom:e}),i)),this.componentConfigSignal().commentsOnDom?Dn([this.commentService.getAllCommentAnnotations({detectGhostComments:!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||[]]),ge(i=>this.commentService.getEnableGhostComments$().pipe(ce(r=>(this.enableGhostComments=r,i)))),ge(i=>this.commentService.getCommentsOnDom$().pipe(ce(r=>(this.componentConfigSignal.update(a=>(a=T(I({},a),{commentsOnDom:r}),a)),i)))),ge(i=>this.commentService.getResolvedCommentsOnDom$().pipe(ce(r=>(this.resolvedCommentsOnDom=r,i)))),ge(i=>this.domService.getSelectedAnnotationsMap$().pipe(ce(r=>({filteredAnnotations:i||[],selectedAnnotationsMap:r||{}}))))):re({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 c=!0;return s?.ghostComment?.type===Vs.DIFFERENT_DEVICE&&!s?.ghostComment?.isSameGroup&&(e.selectedAnnotationsMap[s.annotationId]||(c=!1)),s?.ghostComment&&!this.enableGhostComments&&(c=!1),this.resolvedCommentsOnDom||s.status!==void 0&&s.status.type==="terminal"&&(e.selectedAnnotationsMap[s.annotationId]||(c=!1)),c}),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&&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(U.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(U.SESSION_STORAGE.SNIPPYLY_AUTO_SELECT_ANNOTATION_ID,e.annotationId)),i||(i=document.querySelector(`${U.TAGS.VELT_COMMENT_TEXT}[${U.ATTRIBUTES.ANNOTATION_ID}="${e.annotationId}"]`)),i&&this.scrollToComment&&i.scrollIntoView({behavior:"auto",block:"center",inline:"nearest"})},100))}}setCommentInstalledInAnalytics(){try{this.analyticsService.setInstalledFeature(Re.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(Qe),u(je),u(Fe),u(Te),u(VP),u(rP),u($o),u(y),u(N),u(Hs),u(gi),u(Xi))},o.\u0275cmp=M({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"],_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:[qe],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,NFt,5,5,"ng-container",1),i&2&&m("ngIf",r.componentConfigSignal())},dependencies:[K,ft,Vse,Mue,Pue,UP,nn,IC,me],encapsulation:2,changeDetection:0});let n=o;return n})();var FFt=["sidebarRef"],LFt=n=>({componentConfigSignal:n}),BFt=(n,o)=>({condition:n,data:o}),VFt=(n,o)=>({componentConfigSignal:n,sidebarRef:o}),UFt=(n,o)=>({template:n,context:o});function jFt(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=de(1),e=l(3).ngIf,i=l();pe("s-overflow-hidden",e.moreFiltersVisible)("velt-sidebar--more-filters-visible",e.moreFiltersVisible),x("aria-expanded",e.sidebarVisible),d(2),m("componentConfigSignal",i.componentConfigSignal),d(),m("sidebarRef",t)("componentConfigSignal",i.componentConfigSignal),d(),m("componentConfigSignal",i.componentConfigSignal)("sidebarRef",t)}}function $Ft(n,o){if(n&1){let t=q();f(0),C(1,"div",3),D(2,"translate"),z("click",function(i){k(t);let r=l(3);return R(r.onClick(i))}),g(3,jFt,5,10,"div",4),S(),v()}if(n&2){let t=l(2).ngIf,e=l();d(),pe("mobile",t.isPhone)("visible",t.sidebarVisible||t.embedMode||t.floatingMode)("floating",t.floatingMode)("embed",t.embedMode)("page",t.pageMode),m("ngClass",t.position),x("data-testid",e.componentId)("aria-label",O(2,14,"Comments sidebar")),d(2),m("veltDynamicTemplate",F(19,UFt,e.template,F(16,VFt,e.componentConfigSignal,e.sidebarRef)))}}function HFt(n,o){if(n&1&&(f(0),g(1,$Ft,4,22,"ng-container",1),v()),n&2){let t=l().ngIf;d(),m("ngIf",t)}}function zFt(n,o){if(n&1&&(f(0),g(1,HFt,2,1,"ng-container",2),v()),n&2){let t=l();d(),m("veltIf",F(3,BFt,t.conditionSignal(),P(1,LFt,t.componentConfigSignal)))}}var Rue=(()=>{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 De,this.componentId="velt-comments-sidebar-wrapper",super.initializeComponentConfigSignal(new Ke)}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(N),u(Ye),u(y),u(b))},o.\u0275cmp=M({type:o,selectors:[["velt-comments-sidebar-wrapper-internal"]],viewQuery:function(i,r){if(i&1&&it(FFt,7),i&2){let a;Ze(a=Xe())&&(r.sidebarRef=a.first)}},outputs:{onWrapperClick:"onWrapperClick"},standalone:!1,features:[j([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,zFt,2,6,"ng-container",1),i&2&&m("ngIf",r.componentConfigSignal())},dependencies:[Rr,K,ne,Qu,Xu,DC,se,me],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 WFt=["sidebarOverlay"],qFt=["virtualScrollViewportRef"],YFt=["host"],KFt=n=>["snippyly-sidebar-panel",n];function ZFt(n,o){n&1&&Ue(0)}function XFt(n,o){if(n&1&&(C(0,"velt-shadow-dom-internal"),g(1,ZFt,1,0,"ng-container",7),S()),n&2){l(3);let t=de(3);d(),m("ngTemplateOutlet",t)}}function QFt(n,o){if(n&1&&(f(0),g(1,XFt,2,1,"velt-shadow-dom-internal",6),v()),n&2){l(2);let t=de(3),e=l();d(),m("ngIf",!e.template&&e.sidebarShadowDOM)("ngIfElse",t)}}function JFt(n,o){n&1&&Ue(0)}function eLt(n,o){if(n&1&&(C(0,"velt-shadow-dom-internal"),g(1,JFt,1,0,"ng-container",7),S()),n&2){l(4);let t=de(3);d(),m("ngTemplateOutlet",t)}}function tLt(n,o){if(n&1&&(C(0,"div",10),g(1,eLt,2,1,"velt-shadow-dom-internal",6),S()),n&2){let t=l(3).ngIf,e=de(3),i=l();pe("dark",t.darkMode),d(),m("ngIf",!i.template&&i.sidebarShadowDOM)("ngIfElse",e)}}function nLt(n,o){if(n&1&&(w(0,"div",8,2),g(2,tLt,2,4,"ng-template",9,3,xe)),n&2){let t=de(1),e=l(2).ngIf;d(2),m("cdkConnectedOverlayOrigin",t)("cdkConnectedOverlayOpen",!0)("cdkConnectedOverlayDisableClose",!0)("cdkConnectedOverlayPanelClass",P(4,KFt,e.darkMode?"dark":""))}}function iLt(n,o){if(n&1&&g(0,QFt,2,2,"ng-container",6)(1,nLt,4,6,"ng-template",null,1,xe),n&2){let t=de(2),e=l().ngIf;m("ngIf",e.embedMode||e.floatingMode)("ngIfElse",t)}}function oLt(n,o){if(n&1){let t=q();C(0,"velt-comments-sidebar-wrapper-internal",11),D(1,"translate"),z("onWrapperClick",function(i){k(t);let r=l(2);return R(r.onClick(i))}),S()}if(n&2){let t=l().ngIf,e=l();m("componentConfigSignal",e.componentConfigSignal)("template",e.template)("darkMode",t.darkMode),x("data-testid",e.componentId)("aria-label",O(1,6,"Comments sidebar"))("aria-modal",!0)}}function rLt(n,o){if(n&1&&(f(0),g(1,iLt,3,2,"ng-template",5)(2,oLt,2,8,"ng-template",null,0,xe),v()),n&2){let t=o.ngIf;d(),m("ngIf",t.isFirstComponent||t.floatingMode)}}var jP=(()=>{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 _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,c,p,h,_,E,A,V,G,X,he,Ie){super(c,Ie,void 0,r),this.analyticsService=e,this.authService=i,this.commentService=r,this.domService=a,this.docService=s,this.elementRef=c,this.iamService=p,this.loggingService=h,this.breakpointObserver=_,this.customFilterService=E,this.translateService=A,this.cd=V,this.wireframeService=G,this.renderer=X,this.dynamicComponentService=he,this.themeService=Ie,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 De,this.onSidebarOpen=new De,this.onSidebarCommentClick=new De,this.onSidebarCommentClickEvent=new De,this.onCommentClick=new De,this.onSidebarClose=new De,this.onCommentNavigationButtonClick=new De,this.subscriptions=[],this.locations={},this.commentAccessMode=Yi,this.commentReadAnalyticsCalled=!0,this.peopleTypes={all:"All",assignedToMe:"Me",addedByMe:"Me",other:"Other",taggedMe:"Me"},this.pageTypes={all:"All",other:"Other"},this.unsetType={id:"unset",name:"Not set"},this.objectKeys=Object.keys,this.filteredGroupedCommentAnnotationsObj={},this.filteredGroupedCommentAnnotations=[],this.veltId=xn(),this.veltElement=!0,this.defaultFilterConfig={location:{name:"Pages",enable:!0,multiSelection:!0,enableGrouping:!0},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=be({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,annotations:[],filteredCommentPinAnnotations:[],selectedAnnotationsMap:{},commentAnnotationsCountByFilters:{page:{},status:{},people:{},tagged:{},assigned:{},version:{},priority:{},commentCategory:{},accessMode:{}},noCommentsFound:!1,noCommentsFoundForAppliedFilters:!1,pageCommentAnnotation:new ko,commentCategoryMap:U.CommentCategoryMap,virtualScrollData:[],isFirstComponent:!1,searchPlaceholder:this.searchPlaceholder,enableAutoCategorize:!1,filterConfig:JSON.parse(JSON.stringify(this.defaultFilterConfig)),filters:{pages:[],statuses:[],statusIds:[],people:[],assigned:[],tagged:[],versions:[],versionIds:[],priorities:[],priorityIds:[],categories:[],categoryIds:[],accessModes:[],input:null},moreFiltersVisible:!1,groupByOptions:{},groupBy:null,peopleFilters:[{id:this.peopleTypes.addedByMe,name:this.peopleTypes.addedByMe}],assignedFilters:[{id:this.peopleTypes.assignedToMe,name:this.peopleTypes.assignedToMe}],taggedFilters:[{id:this.peopleTypes.taggedMe,name:this.peopleTypes.taggedMe}],enablePriority:!1,enableStatus:!0,appliedFiltersCount:0,priorities:[],statuses:[],accessModes:[{id:Yi.PUBLIC,name:"Public"},{id:Yi.PRIVATE,name:"Private"}],filterOptionLayout:"checkbox",filterCount:!0,sidebarVisible:!1,pages:{},showAllPages:!1,versions:[],groupConfig:JSON.parse(JSON.stringify(this.defaultGroupConfig)),user:null,currentPage: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),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),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(Be=>{this.componentConfigSignal.update(We=>(We=T(I({},We),{darkMode:Be}),We))})),this.loggingService.log("%c[WB] Creating CLASS: CommentsSidebarComponent","color: blue;"),this.componentConfigSignal.update(Be=>(Be=T(I({},Be),{groupBy:Be.groupByOptions.page}),Be.pageCommentAnnotation.isPageAnnotation=!0,Be)),this.updateGroupByOptions(),this.subscriptions.push(this.commentService.getSidebarShadowDOM$().subscribe(Be=>{this.sidebarShadowDOM=Be})),this.subscriptions.push(this.commentService.getFocusedThreadMode$().subscribe(Be=>{this.componentConfigSignal.update(We=>(We=T(I({},We),{focusedThreadMode:Be}),We))})),this.subscriptions.push(this.commentService.getReadOnly$().subscribe(Be=>{this.componentConfigSignal.update(We=>(We=T(I({},We),{readOnly:Be}),We))})),this.subscriptions.push(this.commentService.getQueryParamsComments$().subscribe(Be=>{this.componentConfigSignal.update(We=>(We=T(I({},We),{queryParamsComments:Be}),We)),this.setPages()})),this.subscriptions.push(this.commentService.getUnreadCommentsMap$().subscribe(Be=>{this.componentConfigSignal.update(We=>(We=T(I({},We),{unreadCommentsMap:Be}),We))})),this.subscriptions.push(this.breakpointObserver.observe(Ei.XSmall).subscribe(Be=>{Be.matches?this.componentConfigSignal.update(We=>(We=T(I({},We),{isPhone:!0}),We)):this.componentConfigSignal.update(We=>(We=T(I({},We),{isPhone:!1}),We))},Be=>{this.loggingService.catch("Error in CommentsSidebarComponent breakpointObserver subscription: ",Be)})),this.subscriptions.push(this.customFilterService.customStatusMap$.subscribe(Be=>{this.statusMap=Be,this.componentConfigSignal.update(We=>(We=T(I({},We),{statuses:Object.values(Be)}),We)),this.pruneStaleStatuses()})),this.subscriptions.push(this.customFilterService.customPriorityMap$.subscribe(Be=>{this.priorityMap=Be,this.componentConfigSignal.update(We=>(We=T(I({},We),{priorities:[...Object.values(Be),{id:"unset",name:"Not set",color:"#FFFFFF"}]}),We)),this.pruneStalePriorities()})),this.subscriptions.push(this.customFilterService.customCategoryMap$.subscribe(Be=>{this.componentConfigSignal.update(We=>(We=T(I({},We),{commentCategoryMap:T(I({},Be),{other:{id:"other",name:"Other",color:"#00C48C"}})}),We)),this.pruneStaleCategories()}));let Pe=sessionStorage.getItem(U.SESSION_STORAGE.VELT_COMMENT_SIDEBAR_CUSTOM_ACTIONS_STATE);Pe&&this.componentConfigSignal.update(Be=>(Be=T(I({},Be),{customActionsState:JSON.parse(Pe)}),Be))}catch(Pe){this.loggingService.catch("Error in CommentsSidebarComponent constructor: ",Pe)}}ngOnInit(){try{if(this.setupA11yAttributes(),sessionStorage.getItem(U.SESSION_STORAGE.SNIPPYLY_COMMENT_SIDEBAR_FILTERS)){let e=JSON.parse(sessionStorage.getItem(U.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(U.SESSION_STORAGE.VELT_COMMENT_SIDEBAR_FILTERS_RESET)||(e.pages=[],sessionStorage.setItem(U.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(U.SESSION_STORAGE.SNIPPYLY_COMMENT_SIDEBAR_GROUP_BY)){let e=sessionStorage.getItem(U.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))}catch{}}ngAfterViewInit(){try{if(this.floatingMode)this.initComponent();else{let e=document.querySelector(U.TAGS.SNIPPYLY_COMMENTS_SIDEBAR),i=document.querySelector(U.TAGS.VELT_COMMENTS_SIDEBAR);i?this.veltId===i?.getAttribute(U.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(U.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!==U.TAGS.VELT_COMMENT_DIALOG&&i!==U.TAGS.SNIPPYLY_COMMENT_DIALOG&&!e?.target?.closest(U.TAGS.VELT_COMMENT_DIALOG)&&!e?.target?.closest(U.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}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(U.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}]),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.getAllCommentAnnotationsSubscription&&this.getAllCommentAnnotationsSubscription.unsubscribe()},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.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(U.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(c=>(c=I({},c),c.virtualScrollData.push({type:"annotation",data:s}),c))})}),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)),Ne(e=>!!e),ce(e=>e?.filter(i=>i?.comments?.length)),ge(e=>this.commentService.getExcludeLocationIdsFromSidebar$().pipe(ce(i=>i?.length&&e?.length?e.filter(r=>r?.location?.id?!i.includes(r.location.id):!0):e))),ge(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.setVersions(),this.setPeople(),this.filterCommentAnnotations(),this.updateAnnotationCountsByFilter(),this.componentConfigSignal().annotations?.length){let i=sessionStorage.getItem(U.SESSION_STORAGE.SNIPPYLY_SELECTED_ANNOTATION_ID);if(i){sessionStorage.removeItem(U.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?.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(U.SESSION_STORAGE.SNIPPYLY_COMMENT_SIDEBAR_FILTERS)||this.setDefaultStatuses();if(e?.people){if(e?.people?.length){let i=[];this.componentConfigSignal().user&&e.people.find(a=>a.userId&&a.userId===this.componentConfigSignal().user?.userId||a.email&&a.email===this.componentConfigSignal().user?.email)&&(i=[{id:this.peopleTypes.assignedToMe,name:this.peopleTypes.assignedToMe},{id:this.peopleTypes.addedByMe,name:this.peopleTypes.addedByMe}]),e.people.forEach(r=>{if(r?.userId||r?.email){let a=this.componentConfigSignal().peopleFilters.find(s=>r.userId&&s?.user?.userId===r.userId||r.email&&s?.user?.email===r.email);a?i.push({id:a?.user?.userSnippylyId,name:a?.user?.name}):i.push({id:r.userId||r.email,name:r.name||r.email||r.userId,userId:r.userId,email:r.email})}}),this.componentConfigSignal.update(r=>(r=T(I({},r),{filters:T(I({},r.filters),{people:i})}),r))}else this.componentConfigSignal.update(i=>(i=T(I({},i),{filters:T(I({},i.filters),{people:[]})}),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=$n(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=$n(e);this.emitOnCommentNavigationButtonClick(r)}if(this.commentService.getSidebarUrlNavigation()&&i)if(e?.pageInfo?.url&&e.pageInfo?.url!==window.location.href){sessionStorage.setItem(U.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(U.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(`${U.TAGS.VELT_COMMENT_TEXT}[${U.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 c=a?.location?.locationName||a?.documentParams?.locationName||this.getDisplayNameFromPageInfo(a?.pageInfo)||"",p=a?.location?.id||c;e.has(s)||(i[p]||(i[p]={locationIds:[],displayName:c,id:p}),e.set(s,p),i[p].locationIds.push(s))}),this.componentConfigSignal.update(a=>{let s=this.location?.locationId,c;if(s){let p=e.get(s);p&&(c=i[p].displayName)}else i.other&&(c="Others");return T(I({},a),{pages:i,currentPage:c})}),this.updateLocationInStorage(),this.componentConfigSignal().annotations?.length&&!sessionStorage.getItem(U.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)}}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=[];i.push({id:this.peopleTypes.assignedToMe,name:this.peopleTypes.assignedToMe}),r.push({id:this.peopleTypes.taggedMe,name:this.peopleTypes.taggedMe}),e.push({id:this.peopleTypes.addedByMe,name:this.peopleTypes.addedByMe}),this.componentConfigSignal().annotations&&this.componentConfigSignal.update(a=>(a=I({},a),a.annotations.forEach(s=>{s?.from?.userSnippylyId&&a.user?.userSnippylyId!==s?.from?.userSnippylyId&&!e.find(c=>c.id===s?.from?.userSnippylyId)&&e.push({id:s?.from?.userSnippylyId,name:`${s?.from?.name||s?.from?.email}`,user:s?.from}),s?.assignedTo?.userSnippylyId&&a.user?.userSnippylyId!==s?.assignedTo?.userSnippylyId&&!i.find(c=>c.id===s?.assignedTo?.userSnippylyId)&&i.push({id:s?.assignedTo?.userSnippylyId,name:`${s?.assignedTo?.name||s?.assignedTo?.email}`,user:s?.assignedTo}),s?.comments?.forEach(c=>{c?.taggedUserContacts?.forEach(p=>{p?.contact?.userSnippylyId&&a.user?.userSnippylyId!==p?.contact?.userSnippylyId&&!r.find(h=>h.id===p?.contact?.userSnippylyId)&&r.push({id:p?.contact?.userSnippylyId,name:`${p?.contact?.name||p?.contact?.email}`,user:p?.contact})})})}),a)),this.componentConfigSignal().filters?.people?.length&&this.componentConfigSignal.update(a=>(a=I({},a),a.filters.people.forEach(s=>{e.find(c=>c.id===s?.id)||s?.id!=="other"&&e.push(s)}),a.filters.assigned.forEach(s=>{i.find(c=>c.id===s?.id)||s?.id!=="other"&&i.push(s)}),a.filters.tagged.forEach(s=>{r.find(c=>c.id===s?.id)||s?.id!=="other"&&r.push(s)}),a)),this.componentConfigSignal.update(a=>(a=T(I({},a),{peopleFilters:e,assignedFilters:i,taggedFilters:r}),a)),this.componentConfigSignal().annotations?.length&&(sessionStorage.getItem(U.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(c=>(c=T(I({},c),{filters:T(I({},c.filters),{statuses:[],statusIds:[]})}),c)),this.resolvedCommentsOnDom=!0;else{let c=this.componentConfigSignal().filters?.statuses||[];c.find(p=>p.id===a.id)?this.componentConfigSignal.update(p=>(p=I({},p),p.filters.statuses=c.filter(h=>h.id!==a.id),p)):this.componentConfigSignal.update(p=>(p=I({},p),p.filters.statuses=[...c,a],p)),this.componentConfigSignal.update(p=>(p=T(I({},p),{filters:T(I({},p.filters),{statusIds:p.filters.statuses.map(h=>h?.id)})}),p))}break;case"pages":let s=this.componentConfigSignal().filters.pages||[];if(i)this.componentConfigSignal.update(c=>(c=T(I({},c),{filters:T(I({},c.filters),{pages:[]})}),c));else{let c=a?.id||a?.displayName;s.find(p=>p?.id===c||p?.displayName===c)?this.componentConfigSignal.update(p=>(p=I({},p),p.filters.pages=s.filter(h=>h?.id!==c&&h?.displayName!==c),p)):this.componentConfigSignal().filterConfig?.location?.multiSelection?this.componentConfigSignal.update(p=>(p=I({},p),p.filters.pages=[...s,a],p)):this.componentConfigSignal.update(p=>(p=I({},p),p.filters.pages=[a],p))}this.sortPageFilters(),this.updatePageSelectedState();break;case"people":this.componentConfigSignal.update(c=>{c=I({},c);let p=c.filters.people||[];return i?c.filters.people=[]:p.find(h=>h?.id===a?.id)?c.filters.people=p.filter(h=>h?.id!==a?.id):c.filterConfig?.people?.multiSelection?c.filters.people=[...p,a]:c.filters.people=[a],c}),this.updatePeopleSelectedState();break;case"tagged":this.componentConfigSignal.update(c=>{c=I({},c);let p=c.filters.tagged||[];return i?c.filters.tagged=[]:p.find(h=>h?.id===a?.id)?c.filters.tagged=p.filter(h=>h?.id!==a?.id):c.filterConfig?.tagged?.multiSelection?c.filters.tagged=[...p,a]:c.filters.tagged=[a],c}),this.updatePeopleSelectedState();break;case"assigned":this.componentConfigSignal.update(c=>{c=I({},c);let p=c.filters.assigned||[];return i?c.filters.assigned=[]:p.find(h=>h?.id===a?.id)?c.filters.assigned=p.filter(h=>h?.id!==a?.id):c.filterConfig?.assigned?.multiSelection?c.filters.assigned=[...p,a]:c.filters.assigned=[a],c}),this.updatePeopleSelectedState();break;case"categories":this.componentConfigSignal.update(c=>{c=I({},c);let p=c.filters.categories||[];return i?c.filters.categories=[]:p.find(h=>h.id===a.id)?c.filters.categories=p.filter(h=>h!==a):c.filterConfig?.category?.multiSelection?c.filters.categories=[...p,a]:c.filters.categories=[a],c.filters.categoryIds=c.filters.categories?.map(h=>h.id),c});break;case"priorities":this.componentConfigSignal.update(c=>{c=I({},c);let p=c.filters.priorities||[];return i?c.filters.priorities=[]:p.find(h=>h.id===a.id)?c.filters.priorities=p.filter(h=>h.id!==a.id):c.filterConfig?.priority?.multiSelection?c.filters.priorities=[...p,a]:c.filters.priorities=[a],c.filters.priorityIds=c.filters.priorities?.map(h=>h.id),c});break;case"accessModes":this.componentConfigSignal.update(c=>{c=I({},c);let p=c.filters.accessModes||[];return i?c.filters.accessModes=[]:p.find(h=>h===a.id)?c.filters.accessModes=p.filter(h=>h!==a.id):c.filterConfig?.commentType?.multiSelection?c.filters.accessModes=[...p,a.id]:c.filters.accessModes=[a.id],c});break;case"versions":this.componentConfigSignal.update(c=>{c=I({},c);let p=c.filters.versions||[];return i?c.filters.versions=[]:p.find(h=>h.id===a.id)?c.filters.versions=p.filter(h=>h.id!==a.id):c.filterConfig?.version?.multiSelection?c.filters.versions=[...p,a]:c.filters.versions=[a],c.filters.versionIds=c.filters.versions?.map(h=>h?.id),c});break;default:this.componentConfigSignal.update(c=>(c=T(I({},c),{filters:T(I({},c.filters),{[r]:a})}),c));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.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)}}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,"people")?.length}),e.taggedFilters?.forEach(i=>{e.commentAnnotationsCountByFilters.tagged[i.id]=this.filterAnnotationsByPeople(i,e.annotations,"tagged")?.length}),e.assignedFilters?.forEach(i=>{e.commentAnnotationsCountByFilters.assigned[i.id]=this.filterAnnotationsByPeople(i,e.annotations,"assigned")?.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();if(e.appliedFiltersCount=0,e.enablePriority&&e.filterConfig?.priority?.enable&&e.filters.priorities?.length){let a=[];e.filters.priorities?.forEach(s=>{a.push(...this.filterAnnotationsByPriority(s,r)?.map(c=>c.annotationId))}),r=r.filter(s=>a.includes(s.annotationId)),e.appliedFiltersCount++}if(e.filterConfig?.location?.enable&&e.filters.pages?.length){let a=[];e.filters.pages?.forEach(s=>{a.push(...this.filterAnnotationsByPage(s,r)?.map(c=>c.annotationId))}),r=r.filter(s=>a.includes(s.annotationId)),e.appliedFiltersCount++}if(e.filterConfig?.people?.enable&&e.filters.people?.length){let a=[];e.filters.people?.forEach(s=>{a.push(...this.filterAnnotationsByPeople(s,r,"people")?.map(c=>c.annotationId))}),r=r.filter(s=>a.includes(s.annotationId)),e.appliedFiltersCount++}if(e.filterConfig?.tagged?.enable&&e.filters.tagged?.length){let a=[];e.filters.tagged?.forEach(s=>{a.push(...this.filterAnnotationsByPeople(s,r,"tagged")?.map(c=>c.annotationId))}),r=r.filter(s=>a.includes(s.annotationId)),e.appliedFiltersCount++}if(e.filterConfig?.assigned?.enable&&e.filters.assigned?.length){let a=[];e.filters.assigned?.forEach(s=>{a.push(...this.filterAnnotationsByPeople(s,r,"assigned")?.map(c=>c.annotationId))}),r=r.filter(s=>a.includes(s.annotationId)),e.appliedFiltersCount++}if(e.enableAutoCategorize&&e.filterConfig?.category?.enable&&e.filters.categories?.length){let a=[];e.filters.categories?.forEach(s=>{a.push(...this.filterAnnotationsByCommentCategory(s,r)?.map(c=>c.annotationId))}),r=r.filter(s=>a.includes(s.annotationId)),e.appliedFiltersCount++}if(e.isUserAdmin&&e.filterConfig?.commentType?.enable&&e.filters.accessModes?.length){let a=[];e.filters.accessModes?.forEach(s=>{a.push(...this.filterAnnotationsByAccessMode(s,r)?.map(c=>c.annotationId))}),r=r.filter(s=>a.includes(s.annotationId)),e.appliedFiltersCount++}if(e.filterConfig?.version?.enable&&e.filters.versions?.length){let a=[];e.filters.versions?.forEach(s=>{a.push(...this.filterAnnotationsByVersion(s,r)?.map(c=>c.annotationId))}),r=r.filter(s=>a.includes(s.annotationId)),e.appliedFiltersCount++}if(e.enableStatus&&e.filters.statuses?.length){let a=[];e.filters.statuses?.forEach(s=>{s.id===this.customFilterService.resolvedStatus.id&&(i=!0),a.push(...this.filterAnnotationsByStatus(s,r)?.map(c=>c.annotationId))}),r=r.filter(s=>a.includes(s.annotationId))}e.filters.input&&(r=this.filterAnnotationsByInput(e.filters.input,r)),e.minimalFilter&&(!i&&e.minimalFilter==="resolved"&&(r=e.annotations.slice()),r=r.filter(a=>{switch(e.minimalFilter){case"all":return!i&&!this.resolvedCommentsOnDom?a.status?.id!==this.customFilterService.resolvedStatus.id:!0;case"read":return!this.componentConfigSignal().unreadCommentsMap?.[a.annotationId]&&a.status?.id!==this.customFilterService.resolvedStatus.id;case"unread":return!!this.componentConfigSignal().unreadCommentsMap?.[a.annotationId]&&a.status?.id!==this.customFilterService.resolvedStatus.id||!!this.componentConfigSignal().selectedAnnotationsMap[a.annotationId];case"resolved":return a.status?.id===this.customFilterService.resolvedStatus.id;default:return!0}})),this.componentConfigSignal.update(a=>(a=T(I(I({},a),e),{filteredCommentPinAnnotations:r}),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(U.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();switch(i.groupBy){case i.groupByOptions.people:let r=i.filters.people?.length?i.filters.people:i.peopleFilters;this.filteredGroupedCommentAnnotationsObj={},r.forEach(E=>{let A=this.filterAnnotationsByPeople(E,this.componentConfigSignal().filteredCommentPinAnnotations,"people");A?.length&&(this.filteredGroupedCommentAnnotationsObj[E.id]={displayName:E.name,annotations:A,isExpanded:e[E.id]?e[E.id]?.isExpanded:!0})}),this.filteredGroupedCommentAnnotations=[],i.peopleFilters.forEach(E=>{this.filteredGroupedCommentAnnotationsObj[E.id]&&this.filteredGroupedCommentAnnotations.push(this.filteredGroupedCommentAnnotationsObj[E.id])});break;case i.groupByOptions.assigned:let a=i.filters.assigned?.length?i.filters.assigned:i.assignedFilters;this.filteredGroupedCommentAnnotationsObj={},a.forEach(E=>{let A=this.filterAnnotationsByPeople(E,this.componentConfigSignal().filteredCommentPinAnnotations,"assigned");A?.length&&(this.filteredGroupedCommentAnnotationsObj[E.id]={displayName:E.name,annotations:A,isExpanded:e[E.id]?e[E.id]?.isExpanded:!0})}),this.filteredGroupedCommentAnnotations=[],i.assignedFilters.forEach(E=>{this.filteredGroupedCommentAnnotationsObj[E.id]&&this.filteredGroupedCommentAnnotations.push(this.filteredGroupedCommentAnnotationsObj[E.id])});break;case i.groupByOptions.tagged:let s=i.filters.tagged?.length?i.filters.tagged:i.taggedFilters;this.filteredGroupedCommentAnnotationsObj={},s.forEach(E=>{let A=this.filterAnnotationsByPeople(E,this.componentConfigSignal().filteredCommentPinAnnotations,"tagged");A?.length&&(this.filteredGroupedCommentAnnotationsObj[E.id]={displayName:E.name,annotations:A,isExpanded:e[E.id]?e[E.id]?.isExpanded:!0})}),this.filteredGroupedCommentAnnotations=[],i.taggedFilters.forEach(E=>{this.filteredGroupedCommentAnnotationsObj[E.id]&&this.filteredGroupedCommentAnnotations.push(this.filteredGroupedCommentAnnotationsObj[E.id])});break;case i.groupByOptions.page:case i.groupByOptions.location:i=this.componentConfigSignal();let c=i.filters.pages?.length?i.filters.pages:Object.values(i.pages||{});c?.sort((E,A)=>E?.displayName===i.currentPage?-1:A?.displayName===i.currentPage?1:0),this.filteredGroupedCommentAnnotationsObj={},c.forEach(E=>{let A=E?.displayName===i?.currentPage;this.locations&&Object.keys(this.locations||{}).forEach(G=>{let X=this.locations[G]?.location;X?.id&&X?.id===E?.id&&(A=!0)});let V=this.filterAnnotationsByPage(E,this.componentConfigSignal().filteredCommentPinAnnotations);if((E.id||E?.displayName)&&V?.length){let G=E.id||E?.displayName||"";this.filteredGroupedCommentAnnotationsObj[G]={displayName:E.displayName,annotations:V,isExpanded:e[G]?e[G]?.isExpanded:!!A}}}),this.filteredGroupedCommentAnnotations=[];let p=i?.filterConfig?.location?.order||[];if(p?.length){let E=A=>{let V=p.indexOf(A?.id);return V===-1?1/0:V};c.sort((A,V)=>{let G=E(A),X=E(V);return G!==X?G-X:c.indexOf(A)-c.indexOf(V)})}c.forEach(E=>{let A=E.id||E?.displayName||"";A&&this.filteredGroupedCommentAnnotationsObj[A]&&this.filteredGroupedCommentAnnotations.push(this.filteredGroupedCommentAnnotationsObj[A])}),this.componentConfigSignal.update(E=>(E=I(I({},E),i),E));break;case i.groupByOptions.priority:let h=i.filters.priorities?.length?i.filters.priorities:i.priorities;this.filteredGroupedCommentAnnotationsObj={},h.forEach(E=>{let A=this.filterAnnotationsByPriority(E,this.componentConfigSignal().filteredCommentPinAnnotations);A?.length&&(this.filteredGroupedCommentAnnotationsObj[E.id]={displayName:E.name,annotations:A,isExpanded:e[E.id]?e[E.id]?.isExpanded:!0})}),this.filteredGroupedCommentAnnotations=[],i.priorities.forEach(E=>{this.filteredGroupedCommentAnnotationsObj[E.id]&&this.filteredGroupedCommentAnnotations.push(this.filteredGroupedCommentAnnotationsObj[E.id])}),this.componentConfigSignal.update(E=>(E=I(I({},E),i),E));break;case i.groupByOptions.category:let _=i.filters.categories?.length?i.filters.categories:Object.values(i.commentCategoryMap||{});this.filteredGroupedCommentAnnotationsObj={},_.forEach(E=>{let A=this.filterAnnotationsByCommentCategory(E,this.componentConfigSignal().filteredCommentPinAnnotations);A?.length&&(this.filteredGroupedCommentAnnotationsObj[E.id]={displayName:E.name,annotations:A,isExpanded:e[E.id]?e[E.id]?.isExpanded:!0})}),this.filteredGroupedCommentAnnotations=[],_.forEach(E=>{this.filteredGroupedCommentAnnotationsObj[E.id]&&this.filteredGroupedCommentAnnotations.push(this.filteredGroupedCommentAnnotationsObj[E.id])}),this.componentConfigSignal.update(E=>(E=I(I({},E),i),E));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,r){try{switch(e.id){case this.peopleTypes.assignedToMe:return i.filter(a=>a?.assignedTo?.userId===this.componentConfigSignal().user?.userId);case this.peopleTypes.taggedMe:return i.filter(a=>{let s=!1;return a.comments.forEach(c=>{c.taggedUserContacts?.forEach(p=>{p?.contact?.userSnippylyId===this.componentConfigSignal().user?.userSnippylyId&&(s=!0)})}),s});case this.peopleTypes.addedByMe:return i.filter(a=>a?.from?.userId===this.componentConfigSignal().user?.userId);case this.peopleTypes.other:return i.filter(a=>!a?.from?.userSnippylyId);default:switch(r){case"people":return e.id?i.filter(a=>a?.from?.userSnippylyId===e?.id||a?.from?.userId===e?.id||a?.from?.email===e?.id):i;case"tagged":return i.filter(a=>a?.comments?.some(s=>s?.taggedUserContacts?.some(c=>c?.contact?.userSnippylyId===e?.id)));case"assigned":return i.filter(a=>a?.assignedTo?.userSnippylyId===e?.id);default:return i}}}catch(a){return this.loggingService.catch("Error in CommentsSidebarComponent filterAnnotationsByPeople: ",a),[]}}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===Yi.PRIVATE?i.filter(r=>r?.iam?.accessMode===Yi.PRIVATE):i.filter(r=>!r?.iam?.accessMode||r?.iam?.accessMode===Yi.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 c=r?.comments[s];if(c?.commentText?.toLowerCase().includes(e.toLowerCase())){a=!0;break}else if(c?.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(U.SESSION_STORAGE.SNIPPYLY_COMMENT_SIDEBAR_FILTERS,i)}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent setFiltersToStorage: ",e)}}setCommentSidebarInstalledInAnalytics(){try{this.analyticsService.setInstalledFeature(Tu.COMMENT_SIDEBAR)}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent setCommentSidebarInstalledInAnalytics: ",e)}}setCommentSidebarEmbedModeInAnalytics(){try{this.componentConfigSignal().embedMode&&this.analyticsService.trackEvent(Z.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(Z.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(Z.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 ko,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 c=new Date(a.data.lastUpdated).getTime();return new Date(s.data.lastUpdated).getTime()-c}else if(e==="unread"){let c=i.unreadCommentsMap?.[a.data.annotationId]||0,p=i.unreadCommentsMap?.[s.data.annotationId]||0;if(c>0&&p===0)return-1;if(c===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:[],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:"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(U.SESSION_STORAGE.VELT_COMMENT_SIDEBAR_CUSTOM_ACTIONS_STATE),sessionStorage.removeItem(U.SESSION_STORAGE.SNIPPYLY_COMMENT_SIDEBAR_FILTERS)}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)}}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(U.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(U.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(c=>c?.name?.toLowerCase().includes(e.toLowerCase()));break;case"assigned":a=r.assignedFilters,!e||e===""?s=a:s=a.filter(c=>c?.name?.toLowerCase().includes(e.toLowerCase()));break;case"tagged":a=r.taggedFilters,!e||e===""?s=a:s=a.filter(c=>c?.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"statuses":a=r.statuses,!e||e===""?s=a:s=a.filter(c=>c.name.toLowerCase().includes(e.toLowerCase()));break;case"priorities":a=r.priorities,!e||e===""?s=a:s=a.filter(c=>c.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(c=>c.name.toLowerCase().includes(e.toLowerCase()));break}return s}catch(r){return this.loggingService.catch("Error in CommentsSidebarComponent filterPeople: ",r),[]}}};o.\u0275fac=function(i){return new(i||o)(u(Qe),u(je),u(Te),u(Fe),u(lt),u(N),u(gn),u(y),u(co),u($o),u(zs),u(Xt),u(Ge),u($i),u(BC),u(Ye))},o.\u0275cmp=M({type:o,selectors:[["app-comments-sidebar"]],viewQuery:function(i,r){if(i&1&&(it(WFt,5),it(qFt,5),it(YFt,7)),i&2){let a;Ze(a=Xe())&&(r.sidebarOverlay=a.first),Ze(a=Xe())&&(r.virtualScrollViewportRef=a.first),Ze(a=Xe())&&(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"],_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,qe],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"],[1,"velt-comments-sidebar-container"],["role","dialog",3,"onWrapperClick","componentConfigSignal","template","darkMode"]],template:function(i,r){i&1&&g(0,rLt,4,1,"ng-container",4),i&2&&m("ngIf",r.componentConfigSignal())},dependencies:[K,ft,jn,kn,nn,Rue,me],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 aLt=["*"];function sLt(n,o){if(n&1&&w(0,"snippyly-user-avatar",12),n&2){let t=l(3);m("user",t.cursorUser)}}function lLt(n,o){if(n&1&&w(0,"video",13),n&2){let t=l(3);pe("flip",t.selfCursorPointer),m("srcObject",t.stream)("volume",t.selfCursorPointer?0:1)}}function cLt(n,o){if(n&1&&w(0,"audio",13),n&2){let t=l(3);m("srcObject",t.stream)("volume",t.selfCursorPointer?0:1)}}function mLt(n,o){if(n&1&&(C(0,"div",6)(1,"div",7)(2,"div",8),g(3,sLt,1,1,"snippyly-user-avatar",9)(4,lLt,1,4,"video",10)(5,cLt,1,2,"audio",11),S()()()),n&2){let t=l(2);d(),ot("background",t.cursorUser==null?null:t.cursorUser.color)("border",t.gainVolume&&t.lightenedColor?t.getGainAnimationBorderStyle():""),d(2),m("ngIf",!(t.huddleState!=null&&t.huddleState.videoState)),d(),m("ngIf",t.huddleState==null?null:t.huddleState.videoState),d(),m("ngIf",(t.huddleState==null?null:t.huddleState.audioState)&&!(t.huddleState!=null&&t.huddleState.videoState))}}function dLt(n,o){if(n&1){let t=q();C(0,"div",14)(1,"img",15),z("error",function(){k(t);let i=l(3);return R(i.onImageLoadError())}),S()()}if(n&2){let t=l(3);ot("background-color",t.cursorUser.color),pe("user-presence-text-container-comment-border",t.cursorUser.comment),d(),m("src",t.cursorUser==null?null:t.cursorUser.photoUrl,cn)}}function pLt(n,o){if(n&1&&(C(0,"p",20),te(1),D(2,"translate"),S()),n&2){let t,e=l(5);ot("color",e.getTextColor(e.cursorUser==null?null:e.cursorUser.color)),d(),ve(" ",O(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 gLt(n,o){if(n&1&&(C(0,"p",21),te(1),D(2,"translate"),S()),n&2){let t=l(5);d(),$e(O(2,1,t.cursorUser.comment))}}function uLt(n,o){if(n&1&&(C(0,"div",17),g(1,pLt,3,5,"p",18)(2,gLt,3,3,"p",19),S()),n&2){let t=l(4);ot("background-color",t.cursorUser.color),pe("user-presence-text-container-comment-border",t.cursorUser.comment)("px-3",t.cursorUser.comment)("py-2",t.cursorUser.comment),d(),m("ngIf",t.cursorUser.name||(t.cursorUser==null?null:t.cursorUser.email)),d(),m("ngIf",t.cursorUser.comment)}}function hLt(n,o){n&1&&(C(0,"div",22),w(1,"velt-skeleton-loader-internal",23),S())}function fLt(n,o){if(n&1&&g(0,uLt,3,10,"div",16)(1,hLt,2,0,"ng-template",null,2,xe),n&2){let t=de(2),e=l(3);m("ngIf",e.cursorUser.name||(e.cursorUser==null?null:e.cursorUser.email)||e.cursorUser.comment)("ngIfElse",t)}}function vLt(n,o){if(n&1&&g(0,dLt,2,5,"ng-template",5)(1,fLt,3,2,"ng-template",null,1,xe),n&2){let t=de(2),e=l(2);m("ngIf",e.avatarMode&&!e.showInitial)("ngIfElse",t)}}function CLt(n,o){if(n&1&&(C(0,"div",4),Pt(1),g(2,mLt,6,7,"ng-template",5)(3,vLt,3,2,"ng-template",null,0,xe),S()),n&2){let t=de(4),e=l();ot("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"),pe("no-transition",e.selfCursorPointer),d(2),m("ngIf",e.stream&&((e.huddleState==null?null:e.huddleState.audioState)||(e.huddleState==null?null:e.huddleState.videoState)))("ngIfElse",t)}}var Nue=(()=>{let o=class o{get cursorUser(){return this._cursorUser}set cursorUser(e){this._cursorUser=e,e?.color&&(this.lightenedColor=Qie(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),c=()=>{a.getByteFrequencyData(s);let p=s.reduce((h,_)=>h+_,0)/s.length;this.gainVolume=p,this.gainAnimationId=requestAnimationFrame(c)};this.gainAnimationId=requestAnimationFrame(c)}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 Xie(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?Jie(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(mr),u(y))},o.\u0275cmp=M({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:aLt,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,CLt,5,8,"div",3)),i&2&&m("ngIf",r.cursorUser==null?null:r.cursorUser.position)},dependencies:[K,Un,yo,me],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 yLt(n,o){if(n&1&&(C(0,"snippyly-cursor-pointer",5)(1,"slot",6),oe(),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();m("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 SLt(n,o){if(n&1&&(f(0),g(1,yLt,15,6,"snippyly-cursor-pointer",4),v()),n&2){let t=o.$implicit;d(),m("ngIf",t==null?null:t.position)}}function bLt(n,o){if(n&1&&(C(0,"snippyly-cursor-pointer",19)(1,"slot",6),oe(),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();m("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 ILt(n,o){if(n&1&&g(0,SLt,2,1,"ng-container",2)(1,bLt,15,7,"snippyly-cursor-pointer",3),n&2){let t=l().ngIf,e=l();m("ngForOf",t.cursorUsers)("ngForTrackBy",e.trackById),d(),m("ngIf",t.huddleJoined&&t.huddleOnCursorMode&&t.currentCursorUser)}}function ELt(n,o){if(n&1&&(f(0),g(1,ILt,2,3,"ng-template",1),v()),n&2){let t=o.ngIf;d(),m("ngIf",t.isFirstComponent&&!(t.user!=null&&t.user.isAnonymous))}}var k$=(()=>{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,c){this.analyticsService=e,this.authService=i,this.cursorService=r,this.domService=a,this.huddleService=s,this.loggingService=c,this.avatarMode=!1,this.onCursorUsersChanged=new De,this.onCursorUserChange=new De,this.subscriptions=[],this.constants=U,this.showInitials={},this.componentConfigSignal=be({isFirstComponent:!1,user:void 0,cursorUsers:[],huddleOnCursorModeByAttendeeId:{},attendeesByUserId:{},remoteStreamsByUserId:{},huddleOnCursorMode:!1,huddleJoined:!1,currentCursorUser:new Lv,localStream:void 0}),this.veltId=xn(),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(U.TAGS.SNIPPYLY_CURSOR),i=document.querySelector(U.TAGS.VELT_CURSOR);i?this.veltId===i?.getAttribute(U.ATTRIBUTES.VELT_ID)&&(this.componentConfigSignal.update(r=>(r=T(I({},r),{isFirstComponent:!0}),r)),this.initComponent()):this.veltId===e?.getAttribute(U.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(Ne(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(Ne(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(Re.CURSOR)}catch(e){this.loggingService.catch("Error in CursorComponent setCursorInstalledInAnalytics: ",e)}}};o.\u0275fac=function(i){return new(i||o)(u(Qe),u(je),u(qv),u(Fe),u(mr),u(y))},o.\u0275cmp=M({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,ELt,2,1,"ng-container",0),i&2&&m("ngIf",r.componentConfigSignal())},dependencies:[ht,K,Nue],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=toe();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(c=>{let p={};p.user=this.componentConfigSignal().userContactsBySnippylyId?.[c],p.viewedAt=i[r]?.views?.[c]?.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(Qe),u(je),u(Te),u(ni),u(rP),u(gi),u(Fe),u(yi),u(Os),u(BC),u(y),u($o),u(gn),u(er),u(Xa),u(Ye),u(N),u($i),u(Ge),u(lt),u(bn),u(Xt),u(tc,8))},o.\u0275cmp=M({type:o,selectors:[["snippyly-comment-dialog"]],viewQuery:function(i,r){if(i&1&&(it($Rt,5),it(HRt,5),it(zRt,5),it(Eue,7),it(Eue,5,fi)),i&2){let a;Ze(a=Xe())&&(r.commentsContainer=a.first),Ze(a=Xe())&&(r.newCommentTextArea=a.first),Ze(a=Xe())&&(r.editCommentTextArea=a.first),Ze(a=Xe())&&(r.hostElement=a.first),Ze(a=Xe())&&(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,qe],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),z("click",function(){return k(a),R(r.onClick())})("pointerout",function(c){return k(a),r.onPointerOutCommentDialog(c),R(c.stopPropagation())})("pointerdown",function(c){return k(a),R(c.stopPropagation())})("pointerup",function(c){return k(a),r.onPointerUp(),R(c.stopPropagation())}),S(),g(3,hNt,4,1,"ng-container",4)}if(i&2){let a,s,c,p,h,_,E,A,V,G,X,he,Ie,Pe,Be,We,ke,we,Ee,Me,Ce,ue,Le,Se,Ut,Gt,Dt,It,Nt,Fn,Ji,ii,Oi,dn,ui;pe("sidebar",(a=r.componentConfigSignal())==null?null:a.sidebarMode)("velt-comment-dialog--sidebar-mode",(s=r.componentConfigSignal())==null?null:s.sidebarMode)("dialog",(c=r.componentConfigSignal())==null?null:c.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",(A=r.componentConfigSignal())==null?null:A.bottomSheetMode)("inbox",(V=r.componentConfigSignal())==null?null:V.inboxMode)("velt-comment-dialog--inbox-mode",(G=r.componentConfigSignal())==null?null:G.inboxMode)("readonly",((X=r.componentConfigSignal())==null||X.user==null?null:X.user.isReadOnly)||((X=r.componentConfigSignal())==null||X.user==null?null:X.user.isAnonymous))("velt-comment-dialog--readonly",((he=r.componentConfigSignal())==null||he.user==null?null:he.user.isReadOnly)||((he=r.componentConfigSignal())==null||he.user==null?null:he.user.isAnonymous))("no-comments",!(!((Ie=r.componentConfigSignal())==null||Ie.annotation==null||Ie.annotation.comments==null)&&Ie.annotation.comments.length))("velt-comment-dialog--no-comments",!(!((Pe=r.componentConfigSignal())==null||Pe.annotation==null||Pe.annotation.comments==null)&&Pe.annotation.comments.length))("selected",(Be=r.componentConfigSignal())==null?null:Be.commentDialogSelected)("velt-comment-dialog--selected",(We=r.componentConfigSignal())==null?null:We.commentDialogSelected)("screen-recording",((ke=r.componentConfigSignal())==null||ke.recorderInitConfig==null?null:ke.recorderInitConfig.type)==="screen")("velt-comment-dialog--screen-recording",((we=r.componentConfigSignal())==null||we.recorderInitConfig==null?null:we.recorderInitConfig.type)==="screen")("s-ghost-comment-annotation",(Ee=r.componentConfigSignal())==null?null:Ee.showGhostCommentMessage)("velt-comment-dialog--ghost-comment-annotation",(Me=r.componentConfigSignal())==null?null:Me.showGhostCommentMessage)("velt-comment-dialog--focused-thread-mode",(Ce=r.componentConfigSignal())==null?null:Ce.focusedThreadMode)("inline-comment-mode",((ue=r.componentConfigSignal())==null?null:ue.inlineCommentMode)&&!((ue=r.componentConfigSignal())!=null&&ue.isInsidePdfViewer))("velt-comment-dialog--page-comment",(Le=r.componentConfigSignal())==null||Le.annotation==null?null:Le.annotation.isPageAnnotation)("velt-comment-dialog--inline-comment-mode",((Se=r.componentConfigSignal())==null?null:Se.inlineCommentMode)&&!((Se=r.componentConfigSignal())!=null&&Se.isInsidePdfViewer))("velt-comment-dialog--multi-thread-mode",(Ut=r.componentConfigSignal())==null?null:Ut.multiThread)("velt-comment-dialog--comment-composer-mode",(Gt=r.componentConfigSignal())==null?null:Gt.commentComposerMode)("velt-comment-dialog--page-mode-composer",(Dt=r.componentConfigSignal())==null?null:Dt.pageModeComposer)("private-comment",(It=r.componentConfigSignal())==null?null:It.isPrivateComment)("velt-comment-dialog--private-comment",(Nt=r.componentConfigSignal())==null?null:Nt.isPrivateComment),x("data-velt-annotation-draft",(Fn=r.componentConfigSignal())==null?null:Fn.getAnnotationDraftAttribute)("data-velt-annotation-edit-comment",(Ji=r.componentConfigSignal())!=null&&Ji.editComment?!0:void 0)("data-velt-comment-dialog-comments-count",((ii=r.componentConfigSignal())==null||ii.annotation==null||ii.annotation.comments==null?null:ii.annotation.comments.length)||"0")("data-velt-comment-dialog-comments-status",(Oi=r.componentConfigSignal())==null||Oi.annotation==null||Oi.annotation.status==null?null:Oi.annotation.status.id)("data-velt-comment-dialog-comments-status-type",(dn=r.componentConfigSignal())==null||dn.annotation==null||dn.annotation.status==null?null:dn.annotation.status.type)("data-velt-comment-dialog-comments-priority",(ui=r.componentConfigSignal())==null||ui.annotation==null||ui.annotation.priority==null?null:ui.annotation.priority.id)("data-testid",r.componentId+"-root"),d(3),m("ngIf",r.componentConfigSignal())}},dependencies:[K,ft,S0,v0,b0,f0,y0,Zu,u0,E0,h0,w0,x0,nn,OC],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 LP=(()=>{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 fe(null),this.saveComment=new De,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 ee(this,null,function*(){try{this.annotation.type==="multiThread"?(this.bottomSheetRef=this.bottomSheet.open(es,{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(Ho,{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(nc),u(Fe),u(y),u(N))},o.\u0275cmp=M({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:[qe],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 vNt(n,o){if(n&1){let t=q();C(0,"div",4),z("pointerup",function(i){return k(t),l(2).togglePinSelection(),R(i.stopPropagation())})("click",function(i){return k(t),R(i.stopPropagation())})("cdkDragStarted",function(){k(t);let i=l(2);return R(i.onPinDragStart())}),C(1,"snippyly-comment-pin",5),z("saveComment",function(i){k(t);let r=l(2);return R(r.saveComment(i))})("commentTargetElementClicked",function(){k(t);let i=l(2);return R(i.togglePinSelection())})("togglePinSelection",function(i){k(t);let r=l(2);return R(r.togglePinSelection(i))}),S()()}if(n&2){let t=l().ngIf,e=l();ot("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"),m("id","comment-pin-container-"+(t.commentPinAnnotation==null?null:t.commentPinAnnotation.annotationId)),x("data-testid",e.componentId+"-popover")("role","button")("aria-expanded",t.commentPinSelected),d(),m("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 CNt(n,o){if(n&1){let t=q();C(0,"div",7),z("pointerup",function(i){return k(t),l(3).togglePinSelection(),R(i.stopPropagation())})("touchend",function(i){return k(t),i.stopPropagation(),R(i.preventDefault())})("mousedown",function(i){return k(t),R(i.stopPropagation())})("touchstart",function(i){return k(t),R(i.stopPropagation())})("pointerdown",function(i){return k(t),R(i.stopPropagation())})("click",function(i){return k(t),R(i.stopPropagation())})("cdkDragStarted",function(){k(t);let i=l(3);return R(i.onPinDragStart())})("cdkDragMoved",function(i){k(t);let r=l(3);return R(r.onPinMove(i))})("cdkDragReleased",function(){k(t);let i=l(3);return R(i.onPinRelease())}),C(1,"snippyly-comment-pin",8,1),z("togglePinSelection",function(i){k(t);let r=l(3);return R(r.togglePinSelection(i))})("saveComment",function(i){k(t);let r=l(3);return R(r.saveComment(i))}),S()()}if(n&2){let t,e=de(2),i=l(2).ngIf,r=l();ot("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)+")":""),pe("pin-dragging",i.annotationDragging),m("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(),m("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 _Nt(n,o){if(n&1&&g(0,CNt,3,24,"div",6),n&2){let t=l().ngIf;m("ngIf",t.commentPinAnnotation==null?null:t.commentPinAnnotation.position)}}function yNt(n,o){if(n&1&&(f(0),g(1,vNt,2,14,"div",3)(2,_Nt,1,1,"ng-template",null,0,xe),v()),n&2){let t=o.ngIf,e=de(3);d(),m("ngIf",t.popoverMode)("ngIfElse",e)}}var BP=(()=>{let o=class o{constructor(e,i,r,a,s,c,p){this.analyticsService=e,this.authService=i,this.docService=r,this.domService=a,this.commentService=s,this.loggingService=c,this.elementRef=p,this.multipleCommentPinsSelected=!1,this.avatarErrorImage="",this.objectKeys=Object.keys,this.selectedAnnotationsLocationMap={},this.subscriptions=[],this.componentConfigSignal=be({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-${xn()}`}),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!==Vs.DIFFERENT_DEVICE&&document.querySelector(`[${U.ATTRIBUTES.VELT_ANNOTATION_DRAFT}="${i?.annotationId}"]`)&&this.domService.resetSelectedAnnotationsMap(!0,"comments");else{let a=document.querySelector(`[${U.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);if(a||(a=(this.domService.getDraftCommentAnnotationDialogs()||[])[0]),a){let s=a.getAttribute(U.ATTRIBUTES.VELT_ANNOTATION_DRAFT);if(s){let c=document.getElementById(`comment-pin-container-${s}`)||document.querySelector(`[data-velt-id='${s}']`);c&&(c.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!==Vs.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,c=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=`${c}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,c=this.domService.getBackgroundElement(r,a);c&&this.commentService.isElementInsideAllowedElements(c)&&(this.componentConfigSignal.update(p=>(p=T(I({},p),{targetElement:c}),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 he=this.domService.getTargetElementForCursorPosition(this.pointerMoveEvent,!0,!0,!0,Ie=>{if(this.commentService.getSvgAsImg()){let Pe=Ie?.closest(`[${U.ATTRIBUTES.VELT_COMMENT_CONTAINER}]`);Pe&&Pe instanceof HTMLElement&&(Ie=Pe)}return Ie});he&&(r=he)}let a=this.domService.getElementFromXPath(r?.xpath),s=this.componentConfigSignal().commentPinAnnotation.targetElement?.xpath,c=r?.xpath,p=s===c;if(!a)return;let h=this.componentConfigSignal().dragPosition,_=a.getBoundingClientRect(),E=50,A=50;if(h){let he=h.left-_.left,Ie=h.top-_.top;E=he/_.width*100,A=Ie/_.height*100,E=Math.max(0,Math.min(100,E)),A=Math.max(0,Math.min(100,A))}let V=I({},this.componentConfigSignal().commentPinAnnotation);V.targetElement=I({},r),V.targetElement.leftPercentage=E,V.targetElement.topPercentage=A,this.commentService.calculateCommentAnnotationPosition(V),this.componentConfigSignal.update(he=>(he=T(I({},he),{commentPinAnnotation:V,targetElement:a}),he));let G=this.domService.isElementInsideAdditionalLocationContainer(i)||this.domService.isElementInsideAdditionalLocationContainer(a),X=this.docService.getAdditionalDocumentIdFromElement(a)||this.docService.getDocumentPaths()?.clientDocumentId;if(!this.componentConfigSignal().commentPinAnnotation?.metadata?.clientDocumentId||this.componentConfigSignal().commentPinAnnotation?.metadata?.clientDocumentId==X?(this.componentConfigSignal.update(he=>(he=T(I({},he),{commentPinAnnotation:T(I({},he.commentPinAnnotation),{targetElement:r})}),he)),this.commentService.updateComment(this.componentConfigSignal().commentPinAnnotation,G)):this.componentConfigSignal.update(he=>(he=T(I({},he),{targetElement:i}),he)),p){let he=this.componentConfigSignal().transformContext,Ie=this.componentConfigSignal().elementInTransformedContainer,Pe=he&&this.isElementInsideTransformContainer(a,he.containerSelector);this.componentConfigSignal.update(We=>(We=T(I({},We),{elementInTransformedContainer:Pe}),We));let Be=e.getBoundingClientRect();if(!Ie&&Pe){e.style.transition="none";let We=Be.top,ke=Be.left;this.parentElement.appendChild(e),e.style.position="fixed",e.style.top=`${We}px`,e.style.left=`${ke}px`,e.offsetWidth,requestAnimationFrame(()=>{e.style.position="absolute",Pe&&V.position.transformContext?(e.style.top=`${V.position.top}px`,e.style.left=`${V.position.left}px`,V.position.transformContext.scale!==1&&(e.style.transform=`scale(${1/V.position.transformContext.scale})`)):(e.style.top=`${V.position.top}px`,e.style.left=`${V.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,Pe&&V.position.transformContext?(e.style.top=`${V.position.top}px`,e.style.left=`${V.position.left}px`):(e.style.top=`${V.position.top}px`,e.style.left=`${V.position.left}px`);e.offsetWidth,this.componentConfigSignal.update(We=>(We=T(I({},We),{annotationDragging:!1,dragPosition:null}),We))}this.analyticsService.trackEvent(Z.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(Qe),u(je),u(lt),u(Fe),u(Te),u(y),u(N))},o.\u0275cmp=M({type:o,selectors:[["snippyly-comment-pin-portal"]],hostVars:2,hostBindings:function(i,r){i&2&&(_a("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,yNt,4,2,"ng-container",2),i&2&&m("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 VP=(()=>{let o=class o{constructor(e,i,r,a,s,c){this.commentService=e,this.domService=i,this.componentFactoryResolver=r,this.injector=a,this.appRef=s,this.loggingService=c,this.commentsPinById={},this.commentPinTemplate$=new fe(null),this.customPinEvents$=new et}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,c=r.pinHostElement;if(document.body.contains(s)&&document.body.contains(c))a&&(a.instance.setCommentPinAnnotation(e),this.updateElementOffset(e));else{let p=r.pinHostDomPortalOutlet;p&&(this.removeCommentPinHostAttributes(e.annotationId,r.pinHostElement),this.removeCommentDisabledAttribute(c),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 No(BP),c=new Fo(a,this.componentFactoryResolver,this.appRef,this.injector),p=c.attach(s);p.instance.setCommentPinAnnotation(e),p.instance.setTargetElement(r);let h=r?.getAttribute(U.ATTRIBUTES.VELT_SOURCE_ID);h&&p.instance.setSourceId(h),this.commentsPinById[e.annotationId].push({pinHostDomPortalOutlet:c,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(U.ATTRIBUTES.VELT_COMMENT_PIN_HOST);if(r){let a=r.split(",");a.includes(e)||(a.push(e),i.setAttribute(U.ATTRIBUTES.VELT_COMMENT_PIN_HOST,a.join(",")))}else i.setAttribute(U.ATTRIBUTES.VELT_COMMENT_PIN_HOST,e);window.getComputedStyle(i).position==="static"&&(rm(i)||i.setAttribute(U.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(U.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(U.ATTRIBUTES.VELT_COMMENT_PIN_HOST,a.join(",")):i.removeAttribute(U.ATTRIBUTES.VELT_COMMENT_PIN_HOST))}i?.getAttribute(U.ATTRIBUTES.VELT_COMMENT_PIN_HOST)||i.removeAttribute(U.ATTRIBUTES.VELT_COMMENT_PIN_HOST_STATIC)}catch(r){this.loggingService.catch("Error in CommentPinPortalService removeCommentPinHostAttributes: ",r)}}setCommentDisabledAttribute(e){try{this.commentService.getPopoverMode()&&e.setAttribute(U.ATTRIBUTES.VELT_COMMENT_DISABLED,"auto")}catch(i){this.loggingService.catch("Error in CommentPinPortalService setCommentDisabledAttribute: ",i)}}removeCommentDisabledAttribute(e){try{e?.getAttribute(U.ATTRIBUTES.VELT_COMMENT_DISABLED)==="auto"&&e.removeAttribute(U.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,c=this.domService.getElementOffset(a,s);r.instance.setOffsetLeft(c.offsetLeft),r.instance.setOffsetTop(c.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(Te),J(Fe),J(Io),J(Et),J(mi),J(y))},o.\u0275prov=Ae({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:c,suffix:p,setIfCondition:h,componentElementRef:_,replaceTemplate:E=!0}){try{if(p&&(s+=`--${p}`),c&&(s+=`---${c}`),s){let A=this.wireframeService.getConditionElement(s);if(!A&&e&&(A=e),A){let V=A?.getAttribute("velt-if");V&&h&&h(V),Array.from(A.attributes).forEach(G=>{_?.nativeElement.setAttribute(G.name,G.value)}),i?.componentConfigSignal?this.dynamicDataService.applyConditionalClasses(_?.nativeElement,i):this.dynamicDataService.applyConditionalClasses(_?.nativeElement)}}if(s&&!e){let A=this.wireframeService.getWireframe(s);if(A){let V=document.createElement(A.tagName);V.innerHTML=A.innerHTML,this.template=V}}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(A){this.loggingService.warn("Error in DynamicTemplateDirective veltDynamicTemplate: ",A)}}constructor(e,i,r,a,s,c,p,h){this.elementRef=e,this.templateRef=i,this.viewContainer=r,this.dynamicComponentService=a,this.loggingService=s,this.domService=c,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,c){return c.split(".").reduce((p,h)=>p&&p[h],s)}r.forEach(s=>{let c=s.getAttribute("data-velt");if(c&&i){let p=a(i,c);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 c=r.children[s],p=this.dynamicComponentService.processAndReplaceVeltComponents(c,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(N),u(fo),u(fi),u(BC),u(y),u(Fe),u(Ge),u(b))},o.\u0275dir=Bt({type:o,selectors:[["","veltDynamicTemplate",""]],inputs:{veltDynamicTemplate:"veltDynamicTemplate"},standalone:!1});let n=o;return n})();function SNt(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 bNt(n,o){if(n&1&&(f(0),C(1,"div",1)(2,"div",2),oe(),C(3,"svg",3),D(4,"translate"),w(5,"path",4),S(),g(6,SNt,1,2,"div",5),S(),ct(),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",O(4,11,"Comment icon"))("focusable","false"),d(3),m("ngIf",t==null?null:t.unreadAnnotationCount),d(),x("data-testid",e.componentId+"-count")("aria-hidden","true"),d(),$e(t==null?null:t.count)}}var Tue=(()=>{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=be({unreadCommentsMap:null,count:0}),this.subscription=[],this.componentId="velt-comment-pin-bubble";try{this.subscription.push(this.commentService.getUnreadCommentsMap$().subscribe(c=>{this.componentConfigSignal.update(p=>(p=I({},p),p.unreadCommentsMap=c,p))}))}catch(c){this.catchError("Error in CommentPinBubbleComponent constructor: ",c)}}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(Te),u(y),u($o),u(Ye),u(N))},o.\u0275cmp=M({type:o,selectors:[["velt-comment-pin-bubble-internal"]],inputs:{annotation:"annotation"},standalone:!1,features:[B,qe],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,bNt,9,13,"ng-container",0),i&2&&m("ngIf",r.componentConfigSignal())},dependencies:[K,me],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 ENt=["commentDialogOverlay"],xNt=["commentPinBubbleOverlay"],TNt=["*"],wNt=()=>["snippyly-overlay-panel","velt-comment-pin-bubble-overlay-panel"],wue=n=>({trigger:n}),DNt=()=>["snippyly-overlay-panel","velt-comment-dialog-overlay-panel"];function ANt(n,o){n&1&&Ue(0)}function ONt(n,o){if(n&1&&(f(0),g(1,ANt,1,0,"ng-container",13),v()),n&2){l();let t=de(1);l(2);let e=de(9);d(),m("ngTemplateOutlet",e)("ngTemplateOutletContext",P(2,wue,t))}}function MNt(n,o){if(n&1){let t=q();C(0,"div",11,4),D(2,"translate"),z("click",function(i){return k(t),R(i.preventDefault())})("pointerenter",function(i){return k(t),l(3).onBubblePointerOver(i),R(i.stopPropagation())})("pointerleave",function(){k(t);let i=l(3);return R(i.onBubblePointerOut())})("pointerup",function(){k(t);let i=l(3);return R(i.onPointerUpOnBubble())}),C(3,"velt-comment-pin-bubble-internal",12),z("afterViewInit",function(){k(t);let i=l(3);return R(i.onBubbleAfterViewInit())})("onDestroy",function(){k(t);let i=l(3);return R(i.onBubbleOnDestroy())}),S()(),g(4,ONt,2,4,"ng-container",6)}if(n&2){let t=l(2).ngIf;x("role","button")("aria-expanded",t.commentBubbleHover)("aria-label",O(2,5,"Comment bubble")),d(3),m("annotation",t.annotation),d(),m("ngIf",t.isBubbleInitialized)}}function PNt(n,o){if(n&1){let t=q();f(0),g(1,MNt,5,7,"ng-template",10,3,xe),z("positionChange",function(i){k(t);let r=l(2);return R(r.onCommentPinBubblePositionChange(i))}),v()}if(n&2){let t=l().ngIf,e=de(2);d(),m("cdkConnectedOverlayOrigin",e)("cdkConnectedOverlayOpen",!t.annotationDragging&&!!(t!=null&&t.user)&&(t.bubbleOnPinHover&&t.commentPinHover||t.commentBubbleHover||t.commentPinSelected))("cdkConnectedOverlayPanelClass",kt(10,wNt))("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 kNt(n,o){n&1&&Ue(0)}function RNt(n,o){if(n&1&&g(0,kNt,1,0,"ng-container",13),n&2){l();let t=de(2),e=de(9);m("ngTemplateOutlet",e)("ngTemplateOutletContext",P(2,wue,t))}}function NNt(n,o){if(n&1){let t=q();f(0),C(1,"velt-multi-thread-comment-dialog-internal",14),D(2,"translate"),z("saveComment",function(i){k(t);let r=l(4);return R(r.saveComment.emit(i))})("updateOverlayPosition",function(){k(t);let i=l(4);return R(i.updateOverlayPosition())})("pointerOutFromCommentDialog",function(i){k(t);let r=l(4);return R(r.onPointerOutFromCommentDialog(i))})("pointerUp",function(i){k(t);let r=l(4);return R(r.onPointerUpOnDialog(i))}),S(),v()}if(n&2){let t=l(3).ngIf;d(),m("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",O(2,8,"Multi-thread comment dialog"))}}function FNt(n,o){if(n&1){let t=q();C(0,"snippyly-comment-dialog",15),D(1,"translate"),z("saveComment",function(i){k(t);let r=l(4);return R(r.saveComment.emit(i))})("updateOverlayPosition",function(){k(t);let i=l(4);return R(i.updateOverlayPosition())})("pointerOutFromCommentDialog",function(i){k(t);let r=l(4);return R(r.onPointerOutFromCommentDialog(i))})("pointerUp",function(){k(t);let i=l(4);return R(i.onPointerUpOnDialog())}),S()}if(n&2){let t=l(3).ngIf;m("annotation",t.annotation)("user",t.user)("commentPinSelected",t.commentPinSelected)("containerComponentId",t.containerComponentId)("commentPinType",t.commentPinType),x("role","dialog")("aria-label",O(1,7,"Comment dialog"))}}function LNt(n,o){if(n&1&&g(0,NNt,3,10,"ng-container",8)(1,FNt,2,9,"ng-template",null,2,xe),n&2){let t=de(2),e=l(2).ngIf;m("ngIf",(e==null||e.annotation==null?null:e.annotation.type)==="multiThread")("ngIfElse",t)}}function BNt(n,o){if(n&1){let t=q();g(0,LNt,3,2,"ng-template",10,5,xe),z("positionChange",function(i){k(t);let r=l(2);return R(r.onCommentDialogPositionChange(i))})}if(n&2){let t=o.trigger,e=l().ngIf;m("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",kt(10,DNt))("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 VNt(n,o){if(n&1){let t=q();C(0,"snippyly-comment-bottom-sheet",16),D(1,"translate"),z("saveComment",function(i){k(t);let r=l(2);return R(r.saveComment.emit(i))}),S()}if(n&2){let t=l().ngIf;m("annotation",t.annotation)("user",t.user),x("role","dialog")("aria-label",O(1,4,"Comment bottom sheet"))}}function UNt(n,o){if(n&1){let t=q();f(0),C(1,"div",7,0),D(3,"translate"),z("click",function(i){return k(t),R(i.preventDefault())})("pointerenter",function(i){return k(t),l().onPointerOver(i),R(i.stopPropagation())})("pointerleave",function(){k(t);let i=l();return R(i.onPointerOut())}),Pt(4),S(),g(5,PNt,3,11,"ng-container",8)(6,RNt,1,4,"ng-template",null,1,xe)(8,BNt,2,11,"ng-template",null,2,xe)(10,VNt,2,6,"snippyly-comment-bottom-sheet",9),v()}if(n&2){let t=o.ngIf,e=de(7),i=l();d(),x("data-testid",i.componentId+"-trigger")("role","button")("aria-expanded",t.commentPinSelected)("aria-haspopup","dialog")("aria-label",O(3,8,"Comment pin")),d(4),m("ngIf",t.bubbleOnPin&&!t.commentBubbleAvailable&&!t.dialogOpenedInSidebar)("ngIfElse",e),d(5),m("ngIf",(t==null?null:t.user)&&t.mobileMode&&t.isPhone&&!t.sidebarVisible&&!t.dialogOpenedInSidebar&&!t.inboxMode&&!t.streamMode&&t.floatingCommentsEnabled&&t.commentPinSelected)}}var VC=(()=>{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 De,this.togglePinSelection=new De,this.commentTargetElementClicked=new De,this.isDialogOnHoverEnabled=!1,this.isDialogOnTargetElementClickEnabled=!1,this.previouslySelectedAnnotations={},this.eventListenersSubscriptions=[],this.customScrollableParentEventsListenersSubscriptions=[],this.componentConfigSignal=be({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(Ei.XSmall).subscribe(c=>{c.matches?this.componentConfigSignal.update(p=>(p=T(I({},p),{isPhone:!0}),p)):this.componentConfigSignal.update(p=>(p=T(I({},p),{isPhone:!1}),p))},c=>{this.catchError("Error in CommentDialogPortalComponent breakpointObserver subscription: ",c)})),this.subscriptions.push(this.commentService.getSidebarVisibility$().subscribe(c=>{this.componentConfigSignal.update(p=>(p=T(I({},p),{sidebarVisible:c}),p))},c=>{this.catchError("Error in CommentDialogPortalComponent getSidebarVisibility$ subscription: ",c)})),this.subscriptions.push(this.commentService.getMobileMode$().subscribe(c=>{this.componentConfigSignal.update(p=>(p=T(I({},p),{mobileMode:c}),p))},c=>{this.catchError("Error in CommentDialogPortalComponent getMobileMode$ subscription: ",c)})),this.subscriptions.push(this.commentService.getShowCommentIndex().subscribe(c=>{this.componentConfigSignal.update(p=>(p=T(I({},p),{showCommentIndex:c}),p))},c=>{this.catchError("Error in CommentDialogPortalComponent getShowCommentIndex subscription: ",c)})),this.subscriptions.push(this.commentService.getStreamMode$().subscribe(c=>{this.componentConfigSignal.update(p=>(p=T(I({},p),{streamMode:c}),p))},c=>{this.catchError("Error in CommentDialogPortalComponent getStreamMode$ subscription: ",c)})),this.subscriptions.push(this.commentService.getInboxMode$().subscribe(c=>{this.componentConfigSignal.update(p=>(p=T(I({},p),{inboxMode:c}),p))},c=>{this.catchError("Error in CommentDialogPortalComponent getInboxMode subscription: ",c)})),this.subscriptions.push(this.domService.getDialogOpenedInSidebar().subscribe(c=>{this.componentConfigSignal.update(p=>(p=T(I({},p),{dialogOpenedInSidebar:c}),p))},c=>{this.catchError("Error in CommentDialogPortalComponent getDialogOpenedInSidebar subscription: ",c)})),this.subscriptions.push(this.commentService.getPopoverMode$().subscribe(c=>{this.componentConfigSignal.update(p=>(p=T(I({},p),{popoverMode:c}),p)),this.componentConfigSignal().popoverMode?this.componentConfigSignal.update(p=>(p=T(I({},p),{positions:U.OVERLAY_POSITIONS_FOR_POPOVER_MODE.map(h=>new Ri({originX:h.originX,originY:h.originY},{overlayX:h.overlayX,overlayY:h.overlayY}))}),p)):this.componentConfigSignal.update(p=>(p=T(I({},p),{positions:U.OVERLAY_POSITIONS.map(h=>new Ri({originX:h.originX,originY:h.originY},{overlayX:h.overlayX,overlayY:h.overlayY}))}),p)),this.addEventListeners()},c=>{this.catchError("Error in CommentDialogPortalComponent getPopoverMode subscription: ",c)})),this.subscriptions.push(this.commentService.showFloatingComments$().subscribe(c=>{this.componentConfigSignal.update(p=>(p=T(I({},p),{floatingCommentsEnabled:c}),p))},c=>{this.catchError("Error in CommentDialogPortalComponent showFloatingComments$ subscription: ",c)})),this.subscriptions.push(this.commentService.getEnableDialogOnHover$().subscribe(c=>{this.isDialogOnHoverEnabled=c,this.componentConfigSignal.update(p=>(p=T(I({},p),{dialogOnHover:c}),p)),this.addEventListeners()},c=>{this.catchError("Error in CommentDialogPortalComponent getEnableDialogOnHover subscription: ",c)})),this.subscriptions.push(this.commentService.getEnableDialogOnTargetElementClick$().subscribe(c=>{this.isDialogOnTargetElementClickEnabled=c,this.addEventListeners()},c=>{this.catchError("Error in CommentDialogPortalComponent getEnableDialogOnTargetElementClick subscription: ",c)})),this.subscriptions.push(this.commentService.getBubbleCommentAnnotationIds$().subscribe(c=>{if(c.includes(this.componentConfigSignal().annotation?.annotationId)){this.commentBubbleElement=this.commentService.getCommentBubbleElement(this.componentConfigSignal().annotation);let p=this.commentBubbleElement?.getAttribute(U.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)))},c=>{this.catchError("Error in CommentDialogPortalComponent getBubbleCommentAnnotationIds$ subscription: ",c)})),this.subscriptions.push(this.domService.getSelectedAnnotationsMap$().pipe(Vi()).subscribe(([c,p])=>{this.previouslySelectedAnnotations=c||{},p&&!p[this.componentConfigSignal().annotation?.annotationId]&&this.componentConfigSignal().commentPinHover&&this.setCommentPinHover(!1)},c=>{this.catchError("Error in CommentDialogPortalComponent getSelectedAnnotationsMap$ subscription: ",c)}))}catch(c){this.catchError("Error in CommentDialogPortalComponent constructor: ",c)}}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(yp(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(oi(this.targetElement,"pointerover").subscribe(e=>{this.onPointerOver(e),e.stopPropagation()},e=>{this.catchError("Error in CommentDialogPortalComponent addEventListeners pointerover subscription: ",e)})),this.eventListenersSubscriptions.push(oi(this.targetElement,"pointerout").subscribe(e=>{!this.targetElement?.contains(e?.relatedTarget)&&!e?.relatedTarget?.closest(U.TAGS.SNIPPYLY_COMMENT_DIALOG)&&this.onPointerOut()},e=>{this.catchError("Error in CommentDialogPortalComponent addEventListeners pointerout subscription: ",e)}))),this.eventListenersSubscriptions.push(oi(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(U.ATTRIBUTES.VELT_COMMENT_PIN_ACTIVE)||this.targetElement?.setAttribute(U.ATTRIBUTES.VELT_COMMENT_PIN_ACTIVE,"true")):this.targetElement&&this.targetElement?.hasAttribute(U.ATTRIBUTES.VELT_COMMENT_PIN_ACTIVE)&&this.targetElement?.removeAttribute(U.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(oi(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(co),u(Te),u(Fe),u(y),u(N))},o.\u0275cmp=M({type:o,selectors:[["velt-comment-dialog-portal-internal"]],viewQuery:function(i,r){if(i&1&&(it(ENt,5),it(xNt,5)),i&2){let a;Ze(a=Xe())&&(r.commentDialogOverlay=a.first),Ze(a=Xe())&&(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:[qe],ngContentSelectors:TNt,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,UNt,11,10,"ng-container",6)),i&2&&m("ngIf",r.componentConfigSignal())},dependencies:[K,ft,jn,kn,Ho,LP,Zp,Tue,es,me],encapsulation:2,changeDetection:0});let n=o;return n})();var jNt=["pinRef"],$Nt=["commentDialogPortalRef"],HNt=["*"],Oue=n=>({componentConfigSignal:n}),zNt=(n,o)=>({condition:n,data:o}),Aue=()=>["bubble","chart"],GNt=(n,o,t,e,i)=>({template:n,context:o,componentName:"velt-comment-pin-wireframe",variant:t,setIfCondition:e,componentElementRef:i}),WNt=(n,o,t)=>({"velt-comment-pin--status-default":n,"velt-comment-pin--status-ongoing":o,"velt-comment-pin--status-terminal":t});function qNt(n,o){n&1&&Ue(0)}function YNt(n,o){if(n&1&&(C(0,"velt-shadow-dom-internal"),g(1,qNt,1,0,"ng-container",11),S()),n&2){l();let t=de(3),e=l(2);x("data-testid",e.componentId+"-shadow-dom"),d(),m("ngTemplateOutlet",t)}}function KNt(n,o){if(n&1){let t=q();f(0),C(1,"div",14),z("click",function(i){return k(t),R(i.preventDefault())}),Pt(2),S(),v()}n&2&&(d(),x("role","presentation"))}function ZNt(n,o){if(n&1&&(f(0),w(1,"app-comment-pin-triangle",15),v()),n&2){let t=l(5);d(),m("componentConfigSignal",t.componentConfigSignal)("template",t.template)}}function XNt(n,o){n&1&&(oe(),C(0,"svg",20),w(1,"path",21)(2,"path",22),S())}function QNt(n,o){n&1&&(oe(),C(0,"svg",20),w(1,"path",23)(2,"path",24),S())}function JNt(n,o){n&1&&(oe(),C(0,"svg",20),w(1,"path",25)(2,"path",26),S())}function eFt(n,o){n&1&&(oe(),C(0,"svg",20),w(1,"path",27)(2,"path",28),S())}function tFt(n,o){if(n&1&&(f(0)(1,18),g(2,XNt,3,0,"svg",19)(3,QNt,3,0,"svg",19)(4,JNt,3,0,"svg",19)(5,eFt,3,0,"svg",19),v()()),n&2){let t=l(6).ngIf;d(),m("ngSwitch",t.annotation==null||t.annotation.pageInfo==null||t.annotation.pageInfo.deviceInfo==null?null:t.annotation.pageInfo.deviceInfo.deviceType),d(),m("ngSwitchCase","Mobile"),d(),m("ngSwitchCase","Tablet"),d(),m("ngSwitchCase","Desktop"),d(),m("ngSwitchCase","Monitor")}}function nFt(n,o){if(n&1&&w(0,"snippyly-user-avatar",29),n&2){let t=l(6).ngIf;m("user",t.annotation==null?null:t.annotation.from)}}function iFt(n,o){if(n&1&&(f(0),w(1,"app-comment-pin-unread-comment-indicator",30),v()),n&2){let t=l(7);d(),m("componentConfigSignal",t.componentConfigSignal)}}function oFt(n,o){if(n&1&&w(0,"app-comment-pin-index",30)(1,"app-comment-pin-ghost-comment-indicator",30)(2,"app-comment-pin-private-comment-indicator",30),n&2){let t=l(7);m("componentConfigSignal",t.componentConfigSignal),d(),m("componentConfigSignal",t.componentConfigSignal),d(),m("componentConfigSignal",t.componentConfigSignal)}}function rFt(n,o){if(n&1){let t=q();f(0),C(1,"div",17,5),z("click",function(i){return k(t),R(i.preventDefault())}),g(3,tFt,6,5,"ng-container",10)(4,nFt,1,1,"ng-template",null,6,xe)(6,iFt,2,1,"ng-container",10)(7,oFt,3,3,"ng-template",null,7,xe),S(),v()}if(n&2){let t=de(5),e=de(8),i=l(5).ngIf,r=l();d(),ot("--velt-internal-comment-pin-bg-color",(i.annotation==null||i.annotation.status==null?null:i.annotation.status.color)||null),pe("velt-comment-pin--marker-transparent",r.usingCustomCommentPin)("velt-comment-pin--marker-default",!r.usingCustomCommentPin),m("ngClass",He(12,WNt,!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),m("ngIf",i.isDeviceIndicatorOnCommentPinsEnabled&&i.isCommentAddedOnDifferentDeviceType)("ngIfElse",t),d(3),m("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 aFt(n,o){if(n&1){let t=q();C(0,"div",14),z("click",function(i){return k(t),R(i.preventDefault())}),g(1,rFt,9,16,"ng-container",16),S()}if(n&2){let t=l(4).ngIf,e=l();x("role","presentation"),d(),m("veltDynamicTemplate",$(4,GNt,e.template,P(2,Oue,e.componentConfigSignal),t==null?null:t.variant,e.setIfCondition.bind(e),e.elementRef))}}function sFt(n,o){if(n&1&&g(0,ZNt,2,2,"ng-container",10)(1,aFt,2,10,"ng-template",null,4,xe),n&2){let t=de(2),e=l(3).ngIf;m("ngIf",e.popoverMode)("ngIfElse",t)}}function lFt(n,o){if(n&1){let t=q();C(0,"velt-comment-dialog-portal-internal",12,1),z("saveComment",function(i){k(t);let r=l(3);return R(r.saveComment.emit(i))})("togglePinSelection",function(i){k(t);let r=l(3);return R(r.onPinBubblePointerUp(i))})("pointerUp",function(){k(t);let i=l(3);return R(i.onPointerUpOnDialog())}),C(2,"div",13,2),g(4,KNt,3,1,"ng-container",10)(5,sFt,3,2,"ng-template",null,3,xe),S()()}if(n&2){let t=de(6),e=l(2).ngIf,i=l();m("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),ot("--velt-internal-comment-pin-max-width",i.pinMaxWidth),pe("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-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),m("ngIf",e.commentPinType==="bubble"||e.commentPinType==="chart")("ngIfElse",t)}}function cFt(n,o){if(n&1&&(f(0),g(1,YNt,2,2,"velt-shadow-dom-internal",10)(2,lFt,7,26,"ng-template",null,0,xe),v()),n&2){let t=de(3),e=l().ngIf,i=l();d(),m("ngIf",!i.template&&i.pinShadowDOM&&!(kt(2,Aue)!=null&&kt(3,Aue).includes(e.commentPinType)))("ngIfElse",t)}}function mFt(n,o){if(n&1&&(f(0),g(1,cFt,4,4,"ng-container",9),v()),n&2){let t=l();d(),m("veltIf",F(3,zNt,t.conditionSignal(),P(1,Oue,t.componentConfigSignal)))}}var Qp=(()=>{let o=class o extends aP{constructor(e,i,r,a,s,c,p){super(c,p,r),this.commentService=e,this.domService=i,this.loggingService=r,this.commentPinPortalService=a,this.wireframeService=s,this.elementRef=c,this.dynamicDataService=p,this.commentPinSelected=!1,this.annotationDragging=!1,this.commentPinType="pin",this.usingCustomCommentPin=!1,this.multipleCommentPinsSelected=!1,this.avatarErrorImage="",this.saveComment=new De,this.pinShadowDOM=!1,this.subscriptions=[],this.commentTargetElementClicked=new De,this.togglePinSelection=new De,this.commentBubbleAvailable=!1,this.commentPinPosition={top:0,left:0},this.isOutsideViewport=!1,this.pinMaxWidth="",this.previouslySelectedAnnotations={},this.deviceInfo=new Jn,this.COMMENT_PIN_SIZE=40,this.componentConfigSignal=be({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{this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;"),super.ngOnInit(),this.setupA11yAttributes();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}}))}catch(e){this.catchError("Error in CommentsToolComponent OnInit: ",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=p0(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()===U.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(U.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=p0(this.componentConfigSignal().annotation);this.injectAttributeData(r,a)}}this.setUserInitial(),this.componentConfigSignal.update(r=>(r=T(I({},r),{isPrivateComment:this.componentConfigSignal().annotation?.iam?.accessMode===Yi.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(Te),u(Fe),u(y),u(VP),u(Ge),u(N),u(b))},o.\u0275cmp=M({type:o,selectors:[["snippyly-comment-pin"]],viewQuery:function(i,r){if(i&1&&(it(jNt,5),it($Nt,5)),i&2){let a;Ze(a=Xe())&&(r.pinRef=a.first),Ze(a=Xe())&&(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:[j([b]),B,qe],ngContentSelectors:HNt,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"],[3,"componentConfigSignal"]],template:function(i,r){i&1&&(Vt(),g(0,mFt,2,6,"ng-container",8)),i&2&&m("ngIf",r.componentConfigSignal())},dependencies:[Rr,K,ft,ki,Gi,kn,Un,ne,L0,N0,F0,V0,B0,nn,VC,se],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 dFt(n,o){if(n&1){let t=q();f(0),C(1,"velt-multi-thread-comment-dialog-internal",6),z("afterViewInit",function(){k(t);let i=l().last,r=l(2);return R(i?r.calculatePosition():null)})("saveComment",function(i){k(t);let r=l().$implicit,a=l(2);return R(a.saveComment(r==null?null:r.annotation,i))}),S(),v()}if(n&2){let t=l().$implicit,e=l().ngIf,i=l();d(),m("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 pFt(n,o){if(n&1){let t=q();C(0,"snippyly-comment-dialog",7),z("afterViewInit",function(){k(t);let i=l().last,r=l(2);return R(i?r.calculatePosition():null)})("saveComment",function(i){k(t);let r=l().$implicit,a=l(2);return R(a.saveComment(r==null?null:r.annotation,i))}),S()}if(n&2){let t=l().$implicit,e=l().ngIf,i=l();m("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 gFt(n,o){if(n&1){let t=q();f(0),C(1,"div",4),z("click",function(){let i=k(t).$implicit,r=l(2);return R(r.togglePinSelection(i==null?null:i.annotation))}),g(2,dFt,2,5,"ng-container",5)(3,pFt,1,6,"ng-template",null,0,xe),S(),v()}if(n&2){let t=o.$implicit,e=de(4),i=l().ngIf,r=l();d(),ot("top",t==null?null:t.top,"px"),pe("selected",i.selectedAnnotationsMap[t==null||t.annotation==null?null:t.annotation.annotationId]),m("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(),m("ngIf",(t==null||t.annotation==null?null:t.annotation.type)==="multiThread")("ngIfElse",e)}}function uFt(n,o){if(n&1&&(f(0),C(1,"div",2),D(2,"translate"),g(3,gFt,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",O(2,5,"Comments panel")),d(2),m("ngForOf",t.commentPinAnnotationsArray)("ngForTrackBy",e.trackById)}}var Mue=(()=>{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=be({commentPinAnnotationsArray:[],selectedAnnotationsMap:{},user:void 0,inlineCommentMode:!1}),this.veltElement=!0,this.componentId="velt-comments-stream-view",this.subscriptions.push(this.authService.getUser$().subscribe(c=>{this.componentConfigSignal.update(p=>(p=T(I({},p),{user:c}),p))},c=>{this.loggingService.catch("Error in CommentsStreamViewComponent getUser$ subscription: ",c)})),this.subscriptions.push(this.domService.getSelectedAnnotationsMap$().subscribe(c=>{this.componentConfigSignal.update(p=>(p=T(I({},p),{selectedAnnotationsMap:c}),p)),setTimeout(()=>{this.calculatePosition(),Object.keys(this.componentConfigSignal().selectedAnnotationsMap).length===1&&this.goToAnnotation(this.componentConfigSignal().selectedAnnotationsMap[Object.keys(this.componentConfigSignal().selectedAnnotationsMap)[0]])},100)},c=>{this.loggingService.catch("Error in CommentsStreamViewComponent getSelectedAnnotationsMap$ subscription: ",c)})),this.subscriptions.push(this.commentService.getInlineCommentMode$().subscribe(c=>{this.componentConfigSignal.update(p=>(p=T(I({},p),{inlineCommentMode:c}),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=ov(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=vV(a,this.scrollableParentElement)?.top||0,r.isInsidePdfViewer=sv(a,U.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 c=this.elementRef?.nativeElement?.querySelector(`[id="snippyly-comments-on-right-block-${r.annotation.annotationId}"]`);c&&(r.dialogElement=c,r.dialogOffsetTop=vV(c,this.scrollableParentElement)?.top||0)}if(!a)r.top=r.targetOffsetTop;else if(i){let c=s[a-1];if(r.dialogElement){let p=c.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 c=s[a-1];if(c.dialogElement){let p=c.top+c.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=bg(0,Um).pipe(ce(()=>{let r=e.getBoundingClientRect();return{top:r.top,left:r.left}}),Kt((r,a)=>r.top===a.top&&r.left===a.left),Vi());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(je),u(Te),u(Fe),u(N),u(y))},o.\u0275cmp=M({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:[qe],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,uFt,4,7,"ng-container",1),i&2&&m("ngIf",r.componentConfigSignal())},dependencies:[ht,K,Ho,es,me],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 fFt=()=>["snippyly-inbox-panel"];function vFt(n,o){n&1&&Ue(0)}function CFt(n,o){if(n&1&&g(0,vFt,1,0,"ng-container",7),n&2){l();let t=de(6);m("ngTemplateOutlet",t)}}function _Ft(n,o){if(n&1){let t=q();C(0,"velt-multi-thread-comment-dialog-internal",11),D(1,"translate"),z("saveComment",function(i){k(t);let r=l(4);return R(r.saveComment(i))}),S()}if(n&2){let t=l(3).ngIf,e=l();m("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",O(1,8,"Multi-thread comment dialog"))}}function yFt(n,o){if(n&1&&(f(0),g(1,_Ft,2,10,"velt-multi-thread-comment-dialog-internal",10),v()),n&2){let t=l(2).ngIf;d(),m("ngIf",t.commentAnnotation&&t.user)}}function SFt(n,o){if(n&1){let t=q();C(0,"snippyly-comment-dialog",13),D(1,"translate"),z("saveComment",function(i){k(t);let r=l(4);return R(r.saveComment(i))}),S()}if(n&2){let t=l(3).ngIf,e=l();m("annotation",t.commentAnnotation)("user",t.user)("commentPinSelected",!0)("inboxMode",!0),x("data-testid",e.componentId+"-single-dialog")("role","dialog")("aria-label",O(1,7,"Single comment dialog"))}}function bFt(n,o){if(n&1&&g(0,SFt,2,9,"snippyly-comment-dialog",12),n&2){let t=l(2).ngIf;m("ngIf",t.commentAnnotation&&t.user)}}function IFt(n,o){if(n&1&&(C(0,"div",8),D(1,"translate"),g(2,yFt,2,1,"ng-container",9)(3,bFt,1,1,"ng-template",null,3,xe),S()),n&2){let t=de(4),e=l().ngIf,i=l();pe("mobile",e.isPhone)("visible",!!e.commentAnnotation),x("data-testid",i.componentId)("role","region")("aria-label",O(1,10,"Comment inbox container"))("aria-expanded",!!e.commentAnnotation),d(2),m("ngIf",(e==null||e.commentAnnotation==null?null:e.commentAnnotation.type)==="multiThread")("ngIfElse",t)}}function EFt(n,o){if(n&1&&(f(0),w(1,"div",5,0),g(3,CFt,1,1,"ng-template",6,1,xe)(5,IFt,5,12,"ng-template",null,2,xe),v()),n&2){let t=de(2),e=l();d(),x("data-testid",e.componentId+"-trigger")("aria-hidden",!0),d(2),m("cdkConnectedOverlayOrigin",t)("cdkConnectedOverlayOpen",!0)("cdkConnectedOverlayDisableClose",!0)("cdkConnectedOverlayPanelClass",kt(6,fFt))}}var Pue=(()=>{let o=class o extends nt{constructor(e,i,r,a,s,c){super(s,c),this.authService=e,this.breakpointObserver=i,this.commentService=r,this.loggingService=a,this.elementRef=s,this.themeService=c,this.componentConfigSignal=be({isPhone:!1,sidebarVisible:!1}),this.subscriptions=[],this.componentId="velt-comment-inbox";try{this.subscriptions.push(this.breakpointObserver.observe(Ei.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(je),u(co),u(Te),u(y),u(N),u(Ye))},o.\u0275cmp=M({type:o,selectors:[["snippyly-comment-inbox"]],inputs:{commentAnnotation:"commentAnnotation"},standalone:!1,features:[B,qe],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,EFt,7,7,"ng-container",4),i&2&&m("ngIf",r.componentConfigSignal())},dependencies:[K,ft,jn,kn,Ho,es,me],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 TFt(n,o){if(n&1){let t=q();f(0),C(1,"div",3),z("click",function(){let i=k(t).$implicit,r=l(2);return R(r.scrollToAnnotation(i==null?null:i.key))}),C(2,"div",4),te(3),D(4,"translate"),S()(),v()}if(n&2){let t=o.$implicit,e=l().ngIf,i=l();d(),ot("top",t.value.top,"%")("transform","translate(0, -"+t.value.top+"%)"),pe("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(" ",O(4,12,"Go to comments here.")," ")}}function wFt(n,o){if(n&1&&(f(0),C(1,"div",1),D(2,"translate"),g(3,TFt,5,14,"ng-container",2),D(4,"keyvalue"),S(),v()),n&2){let t=o.ngIf,e=l();d(),pe("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",O(2,9,"Comments minimap")),d(2),m("ngForOf",O(4,11,t.commentAnnotationPositionMap))("ngForTrackBy",e.trackByAnnotationId)}}var UP=(()=>{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=be({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 c=i/s*100;return{pixelsFromTop:i,percentageOfTotalHeight:c}}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(Te),u(y),u(N))},o.\u0275cmp=M({type:o,selectors:[["app-comments-minimap"]],inputs:{commentAnnotations:"commentAnnotations",user:"user",targetScrollableElementId:"targetScrollableElementId",position:"position"},standalone:!1,features:[qe],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,wFt,5,13,"ng-container",0),i&2&&m("ngIf",r.componentConfigSignal())},dependencies:[ht,K,Qm,me],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 DFt(n,o){n&1&&Ue(0)}function AFt(n,o){if(n&1&&(C(0,"velt-shadow-dom-internal"),g(1,DFt,1,0,"ng-container",6),S()),n&2){l();let t=de(3);d(),m("ngTemplateOutlet",t)}}function OFt(n,o){if(n&1&&(w(0,"snippyly-comments-stream-view",10),D(1,"translate")),n&2){let t=l(3).ngIf,e=l();m("commentPinAnnotations",t.commentPinAnnotationsForStreamView)("streamViewContainerId",e.streamViewContainerId),x("data-testid",e.componentId+"-stream")("role","complementary")("aria-label",O(1,5,"Comments stream view"))}}function MFt(n,o){if(n&1&&(w(0,"snippyly-comment-inbox",11),D(1,"translate")),n&2){let t=l(3).ngIf,e=l();m("darkMode",t.darkMode)("commentAnnotation",t.selectedCommentAnnotation),x("data-testid",e.componentId+"-inbox")("role","complementary")("aria-label",O(1,5,"Comments inbox"))}}function PFt(n,o){if(n&1&&(w(0,"app-comments-minimap",12),D(1,"translate")),n&2){let t=l(3).ngIf,e=l();m("commentAnnotations",t.commentPinAnnotations)("user",t.user)("position",t.minimapPosition),x("data-testid",e.componentId+"-minimap")("role","complementary")("aria-label",O(1,6,"Comments location overview"))}}function kFt(n,o){if(n&1&&(w(0,"snippyly-comment-adder"),g(1,OFt,2,7,"snippyly-comments-stream-view",7)(2,MFt,2,7,"snippyly-comment-inbox",8)(3,PFt,2,8,"app-comments-minimap",9)),n&2){let t=l(2).ngIf,e=l();x("data-testid",e.componentId+"-adder"),d(),m("ngIf",t.streamMode&&t.commentsOnDom),d(),m("ngIf",t.inboxMode&&t.commentsOnDom),d(),m("ngIf",t.minimapEnabled&&t.commentsOnDom)}}function RFt(n,o){if(n&1&&(f(0),g(1,AFt,2,1,"velt-shadow-dom-internal",5)(2,kFt,4,4,"ng-template",null,0,xe),v()),n&2){let t=de(3),e=l().ngIf;d(),m("ngIf",e.shadowDOM)("ngIfElse",t)}}function NFt(n,o){if(n&1){let t=q();f(0),g(1,RFt,4,2,"ng-container",1),C(2,"div",2)(3,"slot",3),z("slotchange",function(i){k(t);let r=l();return R(r.handleCommentPinSlotChanged(i))}),S()(),w(4,"app-persistent-comment-mode",4),v()}if(n&2){let t=o.ngIf,e=l();d(),m("ngIf",t.isFirstComponent),d(),x("aria-hidden","true")("data-testid",e.componentId+"-slot-container"),d(2),m("componentConfigSignal",e.componentConfigSignal),x("data-testid",e.componentId+"-persistent-mode")}}var P$=(()=>{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 _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,c,p,h,_,E,A,V){this.analyticsService=e,this.authService=i,this.domService=r,this.commentService=a,this.commentPinPortalService=s,this.commentTextPortalService=c,this.customFilterService=p,this.loggingService=h,this.elementRef=_,this.autocompleteService=E,this.contactService=A,this.recorderAnnotationService=V,this.onCommentAdd=new De,this.onSignIn=new De,this.onUpgrade=new De,this.onCustomPinInject=new De,this.onCommentUpdate=new De,this.onCommentAccept=new De,this.onCommentReject=new De,this.onSidebarButtonOnCommentDialogClick=new De,this.onCommentSelectionChange=new De,this.onCopyLink=new De,this.subscriptions=[],this.selectedAnnotationsMap={},this.commentAnnotationFocused=!1,this.enableGhostComments=!1,this.resolvedCommentsOnDom=!1,this.scrollToComment=!1,this.componentConfigSignal=be({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=xn(),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 G=new URL(window.location.href);this.focusCommentAnnotationId=G.searchParams.get(U.URL_PARAMS.COMMENT_ID),this.commentService.setCommentAddedEmitter(this.onCommentAdd)}catch(G){this.loggingService.catch("Error in CommentsContainerComponent constructor: ",G)}}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(U.TAGS.SNIPPYLY_COMMENTS),i=document.querySelector(U.TAGS.VELT_COMMENTS);document.querySelector(`${U.TAGS.VELT_COMMENTS}[${U.ATTRIBUTES.VELT_IS_FIRST_COMPONENT}]`)||(i?this.veltId===i?.getAttribute(U.ATTRIBUTES.VELT_ID)&&(this.componentConfigSignal.update(a=>(a=T(I({},a),{isFirstComponent:!0}),a)),i?.setAttribute(U.ATTRIBUTES.VELT_IS_FIRST_COMPONENT,"true"),this.initComponent()):this.veltId===e?.getAttribute(U.ATTRIBUTES.VELT_ID)&&(this.componentConfigSignal.update(a=>(a=T(I({},a),{isFirstComponent:!0}),a)),e?.setAttribute(U.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(Ne(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(ge(e=>(this.componentConfigSignal.update(i=>(i=T(I({},i),{commentsOnDom:e}),i)),this.componentConfigSignal().commentsOnDom?Dn([this.commentService.getAllCommentAnnotations({detectGhostComments:!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||[]]),ge(i=>this.commentService.getEnableGhostComments$().pipe(ce(r=>(this.enableGhostComments=r,i)))),ge(i=>this.commentService.getCommentsOnDom$().pipe(ce(r=>(this.componentConfigSignal.update(a=>(a=T(I({},a),{commentsOnDom:r}),a)),i)))),ge(i=>this.commentService.getResolvedCommentsOnDom$().pipe(ce(r=>(this.resolvedCommentsOnDom=r,i)))),ge(i=>this.domService.getSelectedAnnotationsMap$().pipe(ce(r=>({filteredAnnotations:i||[],selectedAnnotationsMap:r||{}}))))):re({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 c=!0;return s?.ghostComment?.type===Vs.DIFFERENT_DEVICE&&!s?.ghostComment?.isSameGroup&&(e.selectedAnnotationsMap[s.annotationId]||(c=!1)),s?.ghostComment&&!this.enableGhostComments&&(c=!1),this.resolvedCommentsOnDom||s.status!==void 0&&s.status.type==="terminal"&&(e.selectedAnnotationsMap[s.annotationId]||(c=!1)),c}),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&&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(U.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(U.SESSION_STORAGE.SNIPPYLY_AUTO_SELECT_ANNOTATION_ID,e.annotationId)),i||(i=document.querySelector(`${U.TAGS.VELT_COMMENT_TEXT}[${U.ATTRIBUTES.ANNOTATION_ID}="${e.annotationId}"]`)),i&&this.scrollToComment&&i.scrollIntoView({behavior:"auto",block:"center",inline:"nearest"})},100))}}setCommentInstalledInAnalytics(){try{this.analyticsService.setInstalledFeature(Re.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(Qe),u(je),u(Fe),u(Te),u(VP),u(rP),u($o),u(y),u(N),u(Hs),u(gi),u(Xi))},o.\u0275cmp=M({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"],_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:[qe],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,NFt,5,5,"ng-container",1),i&2&&m("ngIf",r.componentConfigSignal())},dependencies:[K,ft,Vse,Mue,Pue,UP,nn,IC,me],encapsulation:2,changeDetection:0});let n=o;return n})();var FFt=["sidebarRef"],LFt=n=>({componentConfigSignal:n}),BFt=(n,o)=>({condition:n,data:o}),VFt=(n,o)=>({componentConfigSignal:n,sidebarRef:o}),UFt=(n,o)=>({template:n,context:o});function jFt(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=de(1),e=l(3).ngIf,i=l();pe("s-overflow-hidden",e.moreFiltersVisible)("velt-sidebar--more-filters-visible",e.moreFiltersVisible),x("aria-expanded",e.sidebarVisible),d(2),m("componentConfigSignal",i.componentConfigSignal),d(),m("sidebarRef",t)("componentConfigSignal",i.componentConfigSignal),d(),m("componentConfigSignal",i.componentConfigSignal)("sidebarRef",t)}}function $Ft(n,o){if(n&1){let t=q();f(0),C(1,"div",3),D(2,"translate"),z("click",function(i){k(t);let r=l(3);return R(r.onClick(i))}),g(3,jFt,5,10,"div",4),S(),v()}if(n&2){let t=l(2).ngIf,e=l();d(),pe("mobile",t.isPhone)("visible",t.sidebarVisible||t.embedMode||t.floatingMode)("floating",t.floatingMode)("embed",t.embedMode)("page",t.pageMode),m("ngClass",t.position),x("data-testid",e.componentId)("aria-label",O(2,14,"Comments sidebar")),d(2),m("veltDynamicTemplate",F(19,UFt,e.template,F(16,VFt,e.componentConfigSignal,e.sidebarRef)))}}function HFt(n,o){if(n&1&&(f(0),g(1,$Ft,4,22,"ng-container",1),v()),n&2){let t=l().ngIf;d(),m("ngIf",t)}}function zFt(n,o){if(n&1&&(f(0),g(1,HFt,2,1,"ng-container",2),v()),n&2){let t=l();d(),m("veltIf",F(3,BFt,t.conditionSignal(),P(1,LFt,t.componentConfigSignal)))}}var Rue=(()=>{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 De,this.componentId="velt-comments-sidebar-wrapper",super.initializeComponentConfigSignal(new Ke)}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(N),u(Ye),u(y),u(b))},o.\u0275cmp=M({type:o,selectors:[["velt-comments-sidebar-wrapper-internal"]],viewQuery:function(i,r){if(i&1&&it(FFt,7),i&2){let a;Ze(a=Xe())&&(r.sidebarRef=a.first)}},outputs:{onWrapperClick:"onWrapperClick"},standalone:!1,features:[j([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,zFt,2,6,"ng-container",1),i&2&&m("ngIf",r.componentConfigSignal())},dependencies:[Rr,K,ne,Qu,Xu,DC,se,me],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 WFt=["sidebarOverlay"],qFt=["virtualScrollViewportRef"],YFt=["host"],KFt=n=>["snippyly-sidebar-panel",n];function ZFt(n,o){n&1&&Ue(0)}function XFt(n,o){if(n&1&&(C(0,"velt-shadow-dom-internal"),g(1,ZFt,1,0,"ng-container",7),S()),n&2){l(3);let t=de(3);d(),m("ngTemplateOutlet",t)}}function QFt(n,o){if(n&1&&(f(0),g(1,XFt,2,1,"velt-shadow-dom-internal",6),v()),n&2){l(2);let t=de(3),e=l();d(),m("ngIf",!e.template&&e.sidebarShadowDOM)("ngIfElse",t)}}function JFt(n,o){n&1&&Ue(0)}function eLt(n,o){if(n&1&&(C(0,"velt-shadow-dom-internal"),g(1,JFt,1,0,"ng-container",7),S()),n&2){l(4);let t=de(3);d(),m("ngTemplateOutlet",t)}}function tLt(n,o){if(n&1&&(C(0,"div",10),g(1,eLt,2,1,"velt-shadow-dom-internal",6),S()),n&2){let t=l(3).ngIf,e=de(3),i=l();pe("dark",t.darkMode),d(),m("ngIf",!i.template&&i.sidebarShadowDOM)("ngIfElse",e)}}function nLt(n,o){if(n&1&&(w(0,"div",8,2),g(2,tLt,2,4,"ng-template",9,3,xe)),n&2){let t=de(1),e=l(2).ngIf;d(2),m("cdkConnectedOverlayOrigin",t)("cdkConnectedOverlayOpen",!0)("cdkConnectedOverlayDisableClose",!0)("cdkConnectedOverlayPanelClass",P(4,KFt,e.darkMode?"dark":""))}}function iLt(n,o){if(n&1&&g(0,QFt,2,2,"ng-container",6)(1,nLt,4,6,"ng-template",null,1,xe),n&2){let t=de(2),e=l().ngIf;m("ngIf",e.embedMode||e.floatingMode)("ngIfElse",t)}}function oLt(n,o){if(n&1){let t=q();C(0,"velt-comments-sidebar-wrapper-internal",11),D(1,"translate"),z("onWrapperClick",function(i){k(t);let r=l(2);return R(r.onClick(i))}),S()}if(n&2){let t=l().ngIf,e=l();m("componentConfigSignal",e.componentConfigSignal)("template",e.template)("darkMode",t.darkMode),x("data-testid",e.componentId)("aria-label",O(1,6,"Comments sidebar"))("aria-modal",!0)}}function rLt(n,o){if(n&1&&(f(0),g(1,iLt,3,2,"ng-template",5)(2,oLt,2,8,"ng-template",null,0,xe),v()),n&2){let t=o.ngIf;d(),m("ngIf",t.isFirstComponent||t.floatingMode)}}var jP=(()=>{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 _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,c,p,h,_,E,A,V,G,X,he,Ie){super(c,Ie,void 0,r),this.analyticsService=e,this.authService=i,this.commentService=r,this.domService=a,this.docService=s,this.elementRef=c,this.iamService=p,this.loggingService=h,this.breakpointObserver=_,this.customFilterService=E,this.translateService=A,this.cd=V,this.wireframeService=G,this.renderer=X,this.dynamicComponentService=he,this.themeService=Ie,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 De,this.onSidebarOpen=new De,this.onSidebarCommentClick=new De,this.onSidebarCommentClickEvent=new De,this.onCommentClick=new De,this.onSidebarClose=new De,this.onCommentNavigationButtonClick=new De,this.subscriptions=[],this.locations={},this.commentAccessMode=Yi,this.commentReadAnalyticsCalled=!0,this.peopleTypes={all:"All",assignedToMe:"Me",addedByMe:"Me",other:"Other",taggedMe:"Me"},this.pageTypes={all:"All",other:"Other"},this.unsetType={id:"unset",name:"Not set"},this.objectKeys=Object.keys,this.filteredGroupedCommentAnnotationsObj={},this.filteredGroupedCommentAnnotations=[],this.veltId=xn(),this.veltElement=!0,this.defaultFilterConfig={location:{name:"Pages",enable:!0,multiSelection:!0,enableGrouping:!0},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=be({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,annotations:[],filteredCommentPinAnnotations:[],selectedAnnotationsMap:{},commentAnnotationsCountByFilters:{page:{},status:{},people:{},tagged:{},assigned:{},version:{},priority:{},commentCategory:{},accessMode:{}},noCommentsFound:!1,noCommentsFoundForAppliedFilters:!1,pageCommentAnnotation:new ko,commentCategoryMap:U.CommentCategoryMap,virtualScrollData:[],isFirstComponent:!1,searchPlaceholder:this.searchPlaceholder,enableAutoCategorize:!1,filterConfig:JSON.parse(JSON.stringify(this.defaultFilterConfig)),filters:{pages:[],statuses:[],statusIds:[],people:[],assigned:[],tagged:[],versions:[],versionIds:[],priorities:[],priorityIds:[],categories:[],categoryIds:[],accessModes:[],input:null},moreFiltersVisible:!1,groupByOptions:{},groupBy:null,peopleFilters:[{id:this.peopleTypes.addedByMe,name:this.peopleTypes.addedByMe}],assignedFilters:[{id:this.peopleTypes.assignedToMe,name:this.peopleTypes.assignedToMe}],taggedFilters:[{id:this.peopleTypes.taggedMe,name:this.peopleTypes.taggedMe}],enablePriority:!1,enableStatus:!0,appliedFiltersCount:0,priorities:[],statuses:[],accessModes:[{id:Yi.PUBLIC,name:"Public"},{id:Yi.PRIVATE,name:"Private"}],filterOptionLayout:"checkbox",filterCount:!0,sidebarVisible:!1,pages:{},showAllPages:!1,versions:[],groupConfig:JSON.parse(JSON.stringify(this.defaultGroupConfig)),user:null,currentPage: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),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),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(Be=>{this.componentConfigSignal.update(We=>(We=T(I({},We),{darkMode:Be}),We))})),this.loggingService.log("%c[WB] Creating CLASS: CommentsSidebarComponent","color: blue;"),this.componentConfigSignal.update(Be=>(Be=T(I({},Be),{groupBy:Be.groupByOptions.page}),Be.pageCommentAnnotation.isPageAnnotation=!0,Be)),this.updateGroupByOptions(),this.subscriptions.push(this.commentService.getSidebarShadowDOM$().subscribe(Be=>{this.sidebarShadowDOM=Be})),this.subscriptions.push(this.commentService.getFocusedThreadMode$().subscribe(Be=>{this.componentConfigSignal.update(We=>(We=T(I({},We),{focusedThreadMode:Be}),We))})),this.subscriptions.push(this.commentService.getReadOnly$().subscribe(Be=>{this.componentConfigSignal.update(We=>(We=T(I({},We),{readOnly:Be}),We))})),this.subscriptions.push(this.commentService.getQueryParamsComments$().subscribe(Be=>{this.componentConfigSignal.update(We=>(We=T(I({},We),{queryParamsComments:Be}),We)),this.setPages()})),this.subscriptions.push(this.commentService.getUnreadCommentsMap$().subscribe(Be=>{this.componentConfigSignal.update(We=>(We=T(I({},We),{unreadCommentsMap:Be}),We))})),this.subscriptions.push(this.breakpointObserver.observe(Ei.XSmall).subscribe(Be=>{Be.matches?this.componentConfigSignal.update(We=>(We=T(I({},We),{isPhone:!0}),We)):this.componentConfigSignal.update(We=>(We=T(I({},We),{isPhone:!1}),We))},Be=>{this.loggingService.catch("Error in CommentsSidebarComponent breakpointObserver subscription: ",Be)})),this.subscriptions.push(this.customFilterService.customStatusMap$.subscribe(Be=>{this.statusMap=Be,this.componentConfigSignal.update(We=>(We=T(I({},We),{statuses:Object.values(Be)}),We)),this.pruneStaleStatuses()})),this.subscriptions.push(this.customFilterService.customPriorityMap$.subscribe(Be=>{this.priorityMap=Be,this.componentConfigSignal.update(We=>(We=T(I({},We),{priorities:[...Object.values(Be),{id:"unset",name:"Not set",color:"#FFFFFF"}]}),We)),this.pruneStalePriorities()})),this.subscriptions.push(this.customFilterService.customCategoryMap$.subscribe(Be=>{this.componentConfigSignal.update(We=>(We=T(I({},We),{commentCategoryMap:T(I({},Be),{other:{id:"other",name:"Other",color:"#00C48C"}})}),We)),this.pruneStaleCategories()}));let Pe=sessionStorage.getItem(U.SESSION_STORAGE.VELT_COMMENT_SIDEBAR_CUSTOM_ACTIONS_STATE);Pe&&this.componentConfigSignal.update(Be=>(Be=T(I({},Be),{customActionsState:JSON.parse(Pe)}),Be))}catch(Pe){this.loggingService.catch("Error in CommentsSidebarComponent constructor: ",Pe)}}ngOnInit(){try{if(this.setupA11yAttributes(),sessionStorage.getItem(U.SESSION_STORAGE.SNIPPYLY_COMMENT_SIDEBAR_FILTERS)){let e=JSON.parse(sessionStorage.getItem(U.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(U.SESSION_STORAGE.VELT_COMMENT_SIDEBAR_FILTERS_RESET)||(e.pages=[],sessionStorage.setItem(U.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(U.SESSION_STORAGE.SNIPPYLY_COMMENT_SIDEBAR_GROUP_BY)){let e=sessionStorage.getItem(U.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))}catch{}}ngAfterViewInit(){try{if(this.floatingMode)this.initComponent();else{let e=document.querySelector(U.TAGS.SNIPPYLY_COMMENTS_SIDEBAR),i=document.querySelector(U.TAGS.VELT_COMMENTS_SIDEBAR);i?this.veltId===i?.getAttribute(U.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(U.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!==U.TAGS.VELT_COMMENT_DIALOG&&i!==U.TAGS.SNIPPYLY_COMMENT_DIALOG&&!e?.target?.closest(U.TAGS.VELT_COMMENT_DIALOG)&&!e?.target?.closest(U.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}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(U.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}]),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.getAllCommentAnnotationsSubscription&&this.getAllCommentAnnotationsSubscription.unsubscribe()},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.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(U.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(c=>(c=I({},c),c.virtualScrollData.push({type:"annotation",data:s}),c))})}),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)),Ne(e=>!!e),ce(e=>e?.filter(i=>i?.comments?.length)),ge(e=>this.commentService.getExcludeLocationIdsFromSidebar$().pipe(ce(i=>i?.length&&e?.length?e.filter(r=>r?.location?.id?!i.includes(r.location.id):!0):e))),ge(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.setVersions(),this.setPeople(),this.filterCommentAnnotations(),this.updateAnnotationCountsByFilter(),this.componentConfigSignal().annotations?.length){let i=sessionStorage.getItem(U.SESSION_STORAGE.SNIPPYLY_SELECTED_ANNOTATION_ID);if(i){sessionStorage.removeItem(U.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?.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(U.SESSION_STORAGE.SNIPPYLY_COMMENT_SIDEBAR_FILTERS)||this.setDefaultStatuses();if(e?.people){if(e?.people?.length){let i=[];this.componentConfigSignal().user&&e.people.find(a=>a.userId&&a.userId===this.componentConfigSignal().user?.userId||a.email&&a.email===this.componentConfigSignal().user?.email)&&(i=[{id:this.peopleTypes.assignedToMe,name:this.peopleTypes.assignedToMe},{id:this.peopleTypes.addedByMe,name:this.peopleTypes.addedByMe}]),e.people.forEach(r=>{if(r?.userId||r?.email){let a=this.componentConfigSignal().peopleFilters.find(s=>r.userId&&s?.user?.userId===r.userId||r.email&&s?.user?.email===r.email);a?i.push({id:a?.user?.userSnippylyId,name:a?.user?.name}):i.push({id:r.userId||r.email,name:r.name||r.email||r.userId,userId:r.userId,email:r.email})}}),this.componentConfigSignal.update(r=>(r=T(I({},r),{filters:T(I({},r.filters),{people:i})}),r))}else this.componentConfigSignal.update(i=>(i=T(I({},i),{filters:T(I({},i.filters),{people:[]})}),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=$n(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=$n(e);this.emitOnCommentNavigationButtonClick(r)}if(this.commentService.getSidebarUrlNavigation()&&i)if(e?.pageInfo?.url&&e.pageInfo?.url!==window.location.href){sessionStorage.setItem(U.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(U.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(`${U.TAGS.VELT_COMMENT_TEXT}[${U.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 c=a?.location?.locationName||a?.documentParams?.locationName||this.getDisplayNameFromPageInfo(a?.pageInfo)||"",p=a?.location?.id||c;e.has(s)||(i[p]||(i[p]={locationIds:[],displayName:c,id:p}),e.set(s,p),i[p].locationIds.push(s))}),this.componentConfigSignal.update(a=>{let s=this.location?.locationId,c;if(s){let p=e.get(s);p&&(c=i[p].displayName)}else i.other&&(c="Others");return T(I({},a),{pages:i,currentPage:c})}),this.updateLocationInStorage(),this.componentConfigSignal().annotations?.length&&!sessionStorage.getItem(U.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)}}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=[];i.push({id:this.peopleTypes.assignedToMe,name:this.peopleTypes.assignedToMe}),r.push({id:this.peopleTypes.taggedMe,name:this.peopleTypes.taggedMe}),e.push({id:this.peopleTypes.addedByMe,name:this.peopleTypes.addedByMe}),this.componentConfigSignal().annotations&&this.componentConfigSignal.update(a=>(a=I({},a),a.annotations.forEach(s=>{s?.from?.userSnippylyId&&a.user?.userSnippylyId!==s?.from?.userSnippylyId&&!e.find(c=>c.id===s?.from?.userSnippylyId)&&e.push({id:s?.from?.userSnippylyId,name:`${s?.from?.name||s?.from?.email}`,user:s?.from}),s?.assignedTo?.userSnippylyId&&a.user?.userSnippylyId!==s?.assignedTo?.userSnippylyId&&!i.find(c=>c.id===s?.assignedTo?.userSnippylyId)&&i.push({id:s?.assignedTo?.userSnippylyId,name:`${s?.assignedTo?.name||s?.assignedTo?.email}`,user:s?.assignedTo}),s?.comments?.forEach(c=>{c?.taggedUserContacts?.forEach(p=>{p?.contact?.userSnippylyId&&a.user?.userSnippylyId!==p?.contact?.userSnippylyId&&!r.find(h=>h.id===p?.contact?.userSnippylyId)&&r.push({id:p?.contact?.userSnippylyId,name:`${p?.contact?.name||p?.contact?.email}`,user:p?.contact})})})}),a)),this.componentConfigSignal().filters?.people?.length&&this.componentConfigSignal.update(a=>(a=I({},a),a.filters.people.forEach(s=>{e.find(c=>c.id===s?.id)||s?.id!=="other"&&e.push(s)}),a.filters.assigned.forEach(s=>{i.find(c=>c.id===s?.id)||s?.id!=="other"&&i.push(s)}),a.filters.tagged.forEach(s=>{r.find(c=>c.id===s?.id)||s?.id!=="other"&&r.push(s)}),a)),this.componentConfigSignal.update(a=>(a=T(I({},a),{peopleFilters:e,assignedFilters:i,taggedFilters:r}),a)),this.componentConfigSignal().annotations?.length&&(sessionStorage.getItem(U.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(c=>(c=T(I({},c),{filters:T(I({},c.filters),{statuses:[],statusIds:[]})}),c)),this.resolvedCommentsOnDom=!0;else{let c=this.componentConfigSignal().filters?.statuses||[];c.find(p=>p.id===a.id)?this.componentConfigSignal.update(p=>(p=I({},p),p.filters.statuses=c.filter(h=>h.id!==a.id),p)):this.componentConfigSignal.update(p=>(p=I({},p),p.filters.statuses=[...c,a],p)),this.componentConfigSignal.update(p=>(p=T(I({},p),{filters:T(I({},p.filters),{statusIds:p.filters.statuses.map(h=>h?.id)})}),p))}break;case"pages":let s=this.componentConfigSignal().filters.pages||[];if(i)this.componentConfigSignal.update(c=>(c=T(I({},c),{filters:T(I({},c.filters),{pages:[]})}),c));else{let c=a?.id||a?.displayName;s.find(p=>p?.id===c||p?.displayName===c)?this.componentConfigSignal.update(p=>(p=I({},p),p.filters.pages=s.filter(h=>h?.id!==c&&h?.displayName!==c),p)):this.componentConfigSignal().filterConfig?.location?.multiSelection?this.componentConfigSignal.update(p=>(p=I({},p),p.filters.pages=[...s,a],p)):this.componentConfigSignal.update(p=>(p=I({},p),p.filters.pages=[a],p))}this.sortPageFilters(),this.updatePageSelectedState();break;case"people":this.componentConfigSignal.update(c=>{c=I({},c);let p=c.filters.people||[];return i?c.filters.people=[]:p.find(h=>h?.id===a?.id)?c.filters.people=p.filter(h=>h?.id!==a?.id):c.filterConfig?.people?.multiSelection?c.filters.people=[...p,a]:c.filters.people=[a],c}),this.updatePeopleSelectedState();break;case"tagged":this.componentConfigSignal.update(c=>{c=I({},c);let p=c.filters.tagged||[];return i?c.filters.tagged=[]:p.find(h=>h?.id===a?.id)?c.filters.tagged=p.filter(h=>h?.id!==a?.id):c.filterConfig?.tagged?.multiSelection?c.filters.tagged=[...p,a]:c.filters.tagged=[a],c}),this.updatePeopleSelectedState();break;case"assigned":this.componentConfigSignal.update(c=>{c=I({},c);let p=c.filters.assigned||[];return i?c.filters.assigned=[]:p.find(h=>h?.id===a?.id)?c.filters.assigned=p.filter(h=>h?.id!==a?.id):c.filterConfig?.assigned?.multiSelection?c.filters.assigned=[...p,a]:c.filters.assigned=[a],c}),this.updatePeopleSelectedState();break;case"categories":this.componentConfigSignal.update(c=>{c=I({},c);let p=c.filters.categories||[];return i?c.filters.categories=[]:p.find(h=>h.id===a.id)?c.filters.categories=p.filter(h=>h!==a):c.filterConfig?.category?.multiSelection?c.filters.categories=[...p,a]:c.filters.categories=[a],c.filters.categoryIds=c.filters.categories?.map(h=>h.id),c});break;case"priorities":this.componentConfigSignal.update(c=>{c=I({},c);let p=c.filters.priorities||[];return i?c.filters.priorities=[]:p.find(h=>h.id===a.id)?c.filters.priorities=p.filter(h=>h.id!==a.id):c.filterConfig?.priority?.multiSelection?c.filters.priorities=[...p,a]:c.filters.priorities=[a],c.filters.priorityIds=c.filters.priorities?.map(h=>h.id),c});break;case"accessModes":this.componentConfigSignal.update(c=>{c=I({},c);let p=c.filters.accessModes||[];return i?c.filters.accessModes=[]:p.find(h=>h===a.id)?c.filters.accessModes=p.filter(h=>h!==a.id):c.filterConfig?.commentType?.multiSelection?c.filters.accessModes=[...p,a.id]:c.filters.accessModes=[a.id],c});break;case"versions":this.componentConfigSignal.update(c=>{c=I({},c);let p=c.filters.versions||[];return i?c.filters.versions=[]:p.find(h=>h.id===a.id)?c.filters.versions=p.filter(h=>h.id!==a.id):c.filterConfig?.version?.multiSelection?c.filters.versions=[...p,a]:c.filters.versions=[a],c.filters.versionIds=c.filters.versions?.map(h=>h?.id),c});break;default:this.componentConfigSignal.update(c=>(c=T(I({},c),{filters:T(I({},c.filters),{[r]:a})}),c));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.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)}}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,"people")?.length}),e.taggedFilters?.forEach(i=>{e.commentAnnotationsCountByFilters.tagged[i.id]=this.filterAnnotationsByPeople(i,e.annotations,"tagged")?.length}),e.assignedFilters?.forEach(i=>{e.commentAnnotationsCountByFilters.assigned[i.id]=this.filterAnnotationsByPeople(i,e.annotations,"assigned")?.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();if(e.appliedFiltersCount=0,e.enablePriority&&e.filterConfig?.priority?.enable&&e.filters.priorities?.length){let a=[];e.filters.priorities?.forEach(s=>{a.push(...this.filterAnnotationsByPriority(s,r)?.map(c=>c.annotationId))}),r=r.filter(s=>a.includes(s.annotationId)),e.appliedFiltersCount++}if(e.filterConfig?.location?.enable&&e.filters.pages?.length){let a=[];e.filters.pages?.forEach(s=>{a.push(...this.filterAnnotationsByPage(s,r)?.map(c=>c.annotationId))}),r=r.filter(s=>a.includes(s.annotationId)),e.appliedFiltersCount++}if(e.filterConfig?.people?.enable&&e.filters.people?.length){let a=[];e.filters.people?.forEach(s=>{a.push(...this.filterAnnotationsByPeople(s,r,"people")?.map(c=>c.annotationId))}),r=r.filter(s=>a.includes(s.annotationId)),e.appliedFiltersCount++}if(e.filterConfig?.tagged?.enable&&e.filters.tagged?.length){let a=[];e.filters.tagged?.forEach(s=>{a.push(...this.filterAnnotationsByPeople(s,r,"tagged")?.map(c=>c.annotationId))}),r=r.filter(s=>a.includes(s.annotationId)),e.appliedFiltersCount++}if(e.filterConfig?.assigned?.enable&&e.filters.assigned?.length){let a=[];e.filters.assigned?.forEach(s=>{a.push(...this.filterAnnotationsByPeople(s,r,"assigned")?.map(c=>c.annotationId))}),r=r.filter(s=>a.includes(s.annotationId)),e.appliedFiltersCount++}if(e.enableAutoCategorize&&e.filterConfig?.category?.enable&&e.filters.categories?.length){let a=[];e.filters.categories?.forEach(s=>{a.push(...this.filterAnnotationsByCommentCategory(s,r)?.map(c=>c.annotationId))}),r=r.filter(s=>a.includes(s.annotationId)),e.appliedFiltersCount++}if(e.isUserAdmin&&e.filterConfig?.commentType?.enable&&e.filters.accessModes?.length){let a=[];e.filters.accessModes?.forEach(s=>{a.push(...this.filterAnnotationsByAccessMode(s,r)?.map(c=>c.annotationId))}),r=r.filter(s=>a.includes(s.annotationId)),e.appliedFiltersCount++}if(e.filterConfig?.version?.enable&&e.filters.versions?.length){let a=[];e.filters.versions?.forEach(s=>{a.push(...this.filterAnnotationsByVersion(s,r)?.map(c=>c.annotationId))}),r=r.filter(s=>a.includes(s.annotationId)),e.appliedFiltersCount++}if(e.enableStatus&&e.filters.statuses?.length){let a=[];e.filters.statuses?.forEach(s=>{s.id===this.customFilterService.resolvedStatus.id&&(i=!0),a.push(...this.filterAnnotationsByStatus(s,r)?.map(c=>c.annotationId))}),r=r.filter(s=>a.includes(s.annotationId))}e.filters.input&&(r=this.filterAnnotationsByInput(e.filters.input,r)),e.minimalFilter&&(!i&&e.minimalFilter==="resolved"&&(r=e.annotations.slice()),r=r.filter(a=>{switch(e.minimalFilter){case"all":return!i&&!this.resolvedCommentsOnDom?a.status?.id!==this.customFilterService.resolvedStatus.id:!0;case"read":return!this.componentConfigSignal().unreadCommentsMap?.[a.annotationId]&&a.status?.id!==this.customFilterService.resolvedStatus.id;case"unread":return!!this.componentConfigSignal().unreadCommentsMap?.[a.annotationId]&&a.status?.id!==this.customFilterService.resolvedStatus.id||!!this.componentConfigSignal().selectedAnnotationsMap[a.annotationId];case"resolved":return a.status?.id===this.customFilterService.resolvedStatus.id;default:return!0}})),this.componentConfigSignal.update(a=>(a=T(I(I({},a),e),{filteredCommentPinAnnotations:r}),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(U.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();switch(i.groupBy){case i.groupByOptions.people:let r=i.filters.people?.length?i.filters.people:i.peopleFilters;this.filteredGroupedCommentAnnotationsObj={},r.forEach(E=>{let A=this.filterAnnotationsByPeople(E,this.componentConfigSignal().filteredCommentPinAnnotations,"people");A?.length&&(this.filteredGroupedCommentAnnotationsObj[E.id]={displayName:E.name,annotations:A,isExpanded:e[E.id]?e[E.id]?.isExpanded:!0})}),this.filteredGroupedCommentAnnotations=[],i.peopleFilters.forEach(E=>{this.filteredGroupedCommentAnnotationsObj[E.id]&&this.filteredGroupedCommentAnnotations.push(this.filteredGroupedCommentAnnotationsObj[E.id])});break;case i.groupByOptions.assigned:let a=i.filters.assigned?.length?i.filters.assigned:i.assignedFilters;this.filteredGroupedCommentAnnotationsObj={},a.forEach(E=>{let A=this.filterAnnotationsByPeople(E,this.componentConfigSignal().filteredCommentPinAnnotations,"assigned");A?.length&&(this.filteredGroupedCommentAnnotationsObj[E.id]={displayName:E.name,annotations:A,isExpanded:e[E.id]?e[E.id]?.isExpanded:!0})}),this.filteredGroupedCommentAnnotations=[],i.assignedFilters.forEach(E=>{this.filteredGroupedCommentAnnotationsObj[E.id]&&this.filteredGroupedCommentAnnotations.push(this.filteredGroupedCommentAnnotationsObj[E.id])});break;case i.groupByOptions.tagged:let s=i.filters.tagged?.length?i.filters.tagged:i.taggedFilters;this.filteredGroupedCommentAnnotationsObj={},s.forEach(E=>{let A=this.filterAnnotationsByPeople(E,this.componentConfigSignal().filteredCommentPinAnnotations,"tagged");A?.length&&(this.filteredGroupedCommentAnnotationsObj[E.id]={displayName:E.name,annotations:A,isExpanded:e[E.id]?e[E.id]?.isExpanded:!0})}),this.filteredGroupedCommentAnnotations=[],i.taggedFilters.forEach(E=>{this.filteredGroupedCommentAnnotationsObj[E.id]&&this.filteredGroupedCommentAnnotations.push(this.filteredGroupedCommentAnnotationsObj[E.id])});break;case i.groupByOptions.page:case i.groupByOptions.location:i=this.componentConfigSignal();let c=i.filters.pages?.length?i.filters.pages:Object.values(i.pages||{});c?.sort((E,A)=>E?.displayName===i.currentPage?-1:A?.displayName===i.currentPage?1:0),this.filteredGroupedCommentAnnotationsObj={},c.forEach(E=>{let A=E?.displayName===i?.currentPage;this.locations&&Object.keys(this.locations||{}).forEach(G=>{let X=this.locations[G]?.location;X?.id&&X?.id===E?.id&&(A=!0)});let V=this.filterAnnotationsByPage(E,this.componentConfigSignal().filteredCommentPinAnnotations);if((E.id||E?.displayName)&&V?.length){let G=E.id||E?.displayName||"";this.filteredGroupedCommentAnnotationsObj[G]={displayName:E.displayName,annotations:V,isExpanded:e[G]?e[G]?.isExpanded:!!A}}}),this.filteredGroupedCommentAnnotations=[];let p=i?.filterConfig?.location?.order||[];if(p?.length){let E=A=>{let V=p.indexOf(A?.id);return V===-1?1/0:V};c.sort((A,V)=>{let G=E(A),X=E(V);return G!==X?G-X:c.indexOf(A)-c.indexOf(V)})}c.forEach(E=>{let A=E.id||E?.displayName||"";A&&this.filteredGroupedCommentAnnotationsObj[A]&&this.filteredGroupedCommentAnnotations.push(this.filteredGroupedCommentAnnotationsObj[A])}),this.componentConfigSignal.update(E=>(E=I(I({},E),i),E));break;case i.groupByOptions.priority:let h=i.filters.priorities?.length?i.filters.priorities:i.priorities;this.filteredGroupedCommentAnnotationsObj={},h.forEach(E=>{let A=this.filterAnnotationsByPriority(E,this.componentConfigSignal().filteredCommentPinAnnotations);A?.length&&(this.filteredGroupedCommentAnnotationsObj[E.id]={displayName:E.name,annotations:A,isExpanded:e[E.id]?e[E.id]?.isExpanded:!0})}),this.filteredGroupedCommentAnnotations=[],i.priorities.forEach(E=>{this.filteredGroupedCommentAnnotationsObj[E.id]&&this.filteredGroupedCommentAnnotations.push(this.filteredGroupedCommentAnnotationsObj[E.id])}),this.componentConfigSignal.update(E=>(E=I(I({},E),i),E));break;case i.groupByOptions.category:let _=i.filters.categories?.length?i.filters.categories:Object.values(i.commentCategoryMap||{});this.filteredGroupedCommentAnnotationsObj={},_.forEach(E=>{let A=this.filterAnnotationsByCommentCategory(E,this.componentConfigSignal().filteredCommentPinAnnotations);A?.length&&(this.filteredGroupedCommentAnnotationsObj[E.id]={displayName:E.name,annotations:A,isExpanded:e[E.id]?e[E.id]?.isExpanded:!0})}),this.filteredGroupedCommentAnnotations=[],_.forEach(E=>{this.filteredGroupedCommentAnnotationsObj[E.id]&&this.filteredGroupedCommentAnnotations.push(this.filteredGroupedCommentAnnotationsObj[E.id])}),this.componentConfigSignal.update(E=>(E=I(I({},E),i),E));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,r){try{switch(e.id){case this.peopleTypes.assignedToMe:return i.filter(a=>a?.assignedTo?.userId===this.componentConfigSignal().user?.userId);case this.peopleTypes.taggedMe:return i.filter(a=>{let s=!1;return a.comments.forEach(c=>{c.taggedUserContacts?.forEach(p=>{p?.contact?.userSnippylyId===this.componentConfigSignal().user?.userSnippylyId&&(s=!0)})}),s});case this.peopleTypes.addedByMe:return i.filter(a=>a?.from?.userId===this.componentConfigSignal().user?.userId);case this.peopleTypes.other:return i.filter(a=>!a?.from?.userSnippylyId);default:switch(r){case"people":return e.id?i.filter(a=>a?.from?.userSnippylyId===e?.id||a?.from?.userId===e?.id||a?.from?.email===e?.id):i;case"tagged":return i.filter(a=>a?.comments?.some(s=>s?.taggedUserContacts?.some(c=>c?.contact?.userSnippylyId===e?.id)));case"assigned":return i.filter(a=>a?.assignedTo?.userSnippylyId===e?.id);default:return i}}}catch(a){return this.loggingService.catch("Error in CommentsSidebarComponent filterAnnotationsByPeople: ",a),[]}}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===Yi.PRIVATE?i.filter(r=>r?.iam?.accessMode===Yi.PRIVATE):i.filter(r=>!r?.iam?.accessMode||r?.iam?.accessMode===Yi.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 c=r?.comments[s];if(c?.commentText?.toLowerCase().includes(e.toLowerCase())){a=!0;break}else if(c?.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(U.SESSION_STORAGE.SNIPPYLY_COMMENT_SIDEBAR_FILTERS,i)}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent setFiltersToStorage: ",e)}}setCommentSidebarInstalledInAnalytics(){try{this.analyticsService.setInstalledFeature(Tu.COMMENT_SIDEBAR)}catch(e){this.loggingService.catch("Error in CommentsSidebarComponent setCommentSidebarInstalledInAnalytics: ",e)}}setCommentSidebarEmbedModeInAnalytics(){try{this.componentConfigSignal().embedMode&&this.analyticsService.trackEvent(Z.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(Z.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(Z.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 ko,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 c=new Date(a.data.lastUpdated).getTime();return new Date(s.data.lastUpdated).getTime()-c}else if(e==="unread"){let c=i.unreadCommentsMap?.[a.data.annotationId]||0,p=i.unreadCommentsMap?.[s.data.annotationId]||0;if(c>0&&p===0)return-1;if(c===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:[],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:"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(U.SESSION_STORAGE.VELT_COMMENT_SIDEBAR_CUSTOM_ACTIONS_STATE),sessionStorage.removeItem(U.SESSION_STORAGE.SNIPPYLY_COMMENT_SIDEBAR_FILTERS)}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)}}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(U.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(U.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(c=>c?.name?.toLowerCase().includes(e.toLowerCase()));break;case"assigned":a=r.assignedFilters,!e||e===""?s=a:s=a.filter(c=>c?.name?.toLowerCase().includes(e.toLowerCase()));break;case"tagged":a=r.taggedFilters,!e||e===""?s=a:s=a.filter(c=>c?.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"statuses":a=r.statuses,!e||e===""?s=a:s=a.filter(c=>c.name.toLowerCase().includes(e.toLowerCase()));break;case"priorities":a=r.priorities,!e||e===""?s=a:s=a.filter(c=>c.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(c=>c.name.toLowerCase().includes(e.toLowerCase()));break}return s}catch(r){return this.loggingService.catch("Error in CommentsSidebarComponent filterPeople: ",r),[]}}};o.\u0275fac=function(i){return new(i||o)(u(Qe),u(je),u(Te),u(Fe),u(lt),u(N),u(gn),u(y),u(co),u($o),u(zs),u(Xt),u(Ge),u($i),u(BC),u(Ye))},o.\u0275cmp=M({type:o,selectors:[["app-comments-sidebar"]],viewQuery:function(i,r){if(i&1&&(it(WFt,5),it(qFt,5),it(YFt,7)),i&2){let a;Ze(a=Xe())&&(r.sidebarOverlay=a.first),Ze(a=Xe())&&(r.virtualScrollViewportRef=a.first),Ze(a=Xe())&&(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"],_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,qe],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"],[1,"velt-comments-sidebar-container"],["role","dialog",3,"onWrapperClick","componentConfigSignal","template","darkMode"]],template:function(i,r){i&1&&g(0,rLt,4,1,"ng-container",4),i&2&&m("ngIf",r.componentConfigSignal())},dependencies:[K,ft,jn,kn,nn,Rue,me],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 aLt=["*"];function sLt(n,o){if(n&1&&w(0,"snippyly-user-avatar",12),n&2){let t=l(3);m("user",t.cursorUser)}}function lLt(n,o){if(n&1&&w(0,"video",13),n&2){let t=l(3);pe("flip",t.selfCursorPointer),m("srcObject",t.stream)("volume",t.selfCursorPointer?0:1)}}function cLt(n,o){if(n&1&&w(0,"audio",13),n&2){let t=l(3);m("srcObject",t.stream)("volume",t.selfCursorPointer?0:1)}}function mLt(n,o){if(n&1&&(C(0,"div",6)(1,"div",7)(2,"div",8),g(3,sLt,1,1,"snippyly-user-avatar",9)(4,lLt,1,4,"video",10)(5,cLt,1,2,"audio",11),S()()()),n&2){let t=l(2);d(),ot("background",t.cursorUser==null?null:t.cursorUser.color)("border",t.gainVolume&&t.lightenedColor?t.getGainAnimationBorderStyle():""),d(2),m("ngIf",!(t.huddleState!=null&&t.huddleState.videoState)),d(),m("ngIf",t.huddleState==null?null:t.huddleState.videoState),d(),m("ngIf",(t.huddleState==null?null:t.huddleState.audioState)&&!(t.huddleState!=null&&t.huddleState.videoState))}}function dLt(n,o){if(n&1){let t=q();C(0,"div",14)(1,"img",15),z("error",function(){k(t);let i=l(3);return R(i.onImageLoadError())}),S()()}if(n&2){let t=l(3);ot("background-color",t.cursorUser.color),pe("user-presence-text-container-comment-border",t.cursorUser.comment),d(),m("src",t.cursorUser==null?null:t.cursorUser.photoUrl,cn)}}function pLt(n,o){if(n&1&&(C(0,"p",20),te(1),D(2,"translate"),S()),n&2){let t,e=l(5);ot("color",e.getTextColor(e.cursorUser==null?null:e.cursorUser.color)),d(),ve(" ",O(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 gLt(n,o){if(n&1&&(C(0,"p",21),te(1),D(2,"translate"),S()),n&2){let t=l(5);d(),$e(O(2,1,t.cursorUser.comment))}}function uLt(n,o){if(n&1&&(C(0,"div",17),g(1,pLt,3,5,"p",18)(2,gLt,3,3,"p",19),S()),n&2){let t=l(4);ot("background-color",t.cursorUser.color),pe("user-presence-text-container-comment-border",t.cursorUser.comment)("px-3",t.cursorUser.comment)("py-2",t.cursorUser.comment),d(),m("ngIf",t.cursorUser.name||(t.cursorUser==null?null:t.cursorUser.email)),d(),m("ngIf",t.cursorUser.comment)}}function hLt(n,o){n&1&&(C(0,"div",22),w(1,"velt-skeleton-loader-internal",23),S())}function fLt(n,o){if(n&1&&g(0,uLt,3,10,"div",16)(1,hLt,2,0,"ng-template",null,2,xe),n&2){let t=de(2),e=l(3);m("ngIf",e.cursorUser.name||(e.cursorUser==null?null:e.cursorUser.email)||e.cursorUser.comment)("ngIfElse",t)}}function vLt(n,o){if(n&1&&g(0,dLt,2,5,"ng-template",5)(1,fLt,3,2,"ng-template",null,1,xe),n&2){let t=de(2),e=l(2);m("ngIf",e.avatarMode&&!e.showInitial)("ngIfElse",t)}}function CLt(n,o){if(n&1&&(C(0,"div",4),Pt(1),g(2,mLt,6,7,"ng-template",5)(3,vLt,3,2,"ng-template",null,0,xe),S()),n&2){let t=de(4),e=l();ot("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"),pe("no-transition",e.selfCursorPointer),d(2),m("ngIf",e.stream&&((e.huddleState==null?null:e.huddleState.audioState)||(e.huddleState==null?null:e.huddleState.videoState)))("ngIfElse",t)}}var Nue=(()=>{let o=class o{get cursorUser(){return this._cursorUser}set cursorUser(e){this._cursorUser=e,e?.color&&(this.lightenedColor=Qie(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),c=()=>{a.getByteFrequencyData(s);let p=s.reduce((h,_)=>h+_,0)/s.length;this.gainVolume=p,this.gainAnimationId=requestAnimationFrame(c)};this.gainAnimationId=requestAnimationFrame(c)}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 Xie(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?Jie(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(mr),u(y))},o.\u0275cmp=M({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:aLt,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,CLt,5,8,"div",3)),i&2&&m("ngIf",r.cursorUser==null?null:r.cursorUser.position)},dependencies:[K,Un,yo,me],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 yLt(n,o){if(n&1&&(C(0,"snippyly-cursor-pointer",5)(1,"slot",6),oe(),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();m("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 SLt(n,o){if(n&1&&(f(0),g(1,yLt,15,6,"snippyly-cursor-pointer",4),v()),n&2){let t=o.$implicit;d(),m("ngIf",t==null?null:t.position)}}function bLt(n,o){if(n&1&&(C(0,"snippyly-cursor-pointer",19)(1,"slot",6),oe(),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();m("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 ILt(n,o){if(n&1&&g(0,SLt,2,1,"ng-container",2)(1,bLt,15,7,"snippyly-cursor-pointer",3),n&2){let t=l().ngIf,e=l();m("ngForOf",t.cursorUsers)("ngForTrackBy",e.trackById),d(),m("ngIf",t.huddleJoined&&t.huddleOnCursorMode&&t.currentCursorUser)}}function ELt(n,o){if(n&1&&(f(0),g(1,ILt,2,3,"ng-template",1),v()),n&2){let t=o.ngIf;d(),m("ngIf",t.isFirstComponent&&!(t.user!=null&&t.user.isAnonymous))}}var k$=(()=>{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,c){this.analyticsService=e,this.authService=i,this.cursorService=r,this.domService=a,this.huddleService=s,this.loggingService=c,this.avatarMode=!1,this.onCursorUsersChanged=new De,this.onCursorUserChange=new De,this.subscriptions=[],this.constants=U,this.showInitials={},this.componentConfigSignal=be({isFirstComponent:!1,user:void 0,cursorUsers:[],huddleOnCursorModeByAttendeeId:{},attendeesByUserId:{},remoteStreamsByUserId:{},huddleOnCursorMode:!1,huddleJoined:!1,currentCursorUser:new Lv,localStream:void 0}),this.veltId=xn(),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(U.TAGS.SNIPPYLY_CURSOR),i=document.querySelector(U.TAGS.VELT_CURSOR);i?this.veltId===i?.getAttribute(U.ATTRIBUTES.VELT_ID)&&(this.componentConfigSignal.update(r=>(r=T(I({},r),{isFirstComponent:!0}),r)),this.initComponent()):this.veltId===e?.getAttribute(U.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(Ne(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(Ne(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(Re.CURSOR)}catch(e){this.loggingService.catch("Error in CursorComponent setCursorInstalledInAnalytics: ",e)}}};o.\u0275fac=function(i){return new(i||o)(u(Qe),u(je),u(qv),u(Fe),u(mr),u(y))},o.\u0275cmp=M({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,ELt,2,1,"ng-container",0),i&2&&m("ngIf",r.componentConfigSignal())},dependencies:[ht,K,Nue],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 xLt(n,o){if(n&1&&(C(0,"span",7),te(1),D(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):O(2,1,t.user==null||t.user.email==null?null:t.user.email.charAt(0)),"")}}function TLt(n,o){if(n&1){let t=q();C(0,"img",8),z("error",function(){k(t);let i=l(3);return R(i.onImageLoadError())}),S()}if(n&2){let t=l(2).ngIf;m("src",t.user.photoUrl,cn)}}function wLt(n,o){if(n&1&&(C(0,"div",3)(1,"span",4),D(2,"translate"),g(3,xLt,3,3,"span",5)(4,TLt,1,1,"ng-template",null,0,xe),S(),w(6,"audio",6),S()),n&2){let t=de(5),e=l().ngIf;d(),ot("color",e.user.color+" !important")("background-color",e.user.color+" !important"),m("title",O(2,8,(e.user==null?null:e.user.name)||(e.user==null?null:e.user.email))),d(2),m("ngIf",e.showInitial)("ngIfElse",t),d(3),m("srcObject",e.remoteAudioStream)}}function DLt(n,o){if(n&1&&(f(0),g(1,wLt,7,10,"div",2),v()),n&2){let t=o.ngIf;d(),m("ngIf",t.user)}}var Fue=(()=>{let o=class o{constructor(e){this.loggingService=e,this.veltElement=!0,this.componentConfigSignal=be({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=M({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:[qe],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,DLt,2,1,"ng-container",1),i&2&&m("ngIf",r.componentConfigSignal())},dependencies:[K,me],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 OLt(n,o){if(n&1){let t=q();C(0,"div",18),z("click",function(){let i=k(t).$implicit,r=l(2);return R(r.selectAudioDevice(i))}),te(1),D(2,"translate"),S()}if(n&2){let t=o.$implicit,e=l(2);pe("selected",t.deviceId===(e.selectedAudioDevice==null?null:e.selectedAudioDevice.deviceId)),d(),ve(" ",O(2,3,t.label)," ")}}function MLt(n,o){if(n&1&&(C(0,"div",12)(1,"div",13),te(2),D(3,"translate"),S(),te(4),D(5,"translate"),C(6,"div",14)(7,"div",15),g(8,OLt,3,5,"div",16),S(),te(9),D(10,"translate"),oe(),C(11,"svg",4),w(12,"path",17),S()()()),n&2){let t=l();d(2),$e(O(3,4,"Audio")),d(2),ve(" ",O(5,6,"Microphone")," "),d(4),m("ngForOf",t.audioDevices),d(),ve(" ",O(10,8,t.selectedAudioDevice==null?null:t.selectedAudioDevice.label)," ")}}function PLt(n,o){if(n&1){let t=q();C(0,"div",18),z("click",function(){let i=k(t).$implicit,r=l(2);return R(r.selectVideoDevice(i))}),te(1),D(2,"translate"),S()}if(n&2){let t=o.$implicit,e=l(2);pe("selected",t.deviceId===(e.selectedVideoDevice==null?null:e.selectedVideoDevice.deviceId)),d(),ve(" ",O(2,3,t.label)," ")}}function kLt(n,o){if(n&1&&(C(0,"div",12)(1,"div",13),te(2),D(3,"translate"),S(),te(4),D(5,"translate"),C(6,"div",14)(7,"div",15),g(8,PLt,3,5,"div",16),S(),te(9),D(10,"translate"),oe(),C(11,"svg",4),w(12,"path",17),S()()()),n&2){let t=l();d(2),$e(O(3,4,"Video")),d(2),ve(" ",O(5,6,"Camera")," "),d(4),m("ngForOf",t.videoDevices),d(),ve(" ",O(10,8,t.selectedVideoDevice==null?null:t.selectedVideoDevice.label)," ")}}var Lue=(()=>{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=ac(),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 ee(this,null,function*(){try{if(new Jn().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(U.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(Ko),u(cl,8))},o.\u0275cmp=M({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),z("pointerdown",function(c){return k(a),R(c.stopPropagation())})("pointerup",function(c){return k(a),R(c.stopPropagation())})("click",function(c){return k(a),R(c.stopPropagation())}),C(2,"div",2)(3,"div",3),oe(),C(4,"svg",4),w(5,"path",5),S(),te(6),D(7,"translate"),S(),ct(),C(8,"div",6),z("click",function(){return k(a),R(r.closeDialog())}),oe(),C(9,"svg",7),w(10,"path",8),S()()(),g(11,MLt,13,10,"div",9)(12,kLt,13,10,"div",9),ct(),w(13,"div",10),C(14,"div",11),z("click",function(){return k(a),R(r.saveChanges())}),te(15),D(16,"translate"),S()()}if(i&2){let a=de(1);m("snippylyOverlay",a)("snippylyOverlayZIndex",3e3),d(6),ve(" ",O(7,6,"Settings")," "),d(5),m("ngIf",r.settingsVisible==null?null:r.settingsVisible.audio),d(),m("ngIf",r.settingsVisible==null?null:r.settingsVisible.video),d(3),$e(O(16,8,"Save changes"))}},dependencies:[ht,K,tr,me],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 Bue=(()=>{let o=class o{constructor(e,i,r,a,s,c,p,h){this.authService=e,this.configService=i,this.contactService=r,this.docService=a,this.commonDbService=s,this.databaseService=c,this.loggingService=p,this.notificationService=h,this.documentUsers$=new fe([]);try{this.databaseService.getDb().pipe(Ne(_=>!!_),Je(1)).subscribe(_=>{_&&(this.db=_,this.subscribeUsersFromDocument())}),this.authService.getUser$().subscribe(_=>{if(_?.email){this.subscribeUsersFromDocument();let E=Rt(_.email);_?.organizationId&&(E=Rt(_.userId)),this.getDocumentUserByIdFromDb(E).then(A=>{A&&(A.user.name=_.name,A.user.photoUrl=_.photoUrl,this.updateDocumentUser(A))}).catch(A=>{this.loggingService.catch("Error in DocumentUserAccessService getDocumentUserByIdFromDb:",A)})}},_=>{this.loggingService.catch("Error in DocumentUserAccessService getUser$:",_)})}catch(_){this.loggingService.catch("Error in DocService constructor:",_)}}getDocumentUserByIdFromDb(e){return ee(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(Je(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(ge(e=>e?this.docService.getDocumentPaths$().pipe(Ne(i=>!!i),ge(i=>this.commonDbService.dbListener({feature:"allDocumentUsers",properties:{documentId:i?.documentId,organizationId:i?.organizationId,isCollection:!0}}).pipe(ce(r=>r?.data?Object.values(r?.data):[])))):re([]))).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===mo.ADMIN)this.contactService.addGlobalContact(e.user);else if(e?.role?.name===mo.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=Rt(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(je),J($t),J(gi),J(lt),J(bn),J(pn),J(y),J(Vn))},o.\u0275prov=Ae({token:o,factory:o.\u0275fac,providedIn:"root"});let n=o;return n})();var NLt=["triggerTemplate"],FLt=["tooltipTemplate"],LLt=["trigger"],BLt=["overlay"],VLt=()=>["snippyly-overlay-panel","snippyly-reaction-dialog-overlay-panel"];function ULt(n,o){n&1&&Ue(0)}function jLt(n,o){n&1&&Ue(0)}function $Lt(n,o){if(n&1){let t=q();C(0,"div",6,2),z("pointerenter",function(){k(t);let i=l();return R(i.showTooltip())})("pointerleave",function(){k(t);let i=l();return R(i.hideTooltip())}),g(2,jLt,1,0,"ng-container",4),S()}if(n&2){let t=de(1),e=l();m("snippylyOverlay",t)("snippylyOverlayZIndex",2e3),x("data-velt-element",!0),d(2),m("ngTemplateOutlet",e.tooltipTemplate)}}var wm=(()=>{let o=class o{constructor(e){this.loggingService=e,this.positions=[],this.disableClose=!0,this.disabled=!1,this.componentConfigSignal=be({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 Ri({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=M({type:o,selectors:[["app-overlay-tooltip"]],contentQueries:function(i,r,a){if(i&1&&(ws(a,NLt,7),ws(a,FLt,7)),i&2){let s;Ze(s=Xe())&&(r.triggerTemplate=s.first),Ze(s=Xe())&&(r.tooltipTemplate=s.first)}},viewQuery:function(i,r){if(i&1&&(it(LLt,5),it(BLt,5)),i&2){let a;Ze(a=Xe())&&(r.trigger=a.first),Ze(a=Xe())&&(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:[qe],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),z("pointerenter",function(){return k(a),R(r.showTooltip())})("pointerleave",function(){return k(a),R(r.hideTooltip())}),g(2,ULt,1,0,"ng-container",4),S(),g(3,$Lt,3,4,"ng-template",5,1,xe)}if(i&2){let a=de(1);d(2),m("ngTemplateOutlet",r.triggerTemplate),d(),m("cdkConnectedOverlayOrigin",a)("cdkConnectedOverlayPanelClass",kt(7,VLt))("cdkConnectedOverlayOpen",!r.componentConfigSignal().disabled&&r.componentConfigSignal().tooltipVisible)("cdkConnectedOverlayPositions",r.componentConfigSignal().overlayPositions)("cdkConnectedOverlayGrowAfterOpen",!0)("cdkConnectedOverlayDisableClose",r.disableClose)}},dependencies:[ft,jn,kn,tr],encapsulation:2,changeDetection:0});let n=o;return n})();var HLt=["matAutocomplete"],zLt=["matAutocompleteTrigger"],GLt=["autocompletePanelInput"],WLt=["viewport"],qLt=n=>({componentConfigSignal:n}),YLt=(n,o)=>({condition:n,data:o}),tw=n=>({$implicit:n}),R$=n=>({$implicit:n,isNewContact:!0});function KLt(n,o){if(n&1){let t=q();C(0,"input",9,2),z("keyup",function(i){return k(t),R(i.stopPropagation())})("keydown",function(i){return k(t),R(i.stopPropagation())})("keyup.escape",function(i){return k(t),l().closePanel(),R(i.stopPropagation())})("input",function(i){return k(t),l().handleInput(i),R(i.stopPropagation())}),S()}if(n&2){let t=l(),e=de(4);m("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 ZLt(n,o){n&1&&Ue(0)}function XLt(n,o){if(n&1){let t=q();C(0,"mat-option",17),z("pointerdown",function(i){return k(t),i.stopPropagation(),R(i.preventDefault())})("pointerup",function(i){let r=k(t).$implicit,a=l(3);return i.stopPropagation(),a.onOptionClick(r),R(i.preventDefault())}),g(1,ZLt,1,0,"ng-container",18),S()}if(n&2){let t=o.$implicit,e=o.index,i=l(3),r=de(7);m("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(),m("ngTemplateOutlet",r)("ngTemplateOutletContext",P(7,tw,t))}}function QLt(n,o){n&1&&Ue(0)}function JLt(n,o){if(n&1){let t=q();C(0,"mat-option",19),z("pointerdown",function(i){return k(t),i.stopPropagation(),R(i.preventDefault())})("pointerup",function(i){return k(t),i.stopPropagation(),R(i.preventDefault())}),g(1,QLt,1,0,"ng-container",18),S()}if(n&2){let t,e=l(3),i=de(7);m("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(),m("ngTemplateOutlet",i)("ngTemplateOutletContext",P(6,R$,e.componentConfigSignal().newUserContact))}}function eBt(n,o){if(n&1&&(C(0,"cdk-virtual-scroll-viewport",14,3),g(2,XLt,2,9,"mat-option",15),D(3,"async"),g(4,JLt,2,8,"mat-option",16),S()),n&2){let t,e=l(2);d(2),m("cdkVirtualForOf",O(3,3,e.componentConfigSignal().filteredUserContacts$))("cdkVirtualForTrackBy",e.trackByUserContact),d(2),m("ngIf",(t=e.componentConfigSignal().newUserContact)==null||t.contact==null?null:t.contact.email)}}function tBt(n,o){n&1&&Ue(0)}function nBt(n,o){if(n&1){let t=q();C(0,"mat-option",17),z("pointerdown",function(i){return k(t),i.stopPropagation(),R(i.preventDefault())})("pointerup",function(i){let r=k(t).$implicit,a=l(5);return i.stopPropagation(),a.onOptionClick(r),R(i.preventDefault())}),g(1,tBt,1,0,"ng-container",18),S()}if(n&2){let t=o.$implicit,e=o.index,i=l(5),r=de(7);m("disabled",t.disabled)("value",t),x("id","velt-option-user-"+e)("aria-disabled",t.disabled)("data-testid",i.componentId+"-user-"+e),d(),m("ngTemplateOutlet",r)("ngTemplateOutletContext",P(7,tw,t))}}function iBt(n,o){if(n&1&&(f(0),g(1,nBt,2,9,"mat-option",23),v()),n&2){let t=l(4);d(),m("ngForOf",t.componentConfigSignal().contactsWithoutGroup)("ngForTrackBy",t.trackByUserContact)}}function oBt(n,o){if(n&1){let t=q();C(0,"mat-option",26),z("pointerdown",function(i){return k(t),i.stopPropagation(),R(i.preventDefault())})("pointerup",function(i){return k(t),i.stopPropagation(),R(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);m("disabled",!0)("value",null),x("id","velt-option-group-"+i)("data-testid",r.componentId+"-group-"+i),d(),m("componentConfigSignal",r.componentConfigSignal)("group",e)}}function rBt(n,o){n&1&&Ue(0)}function aBt(n,o){if(n&1){let t=q();C(0,"mat-option",28),z("pointerdown",function(i){return k(t),i.stopPropagation(),R(i.preventDefault())})("pointerup",function(i){let r=k(t).$implicit,a=l(5);return i.stopPropagation(),a.onOptionClick(r),R(i.preventDefault())}),C(1,"div",29),g(2,rBt,1,0,"ng-container",18),S()()}if(n&2){let t=o.$implicit,e=o.index,i=l().index,r=l(4),a=de(7);m("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),m("ngTemplateOutlet",a)("ngTemplateOutletContext",P(7,tw,t))}}function sBt(n,o){if(n&1&&(f(0),g(1,oBt,2,6,"mat-option",24)(2,aBt,3,9,"mat-option",25),v()),n&2){let t=o.$implicit;d(),m("ngIf",t==null||t.members==null?null:t.members.length),d(),m("ngForOf",t.members)}}function lBt(n,o){if(n&1){let t=q();C(0,"mat-option",31),z("pointerdown",function(i){return k(t),i.stopPropagation(),R(i.preventDefault())})("pointerup",function(i){return k(t),i.stopPropagation(),R(i.preventDefault())}),w(1,"velt-autocomplete-group-option-internal",32),S()}if(n&2){let t=l(5);m("disabled",!0)("value",null),x("id","velt-option-ungrouped")("data-testid",t.componentId+"-ungrouped"),d(),m("componentConfigSignal",t.componentConfigSignal)("groupName","Ungrouped")}}function cBt(n,o){n&1&&Ue(0)}function mBt(n,o){if(n&1){let t=q();C(0,"mat-option",17),z("pointerdown",function(i){return k(t),i.stopPropagation(),R(i.preventDefault())})("pointerup",function(i){let r=k(t).$implicit,a=l(5);return i.stopPropagation(),a.onOptionClick(r),R(i.preventDefault())}),g(1,cBt,1,0,"ng-container",18),S()}if(n&2){let t=o.$implicit,e=o.index,i=l(5),r=de(7);m("disabled",t.disabled)("value",t),x("id","velt-option-user-"+e)("aria-disabled",t.disabled)("data-testid",i.componentId+"-user-"+e),d(),m("ngTemplateOutlet",r)("ngTemplateOutletContext",P(7,tw,t))}}function dBt(n,o){if(n&1&&(f(0),g(1,lBt,2,6,"mat-option",30)(2,mBt,2,9,"mat-option",23),v()),n&2){let t,e,i=l(4);d(),m("ngIf",(t=i.componentConfigSignal())==null||t.contactsWithoutGroup==null?null:t.contactsWithoutGroup.length),d(),m("ngForOf",(e=i.componentConfigSignal())==null?null:e.contactsWithoutGroup)("ngForTrackBy",i.trackByUserContact)}}function pBt(n,o){if(n&1&&(f(0),g(1,iBt,2,2,"ng-container",21)(2,sBt,3,2,"ng-container",22)(3,dBt,3,3,"ng-container",21),v()),n&2){let t=l(3);d(),m("ngIf",!t.componentConfigSignal().showMentionGroupsOnly&&!t.componentConfigSignal().showMentionGroupsFirst),d(),m("ngForOf",t.componentConfigSignal().groups),d(),m("ngIf",!t.componentConfigSignal().showMentionGroupsOnly&&t.componentConfigSignal().showMentionGroupsFirst)}}function gBt(n,o){n&1&&Ue(0)}function uBt(n,o){if(n&1){let t=q();C(0,"mat-option",19),z("pointerdown",function(i){return k(t),i.stopPropagation(),R(i.preventDefault())})("pointerup",function(i){return k(t),i.stopPropagation(),R(i.preventDefault())}),g(1,gBt,1,0,"ng-container",18),S()}if(n&2){let t,e=l(3),i=de(7);m("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(),m("ngTemplateOutlet",i)("ngTemplateOutletContext",P(6,R$,e.componentConfigSignal().newUserContact))}}function hBt(n,o){if(n&1&&(C(0,"div",20),g(1,pBt,4,3,"ng-container",21),D(2,"async"),g(3,uBt,2,8,"mat-option",16),S()),n&2){let t,e=l(2);d(),m("ngIf",O(2,2,e.componentConfigSignal().filteredUserContacts$)),d(2),m("ngIf",(t=e.componentConfigSignal().newUserContact)==null||t.contact==null?null:t.contact.email)}}function fBt(n,o){n&1&&Ue(0)}function vBt(n,o){if(n&1){let t=q();C(0,"mat-option",17),z("pointerdown",function(i){return k(t),i.stopPropagation(),R(i.preventDefault())})("pointerup",function(i){let r=k(t).$implicit,a=l(3);return i.stopPropagation(),a.onOptionClick(r),R(i.preventDefault())}),g(1,fBt,1,0,"ng-container",18),S()}if(n&2){let t=o.$implicit,e=o.index,i=l(3),r=de(7);m("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(),m("ngTemplateOutlet",r)("ngTemplateOutletContext",P(7,tw,t))}}function CBt(n,o){n&1&&Ue(0)}function _Bt(n,o){if(n&1){let t=q();C(0,"mat-option",19),z("pointerdown",function(i){return k(t),i.stopPropagation(),R(i.preventDefault())})("pointerup",function(i){return k(t),i.stopPropagation(),R(i.preventDefault())}),g(1,CBt,1,0,"ng-container",18),S()}if(n&2){let t,e=l(3),i=de(7);m("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(),m("ngTemplateOutlet",i)("ngTemplateOutletContext",P(6,R$,e.componentConfigSignal().newUserContact))}}function yBt(n,o){if(n&1&&(C(0,"div",33),g(1,vBt,2,9,"mat-option",23),D(2,"async"),g(3,_Bt,2,8,"mat-option",16),S()),n&2){let t,e=l(2);d(),m("ngForOf",O(2,3,e.componentConfigSignal().filteredUserContacts$))("ngForTrackBy",e.trackByUserContact),d(2),m("ngIf",(t=e.componentConfigSignal().newUserContact)==null||t.contact==null?null:t.contact.email)}}function SBt(n,o){if(n&1&&(C(0,"div",10),g(1,eBt,5,5,"cdk-virtual-scroll-viewport",11),D(2,"async"),g(3,hBt,4,4,"div",12)(4,yBt,4,5,"div",13),D(5,"async"),S()),n&2){let t,e,i=l();pe("s-comment-autocomplete-panel-dark",i.darkMode),x("data-testid",i.componentId+"-options-container"),d(),m("ngIf",(!i.componentConfigSignal().expandMentionGroups||(i.selectedAutocompleteData==null?null:i.selectedAutocompleteData.type)!=="contact")&&(((t=O(2,6,i.componentConfigSignal().filteredUserContacts$))==null?null:t.length)||0)>6),d(2),m("ngIf",i.componentConfigSignal().expandMentionGroups&&(i.selectedAutocompleteData==null?null:i.selectedAutocompleteData.type)==="contact"),d(),m("ngIf",(!i.componentConfigSignal().expandMentionGroups||(i.selectedAutocompleteData==null?null:i.selectedAutocompleteData.type)!=="contact")&&(((e=O(5,8,i.componentConfigSignal().filteredUserContacts$))==null?null:e.length)||0)<=6)}}function bBt(n,o){if(n&1&&w(0,"velt-autocomplete-option-internal",34),n&2){let t=o.$implicit,e=o.isNewContact,i=l();m("componentConfigSignal",i.componentConfigSignal)("selectorItem",t)("isNewContact",e)}}var Jp=(()=>{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 N(this.triggerElement);this.trigger=new KS(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,c,p,h,_,E,A,V,G,X,he){super(s,A,void 0,void 0,void 0,V,a),this.authService=e,this.autocompleteService=i,this.contactService=r,this.loggingService=a,this.elementRef=s,this.overlay=c,this.viewContainerRef=p,this.cd=h,this.directionality=_,this.viewportRuler=E,this.themeService=A,this.dynamicDataService=V,this.commentActionsService=G,this.commentService=X,this.metadataService=he,this.type="contact",this._enableOnFocus=!1,this.position="auto",this._excludeContacts=[],this.showAtHere=!1,this.optionSelected=new De,this.atHereSelected=new De,this.userContactOptionSelected=new De,this.customOptionSelected=new De,this.groupOptionSelected=new De,this.enterPressed=new De,this.userContacts=[],this.user=null,this.inputFilterFormControl=new Ote,this.oldText="",this.newText="",this.wordIndex=-1,this.deviceInfo=new Jn,this.userDocumentContacts=[],this.organizationGroups=[],this.subscriptions=[],this.veltId=xn(),this.veltElement=!0,this.componentConfigSignal=be({filteredUserContacts$:re([]),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(Ie=>{this.componentConfigSignal.update(Pe=>(Pe=T(I({},Pe),{customAutocompleteSearch:Ie}),Pe))})),this.subscriptions.push(this.authService.getUser$().subscribe(Ie=>{this.user=Ie,this.filterOptions()})),this.subscriptions.push(this.autocompleteService.getAutocompleteDataMap$().subscribe(Ie=>{this.autocompleteDataMap=Ie,this.filterOptions()})),this.subscriptions.push(this.inputFilterFormControl.valueChanges.pipe(jr(150),Kt()).subscribe(()=>{this.filterOptions()}))}catch(Ie){this.loggingService.catch("Error in AutocompletePanelComponent ngOnInit:",Ie)}}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(oi(this.triggerElement,"blur").subscribe(()=>{requestAnimationFrame(()=>this.closePanel())})):this.autocompletePanelInput&&this.subscriptions.push(oi(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 Rp,r=e?.toLowerCase()?.trim();i.email=r;let a=new RegExp(U.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(A=>A?.userId=="here")&&(s=[this.hereUserContact,...s]),s=s.filter(A=>!this.excludeContacts?.find(V=>V?.email===A?.email));let c=e?this._filterGroup(e):this.organizationGroups,p=s.map(A=>{let V=!1;return A.visibility==="here"&&(this.atHereDescription?(A.email=`${this.atHereDescription}`,A.description=this.atHereDescription):this.user?.organizationId&&(A.email=`${this.userDocumentContacts?.length||0} members`,A.description=`${this.userDocumentContacts?.length||0} members`)),{type:"contact",contact:A,disabled:V}}),h=c.map(A=>({type:"group",group:A})),_=[...p,...h];if(this.componentConfigSignal().expandMentionGroups){let A=[],V={},G=new Map;_.forEach(Ie=>{if(Ie.contact?.userId){let Pe=Rt(Ie.contact?.userId);G.set(Pe,Ie),V[Ie.contact?.userId]=!1}});let X=new Map;this.organizationGroups.forEach(Ie=>{X.set(Ie.metadata.clientGroupId,{id:Ie.metadata.clientGroupId,name:Ie.metadata.groupName,members:[],userIds:Object.keys(Ie.users||{})})}),X.forEach(Ie=>{Ie.userIds.forEach(Pe=>{let Be=G.get(Pe);Be&&(Ie.members.push(Be),Be.contact?.userId&&(V[Be.contact.userId]=!0))})}),_.forEach(Ie=>{Ie.type==="contact"&&Ie.contact?.userId&&!V[Ie.contact?.userId]&&A.push(Ie)});let he=Array.from(X.values());this.componentConfigSignal.update(Ie=>T(I({},Ie),{filteredUserContacts$:re(_),newUserContactError:a?void 0:"Invalid email",newUserContact:_.length?void 0:{type:"contact",contact:i},contactsWithoutGroup:A,groups:he}))}else this.componentConfigSignal.update(A=>T(I({},A),{filteredUserContacts$:re(_),newUserContactError:a?void 0:"Invalid email",newUserContact:_.length?void 0:{type:"contact",contact:i}}));let E=this.getViewport();if(E){let A=this.ITEM_SIZE*this.MAX_VISIBLE_ITEMS;E.style.height=`${A}px`,E.style.maxHeight=`${A}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$:re(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=yV(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 c={event:e,searchText:a,type:this.selectedAutocompleteData?.type};this.commentActionsService.autocompleteSearch(c)}}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(U.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,c=this.replaceWordAtCursor(a,s);this.optionSelected.emit(i),this.userContactOptionSelected.emit({text:c,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(U.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,c=this.replaceWordAtCursor(a,s);this.optionSelected.emit(i),this.userContactOptionSelected.emit({text:c,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 c=s.charAt(0);return this.selectedAutocompleteData?.hotkey===c?c:""};if(["safari","firefox"].includes(this.deviceInfo?.browserName?.toLowerCase())){let s=this.newText?.split(/\s+/)?.filter(_=>_),c=s[this.wordIndex];r=(a(c||"")||"")+i,s[this.wordIndex]=r;let h=s.join(" ");e.innerText=h}else{let s=this.autocompleteDataMap?Object.keys(this.autocompleteDataMap):["@"],c=yV(e,s);r=(a(c||"")||"")+i,$ie(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(je),u(Hs),u(gi),u(y),u(N),u(Ni),u(fi),u(Xt),u(Nr),u(Ms),u(Ye),u(b),u(ni),u(Te),u(fm))},o.\u0275cmp=M({type:o,selectors:[["velt-autocomplete-panel-internal"]],viewQuery:function(i,r){if(i&1&&(it(HLt,5),it(zLt,5),it(GLt,5),it(WLt,5)),i&2){let a;Ze(a=Xe())&&(r.matAutocomplete=a.first),Ze(a=Xe())&&(r.matAutocompleteTrigger=a.first),Ze(a=Xe())&&(r.autocompletePanelInput=a.first),Ze(a=Xe())&&(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:[j([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,KLt,3,8,"input",6),S()(),C(3,"mat-autocomplete",7,0),z("optionSelected",function(c){return k(a),R(r.onOptionSelected(c))}),g(5,SBt,6,10,"div",8),S(),g(6,bBt,1,3,"ng-template",null,1,xe)}if(i&2){let a=de(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(),m("ngIf",!r.hideInput),d(),m("autoActiveFirstOption",!0)("hideSingleSelectionIndicator",!0)("snippylyOverlay",a)("snippylyOverlayZIndex",2147483627)("displayWith",r.displayFn),d(2),m("veltIf",F(14,YLt,r.conditionSignal(),P(12,qLt,r.componentConfigSignal)))}},dependencies:[ht,K,ft,iR,_1,ef,$y,dO,Hy,tr,Qv,MC,se,Rk],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 IBt(n,o){if(n&1){let t=q();f(0),C(1,"div",23)(2,"div",24),te(3),S(),C(4,"div",25),z("click",function(){let i=k(t).$implicit,r=l();return R(r.removeSelectedUserToInvite(i))}),oe(),C(5,"svg",26),w(6,"path",7),S()()(),v()}if(n&2){let t=o.$implicit;d(3),$e((t==null||t.user==null?null:t.user.name)||(t==null||t.user==null?null:t.user.email))}}function EBt(n,o){if(n&1){let t=q();f(0),C(1,"div",31),z("click",function(){let i=k(t).$implicit,r=l(2);return R(r.selectRole(i))}),oe(),C(2,"svg",32),w(3,"path",33),S(),ct(),C(4,"div")(5,"h4"),te(6),D(7,"translate"),S(),C(8,"p"),te(9),D(10,"translate"),S()()(),v()}if(n&2){let t=o.$implicit,e=o.first,i=l(2);d(),pe("border-top",!e),d(),ot("visibility",(i.selectedUserRole==null?null:i.selectedUserRole.id)===(t==null?null:t.id)?"visible":"hidden"),d(4),$e(O(7,6,t==null?null:t.name)),d(3),$e(O(10,8,t==null?null:t.description))}}function xBt(n,o){if(n&1&&(C(0,"div",27)(1,"div",28),g(2,EBt,11,10,"ng-container",12),S(),te(3),D(4,"translate"),oe(),C(5,"svg",29),w(6,"path",30),S()()),n&2){let t=l();pe("disabled",!t.isUserAdmin),d(2),m("ngForOf",t.userRoles),d(),ve(" ",O(4,4,t.selectedUserRole==null?null:t.selectedUserRole.name)," ")}}function TBt(n,o){n&1&&(oe(),C(0,"svg",32),w(1,"path",44),S())}function wBt(n,o){if(n&1&&(C(0,"div",41),te(1),D(2,"translate"),g(3,TBt,2,0,"svg",43),S()),n&2){let t=l().$implicit,e=l(2);d(),ve(" ",O(2,2,t==null||t.role==null?null:t.role.name)," "),d(2),m("ngIf",e.isUserAdmin&&(t==null||t.user==null?null:t.user.email)!==(e.user==null?null:e.user.email))}}function DBt(n,o){if(n&1){let t=q();C(0,"div",28)(1,"div",45),z("click",function(){k(t);let i=l().$implicit,r=l(2);return R(r.removeUser(i))}),te(2),D(3,"translate"),S()()}n&2&&(d(2),ve(" ",O(3,1,"Remove")," "))}function ABt(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,wBt,4,4,"ng-template",null,1,xe)(9,DBt,4,3,"ng-template",null,2,xe),S()()(),v()),n&2){let t=o.$implicit,e=l(2);d(3),m("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),m("disabled",!(e.isUserAdmin&&(t==null||t.user==null?null:t.user.email)!==(e.user==null?null:e.user.email)))}}function OBt(n,o){n&1&&(f(0),C(1,"div"),te(2),D(3,"translate"),S(),v()),n&2&&(d(2),$e(O(3,1,"No users are added.")))}function MBt(n,o){if(n&1&&(C(0,"div",34)(1,"div",35),te(2),D(3,"translate"),S(),g(4,ABt,11,4,"ng-container",36)(5,OBt,4,3,"ng-container",37),S()),n&2){let t=l();d(2),$e(O(3,4,"People on this project")),d(2),m("ngForOf",t.documentUsers)("ngForTrackBy",t.trackByDocumentUserId),d(),m("ngIf",!(t.documentUsers!=null&&t.documentUsers.length))}}function PBt(n,o){if(n&1&&(f(0),C(1,"div",38)(2,"div",39),w(3,"snippyly-user-avatar",40),te(4),D(5,"translate"),S()(),v()),n&2){let t=o.$implicit;d(3),m("user",t)("background","#625DF5"),d(),ve(" ",O(5,3,(t==null?null:t.name)||(t==null?null:t.email))," ")}}function kBt(n,o){if(n&1&&(C(0,"div",38)(1,"div",39),w(2,"snippyly-user-avatar",40),te(3),D(4,"translate"),S(),C(5,"div",27),te(6),D(7,"translate"),S()()),n&2){let t=l().$implicit;d(2),m("user",t)("background","#625DF5"),d(),ve(" ",O(4,4,(t==null?null:t.name)||(t==null?null:t.email))," "),d(3),ve(" ",O(7,6,"Invited")," ")}}function RBt(n,o){if(n&1&&(f(0),g(1,kBt,8,8,"div",46),v()),n&2){let t=o.$implicit,e=l(2);d(),m("ngIf",!e.huddleUsersByEmailMap[t==null?null:t.email])}}function NBt(n,o){if(n&1&&(C(0,"div",34)(1,"div",35),te(2),D(3,"translate"),S(),g(4,PBt,6,5,"ng-container",36)(5,RBt,2,1,"ng-container",36),S()),n&2){let t=l();d(2),$e(O(3,5,"People on this huddle")),d(2),m("ngForOf",t.huddleUsers)("ngForTrackBy",t.trackByHuddleUserId),d(),m("ngForOf",t.huddleInvitees)("ngForTrackBy",t.trackByHuddleInviteeId)}}function FBt(n,o){if(n&1){let t=q();C(0,"div",47)(1,"div",48),te(2),D(3,"translate"),S(),C(4,"div",49)(5,"div",28)(6,"div",31),z("click",function(){k(t);let i=l();return R(i.changeDocumentAccessType(i.DocumentAccessTypes.PUBLIC))}),oe(),C(7,"svg",32),w(8,"path",33),S(),ct(),C(9,"div")(10,"h3"),te(11),D(12,"translate"),D(13,"titlecase"),S(),C(14,"p"),te(15),D(16,"translate"),S()()(),C(17,"div",45),z("click",function(){k(t);let i=l();return R(i.changeDocumentAccessType(i.DocumentAccessTypes.RESTRICTED))}),oe(),C(18,"svg",32),w(19,"path",33),S(),ct(),C(20,"div")(21,"h3"),te(22),D(23,"translate"),D(24,"titlecase"),S(),C(25,"p"),te(26),D(27,"translate"),S()()()(),oe(),C(28,"svg",32),w(29,"path",50)(30,"path",51)(31,"path",52),S(),ct(),C(32,"div",53)(33,"h3"),te(34),D(35,"translate"),D(36,"titlecase"),S(),C(37,"p"),te(38),D(39,"translate"),S()()()()}if(n&2){let t=l();d(2),$e(O(3,11,"General access")),d(5),ot("visibility",!t.documentAccessType||t.documentAccessType===t.DocumentAccessTypes.PUBLIC?"visible":"hidden"),d(4),$e(O(13,15,O(12,13,t.DocumentAccessTypes.PUBLIC))),d(4),$e(O(16,17,t.documentAccessTypeMap[t.DocumentAccessTypes.PUBLIC]==null?null:t.documentAccessTypeMap[t.DocumentAccessTypes.PUBLIC].description)),d(3),ot("visibility",t.documentAccessType===t.DocumentAccessTypes.RESTRICTED?"visible":"hidden"),d(4),$e(O(24,21,O(23,19,t.DocumentAccessTypes.RESTRICTED))),d(4),$e(O(27,23,t.documentAccessTypeMap[t.DocumentAccessTypes.RESTRICTED]==null?null:t.documentAccessTypeMap[t.DocumentAccessTypes.RESTRICTED].description)),d(8),$e(O(36,27,O(35,25,t.documentAccessType||t.DocumentAccessTypes.PUBLIC))),d(4),ve("",O(39,29,t.documentAccessTypeMap[t.documentAccessType?t.documentAccessType:t.DocumentAccessTypes.PUBLIC]==null?null:t.documentAccessTypeMap[t.documentAccessType?t.documentAccessType:t.DocumentAccessTypes.PUBLIC].description)," ")}}function LBt(n,o){n&1&&(oe(),C(0,"svg",54),w(1,"path",55),S())}function BBt(n,o){n&1&&(oe(),C(0,"svg",56),w(1,"path",57),S())}var Uue=(()=>{let o=class o{constructor(e,i,r,a,s,c,p,h,_,E,A){this.analyticsService=e,this.authService=i,this.configService=r,this.docService=a,this.documentUserAccessService=s,this.huddleService=c,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=di,this.isUserAdmin=!1,this.documentAccessTypeMap=U.DocumentAccessTypeMap,this.documentUserAccessList=!0,this.veltElement=!0;try{A&&(this.hideAccessControlDropdown=!!A.hideAccessControlDropdown,this.type=A.type,this.source=A.source,A.title&&(this.title=A.title),A.placeholder&&(this.placeholder=A.placeholder),this.documentUserAccessList=!!A.documentUserAccessList,this.inviteUrl=A.inviteUrl),this.subscriptions.push(this.authService.getUser$().subscribe(V=>{this.user=V})),this.subscriptions.push(this.iamService.isUserAdmin$().subscribe(V=>{this.isUserAdmin=V})),this.subscriptions.push(this.configService.getSF$().subscribe(V=>{V?this.documentAccessTypeMap=U.DocumentAccessTypeMapSF:this.documentAccessTypeMap=U.DocumentAccessTypeMap})),this.type!=="invite"&&this.subscriptions.push(this.documentUserAccessService.getDocumentUsers$().subscribe(V=>{this.documentUsers=V,this.updateExcludeContacts()})),this.type!=="invite"&&this.subscriptions.push(this.iamService.getRoles$().subscribe(V=>{this.userRoles=V,this.userRoles?.length&&(this.selectedUserRole=this.userRoles?.find(G=>G.name===mo.COMMENTER))})),this.type!=="invite"&&this.subscriptions.push(this.iamService.getDocumentIAM$().subscribe(V=>{this.documentAccessType=this.docService.getDocumentAccessType(V)})),this.type==="invite"&&(this.subscriptions.push(this.huddleService.getHuddleAttendees$().subscribe(V=>{this.huddleUsers=V,this.huddleUsersByEmailMap={},V.forEach(G=>{G.email&&(this.huddleUsersByEmailMap[G.email]=G)})})),this.subscriptions.push(this.huddleService.getHuddleInvitees$().subscribe(V=>{this.huddleInvitees=V})))}catch(V){this.loggingService.catch("Error in UserInviteDialogComponent constructor: ",V)}}ngOnInit(){try{this.dialogRef.addPanelClass("snippyly-user-invite-dialog"),this.userRoles?.length&&(this.selectedUserRole=this.userRoles?.find(e=>e.name===mo.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?Rt(e.email):Rt(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(Z.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===mo.ADMIN).map(a=>a.user.email),i=this.usersToInvite.filter(a=>a.role?.name===mo.COMMENTER).map(a=>a.user.email),r={actionType:dV.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(Z.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,vs(e),setTimeout(()=>{this.linkCopied=!1},2e3),this.type==="invite"?this.analyticsService.trackEvent(Z.Events.InviteDialog.INVITE_LINK_COPIED,{source:this.source}):this.type==="share"&&this.analyticsService.trackEvent(Z.Events.ShareDialog.SHARE_LINK_COPIED)}catch(e){this.loggingService.catch("Error in UserInviteDialogComponent copyLink: ",e)}}changeDocumentAccessType(e){try{this.documentAccessType!==e&&(this.analyticsService.trackEvent(Z.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(Qe),u(je),u($t),u(lt),u(Bue),u(mr),u(y),u(gn),u(_m),u(Ko),u(cl,8))},o.\u0275cmp=M({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),z("click",function(c){return k(a),R(c.stopPropagation())})("pointerdown",function(c){return k(a),R(c.stopPropagation())})("pointerup",function(c){return k(a),R(c.stopPropagation())}),C(1,"div",4)(2,"div",5),te(3),D(4,"translate"),S(),oe(),C(5,"svg",6),z("click",function(){return k(a),R(r.closeDialog())}),w(6,"path",7),S()(),ct(),C(7,"div",8),te(8),D(9,"translate"),C(10,"div",9)(11,"div",10)(12,"div",11),g(13,IBt,7,1,"ng-container",12),S(),C(14,"velt-autocomplete-panel-internal",13,0),D(16,"translate"),z("optionSelected",function(c){return k(a),R(r.onUserSelected(c))}),S()(),g(17,xBt,7,6,"div",14),S()(),g(18,MBt,6,6,"div",15)(19,NBt,6,7,"div",15)(20,FBt,40,31,"div",16),C(21,"div",17)(22,"div",18),z("click",function(){return k(a),R(r.copyLink())}),g(23,LBt,2,0,"svg",19)(24,BBt,2,0,"svg",20),te(25),D(26,"translate"),D(27,"translate"),S(),w(28,"div",21),C(29,"div",22),z("click",function(){return k(a),R(r.inviteSelectedUsers())}),te(30),D(31,"translate"),S()()()}i&2&&(d(3),ve(" ",O(4,15,r.title)," "),d(5),ve(" ",O(9,17,"Invite users")," "),d(5),m("ngForOf",r.usersToInvite),d(),m("placeholder",O(16,19,r.placeholder))("enableOnFocus",!1),d(3),m("ngIf",!r.hideAccessControlDropdown),d(),m("ngIf",r.documentUserAccessList&&(r.documentUsers==null?null:r.documentUsers.length)),d(),m("ngIf",(r.huddleInvitees==null?null:r.huddleInvitees.length)||(r.huddleUsers==null?null:r.huddleUsers.length)),d(),m("ngIf",r.isUserAdmin&&!r.hideAccessControlDropdown),d(3),m("ngIf",!r.linkCopied),d(),m("ngIf",r.linkCopied),d(),ve(" ",r.linkCopied?O(26,21,"Link Copied!"):O(27,23,"Copy Link")," "),d(4),pe("s-disabled",!(r.usersToInvite!=null&&r.usersToInvite.length)),d(),$e(O(31,25,"Send invite")))},dependencies:[ht,K,Un,wm,Jp,Nk,me],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 VBt(n,o){n&1&&(C(0,"div",4),oe(),C(1,"svg",5)(2,"g"),w(3,"path",6)(4,"path",7)(5,"path",8),S()()())}function UBt(n,o){if(n&1){let t=q();C(0,"div")(1,"slot",9),z("slotchange",function(){k(t);let i=l();return R(i.onButtonSlotChange())}),C(2,"div",10),oe(),C(3,"svg",11),w(4,"path",12),S()()()()}}var nw=(()=>{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,c){super(s,r,void 0,void 0,void 0,c,i),this.analyticsService=e,this.loggingService=i,this.themeService=r,this.dialog=a,this.elementRef=s,this.dynamicDataService=c,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(Z.Events.ShareDialog.SHARE_BUTTON_CLICKED),this.dialog.open(Uue,{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(Qe),u(y),u(Ye),u(Wi),u(N),u(b))},o.\u0275cmp=M({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:[j([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),z("click",function(){return r.openInviteDialog()}),C(1,"div",1),g(2,VBt,6,0,"div",2)(3,UBt,5,0,"div",3),S()()),i&2&&(d(),m("ngSwitch",r.type),d(),m("ngSwitchCase","invite"),d(),m("ngSwitchCase","share"))},dependencies:[ki,Gi],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 $Bt=["*"];function HBt(n,o){if(n&1&&(f(0),oe(),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 zBt(n,o){if(n&1&&(f(0),oe(),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 GBt(n,o){if(n&1){let t=q();f(0),C(1,"div",3),z("click",function(){k(t);let i=l();return R(i.openPermissionDeniedDialog())}),oe(),C(2,"svg",4),w(3,"rect",5)(4,"path",6),S(),ct(),f(5,0),g(6,HBt,4,1,"ng-container",1)(7,zBt,4,1,"ng-container",1),v(),S(),v()}if(n&2){let t=l();d(),pe("thread-mode",t.mode==="thread"),x("aria-expanded",!1)("data-testid",t.componentId+"-denied"),d(),x("data-testid",t.componentId+"-info-icon"),d(3),m("ngSwitch",t.type),d(),m("ngSwitchCase","video"),d(),m("ngSwitchCase","audio")}}function WBt(n,o){n&1&&(f(0),Pt(1),v())}var UC=(()=>{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(hm),u(y),u(Ye),u(N))},o.\u0275cmp=M({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:$Bt,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,GBt,8,8,"ng-container",1)(2,WBt,2,0,"ng-container",2),v()),i&2&&(m("ngSwitch",r.state),d(),m("ngSwitchCase","denied"))},dependencies:[ki,Gi,Xm],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 YBt(n,o){if(n&1){let t=q();C(0,"div",22),z("click",function(){k(t);let i=l().$implicit,r=l(2);return R(r.followUser(i))}),w(1,"snippyly-user-avatar",23),S()}if(n&2){let t=l().$implicit,e=l().ngIf;pe("s-current-user",(e.user==null?null:e.user.userSnippylyId)===(t==null?null:t.userSnippylyId)),d(),m("user",t)}}function KBt(n,o){if(n&1&&(f(0),g(1,YBt,2,3,"div",21),v()),n&2){let t=o.index,e=l().ngIf;d(),m("ngIf",t<e.maxAttendees)}}function ZBt(n,o){if(n&1&&(C(0,"button"),te(1),S()),n&2){let t=l().ngIf;d(),$e("+"+((t.attendees==null?null:t.attendees.length)-t.maxAttendees))}}function XBt(n,o){n&1&&(oe(),C(0,"svg",24),w(1,"path",25),S())}function QBt(n,o){n&1&&(oe(),C(0,"svg",26),w(1,"path",27)(2,"path",28),S())}function JBt(n,o){n&1&&(oe(),C(0,"svg",29),w(1,"path",30),S())}function eVt(n,o){n&1&&(oe(),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 tVt(n,o){n&1&&(f(0),oe(),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 nVt(n,o){n&1&&(oe(),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 iVt(n,o){n&1&&(oe(),C(0,"svg",26),w(1,"path",43)(2,"path",44)(3,"path",45)(4,"path",46),S())}function oVt(n,o){if(n&1&&g(0,nVt,10,0,"svg",11)(1,iVt,5,0,"svg",11),n&2){let t=l(2).ngIf;m("ngIf",!t.screenSharingState),d(),m("ngIf",t.screenSharingState)}}function rVt(n,o){if(n&1){let t=q();C(0,"button",8),z("click",function(){k(t);let i=l(2);return R(i.onToggleScreenSharingClick())}),C(1,"div",9),te(2),D(3,"translate"),D(4,"translate"),S(),g(5,tVt,11,0,"ng-container",34)(6,oVt,2,2,"ng-template",null,0,xe),S()}if(n&2){let t=de(7),e=l().ngIf;d(2),ve("",e.screenSharingState?O(3,3,"Stop sharing"):O(4,5,"Share screen")," "),d(3),m("ngIf",e.screenSharingDisabled)("ngIfElse",t)}}function aVt(n,o){n&1&&(oe(),C(0,"svg",26),w(1,"path",47),S())}function sVt(n,o){n&1&&(oe(),C(0,"svg",26),w(1,"path",48),S())}function lVt(n,o){if(n&1){let t=q();C(0,"button",8),z("click",function(){k(t);let i=l(2);return R(i.onToggleHuddleCursorModeClick())}),g(1,aVt,2,0,"svg",11)(2,sVt,2,0,"svg",11),S()}if(n&2){let t=l().ngIf;d(),m("ngIf",!t.huddleOnCursorMode),d(),m("ngIf",t.huddleOnCursorMode)}}function cVt(n,o){if(n&1){let t=q();C(0,"button",8),z("click",function(){k(t);let i=l(2);return R(i.toggleMessagesPanel())}),C(1,"div",9),te(2),D(3,"translate"),S(),oe(),C(4,"svg",17),w(5,"path",49),S()()}n&2&&(d(2),$e(O(3,1,"Chat with everyone")))}function mVt(n,o){if(n&1){let t=q();f(0),C(1,"div",2)(2,"div",3)(3,"div",4),g(4,KBt,2,1,"ng-container",5)(5,ZBt,2,1,"button",1),S(),C(6,"div",6)(7,"app-device-permission-button",7)(8,"button",8),z("click",function(){k(t);let i=l();return R(i.onToggleAudioClick())}),C(9,"div",9),te(10),D(11,"translate"),D(12,"translate"),S(),g(13,XBt,2,0,"svg",10)(14,QBt,3,0,"svg",11),S()(),C(15,"app-device-permission-button",12)(16,"button",8),z("click",function(){k(t);let i=l();return R(i.onToggleVideoClick())}),C(17,"div",9),te(18),D(19,"translate"),D(20,"translate"),S(),g(21,JBt,2,0,"svg",13)(22,eVt,7,0,"svg",11),S()(),g(23,rVt,8,7,"button",14)(24,lVt,3,2,"button",14),w(25,"snippyly-user-invite-tool-internal",15),D(26,"translate"),D(27,"translate"),g(28,cVt,6,3,"button",14),C(29,"button",16),z("click",function(){k(t);let i=l();return R(i.openMediaSourceOptionsDialog())}),C(30,"div",9),te(31),D(32,"translate"),D(33,"translate"),S(),oe(),C(34,"svg",17),w(35,"path",18),S()()(),ct(),C(36,"div",19)(37,"button",20),z("click",function(){k(t);let i=l();return R(i.onLeaveClick())}),te(38),D(39,"translate"),S()()()(),v()}if(n&2){let t=o.ngIf,e=l();d(4),m("ngForOf",t.attendees)("ngForTrackBy",e.trackByAttendeeId),d(),m("ngIf",(t.attendees==null?null:t.attendees.length)>t.maxAttendees),d(2),m("darkMode",!0),d(3),ve("",t.audioState?O(11,20,"Click to mute"):O(12,22,"Click to unmute")," "),d(3),m("ngIf",t.audioState),d(),m("ngIf",!t.audioState),d(),m("darkMode",!0),d(3),ve("",t.videoState?O(19,24,"Turn off video"):O(20,26,"Turn on video")," "),d(3),m("ngIf",t.videoState),d(),m("ngIf",!t.videoState),d(),m("ngIf",t.screenSharingSupported),d(),m("ngIf",!t.hideHuddleOnCursor),d(),m("title",O(26,28,"Invite users to join this huddle"))("placeholder",O(27,30,"Please select a contact to invite"))("hideAccessControlDropdown",!0),d(3),m("ngIf",t.chatEnabled),d(),m("disabled",!t.audioState&&!t.videoState),d(2),$e(!t.audioState&&!t.videoState?O(32,32,"Enable audio or video to change the settings"):O(33,34,"Change audio/video settings")),d(7),$e(O(39,36,"Leave"))}}var jue=(()=>{let o=class o{constructor(e,i,r,a,s,c){this.analyticsService=e,this.configService=i,this.flockService=r,this.huddleService=a,this.loggingService=s,this.dialog=c,this.attendees=[],this.toggleAudio=new De,this.toggleVideo=new De,this.toggleScreenSharing=new De,this.leave=new De,this.subscriptions=[],this.veltElement=!0,this.componentConfigSignal=be({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===Re.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(Z.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(Z.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(Z.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(Lue,{data:{settingsVisible:{audio:this.componentConfigSignal().audioState,video:this.componentConfigSignal().videoState}}}).afterClosed().pipe(Je(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(Qe),u($t),u(vc),u(mr),u(y),u(Wi))},o.\u0275cmp=M({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:[qe],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,mVt,40,38,"ng-container",1),i&2&&m("ngIf",r.componentConfigSignal())},dependencies:[ht,K,Un,nw,UC,me],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 $ue=(()=>{let o=class o{constructor(e,i){this.loggingService=e,this.dragDrop=i,this.currentX=0,this.currentY=0,this.destroy$=new et,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(io(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(io(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(m5))},o.\u0275dir=Bt({type:o,selectors:[["","veltDraggableOverlay",""]],inputs:{connectedOverlay:[0,"veltDraggableOverlay","connectedOverlay"]},standalone:!1});let n=o;return n})();var gVt=()=>["snippyly-overlay-panel","snippyly-huddle-menu-panel-overlay-panel"],uVt=()=>["snippyly-overlay-panel","snippyly-huddle-banner-panel"];function hVt(n,o){if(n&1){let t=q();C(0,"div",20),z("click",function(){k(t);let i=l(2);return R(i.onHuddleToolClick("audio"))}),C(1,"slot",21),z("slotchange",function(){k(t);let i=l(2);return R(i.onButtonSlotChange())}),C(2,"div",22),oe(),C(3,"svg",23),w(4,"path",24),S()()()()}}function fVt(n,o){if(n&1){let t=q();C(0,"div",20),z("click",function(){k(t);let i=l(2);return R(i.onHuddleToolClick("video"))}),C(1,"slot",21),z("slotchange",function(){k(t);let i=l(2);return R(i.onButtonSlotChange())}),C(2,"div",22),oe(),C(3,"svg",25),w(4,"path",26)(5,"path",27),S()()()()}}function vVt(n,o){if(n&1){let t=q();C(0,"div",20),z("click",function(){k(t);let i=l(3);return R(i.onHuddleToolClick("presentation"))}),C(1,"slot",21),z("slotchange",function(){k(t);let i=l(3);return R(i.onButtonSlotChange())}),C(2,"div",22),oe(),C(3,"svg",23),w(4,"path",28),S()()()()}}function CVt(n,o){n&1&&g(0,vVt,5,0,"div",7),n&2&&m("ngSwitchCase","presentation")}function _Vt(n,o){if(n&1){let t=q();C(0,"div",29,4)(2,"slot",21),z("slotchange",function(){k(t);let i=l(2);return R(i.onButtonSlotChange())}),C(3,"div",30),oe(),C(4,"svg",31),w(5,"path",24),S(),C(6,"svg",32),w(7,"path",33),S()()()()}if(n&2){let t=de(1);l();let e=de(8);m("matMenuTriggerFor",e),d(3),pe("active",t==null?null:t.menuOpen)}}function yVt(n,o){if(n&1){let t=q();C(0,"div",11),z("click",function(){k(t);let i=l(2);return R(i.onHuddleToolClick("presentation"))}),oe(),C(1,"svg",12),w(2,"path",34),S(),ct(),C(3,"span"),te(4),D(5,"translate"),S()()}if(n&2){let t=l().ngIf;m("disabled",t.disabled),d(4),$e(O(5,2,"Screen Huddle"))}}function SVt(n,o){if(n&1){let t=q();C(0,"snippyly-huddle-menu-panel",36),z("toggleAudio",function(){k(t);let i=l(3);return R(i.toggleAudio())})("toggleVideo",function(){k(t);let i=l(3);return R(i.toggleVideo())})("toggleScreenSharing",function(){k(t);let i=l(3);return R(i.toggleScreenSharing())})("leave",function(){k(t);let i=l(3);return R(i.dropCall())}),S()}if(n&2){let t=l(2).ngIf,e=de(24);m("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 bVt(n,o){if(n&1&&g(0,SVt,1,6,"snippyly-huddle-menu-panel",35),n&2){let t=l().ngIf;m("ngIf",t.meetingJoined)}}function IVt(n,o){if(n&1){let t=q();C(0,"div",38)(1,"div")(2,"div"),oe(),C(3,"svg",39),w(4,"path",40),S()(),ct(),C(5,"div")(6,"h3",41),te(7),D(8,"translate"),D(9,"translate"),D(10,"translate"),S(),C(11,"p",42),te(12),D(13,"translate"),S(),C(14,"div",43)(15,"button",44),z("click",function(){k(t);let i=l(3);return R(i.onJoinButtonClick())}),te(16,"Join"),S(),C(17,"button",45),z("click",function(){k(t);let i=l(3);return R(i.removeBanner())}),te(18,"Cancel"),S()()(),C(19,"div"),oe(),C(20,"svg",46),z("click",function(){k(t);let i=l(3);return R(i.removeBanner())}),w(21,"path",47),S()()()()}if(n&2){let t=l(2).ngIf;d(7),dr("",(t.huddleAttendees==null?null:t.huddleAttendees.length)===1?O(8,3,"1 person is"):(t.huddleAttendees==null?null:t.huddleAttendees.length)+" "+O(9,5,"people are")," ",O(10,7,"on a call now"),""),d(5),$e(O(13,9,"You can join the call"))}}function EVt(n,o){if(n&1&&g(0,IVt,22,11,"div",37),n&2){let t=l().ngIf;m("ngIf",t.isFirstComponent&&!t.meetingJoined&&!t.bannerRemoved&&(t.huddleAttendees==null?null:t.huddleAttendees.length))}}function xVt(n,o){if(n&1){let t=q();f(0),C(1,"div",6,0),g(3,hVt,5,0,"div",7)(4,fVt,6,0,"div",7)(5,CVt,1,1,"ng-template",8)(6,_Vt,8,3,"div",9),S(),C(7,"mat-menu",10,1)(9,"div",11),z("click",function(){k(t);let i=l();return R(i.onHuddleToolClick("audio"))}),oe(),C(10,"svg",12),w(11,"path",13),S(),ct(),C(12,"span"),te(13),D(14,"translate"),S()(),C(15,"div",11),z("click",function(){k(t);let i=l();return R(i.onHuddleToolClick("video"))}),oe(),C(16,"svg",12),w(17,"path",14)(18,"path",15),S(),ct(),C(19,"span"),te(20),D(21,"translate"),S()(),g(22,yVt,6,4,"div",16),S(),g(23,bVt,1,1,"ng-template",17,2,xe),w(25,"div",18,3),g(27,EVt,1,1,"ng-template",19,2,xe),v()}if(n&2){let t=o.ngIf,e=de(2),i=de(26),r=l();d(),m("ngSwitch",t.type),d(2),m("ngSwitchCase","audio"),d(),m("ngSwitchCase","video"),d(),m("ngIf",t.screenSharingSupported),d(),m("ngSwitchCase","all"),d(3),m("disabled",t.disabled),d(4),$e(O(14,21,"Audio Huddle")),d(2),m("disabled",t.disabled),d(5),$e(O(21,23,"Video Huddle")),d(2),m("ngIf",t.screenSharingSupported),d(),m("cdkConnectedOverlayOrigin",e)("cdkConnectedOverlayOpen",t.meetingJoined&&t.joinedHuddleToolComponentId===r.veltId)("cdkConnectedOverlayPanelClass",kt(25,gVt))("cdkConnectedOverlayBackdropClass","snippyly-overlay-backdrop")("cdkConnectedOverlayGrowAfterOpen",!0)("cdkConnectedOverlayPositions",t.positions)("cdkConnectedOverlayDisableClose",!0),d(4),m("cdkConnectedOverlayOrigin",i)("cdkConnectedOverlayOpen",t.isFirstComponent&&!t.meetingJoined&&!t.bannerRemoved&&!!(t.huddleAttendees!=null&&t.huddleAttendees.length))("cdkConnectedOverlayPanelClass",kt(26,uVt))("cdkConnectedOverlayPositions",t.positions)}}var N$=(()=>{let o=class o extends nt{constructor(e,i,r,a,s,c,p){super(p,c),this.analyticsService=e,this.authService=i,this.huddleService=r,this.iamService=a,this.loggingService=s,this.themeService=c,this.elementRef=p,this.type="audio",this.remoteStreams=[],this.huddleStarted=!1,this.initialHuddleType="audio",this.customButtonAdded=!1,this.subscriptions=[],this.veltId=xn(),this.veltElement=!0,this.componentConfigSignal=be({type:this.type,screenSharingSupported:!!navigator?.mediaDevices?.getDisplayMedia,disabled:!1,meetingJoined:!1,joinedHuddleToolComponentId:null,positions:U.OVERLAY_POSITIONS.map(h=>new Ri({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(Ne(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(U.TAGS.SNIPPYLY_HUDDLE_TOOL),i=document.querySelector(U.TAGS.VELT_HUDDLE_TOOL);i||e?i?this.veltId===i?.getAttribute(U.ATTRIBUTES.VELT_ID)&&(this.componentConfigSignal.update(r=>T(I({},r),{isFirstComponent:!0})),this.checkToAutoJoinHuddle()):this.veltId===e?.getAttribute(U.ATTRIBUTES.VELT_ID)&&(this.componentConfigSignal.update(r=>T(I({},r),{isFirstComponent:!0})),this.checkToAutoJoinHuddle()):(document.querySelector(U.TAGS.SNIPPYLY_PLUGIN)||document.querySelector(U.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(U.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(Z.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(Z.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 ee(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 Ip(1e3)),!this.componentConfigSignal().meetingJoined)if(this.componentConfigSignal().user&&!this.componentConfigSignal().meetingJoined){this.huddleService.setHuddleToolComponentId(this.veltId);let r=U.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(Z.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:BO.JOINED})):(this.huddleService.clearHuddleInvitees(),this.analyticsService.trackEvent(Z.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:BO.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 ee(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 ee(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(){vs(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(Qe),u(je),u(mr),u(gn),u(y),u(Ye),u(N))},o.\u0275cmp=M({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,qe],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,xVt,29,27,"ng-container",5),i&2&&m("ngIf",r.componentConfigSignal())},dependencies:[K,ki,Gi,jn,kn,ml,Bs,Cp,jue,$ue,me],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 TVt(n,o){if(n&1&&(C(0,"span",11),te(1),D(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):O(2,1,t.user==null||t.user.email==null?null:t.user.email.charAt(0)),"")}}function wVt(n,o){if(n&1){let t=q();C(0,"img",12),z("error",function(){k(t);let i=l(3);return R(i.onImageLoadError())}),S()}if(n&2){let t=l(2).ngIf;m("src",t.user==null?null:t.user.photoUrl,cn)}}function DVt(n,o){if(n&1&&(C(0,"span"),te(1),D(2,"translate"),S()),n&2){let t=l(2).ngIf;d(),$e(t.isRemoteStream?t.user==null||t.user.name==null?null:t.user.name.split(" ")[0]:O(2,1,"You"))}}function AVt(n,o){n&1&&(oe(),C(0,"svg",15),w(1,"path",16),S())}function OVt(n,o){n&1&&(oe(),C(0,"svg",17),w(1,"path",18)(2,"path",19),S())}function MVt(n,o){if(n&1&&(f(0),g(1,AVt,2,0,"svg",13)(2,OVt,3,0,"svg",14),v()),n&2){let t=l(2).ngIf;d(),m("ngIf",t.audioState),d(),m("ngIf",!t.audioState)}}function PVt(n,o){n&1&&(oe(),C(0,"svg",15),w(1,"path",16),S())}function kVt(n,o){n&1&&(oe(),C(0,"svg",17),w(1,"path",18)(2,"path",19),S())}function RVt(n,o){n&1&&(oe(),C(0,"svg",23),w(1,"path",24),S())}function NVt(n,o){n&1&&(oe(),C(0,"svg",17)(1,"g"),w(2,"path",25)(3,"path",19),S()())}function FVt(n,o){if(n&1){let t=q();C(0,"div",20),z("click",function(i){return k(t),R(i.stopPropagation())}),C(1,"div",21),z("click",function(){k(t);let i=l(3);return R(i.onToggleAudioClick())}),g(2,PVt,2,0,"svg",13)(3,kVt,3,0,"svg",14),S(),C(4,"div",21),z("click",function(){k(t);let i=l(3);return R(i.onToggleVideoClick())}),g(5,RVt,2,0,"svg",22)(6,NVt,4,0,"svg",14),S()()}if(n&2){let t=l(2).ngIf;d(2),m("ngIf",t.audioState),d(),m("ngIf",!t.audioState),d(2),m("ngIf",t.videoState),d(),m("ngIf",!t.videoState)}}function LVt(n,o){if(n&1){let t=q();C(0,"div",20),z("click",function(i){return k(t),R(i.stopPropagation())}),C(1,"div",21),z("click",function(){k(t);let i=l(3);return R(i.onToggleHuddleOnCursor())}),oe(),C(2,"svg",17),w(3,"path",26),S()()()}}function BVt(n,o){if(n&1){let t=q();C(0,"div",3),z("click",function(){k(t);let i=l(2);return R(i.toggleSelection())}),C(1,"div",4),w(2,"video",5),C(3,"div",6)(4,"span",7),D(5,"translate"),g(6,TVt,3,3,"span",8)(7,wVt,1,1,"ng-template",null,0,xe),S()(),C(9,"div",9),g(10,DVt,3,3,"span",1)(11,MVt,3,2,"ng-container",1),S()(),g(12,FVt,7,4,"div",10)(13,LVt,4,0,"div",10),S()}if(n&2){let t=de(8),e=l().ngIf,i=l();pe("local-stream",!e.isRemoteStream)("video-off",!e.videoState)("speaking",e.audioState)("selected",i.selected),d(2),pe("flip",!e.isRemoteStream),m("srcObject",e.isRemoteStream?e.remoteVideoStream:e.stream)("muted",e.isRemoteStream?null:"muted")("volume",e.isRemoteStream?1:0),d(2),ot("color",(e.user==null?null:e.user.color)+" !important")("background-color",(e.user==null?null:e.user.color)+" !important"),m("title",O(5,24,(e.user==null?null:e.user.name)||(e.user==null?null:e.user.email))),d(2),m("ngIf",e.showInitials)("ngIfElse",t),d(4),m("ngIf",e.user==null?null:e.user.name),d(),m("ngIf",e.isRemoteStream),d(),m("ngIf",!e.isRemoteStream),d(),m("ngIf",e.isRemoteStream)}}function VVt(n,o){if(n&1&&(f(0),g(1,BVt,14,26,"div",2),v()),n&2){let t=o.ngIf;d(),m("ngIf",t.isRemoteStream?t.remoteVideoStream:t.stream)}}var Hue=(()=>{let o=class o{get remoteStream(){return this._remoteStream}set remoteStream(e){this._remoteStream=e}constructor(e){this.loggingService=e,this.toggleAudio=new De,this.toggleVideo=new De,this.toggleHuddleOnCursor=new De,this.veltElement=!0,this.componentConfigSignal=be({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=M({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:[qe],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,VVt,2,1,"ng-container",1),i&2&&m("ngIf",r.componentConfigSignal())},dependencies:[K,me],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 jVt=(n,o,t)=>({large:n,medium:o,small:t});function $Vt(n,o){if(n&1){let t=q();C(0,"div",3),w(1,"video",4),C(2,"div",5)(3,"div",6),z("click",function(){k(t);let i=l(2);return R(i.onToggleScreenSharing())}),te(4),D(5,"translate"),S()()()}if(n&2){let t=l().ngIf;d(),m("srcObject",t.stream)("volume",0),d(3),$e(O(5,3,"Stop Sharing"))}}function HVt(n,o){if(n&1){let t=q();C(0,"div",7),w(1,"video",4),C(2,"div",5)(3,"div"),te(4),D(5,"translate"),S(),C(6,"div",8),oe(),C(7,"svg",9),z("click",function(){k(t);let i=l(2);return R(i.changeViewportSize("large"))}),w(8,"path",10)(9,"path",11),S(),C(10,"svg",12),z("click",function(){k(t);let i=l(2);return R(i.changeViewportSize("medium"))}),w(11,"path",13)(12,"path",14),S(),C(13,"svg",15),z("click",function(){k(t);let i=l(2);return R(i.changeViewportSize("small"))}),w(14,"path",16)(15,"path",17),S()()()()}if(n&2){let t=l().ngIf;m("ngClass",He(13,jVt,t.viewportSize==="large",t.viewportSize==="medium",t.viewportSize==="small")),d(),m("srcObject",t.stream)("volume",0),d(3),dr("",(t.user==null?null:t.user.name)||(t.user==null?null:t.user.email)," ",O(5,11,"is sharing now."),""),d(3),pe("selected",t.viewportSize==="large"),d(3),pe("selected",t.viewportSize==="medium"),d(3),pe("selected",t.viewportSize==="small")}}function zVt(n,o){if(n&1&&(f(0),g(1,$Vt,6,5,"div",1)(2,HVt,16,17,"div",2),v()),n&2){let t=o.ngIf;d(),m("ngIf",t.stream&&!t.isRemoteStream),d(),m("ngIf",t.stream&&t.isRemoteStream)}}var zue=(()=>{let o=class o{constructor(e){this.loggingService=e,this.isRemoteStream=!1,this.toggleScreenSharing=new De,this.viewportSizeChange=new De,this.veltElement=!0,this.componentConfigSignal=be({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=M({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:[qe],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,zVt,3,2,"ng-container",0),i&2&&m("ngIf",r.componentConfigSignal())},dependencies:[Rr,K,me],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 eg=(()=>{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 c in s){let p=Math.floor(a/s[c]);if(p>0)return`${p}${this.translateService.translate(c)}`}return e}catch{return e}}};o.\u0275fac=function(i){return new(i||o)(u(zs,16))},o.\u0275pipe=ao({name:"timeAgo",type:o,pure:!0,standalone:!1});let n=o;return n})();var tg=(()=>{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(Fe,16),u(Os,16))},o.\u0275pipe=ao({name:"safeHtml",type:o,pure:!0,standalone:!1});let n=o;return n})();function WVt(n,o){if(n&1&&(C(0,"div",21),te(1),D(2,"translate"),D(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)?O(2,1,"Me"):O(3,3,(t==null||t.from==null?null:t.from.name)||(t==null||t.from==null?null:t.from.email))," ")}}function qVt(n,o){n&1&&w(0,"velt-skeleton-loader-internal",22)}function YVt(n,o){if(n&1&&(f(0),C(1,"div",15),w(2,"snippyly-user-avatar",16),C(3,"div",17),g(4,WVt,4,5,"div",18)(5,qVt,1,0,"ng-template",null,1,xe),C(7,"div",19),te(8),D(9,"timeAgo"),S(),w(10,"div",20),D(11,"translate"),D(12,"safeHtml"),S()(),v()),n&2){let t=o.$implicit,e=de(6),i=l().ngIf;d(2),m("user",t==null?null:t.from),d(2),m("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),$e(O(9,5,t==null?null:t.timestamp)),d(2),m("innerHTML",O(12,9,O(11,7,(t==null?null:t.message)||"")),ji)}}function KVt(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),D(7,"translate"),S(),C(8,"div"),oe(),C(9,"svg",6),z("click",function(){k(t);let i=l();return R(i.toggleMessagesPanel())}),w(10,"path",7),S()()(),ct(),C(11,"div",8),g(12,YVt,13,11,"ng-container",9),S(),C(13,"div",10)(14,"textarea",11),D(15,"translate"),kr("ngModelChange",function(i){let r=k(t).ngIf;return zr(r.message,i)||(r.message=i),R(i)}),z("keydown.enter",function(i){k(t);let r=l();return i.preventDefault(),R(r.sendMessage())}),S(),C(16,"button",12),z("click",function(){k(t);let i=l();return R(i.sendMessage())}),oe(),C(17,"svg",13),w(18,"path",14),S()()()()(),v()}if(n&2){let t=o.ngIf,e=l();d(),pe("visible",t.messagesPanelVisible)("mobile",t.isPhone),d(5),$e(O(7,10,"In-call messages")),d(6),m("ngForOf",t.messages)("ngForTrackBy",e.trackByMessageId),d(2),Z_("placeholder",O(15,12,"Type here...")),Pr("ngModel",t.message),d(2),m("disabled",!(t.message!=null&&t.message.trim()))}}var que=(()=>{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=be({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((c,p)=>c?.timestamp-p?.timestamp),this.componentConfigSignal.update(c=>T(I({},c),{messages:s}))})),this.subscriptions.push(this.huddleService.getMessagesPanelVisible$().subscribe(s=>{this.componentConfigSignal.update(c=>T(I({},c),{messagesPanelVisible:s}))})),this.subscriptions.push(this.authService.getUser$().subscribe(s=>{this.componentConfigSignal.update(c=>T(I({},c),{user:s}))})),this.subscriptions.push(this.breakpointObserver.observe(Ei.XSmall).subscribe(s=>{s.matches?this.componentConfigSignal.update(c=>T(I({},c),{isPhone:!0})):this.componentConfigSignal.update(c=>T(I({},c),{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("&","&")),e.replaceAll(U.REGEX_URL,r=>new RegExp(U.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(je),u(mr),u(y),u(co))},o.\u0275cmp=M({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,KVt,19,14,"ng-container",2),i&2&&m("ngIf",r.componentConfigSignal())},dependencies:[ht,K,sa,$a,Ia,Un,yo,eg,tg,me],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}
|